/* DocuTrack app — paper, ink and a highlighter. Newsreader for headings, figures and document names;
   Schibsted Grotesk for everything you tap. Square-ish tags, no gradients, no navy. */
@font-face { font-family: 'Schibsted Grotesk'; src: url('/fonts/schibsted-grotesk.woff2') format('woff2'); font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/fonts/newsreader.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }

:root {
  --bg: #F2EEE5; --surface: #FBF9F4; --surface-2: #EAE5D9; --surface-3: #DFD8C9;
  --line: #E1DACB; --line-2: #CEC5B2;
  --ink: #1D1B16; --ink-2: #57514A; --ink-3: #8C8576;
  --mark: #F2D24B; --mark-2: #F7E8A6; --mark-ink: #2A2307;
  --ok: #2A7448; --ok-bg: #DDEADF; --wait: #8F600F; --wait-bg: #F2E5C7; --bad: #AF3626; --bad-bg: #F4DDD7;
  --btn: #1D1B16; --btn-ink: #F8F5EE;
  --bar: rgba(242, 238, 229, .9); --scrim: rgba(24, 21, 16, .42);
  --shadow-1: 0 1px 2px rgba(29, 27, 22, .06); --shadow-2: 0 14px 34px -14px rgba(29, 27, 22, .32);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2357514A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.4 9.6 5.6 5.6 5.6-5.6'/%3E%3C/svg%3E");
  --r-lg: 16px; --r: 12px; --r-sm: 10px; --r-xs: 4px;
  --sans: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --tab-h: 62px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --hl-from: 55%; --hl-to: 92%;        /* the highlighter: through the lower half of the letters */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131210; --surface: #1C1A17; --surface-2: #26241F; --surface-3: #332F29; --line: #2E2B26; --line-2: #403B34;
    --ink: #EFEBE2; --ink-2: #B3AC9E; --ink-3: #847E71; --mark: #E8C53D; --mark-2: rgba(232, 197, 61, .22); --mark-ink: #1E1903;
    --ok: #74C390; --ok-bg: rgba(116, 195, 144, .14); --wait: #E2A84B; --wait-bg: rgba(226, 168, 75, .14); --bad: #EF8B7A; --bad-bg: rgba(239, 139, 122, .14);
    --btn: #EFEBE2; --btn-ink: #131210; --bar: rgba(19, 18, 16, .88); --scrim: rgba(0, 0, 0, .58);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 16px 40px -14px rgba(0, 0, 0, .7);
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B3AC9E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.4 9.6 5.6 5.6 5.6-5.6'/%3E%3C/svg%3E");
    --hl-from: 86%; --hl-to: 100%;     /* on dark paper, a marker stroke under the letters */
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131210; --surface: #1C1A17; --surface-2: #26241F; --surface-3: #332F29; --line: #2E2B26; --line-2: #403B34;
  --ink: #EFEBE2; --ink-2: #B3AC9E; --ink-3: #847E71; --mark: #E8C53D; --mark-2: rgba(232, 197, 61, .22); --mark-ink: #1E1903;
  --ok: #74C390; --ok-bg: rgba(116, 195, 144, .14); --wait: #E2A84B; --wait-bg: rgba(226, 168, 75, .14); --bad: #EF8B7A; --bad-bg: rgba(239, 139, 122, .14);
  --btn: #EFEBE2; --btn-ink: #131210; --bar: rgba(19, 18, 16, .88); --scrim: rgba(0, 0, 0, .58);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 16px 40px -14px rgba(0, 0, 0, .7);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B3AC9E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.4 9.6 5.6 5.6 5.6-5.6'/%3E%3C/svg%3E");
  --hl-from: 86%; --hl-to: 100%;
  color-scheme: dark;
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
body.sheet-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
h1, h2, h3 { font-weight: 500; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.ic { width: 22px; height: 22px; flex: none; }
.ic.inline { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -0.16em; }
.mark { color: var(--ink); }
.mark-pupil { fill: var(--mark); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.wrap { white-space: normal !important; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal !important; }
.hl { background: linear-gradient(transparent var(--hl-from), var(--mark) var(--hl-from), var(--mark) var(--hl-to), transparent var(--hl-to)); padding: 0 3px; margin: 0 -3px; }
.doc-name { font: italic 400 1.04em/1 var(--serif); }

/* ---- frame ---- */
.frame { min-height: 100vh; min-height: 100dvh; }
.main { max-width: 680px; margin: 0 auto; padding: 0 16px calc(var(--tab-h) + var(--safe-b) + 32px); }
.frame.is-full .main { padding-bottom: calc(var(--safe-b) + 104px); }
.rail { display: none; }

.topbar { position: sticky; top: 0; z-index: 20; margin: 0 -16px; padding: var(--safe-t) 6px 0; background: transparent; border-bottom: 1px solid transparent; transition: border-color .2s, background-color .2s; }
body.scrolled .topbar, .topbar.flow { background: var(--bar); -webkit-backdrop-filter: saturate(1.3) blur(16px); backdrop-filter: saturate(1.3) blur(16px); border-bottom-color: var(--line); }
.topbar-row { display: grid; grid-template-columns: minmax(44px, auto) 1fr minmax(44px, auto); align-items: center; height: 52px; gap: 4px; }
.topbar-gap { width: 44px; }
.topbar-title { font-weight: 650; font-size: 16px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transform: translateY(5px); transition: opacity .18s, transform .18s; }
body.scrolled .topbar-title, .topbar-title.on { opacity: 1; transform: none; }
.topbar-actions { display: flex; justify-content: flex-end; align-items: center; gap: 2px; }
.topbar-actions .link-btn { margin-right: 8px; }
.headline { padding: 4px 0 18px; }
.headline h1 { font: 500 36px/1.04 var(--serif); letter-spacing: -0.014em; margin: 0; overflow-wrap: anywhere; }
.headline p { margin: 8px 0 0; color: var(--ink-2); }
.eyebrow { font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
.screen-lead { color: var(--ink-2); margin: -8px 0 16px; font-size: 15px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--ink); position: relative; flex: none; }
.icon-btn:active { background: var(--surface-2); }

/* ---- the tab bar ---- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--bar); -webkit-backdrop-filter: saturate(1.3) blur(16px); backdrop-filter: saturate(1.3) blur(16px); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: 11px; font-weight: 650; letter-spacing: .01em; }
.tab em { font-style: normal; padding: 0 3px; }
.tab.on { color: var(--ink); }
.tab.on em { background: linear-gradient(transparent var(--hl-from), var(--mark) var(--hl-from), var(--mark) var(--hl-to), transparent var(--hl-to)); }
.tab:active .ic { transform: scale(.92); }
.tab-send { display: grid; place-items: center; }
.tab-send span { width: 54px; height: 50px; border-radius: 16px; background: var(--btn); color: var(--btn-ink); display: grid; place-items: center; transform: translateY(-9px); box-shadow: 0 10px 20px -10px rgba(29, 27, 22, .6); transition: transform .1s; }
.tab-send:active span { transform: translateY(-8px) scale(.96); }
.tab-send .ic { width: 26px; height: 26px; stroke-width: 2.1; }

/* ---- lists and rows ---- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 62px; width: 100%; text-align: left; position: relative; }
.row + .row { border-top: 1px solid var(--line); }
a.row:active, button.row:active, .row a.row-main:active { background: var(--surface-2); }
button.row:disabled { opacity: .55; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-main > b { font-weight: 600; font-size: 15.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--ink-2); font-size: 13.5px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub.place { display: flex; align-items: center; gap: 4px; color: var(--ink-3); }
.row-sub.place > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.row-time { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; flex: none; }
.row-note { font-size: 12px; color: var(--wait); white-space: nowrap; }
.row-chev { color: var(--ink-3); width: 18px; height: 18px; }
.row-chev.ok { color: var(--ok); }
.row-ic { color: var(--ink-2); }
.row-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.sub-row { padding-left: 50px; min-height: 54px; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 11px; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.avatar.ok { background: var(--ok-bg); color: var(--ok); }
.avatar.lg { width: 56px; height: 56px; border-radius: 15px; font-size: 19px; }
.letter { font: 500 21px/1 var(--serif); color: var(--ink-3); margin: 20px 4px 8px; }
.block { margin: 24px 0; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.block-head h2, .group-title { font: 500 22px/1.2 var(--serif); letter-spacing: -.006em; margin: 0; }
.group-title { margin: 28px 2px 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: var(--r); background: var(--btn); color: var(--btn-ink); font-weight: 650; font-size: 16px; letter-spacing: -.005em; transition: transform .08s, opacity .15s; text-align: center; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn.secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.danger-solid { background: var(--bad); color: #fff; }
.btn .ic { width: 20px; height: 20px; }
.danger-text { color: var(--bad) !important; }
.link-btn { color: var(--ink); font-weight: 650; font-size: 14.5px; text-decoration: underline; text-decoration-color: var(--mark); text-decoration-thickness: 3px; text-underline-offset: 4px; padding: 6px 2px; white-space: nowrap; cursor: pointer; }
.link-btn.muted { color: var(--ink-2); text-decoration-color: var(--line-2); }
.link-btn.center { display: block; margin: 16px auto 0; }
.row-buttons { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin: 14px 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--r); margin: 0 0 16px; }
.seg button { min-height: 36px; border-radius: 9px; font-size: 13.5px; font-weight: 650; color: var(--ink-2); white-space: nowrap; padding: 0 8px; text-align: center; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.row .seg { margin: 0; flex: none; }
.row .seg button { min-height: 32px; padding: 0 10px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field-hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface);
  font-size: 16px; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
select { background: var(--surface) var(--chev) no-repeat right 12px center / 18px; padding-right: 40px; }
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 4px var(--mark-2); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type=time] { font-variant-numeric: tabular-nums; }
.code-input { font: 650 26px/1 var(--sans) !important; letter-spacing: .34em; text-align: center; font-variant-numeric: tabular-nums; }
.pw { position: relative; display: block; }
.pw input { padding-right: 76px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 36px; padding: 0 12px; font-size: 13px; font-weight: 650; color: var(--ink-2); border-radius: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

.switch { position: relative; flex: none; width: 50px; height: 30px; display: inline-block; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 9px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); transition: background .18s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 7px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .28); transition: transform .2s cubic-bezier(.3, .7, .2, 1), background .2s; }
.switch input:checked + span { background: var(--ink); box-shadow: none; }
.switch input:checked + span::after { transform: translateX(20px); background: var(--mark); }
.switch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch input:disabled + span { opacity: .45; }
.toggles { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin: 16px 0; overflow: hidden; }
.toggles > * + * { border-top: 1px solid var(--line); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; }
.toggle b { display: block; font-weight: 600; font-size: 15px; }
.toggle small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; line-height: 1.4; }
.inline-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; font-size: 14.5px; color: var(--ink-2); }
.inline-fields input { width: 70px !important; min-height: 40px !important; padding: 8px 10px !important; }
.inline-fields select { width: auto !important; min-height: 40px !important; padding: 8px 36px 8px 10px !important; }
.inset-block { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin: 2px 0 14px; }
.toggles > .inset-block { border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0; background: transparent; }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 46px; font-size: 15px; cursor: pointer; }
.check-row input, .radio-row input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; margin: 0; }
.checks { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 14px; }
.checks .check-row + .check-row { border-top: 1px solid var(--line); }
.radio-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); margin-bottom: 10px; cursor: pointer; }
.radio-row:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.radio-row input { margin-top: 1px; }
.radio-row b { display: block; font-weight: 600; }
.radio-row small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.radio-row.disabled { opacity: .55; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dow { position: relative; }
.dow input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.dow span { display: grid; place-items: center; height: 42px; border-radius: 9px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 650; color: var(--ink-2); background: var(--surface); }
.dow input:checked + span { background: var(--ink); color: var(--btn-ink); border-color: var(--ink); }
.dow input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.time-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 7px; border-radius: var(--r-xs); background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 650; white-space: nowrap; }
.tag.ink { background: var(--ink); color: var(--btn-ink); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: var(--ink-2); white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 2px; background: var(--ink-3); flex: none; }
.status.ok { color: var(--ok); } .status.ok i { background: var(--ok); }
.status.wait { color: var(--wait); } .status.wait i { background: var(--wait); }
.status.bad { color: var(--bad); } .status.bad i { background: var(--bad); }
.status.muted { color: var(--ink-3); } .status.muted i { background: var(--line-2); }
.count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--mark); color: var(--mark-ink); font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }
.meter { display: block; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--ink); border-radius: 2px; transition: width .3s; }
.meter.big { height: 8px; border-radius: 3px; margin: 14px 0 12px; }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r); font-size: 14px; line-height: 1.42; margin: 0 0 14px; }
.notice .ic { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.notice > span { flex: 1; }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.wait { background: var(--wait-bg); color: var(--wait); }
.notice .link-btn { color: inherit; text-decoration-color: currentColor; padding: 0; font-size: 14px; }
.offline { display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 8px) 16px 8px; background: var(--mark); color: var(--mark-ink); font-size: 13px; font-weight: 650; }
.offline .ic { width: 17px; height: 17px; }
.empty { text-align: center; padding: 42px 16px 28px; }
.empty h3 { font: italic 400 26px/1.2 var(--serif); margin: 0 0 8px; }
.empty p { color: var(--ink-2); margin: 0 auto 20px; max-width: 34ch; }
.empty .stack-sm { max-width: 320px; margin: 0 auto; }
.skel { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
.skel.sq { width: 40px; height: 40px; border-radius: 11px; flex: none; }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.w40 { width: 40%; } .w50 { width: 50%; } .w60 { width: 60%; }
.skel-block { display: flex; flex-direction: column; gap: 14px; padding: 18px; min-height: 150px; }
.spinner { display: inline-block; width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--ink); animation: spin .8s linear infinite; flex: none; }
.spinner.small { width: 16px; height: 16px; border-width: 2px; }
.center-pad { display: grid; place-items: center; padding: 32px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.ptr { position: fixed; top: calc(var(--safe-t) + 10px); left: 50%; z-index: 60; width: 40px; height: 40px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-2); display: grid; place-items: center; opacity: 0; transform: translate(-50%, 0); pointer-events: none; }
.ptr .ic { width: 20px; height: 20px; }
.ptr.spin .ic { animation: spin .7s linear infinite; }

/* ---- home ---- */
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(var(--safe-t) + 10px) 0 2px; }
.company-btn { display: inline-flex; align-items: center; gap: 9px; min-height: 42px; padding: 0 8px 0 0; font-weight: 650; font-size: 15px; border-radius: 10px; max-width: 78%; color: var(--ink); }
.company-btn:disabled { cursor: default; }
.company-btn .mark { width: 24px; height: 28px; flex: none; }
.company-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-btn .ic { width: 18px; height: 18px; color: var(--ink-3); }
.bell b { position: absolute; top: 6px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 5px; background: var(--mark); color: var(--mark-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.hello { padding: 14px 0 18px; }
.hello h1 { font: 500 33px/1.07 var(--serif); margin: 0; letter-spacing: -.014em; }
.hello p { color: var(--ink-2); margin: 8px 0 0; }
.ledger { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 14px; }
.lg { padding: 14px 14px 12px; display: flex; flex-direction: column; min-width: 0; }
.lg + .lg { border-left: 1px solid var(--line); }
.lg-label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.lg strong { font: 500 40px/1 var(--serif); letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; margin: 8px 0 4px; font-weight: 500; }
.lg-sub { font-size: 12px; line-height: 1.3; color: var(--ink-3); }
.lg-chart { grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 12px 14px 10px; }
.spark { width: 100%; height: 56px; }
.sp-sent { fill: var(--surface-3); }
.sp-open { fill: var(--ink); }
.lg-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 9px; font-size: 12px; color: var(--ink-2); }
.lg-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.k-sent { background: var(--surface-3); } .k-open { background: var(--ink); }
.lg-median { margin-left: auto; }
.send-cta { margin: 4px 0 24px; }
.feed-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.feed-ic .ic { width: 18px; height: 18px; }
.feed-ic.ok { background: var(--ok-bg); color: var(--ok); } .feed-ic.bad { background: var(--bad-bg); color: var(--bad); } .feed-ic.wait { background: var(--wait-bg); color: var(--wait); }
.feed-text { font-size: 14.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row.feed { align-items: flex-start; } .row.feed .row-time { margin-top: 2px; }
.card.install, .card.promo { display: grid; grid-template-columns: 26px 1fr; gap: 4px 12px; margin-bottom: 16px; align-items: start; }
.card.install > .ic, .card.promo > .ic { width: 26px; height: 26px; margin-top: 1px; }
.card.install p, .card.promo p { margin-top: 3px; color: var(--ink-2); font-size: 14px; }
.install-actions { grid-column: 2; display: flex; gap: 14px; align-items: center; margin-top: 10px; }
.first-steps h2 { font: 500 22px/1.2 var(--serif); margin: 0 0 8px; }
.first-steps .steps { margin-top: 14px; gap: 14px; }
.first-steps .steps p { margin: 2px 0 0; }
.row.note { align-items: flex-start; }
.note-mark { width: 9px; height: 9px; border-radius: 2px; flex: none; margin-top: 6px; background: transparent; }
.row.note.unread .note-mark { background: var(--mark); box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.row.note:not(.unread) b { font-weight: 500; }

/* ---- documents ---- */
.tools { display: flex; gap: 8px; margin-bottom: 12px; }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px; border-radius: var(--r); background: var(--surface-2); color: var(--ink-3); }
.search input { border: 0 !important; background: transparent !important; box-shadow: none !important; min-height: 0 !important; height: 42px; padding: 0 !important; font-size: 16px; color: var(--ink); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search .ic { width: 19px; height: 19px; }
.search.inset { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); margin-bottom: 10px; }
.mini-select { width: auto !important; max-width: 44%; min-height: 46px !important; padding: 0 36px 0 12px !important; font-size: 14px !important; font-weight: 650; background-color: var(--surface-2) !important; border: 0 !important; border-radius: var(--r) !important; }
.doc-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.doc-ic.locked { background: var(--ink); color: var(--mark); }
.row.doc { align-items: flex-start; }
.row.doc .doc-ic { margin-top: 1px; }
.row.doc .row-main > b { font: 500 17px/1.25 var(--serif); }
.row.doc .row-chev { margin-top: 11px; }
.doc-meta { display: flex; flex-direction: column; gap: 10px; margin: -8px 0 16px; color: var(--ink-2); font-size: 14px; }
.doc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.summary-main { display: flex; align-items: baseline; gap: 10px; }
.summary-main strong { font: 500 46px/1 var(--serif); letter-spacing: -.02em; font-weight: 500; }
.summary-main strong span { font-size: 26px; color: var(--ink-3); letter-spacing: 0; }
.summary-main > span { color: var(--ink-2); font-weight: 650; }
.summary-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-2); font-size: 13.5px; }
.summary-stats b { color: var(--ink); font-weight: 700; }
.tl-day { margin-bottom: 16px; }
.tl-day-label { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 2px 8px; }
.timeline { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.timeline li { display: grid; grid-template-columns: 30px 1fr auto; gap: 11px; padding: 12px 14px; align-items: start; }
.timeline li + li { border-top: 1px solid var(--line); }
.tl-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; }
.tl-ic .ic { width: 16px; height: 16px; }
.timeline li.ok .tl-ic { background: var(--ok-bg); color: var(--ok); }
.timeline li.bad .tl-ic { background: var(--bad-bg); color: var(--bad); }
.timeline li.wait .tl-ic { background: var(--wait-bg); color: var(--wait); }
.timeline b { font-weight: 600; font-size: 14.5px; }
.tl-meta { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.timeline time { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ---- sheets ---- */
#sheet-root { position: relative; z-index: 100; }
.sheet-backdrop { position: fixed; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .22s; }
.sheet-backdrop.in { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 90vh; max-height: 90dvh; display: flex; flex-direction: column; background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .18); transform: translateY(104%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); padding-bottom: var(--safe-b); }
.sheet.in { transform: none; }
.sheet.tall { height: 90vh; height: 90dvh; }
.sheet-grip { display: grid; place-items: center; height: 24px; flex: none; cursor: grab; }
.sheet-grip span { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); }
.sheet-body { overflow-y: auto; padding: 0 18px 22px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; flex: 1; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 2px 0 16px; }
.sheet-head h2 { font: 500 26px/1.15 var(--serif); margin: 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
.sheet-head p { margin-top: 4px; color: var(--ink-2); font-size: 14px; }
.sheet-head .icon-btn { margin: -8px -10px 0 0; }
.sheet-text { color: var(--ink-2); margin: 0 0 16px; }
.sheet-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-top: 20px; }
.kv { display: flex; flex-direction: column; margin: 0 0 18px; }
.kv > div { display: grid; grid-template-columns: 116px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14.5px; align-items: baseline; }
.kv > div:first-child { border-top: 0; }
.kv > div > span { color: var(--ink-3); font-size: 13.5px; }
.kv b { font-weight: 500; overflow-wrap: anywhere; }
.kv small { display: block; color: var(--ink-3); font-weight: 400; font-size: 13px; margin-top: 2px; }
.kv.card { padding: 4px 16px; }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.action-grid > * { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-height: 78px; padding: 10px 6px; border-radius: var(--r); background: var(--surface-2); font-size: 12.5px; font-weight: 650; text-align: center; color: var(--ink); line-height: 1.2; }
.action-grid > *:active { background: var(--surface-3); }
.action-grid .danger { color: var(--bad); }
.menu-list { display: flex; flex-direction: column; }
.menu-list button { display: flex; align-items: flex-start; gap: 14px; padding: 14px 2px; text-align: left; border-top: 1px solid var(--line); width: 100%; }
.menu-list button:first-child { border-top: 0; }
.menu-list b { display: block; font-weight: 600; }
.menu-list small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.menu-list .danger, .menu-list .danger small { color: var(--bad); }
.picks { margin: 0 0 14px; }
.menu-list a { display: flex; align-items: flex-start; gap: 14px; padding: 14px 2px; border-top: 1px solid var(--line); width: 100%; }
.empty-card p { color: var(--ink-2); margin-bottom: 12px; }
.qr-box { display: grid; place-items: center; padding: 16px; margin: 0 0 18px; background: #fff; border-radius: var(--r-lg); border: 1px solid var(--line); }
.qr-box img { width: min(240px, 68vw); height: auto; image-rendering: pixelated; }
.pair-code { display: flex; justify-content: center; gap: 12px; margin: 4px 0 14px; }
.pair-code span { font: 650 32px/1 var(--mono); letter-spacing: .16em; padding: 16px 14px 16px 18px; border-radius: 12px; background: var(--surface-2); color: var(--ink); }
.file-card.flat { border: 0; padding: 0; margin: 0; background: transparent; }

/* ---- toasts ---- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); z-index: 300; display: flex; align-items: center; gap: 16px; width: max-content; max-width: min(520px, calc(100vw - 32px)); padding: 13px 16px; border-radius: 12px; background: var(--ink); color: var(--btn-ink); font-size: 14.5px; font-weight: 550; box-shadow: var(--shadow-2); transform: translate(-50%, 16px); opacity: 0; transition: transform .22s, opacity .22s; }
.toast.in { transform: translate(-50%, 0); opacity: 1; }
.toast.bad { background: var(--bad); color: #fff; }
.toast button { color: var(--mark); font-weight: 750; white-space: nowrap; }
.toast.bad button { color: #fff; text-decoration: underline; }
body:has(.frame.is-full) .toast, body.sheet-open .toast { bottom: calc(var(--safe-b) + 96px); }

/* ---- signing in ---- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--safe-t) + 28px) 22px calc(var(--safe-b) + 22px); max-width: 460px; margin: 0 auto; }
.auth-brand, .splash { display: flex; align-items: center; gap: 10px; font: 600 23px/1 var(--serif); }
.auth-brand .mark { width: 30px; height: 35px; }
.auth-panel { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 28px 0; }
.auth-title { font: 500 42px/1.03 var(--serif); letter-spacing: -.018em; margin: 0 0 10px; }
.auth-lead { color: var(--ink-2); margin-bottom: 24px; font-size: 16.5px; }
.auth-foot { display: flex; gap: 8px; justify-content: center; color: var(--ink-3); font-size: 13px; }
.auth-foot a { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.splash { min-height: 100vh; min-height: 100dvh; justify-content: center; flex-direction: column; gap: 16px; font-size: 26px; }
.splash .mark { width: 50px; height: 58px; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .5; } }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 20px; }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 30px 1fr; gap: 12px; }
.steps > li::before { content: counter(step); width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: var(--btn-ink); display: grid; place-items: center; font-weight: 750; font-size: 14px; }
.steps > li > div { min-width: 0; }
.steps b { display: block; font-weight: 650; margin: 4px 0; }
.steps p { color: var(--ink-2); font-size: 14px; margin-bottom: 12px; }
.steps.plain > li::before { background: var(--surface-2); color: var(--ink); }
.steps.plain > li > div { padding-top: 4px; }
.mono-key { font: 600 15px/1.5 var(--mono); letter-spacing: .06em; overflow-wrap: anywhere; color: var(--ink-2); margin-top: 12px; }
.qr-more summary { cursor: pointer; font-size: 14px; color: var(--ink-2); margin-top: 12px; }
.qr-more img { margin-top: 12px; border-radius: 10px; background: #fff; padding: 8px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.codes code { font: 600 15px/1 var(--mono); padding: 12px 8px; text-align: center; background: var(--surface-2); border-radius: 9px; letter-spacing: .04em; }
.card.secret code { display: block; font: 600 22px/1.3 var(--mono); letter-spacing: .06em; margin: 8px 0 12px; overflow-wrap: anywhere; }
.card.secret p { color: var(--ink-2); font-size: 13.5px; margin-top: 12px; }
.card.secret { margin: 0 0 16px; }

/* ---- sending ---- */
.topbar.flow { background: var(--bar); }
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; list-style: none; margin: 0; padding: 0 10px 10px; }
.stepper li { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; font-weight: 650; color: var(--ink-3); }
.stepper i { display: block; height: 4px; border-radius: 2px; background: var(--surface-3); }
.stepper li.done i { background: var(--ink); }
.stepper li.on { color: var(--ink); }
.stepper li.on i { background: var(--mark); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.flow-body { padding: 18px 0 8px; }
.flow-title { font: 500 31px/1.1 var(--serif); margin: 0 0 6px; letter-spacing: -.014em; }
.flow-lead { color: var(--ink-2); margin-bottom: 20px; }
.flow-bar .btn { padding: 0 14px; white-space: nowrap; }
.flow-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; padding: 12px 16px calc(var(--safe-b) + 12px); background: var(--bar); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 36px 20px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; margin-bottom: 20px; }
.drop .ic { width: 34px; height: 34px; color: var(--ink); }
.drop b { font-size: 17px; font-weight: 650; }
.drop span { color: var(--ink-2); font-size: 14px; max-width: 32ch; }
.drop:active, .drop.over { background: var(--surface-2); border-color: var(--ink); }
button.drop { width: 100%; color: inherit; }
.file-card { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 20px; }
.file-card .row-main > b { font: 500 17px/1.25 var(--serif); }
.adder { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin: 14px 0; }
.adder summary { list-style: none; padding: 15px 14px; font-weight: 650; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.adder summary::-webkit-details-marker { display: none; }
.adder summary::after { content: '+'; font-size: 22px; line-height: 1; color: var(--ink-3); font-weight: 400; }
.adder[open] summary::after { content: '–'; }
.adder .stack { padding: 0 14px 14px; }
.result-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; }
.result-head h2 { font: 500 29px/1.15 var(--serif); margin: 0; letter-spacing: -.012em; }
.result-head .ic { width: 38px; height: 38px; padding: 8px; border-radius: 11px; }
.result-head.ok .ic { background: var(--ok-bg); color: var(--ok); }
.result-head.bad .ic { background: var(--bad-bg); color: var(--bad); }
.res-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.res-ic .ic { width: 16px; height: 16px; }
.res-ic.sent { background: var(--ok-bg); color: var(--ok); }
.res-ic.failed { background: var(--bad-bg); color: var(--bad); }
.res-ic.ready { background: var(--wait-bg); color: var(--wait); }

/* ---- alert rules ---- */
.form-sections section { margin-bottom: 30px; }
.section-title { display: flex; align-items: center; gap: 10px; font: 500 23px/1.2 var(--serif); margin: 0 0 14px; }
.section-title span { width: 28px; height: 28px; border-radius: 8px; background: var(--mark); color: var(--mark-ink); display: grid; place-items: center; font: 750 14px/1 var(--sans); flex: none; }
.form-sections .field { margin-bottom: 14px; }
.row.rule { align-items: center; padding-right: 14px; }
.row.rule .row-main { padding: 2px 6px 2px 0; }
.row.rule.off .row-main > b { color: var(--ink-3); }
.bad-text { color: var(--bad) !important; white-space: normal !important; }

/* ---- more ---- */
.card.me { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.card.me > div { min-width: 0; }
.card.me b { display: block; font-size: 17px; font-weight: 650; }
.card.me span { display: block; color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.card.me .muted { color: var(--ink-3); }
.sign-out { margin-top: 28px; color: var(--bad) !important; }
.version { text-align: center; color: var(--ink-3); font-size: 12.5px; margin-top: 18px; }
.mfa-state { display: flex; gap: 12px; align-items: center; }
.mfa-state .ic { width: 40px; height: 40px; padding: 9px; border-radius: 11px; background: var(--surface-2); color: var(--ink-2); }
.mfa-state.on .ic { background: var(--ok-bg); color: var(--ok); }
.mfa-state b { display: block; font-weight: 650; }
.mfa-state span { color: var(--ink-2); font-size: 14px; }

/* ---- wide screens: a rail instead of the tab bar ---- */
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(540px, calc(100vw - 48px)); max-height: min(86vh, 780px); border-radius: 20px; transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: transform .22s, opacity .18s; padding-bottom: 0; }
  .sheet.in { transform: translate(-50%, -50%); opacity: 1; }
  .sheet.tall { height: auto; }
  .sheet-grip { display: none; }
  .sheet-body { padding-top: 20px; }
}
@media (min-width: 960px) {
  .tabbar { display: none; }
  .frame { padding-left: 264px; }
  .rail { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: 264px; padding: 22px 16px; border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
  .rail-brand { display: flex; align-items: center; gap: 10px; font: 600 22px/1 var(--serif); padding: 4px 8px 18px; }
  .rail-brand .mark { width: 26px; height: 30px; }
  .rail-company { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 11px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 650; font-size: 14px; margin-bottom: 12px; text-align: left; }
  .rail-company.static { display: block; }
  .rail-company .ic { width: 18px; height: 18px; color: var(--ink-3); }
  .rail-send { margin-bottom: 16px; }
  .rail-nav { display: flex; flex-direction: column; gap: 2px; }
  .rail-nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 10px; border-radius: 10px; color: var(--ink-2); font-weight: 650; font-size: 15px; }
  .rail-nav a:hover { background: var(--surface-2); color: var(--ink); }
  .rail-nav a.on { color: var(--ink); }
  .rail-nav a.on span { background: linear-gradient(transparent var(--hl-from), var(--mark) var(--hl-from), var(--mark) var(--hl-to), transparent var(--hl-to)); padding: 0 2px; }
  .rail-nav .count { margin-left: auto; }
  .main { max-width: 780px; padding: 0 40px 64px; }
  .frame.is-full .main { padding-bottom: 120px; }
  .topbar { margin: 0 -40px; padding: 0 28px; }
  .home-top .company-btn .mark { display: none; }
  .flow-bar { left: 264px; padding: 14px max(40px, calc((100vw - 264px - 780px) / 2 + 40px)); }
  .toast, body:has(.frame.is-full) .toast { bottom: 28px; margin-left: 132px; }
  .headline h1 { font-size: 42px; }
  a.row:hover, button.row:hover { background: var(--surface-2); }
}
@media (max-width: 370px) {
  .lg strong { font-size: 32px; }
  .action-grid { grid-template-columns: repeat(2, 1fr); }
  .two, .time-pair { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
