/* ===========================================================================
   Throughline — design system ported from the Claude Design pages
   Fonts: Spectral (serif headings/figures) + Public Sans (body)
   Palette: cream #F7F2E7, ink navy #16243E, teal #1E8A82
   Teal underline accent under section titles is the recurring motif.
   =========================================================================== */

:root {
    --ink:        #16243E;   /* ink navy */
    --ink-text:   #1B2A44;   /* body text */
    --ink-soft:   #33425C;
    --ink-muted:  #5A6678;
    --muted:      #6A7689;
    --muted-2:    #8B94A4;
    --muted-3:    #9AA3B0;

    --teal:       #1E8A82;
    --teal-dark:  #167068;
    --teal-soft:  #E2F0EF;

    --cream:      #F7F2E7;   /* page background */
    --cream-2:    #FBF8F0;   /* inset panels, table headers */
    --cream-3:    #F1EBDB;   /* kanban columns, dividers */
    --paper:      #ffffff;

    --line:       #ECE4D2;   /* card borders */
    --line-2:     #EFE7D5;
    --line-3:     #F4EFE2;   /* row dividers */
    --line-input: #DDD4C0;

    --good:       #2F7A4E;
    --good-bg:    #E0F0E5;
    --warn:       #9A6A18;
    --warn-bg:    #FBEFD7;
    --danger:     #B3402F;
    --danger-bg:  #FBE9E5;
    --danger-bd:  #EBC4BC;
    --info:       #1E8A82;

    --radius:     14px;
    --radius-md:  12px;
    --radius-sm:  8px;
    --shadow-sm:  0 1px 2px rgba(22, 36, 62, .05);
    --shadow:     0 6px 24px rgba(22, 36, 62, .06);

    --serif: 'Spectral', Georgia, 'Times New Roman', serif;
    --sans:  'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Slim, cream-blended scrollbars */
* { scrollbar-width: thin; scrollbar-color: #e0d8c5 transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #e0d8c5;            /* a hair darker than the cream page so it's findable */
    border-radius: 8px;
    border: 2px solid var(--cream); /* the border lets the page color show through, slimming the thumb */
}
::-webkit-scrollbar-thumb:hover { background: #d3c9b1; }
::-webkit-scrollbar-corner { background: transparent; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--cream);
    color: var(--ink-text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--serif); color: var(--ink); font-weight: 600; line-height: 1.2; }
h1 { font-size: 27px; margin: 0 0 .2rem; }
h2 { font-size: 18px; margin: 0 0 .6rem; }
h3 { font-size: 16px; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }
::placeholder { color: var(--muted-3); }

/* Teal underline accent motif */
.section-title {
    display: inline-block;
    position: relative;
    padding-bottom: .55rem;
    margin-bottom: 1rem;
}
.section-title::after {
    content: "";
    position: absolute;
    left: 0; bottom: 0;
    width: 40px; height: 3px;
    background: var(--teal);
    border-radius: 2px;
}

/* ---- App shell (fixed sidebar + topbar; content is the scroll region) ----- */
.app { display: flex; height: 100vh; overflow: hidden; width: 100%; }

.sidebar {
    width: 228px; flex: none;
    background: var(--ink); color: #E8EDF4;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar .brand-block { padding: 26px 22px 18px; }
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--serif); font-size: 19px; font-weight: 600; color: #fff;
}
.sidebar .brand .mark {
    width: 26px; height: 26px; border-radius: 6px; background: var(--teal);
    position: relative; flex: none;
}
.sidebar .brand .mark::after {
    content: ""; position: absolute; left: 6px; top: 12px;
    width: 14px; height: 2px; background: var(--cream);
}
.sidebar .tag {
    font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
    color: #7E8CA3; margin-top: 6px; padding-left: 36px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; flex: 1; }
.sidebar nav a {
    display: flex; align-items: center; gap: 11px;
    color: #C4CFE0; padding: 10px 12px; border-radius: 8px;
    font-size: 13.5px; font-weight: 500;
}
.sidebar nav a .ico { width: 18px; text-align: center; opacity: .9; flex: none; }
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: rgba(30,138,130,.18); color: #fff; }
.sidebar nav a .nav-badge {
    margin-left: auto; background: var(--teal); color: #fff;
    font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 8px;
}
/* "Add note" call-to-action pinned to the bottom of the nav, above the divider.
   Outlined so it reads as a button but stays distinct from the teal "New case". */
.sidebar nav a.nav-cta {
    margin-top: auto; margin-bottom: 6px; justify-content: center; gap: .5rem;
    border: 1px solid #34435E; color: #C4CFE0; font-weight: 600;
}
.sidebar nav a.nav-cta:hover { background: rgba(255,255,255,.06); color: #fff; }
html.nav-collapsed .sidebar nav a.nav-cta { padding: 10px 0; }
.sidebar .foot { padding: 16px 20px; border-top: 1px solid #25344F; }
.sidebar .foot .portal-link { display: block; text-align: center; margin-top: 10px; font-size: 12px; color: #9DB0C9; }
.sidebar .foot .note { font-size: 11px; color: #6E7C94; margin-top: 12px; line-height: 1.5; }

/* Sidebar collapse */
.sidebar .brand-block { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar .brand-block .brand-main { min-width: 0; }
.nav-toggle {
    background: rgba(255,255,255,.06); border: 1px solid #25344F; color: #C4CFE0;
    width: 28px; height: 28px; border-radius: 6px; cursor: pointer; flex: none;
    display: flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1;
}
.nav-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }

html.nav-collapsed .sidebar { width: 62px; }
html.nav-collapsed .sidebar .brand-block { flex-direction: column; gap: 12px; padding: 22px 0 14px; }
html.nav-collapsed .sidebar .brand .brandname,
html.nav-collapsed .sidebar .tag,
html.nav-collapsed .sidebar nav a .lbl,
html.nav-collapsed .sidebar nav a .nav-badge,
html.nav-collapsed .sidebar .foot { display: none; }
html.nav-collapsed .sidebar nav { padding: 6px; }
html.nav-collapsed .sidebar nav a { justify-content: center; gap: 0; padding: 10px 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
    display: flex; align-items: center; justify-content: flex-end; gap: .8rem; flex: none;
    padding: 12px 36px; font-size: 12.5px; color: var(--muted);
    background: var(--cream); border-bottom: 1px solid var(--line);
}
.topbar .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--teal); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 13px;
}

.content { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 18px 36px 48px; width: 100%; max-width: 1180px; }
.content.wide { max-width: 100%; }
/* Pipeline: page-head/filter stay fixed; only the board panel scrolls. */
.content.content-board { max-width: none; overflow: hidden; display: flex; flex-direction: column; padding-bottom: 18px; }
.board-scroll { flex: 1; min-height: 0; overflow: auto; }
.board-scroll .kanban { min-width: max-content; padding-bottom: 8px; }

/* ---- Page header ---------------------------------------------------------- */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 20px; margin-bottom: 1.4rem; flex-wrap: wrap;
}
.page-head h1 { margin: 0; }
.page-head .underline { width: 46px; height: 3px; background: var(--teal); border-radius: 2px; margin-top: 9px; }
.page-head .lede { color: var(--muted); margin: .5rem 0 0; max-width: 620px; }

/* ---- Cards ---------------------------------------------------------------- */
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px 24px;
    margin-bottom: 1.2rem;
}
.card.tight { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 1rem; }
.card-head h2, .card-head h3 { margin: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Stat cards ----------------------------------------------------------- */
.stat {
    background: var(--paper); border: 1px solid var(--line);
    border-radius: var(--radius-md); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .value { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--ink); margin-top: 4px; line-height: 1; }
.stat .sub { font-size: 11.5px; color: var(--muted-3); margin-top: 6px; }

/* Navy stat (balances) */
.stat.navy { background: var(--ink); border-color: var(--ink); color: #fff; }
.stat.navy .label { color: #9DB0C9; }
.stat.navy .value { color: #fff; }
.stat.navy .sub { color: #9DB0C9; }

a.stat, button.stat { display: block; text-align: left; cursor: pointer; font: inherit; }

/* ---- Buttons -------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: .45rem;
    background: var(--teal); color: #fff;
    border: 1px solid var(--teal); border-radius: var(--radius-sm);
    padding: .6rem 1rem; font-size: 13.5px; font-weight: 600;
    cursor: pointer; text-decoration: none; line-height: 1.2;
    font-family: inherit; transition: background .12s ease;
}
.btn:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; text-decoration: none; }
.btn.navy { background: var(--ink); border-color: var(--ink); }
.btn.navy:hover { background: #0f1b30; }
.btn.secondary { background: var(--paper); color: var(--ink); border-color: var(--line-input); }
.btn.secondary:hover { background: var(--cream-2); color: var(--ink); }
.btn.soft { background: var(--cream-3); color: var(--ink); border-color: var(--cream-3); }
.btn.soft:hover { background: #e8dec6; }
.btn.ghost { background: transparent; color: var(--teal-dark); border-color: transparent; }
.btn.ghost:hover { background: rgba(30,138,130,.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #8F3022; }
.btn.sm { padding: .4rem .75rem; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.link-btn { background: none; border: none; color: var(--teal-dark); font-weight: 600; font-size: 12.5px; cursor: pointer; font-family: inherit; padding: 0; }

/* ---- Forms ---------------------------------------------------------------- */
label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: .35rem; font-weight: 600; }
.field { margin-bottom: 1rem; }
.field .hint { font-size: 11.5px; color: var(--muted-3); margin-top: .3rem; }
input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=date], input[type=number], select, textarea {
    width: 100%; padding: .6rem .7rem;
    border: 1px solid var(--line-input); border-radius: var(--radius-sm);
    font-family: inherit; font-size: 13.5px; color: var(--ink); background: var(--paper);
}
select { background: var(--cream-2); }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft);
}
textarea { resize: vertical; min-height: 84px; background: #FCFAF4; line-height: 1.55; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.checkbox { display: flex; align-items: center; gap: .5rem; }
.checkbox input { width: auto; }
.checkbox label { margin: 0; font-weight: 500; }

/* ---- Tables --------------------------------------------------------------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data thead th {
    text-align: left; color: var(--muted-2); font-weight: 600;
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
    padding: 13px 14px; background: var(--cream-2); border-bottom: 1px solid var(--line-2);
}
table.data td { padding: 14px; border-bottom: 1px solid var(--line-3); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--cream-2); }
.table-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-card table.data thead th:first-child { padding-left: 22px; }
.table-card table.data td:first-child { padding-left: 22px; }

/* ---- Badges / pills ------------------------------------------------------- */
.badge {
    display: inline-block; padding: 3px 11px; border-radius: 20px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
    background: var(--cream-3); color: var(--ink-soft);
}
.badge.teal   { background: var(--teal-soft); color: var(--teal); }
.badge.good   { background: var(--good-bg); color: var(--good); }
.badge.warn   { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: #F7E0DC; color: var(--danger); }
.badge.info   { background: var(--teal-soft); color: var(--teal); }
.badge.muted  { background: #EEE9DC; color: #7A7158; }
.badge.type   { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; padding: 3px 7px; border-radius: 5px; background: var(--cream-3); color: #3B4A66; }

/* ---- Flash messages ------------------------------------------------------- */
.flash { padding: .8rem 1.1rem; border-radius: var(--radius-md); margin-bottom: 1.1rem; font-size: 13.5px; border: 1px solid; }
.flash.success { background: var(--good-bg); border-color: #BFE0CC; color: #1f6b43; }
.flash.error   { background: var(--danger-bg); border-color: var(--danger-bd); color: #8F3022; }
.flash.info    { background: var(--cream-2); border-color: var(--line-2); color: var(--ink-soft); }

/* Alert banner (failed charges, intake) */
.alert { border-radius: var(--radius-md); padding: 14px 18px; margin-bottom: 16px; }
.alert.red { background: var(--danger-bg); border: 1px solid var(--danger-bd); }
.alert.red .alert-title { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 700; color: #8F3022; }
.alert.amber { background: var(--warn-bg); border: 1px solid #ECD9AE; color: #7A5A1E; font-size: 13px; }
.alert .bang {
    width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none;
}

/* ---- Empty states --------------------------------------------------------- */
.empty { text-align: center; padding: 2.4rem 1rem; color: var(--muted-2); font-size: 14px; }
.empty .big { font-size: 15px; color: var(--ink-soft); margin-bottom: .4rem; font-family: var(--serif); }

/* ---- Kanban --------------------------------------------------------------- */
.kanban { display: flex; gap: 14px; align-items: flex-start; }
.kanban .column { width: 248px; flex: none; background: var(--cream-3); border: 1px solid #E7DEC9; border-radius: var(--radius-md); padding: 10px; min-height: 120px; }
.kanban .column-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; }
.kanban .column-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.kanban .column-head .name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.kanban .column-head .count { font-size: 12px; color: var(--muted-2); font-weight: 600; }
.kanban .column-cards { display: flex; flex-direction: column; gap: 9px; }
.kanban .kcard { background: var(--paper); border: 1px solid #EAE2D0; border-radius: 10px; padding: 12px 13px; cursor: grab; box-shadow: var(--shadow-sm); }
.kanban .kcard:active { cursor: grabbing; }
.kanban .kcard.dragging { opacity: .5; }
.kanban .column.drop-target { outline: 2px dashed var(--teal); outline-offset: -4px; }
.kanban .kcard .client { font-size: 14px; font-weight: 600; color: var(--ink); }
.kanban .kcard .summary { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kanban .kcard .kfoot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--cream-3); font-size: 11.5px; }
.kanban .kcard .kfoot .bal { color: var(--teal); font-weight: 600; }
.kanban .col-toggle { background: none; border: none; color: var(--muted-2); cursor: pointer; font-size: 14px; line-height: 1; flex: none; padding: 0 2px; }
.kanban .col-toggle:hover { color: var(--ink); }

/* Collapsed kanban column */
.kanban .column.collapsed { width: 46px; padding: 10px 6px; }
.kanban .column.collapsed .column-cards { display: none; }
.kanban .column.collapsed .column-head { flex-direction: column; gap: 10px; padding: 2px 0; }
.kanban .column.collapsed .column-head .name { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }

/* ---- Progress bars -------------------------------------------------------- */
.progress { display: flex; gap: 4px; }
.progress .seg { flex: 1; height: 5px; border-radius: 3px; background: #E5DDC9; }
.progress .seg.on { background: var(--teal); }
.progress-label { font-size: 11.5px; color: var(--muted-2); margin-top: 7px; }
.bar { height: 6px; background: var(--cream-3); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--teal); }

/* ---- Tabs ----------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid #E2DAC7; margin-bottom: 1.2rem; flex-wrap: wrap; }
.tabs a, .tabs button {
    padding: 10px 14px; color: var(--muted); font-size: 13.5px; font-weight: 600;
    border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
    background: none; cursor: pointer; font-family: inherit;
    display: inline-flex; align-items: center; gap: 7px;
}
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs a.active, .tabs button.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.tabs .tab-count { font-size: 11px; font-weight: 700; background: var(--cream-3); color: var(--muted); border-radius: 20px; padding: 0 7px; }

/* ---- Definition list ------------------------------------------------------ */
dl.facts { display: grid; grid-template-columns: 130px 1fr; gap: .55rem 1rem; margin: 0; font-size: 13px; }
dl.facts dt { color: var(--muted-2); }
dl.facts dd { margin: 0; color: var(--ink-soft); font-weight: 500; }

/* ---- List rows ------------------------------------------------------------ */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 11px 2px; border-top: 1px solid var(--line-3); }
.list-row:first-child { border-top: none; }
.list-row .main { min-width: 0; }
.list-row .title { font-weight: 600; color: var(--ink-soft); font-size: 13.5px; }
.list-row .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-row .actions { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.list-row.done .title { color: var(--muted-3); text-decoration: line-through; }

/* Inset row pill (today/this-week dashboard items) */
.due-row { display: flex; align-items: center; gap: 13px; background: var(--cream-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 14px; }
.due-row .when { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; flex: none; }
.due-row .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

/* check box toggle (tasks/reminders) */
.check-box {
    width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-input);
    background: var(--paper); color: #fff; font-size: 12px; flex: none;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.check-box.on { background: var(--teal); border-color: var(--teal); }

/* doc/kind chip */
.kind-chip {
    width: 30px; height: 30px; border-radius: 7px; background: var(--cream-3);
    display: flex; align-items: center; justify-content: center; font-size: 14px; flex: none; color: var(--ink-soft);
}

/* ---- Intake (public) ------------------------------------------------------ */
.public-shell { max-width: 680px; margin: 0 auto; padding: 40px 22px 64px; }
.public-head { text-align: center; margin-bottom: 28px; }
.public-head .brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--ink); }
.public-head .brand .mark { width: 26px; height: 26px; border-radius: 6px; background: var(--teal); position: relative; }
.public-head .brand .mark::after { content: ""; position: absolute; left: 6px; top: 12px; width: 14px; height: 2px; background: var(--cream); }
.public-head .tag { color: var(--muted); margin-top: 10px; }
.public-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 32px 36px; box-shadow: var(--shadow); }

.steps { display: flex; gap: 8px; margin-bottom: 10px; }
.steps .step { flex: 1; height: 4px; border-radius: 3px; background: #E5DDC9; }
.steps .step.active, .steps .step.complete { background: var(--teal); }
.step-counter { font-size: 12px; color: var(--muted-2); margin-bottom: 18px; }
.step-panel { display: none; }
.step-panel.active { display: block; animation: tlFade .25s ease; }
@keyframes tlFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Dropzone ------------------------------------------------------------- */
.dropzone { border: 2px dashed #CBC2AC; border-radius: var(--radius); padding: 24px; text-align: center; color: var(--muted); background: #FCFAF4; cursor: pointer; }
.dropzone.hover { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.dropzone .files { margin-top: .8rem; font-size: 13px; color: var(--ink-soft); text-align: left; }

/* ---- Auth ----------------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--cream) 0%, #efe6d3 100%); }
.auth-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 32px; width: 100%; max-width: 400px; }
.auth-card .brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); }
.auth-card .brand .mark { width: 26px; height: 26px; border-radius: 6px; background: var(--teal); position: relative; }
.auth-card .brand .mark::after { content: ""; position: absolute; left: 6px; top: 12px; width: 14px; height: 2px; background: var(--cream); }
.auth-card .tag { color: var(--muted); margin: .4rem 0 1.4rem; }

/* ---- Portal --------------------------------------------------------------- */
.portal-shell { min-height: 100vh; display: flex; flex-direction: column; }
.portal-banner { background: var(--teal-soft); color: var(--teal-dark); text-align: center; font-size: 12px; padding: .4rem; }
.portal-header { background: var(--ink); color: #E8EDF4; }
.portal-header .inner { max-width: 1040px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; height: 66px; }
.portal-header .brand { display: flex; align-items: center; gap: 12px; font-family: var(--serif); font-size: 18px; font-weight: 600; color: #fff; }
.portal-header .brand .mark { width: 26px; height: 26px; border-radius: 6px; background: var(--teal); position: relative; flex: none; }
.portal-header .brand .mark::after { content: ""; position: absolute; left: 6px; top: 12px; width: 14px; height: 2px; background: var(--cream); }
.portal-header .brand .pchip { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #9DB0C9; border-left: 1px solid #34435E; padding-left: 12px; }
.portal-header .who { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #C7D2E2; }
.portal-header .who .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.portal-rule { height: 3px; background: var(--teal); }
.portal-content { max-width: 1040px; width: 100%; margin: 0 auto; padding: 34px 28px 56px; flex: 1; }
.portal-foot { margin-top: 36px; padding-top: 20px; border-top: 1px solid #E7DEC9; font-size: 12px; color: var(--muted-3); text-align: center; }

/* status headline card (portal cases) */
.case-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.case-card .ctype { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #3B4A66; }
.case-card .headline { font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 6px 0 0; color: var(--ink); }

/* ---- Modal ---------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(22,36,62,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(22,36,62,.3); overflow: hidden; }
.modal .modal-head { background: var(--ink); color: #fff; padding: 18px 24px; }
.modal .modal-head .eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #9DB0C9; }
.modal .modal-head .mtitle { font-family: var(--serif); font-size: 20px; font-weight: 600; margin-top: 3px; }
.modal .modal-body { padding: 22px 24px; }

/* ---- Misc ----------------------------------------------------------------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; }
.mb0 { margin-bottom: 0; }
.good { color: var(--good); }
.divider { height: 1px; background: var(--cream-3); margin: 16px 0; border: none; }
.inline-form { display: inline; }
.balance-pill { display: inline-block; padding: .35rem .8rem; border-radius: var(--radius-sm); background: var(--cream-3); font-weight: 700; font-family: var(--serif); }
.eyebrow { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); font-weight: 600; }

/* navy running-balance card (case detail) */
.balance-card { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 18px 20px; }
.balance-card .label { font-size: 12px; color: #9DB0C9; }
.balance-card .value { font-family: var(--serif); font-size: 26px; font-weight: 600; margin-top: 2px; }
.balance-card .sub { font-size: 12px; color: #9DB0C9; margin-top: 6px; }

/* case detail two-column */
.case-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.case-left { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 16px; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 1040px) {
    .case-grid { grid-template-columns: 1fr; }
    .case-left { position: static; }
}
@media (max-width: 1000px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; padding: .4rem; }
    .sidebar .brand-block { padding: 0 14px 0 8px; }
    .sidebar .tag, .sidebar .foot { display: none; }
    .sidebar nav { flex-direction: row; padding: 6px; }
    .sidebar nav a { white-space: nowrap; }
    /* Neutralize desktop collapse on narrow screens */
    .nav-toggle { display: none; }
    html.nav-collapsed .sidebar { width: 100%; }
    html.nav-collapsed .sidebar .brand .brandname,
    html.nav-collapsed .sidebar nav a .lbl { display: inline; }
    html.nav-collapsed .sidebar nav a { justify-content: flex-start; gap: 11px; padding: 10px 12px; }
    .content { padding: 16px; }
    .topbar { padding: 12px 16px 0; }
    .grid-2, .grid-3, .grid-4, .form-row, .form-row-3 { grid-template-columns: 1fr; }
    dl.facts { grid-template-columns: 1fr; gap: .15rem .5rem; }
    dl.facts dt { margin-top: .5rem; }
}
