/* 1099Tracks web app — one stylesheet, no build step (theme rule).
   Palette matches /portal (api/portal.py) so the two surfaces read as
   one product. Mobile-first; the sidebar becomes bottom tabs under 900px. */

:root {
  --ink: #1a1d21;
  --mut: #5c6470;
  --line: #e3e6ea;
  --brand: #176d3e;
  --brand-dk: #0f5230;
  --brand-soft: #e7f3ec;
  --bg: #f6f7f8;
  --card: #ffffff;
  --warn: #8a6d1a;
  --warn-soft: #fdf6e0;
  --err: #a33333;
  --err-soft: #fbecec;
  --income: #1c6fa8;
  --match: #1a64c8;   /* "Same as last time" — the iOS/Android blue match icon */
  --radius: 12px;
  --nav-w: 218px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg);
}
a { color: var(--brand-dk); }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 6px; }

.boot-splash { display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100vh; gap: 6px; }
.boot-mark { font-size: 24px; font-weight: 700; color: var(--brand-dk); }
.boot-sub { color: var(--mut); font-size: 14px; }

/* ---- app frame ---- */
.frame { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--nav-w); flex: none; background: var(--card);
  border-right: 1px solid var(--line); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .mark { font-size: 19px; font-weight: 700; color: var(--brand-dk);
  padding: 2px 10px 14px; }
.navlink {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 8px; color: var(--ink); text-decoration: none;
  font-size: 14.5px;
}
.navlink:hover { background: var(--bg); }
.navlink.active { background: var(--brand-soft); color: var(--brand-dk);
  font-weight: 600; }
.navlink .ico { width: 20px; text-align: center; }
.sidebar .spacer { flex: 1; }
.sidebar .whoami { padding: 8px 10px; font-size: 12.5px; color: var(--mut);
  border-top: 1px solid var(--line); }

.main { flex: 1; min-width: 0; padding: 22px 26px 80px; max-width: 1060px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--mut); font-size: 13.5px; }

/* ---- cards / grids ---- */
.card { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; }
.stat .lbl { font-size: 12.5px; color: var(--mut); margin-bottom: 2px; }
.stat .val { font-size: 21px; font-weight: 700; }
.stat .note { font-size: 12px; color: var(--mut); margin-top: 2px; }

/* ---- table-ish rows ---- */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 4px;
  border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.row .ttl { font-weight: 600; font-size: 14.5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 12.5px; color: var(--mut); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.row .amt { font-weight: 700; font-variant-numeric: tabular-nums;
  white-space: nowrap; }
.row .amt.income { color: var(--income); }
.row.clickable { cursor: pointer; }
.row.clickable:hover { background: var(--bg); }

/* ---- badges / chips ---- */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 1.5px 8px; border-radius: 999px; background: var(--bg);
  color: var(--mut); white-space: nowrap; }
.badge.biz { background: var(--brand-soft); color: var(--brand-dk); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.blue { background: #e8f1f8; color: var(--income); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); font-size: 13px; cursor: pointer; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff;
  font-weight: 600; }

/* ---- controls ---- */
button.primary, button.ghost, button.tiny, button.danger {
  font: inherit; cursor: pointer; border-radius: 8px; }
button.primary { padding: 9px 16px; font-weight: 600; color: #fff;
  background: var(--brand); border: none; }
button.primary:hover { background: var(--brand-dk); }
button.primary:disabled, button.ghost:disabled { opacity: .5; cursor: default; }
button.ghost { padding: 8px 13px; background: none; color: var(--ink);
  border: 1px solid var(--line); }
button.ghost:hover { background: var(--bg); }
button.tiny { padding: 4px 10px; font-size: 12.5px; background: none;
  border: 1px solid var(--line); }
button.tiny.approve { border-color: var(--brand); color: var(--brand-dk); }
button.tiny.approve:hover { background: var(--brand-soft); }
button.danger { padding: 8px 13px; background: none; border: 1px solid var(--err);
  color: var(--err); }
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); color: var(--ink);
}
label.f { display: block; font-size: 12.5px; color: var(--mut); margin: 10px 0 4px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 12px; }
.toolbar input[type="search"] { max-width: 260px; }
.toolbar select { width: auto; }

.msg { font-size: 13.5px; margin-top: 10px; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--brand-dk); }
.msg.warn { color: var(--warn); }
.empty { color: var(--mut); text-align: center; padding: 34px 10px;
  font-size: 14px; }
.spin { color: var(--mut); text-align: center; padding: 30px; }

/* ---- modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(20,24,28,.45);
  display: flex; align-items: center; justify-content: center; z-index: 40;
  padding: 16px; }
.modal { background: var(--card); border-radius: 14px; padding: 20px;
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; }
.modal h2 { margin-bottom: 4px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 18px; }
.tog { display: flex; align-items: center; gap: 8px; font-size: 13.5px;
  margin-top: 12px; cursor: pointer; }
.tog input { width: auto; }

/* ---- chat ---- */
.chat-wrap { display: flex; flex-direction: column;
  height: calc(100vh - 170px); min-height: 320px; }
