/* Hand & Seal web app (SPEC.md §4.16): the concept mock's design system, ported. Plus Jakarta Sans self-hosted, light only, near-black on
   white with soft layered grey surfaces (tinted containers holding white cards; hairlines instead of shadows), sentence-case headings with
   tight tracking, filled-pill tabs, a few muted icon tiles, and ONE accent: Riso pink, used as a mark (dot, stripe, tile), never as text on
   white. Every page works at 360px and every target is at least 44px: where the mock draws a smaller control (buttons, icon buttons, tabs,
   nav rows) the element keeps its 44px box and a ::before draws the visible shape. No framework; no inline styles (strict CSP). */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/assets/PlusJakartaSans-var-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* ───────────── tokens ───────────── */
:root {
  --ink: #1d1d1d; --paper: #ffffff; --side: #f7f7f5; --soft: #f1f1ef; --tint: #f5f5f3; --line: #ececea; --line2: #e2e2de; --field: #8d8d88;
  --muted: #6b6b67; --body2: #3d3d3a; --faint: #a3a39e; --dot: #cdcdc8; --row-on: #e8e8e5; --row-hover: #eeeeeb;
  --pink: #ff58a8; --pink-tint: #ffe6f2; --yellow: #ffe14a; --slate: #56677f;
  --ok: #2c7a4f; --ok-bg: #eaf4ee; --warn: #8a5a00; --warn-bg: #fbf2df; --crit: #b3261e; --crit-bg: #fcecea;
  --pop: var(--pink); --accent: var(--crit);
  --r-card: 16px; --r-ctl: 10px; --side-w: 264px; --side-mini: 76px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* ───────────── base ───────────── */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; }
h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; overflow-wrap: anywhere; }
.num, .hero-n { font-variant-numeric: tabular-nums; }

