@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --canvas: #F4F6F7;
  --surface: #FFFFFF;
  --text: #17212B;
  --muted: #4C5966;
  --action: #234D61;
  --action-hover: #163B4D;
  --selected: #E7EFF3;
  --border: #788793;
  --grid: #DCE2E6;
  --success: #176044;
  --success-bg: #E8F4EE;
  --error: #A12B32;
  --error-bg: #FDEBED;
  --warning: #795000;
  --warning-bg: #FFF4D6;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--canvas);
  color: var(--text);
  font-family: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  min-height: 100vh;
}
a { color: var(--action); }
code, .mono, .price, td.num { font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--grid);
}
.wordmark {
  font-weight: 600;
  font-size: 20px;
  color: var(--text);
  text-decoration: none;
}
.mode-switch { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.mode-switch button {
  min-height: 44px;
  min-width: 88px;
  border: 0;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.mode-switch button[aria-pressed="true"] {
  background: var(--selected);
  color: var(--action);
  font-weight: 600;
}
.search { flex: 1; min-width: 0; }
.search input, .field input, select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
.search input:focus, .field input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}
.nav-links { display: flex; gap: 16px; }
.nav-links a { text-decoration: none; color: var(--muted); }
.nav-links a.active { color: var(--action); font-weight: 600; }

.banner {
  background: var(--warning-bg);
  color: var(--warning);
  padding: 8px 16px;
  border-bottom: 1px solid var(--grid);
}

.desk { display: block; padding: 0 0 80px; }
.watchlist { display: none; }
.main { padding: 16px; }
.ledger { padding: 0 16px 16px; }
.seam {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.seam-top { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.symbol-name { font-size: 20px; font-weight: 600; line-height: 1.25; }
.price { font-size: 28px; font-weight: 500; line-height: 1.15; }
.seam-meta { color: var(--muted); font-size: 12px; font-weight: 500; margin-top: 4px; }
.chart-well {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 220px;
  position: relative;
  margin-bottom: 16px;
}
.chart-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  padding: 16px;
  text-align: center;
}
.section { background: var(--surface); border: 1px solid var(--grid); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.section h2 { font-size: 16px; margin: 0 0 4px; }
.plain { color: var(--muted); margin: 0 0 12px; font-size: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--grid); }
td.num, th.num { text-align: right; }
.chip {
  display: inline-block;
  height: 24px;
  line-height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  background: var(--selected);
  color: var(--action);
}
.chip.warning { background: var(--warning-bg); color: var(--warning); }
.chip.error { background: var(--error-bg); color: var(--error); }
.chip.success { background: var(--success-bg); color: var(--success); }

@media (max-width: 1023px) {
  .topbar .search { display: none; }
}
.sheet-toggle {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 48px;
  border: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
}
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 85vh;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  transform: translateY(110%);
  transition: transform 180ms ease-out;
  z-index: 20;
  display: flex;
  flex-direction: column;
}
.sheet.open { transform: translateY(0); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; }
.sheet-list { overflow: auto; }
.watch-row, .result-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 8px 16px;
  border: 0;
  border-bottom: 1px solid var(--grid);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.watch-row.selected { background: var(--selected); }

.footer { padding: 16px; color: var(--muted); font-size: 12px; }
.footer a { color: var(--muted); }
.btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--action); color: var(--surface); }
.btn.primary:hover { background: var(--action-hover); }
.btn.secondary { background: var(--surface); color: var(--action); border-color: var(--border); }
.card { background: var(--surface); border: 1px solid var(--grid); border-radius: 8px; padding: 16px; margin: 16px 0; }
.simple-page, .login-page { max-width: 36rem; margin: 0 auto; padding: 24px 16px; }
.login-page { max-width: 360px; }
.login-page h1 { font-size: 20px; }
.login-page label { display: block; margin: 16px 0 8px; }
.password-row { display: flex; gap: 8px; }
.form-error { color: var(--error); }
.results { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; margin-top: 4px; }
.trade-card { border-bottom: 1px solid var(--grid); padding: 12px 0; }
.honesty { display: grid; gap: 8px; }
.hidden { display: none !important; }

@media (min-width: 1024px) {
  .topbar { padding: 0 24px; }
  .search input { height: 40px; max-width: 320px; }
  .desk {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) 320px;
    padding-bottom: 0;
    min-height: calc(100vh - 56px);
  }
  .watchlist {
    display: block;
    background: var(--canvas);
    border-right: 1px solid var(--border);
    overflow: auto;
  }
  .main { padding: 24px; }
  .ledger { padding: 24px 16px; overflow: auto; }
  .chart-well { height: 420px; }
  .price { font-size: 32px; }
  .sheet-toggle, .sheet, .phone-search { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet { transition: none; }
  .btn.primary:active { transform: none; }
}
