/* SignOff design system. Bento tiles on warm paper, ballpoint blue as the accent. */

@font-face { font-family: "Instrument Sans"; src: url(../fonts/instrument-sans.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Caveat"; src: url(../fonts/caveat.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Great Vibes"; src: url(../fonts/great-vibes.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Pacifico"; src: url(../fonts/pacifico.woff2) format("woff2"); font-display: swap; }

:root {
  --paper: #ECE9E1;
  --tile: #FFFFFF;
  --tile-2: #F5F3ED;
  --ink: #14151A;
  --ink-2: #4F5059;
  --ink-3: #6B6C75;
  --line: #E4E1D7;
  --pen: #2540E8;
  --pen-dark: #1A2EB8;
  --pen-soft: #E6E9FF;
  --pen-fill: #2540E8;
  --pen-fill-hover: #1A2EB8;
  --lime: #DDF26E;
  --tint-lime: #DDF26E;
  --tint-peach: #FFDCC4;
  --tint-lilac: #DED9FF;
  --on-tint-2: rgba(20, 21, 26, .72);
  --on-tint-track: rgba(20, 21, 26, .14);
  --fixed-ink: #14151A;
  --strong: #14151A;
  --on-strong: #FFFFFF;
  --strong-hover: #2B2C33;
  --night: #14151A;
  --toast: #14151A;
  --bad-hover: #F9D2CD;
  --desk: #DEDBD1;
  --track: #C9C7BF;
  --dash: #CFCBBE;
  --faint: #BDBBB2;
  --scroll: #C6C2B5;
  --selected: #F7F8FF;
  --seg-on: #FFFFFF;
  --veil: rgba(236, 233, 225, .72);
  --backdrop: rgba(20, 21, 26, .45);
  --ok: #0B6E46;
  --ok-soft: #D9F2E5;
  --warn: #8A5200;
  --warn-soft: #FFEFCE;
  --bad: #B72B24;
  --bad-soft: #FCE3E0;
  --r: 26px;
  --r-m: 18px;
  --r-s: 12px;
  --gap: 14px;
  --shadow: 0 1px 2px rgba(20, 21, 26, .04), 0 12px 32px -18px rgba(20, 21, 26, .18);
  --shadow-lg: 0 2px 6px rgba(20, 21, 26, .08), 0 24px 56px -18px rgba(20, 21, 26, .42);
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0E0F13;
  --tile: #181A20;
  --tile-2: #23262E;
  --ink: #F1F0EC;
  --ink-2: #BDBEC7;
  --ink-3: #9A9BA5;
  --line: #2E313A;
  --pen: #93A5FF;
  --pen-dark: #C3CDFF;
  --pen-soft: #232A55;
  --pen-fill: #2F49E0;
  --pen-fill-hover: #3F58EC;
  --tint-lime: #2B3212;
  --tint-peach: #3B281C;
  --tint-lilac: #2A2747;
  --on-tint-2: rgba(241, 240, 236, .76);
  --on-tint-track: rgba(241, 240, 236, .18);
  --strong: #F1F0EC;
  --on-strong: #14151A;
  --strong-hover: #D9D8D3;
  --night: #22253A;
  --toast: #2C2F3A;
  --ok: #5AD6A0;
  --ok-soft: #123428;
  --warn: #F2C069;
  --warn-soft: #3A2B0F;
  --bad: #FF958B;
  --bad-soft: #401C19;
  --bad-hover: #542623;
  --desk: #0B0C0F;
  --track: #454854;
  --dash: #3D404A;
  --faint: #5C5E67;
  --scroll: #454854;
  --selected: #1D2036;
  --seg-on: #343844;
  --veil: rgba(14, 15, 19, .72);
  --backdrop: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -18px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .4), 0 24px 56px -18px rgba(0, 0, 0, .8);
}

/* A document is paper in either theme, so everything drawn on it stays light. */
.pdf-page {
  color: #14151A; --pen: #2540E8; --pen-dark: #1A2EB8; --pen-fill: #2540E8; --ok: #0B6E46; --warn: #8A5200;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink);
  font: 400 15px/1.5 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.lg { width: 22px; height: 22px; }
svg.i.sm { width: 15px; height: 15px; }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: var(--gap); padding: var(--gap); max-width: 1560px; margin: 0 auto; align-items: start; }
.rail { position: sticky; top: var(--gap); height: calc(100vh - var(--gap) * 2); display: flex; flex-direction: column; gap: var(--gap); min-height: 480px; }
.rail-nav { flex: 1; background: var(--tile); color: var(--ink); box-shadow: var(--shadow); border-radius: var(--r); padding: 16px 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.brand-logo { display: inline-flex; flex: none; }
.brand-logo .logo-dark { display: none; }
:root[data-theme="dark"] .brand-logo .logo-light { display: none; }
:root[data-theme="dark"] .brand-logo .logo-dark { display: block; }
.brand-logo img { display: block; height: 36px; width: auto; }
.brand.on-paper { padding: 0; color: var(--ink); }
.stage-body { min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 14px; color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s; }
.nav-link:hover { color: var(--ink); background: var(--tile-2); }
.nav-link.on, .nav-link.on:hover { background: var(--lime); color: var(--fixed-ink); font-weight: 600; }
.rail-user { background: var(--tile); border-radius: var(--r); padding: 12px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.rail-user .who { min-width: 0; flex: 1; }
.rail-user .who b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-user .who span { display: block; font-size: 12px; color: var(--ink-3); }
.stage { min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }

/* ---- bento grid ---- */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: stretch; }
.s2 { grid-column: span 2; } .s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; }
.s6 { grid-column: span 6; } .s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s9 { grid-column: span 9; } .s12 { grid-column: span 12; }
.r2 { grid-row: span 2; }

.tile { background: var(--tile); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.tile.ink { background: var(--night); color: #fff; }
.tile.lime { background: var(--tint-lime); }
.tile.peach { background: var(--tint-peach); }
.tile.lilac { background: var(--tint-lilac); }
.tile.pen { background: var(--pen-fill); color: #fff; }
.tile.soft { background: var(--tile-2); box-shadow: none; }
.tile.link { transition: transform .16s cubic-bezier(.2, .8, .2, 1), box-shadow .16s; }
a.tile.link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 8px 8px 2px; }
.page-head h1 { font-size: 30px; line-height: 1.15; font-weight: 600; letter-spacing: -.03em; }
.page-head p { color: var(--ink-2); margin-top: 2px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; font-size: 14px; }
.back:hover { color: var(--ink); }
.tile-title { font-size: 13px; font-weight: 600; color: var(--ink-3); letter-spacing: .01em; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile.ink .tile-title { color: rgba(255, 255, 255, .7); }
.tile.pen .tile-title { color: rgba(255, 255, 255, .92); }
.tile.lime .tile-title, .tile.peach .tile-title, .tile.lilac .tile-title { color: var(--on-tint-2); }
.h2 { font-size: 19px; font-weight: 600; letter-spacing: -.015em; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; word-break: break-all; }
.trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.spacer { margin-top: auto; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stack.lg { gap: 16px; }

/* ---- hero + stats ---- */
.hero h1 { font-size: clamp(30px, 3.6vw, 46px); line-height: 1.06; font-weight: 600; letter-spacing: -.035em; }
.hero p { color: rgba(255, 255, 255, .72); max-width: 44ch; }
.stat-value { font-size: 52px; line-height: 1; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 13px; color: var(--ink-2); }
.tile.lime .stat-note, .tile.peach .stat-note, .tile.lilac .stat-note { color: var(--on-tint-2); }
.tile.ink .stat-note { color: rgba(255, 255, 255, .72); }
.tile.pen .stat-note { color: rgba(255, 255, 255, .92); }

.meter { display: flex; gap: 2px; height: 10px; border-radius: 6px; overflow: hidden; background: var(--tile-2); }
.meter > i { display: block; min-width: 4px; }
.meter .m-complete { background: var(--ok); } .meter .m-partial { background: var(--pen); }
.meter .m-pending { background: #D39A2D; } .meter .m-expired { background: var(--bad); }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.legend div { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.legend b { margin-left: auto; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.progress { height: 6px; background: var(--tile-2); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); border-radius: 4px; }

/* ---- controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; min-height: 42px;
  border: 0; border-radius: 13px; background: var(--tile-2); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background .14s, transform .1s, opacity .14s; white-space: nowrap;
}
.btn:hover { background: var(--line); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--pen-fill); color: #fff; }
.btn.primary:hover { background: var(--pen-fill-hover); }
.btn.dark { background: var(--strong); color: var(--on-strong); }
.btn.dark:hover { background: var(--strong-hover); }
.btn.lime { background: var(--lime); color: var(--fixed-ink); }
.btn.lime:hover { background: #CDE85A; }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.danger:hover { background: var(--bad-hover); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn.icon { padding: 0; width: 38px; min-height: 38px; flex: none; }
.btn.icon.sm { width: 32px; min-height: 32px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.field .err { font-size: 12.5px; color: var(--bad); font-weight: 500; }
.input {
  width: 100%; padding: 11px 13px; min-height: 44px; border: 1.5px solid var(--line); border-radius: 13px;
  background: var(--tile); outline: none; transition: border-color .14s, box-shadow .14s;
}
.input:focus { border-color: var(--pen); box-shadow: 0 0 0 3px var(--pen-soft); }
.input.bad { border-color: var(--bad); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .peek { position: absolute; right: 4px; top: 3px; background: none; }
textarea.input { resize: vertical; min-height: 70px; }

.seg { display: inline-flex; background: var(--tile-2); border-radius: 13px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 13px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }

.switch { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 13px; background: var(--tile-2); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 12px; background: var(--track); position: relative; flex: none; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--pen-fill); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--pen); outline-offset: 2px; }
.switch input:disabled ~ * { opacity: .55; }
.switch .sw-text { min-width: 0; }
.switch b { display: block; font-weight: 600; font-size: 14px; }
.switch small { display: block; color: var(--ink-3); font-size: 12.5px; line-height: 1.35; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--pen-fill); flex: none; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 9px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge svg.i { width: 14px; height: 14px; }
.b-complete { background: var(--ok-soft); color: var(--ok); }
.b-partial { background: var(--pen-soft); color: var(--pen-dark); }
.b-pending { background: var(--warn-soft); color: var(--warn); }
.b-expired, .b-off { background: var(--bad-soft); color: var(--bad); }
.b-plain { background: var(--tile-2); color: var(--ink-2); }
.b-dark { background: var(--strong); color: var(--on-strong); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 7px; background: var(--tile-2); color: var(--ink-2); }

.avatar { width: 40px; height: 40px; border-radius: 13px; background: #DED9FF; color: var(--fixed-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.avatar.lime { background: var(--lime); } .avatar.peach { background: #FFDCC4; } .avatar.pen { background: #E6E9FF; }
.avatar.off { background: var(--tile-2); color: var(--ink-3); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
a.list-item:hover b { color: var(--pen); }
.dot-ico { width: 34px; height: 34px; border-radius: 11px; background: var(--tile-2); display: grid; place-items: center; flex: none; color: var(--ink-2); }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .dot-ico { width: 52px; height: 52px; border-radius: 16px; }

/* ---- document cards + links ---- */
.doc-card { color: var(--ink); gap: 12px; }
.doc-card h3 { font-size: 18px; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; overflow-wrap: anywhere; }
.signer-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.signer-dots i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.signer-dots i.done { background: var(--ok); }

.signer-tile { background: var(--tile-2); border-radius: var(--r-m); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.link-box { display: flex; align-items: center; gap: 6px; background: var(--tile); border: 1.5px solid var(--line); border-radius: 11px; padding: 4px 4px 4px 11px; min-width: 0; }
.link-box code { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* ---- pdf canvas ---- */
.pdf-scroller { background: var(--desk); border-radius: var(--r-m); padding: 16px; display: flex; flex-direction: column; gap: 18px; max-height: 80vh; overflow-y: auto; align-items: center; }
.page-label { font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: center; margin-bottom: 6px; }
.page-wrap { width: 100%; max-width: 760px; }
.pdf-page { position: relative; width: 100%; background: #fff; box-shadow: 0 6px 20px -8px rgba(20, 21, 26, .35); user-select: none; -webkit-user-select: none; }
.pdf-page img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.pdf-page.placing { cursor: crosshair; }
.box {
  position: absolute; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px 4px; overflow: visible;
  border: 1.5px solid var(--pen); border-radius: 6px; background: rgba(230, 233, 255, .9); color: var(--pen-dark); font-size: 11px; font-weight: 600; line-height: 1.15;
  touch-action: none; cursor: grab; user-select: none;
}
.box.dim { border-color: #8E90A5; background: rgba(240, 240, 243, .88); color: #4F5059; }
.box.active { box-shadow: 0 0 0 3px rgba(37, 64, 232, .25); }
.box.stamp { border-color: #B57A10; background: rgba(255, 239, 206, .92); color: var(--warn); }
.box.locked { border-color: var(--ok); background: rgba(217, 242, 229, .9); color: var(--ok); cursor: default; }
.box.dragging { cursor: grabbing; }
.box span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; pointer-events: none; }
.box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.box.readonly { cursor: default; touch-action: auto; }
.handle { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--pen); border: 2px solid #fff; touch-action: none; }
.stamp .handle { background: #B57A10; }
.handle.nw { left: -6px; top: -6px; cursor: nwse-resize; } .handle.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.handle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; } .handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }

.dropzone { border: 2px dashed var(--dash); border-radius: var(--r-m); padding: 30px 16px; text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: border-color .15s, background .15s; background: none; width: 100%; }
.dropzone:hover, .dropzone.over { border-color: var(--pen); background: var(--pen-soft); }
.file-pill { display: flex; align-items: center; gap: 10px; background: var(--tile-2); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.signer-edit { border: 1.5px solid var(--line); border-radius: 15px; padding: 11px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.signer-edit.on { border-color: var(--pen); background: var(--selected); }
.page-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.page-pills button { min-width: 28px; height: 26px; padding: 0 5px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--tile); font-size: 12px; font-weight: 600; cursor: pointer; }
.page-pills button.on { background: var(--pen-fill); border-color: var(--pen-fill); color: #fff; }
.link-btn { background: none; border: 0; padding: 0; font-size: 12.5px; font-weight: 600; color: var(--pen); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---- signature pad ---- */
.pad { --ink-3: #6B6C75; position: relative; background: #F5F3ED; border-radius: var(--r-m); overflow: hidden; }
.pad canvas { display: block; width: 100%; height: 170px; touch-action: none; cursor: crosshair; }
.pad .baseline { position: absolute; left: 18px; right: 18px; bottom: 44px; border-bottom: 1.5px dashed #C9C7BF; pointer-events: none; }
.pad .pad-hint { position: absolute; inset: 0 0 auto; top: 66px; text-align: center; color: var(--ink-3); font-size: 13.5px; pointer-events: none; }
.pad .clear { position: absolute; right: 8px; bottom: 8px; }
.typed-preview { background: #F5F3ED; border-radius: var(--r-m); min-height: 116px; display: grid; place-items: center; font-size: 42px; line-height: 1.1; color: var(--pen-dark); padding: 12px; text-align: center; overflow-wrap: anywhere; }
.f-caveat { font-family: "Caveat", cursive; font-weight: 600; }
.f-vibes { font-family: "Great Vibes", cursive; }
.f-pacifico { font-family: "Pacifico", cursive; font-size: 32px; }

/* ---- sign-in + public pages ---- */
.auth { min-height: 100vh; padding: var(--gap); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(0, 1fr)); gap: var(--gap); max-width: 1320px; margin: 0 auto; }
.auth-hero { grid-column: span 7; grid-row: span 4; justify-content: flex-end; padding: 32px; overflow: hidden; position: relative; }
.auth-hero h1 { font-size: clamp(38px, 5.2vw, 68px); line-height: 1.02; letter-spacing: -.04em; font-weight: 600; max-width: 12ch; position: relative; z-index: 1; }
.auth-hero .sig { position: absolute; right: 32px; top: 36px; width: min(82%, 560px); color: var(--lime); }
.auth-hero .sig path { fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.4s .2s cubic-bezier(.6, 0, .3, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.auth-card { grid-column: span 5; grid-row: span 6; padding: clamp(24px, 4vw, 44px); justify-content: center; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 380px; margin: 0 auto; }
.auth-card h2 { font-size: 30px; line-height: 1.12; letter-spacing: -.03em; font-weight: 600; }
.auth-mini { grid-column: span 4; grid-row: span 2; justify-content: flex-end; gap: 6px; }
.auth-mini.sm { grid-column: span 3; }
.auth-mini b { font-size: 19px; line-height: 1.2; letter-spacing: -.02em; font-weight: 600; }
.notice { padding: 11px 13px; border-radius: 13px; font-size: 13.5px; display: flex; gap: 9px; align-items: flex-start; background: var(--tile-2); color: var(--ink-2); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice svg.i { margin-top: 1px; }

.public { max-width: 1240px; margin: 0 auto; padding: var(--gap); display: flex; flex-direction: column; gap: var(--gap); min-height: 100vh; }
.public-center { flex: 1; display: grid; place-items: center; }
.public-card { width: 100%; max-width: 440px; padding: 30px; }
.public-card h2 { font-size: 25px; line-height: 1.15; letter-spacing: -.025em; font-weight: 600; }
.loading { min-height: 60vh; display: grid; place-items: center; color: var(--ink-3); }

.secret-box { background: var(--tile-2); border-radius: 13px; padding: 12px 14px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 14px; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.qr { background: #fff; border-radius: 14px; padding: 10px; width: 188px; height: 188px; align-self: center; border: 1.5px solid var(--line); }
.qr svg { display: block; width: 100%; height: 100%; }

/* ---- dialog + toast ---- */
dialog.modal { border: 0; padding: 0; border-radius: var(--r); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--tile); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(20, 21, 26, .5); overflow: hidden; animation: fade .18s ease-out; }
dialog.modal::backdrop { animation: fade .18s ease-out; }
dialog.modal::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-body h2 { font-size: 21px; letter-spacing: -.02em; font-weight: 600; line-height: 1.2; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
/* popover="manual" lifts toasts above open dialogs. These undo the browser's popover box. */
.toasts { position: fixed; inset: auto 16px 16px auto; margin: 0; padding: 0; border: 0; background: none; overflow: visible; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--toast); color: #fff; padding: 11px 14px; border-radius: 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 500; box-shadow: 0 16px 36px -14px rgba(20, 21, 26, .6); animation: rise .22s cubic-bezier(.2, .8, .2, 1); }
.toast.ok svg { color: var(--lime); }
.toast.bad svg { color: #FF9C93; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.busy-veil { position: fixed; inset: 0; background: var(--veil); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 90; }
.busy-card { background: var(--tile); border-radius: var(--r); padding: 22px 26px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; font-weight: 600; }

/* ---- responsive ---- */
@media (max-width: 1100px) {
  .s3 { grid-column: span 6; } .s4, .s5 { grid-column: span 6; } .s7, .s8, .s9 { grid-column: span 12; } .s6 { grid-column: span 6; }
  .s4.keep12, .side-col { grid-column: span 12; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-bottom: 86px; }
  .rail { position: fixed; z-index: 40; left: 8px; right: 8px; bottom: 8px; top: auto; height: auto; min-height: 0; flex-direction: row; }
  .rail-user, .rail .brand { display: none; }
  .rail-nav { flex-direction: row; padding: 6px; justify-content: space-around; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-lg); outline: 1px solid var(--line); }
  .nav-link { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 10.5px; flex: 1 1 0; min-width: 0; text-align: center; }
  .nav-link .nav-full { display: none; }
  .nav-link .nav-short { display: inline; }
  .toasts { bottom: 84px; }
  .auth { grid-template-rows: none; min-height: 0; }
  .auth-hero { grid-column: span 12; grid-row: auto; min-height: 220px; }
  .auth-card { grid-column: span 12; grid-row: auto; order: -1; }
  .auth-mini, .auth-mini.sm { display: none; }
  .pdf-scroller { max-height: none; padding: 10px; }
  .page-head h1 { font-size: 25px; }
}
@media (max-width: 620px) {
  .bento > * { grid-column: span 12; }
  .tile { padding: 18px; }
  .stat-value { font-size: 42px; }
  .hide-sm { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .auth-hero .sig path { stroke-dashoffset: 0; }
}

/* ---- small additions used across views ---- */
.trunc.block { display: block; }
.two-line { display: flex; flex-direction: column; min-width: 0; }
.start { align-self: flex-start; }
.search { width: min(320px, 100%); }
.doc-title { font-size: clamp(24px, 3vw, 36px); line-height: 1.12; letter-spacing: -.03em; font-weight: 600; overflow-wrap: anywhere; }
.soft-white { color: rgba(255, 255, 255, .72); }
.btn.dark-outline { background: rgba(255, 255, 255, .1); color: #fff; }
.btn.dark-outline:hover { background: rgba(255, 255, 255, .2); }
.progress.on-lime { background: var(--on-tint-track); }
.progress.on-lime > i { background: var(--ink); }
.meter-legend i.m-complete { background: var(--ok); }
.meter-legend i.m-partial { background: var(--pen); }
.meter-legend i.m-pending { background: #D39A2D; }
.meter-legend i.m-expired { background: var(--bad); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; width: 100%; }
.sticky-top { position: sticky; top: var(--gap); align-self: start; }
.muted-on { color: var(--ink-2); }
.nav-mobile { display: none; }
@media (max-width: 860px) { .nav-mobile { display: flex; } .sticky-top { position: static; } }

.nav-short { display: none; }
.jump-sign { display: none; }
#b-canvas { position: sticky; top: var(--gap); align-self: start; }
@media (max-width: 1100px) { #b-canvas { position: static; } }
@media (max-width: 860px) { .jump-sign { display: inline-flex; align-self: flex-start; } }

/* ---- dropdowns, calendar, tooltips, scrollbars: nothing browser-styled ---- */
@keyframes fade { from { opacity: 0; } }

* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
::placeholder { color: var(--ink-3); opacity: 1; }
::selection { background: var(--pen-soft); color: var(--ink); }
.tile.ink ::selection, .tile.pen ::selection { background: var(--lime); color: var(--fixed-ink); }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 40px var(--tile) inset; transition: background-color 9999s;
}
.input:disabled { background: var(--tile-2); color: var(--ink-3); }

.picker { position: relative; }
.picker-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; cursor: pointer; font-weight: 500; }
.picker-btn svg.i { color: var(--ink-3); transition: transform .15s; }
.picker-btn[aria-expanded="true"] { border-color: var(--pen); box-shadow: 0 0 0 3px var(--pen-soft); }
.picker-btn[data-act="select-open"][aria-expanded="true"] svg.i { transform: rotate(180deg); }
.picker-value { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-value.placeholder { color: var(--ink-3); font-weight: 400; }

.popover {
  position: fixed; z-index: 120; margin: 0; background: var(--tile); color: var(--ink); border-radius: var(--r-m); padding: 6px;
  box-shadow: var(--shadow-lg); animation: pop .14s cubic-bezier(.2, .8, .2, 1);
  max-height: min(380px, calc(100vh - 16px)); overflow-y: auto; outline: 1px solid var(--line);
}
@keyframes pop { from { opacity: 0; translate: 0 -4px; } }
.option { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px 12px; border-radius: var(--r-s); font-weight: 500; font-size: 14px; text-align: left; cursor: pointer; color: var(--ink); }
.option:hover, .option:focus-visible { background: var(--tile-2); outline: none; }
.option.on { background: var(--pen-soft); color: var(--pen-dark); font-weight: 600; }

.calendar { width: 304px; max-width: calc(100vw - 16px); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-head b { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-dow { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 4px 0; }
.cal-day { aspect-ratio: 1; border: 0; background: none; border-radius: 11px; font-size: 13.5px; font-weight: 500; cursor: pointer; color: var(--ink); font-variant-numeric: tabular-nums; }
.cal-day:hover:not([disabled]) { background: var(--tile-2); }
.cal-day.out { color: var(--ink-3); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--pen); font-weight: 700; }
.cal-day.on, .cal-day.on:hover:not([disabled]) { background: var(--pen-fill); color: #fff; box-shadow: none; }
.cal-day[disabled] { color: var(--faint); cursor: not-allowed; }
.cal-foot { display: flex; justify-content: space-between; padding: 2px 4px 0; }

[data-tip] { position: relative; }
@media (hover: hover) {
  [data-tip]:hover::after, [data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; right: 0; bottom: calc(100% + 7px); background: var(--toast); color: #fff; font-size: 12px; font-weight: 500;
    line-height: 1.3; padding: 5px 9px; border-radius: 9px; white-space: nowrap; pointer-events: none; z-index: 30; animation: fade .12s ease-out;
  }
}


@media (max-width: 860px) {
  .mobile-top { padding: 2px 4px; }
  .stage { gap: 10px; }
}

/* ---- theme switch and brand rows ---- */
.theme-switch button { cursor: pointer; }
.theme-switch.compact button { padding: 7px 10px; justify-content: center; }
.nav-theme { margin-top: auto; padding-top: 12px; }
.nav-theme .theme-switch { display: flex; }
.nav-theme .theme-switch button { flex: 1; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-top { width: 100%; max-width: 380px; margin: 0 auto 28px; }
.auth-top .brand { padding: 0; font-size: 21px; }
.auth-top .brand-logo img { height: 58px; }
.mobile-top { display: none; }

@media (max-width: 860px) {
  .nav-theme { display: none; }
  .mobile-top { display: flex; }
}