/* ───────────── the shell: a faint-grey sidebar beside a white canvas ───────────── */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; padding: 16px 14px 24px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 0 8px; min-height: 44px; }
.side-top a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
.wordmark img { height: 25px; width: auto; display: block; }
.appmark { display: none !important; justify-content: center; }
.appmark img { width: 30px; height: 30px; display: block; }
.side .nav-close { display: none; }
.firmcard { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); min-width: 0; }
.firmcard .grow { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.firmcard b { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.mg { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--side); display: inline-grid; place-items: center; font-weight: 700; font-size: 11px;
  letter-spacing: 0.01em; flex: none; color: var(--ink); }
.nav { display: flex; flex-direction: column; gap: 0; }
.nav a { position: relative; isolation: isolate; display: flex; align-items: center; gap: 11px; padding: 0 9px; min-height: 44px; color: var(--ink); text-decoration: none;
  font-weight: 500; font-size: 14px; letter-spacing: -0.01em; }
.nav a::before { content: ""; position: absolute; inset: 3px 0; border-radius: 10px; z-index: -1; }
.nav a:hover::before { background: var(--row-hover); }
.nav a[aria-current="page"] { font-weight: 600; }
.nav a[aria-current="page"]::before { background: var(--row-on); }
.nav a > .ico { color: #4a4a47; width: 18px; height: 18px; margin: 0 3px; }
.nav .tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .n { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.nav a[aria-current="page"] .n { color: #4a4a47; }
.tile { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none; color: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); }
.tile .ico { width: 14px; height: 14px; stroke-width: 2.2; }
.t-ink { background: var(--ink); } .t-pink { background: var(--pink); } .t-yellow { background: var(--yellow); color: var(--ink); } .t-slate { background: var(--slate); }
.grp { display: flex; flex-direction: column; margin-top: 2px; }
.grp-h { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0 9px; min-height: 44px; font: 500 13px var(--font); color: var(--muted); text-align: left;
  border-radius: 8px; cursor: pointer; width: fit-content; }
.grp-h:hover { color: var(--ink); }
.grp-h .ico { width: 14px; height: 14px; transition: transform 0.15s; }
.grp-h[aria-expanded="false"] .ico { transform: rotate(-90deg); }
.grp-h[aria-expanded="false"] + .grp-b { display: none; }
html:not(.js) .grp-h { pointer-events: none; }
html:not(.js) .grp-h .ico { display: none; }
.grp-b { display: flex; flex-direction: column; }
.tree { margin-left: 21px; padding-left: 12px; border-left: 1px solid var(--line2); display: flex; flex-direction: column; }
.tree a { font-size: 13.5px; color: var(--body2); }
.tree a .ico { width: 16px; height: 16px; color: #4a4a47; margin: 0; }

/* the header: breadcrumbs with icons; search, Ask, reminders and the person's menu on the right */
.top { display: flex; align-items: center; gap: 4px; padding: 6px 24px 6px 32px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px); min-height: 58px; }
.top .spacer { flex: 1; }
.bc { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; color: var(--muted); }
.bc .c { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap; min-height: 44px; min-width: 0; }
.bc a.c:hover span:last-child { color: var(--ink); }
.bc .cur { color: var(--ink); font-weight: 600; }
.bc .cur-m { display: none; }
.bc .tt { overflow: hidden; text-overflow: ellipsis; }
.bc .sep { color: var(--faint); display: inline-flex; }
.bc .sep .ico { width: 14px; height: 14px; }
.bc .mg { width: 22px; height: 22px; border-radius: 6px; font-size: 9.5px; }
.bc .ci { width: 22px; height: 22px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; flex: none; color: var(--body2); }
.bc .ci .ico { width: 13px; height: 13px; }
.iconbtn { position: relative; isolation: isolate; width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: none; color: var(--body2);
  cursor: pointer; padding: 0; flex: none; text-decoration: none; }
.iconbtn::before { content: ""; position: absolute; inset: 5px; border: 1px solid var(--line2); border-radius: 9px; background: var(--paper); z-index: -1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.iconbtn:hover::before { background: var(--side); }
.iconbtn:focus-visible { outline: none; }
.iconbtn:focus-visible::before { outline: 2px solid var(--ink); outline-offset: 1px; }
.iconbtn .badge { position: absolute; top: 11px; right: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 2px #fff; }
.menu-btn { display: none; margin-left: -6px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--soft); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; font-size: 11.5px; flex: none; }
.me { position: relative; }
.me > summary { list-style: none; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; border-radius: 50%; }
.me > summary::-webkit-details-marker { display: none; }
.me > summary:hover .avatar, .me[open] > summary .avatar { border-color: var(--line2); background: var(--line); }
.me-pop { position: absolute; right: 0; top: calc(100% + 6px); width: 248px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; z-index: 30; }
.me-h { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; line-height: 1.35; }
.me-h b { font-weight: 600; }
.me-pop a, .me-pop button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 9px; border: 0; background: none; width: 100%;
  text-decoration: none; font-weight: 500; cursor: pointer; text-align: left; }
.me-pop a:hover, .me-pop button:hover { background: var(--side); }
.me-pop form { margin: 0; }

main { padding: 32px 32px 64px; max-width: 1260px; width: 100%; display: flex; flex-direction: column; gap: 24px; min-width: 0; }

/* the collapsed sidebar (desktop; remembered in this browser) */
html.mini .app { grid-template-columns: var(--side-mini) minmax(0, 1fr); }
html.mini .side { padding: 16px 12px 24px; align-items: stretch; }
html.mini .side-top { flex-direction: column; padding: 0; gap: 4px; }
html.mini .wordmark { display: none; }
html.mini .appmark { display: inline-flex !important; }
html.mini .collapse .ico { transform: rotate(180deg); }
html.mini .firmcard { justify-content: center; padding: 6px; }
html.mini .firmcard .grow, html.mini .grp-h, html.mini .tree, html.mini .nav .n { display: none; }
html.mini .grp { margin-top: 0; border-top: 1px solid var(--line); padding-top: 6px; }
html.mini .nav a { justify-content: center; padding: 0; }
html.mini .nav .tx { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html:not(.js) .collapse { display: none; }

/* phones and small tablets: the sidebar is a sheet from the left; the header's Menu opens it, Back closes it first */
@media (max-width: 63.99rem) {
  .app, html.mini .app { grid-template-columns: minmax(0, 1fr); }
  html.mini .side { padding: 14px 14px 24px; }
  html.mini .side-top { flex-direction: row; padding-left: 8px; }
  html.mini .wordmark { display: inline-flex; }
  html.mini .appmark { display: none !important; }
  html.mini .firmcard .grow { display: flex; }
  html.mini .grp-h, html.mini .tree { display: flex; }
  html.mini .nav .n { display: inline; }
  html.mini .nav a { justify-content: flex-start; padding: 0 9px; }
  html.mini .nav .tx { position: static; width: auto; height: auto; clip: auto; }
  html.mini .grp { border-top: 0; padding-top: 0; margin-top: 8px; }
  .collapse { display: none; }
  .menu-btn { display: inline-grid; }
  html.js .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); height: auto; z-index: 50; transform: translateX(-100%); visibility: hidden;
    transition: none; box-shadow: none; }
  html.js .side.open { transform: none; visibility: visible; transition: transform 0.2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, 0.14); }
  html.js .side .nav-close { display: inline-grid; }
  html:not(.js) .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  html:not(.js) .menu-btn { display: none; }
  .top { padding: 6px 12px; }
  .bc .firm-c, .bc .up, .bc .sep { display: none; }
  .bc .cur { min-width: 0; }
  .bc .cur-d { display: none; }
  .bc .cur-m { display: inline-flex; text-decoration: none; }
  main { padding: 22px 16px 48px; }
}
@media (max-width: 40rem) {
  .ask .ask-tx { display: none; }
  .top .btn.ask { padding: 0; width: 44px; margin: 0; }
  .top { gap: 0; }
  h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ───────────── page heads ───────────── */
.head { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.head h1 { overflow-wrap: anywhere; }
.sub { color: var(--muted); max-width: 66ch; font-size: 15px; letter-spacing: -0.005em; }
.head > p > .btn.link { min-height: 44px; padding: 0; font-weight: 500; color: var(--muted); text-decoration: none; font-size: 13.5px; }
.head > p > .btn.link::before { display: none; }
.head > p > .btn.link:hover { color: var(--ink); text-decoration: underline; }
/* on wide screens the header's breadcrumbs already lead back up; the page's own back link is for phones */
@media (min-width: 64rem) { .head > p:first-child:has(> .btn.link:only-child) { display: none; } }
.head-row { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; justify-content: space-between; }
.head-row .btns { justify-content: flex-start; }
.quiet { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.count { color: var(--muted); font-weight: 500; margin-left: 6px; font-variant-numeric: tabular-nums; }
.dot::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pop); margin-right: 6px; vertical-align: middle; }

/* ───────────── surfaces: white cards with hairlines; tinted containers holding white cards ───────────── */
.card { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--paper); min-width: 0; }
.card > .card-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); min-height: 58px; }
.card > .card-h h2 { font-size: 16px; }
.card > .card-b { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.card.nest, .nest { background: var(--tint); border: 1px solid var(--line); border-radius: var(--r-card); padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.empty, p.muted:only-child { color: var(--muted); }
.card-b > p.muted:only-child { padding: 18px; border: 1px dashed var(--line2); border-radius: 12px; text-align: center; background: var(--paper); }

/* ───────────── buttons: a 44px target; the visible shape is the mock's 36px pill-cornered button ───────────── */
.btn { position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; min-width: 44px; padding: 0 14px;
  border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--ink); font: 600 13px var(--font); letter-spacing: -0.005em; cursor: pointer; text-decoration: none;
  white-space: nowrap; }
.btn::before { content: ""; position: absolute; inset: 4px 0; border: 1px solid var(--line2); border-radius: var(--r-ctl); background: var(--paper); z-index: -1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); }
.btn:hover::before { background: var(--side); }
.btn:focus-visible { outline: none; }
.btn:focus-visible::before { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.pri { color: #fff; }
.btn.pri::before { background: var(--ink); border-color: var(--ink); }
.btn.pri:hover::before { background: #000; }
.btn.danger { color: var(--crit); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }
.btn.icon { padding: 0; width: 44px; }
.btn.icon::before { inset: 4px; }
.btn.link { padding: 0 4px; justify-content: flex-start; text-align: left; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; white-space: normal; }
.btn.link::before { display: none; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* next to a 44px field, a button is as tall as the field */
form.row .btn::before, .filters .btn::before, .abby-ask .btn::before, .gsearch .btn::before, .field + .btn::before { inset: 0; }

/* ───────────── forms ───────────── */
form.stack, div.stack { display: grid; gap: 12px; }
form.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
form.inline { display: inline; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label, .field .lbl { font-weight: 600; font-size: 12.5px; }
input[type=text], input[type=email], input[type=number], input[type=datetime-local], input[type=search], input[type=date], input[type=time], input[type=file], input:not([type]),
select, textarea {
  font: inherit; font-size: 14px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--field); border-radius: var(--r-ctl); background: #fff; color: var(--ink); width: 100%; max-width: 100%; }
input[type=file] { padding: 9px 12px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
textarea { min-height: 120px; resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .grid2 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px; border-radius: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px 12px; margin: 0; min-width: 0; }
legend { font-weight: 600; padding: 0 6px; font-size: 13px; }
.caps { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 48rem) { .caps { grid-template-columns: 1fr 1fr; } }
form.row input[type=number] { width: 6.5em; }
form.row select { width: auto; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ───────────── flashes, pills, quiet marks ───────────── */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-weight: 500; }
.flash .ico { margin-top: 2px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--crit-bg); color: var(--crit); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600; background: var(--soft); color: var(--body2);
  white-space: nowrap; border: 1px solid transparent; line-height: 1.5; }
.pill.grant, .pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.deny, .pill.crit, .pill.warn { background: var(--crit-bg); color: var(--crit); }
.pill.amber { background: var(--warn-bg); color: var(--warn); }
.pill.line { background: var(--paper); border-color: var(--line2); color: var(--muted); }
.pill.dark { background: var(--ink); color: #fff; }
.pill.mark { background: var(--soft); }
.pill.mark::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pop); flex: none; }
.pill .ico, .pill svg { width: 12px; height: 12px; }
.mark-stripe { border-left: 3px solid var(--pop); padding-left: 10px; }
.hold { border-left: 3px solid var(--pop); padding-left: 12px; display: grid; gap: 6px; }
.warnbox { background: var(--warn-bg); color: #4d3500; border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; }
.diff del { color: var(--crit); text-decoration: line-through; text-decoration-thickness: 1px; }
.diff ins { color: var(--ok); text-decoration: none; font-weight: 600; }

/* ───────────── tabs: filled grey pill for the active one (real links; the active one aria-current) ───────────── */
.tabs { display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; }
.tabs .btn { font-weight: 500; font-size: 13.5px; color: var(--muted); padding: 0 12px; letter-spacing: -0.01em; }
.tabs .btn::before { border-color: transparent; background: transparent; box-shadow: none; inset: 5px 0; }
.tabs .btn:hover { color: var(--ink); }
.tabs .btn:hover::before { background: transparent; }
.tabs .btn.on, .tabs .btn[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tabs .btn.on::before, .tabs .btn[aria-current="page"]::before { background: var(--soft); }
.tabs .btn .ico { width: 15px; height: 15px; }
.tabs .count { color: var(--muted); font-weight: 500; margin-left: 0; }
@media (max-width: 40rem) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .btn { flex: none; }
}

/* ───────────── tables: real tables on wide screens (in a flat card), cards at 640px and below ───────────── */
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
table.grid th, table.grid td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
table.grid th { font-size: 12px; color: var(--muted); font-weight: 500; background: var(--side); white-space: nowrap; padding-top: 10px; padding-bottom: 10px; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid td a:not(.btn), table.grid td .btn.link { font-weight: 600; text-decoration: none; margin: -12px 0; }
table.grid td .btn.link { margin-left: -4px; }
table.grid td a:not(.btn):hover, table.grid td .btn.link:hover { text-decoration: underline; }
.card-b > table.grid, .card > table.grid { border: 0; border-radius: 0; }
@media (max-width: 40rem) {
  table.grid, table.grid tbody, table.grid tr, table.grid td { display: block; width: 100%; }
  table.grid thead { display: none; }
  table.grid { border-radius: 14px; }
  table.grid tr { border-bottom: 1px solid var(--line); padding: 8px 4px; }
  table.grid tbody tr:last-child { border-bottom: 0; }
  table.grid td { border: 0; padding: 4px 12px; }
  table.grid td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
}
/* the capability matrix scrolls inside its own region (the page never scrolls sideways) */
.scroll { overflow-x: auto; max-width: 100%; position: relative; }
.scroll:focus-visible { outline-offset: -2px; }
table.matrix { border-collapse: collapse; min-width: 640px; width: 100%; font-size: 13px; }
table.matrix th, table.matrix td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: center; }
table.matrix th:first-child, table.matrix td:first-child { text-align: left; position: sticky; left: 0; background: var(--paper); min-width: 190px; }
table.matrix thead th { font-size: 12px; font-weight: 500; color: var(--muted); vertical-align: bottom; background: var(--side); }
table.matrix thead th:first-child { background: var(--side); }
table.matrix .yes { color: var(--ink); }
table.matrix .no { color: var(--muted); }
table.matrix .area td { text-align: left; font-weight: 600; background: var(--tint); }

/* ───────────── facts, lists of things with a leading icon ───────────── */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--muted); font-weight: 400; }
.facts dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
dl.facts dd a { font-weight: 600; margin: -12px 0; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
ul.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
ul.items > li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
ul.items > li:first-child { padding-top: 0; }
ul.items > li:last-child { border-bottom: 0; padding-bottom: 0; }
.it-ico { width: 32px; height: 32px; border-radius: 10px; background: var(--soft); display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--body2); }
.it-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.it-body .t { font-weight: 600; overflow-wrap: anywhere; }
.it-side { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.it-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: 12.5px; color: var(--muted); }
.outside { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.overdue { font-weight: 600; color: var(--crit); display: inline-flex; align-items: center; gap: 4px; }
.overdue .ico { width: 14px; height: 14px; }
.preview { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--side); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--body2); font-size: 13.5px; }
.reasons { margin: 4px 0 0; padding-left: 20px; }
details.more { width: 100%; }
.btns > details.more:not([open]) { width: auto; }
details.more > summary { list-style: none; width: fit-content; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 10px; }
details.more > summary.btn { cursor: pointer; }
h3.small { font-size: 13px; margin: 0; }
h4.small { font-size: 13px; margin: 0 0 4px; }
.tick { display: flex; align-items: center; gap: 10px; min-height: 44px; width: 100%; text-align: left; justify-content: flex-start; border: 0; background: none; padding: 0 4px;
  font: inherit; cursor: pointer; border-radius: 8px; }
.tick:hover { background: var(--side); }
.tick .ico { width: 20px; height: 20px; }
.tick[aria-checked="true"] .lbl { color: var(--muted); text-decoration: line-through; }
.checklist { display: grid; gap: 0; }
/* every link in the page body is a 44px target (inline links included) */
main a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }

/* ───────────── sheets (forms, a lead, search) and Ask Abby: modal; a side sheet on wide screens, full screen on a phone ───────────── */
.sheet-scrim, .abby-scrim { position: fixed; inset: 0; background: rgba(20, 20, 20, 0.28); z-index: 40; }
.sheet[hidden], .sheet-scrim[hidden], .abby[hidden], .abby-scrim[hidden] { display: none; }
.sheet, .abby { position: fixed; z-index: 50; inset: 0; background: var(--paper); display: flex; flex-direction: column; }
@media (min-width: 48rem) {
  .sheet, .abby { inset: 10px 10px 10px auto; width: min(600px, calc(100vw - 20px)); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16); }
  .abby { width: min(440px, calc(100vw - 20px)); }
  #search-sheet { bottom: auto; width: min(480px, calc(100vw - 20px)); }
  #search-sheet .sheet-body { flex: none; }
}
body.sheet-open, body.abby-open { overflow: hidden; }
.sheet-top, .abby-top { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--line); background: var(--paper); min-height: 60px; }
.sheet-top h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 17px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: var(--paper); }
.abby-top { align-items: flex-start; padding-top: 14px; }
.abby-title { flex: 1; min-width: 0; display: grid; gap: 4px; }
.abby-title h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.abby-title h2 .ico { color: var(--pop); }
.abby-log { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; background: var(--paper); }
.abby-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.btn.chip { font-weight: 500; text-align: left; white-space: normal; }
.btn.chip::before { background: var(--soft); border-color: var(--soft); box-shadow: none; }
.abby-msg { max-width: 92%; display: grid; gap: 4px; padding: 10px 12px; border-radius: 14px; }
.abby-msg.me { align-self: flex-end; background: var(--soft); }
.abby-msg.abby { align-self: flex-start; background: var(--side); border: 1px solid var(--line); }
.abby-who { font-size: 12px; font-weight: 600; color: var(--muted); }
.abby-msg.abby .abby-who::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pop); margin-right: 6px; vertical-align: 1px; }
.abby-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.abby-md { white-space: normal; display: grid; gap: 8px; }
.abby-md p, .abby-md ul, .abby-md ol { margin: 0; }
.abby-md ul, .abby-md ol { padding-left: 1.4em; display: grid; gap: 4px; }
.abby-md code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; background: var(--soft); padding: 0 4px; border-radius: 4px; overflow-wrap: anywhere; }
.abby-md a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.abby-note { font-weight: 600; }
.abby-offer { margin: 4px 0 0; }
.abby-ask { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); background: var(--side); }
.abby-ask textarea { min-height: 44px; height: 64px; resize: none; flex: 1; }
/* the header's Ask button: quiet, with the one accent as a dot */
.btn.ask { gap: 7px; padding: 0 12px; margin: 0 2px; }
.btn.ask .ico { color: var(--ink); }
.btn.ask::after { content: ""; position: absolute; top: 9px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--pop); box-shadow: 0 0 0 2px #fff; }

