/* TC Tracker, in the Envoy TC look: warm paper, white rounded cards, serif headlines, gold and charcoal accents. */
:root {
  --paper: #faf8f3;
  --surface: #ffffff;
  --sunken: #f2eee5;
  --ink: #1f2f26;
  --ink-btn: #1f2f26;
  --muted: #5b655d;
  --faint: #8a8f86;
  --line: #e8e2d6;
  --line-strong: #d2cabb;

  --blue: #2b4a3c;          /* brand ink: links and focus, a deep green-gray */
  --blue-press: #1f2f26;
  --blue-wash: #eceee6;
  --steel: #4b7bb0;         /* in-progress */
  --hl: #c9a87a;            /* champagne gold */
  --hl-wash: #f7f0e1;
  --hl-ink: #6b5430;
  --brown: #a8663a;
  --peach: #fdf1ec;
  --peach-line: #f0d5c8;
  --red: #c4452f;
  --red-wash: #fdebe6;
  --green: #2f6b57;
  --green-wash: #e4eee9;
  --charcoal: #1f2f26;

  --r-tag: 6px;
  --r-field: 8px;
  --r-panel: 14px;
  --rail: 244px;
  --font: 'Montserrat', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Playfair Display', 'Iowan Old Style', Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121714; --surface: #1a211d; --sunken: #232b26; --ink: #efebe2; --ink-btn: #efebe2; --muted: #a6a9ad; --faint: #767a7e;
    --line: #2b342e; --line-strong: #46514a;
    --blue: #d9be92; --blue-press: #e8d3ae; --blue-wash: #2a2a1f; --steel: #7aa6d8;
    --hl: #c9a87a; --hl-wash: #34301c; --hl-ink: #e3cb9f; --brown: #e0a67c; --peach: #33231d; --peach-line: #52372b;
    --red: #ff8573; --red-wash: #3a211d; --green: #6fc4a2; --green-wash: #1d3329; --charcoal: #0c100d;
  }
  .btn--primary, .seg button[aria-pressed='true'] { color: #121714; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 14px/1.5 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-family: var(--serif); font-size: 38px; line-height: 1.1; font-weight: 500; letter-spacing: -0.02em; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: 14.5px; font-weight: 600; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 22px 14px 14px; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 18px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__mark { width: 40px; height: 40px; flex: none; display: block; }
.brand__word { display: flex; flex-direction: column; gap: 6px; line-height: 1; }
.brand__word b { font-family: var(--serif); font-weight: 500; font-size: 21px; letter-spacing: 0.26em; margin-right: -0.26em; }
.brand__word small { font-size: 8px; font-weight: 500; letter-spacing: 0.32em; color: var(--muted); }
.wscard { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.wscard b { display: block; font-size: 14px; font-weight: 600; }
.wscard span { font-size: 12.5px; color: var(--muted); }
.wscard i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 600; font-size: 12px; background: var(--sunken); flex: none; }
.navlabel { margin: 16px 8px 6px; font-size: 11px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.nav { display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14.5px; }
.nav:hover { background: var(--sunken); color: var(--ink); text-decoration: none; }
.nav[aria-current='page'] { background: var(--sunken); color: var(--ink); font-weight: 600; }
.nav .count { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--green-wash); color: var(--green); }
.userbox { margin-top: auto; display: flex; align-items: center; gap: 11px; padding: 14px 8px 4px; border-top: 1px solid var(--line); }
.userbox .av { width: 34px; height: 34px; border-radius: 50%; background: var(--sunken); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.userbox .who { min-width: 0; flex: 1; font-size: 13px; line-height: 1.3; }
.userbox .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox .who span { color: var(--muted); font-size: 12px; }
.save { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: 12.5px; min-height: 18px; }
.save::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.save[data-state='saving']::before { background: var(--hl); box-shadow: 0 0 0 1px var(--line-strong); }
.main { min-width: 0; }
.crumbbar { position: sticky; top: 0; z-index: 9; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 58px; padding: 0 38px 0 38px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.crumbbar b { font-weight: 500; color: var(--ink); }
.crumbbar .sep { margin: 0 9px; color: var(--faint); }
.crumbbar .acts { display: flex; align-items: center; gap: 14px; }
.chip { padding: 4px 10px; border-radius: 6px; background: var(--green-wash); color: var(--green); font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.topbar, .tabbar { display: none; }
.page { max-width: 1200px; margin: 0 auto; padding: 34px 38px 80px; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page__head .sub { margin-top: 8px; color: var(--muted); max-width: 64ch; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 500; margin-bottom: 12px; }
.crumb:hover { color: var(--ink); text-decoration: none; }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 15px; border: 1px solid var(--line-strong); border-radius: var(--r-field); background: var(--surface); font-weight: 600; font-size: 14px; white-space: nowrap; }
.btn:hover { background: var(--sunken); text-decoration: none; }
.btn--primary { background: var(--ink-btn); border-color: var(--ink-btn); color: #fff; }
.btn--primary:hover { background: #34493c; border-color: #34493c; }
.btn--gold { background: var(--hl); border-color: var(--hl); color: #3d2f08; }
.btn--gold:hover { background: #dfc578; border-color: #dfc578; }
.btn--small { min-height: 30px; padding: 0 11px; font-size: 13px; }
.btn--quiet { border-color: transparent; background: transparent; color: var(--blue); }
.btn--quiet:hover { background: var(--blue-wash); }
.btn--danger { color: var(--red); border-color: var(--red); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.iconbtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--r-field); background: transparent; color: var(--muted); }
.iconbtn:hover { background: var(--sunken); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12.5px; color: var(--faint); }
input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='date'], input[type='search'], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-field);
  background: var(--surface); color: var(--ink); font: inherit; font-variant-numeric: tabular-nums;
}
textarea { min-height: 80px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.check { display: flex; align-items: center; gap: 9px; min-height: 32px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--blue); }
.grid { display: grid; gap: 16px 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span4 { grid-column: 1 / -1; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { min-height: 36px; padding: 0 14px; border: 0; border-right: 1px solid var(--line); background: transparent; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed='true'] { background: var(--ink-btn); color: #fff; }
.seg button:not([aria-pressed='true']):hover { background: var(--sunken); }

/* ---------- Tags ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: var(--r-tag); background: var(--sunken); color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.55; white-space: nowrap; }
.tag--code { background: var(--blue-wash); color: var(--blue); }
.tag--red { background: var(--red-wash); color: var(--red); }
.tag--hl { background: var(--hl-wash); color: var(--hl-ink); box-shadow: inset 0 0 0 1px #e6d391; }
.tag--green { background: var(--green-wash); color: var(--green); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border: 1px solid #dcb872; border-radius: 8px; font-size: 12.5px; font-weight: 500; background: var(--surface); }

/* ---------- The file strip: one cell per checklist item ---------- */
.strip { display: flex; gap: 1px; height: 12px; width: 100%; }
.strip i { flex: 1 1 0; min-width: 2px; border-radius: 2px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.strip .b-done { background: var(--green); box-shadow: none; }
.strip .b-progress { background: var(--steel); box-shadow: none; }
.strip .b-overdue { background: var(--red); box-shadow: none; }
.strip .b-pending { background: var(--hl); box-shadow: inset 0 0 0 1px #cdb560; }
.strip .b-optional { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.strip .b-exempt, .strip .b-na { background: repeating-linear-gradient(135deg, transparent 0 2px, var(--line) 2px 3px); box-shadow: none; }
.strip--lg { height: 20px; gap: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.legend .b-done { background: var(--green); box-shadow: none; } .legend .b-progress { background: var(--steel); box-shadow: none; }
.legend .b-overdue { background: var(--red); box-shadow: none; } .legend .b-pending { background: var(--hl); box-shadow: inset 0 0 0 1px #cdb560; }
.legend .b-exempt { background: repeating-linear-gradient(135deg, transparent 0 2px, var(--line-strong) 2px 3px); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Cards, tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.card__head h2 { display: flex; align-items: center; gap: 10px; }
.card__head .count { font-size: 12px; font-weight: 600; padding: 0 7px; border-radius: 6px; background: var(--sunken); color: var(--muted); }
.card__head a { font-size: 13.5px; color: var(--muted); }
.card__head a:hover { color: var(--ink); text-decoration: none; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { position: relative; flex: 1 1 260px; max-width: 360px; }
.toolbar .search svg { position: absolute; left: 12px; top: 11px; color: var(--faint); }
.toolbar .search input { padding-left: 36px; }
.toolbar select { width: auto; min-width: 150px; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.card .table { border: 0; border-radius: 0; }
.table th { text-align: left; padding: 12px 18px; font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 55%, var(--surface)); white-space: nowrap; }
.table td { padding: 16px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--paper) 60%, var(--surface)); }
.table .addr { font-weight: 600; color: var(--blue); display: block; font-size: 15px; }
.table .sub { color: var(--muted); font-size: 13px; }
.table .progress { width: 190px; }
.table .progress small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.table .flags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.table .next { max-width: 260px; }
.table .next b { font-weight: 500; display: block; }
.table .next small { color: var(--red); font-size: 12.5px; }
.empty { padding: 52px 24px; text-align: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-panel); }
.empty h2 { margin-bottom: 6px; font-family: var(--serif); font-size: 24px; font-weight: 500; }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto 18px; }

/* ---------- Dashboard ---------- */
.hero { margin-bottom: 26px; }
.hero h1 { font-size: 46px; margin: 10px 0 10px; }
.hero p { color: var(--muted); font-size: 15.5px; }
.searchcard { display: flex; align-items: center; gap: 14px; padding: 18px 22px; margin-bottom: 20px; }
.searchcard svg { color: var(--faint); flex: none; }
.searchcard input { border: 0; min-height: 36px; padding: 0; font-size: 15px; background: transparent; }
.searchcard input:focus-visible { outline: none; }
.searchcard .btn { background: #8d8f92; border-color: #8d8f92; color: #fff; }
.searchcard .btn:hover { background: #75777a; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { display: block; padding: 22px 24px 20px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.stat:hover { text-decoration: none; border-color: var(--line-strong); }
.stat .top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.stat .num { font-size: 38px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.stat small { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.stat .foot { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.stat--alert { background: var(--peach); border-color: var(--peach-line); }
.stat--alert .top, .stat--alert .num { color: var(--brown); }
.cols { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 22px; }
.prio { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.prio:last-child { border-bottom: 0; }
.prio input { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; margin: 0; }
.prio .t { font-weight: 500; font-size: 15px; }
.prio .m { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.prio .m a { color: var(--muted); }
.prio .m a:hover { color: var(--ink); }
.due { padding: 3px 9px; border-radius: 6px; background: var(--sunken); color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.due.is-late { background: var(--peach); color: var(--red); }
.more { padding: 12px 24px; border-top: 1px solid var(--line); }
.darkcard { position: relative; overflow: hidden; background: var(--charcoal); color: #f1efe8; border-radius: var(--r-panel); padding: 28px 28px 26px; border-top: 3px solid var(--hl); }
.darkcard .eyebrow { color: var(--hl); }
.darkcard h2 { font-family: var(--serif); font-size: 36px; font-weight: 500; line-height: 1.1; margin: 20px 0 8px; letter-spacing: -0.02em; }
.darkcard > p { color: #bdbab1; font-size: 13.5px; margin-bottom: 20px; }
.dl { margin-bottom: 22px; }
.dl a { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-top: 1px solid #36383d; color: #f1efe8; }
.dl a:hover { text-decoration: none; background: #2a2b30; }
.dl .d { text-align: center; line-height: 1.1; }
.dl .d b { display: block; font-size: 22px; font-weight: 500; font-family: var(--serif); }
.dl .d span { font-size: 11px; color: #a9a69d; letter-spacing: 0.08em; text-transform: uppercase; }
.dl .s { font-weight: 500; font-size: 14px; }
.dl small { display: block; color: #a9a69d; font-size: 12px; margin-top: 3px; }
.dl .strip { margin: 7px 0 2px; height: 8px; }
.dl .strip i { box-shadow: inset 0 0 0 1px #4a4c52; background: transparent; }
.dl .strip .b-done { background: #6fc4a2; box-shadow: none; } .dl .strip .b-overdue { background: #ff8573; box-shadow: none; }
.dl .strip .b-pending { background: var(--hl); box-shadow: none; } .dl .strip .b-progress { background: #8db3dd; box-shadow: none; }
.listing { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.listing .li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); align-items: center; }
.listing .li:last-child { border-bottom: 0; }
.fineprint { margin-top: 14px; font-size: 12.5px; color: var(--faint); }

/* ---------- File detail ---------- */
.fhead { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 26px 28px 22px; margin-bottom: 24px; }
.fhead h1 { font-size: 36px; }
.fhead__top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.fhead__tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.fhead__tags select { width: auto; min-height: 32px; padding: 3px 10px; font-weight: 500; }
.facts { display: flex; gap: 40px; flex-wrap: wrap; margin-bottom: 20px; }
.fact b { display: block; font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.fact span { font-size: 12.5px; color: var(--muted); }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line-strong); margin-bottom: 22px; }
.tab { padding: 11px 14px; border: 0; background: transparent; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected='true'] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

.ask { background: var(--hl-wash); border: 1px solid #ecdca2; border-radius: var(--r-panel); padding: 18px 22px; margin-bottom: 24px; }
.ask h2 { margin-bottom: 4px; font-family: var(--serif); font-size: 22px; font-weight: 500; }
.ask > p { color: var(--hl-ink); margin-bottom: 10px; }
.q { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid #ecdca2; }
.q .seg button { min-height: 30px; padding: 0 13px; }
.q input, .q select { min-width: 190px; }
.q small { display: block; color: var(--hl-ink); opacity: 0.8; }

.sec { margin-bottom: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.sec__head { display: flex; align-items: baseline; justify-content: space-between; padding: 15px 22px; border-bottom: 1px solid var(--line); }
.sec__head h3 { font-size: 15px; }
.sec__head span { color: var(--muted); font-size: 12.5px; }
.item { display: grid; grid-template-columns: 172px minmax(0, 1fr) 150px 34px; gap: 14px; align-items: start; padding: 13px 10px 13px 19px; border-bottom: 1px solid var(--line); background: var(--surface); border-left: 3px solid transparent; }
.item:last-child { border-bottom: 0; }
.item select { min-height: 34px; padding: 3px 9px; font-weight: 500; }
.item__title { font-weight: 500; font-size: 14.5px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.item__why { font-size: 13px; color: var(--muted); margin-top: 2px; }
.item__note { margin-top: 8px; }
.item__note textarea { min-height: 60px; }
.item__due { font-size: 13px; }
.item__due input { min-height: 34px; padding: 3px 9px; }
.item__due small { display: block; color: var(--faint); margin-top: 2px; }
.item.b-done .item__title > span:first-child { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.item.b-overdue { border-left-color: var(--red); }
.item.b-overdue .item__due { color: var(--red); font-weight: 600; }
.item.b-pending { background: var(--hl-wash); border-left-color: var(--hl); }
.item.b-progress { border-left-color: var(--steel); }
.item.b-exempt, .item.b-na { background: repeating-linear-gradient(135deg, var(--paper) 0 6px, color-mix(in srgb, var(--paper) 70%, var(--line)) 6px 7px); color: var(--muted); }
.stamp { animation: stamp 0.28s ease-out; }
@keyframes stamp { 0% { transform: scale(1.14); } 100% { transform: scale(1); } }

.formgrid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 24px 26px; margin-bottom: 20px; }
.formgrid > h2 { margin-bottom: 16px; font-family: var(--serif); font-size: 22px; font-weight: 500; }
.form-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 16px 0; background: linear-gradient(to top, var(--paper) 70%, transparent); }

.log { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.log li { list-style: none; display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.log li:last-child { border-bottom: 0; }
.log ul { margin: 0; padding: 0; }

/* ---------- Brokerages & templates ---------- */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.bro { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.bro h2 { display: flex; justify-content: space-between; gap: 10px; font-family: var(--serif); font-size: 22px; font-weight: 500; }
.tpl-item { display: grid; grid-template-columns: 110px minmax(0, 1fr) 170px; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.tpl-item:last-child { border-bottom: 0; }
.lede { font-size: 16px; line-height: 1.5; max-width: 64ch; margin-bottom: 22px; }
.lede b { font-weight: 600; }
.lede .red { color: var(--red); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr); }
.login__art { padding: 64px 60px; background: var(--charcoal); color: #f4f2ec; display: flex; flex-direction: column; justify-content: center; gap: 30px; border-top: 3px solid var(--hl); }
.login__logo { width: min(400px, 100%); height: auto; display: block; margin-bottom: 18px; }
.login__art h1 { font-size: 52px; line-height: 1.05; max-width: 14ch; color: #fff; }
.login__art p { max-width: 40ch; font-size: 16.5px; color: #bdbab1; }
.login__art .strip { max-width: 460px; height: 22px; gap: 3px; }
.login__art .strip i { box-shadow: inset 0 0 0 1px #55575d; background: transparent; }
.login__art .strip .b-done { background: #6fc4a2; box-shadow: none; }
.login__art .strip .b-pending { background: var(--hl); box-shadow: none; }
.login__art .strip .b-overdue { background: #ff8573; box-shadow: none; }
.login__art .strip .b-progress { background: #8db3dd; box-shadow: none; }
.login__form { padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 16px; max-width: 480px; width: 100%; margin: 0 auto; }
.login__form h2 { font-family: var(--serif); font-weight: 500; }
.error { padding: 10px 12px; border-radius: var(--r-field); background: var(--red-wash); color: var(--red); font-weight: 500; }
.notice { padding: 10px 12px; border-radius: var(--r-field); background: var(--green-wash); color: var(--green); font-weight: 500; }
.center { min-height: 60vh; display: grid; place-items: center; color: var(--muted); }

/* ---------- Dialog & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(18, 18, 20, 0.5); display: grid; place-items: center; padding: 16px; z-index: 50; }
.dialog { width: min(480px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); }
.dialog--wide { width: min(720px, 100%); }
.dialog__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.dialog__head h2 { font-family: var(--serif); font-size: 21px; font-weight: 500; }
.dialog__body { padding: 20px 22px; overflow: auto; }
.dialog__body p + p, .dialog__body p + .field { margin-top: 12px; }
.dialog__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }
.diff { width: 100%; border-collapse: collapse; font-size: 14px; }
.diff td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.diff td:last-child { text-align: right; white-space: nowrap; }
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { padding: 11px 16px; border-radius: 10px; background: var(--charcoal); color: #f4f2ec; font-weight: 500; max-width: 380px; box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.toast--error { background: var(--red); color: #fff; }

/* ---------- Phones & small screens ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login__art { padding: 36px 24px; } .login__art h1 { font-size: 36px; }
  .login__form { padding: 32px 24px; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; padding-bottom: 64px; }
  .rail, .crumbbar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
  .topbar .brand { padding: 0; }
  .topbar .brand__mark { width: 30px; height: 30px; }
  .topbar .brand__word b { font-size: 17px; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; color: var(--muted); font-size: 11.5px; font-weight: 500; }
  .tabbar a[aria-current='page'] { color: var(--ink); font-weight: 600; }
  .tabbar a:hover { text-decoration: none; }
  .page { padding: 22px 16px 56px; }
  h1 { font-size: 30px; }
  .hero h1 { font-size: 34px; }
  .fhead h1 { font-size: 28px; }
  .fhead { padding: 18px; }
  .stats { gap: 10px; }
  .stat { padding: 16px; }
  .stat .num { font-size: 30px; }
  .searchcard { padding: 12px 14px; }
  .searchcard .btn { display: none; }
  .prio { padding: 14px 16px; gap: 12px; }
  .card__head { padding: 14px 16px; }
  .darkcard { padding: 22px 20px; }
  .grid { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table { background: transparent; border: 0; }
  .card .table { border: 0; }
  .table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px 16px; margin-bottom: 10px; }
  .card .table tr { border-radius: 0; border-width: 0 0 1px; margin: 0; }
  .table td { border: 0; padding: 3px 0; }
  .table tbody tr:hover td { background: transparent; }
  .table .progress { width: auto; margin-top: 6px; }
  .table .hide-sm { display: none; }
  .table .flags { justify-content: flex-start; margin-top: 4px; }
  .facts { gap: 22px; }
  .item { grid-template-columns: 1fr 34px; }
  .item > .item__status { grid-column: 1 / 2; grid-row: 2; }
  .item > .item__main { grid-column: 1 / 2; grid-row: 1; }
  .item > .item__due { grid-column: 1 / 2; grid-row: 3; }
  .item > .item__more { grid-column: 2; grid-row: 1; }
  .tpl-item { grid-template-columns: 1fr; }
  .q { grid-template-columns: 1fr; }
  .log li { grid-template-columns: 1fr; gap: 2px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  #toasts { left: 12px; right: 12px; bottom: 74px; }
}
@media (prefers-reduced-motion: reduce) { .stamp { animation: none; } }
