/* EasyDocs dashboard design system — single source of truth for portal styling.
   Pages extend templates/dashboard_base.html and rely on these classes;
   page-specific rules stay in a {% block head_extra %} on that page. */

:root {
  --paper: #FBF8F1; --white: #FFFDF8; --cream: #F4EEE1; --chip: #F1EADA;
  --rule: #E4DDCB; --rule-l: #DCD4C1;
  --ink: #1B1A17; --ink2: #4E4B44; --ink3: #615D54; --ink4: #857F72;
  --red: #A8291F; --red-d: #7C1D16; --red-l: #F8E3DF;
  --amber: #7E6A0F; --amber-l: #FBE87F;
  --green: #1F4A33; --green-l: #DFEDE2;
  --blue: #2E4E75; --blue-l: #E2EAF3;
  --dark: #17160F; --gold: #E8C74E;
  --shadow: 0 1px 3px rgba(27,26,23,0.06), 0 1px 2px rgba(27,26,23,0.04);
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: Archivo, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; }
body { font-family: var(--font-body); background: var(--paper); color: var(--ink); font-size: 16px; }

/* ── Top navigation ─────────────────────────────────────────────── */
/* Two-row dark masthead (port 4/4, reskin design 2026-08-07): row 1 carries
   the drawn-paper logo + primary nav, row 2 carries search + firm identity.
   Kept as one .topnav element so the existing sticky/z-index behaviour and
   every {% if not hide_nav %} guard in dashboard_base.html still applies. */