/* ───────────── sign-in (no shell) ───────────── */
.signin { max-width: 440px; margin: 0 auto; padding: 56px 16px; display: grid; gap: 18px; }
.signin .brand { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 18px; }
.signin .brand img { height: 26px; width: auto; display: block; }
.signin .card-b > .btn { width: 100%; }
.brandline { font-size: 15px; }

/* ───────────── Today: the approvals queue (white cards on a tinted container) ───────────── */
.queue { display: flex; flex-direction: column; gap: 8px; background: var(--tint); border: 1px solid var(--line); border-radius: var(--r-card); padding: 8px; }
.queue > .card, .queue > article { border-radius: 14px; }
.queue-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 6px; }
.queue-h h2 { font-size: 16px; }
.batch-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: end; }
.batch-row .field { flex: 1 1 260px; }
.batch-row .btn::before { inset: 0; }
.empty-note { padding: 18px; border: 1px dashed var(--line2); border-radius: 12px; color: var(--muted); text-align: center; background: var(--paper); }
.action h2 { font-size: 15px; }
.check.pick { min-width: 44px; justify-content: center; }

/* ───────────── Leads & intake ───────────── */
.lead { display: flex; flex-direction: column; gap: 14px; }
.lead-name { font-size: 17px; }
.tpl + .tpl { border-top: 1px solid var(--line); padding-top: 14px; }