.chat-log { flex: 1; overflow-y: auto; padding: 4px 2px; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 14px;
  margin-bottom: 10px; font-size: 14.5px; white-space: pre-wrap;
  overflow-wrap: break-word; }
.bubble.me { margin-left: auto; background: var(--brand); color: #fff;
  border-bottom-right-radius: 4px; }
.bubble.bot { background: var(--card); border: 1px solid var(--line);
  border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding-top: 10px; }
.chat-input textarea { resize: none; height: 46px; }

/* ---- quarters ---- */
.qgrid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px; }
.q { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.q.current { border-color: var(--brand); background: var(--brand-soft); }
.q .qn { font-size: 12px; color: var(--mut); font-weight: 600; }
.q .qa { font-size: 17px; font-weight: 700; margin-top: 2px; }
.q .qd { font-size: 11.5px; color: var(--mut); }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .frame { flex-direction: column; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    height: auto; width: auto; flex-direction: row; padding: 4px 6px;
    border-right: none; border-top: 1px solid var(--line); z-index: 30;
    overflow-x: auto; }
  .sidebar .mark, .sidebar .whoami, .sidebar .spacer { display: none; }
  .navlink { flex-direction: column; gap: 2px; font-size: 10.5px;
    padding: 6px 8px; flex: 1; text-align: center; }
  .main { padding: 16px 14px 96px; }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .qgrid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .chat-wrap { height: calc(100vh - 220px); }
}

/* ---- 2026-08-30 parity build ---- */
.hint { font-size: 12px; color: var(--mut); margin-top: 3px; }
.daterange { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.totals { display: flex; gap: 16px; align-items: center; padding: 10px 4px 2px;
  border-top: 2px solid var(--line); font-size: 13.5px; }
.totals .spacer { flex: 1; }
.totals .income { color: var(--income); }
.rowbtns { display: flex; gap: 6px; flex: none; }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px;
  flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 6px; font-size: 12.5px;
  color: var(--mut); padding: 4px 10px 4px 4px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); }
.steps li .n { width: 20px; height: 20px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
  background: var(--bg); }
.steps li.cur { color: var(--brand-dk); border-color: var(--brand); font-weight: 600; }
.steps li.cur .n { background: var(--brand); color: #fff; }
.steps li.done { color: var(--brand-dk); }
.steps li.done .n { background: var(--brand-soft); color: var(--brand-dk); }
.wizard { max-width: 720px; }
.wizard .actions { display: flex; gap: 10px; justify-content: space-between;
  margin-top: 18px; }
.plan { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan .tier { border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; background: var(--card); }
.plan .tier.pick { border-color: var(--brand); background: var(--brand-soft); }
.plan .price { font-size: 22px; font-weight: 700; }
.plan ul { padding-left: 18px; margin: 8px 0 0; font-size: 13.5px; }
.disclosure h3 { margin-top: 16px; }
.disclosure p { font-size: 14px; white-space: pre-wrap; margin: 0 0 6px; }
.disclosure p.summary { font-weight: 500; }
.disclosure details { margin: 0 0 6px; }
.disclosure details summary { cursor: pointer; font-size: 14px; color: var(--brand); margin: 2px 0 6px; }
.disclosure details[open] summary { margin-bottom: 6px; }
.samplecard { border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; background: var(--card); margin-bottom: 12px; }
.samplecard .why { font-size: 13px; color: var(--brand-dk); margin-top: 4px; }
.progress { height: 8px; border-radius: 999px; background: var(--line);
  overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--brand); transition: width .4s; }
.filedrop { border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 18px; text-align: center; color: var(--mut); font-size: 13.5px; }
.filedrop input { width: auto; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px;
  font-size: 13.5px; }
.kv .k { color: var(--mut); }
.tabsub { font-size: 12.5px; color: var(--mut); margin: -6px 0 10px; }
.receipt-img { max-width: 100%; max-height: 60vh; border-radius: 8px;
  border: 1px solid var(--line); }
@media (max-width: 900px) { .plan { grid-template-columns: 1fr; } }

/* ---- phone layout (Max, 2026-08-30, on-device): a row with an amount
   plus three buttons squeezed the merchant column to one letter per
   line. Under 600px the row wraps: text on line one, amount + buttons on
   line two, right-aligned. ---- */
@media (max-width: 600px) {
  .row { flex-wrap: wrap; row-gap: 6px; }
  .row .grow { flex: 1 1 100%; }
  .row .ttl, .row .sub { white-space: normal; }
  .row .amt { margin-left: auto; }
  .row .rowbtns { flex-wrap: wrap; }
  .row input[type="checkbox"] { order: -1; }
  .toolbar select, .toolbar input[type="search"] { max-width: 100%; }
  .modal .actions { flex-wrap: wrap; }
}