.topnav { background: var(--dark); position: sticky; top: 0; z-index: 50; }
.topnav-inner { max-width: 1360px; margin: 0 auto; padding: 10px 24px 0; }
.topnav-row { display: flex; align-items: center; gap: 18px; min-width: 0; }
.topnav-row.row1 { padding-bottom: 10px; }
.topnav-row.row2 { padding: 10px 0; border-top: 1px solid #2A2820; gap: 14px; }
.topnav .logo-text { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 0 0 auto; }
.topnav .logo-text .logo-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.topnav .logo-text .logo-mark { font-family: var(--font-display); font-size: 26px; color: #FBF8F1; line-height: 1; }
.topnav .logo-text .logo-sub { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; color: #857F72; line-height: 1; }
.topnav .logo-text span { color: var(--red); }
/* Drawn paper logo: a folded sheet, a highlight stroke, a signed-off tick. */
.logo-icon { position: relative; width: 30px; height: 38px; flex: none; transform: rotate(-3.5deg); display: inline-block; }
.logo-icon .li-sheet { position: absolute; inset: 0; background: #FFFDF8; border: 1.5px solid #FFFDF8; border-radius: 2px; }
.logo-icon .li-fold { position: absolute; top: 0; right: 0; width: 8px; height: 8px; background: var(--dark); border-left: 1.5px solid #857F72; border-bottom: 1.5px solid #857F72; }
.logo-icon .li-hl { position: absolute; left: 4px; top: 12px; width: 12px; height: 5px; background: var(--gold); }
.logo-icon .li-line { position: absolute; left: 4px; top: 19px; width: 9px; height: 1.5px; background: #B5AF9F; }
.logo-icon .li-tick { position: absolute; right: -6px; bottom: -5px; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--red); background: #FFFDF8; color: var(--red); font-size: 7px; font-weight: 700; font-family: var(--font-mono); display: flex; align-items: center; justify-content: center; line-height: 1; }
.topnav nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; min-width: 0; }
.topnav nav a { color: #C9C3B4; text-decoration: none; font-size: 0.86rem; font-weight: 600; padding: 7px 10px; border-radius: 4px; white-space: nowrap; }
.topnav nav a:hover { color: #FBF8F1; background: rgba(255,253,248,0.08); }
.topnav nav a.active { color: var(--ink); background: #FBF8F1; font-weight: 600; }
.topnav .nav-search { width: 220px; min-width: 100px; padding: 7px 12px; border: 1px solid #4B463C; border-radius: 4px; font-size: 0.85rem; background: rgba(255,253,248,0.08); color: #FBF8F1; font-family: var(--font-body); }
.topnav .nav-search::placeholder { color: #857F72; }
.topnav .nav-search:focus { outline: none; border-color: #857F72; background: rgba(255,253,248,0.12); }
.topnav .nav-user { font-size: 0.8rem; color: #FBF8F1; white-space: nowrap; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: var(--dark); font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-firmname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
@media (max-width: 640px) {
  .topnav-inner { padding: 8px 14px 0; }
  .topnav-row { gap: 10px; }
  .topnav .nav-search { display: none; }
  .topnav nav { gap: 0; }
}

/* ── Layout ─────────────────────────────────────────────────────── */
.container { max-width: 1240px; margin: 40px auto 32px; padding: 0 20px; }
.container-narrow { max-width: 720px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
h1 { font-family: var(--font-display); font-size: 1.9rem; font-weight: 400; letter-spacing: -0.02em; }
/* 2026-08-13 (Zaff, walking the client overview): "the text for those headings
   is too close to the boxes - the heading text is squished". The global reset
   above zeroes every margin and h2 only ever set margin-bottom, so a section
   heading that follows a card sat flush against the box above it. Section
   headings now get room above; a heading that OPENS a card or the page hero
   keeps its tight spacing, because the container's own padding is the gap
   there and doubling it looks like a mistake in the other direction. */
h2 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700;
     margin-top: 30px; margin-bottom: 12px; }
h2:first-child,
.card h2,
.card-head h2,
.page-hero h2,
.stat-card h2 { margin-top: 0; }
.page-sub { color: var(--ink3); font-size: 0.9rem; margin-top: 4px; }

/* ── Cards & sections ───────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--rule); border-radius: 3px; padding: 24px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.card-head h2 { margin-bottom: 0; }
.card[data-href]:hover, a.card:hover { transform: translate(-1px, -2px); box-shadow: 4px 4px 0 rgba(27,26,23,0.18); cursor: pointer; }

/* ── Metric ribbon (daily home) ─────────────────────────────────── */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric { background: var(--white); border: 1px solid var(--rule); border-radius: 3px; padding: 14px 16px; text-decoration: none; display: block; }
.metric:hover { transform: translate(-1px, -2px); box-shadow: 4px 4px 0 rgba(27,26,23,0.18); }
.metric .num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.metric .num.warn { color: var(--amber); }
.metric .num.bad { color: var(--red-d); }
.metric .label { font-size: 0.84rem; color: var(--ink3); font-weight: 600; margin-top: 2px; }

/* ── Tables ─────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; }
th { text-align: left; font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink3); padding: 11px 14px; background: var(--cream); border-bottom: 1px solid var(--rule); }
td { padding: 11px 14px; border-bottom: 1px dashed var(--rule-l); font-size: 0.9rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--paper); }

/* ── Badges / status chips ──────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 2px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.badge-good { background: #DFEDE2; color: #1F4A33; }
.badge-attention, .badge-warn { background: #FBE87F; color: #7E6A0F; }
.badge-urgent, .badge-bad { background: #F8E3DF; color: #8C1F16; }
.badge-info { background: #E2EAF3; color: #2E4E75; }
.badge-none { background: var(--chip); color: var(--ink3); }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn { background: var(--red); color: var(--white); border: none; padding: 10px 20px; font-size: 0.9rem; font-weight: 700; border-radius: 4px; cursor: pointer; text-decoration: none; display: inline-block; font-family: var(--font-body); box-shadow: 3px 3px 0 var(--ink); }
.btn:hover { background: var(--red-d); box-shadow: 3px 3px 0 var(--ink); }
.btn-outline { background: var(--white); color: var(--ink); border: 1px solid var(--ink); box-shadow: none; }
.btn-outline:hover { background: var(--cream); box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-quiet { background: none; border: none; color: var(--ink3); font-size: 0.85rem; font-weight: 600; cursor: pointer; text-decoration: underline; box-shadow: none; }
.btn-quiet:hover { background: none; box-shadow: none; }

/* ── Action menu (replaces link clutter in table rows) ──────────── */
.actions-menu { position: relative; display: inline-block; }
.actions-menu summary { list-style: none; cursor: pointer; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 3px; font-size: 0.8rem; font-weight: 600; color: var(--ink2); background: var(--white); }
.actions-menu summary::-webkit-details-marker { display: none; }
.actions-menu[open] summary { background: var(--cream); }
.actions-menu .menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--white); border: 1px solid var(--rule); border-radius: 3px; box-shadow: 0 4px 14px rgba(27,26,23,0.1); min-width: 180px; z-index: 40; padding: 6px; }
.actions-menu .menu a { display: block; padding: 8px 10px; border-radius: 3px; color: var(--ink); text-decoration: none; font-size: 0.85rem; }
.actions-menu .menu a:hover { background: var(--cream); }

/* ── Tabs (client detail) ───────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 9px 16px; color: var(--ink3); text-decoration: none; font-size: 0.9rem; font-weight: 600; border: 1px solid transparent; border-bottom-color: transparent; margin-bottom: -1px; border-radius: 3px 3px 0 0; }
.tabs a:hover { color: var(--ink); background: var(--chip); }
.tabs a.active { color: var(--ink); background: var(--white); border: 1px solid var(--rule); border-bottom-color: var(--white); margin-bottom: -1px; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink2); margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 4px; font-size: 0.9rem; font-family: var(--font-body); background: var(--paper); }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--ink); }
.form-hint { font-size: 0.84rem; color: var(--ink3); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ── Empty states ───────────────────────────────────────────────── */
.empty-state { background: var(--white); border: 1px dashed var(--rule); border-radius: 3px; padding: 40px 24px; text-align: center; color: var(--ink3); }
.empty-state h2 { font-size: 1.05rem; color: var(--ink); margin-bottom: 6px; }
.empty-state p { font-size: 0.9rem; margin-bottom: 14px; }

/* ── Utility ────────────────────────────────────────────────────── */
.muted { color: var(--ink3); font-size: 0.85rem; }
.mono { font-family: var(--font-mono); font-size: 0.82rem; }
.kicker { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink3); }
.flash { padding: 12px 16px; border-radius: 3px; margin-bottom: 16px; font-size: 0.9rem; font-weight: 600; }
.flash-ok { background: #DFEDE2; color: #1F4A33; }
.flash-err { background: #F8E3DF; color: #8C1F16; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ── Clickable table rows (client list) ─────────────────────────── */
tr[data-href] { cursor: pointer; }
.client-link { color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--ink4); }
.client-link:hover { color: var(--red-d); border-bottom-color: var(--red-d); }

/* ── Design-system components transcribed from Zaff's reskin (design-dom/
   portal-screens/*.html), 2026-08-06. These are the SHARED chrome classes the
   design uses on every screen: page hero, stat cards, the gold overnight
   panel, chips and queue rows. Pages use these instead of per-page CSS so the
   flow is one system rather than a dozen dialects. ── */

.page-hero { display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin: 28px 0 22px; }
.page-hero .eyebrow { font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink3); }
.page-hero h1 { font-family: var(--font-display); font-weight: 400; font-size: 44px;
  line-height: 1.02; letter-spacing: -0.022em; margin: 10px 0 0; }
.page-hero .hero-sub { font-size: 16px; color: var(--ink2); margin: 8px 0 0; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-ghost { border: 1px solid var(--dark); background: var(--white); color: var(--dark);
  font-size: 14.5px; font-weight: 600; padding: 11px 18px; border-radius: 4px;
  cursor: pointer; text-decoration: none; display: inline-block; }
.btn-ghost:hover { background: var(--cream); }
.btn-primary-hard { background: var(--red); color: #fff; border: 0; font-size: 14.5px;
  font-weight: 600; padding: 11px 18px; border-radius: 4px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--dark); text-decoration: none; display: inline-block; }
.btn-primary-hard:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--dark); }

.workflow-strip { background: var(--white); border: 1px solid var(--rule); border-radius: 4px;
  padding: 16px 20px; margin-bottom: 22px; }
.workflow-strip-head { margin-bottom: 12px; }
.workflow-strip .eyebrow { font-family: var(--font-mono); font-size: 11.5px;
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink3); }
.workflow-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0; margin: 0; padding: 0; list-style: none; }
.workflow-stage { display: flex; align-items: center; gap: 9px; min-width: 0;
  padding: 8px 18px 8px 0; color: var(--ink2); font-size: 13.5px; }
.workflow-stage:not(:last-child)::after { content: "\2192"; margin-left: auto;
  color: var(--ink4); }
.workflow-stage-number { display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--cream);
  color: var(--ink3); font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; }
@media (max-width: 640px) {
  .workflow-stages { grid-template-columns: 1fr; }
  .workflow-stage { padding-right: 0; }
  .workflow-stage:not(:last-child)::after { content: "\2193"; }
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--white); border: 1px solid var(--rule); border-radius: 4px;
  padding: 18px 20px; text-decoration: none; display: block; color: inherit; }
.stat-card:hover { border-color: var(--dark); }
.stat-card .stat-label { font-family: var(--font-mono); font-size: 11.5px;
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink3); }
.stat-card .stat-num { font-family: var(--font-display); font-size: 40px; line-height: 1;
  margin: 10px 0 0; }
.stat-card .stat-num.warn { color: var(--amber); }
.stat-card .stat-num.bad { color: var(--red); }
.stat-card .stat-note { font-size: 13.5px; color: var(--ink2); margin: 8px 0 0; }

.split-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 20px; align-items: start; }
@media (max-width: 900px) { .split-main { grid-template-columns: 1fr; } }

.panel-gold { background: var(--gold); border-radius: 4px; padding: 20px 22px; }
.panel-gold .panel-eyebrow { font-family: var(--font-mono); font-size: 11.5px;
  letter-spacing: 0.11em; text-transform: uppercase; color: rgba(27,26,23,0.65); }
.panel-gold h3 { font-family: var(--font-display); font-weight: 400; font-size: 26px;
  line-height: 1.12; margin: 8px 0 14px; }
.panel-gold .panel-row { display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 0; font-size: 14px; }
.panel-gold .panel-row + .panel-row { border-top: 1px solid rgba(27,26,23,0.13); }
.panel-note { background: var(--white); border: 1px solid var(--rule); border-radius: 4px;
  padding: 16px 18px; margin-top: 16px; font-size: 13.5px; color: var(--ink2); }
.panel-note .panel-eyebrow { font-family: var(--font-mono); font-size: 11.5px;
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink3);
  display: block; margin-bottom: 8px; }