/* ───────────── the board: one tinted column per stage, white matter cards ───────────── */
.filters { display: grid; gap: 10px; grid-template-columns: 1fr; align-items: end; }
@media (min-width: 48rem) { .filters { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; } }
.filters .btn { width: fit-content; }
.tabs.matter-tabs .btn { gap: 6px; }
.board { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 64rem) { .board { grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; } .board.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.col { background: var(--tint); border: 1px solid var(--line); border-radius: var(--r-card); padding: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.col > h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; padding: 6px 6px 2px; display: flex; align-items: center; gap: 8px; }
.col > h2 .count { font-size: 12px; font-weight: 600; border: 1px solid var(--line2); background: var(--paper); border-radius: 7px; padding: 0 6px; margin-left: 0; }
.col .empty { padding: 4px 6px 8px; font-size: 12.5px; }
.mcard { background: var(--paper); border-radius: 12px; border: 1px solid var(--line); padding: 12px 13px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mcard:hover { border-color: var(--line2); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); }
.mcard .cat { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.mcard h3 { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.mcard h3 a { text-decoration: none; display: inline-flex; min-height: 44px; align-items: center; }
.mcard h3 a:hover { text-decoration: underline; }
.mcard .who-line { font-size: 13px; overflow-wrap: anywhere; color: var(--body2); }
.mcard hr, .hair { border: 0; border-top: 1px solid var(--line); margin: 2px 0; }
.mcard .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.mcard .meta span { display: inline-flex; align-items: center; gap: 5px; }
.mcard .meta .ico, .meta .ico { width: 13px; height: 13px; }
.evt a.t, .mcard h3 a { overflow-wrap: break-word; word-break: normal; }

/* ───────────── the calendar ───────────── */
.calbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.calbar h2 { font-size: 17px; }
.week { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 64rem) { .week { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.day { background: var(--tint); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.day > h3 { font-size: 12.5px; color: var(--muted); font-weight: 500; padding: 2px 4px; }
.day.today > h3 { color: var(--ink); font-weight: 600; }
.day.today > h3::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pop); margin-left: 6px; vertical-align: middle; }
.day > h3 a { font-weight: inherit; text-decoration: none; }
.day > h3 a:hover { text-decoration: underline; }
.evt { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; display: grid; gap: 1px; min-width: 0; font-size: 12.5px; }
.evt.allday { background: var(--side); }
.evt.court, .evt.deadline { border-left: 3px solid var(--pop); }
.evt .k { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.evt .k .ico { width: 13px; height: 13px; }
.evt a.t { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; min-height: 44px; display: inline-flex; align-items: center; font-size: 13px; }
.evt a.t:hover { text-decoration: underline; }
.evt .tm { font-size: 12px; color: var(--muted); }
.agenda h3 { font-size: 14px; margin-top: 4px; }
.agenda .evts { display: grid; gap: 8px; }

/* ───────────── import, practice settings, layout helpers ───────────── */
.mapping { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 48rem) { .mapping { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.decide { display: grid; gap: 0; }
.problems { margin: 0; padding-left: 18px; color: var(--crit); font-size: 13px; }
.stat-line { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.stat-line strong { font-size: 22px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.items-edit { display: grid; gap: 8px; }
.items-edit .row-edit { display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr); align-items: end; }
@media (min-width: 48rem) { .items-edit .row-edit { grid-template-columns: minmax(0, 1fr) auto; } }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 72rem) { .split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.stack-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ───────────── Billing: the hero number with its delta pill and aging bar; the invoice as paper ───────────── */
.hero .card-b { display: grid; gap: 4px; padding: 20px 22px; }
.hero .quiet { color: var(--body2); font-size: 14px; font-weight: 500; letter-spacing: -0.01em; }
.hero-n { font-size: 52px; font-weight: 700; letter-spacing: -0.055em; line-height: 1; margin-top: 12px; }
.hero .pill { justify-self: start; margin-top: 8px; font-size: 12.5px; padding: 3px 9px; border-radius: 8px; }
.aging-bar { width: 100%; height: 12px; border-radius: 7px; background: var(--soft); overflow: hidden; display: block; margin-top: 16px; }
.timer .card-h h2 { display: inline-flex; align-items: center; gap: 8px; }
.time-row .outside { color: var(--ink); }
.time-row .it-meta .ico { width: 13px; height: 13px; }
.time-row .it-meta span { display: inline-flex; align-items: center; gap: 4px; }
.row-wd { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.row-wd legend { font-size: 13px; font-weight: 600; padding: 0 4px; overflow-wrap: anywhere; }
.paper { border-radius: 14px; display: grid; gap: 18px; min-width: 0; background: var(--paper); border: 1px solid var(--line); padding: 26px; }
.paper-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 14px; }
.paper-firm { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.paper-kind { font-weight: 700; font-size: 15px; }
.paper-meta .facts { font-size: 13px; }
.paper-lines td:last-child, .paper-lines th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.paper-tot { justify-self: end; font-variant-numeric: tabular-nums; }
.paper-tot dd { text-align: right; }
@media (max-width: 40rem) { .paper { padding: 18px; } }

/* ───────────── a hero number beside a facts list (Today) ───────────── */
.metrics { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.hero-card { border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero-h { display: flex; align-items: center; gap: 10px; color: var(--body2); font-weight: 500; }
.hero-h .tile { width: 22px; height: 22px; border-radius: 6px; }
.big { font-size: 64px; font-weight: 700; letter-spacing: -0.055em; line-height: 1; margin-top: 18px; font-variant-numeric: tabular-nums; }
.big-l { color: var(--muted); font-size: 14px; margin-top: 8px; max-width: 52ch; }
.facts-list { border: 1px solid var(--line); border-radius: 18px; padding: 6px 20px; display: flex; flex-direction: column; background: var(--side); min-width: 0; }
.facts-list .fl { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; min-height: 56px; }
.facts-list .fl:last-child { border-bottom: 0; }
.facts-list .fl .k { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.facts-list .fl .k b { font-weight: 500; }
.facts-list .fl .k span { font-size: 12.5px; color: var(--muted); }
.facts-list .fl .v { font-size: 22px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.facts-list .fl:hover .k b { text-decoration: underline; }
@media (max-width: 72rem) { .metrics { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 40rem) { .big { font-size: 52px; } }

/* ───────────── P2.5: the client portal, in the firm's own colour (/portal/brand.css sets --firm; contrast-checked when it is set) ───────────── */
.portal-body { --firm: #1c1c1f; --firm-ink: #ffffff; --firm-tint: #f1f1ef; background: #fafaf8; min-height: 100vh; display: flex; flex-direction: column; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 60; background: var(--paper); padding: 0 14px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 10px; border: 1px solid var(--line2); }
.skip:focus { left: 8px; }
.p-top { display: flex; align-items: center; gap: 8px 16px; padding: 8px 24px; background: var(--paper); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.p-top .spacer { flex: 1; }
.flogo { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; color: var(--ink); text-decoration: none; }
.fmark { width: 40px; height: 40px; border-radius: 9px; background: var(--firm); color: var(--firm-ink); display: grid; place-items: center; font-weight: 700; font-size: 15px; overflow: hidden; flex: none; }
.fmark.has-logo { background: var(--paper); }
.fmark img { max-width: 100%; max-height: 100%; display: block; }
.fword { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.p-nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.p-nav a:hover { color: var(--ink); background: var(--side); }
.p-nav a[aria-current="page"] { background: var(--firm-tint); color: var(--firm); font-weight: 600; }
.p-main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 28px 24px 48px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.p-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--paper); font-size: 12.5px; color: var(--muted); }
.powered { color: var(--muted); font-size: 12px; }
.portal-body a { color: var(--firm); }
.portal-body .btn { color: var(--ink); }
.portal-body .btn.pri { color: var(--firm-ink); }
.portal-body .btn.pri::before { background: var(--firm); border-color: var(--firm); }
.portal-body .btn.pri:hover::before { background: var(--firm); filter: brightness(0.88); }
.portal-body .btn.ask .ico { color: var(--firm); }
.p-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.p-grid > :first-child { grid-row: span 2; }
.p-card .card-b { gap: 12px; }
.p-h1 { font-size: 24px; line-height: 1.25; margin: 2px 0 4px; overflow-wrap: anywhere; }
.p-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 6px 0; }
.p-step { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; }
.p-step i { height: 6px; border-radius: 4px; background: var(--line2); display: block; }
.p-step.done i { background: var(--firm); }
.p-step.now i { background: linear-gradient(90deg, var(--firm) 50%, var(--line2) 50%); }
.p-step.now { color: var(--ink); font-weight: 600; }
.p-step .ico { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.p-next { background: var(--firm-tint); border-radius: 12px; padding: 12px 14px; }
.p-next p { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.p-list { list-style: none; padding: 0; margin: 0; }
.p-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.p-row:last-child { border-bottom: 0; }
.p-row .grow { flex: 1 1 12rem; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.p-row .it-ico .ico { width: 18px; height: 18px; }
.p-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.p-thread { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.p-msg { display: flex; gap: 10px; }
.p-msg .bub { background: var(--side); border-radius: 12px; padding: 10px 12px; flex: 1; min-width: 0; }
.p-msg.me .bub { background: var(--firm-tint); }
.p-text { white-space: pre-line; margin: 4px 0 0; overflow-wrap: anywhere; }
.p-signin { width: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.portal-body .abby-text { white-space: pre-line; }
@media (max-width: 900px) { .p-grid { grid-template-columns: 1fr; } .p-grid > :first-child { grid-row: auto; } }
@media (max-width: 640px) {
  .p-top { padding: 6px 12px; gap: 4px 8px; }
  .p-main { padding: 16px 12px 40px; }
  .p-nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .fword { max-width: 46vw; }
  .p-steps { flex-wrap: wrap; }
  .p-step { flex: 1 1 40%; }
  .p-foot { padding: 12px; }
}

/* ───────────── P2.5: the firm's branding page (its live previews take the colour from the form) ───────────── */
.brand-grid { --firm: #23483a; --firm-ink: #ffffff; --firm-tint: #eaf0ed; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.brand-prev { --firm: #23483a; --firm-ink: #ffffff; --firm-tint: #eaf0ed; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 72px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatches input[type="color"] { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line2); border-radius: 10px; background: var(--paper); }
.inv { border: 1px solid var(--line); border-radius: 14px; background: var(--paper); padding: 22px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.inv-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.inv.classic .inv-head { border-bottom: 2px solid var(--firm); padding-bottom: 14px; }
.inv.modern .inv-head { background: var(--firm); color: var(--firm-ink); margin: -22px -22px 0; padding: 20px 22px; }
.inv.modern .inv-addr { color: var(--firm-ink); }
.inv.modern .fmark:not(.has-logo) { background: var(--paper); color: var(--firm); }
.inv.minimal .fmark:not(.has-logo) { background: transparent; color: var(--firm); box-shadow: inset 0 0 0 1.5px var(--firm); }
.inv-addr { white-space: pre-line; font-size: 12px; color: var(--muted); text-align: right; }
.inv-meta { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.inv-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.inv-t th, .inv-t td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); }
.inv-t .r { text-align: right; }
.inv-foot, .mail-f { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.fbtn { display: inline-flex; align-items: center; background: var(--firm); color: var(--firm-ink); border-radius: 9px; padding: 8px 14px; font-weight: 600; font-size: 13px; align-self: flex-start; }
.mail { border: 1px solid var(--line); border-radius: 14px; background: var(--paper); overflow: hidden; }
.mail-h { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--side); align-items: center; min-width: 0; }
.mail-b { padding: 16px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.mail-b p { margin: 0; }
.mail-f { margin: 0 16px 14px; }
.sig { white-space: pre-line; font-size: 12.5px; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--line); }
.p-mini { border: 1px solid var(--line2); border-radius: 16px; overflow: hidden; background: #fafaf8; }
.p-mini .p-top { position: static; }
.p-mini .p-main { padding: 16px; }
@media (max-width: 1100px) { .brand-grid { grid-template-columns: 1fr; } .brand-prev { position: static; } }