.queue-row { display: flex; align-items: center; gap: 14px; padding: 13px 0;
  border-bottom: 1px dotted var(--rule); flex-wrap: wrap; }
.queue-row:last-child { border-bottom: none; }
.queue-row .q-client { flex: 0 0 190px; font-weight: 600; font-size: 14.5px; }
.queue-row .q-client a { color: var(--ink); text-decoration: none; }
.queue-row .q-client a:hover { text-decoration: underline; }
.queue-row .q-what { flex: 1 1 220px; font-size: 14px; color: var(--ink2); }
.chip { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.09em;
  text-transform: uppercase; padding: 4px 9px; border-radius: 3px;
  background: var(--cream); color: var(--ink2); white-space: nowrap; }
.chip.chip-overdue { background: var(--red-l); color: var(--red-d); }
.chip.chip-review { background: var(--amber-l); color: var(--amber); }
.chip.chip-info { background: var(--blue-l); color: var(--blue); }
.card-foot-link { margin-top: 14px; text-align: right; font-size: 14px; }

/* Quiet secondary links in the masthead second row (Support / Account). */
.nav-quiet { color: #B5AF9F; font-size: 13px; text-decoration: none; margin-right: 14px; }
/* Hover must stay LIGHT: this sits on the dark masthead, and var(--ink) is
   near-black here — hovering made the link vanish (Zaff, 2026-08-07). */
.nav-quiet:hover { color: #FBF8F1; text-decoration: underline; }

/* Long-list containment (2026-08-07): pages must not grow with their data.
   The updates feed and the document-bank rail scroll inside themselves. */
.upd-scroll { max-height: 560px; overflow-y: auto; padding-right: 10px; }
.bank-rail { max-height: 78vh; overflow-y: auto; position: sticky; top: 90px; }
