/* Scanly Glass — web portal design system (Sept 2026 remake).
   Spec: GLASS.md (shared with the iOS app and the admin console).
   Two layers: a warm "daylight" backdrop with frosted content surfaces
   (translucent fills, no blur), and a functional layer of real Liquid-Glass
   material (sidebar, top bar, tab bar, bulk bar, dialogs, menus, toasts).
   Monochrome controls with ONE ink primary per context; colour only for
   status, user content and category icon chips. Tailwind (CDN) is used for
   layout utilities only — every colour, radius, shadow and motion token
   lives here. */

:root {
  color-scheme: light;
  /* backdrop */
  --paper: #F3F1EC;
  --f1: rgba(255, 160, 110, .70);
  --f2: rgba(128, 206, 170, .66);
  --f3: rgba(247, 214, 120, .62);
  --f4: rgba(238, 150, 140, .45);
  /* surfaces */
  --glass: rgba(255, 255, 255, .52);
  --glass-strong: rgba(255, 255, 255, .74);
  --glass-nav: rgba(255, 255, 255, .44);
  --glass-sheet: rgba(255, 255, 255, .62);
  --glass-edge: rgba(255, 255, 255, .85);
  --nav-on: var(--glass-strong);
  --hair: rgba(20, 20, 24, .08);
  --hair-2: rgba(20, 20, 24, .14);
  --fill: rgba(20, 20, 24, .05);
  --fill-2: rgba(20, 20, 24, .09);
  --solid: #FFFFFF;
  --thumb: rgba(255, 255, 255, .55);
  --overlay: rgba(20, 16, 12, .28);
  --blur: blur(30px) saturate(180%);
  --shadow: 0 1px 1px rgba(20, 20, 24, .04), 0 10px 30px -12px rgba(40, 30, 20, .18);
  --shadow-lg: 0 30px 60px -24px rgba(40, 30, 20, .35);
  --spec-glow: rgba(255, 255, 255, .55);
  /* text */
  --text: #141416;
  --text-2: #4E4E56;
  --text-3: #5F5F67;
  /* ink accent (flips between modes: labels on it use --on-ink) */
  --ink: #141416;
  --on-ink: #FFFFFF;
  --ink-hover: #2A2A2E;
  --ink-shadow: 0 8px 20px -8px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .18);
  /* status */
  --success: #0B6B41; --success-soft: rgba(16, 150, 90, .12);
  --warn: #8A5006;    --warn-soft: rgba(220, 140, 20, .14);
  --danger: #B42A23;  --danger-soft: rgba(200, 50, 40, .11);
  --danger-fill: #C4312A;
  --star: #E9A800;
  --toggle-on: #34C759;
  /* category icon chips (white glyph) */
  --c-orange: #F2743B; --c-green: #2FA37A; --c-red: #D9544D; --c-amber: #E3A21A;
  --c-teal: #2A9D9A; --c-brown: #8C6B4F; --c-pink: #D65A8A; --c-graphite: #5B5B66;
  /* shape + motion */
  --r-tile: 18px; --r-card: 22px; --r-panel: 26px; --r-field: 14px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --sidebar-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Geist", "Segoe UI Variable", "Segoe UI", Roboto, "Noto Sans Gurmukhi", sans-serif;
}
html.dark {
  color-scheme: dark;
  --paper: #0A0A0C;
  --f1: rgba(232, 118, 70, .40);
  --f2: rgba(52, 160, 124, .34);
  --f3: rgba(205, 152, 60, .24);
  --f4: rgba(190, 96, 84, .24);
  --glass: rgba(30, 30, 34, .50);
  --glass-strong: rgba(44, 44, 48, .72);
  --glass-nav: rgba(28, 28, 32, .48);
  --glass-sheet: rgba(30, 30, 34, .66);
  --glass-edge: rgba(255, 255, 255, .14);
  --hair: rgba(255, 255, 255, .08);
  --hair-2: rgba(255, 255, 255, .14);
  --fill: rgba(255, 255, 255, .06);
  --fill-2: rgba(255, 255, 255, .10);
  --solid: #1C1C1F;
  --thumb: rgba(255, 255, 255, .05);
  --overlay: rgba(0, 0, 0, .55);
  --shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 14px 34px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, .9);
  --spec-glow: rgba(255, 255, 255, .09);
  --text: #F4F4F5;
  --text-2: #B8B8C0;
  --text-3: #9C9CA5;
  --ink: #F4F4F5;
  --on-ink: #0B0B0C;
  --ink-hover: #FFFFFF;
  --ink-shadow: 0 8px 22px -10px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .6);
  --success: #4ADE80; --success-soft: rgba(74, 222, 128, .14);
  --warn: #FBBF24;    --warn-soft: rgba(251, 191, 36, .14);
  --danger: #F87171;  --danger-soft: rgba(248, 113, 113, .14);
  --star: #FACC15;
  --toggle-on: #30D158;
}
/* Reduce Transparency / Increase Contrast: opaque surfaces, no colour fields. */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  :root, html.dark {
    --glass: var(--solid); --glass-strong: var(--solid); --glass-nav: var(--solid); --glass-sheet: var(--solid);
    --nav-on: var(--fill-2); --blur: none; --spec-glow: transparent;
  }
  .backdrop i { display: none; }
}
@media (prefers-contrast: more) {
  :root { --hair: rgba(20, 20, 24, .30); --hair-2: rgba(20, 20, 24, .50); --text-2: #2E2E33; --text-3: #3A3A40; }
  html.dark { --hair: rgba(255, 255, 255, .32); --hair-2: rgba(255, 255, 255, .5); --text-2: #DADAE0; --text-3: #C8C8CF; }
}

/* ---------------------------------------------------------------- base */
[hidden] { display: none !important; }
html { background: var(--paper); color: var(--text); -webkit-text-size-adjust: 100%; }
body { background: transparent; color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; min-height: 100dvh; overflow-x: hidden; }
html[lang="pa"] body { line-height: 1.6; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(247, 214, 120, .55); color: var(--text); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button, [role="button"], summary, label[for], .chip-btn { cursor: pointer; touch-action: manipulation; }
button { color: inherit; font: inherit; }
img { max-width: 100%; }
.tabular, [data-count] { font-variant-numeric: tabular-nums; }
.skip-link { position: absolute; left: 12px; top: -80px; z-index: 100; padding: .6rem 1.1rem; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-weight: 600; transition: top .2s var(--ease-out); }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Daylight backdrop: paper + four soft colour fields. Static (no drift) so
   the glass above never has to re-blur a moving background. */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--paper); }
.backdrop i { position: absolute; border-radius: 50%; }
.backdrop i:nth-child(1) { width: 62vmax; height: 62vmax; left: -20vmax; top: -26vmax; background: radial-gradient(closest-side, var(--f1), transparent); }
.backdrop i:nth-child(2) { width: 56vmax; height: 56vmax; right: -18vmax; top: -12vmax; background: radial-gradient(closest-side, var(--f2), transparent); }
.backdrop i:nth-child(3) { width: 54vmax; height: 54vmax; left: 18vw; bottom: -32vmax; background: radial-gradient(closest-side, var(--f3), transparent); }
.backdrop i:nth-child(4) { width: 40vmax; height: 40vmax; right: 6vw; bottom: -12vmax; background: radial-gradient(closest-side, var(--f4), transparent); }

/* ---------------------------------------------------------------- type */
.display { font-size: clamp(1.75rem, 4.2vw, 2.125rem); line-height: 1.1; font-weight: 700; letter-spacing: -.035em; }
.h1 { font-size: clamp(1.5rem, 3vw, 1.75rem); line-height: 1.15; font-weight: 700; letter-spacing: -.03em; }
.h2 { font-size: 1.0625rem; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; }
.sec-title { display: flex; align-items: center; gap: .5rem; font-size: 1.0625rem; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; color: var(--text); }
.sec-title .count { font-weight: 500; color: var(--text-2); }
.lead { color: var(--text-2); font-size: 1rem; }
.eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .02em; color: var(--text-2); }
.meta { font-size: .8125rem; font-weight: 500; color: var(--text-2); }
.t-muted { color: var(--text-2); }
.t-faint { color: var(--text-3); }
.t-accent { color: var(--text); }
.t-danger { color: var(--danger); }
.t-success { color: var(--success); }
.t-warn { color: var(--warn); }
.t-star { color: var(--star); }
.link { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--hair-2); text-decoration-thickness: 1.5px; text-underline-offset: 3px; transition: text-decoration-color .16s; }
.link:hover { text-decoration-color: currentColor; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; padding: .08rem .45rem; border-radius: 7px; background: var(--fill); border: 1px solid var(--hair-2); color: var(--text); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ic-fill path, .ic-fill circle { fill: currentColor; }

/* ---------------------------------------------------------------- logo */
.logo { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); }
.logo-mark { flex-shrink: 0; border-radius: 27.5%; }
.logo-word { font-size: 1.1875rem; font-weight: 700; letter-spacing: -.02em; }
.logo-beam { animation: logo-beam 3.2s ease-in-out infinite alternate; }
@keyframes logo-beam { 0%, 8% { transform: translateY(-7px); } 92%, 100% { transform: translateY(8px); } }
html.dark .logo-mark { box-shadow: 0 0 0 .5px rgba(255, 255, 255, .18); }

/* ---------------------------------------------------------------- icon chips (Settings-style) */
.ic-chip { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 30%; color: #fff; background: var(--c-graphite); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 4px 10px -4px rgba(0, 0, 0, .3); }
.ic-chip svg { width: 18px; height: 18px; }
.ic-chip-sm { width: 28px; height: 28px; } .ic-chip-sm svg { width: 15px; height: 15px; }
.ic-chip-lg { width: 44px; height: 44px; } .ic-chip-lg svg { width: 22px; height: 22px; }
.ic-chip-xl { width: 56px; height: 56px; } .ic-chip-xl svg { width: 28px; height: 28px; }
.c-orange { background: var(--c-orange); } .c-green { background: var(--c-green); } .c-red { background: var(--c-red); }
.c-amber { background: var(--c-amber); } .c-teal { background: var(--c-teal); } .c-brown { background: var(--c-brown); }
.c-pink { background: var(--c-pink); } .c-graphite { background: var(--c-graphite); }

/* ---------------------------------------------------------------- glass (functional layer) */
.glass-nav { position: relative; background: var(--glass-nav); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--hair); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge); }
/* 1px specular ring: bright top-left edge fading to a hairline bottom-right. */
.glass-nav::before, .card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; background: linear-gradient(160deg, var(--glass-edge), transparent 38%, transparent 70%, var(--hair-2)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
/* Pointer-following highlight (desktop). Painted under the content. */
.specular { isolation: isolate; }
.specular::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s; background: radial-gradient(280px circle at var(--mx, 50%) var(--my, -30%), var(--spec-glow), transparent 65%); }
@media (hover: hover) and (pointer: fine) { .specular:hover::after { opacity: 1; } }

/* ---------------------------------------------------------------- shell */
.sidebar { position: fixed; z-index: 40; top: 12px; bottom: 12px; left: 12px; width: var(--sidebar-w); display: none; flex-direction: column; border-radius: var(--r-panel); padding: 12px 10px 10px; }
.sidebar-brand { display: flex; align-items: center; min-height: 52px; padding: 0 10px 8px; border-radius: 16px; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 4px 0 12px; scrollbar-width: none; }
.sidebar-scroll::-webkit-scrollbar { display: none; }
.nav-item { position: relative; display: flex; align-items: center; gap: .75rem; min-height: 42px; padding: 0 .85rem; border-radius: 999px; border: 1px solid transparent; font-size: .9375rem; font-weight: 500; color: var(--text-2); transition: background .16s, color .16s, transform .16s var(--spring); }
.nav-item > svg { flex-shrink: 0; }
.nav-item:hover { background: var(--fill); color: var(--text); }
.nav-item:active { transform: scale(.98); }
.nav-item.is-active { background: var(--nav-on); color: var(--text); font-weight: 600; border-color: var(--hair); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), inset 0 1px 0 var(--glass-edge); }
.nav-item .badge { margin-left: auto; }
.nav-sub { margin-top: 1.1rem; }
.nav-sub-h { display: flex; align-items: center; justify-content: space-between; padding: 0 .9rem .4rem; }
.saved-item { position: relative; }
.saved-item > .nav-item { min-height: 38px; font-size: .875rem; padding-right: 2.6rem; }
.saved-item > details { position: absolute; right: 2px; top: 1px; }
.saved-item > details > summary { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; color: var(--text-2); opacity: 0; transition: opacity .16s, background .16s; }
.saved-item > details > summary:hover { background: var(--fill); }
.saved-item:hover > details > summary, .saved-item > details[open] > summary, .saved-item > details > summary:focus-visible { opacity: 1; }
.saved-item > details[open] { position: static; }
.saved-item > details[open] > .saved-pop { margin: .3rem .1rem .6rem; }
@media (hover: none) { .saved-item > details > summary { opacity: 1; } }
.saved-pop { padding: .6rem; border-radius: 18px; background: var(--fill); border: 1px solid var(--hair); }
.sidebar-foot { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding-top: 8px; border-top: 1px solid var(--hair); }
.storage-mini { display: block; padding: .55rem .75rem; border-radius: 16px; transition: background .16s; }
.storage-mini:hover { background: var(--fill); }
.acct { display: flex; align-items: center; gap: .65rem; padding: .35rem .35rem .35rem .5rem; border-radius: 18px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-weight: 650; font-size: .875rem; }
.topbar { position: sticky; top: calc(10px + env(safe-area-inset-top)); z-index: 30; margin: calc(10px + env(safe-area-inset-top)) 12px 0; }
.topbar-in { display: flex; align-items: center; gap: .35rem; max-width: 1180px; margin: 0 auto; padding: 5px 5px 5px 8px; border-radius: 999px; }
.search-pill { position: relative; flex: 1; min-width: 0; }
.search-pill .input { padding-left: 2.6rem; padding-right: 1rem; border-radius: 999px; }
.search-pill .ic { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; display: flex; }
.search-pill .kbd { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.topbar .search-pill .input { background: var(--fill); border-color: transparent; box-shadow: none; min-height: 42px; padding-right: 2.4rem; }
.topbar .search-pill .input:focus { background: var(--glass-strong); }
.topbar .logo-home { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; flex-shrink: 0; border-radius: 999px; }
.tabbar { position: fixed; z-index: 40; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 999px; }
.tab-item { position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 52px; border-radius: 999px; border: 1px solid transparent; font-size: .6875rem; font-weight: 600; color: var(--text-2); transition: background .16s, color .16s, transform .16s var(--spring); -webkit-tap-highlight-color: transparent; }
.tab-item:active { transform: scale(.94); }
.tab-item.is-active { color: var(--text); background: var(--nav-on); border-color: var(--hair); box-shadow: 0 1px 3px rgba(0, 0, 0, .08), inset 0 1px 0 var(--glass-edge); }
.tab-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tab-item .badge { position: absolute; top: 3px; right: calc(50% - 22px); }
.main { padding: 1.25rem 1rem calc(7.5rem + env(safe-area-inset-bottom)); }
.container { max-width: 1180px; margin: 0 auto; }
.site-foot { padding: 0 1rem calc(7.5rem + env(safe-area-inset-bottom)); margin-top: -5rem; text-align: center; font-size: .8125rem; color: var(--text-2); }
.site-foot a { text-decoration: underline; text-decoration-color: var(--hair-2); text-underline-offset: 3px; }
.site-foot a:hover { text-decoration-color: currentColor; }
@media (min-width: 768px) {
  .sidebar { display: flex; }
  .has-shell .topbar, .has-shell .main, .has-shell .site-foot { margin-left: calc(var(--sidebar-w) + 12px); }
  .topbar { top: 12px; margin-top: 12px; margin-right: 20px; padding-left: 20px; }
  .tabbar, .md-hide { display: none !important; }
  .main { padding: 1.75rem 1.25rem 3rem 2rem; }
  .has-shell .main { padding-right: 1.25rem; }
  .site-foot { margin-top: 0; padding-bottom: 2rem; }
}
@media (min-width: 768px) and (max-width: 1023px) { :root { --sidebar-w: 220px; } }
@media (min-width: 1200px) { .main { padding-left: 2.5rem; padding-right: 2rem; } .has-shell .main { padding-right: 2rem; } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.25rem; margin-bottom: 1.5rem; }
.page-head .h1 { display: flex; align-items: center; gap: .75rem; }
.page-head > .ph-main { flex: 1 1 20rem; min-width: 0; }
.page-head .lead, .page-head p { color: var(--text-2); }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; margin-bottom: .9rem; font-size: .875rem; color: var(--text-2); }
.crumbs a { display: inline-flex; align-items: center; gap: .3rem; min-height: 34px; padding: 0 .6rem; border-radius: 999px; font-weight: 500; transition: background .16s, color .16s; }
.crumbs a:hover { background: var(--fill); color: var(--text); }
.crumbs .sep { display: inline-flex; color: var(--text-2); opacity: .7; }
.crumbs [aria-current] { color: var(--text); font-weight: 600; padding: 0 .6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section { margin-bottom: 2.25rem; }
.section-h { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 40px; margin-bottom: .75rem; }

/* ---------------------------------------------------------------- content surfaces (frosted, no blur) */
.card { position: relative; background: var(--glass); border: 1px solid var(--hair); border-radius: var(--r-card); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge); }
.card-pad { padding: 1.1rem; }
@media (min-width: 640px) { .card-pad { padding: 1.35rem; } }
.tile { border-radius: var(--r-tile); }
.well { background: var(--fill); border-radius: var(--r-field); border: 1px solid var(--hair); }
.divide > * + * { border-top: 1px solid var(--hair); }
.hairline { border-color: var(--hair); }
.press { transition: transform .16s var(--spring), background .16s, box-shadow .2s; }
.press:active { transform: scale(.98); }
a.card:hover, .card.is-link:hover { background: color-mix(in srgb, var(--glass) 70%, var(--glass-strong)); }
.list-group { overflow: hidden; }
.list-group > * + * { border-top: 1px solid var(--hair); }
.lrow { position: relative; display: flex; align-items: center; gap: .9rem; min-height: 64px; padding: .7rem 1rem; transition: background .16s; }
a.lrow:hover, .lrow.is-link:hover { background: var(--fill); }
.lrow-main { min-width: 0; flex: 1; }
.lrow-title { display: flex; align-items: center; gap: .35rem; font-weight: 600; font-size: .9375rem; min-width: 0; }
.lrow-title > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow-sub { font-size: .8125rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-label { padding: 0 .35rem .45rem; font-size: .8125rem; font-weight: 600; color: var(--text-2); }

/* ---------------------------------------------------------------- buttons */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: 0 1.1rem; border-radius: 999px; font-size: .9375rem; font-weight: 600; line-height: 1.1; white-space: nowrap; border: 1px solid var(--hair); background: var(--glass-strong); color: var(--text); box-shadow: inset 0 1px 0 var(--glass-edge); transition: background .16s, border-color .16s, color .16s, box-shadow .2s, transform .2s var(--spring); -webkit-tap-highlight-color: transparent; }
.btn > svg { flex-shrink: 0; }
.btn:hover { background: color-mix(in srgb, var(--glass-strong) 80%, var(--solid)); border-color: var(--hair-2); }
.btn:active { transform: scale(.96); transition-duration: .08s; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .btn { min-height: 40px; } .btn-icon { width: 40px; } }
.btn-sm { min-height: 36px; padding: 0 .85rem; font-size: .8125rem; }
@media (pointer: coarse) { .btn-sm { min-height: 40px; } .btn-sm.btn-icon { width: 40px; } }
.btn-icon { width: 44px; padding: 0; }
.btn-sm.btn-icon { width: 36px; }
.btn-block { width: 100%; }
.btn.js-select-toggle[aria-pressed="true"] { background: var(--fill-2); border-color: var(--hair-2); box-shadow: none; }
.btn-primary { border-color: transparent; background: var(--ink); color: var(--on-ink); box-shadow: var(--ink-shadow); }
.btn-primary:hover { background: var(--ink-hover); border-color: transparent; }
.btn-soft { background: var(--fill-2); border-color: transparent; box-shadow: none; color: var(--text); }
.btn-soft:hover { background: color-mix(in srgb, var(--fill-2) 60%, var(--glass-strong)); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--fill); border-color: transparent; color: var(--text); }
.btn-danger { background: var(--danger-soft); border-color: transparent; box-shadow: none; color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger-soft) 60%, var(--danger) 12%); border-color: transparent; color: var(--danger); }
.btn-ghost.t-danger { color: var(--danger); }
.btn-ghost.t-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger-fill); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -10px rgba(180, 40, 30, .6), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn-danger-solid:hover { background: #AE2922; border-color: transparent; }
.btn.is-loading { color: transparent !important; pointer-events: none; transition: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::before { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2.5px solid var(--text-2); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-primary.is-loading::before { border-color: var(--on-ink); border-right-color: transparent; }
.btn-danger-solid.is-loading::before { border-color: #fff; border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- forms */
.input, .select, .textarea { width: 100%; min-height: 44px; padding: .6rem .9rem; border-radius: var(--r-field); border: 1px solid var(--hair-2); background: var(--glass-strong); color: var(--text); font: inherit; font-size: 1rem; box-shadow: inset 0 1px 2px rgba(20, 20, 24, .04); transition: border-color .16s, box-shadow .16s, background .16s; }
@media (min-width: 768px) { .input, .select, .textarea { font-size: .9375rem; } }
.select { appearance: none; -webkit-appearance: none; padding-right: 2.3rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234E4E56' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; background-size: 16px; }
html.dark .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B8B8C0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.select option { background: var(--solid); color: var(--text); }
.textarea { min-height: 96px; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 16%, transparent); }
.input[readonly] { background: var(--fill); }
input[type=file].input { padding: .45rem .6rem; }
input[type=file]::file-selector-button { margin-right: .7rem; padding: .4rem .9rem; border-radius: 999px; border: 1px solid var(--hair-2); background: var(--glass-strong); color: var(--text); font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; }
input[type=range] { accent-color: var(--ink); }
input[type=date].input { min-width: 0; }
.label { display: block; margin-bottom: .4rem; font-size: .8125rem; font-weight: 600; color: var(--text-2); }
.help { margin-top: .4rem; font-size: .8125rem; color: var(--text-3); }
.check { width: 20px; height: 20px; accent-color: var(--ink); flex-shrink: 0; }
.switch { position: relative; display: inline-flex; width: 51px; height: 31px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--fill-2); border-radius: 999px; box-shadow: inset 0 0 0 1px var(--hair); transition: background .25s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: transform .3s var(--spring); }
.switch input:checked + span { background: var(--toggle-on); box-shadow: none; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
/* Segmented control: fill track, raised glass thumb (.seg-ind slides with JS). */
.seg { position: relative; display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; border-radius: 999px; background: var(--fill); border: 1px solid var(--hair); }
.seg > label, .seg > a, .seg > button { position: relative; z-index: 1; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span, .seg > a, .seg > button { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 36px; padding: 0 .95rem; border-radius: 999px; font-size: .8125rem; font-weight: 600; color: var(--text-2); transition: color .2s; }
.seg > button { border: 0; background: transparent; }
.seg input:checked + span, .seg > .is-on { background: var(--glass-strong); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1), inset 0 1px 0 var(--glass-edge); }
.seg.seg-js input:checked + span, .seg.seg-js > .is-on { background: transparent; box-shadow: none; }
.seg input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 1px; }
.seg-ind { position: absolute; z-index: 0; top: 3px; left: 0; height: calc(100% - 6px); border-radius: 999px; background: var(--glass-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, .1), inset 0 1px 0 var(--glass-edge); pointer-events: none; }
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) { .seg-ind, .seg input:checked + span, .seg > .is-on { background: var(--solid); box-shadow: 0 0 0 1px var(--hair-2); } }
.seg-ind.is-ready { transition: transform .35s var(--ease-out), width .35s var(--ease-out); }
.seg-block { display: flex; width: 100%; }
.seg-block > * { flex: 1; }
.seg-block span, .seg-block > a { width: 100%; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; min-height: 140px; padding: 1.1rem; border-radius: var(--r-card); border: 1.5px dashed var(--hair-2); background: var(--fill); text-align: center; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone:focus-within, .dropzone.is-over { border-color: var(--ink); background: var(--fill-2); }
.js .dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dz-files { font-size: .8125rem; color: var(--text-2); word-break: break-word; }
.opt { display: flex; align-items: flex-start; gap: .75rem; min-height: 44px; padding: .75rem .9rem; border-radius: 16px; border: 1px solid var(--hair); background: var(--fill); transition: border-color .16s, background .16s; }
.opt:hover { border-color: var(--hair-2); }
.opt:has(input:checked) { background: var(--glass-strong); border-color: var(--hair-2); }

/* ---------------------------------------------------------------- pills */
.chip { display: inline-flex; align-items: center; gap: .3rem; min-height: 28px; padding: 0 .7rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--fill); color: var(--text-2); border: 1px solid var(--hair); }
.chip-accent { background: var(--glass-strong); color: var(--text); border-color: var(--hair-2); }
.chip-btn { transition: border-color .16s, background .16s, transform .16s var(--spring); }
.chip-btn:hover { border-color: var(--hair-2); background: var(--fill-2); }
.chip-btn:active { transform: scale(.96); }
a.chip-accent.chip-btn:hover, button.chip-accent.chip-btn:hover { background: var(--glass-strong); border-color: var(--text-3); }
.chip-lg { min-height: 36px; padding: 0 .95rem; font-size: .8125rem; }
.chip.t-danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.chip.t-warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.chip.t-success { color: var(--success); background: var(--success-soft); border-color: transparent; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: .6875rem; font-weight: 700; background: var(--danger-fill); color: #fff; font-variant-numeric: tabular-nums; }
.pill-status { display: inline-flex; align-items: center; gap: .35rem; height: 24px; padding: 0 .65rem; border-radius: 999px; font-size: .75rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
html.dark .pill-status { filter: brightness(1.35) saturate(.9); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ---------------------------------------------------------------- notices, banners, toasts */
.notice { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: 16px; font-size: .875rem; border: 1px solid var(--hair); background: var(--glass); color: var(--text); }
.notice > svg { margin-top: .05rem; }
.notice-ok { background: var(--success-soft); border-color: transparent; color: var(--success); }
.notice-err { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.notice-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.notice-info { background: var(--fill); border-color: var(--hair); color: var(--text); }
.banners { display: grid; gap: .6rem; margin-bottom: 1.5rem; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding: .85rem 1rem; border-radius: var(--r-card); animation: rise .24s var(--ease-out) backwards; }
.banner-ic { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 30%; flex-shrink: 0; color: #fff; background: var(--c-graphite); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 4px 10px -4px rgba(0, 0, 0, .3); }
.banner-body { flex: 1; min-width: 12rem; font-size: .875rem; }
.banner-body strong { display: block; font-size: .9375rem; font-weight: 650; color: var(--text); }
.banner-body p { color: var(--text-2); }
.banner-lock .banner-ic { background: var(--c-graphite); }
.banner-warn .banner-ic { background: var(--c-amber); }
.banner-warn strong { color: var(--warn); }
.banner-danger { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.banner-danger .banner-ic { background: var(--c-red); }
.banner-danger strong { color: var(--danger); }
.banner-info .banner-ic { background: var(--c-graphite); }
.toasts { position: fixed; z-index: 95; left: 12px; right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); top: auto; display: flex; flex-direction: column; align-items: center; gap: .5rem; pointer-events: none; }
@media (min-width: 768px) { .toasts { bottom: 24px; left: calc(var(--sidebar-w) + 24px); } .no-shell .toasts { left: 12px; } }
.toasts[popover] { margin: 0; border: 0; padding: 0; background: transparent; overflow: visible; color: inherit; width: auto; height: auto; inset: auto 12px calc(86px + env(safe-area-inset-bottom)) 12px; }
@media (min-width: 768px) { .toasts[popover] { inset: auto 12px 24px calc(var(--sidebar-w) + 24px); } .no-shell .toasts[popover] { left: 12px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: .65rem; width: fit-content; max-width: min(480px, 100%); min-height: 52px; padding: .45rem .45rem .45rem .55rem; border-radius: 26px; font-size: .9rem; font-weight: 500; color: var(--text); background: var(--glass-nav); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--hair); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-edge); animation: toast-in .36s var(--spring) both; }
.toast-ic { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; color: #fff; }
.toast-ok .toast-ic { background: var(--c-green); }
.toast-err { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.toast-err .toast-ic { background: var(--c-red); }
.toast-info .toast-ic { background: var(--c-graphite); }
.toast-msg { flex: 1; padding: .2rem 0; }
.toast .btn { min-height: 36px; width: 36px; }
.toast.is-leaving { animation: toast-out .24s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ---------------------------------------------------------------- home: greeting + stats */
.hello-date { font-size: .8125rem; font-weight: 500; color: var(--text-2); letter-spacing: .01em; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 1024px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; } }
.stat { display: flex; flex-direction: column; min-width: 0; padding: 1rem 1.1rem; border-radius: var(--r-card); }
.stat .ic-chip { margin-bottom: .8rem; }
@media (max-width: 639px) { .stat { padding: .85rem .95rem; } .stat .ic-chip { width: 30px; height: 30px; margin-bottom: .55rem; } .stat .ic-chip svg { width: 16px; height: 16px; } .stat-num { font-size: 1.5rem; } }
.stat-num { font-size: 1.75rem; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-num small { font-size: .875rem; font-weight: 600; letter-spacing: 0; color: var(--text-2); }
.stat-label { margin-top: .15rem; font-size: .8125rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { height: 6px; border-radius: 999px; background: var(--fill-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--ink); }
.meter.is-high > span { background: var(--c-amber); }
.meter.is-full > span { background: var(--c-red); }
.meter-sm { height: 4px; }

/* ---------------------------------------------------------------- folders */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: .75rem; }
@media (min-width: 1024px) { .folder-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem; } }
.ftile { display: flex; flex-direction: column; min-width: 0; padding: 1rem; border-radius: var(--r-card); transition: transform .16s var(--spring), background .16s; }
.ftile:active { transform: scale(.98); }
.ftile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; margin-bottom: .8rem; }
.ftile-flags { display: flex; align-items: center; gap: .3rem; color: var(--text-3); }
.ftile-name { display: flex; align-items: center; gap: .35rem; min-width: 0; font-size: .9375rem; font-weight: 600; letter-spacing: -.005em; }
.ftile-meta { display: block; margin-top: .1rem; font-size: .8125rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-glyph { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 30%; color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 4px 10px -4px rgba(0, 0, 0, .3); }

/* ---------------------------------------------------------------- documents */
.doc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 640px) { .doc-grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: .9rem; } }
.doc-item { position: relative; min-width: 0; }
.doc-card { display: flex; flex-direction: column; overflow: hidden; height: 100%; transition: transform .16s var(--spring), background .16s, box-shadow .2s; }
.doc-card:active { transform: scale(.98); }
.doc-thumb { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 4.3; padding: 14px 16px 0; background: var(--thumb); overflow: hidden; }
.doc-thumb img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; align-self: flex-end; border-radius: 6px 6px 0 0; background: #fff; box-shadow: 0 0 0 1px rgba(20, 20, 24, .06), 0 6px 16px -6px rgba(40, 30, 20, .35); transition: transform .4s var(--ease-out); transform-origin: 50% 100%; }
.doc-card:hover .doc-thumb img { transform: translateY(-3px); }
html.dark .doc-thumb img { filter: brightness(.92); }
.doc-body { padding: .75rem .85rem .85rem; border-top: 1px solid var(--hair); }
.doc-name { display: flex; align-items: center; gap: .3rem; font-size: .875rem; font-weight: 600; min-width: 0; }
.doc-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .4rem; margin-top: .2rem; font-size: .75rem; color: var(--text-3); }
.star-badge { position: absolute; right: 8px; top: 8px; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; color: var(--star); background: var(--glass-strong); border: 1px solid var(--hair); box-shadow: var(--shadow); }
.pdf-glyph { position: relative; display: flex; align-items: flex-end; justify-content: center; align-self: flex-end; width: 62%; max-width: 110px; aspect-ratio: 8.5 / 11; padding-bottom: .7rem; border-radius: 6px 6px 0 0; background: #fff; font-size: .625rem; font-weight: 700; letter-spacing: .06em; color: #C4312A; box-shadow: 0 0 0 1px rgba(20, 20, 24, .06), 0 6px 16px -6px rgba(40, 30, 20, .35); }
.pdf-glyph::before { content: ""; position: absolute; top: 16%; left: 16%; right: 16%; height: 40%; background: repeating-linear-gradient(180deg, #D8D6D0 0 3px, transparent 3px 8px); border-radius: 2px; }
.doc-check-wrap { position: absolute; z-index: 5; top: 4px; left: 4px; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; transition: opacity .2s, transform .2s var(--spring); }
.doc-check-wrap .check { width: 22px; height: 22px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
.js .doc-check-wrap { opacity: 0; transform: scale(.85); }
.js .doc-item:hover .doc-check-wrap, .js .doc-item:focus-within .doc-check-wrap, .js .selecting .doc-check-wrap, .js .doc-item.is-selected .doc-check-wrap { opacity: 1; transform: none; }
@media (hover: none) { .js .doc-item:not(.is-selected) .doc-check-wrap { opacity: 0; } .js .selecting .doc-item .doc-check-wrap { opacity: 1; transform: none; } }
.doc-item.is-selected .doc-card { border-color: transparent; box-shadow: 0 0 0 2px var(--ink), var(--shadow); }
.doc-item.is-selected .doc-row { background: var(--fill-2); }
.selecting .doc-card, .selecting .doc-card:hover .doc-thumb img { transform: none !important; }
/* list view */
.doc-list { overflow: hidden; }
.doc-list-head, .doc-row { display: grid; grid-template-columns: 44px 44px minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: .45rem .8rem; }
.doc-list-head { font-size: .8125rem; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--hair); min-height: 44px; background: var(--glass-strong); }
.doc-row { position: relative; min-height: 66px; transition: background .16s; }
.doc-row:hover { background: var(--fill); }
.doc-list .doc-item + .doc-item { border-top: 1px solid var(--hair); }
.doc-row .doc-check-wrap { position: relative; z-index: 5; top: 0; left: 0; width: 44px; height: 44px; opacity: 1 !important; transform: none !important; }
.row-thumb { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 52px; border-radius: 8px; overflow: hidden; background: #fff; border: 1px solid var(--hair-2); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
html.dark .row-thumb { background: #2A2A2E; }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-thumb .pdf-t { font-size: 9px; font-weight: 700; letter-spacing: .04em; color: #C4312A; }
html.dark .row-thumb .pdf-t { color: #F87171; }
.row-main { min-width: 0; }
.row-link-stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.row-link-stretch:focus-visible { outline: none; }
.row-link-stretch:focus-visible::after { outline: 2px solid var(--ink); outline-offset: -3px; border-radius: 14px; }
.row-chev { display: flex; color: var(--text-3); }
.row-cols { display: none; }
.col-num { font-variant-numeric: tabular-nums; }
@media (min-width: 900px) {
  .doc-list-head, .doc-row { grid-template-columns: 44px 44px minmax(0, 1fr) 124px 64px 84px 108px 108px; }
  .row-cols { display: contents; font-size: .8125rem; color: var(--text-2); }
  .row-meta-sm, .doc-row .row-chev { display: none; }
}
@media (max-width: 899px) { .doc-list-head { display: none; } }
.doc-list-head .sort-h { display: inline-flex; align-items: center; gap: .25rem; min-height: 32px; padding: 0 .4rem; margin-left: -.4rem; border-radius: 999px; font-weight: inherit; color: inherit; background: transparent; border: 0; }
.doc-list-head .sort-h:hover { color: var(--text); background: var(--fill); }
.doc-list-head .sort-h.is-sorted { color: var(--text); }

/* ---------------------------------------------------------------- toolbar, menus */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.toolbar .grow { flex: 1 1 14rem; min-width: 0; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu-pop { position: absolute; right: 0; z-index: 35; margin-top: .45rem; width: 16rem; max-width: calc(100vw - 2rem); padding: 6px; border-radius: 18px; color: var(--text); background: var(--glass-sheet); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--hair); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-edge); animation: pop-in .2s var(--ease-out) both; transform-origin: top right; }
.menu-pop.left { right: auto; left: 0; transform-origin: top left; }
@keyframes pop-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
.menu-label { padding: .5rem .7rem .25rem; font-size: .75rem; font-weight: 600; color: var(--text-2); }
.menu-item { display: flex; align-items: center; gap: .65rem; width: 100%; min-height: 40px; padding: 0 .7rem; border: 0; border-radius: 12px; background: transparent; font-size: .875rem; font-weight: 500; text-align: left; color: var(--text); }
.menu-item:hover, .menu-item:focus-visible { background: var(--fill-2); }
.menu-item:disabled { opacity: .4; cursor: not-allowed; }
.menu-item.is-on { font-weight: 650; }
.menu-item > svg { flex-shrink: 0; color: var(--text-2); }
.menu-item .tick { margin-left: auto; opacity: 0; color: var(--text); }
.menu-item.is-on .tick { opacity: 1; }
.menu-item.danger, .menu-item.danger > svg { color: var(--danger); }
.menu-sep { height: 1px; margin: .3rem .5rem; background: var(--hair-2); }
.row-link { display: flex; align-items: center; gap: .8rem; min-height: 54px; padding: .6rem 1rem; transition: background .16s; }
.row-link:hover { background: var(--fill); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ---------------------------------------------------------------- bulk action bar (glass) */
.bulkbar { position: fixed; z-index: 45; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); width: min(820px, calc(100vw - 24px)); transform: translate(-50%, 0); padding: 6px; border-radius: 24px; background: var(--glass-nav); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--hair); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-edge); transition: transform .36s var(--spring), opacity .24s, visibility .24s; }
.js .bulkbar:not(.is-on) { transform: translate(-50%, 130%); opacity: 0; visibility: hidden; transition-timing-function: var(--ease-out); }
html:not(.js) .bulkbar { position: sticky; transform: none; left: auto; margin: 1rem auto 0; }
@media (min-width: 768px) { .bulkbar { bottom: 22px; left: calc(50% + (var(--sidebar-w) + 12px) / 2); width: min(1040px, calc(100vw - var(--sidebar-w) - 64px)); border-radius: 999px; } }
@media (min-width: 768px) and (max-width: 1279px) { .bulk-actions .btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .bulk-actions .btn { padding: 0 .8rem; } }
.bulk-top { display: flex; align-items: center; gap: .35rem; }
.bulk-count { display: flex; align-items: center; gap: .55rem; min-height: 44px; padding: 0 .6rem; font-size: .875rem; font-weight: 650; white-space: nowrap; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 2px; }
.bulk-actions .btn { min-height: 44px; padding: 0 .8rem; }
@media (max-width: 767px) {
  .bulk-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--hair); }
  .bulk-actions .btn { padding: 0; }
  .bulk-actions .btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (min-width: 768px) { .bulkbar-in { display: flex; align-items: center; gap: .4rem; } .bulk-actions { margin-left: auto; } }
.bulk-actions.is-empty .btn { opacity: .4; pointer-events: none; }
.has-bulk .main { padding-bottom: 13rem; }

/* ---------------------------------------------------------------- dialogs / sheets (glass) */
dialog.sheet { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--hair); border-radius: var(--r-panel); background: var(--glass-sheet); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); color: var(--text); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-edge); overflow: hidden; overscroll-behavior: contain;
  opacity: 0; transform: scale(.96); transition: opacity .23s ease-in, transform .23s ease-in, overlay .23s allow-discrete, display .23s allow-discrete; }
dialog.sheet[open] { display: flex; flex-direction: column; opacity: 1; transform: none; transition: opacity .36s var(--ease-out), transform .36s var(--spring), overlay .36s allow-discrete, display .36s allow-discrete; }
@starting-style { dialog.sheet[open] { opacity: 0; transform: scale(.96); } }
dialog.sheet > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
dialog.sheet::backdrop { background: var(--overlay); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .23s, overlay .23s allow-discrete, display .23s allow-discrete; }
dialog.sheet[open]::backdrop { opacity: 1; }
@starting-style { dialog.sheet[open]::backdrop { opacity: 0; } }
dialog.sheet-wide { width: min(980px, calc(100vw - 16px)); }
dialog.sheet-mid { width: min(720px, calc(100vw - 16px)); }
dialog.sheet-sm { width: min(440px, calc(100vw - 24px)); }
@media (max-width: 639px) {
  dialog.sheet:not(.sheet-wide) { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--r-panel) var(--r-panel) 0 0; max-height: 92dvh; border-bottom: 0; transform: translateY(24px); }
  dialog.sheet:not(.sheet-wide)[open] { transform: none; }
  @starting-style { dialog.sheet:not(.sheet-wide)[open] { opacity: 0; transform: translateY(40%); } }
}
.sheet-head { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .85rem .85rem .85rem 1.3rem; border-bottom: 1px solid var(--hair); }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1.2rem 1.3rem; }
.sheet-body.pb-0 { flex: 0 0 auto; }
.sheet-foot { flex-shrink: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; padding: .85rem 1rem calc(.85rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--hair); }
.confirm-ic { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 30%; flex-shrink: 0; color: #fff; background: var(--c-red); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 4px 10px -4px rgba(0, 0, 0, .3); }

/* ---------------------------------------------------------------- empty states */
.empty { display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: 2.5rem 1.25rem 2.25rem; text-align: center; }
.empty .ic-chip { margin-bottom: .5rem; }
.empty p { max-width: 28rem; }
.empty .btn { margin-top: .6rem; }

/* ---------------------------------------------------------------- scheduled sends */
.send-card { padding: 1rem 1.05rem; border-radius: var(--r-tile); border: 1px solid var(--hair); background: var(--fill); }
.send-card.is-off { opacity: .7; }
.send-when { display: flex; align-items: center; gap: .5rem; font-weight: 650; }

/* ---------------------------------------------------------------- page viewer / editor (editor.js) */
.page-card { overflow: visible; }
.page-frame { display: block; width: 100%; padding: 14px; border-radius: var(--r-card) var(--r-card) 0 0; background: var(--thumb); border: 0; }
.page-frame .page-img { aspect-ratio: auto 8.5 / 11; border-radius: 4px; background: #fff; box-shadow: 0 0 0 1px rgba(20, 20, 24, .06), 0 10px 26px -12px rgba(40, 30, 20, .4); }
html.dark .page-frame .page-img { filter: brightness(.94); }
.page-cap { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .55rem .7rem; border-top: 1px solid var(--hair); }
.filter-row { border-top: 1px solid var(--hair); }
.filter-row .btn-soft { background: var(--glass-strong); box-shadow: inset 0 0 0 1.5px var(--ink); }
.viewer { position: fixed; inset: 0; z-index: 90; background: rgba(8, 8, 10, .96); display: none; touch-action: none; }
.viewer.is-open { display: block; }
.viewer img { position: absolute; left: 50%; top: 50%; transform-origin: 0 0; max-width: none; user-select: none; -webkit-user-drag: none; }
.viewer-bar { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem; color: #fff; z-index: 2; }
.viewer-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border-radius: 999px; background: rgba(40, 40, 44, .55); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%); border: 1px solid rgba(255, 255, 255, .12); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14); color: #fff; font-size: .875rem; font-weight: 600; padding: 0 .85rem; transition: background .16s, transform .16s var(--spring); }
.viewer-btn:hover { background: rgba(60, 60, 66, .7); }
.viewer-btn:active { transform: scale(.94); }
.viewer-btn:focus-visible { outline-color: #fff; }
.editor-stage { position: relative; display: flex; align-items: center; justify-content: center; background: #111113; border-radius: 16px; overflow: hidden; touch-action: none; min-height: 50vh; }
.editor-stage canvas { max-width: 100%; max-height: 68vh; display: block; }
.handle { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 3px solid #141416; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .55); cursor: grab; touch-action: none; }
.handle:focus-visible { outline: 2px solid #F6DE96; outline-offset: 2px; }
.sig-box { position: absolute; border: 2px dashed #F6DE96; cursor: move; touch-action: none; }
.sig-box img { width: 100%; height: 100%; pointer-events: none; }
.sig-resize { position: absolute; right: -14px; bottom: -14px; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 3px solid #141416; cursor: nwse-resize; touch-action: none; }
.sort-item { touch-action: none; }
.sort-item.is-dragging { opacity: .7; box-shadow: 0 0 0 2px var(--ink), var(--shadow-lg); }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); transition: transform .16s var(--spring); }
.swatch:hover { transform: scale(1.08); }
.swatch-input:checked + .swatch { border-color: var(--paper); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 1px rgba(0, 0, 0, .12); }
.swatch-input:focus-visible + .swatch { outline: 2px solid var(--ink); outline-offset: 3px; }
.icon-choice { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--hair); background: var(--fill); color: var(--text-2); transition: background .16s, border-color .16s, color .16s; }
.icon-choice:hover { border-color: var(--hair-2); }
.icon-input:checked + .icon-choice { background: var(--ink); color: var(--on-ink); border-color: transparent; }
.icon-input:focus-visible + .icon-choice { outline: 2px solid var(--ink); outline-offset: 2px; }
.scroll-x { overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }

/* ---------------------------------------------------------------- sign-in */
.auth { position: relative; display: grid; align-items: center; min-height: 100dvh; padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); gap: 1.5rem; }
@media (min-width: 1024px) { .auth { grid-template-columns: minmax(0, 1.05fr) minmax(400px, 460px); gap: clamp(2rem, 6vw, 6rem); max-width: 1180px; margin: 0 auto; padding: 2rem 2.5rem; } }
.auth-hero { position: relative; display: flex; flex-direction: column; gap: 1.25rem; }
.auth-hero h2 { font-size: clamp(1.75rem, 4.4vw, 3rem); line-height: 1.05; font-weight: 700; letter-spacing: -.04em; color: var(--text); }
.auth-hero h2 .soft { color: var(--text-2); }
.auth-hero p { max-width: 30rem; color: var(--text-2); font-size: 1.0625rem; }
@media (max-width: 1023px) { .auth-hero p, .auth-hero .scan-art, .auth-hero h2 { display: none; } .auth { align-content: start; padding-top: calc(20px + env(safe-area-inset-top)); } .auth-hero { max-width: 460px; width: 100%; margin: 0 auto; } }
.auth-panel { width: 100%; max-width: 460px; margin: 0 auto; }
.auth-card { width: 100%; }
.auth-sheet { padding: 1.4rem; border-radius: var(--r-panel); }
@media (min-width: 640px) { .auth-sheet { padding: 1.9rem; } }
.invite-card { position: relative; display: flex; gap: .75rem; align-items: flex-start; padding: 1rem; margin-bottom: 1rem; border-radius: var(--r-card); background: var(--glass); border: 1px solid var(--hair); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge); }
.invite-card .banner-ic { background: var(--c-orange); }
.divider-or { display: flex; align-items: center; gap: .75rem; margin: 1.15rem 0; font-size: .8125rem; font-weight: 500; color: var(--text-2); }
.divider-or::before, .divider-or::after { content: ""; flex: 1; height: 1px; background: var(--hair-2); }
.btn-apple { background: #000; color: #fff; border-color: #000; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .5); }
.btn-apple:hover { background: #1A1A1C; border-color: #1A1A1C; }
html.dark .btn-apple { background: #fff; color: #000; border-color: #fff; }
html.dark .btn-apple:hover { background: #EDEDEF; border-color: #EDEDEF; }
/* Scan illustration: a sheet on a glass plate with the daylight beam sweeping it. */
.scan-art { position: relative; width: min(100%, 440px); aspect-ratio: 1.18; margin-top: .5rem; }
.scan-plate { position: absolute; inset: 6% 4% 4% 10%; border-radius: 34px; transform: rotate(-4deg); }
.scan-sheet { position: absolute; left: 26%; top: 13%; width: 46%; aspect-ratio: 8.5 / 11; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px rgba(20, 20, 24, .06), 0 24px 44px -18px rgba(40, 30, 20, .45); overflow: hidden; transform: rotate(3deg); }
html.dark .scan-sheet { background: #F1F0EC; }
.scan-sheet::before { content: ""; position: absolute; top: 0; right: 0; width: 22%; aspect-ratio: 1; background: linear-gradient(225deg, var(--paper) 50%, #E7E4DD 50%); }
.scan-sheet .ln { position: absolute; left: 12%; height: 5px; border-radius: 3px; background: #D8D6D0; }
.scan-sheet .ln.h { height: 9px; background: #1F1F23; }
.scan-sheet .beam { position: absolute; left: -6%; right: -6%; top: 10%; height: 5px; border-radius: 3px; background: linear-gradient(90deg, #FFB080, #F6DE96 50%, #9CD6BA); box-shadow: 0 0 18px 4px rgba(246, 222, 150, .75), 0 -16px 30px -6px rgba(255, 176, 128, .35); animation: sweep 3.2s ease-in-out infinite alternate; }
@keyframes sweep { to { top: 86%; } }
.scan-bracket { position: absolute; width: 11%; aspect-ratio: 1; border: 4px solid var(--text); opacity: .85; }
.scan-bracket.tl { left: 17%; top: 5%; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.scan-bracket.tr { right: 18%; top: 5%; border-left: 0; border-bottom: 0; border-radius: 0 14px 0 0; }
.scan-bracket.bl { left: 17%; bottom: 5%; border-right: 0; border-top: 0; border-radius: 0 0 0 14px; }
.scan-bracket.br { right: 18%; bottom: 5%; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.scan-chip { position: absolute; display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .8rem .45rem .45rem; border-radius: 999px; font-size: .8125rem; font-weight: 600; color: var(--text); }
.scan-chip.a { right: 0; top: 30%; animation: float 7s ease-in-out infinite alternate; }
.scan-chip.b { left: 0; bottom: 18%; animation: float 8s ease-in-out -3s infinite alternate; }
@keyframes float { to { transform: translateY(-8px); } }

/* ---------------------------------------------------------------- entrance motion (CSS only: nothing is hidden without it) */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.rise { animation: rise .24s var(--ease-out) backwards; }
.rise-2 { animation: rise .24s var(--ease-out) .04s backwards; }
.rise-3 { animation: rise .24s var(--ease-out) .08s backwards; }
.stagger > * { animation: rise .24s var(--ease-out) backwards; }
.stagger > :nth-child(2) { animation-delay: .035s; } .stagger > :nth-child(3) { animation-delay: .07s; }
.stagger > :nth-child(4) { animation-delay: .105s; } .stagger > :nth-child(5) { animation-delay: .14s; }
.stagger > :nth-child(6) { animation-delay: .175s; } .stagger > :nth-child(7) { animation-delay: .21s; }
.stagger > :nth-child(8) { animation-delay: .245s; } .stagger > :nth-child(9) { animation-delay: .28s; }
.stagger > :nth-child(10) { animation-delay: .315s; } .stagger > :nth-child(n+11) { animation-delay: .35s; }

/* Top-bar theme toggle shows the mode you'd switch TO. */
.theme-ic-dark { display: none; }
html.dark .theme-ic-dark { display: inline-flex; }
html.dark .theme-ic-light { display: none; }
html:not(.js) .js-only { display: none !important; }
.js .js-reveal:not(.is-shown) { display: none; }
[data-drop-input].is-over { outline: 2px dashed var(--ink); outline-offset: 6px; border-radius: var(--r-card); }
fieldset:disabled .input, fieldset:disabled .select, fieldset:disabled .textarea, .input:disabled { opacity: .55; cursor: not-allowed; }
fieldset:disabled .btn, fieldset:disabled .switch { opacity: .4; pointer-events: none; }

/* Read-only accounts: controls that would change something are hidden. */
.is-frozen [data-write] { display: none !important; }

/* Settings-style grouped rows */
.set-group { overflow: hidden; }
.set-head { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.25rem .45rem; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem .9rem; min-height: 52px; padding: .7rem 1.25rem; }
.set-group .row-link { padding-left: 1.25rem; padding-right: 1.25rem; }
.set-row + .set-row, .set-group .divide > * + * { border-top: 1px solid var(--hair); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .logo-beam { transform: none; }
  .btn:active, .nav-item:active, .tab-item:active, .ftile:active, .doc-card:active, .press:active, .chip-btn:active, .viewer-btn:active { transform: none; }
  .specular::after { display: none; }
  dialog.sheet, dialog.sheet[open] { transform: none; }
  .scan-sheet .beam { top: 46%; }
}
@media print { .sidebar, .topbar, .tabbar, .backdrop, .toasts, .bulkbar { display: none !important; } .has-shell .main { margin: 0; } .card { box-shadow: none; } }

/* Folder status filter chips (mirrors the iOS folder header) */
.status-chips { display: flex; gap: .5rem; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 0 .75rem; -webkit-overflow-scrolling: touch; max-width: 100%; }
.status-chips::-webkit-scrollbar { display: none; }
.status-chip { flex: none; white-space: nowrap; text-decoration: none; }
.status-chip.is-on, .status-chip.is-on:hover { background: var(--ink); color: var(--on-ink); border-color: transparent; }
.status-chip.is-on .t-faint { color: inherit; opacity: .7; }
.status-dot { width: 8px; height: 8px; border-radius: 999px; flex: none; }
.status-dot-none { border: 1.5px solid currentColor; opacity: .5; }

/* ---- Sign-in loading overlay (login page, Google/Apple) ---------------- */
.oauth-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4); animation: oauthFade .2s ease-out; }
.oauth-overlay[hidden] { display: none; }
.oauth-overlay-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.oauth-mark { display: inline-flex; filter: drop-shadow(0 10px 18px rgba(0,0,0,.22)); animation: oauthPulse 2.2s ease-in-out infinite; }
.oauth-status { font-weight: 600; font-size: 1.05rem; color: var(--text); margin: 0; }
.oauth-spinner { display: none; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--hair); border-top-color: var(--text); }
.oauth-cancel { min-height: 44px; }
@keyframes oauthPulse { 0%, 100% { transform: scale(.96); opacity: .85; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes oauthFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes oauthSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .oauth-overlay, .oauth-mark { animation: none; }
  .oauth-spinner { display: block; animation: oauthSpin 1.6s linear infinite; }
}

/* feat29 — page notes (sticky note per page; never in the PDF). User content, so colour is allowed. */
.page-note { position: relative; display: flex; gap: .5rem; align-items: flex-start; padding: .6rem .75rem; border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, .06); box-shadow: 0 6px 14px -10px rgba(0, 0, 0, .35); color: #2A2A2E; }
.page-note-text { white-space: pre-wrap; word-break: break-word; font-size: .875rem; line-height: 1.35; margin: 0; }
.page-note-pin { flex: none; margin-top: .1rem; opacity: .6; }
.page-note-yellow { background: #FFF4B8; }
.page-note-blue { background: #D7E9FF; }
.page-note-green { background: #D6F5DF; }
.page-note-pink { background: #FFDCE8; }
.page-note-swatch { width: 1.6rem; height: 1.6rem; border-radius: 999px; border: 2px solid rgba(0, 0, 0, .12); cursor: pointer; display: inline-block; }
.page-note-swatch:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper) inset; }
.page-note-swatch:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.page-note-edit > summary { list-style: none; display: inline-flex; }
.page-note-edit > summary::-webkit-details-marker { display: none; }

/* ================================================================
   Scanly Workspace layer (Oct 2026 reskin). Overrides the Glass layer
   above: a clean white document workspace — flush left sidebar, flat top
   bar with search + Upload/New, white cards with big thumbnails and hover
   actions — with Scanly teal as the single accent. Every selector the
   portal JS relies on is unchanged; this layer only restyles them.
   ================================================================ */
:root {
  --accent: #0C8F80; --accent-hover: #097466; --accent-soft: rgba(12, 143, 128, .10); --accent-soft-2: rgba(12, 143, 128, .18);
  --paper: #F5F7F8; --solid: #FFFFFF;
  --glass: #FFFFFF; --glass-strong: #FFFFFF; --glass-nav: #FFFFFF; --glass-sheet: #FFFFFF; --glass-edge: transparent;
  --nav-on: var(--accent-soft); --blur: none; --spec-glow: transparent;
  --hair: #E6EAED; --hair-2: #D5DBE0; --fill: #F1F4F6; --fill-2: #E7ECEF; --thumb: #F1F4F6;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06); --shadow-lg: 0 18px 40px -18px rgba(16, 24, 32, .28);
  --text: #15202B; --text-2: #4A5866; --text-3: #5E6B78;
  --ink: var(--accent); --on-ink: #FFFFFF; --ink-hover: var(--accent-hover); --ink-shadow: none;
  --r-tile: 12px; --r-card: 12px; --r-panel: 16px; --r-field: 8px;
  --sidebar-w: 240px; --topbar-h: 64px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, "Noto Sans Gurmukhi", sans-serif;
}
html.dark {
  --accent: #2CC3AE; --accent-hover: #4FD3C0; --accent-soft: rgba(44, 195, 174, .14); --accent-soft-2: rgba(44, 195, 174, .24);
  --paper: #0F1214; --solid: #171B1E;
  --glass: #171B1E; --glass-strong: #1D2226; --glass-nav: #14181B; --glass-sheet: #171B1E; --glass-edge: transparent;
  --hair: #262D32; --hair-2: #333B41; --fill: #1F2529; --fill-2: #283036; --thumb: #1F2529;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 20px 44px -18px rgba(0, 0, 0, .8);
  --text: #EEF2F4; --text-2: #A9B4BC; --text-3: #95A1AA;
  --ink: var(--accent); --on-ink: #062520; --ink-hover: var(--accent-hover); --ink-shadow: none;
}
::selection { background: var(--accent-soft-2); }
.backdrop { background: var(--paper); }
.backdrop i { display: none; }
.glass-nav { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
.glass-nav::before, .card::before { display: none; }

/* buttons + fields: rectangular-rounded, flat */
.btn { min-height: 40px; border-radius: 8px; box-shadow: none; border-color: var(--hair-2); background-color: var(--solid); }
.btn:hover { background-color: var(--fill); }
.btn-sm { min-height: 34px; }
.btn-icon { width: 40px; }
.btn-sm.btn-icon { width: 34px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-primary { background: var(--accent); color: var(--on-ink); border-color: transparent; box-shadow: none; }
.btn-primary:hover { background: var(--accent-hover); }
.input, .select, .textarea { border-radius: 8px; background-color: var(--solid); box-shadow: none; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); outline: none; }
.seg { border-radius: 8px; }
.seg span, .seg > a, .seg > button { border-radius: 6px; }

/* cards */
.card { background: var(--solid); border: 1px solid var(--hair); box-shadow: var(--shadow); }
.ftile, .stat { border-radius: var(--r-card); }
.ftile { transition: border-color .16s, box-shadow .16s, transform .16s; }
.ftile:hover { border-color: var(--accent-soft-2); box-shadow: 0 6px 18px -10px rgba(16, 24, 32, .25); transform: translateY(-1px); }

/* ---- shell: flush sidebar + flat top bar ---- */
.sidebar { top: 0; bottom: 0; left: 0; border-radius: 0; border: 0; border-right: 1px solid var(--hair); padding: 10px 12px 12px; background: var(--glass-nav); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sidebar-brand { min-height: 48px; padding: 0 6px; }
.drawer-close { display: none; }
.nav-item { border-radius: 8px; min-height: 40px; padding: 0 .75rem; border: 0; font-weight: 500; }
.nav-item:hover { background: var(--fill); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: none; border: 0; }
html.dark .nav-item.is-active { color: var(--accent); }
.saved-pop { border-radius: 10px; }
.avatar { background: var(--accent); color: var(--on-ink); }
.topbar { top: 0; margin: 0; padding-top: env(safe-area-inset-top); background: var(--glass-nav); border-bottom: 1px solid var(--hair); }
.topbar-in { max-width: none; min-height: var(--topbar-h); padding: 0 12px; border: 0; border-radius: 0; background: transparent; gap: .5rem; }
.topbar .search-pill { max-width: 560px; }
.topbar .search-pill .input { border-radius: 8px; min-height: 40px; background: var(--fill); border: 1px solid transparent; }
.topbar .search-pill .input:focus { background: var(--solid); border-color: var(--accent); }
.topbar-actions { display: none; align-items: center; gap: .5rem; margin-left: auto; }
.tabbar { left: 0; right: 0; bottom: 0; border-radius: 0; padding: 4px 6px max(4px, env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--hair); background: var(--glass-nav); }
.tab-item { border-radius: 8px; border: 0; }
.tab-item.is-active { color: var(--accent); background: transparent; box-shadow: none; }
.main { padding-top: 1.25rem; padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
.site-foot { margin-top: -3.5rem; padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
.drawer-scrim { display: none; }
@media (max-width: 767px) {
  .has-shell .sidebar { display: flex; z-index: 60; width: min(84vw, 300px); transform: translateX(-102%); transition: transform .26s var(--ease-out); box-shadow: var(--shadow-lg); padding-top: calc(10px + env(safe-area-inset-top)); }
  .drawer-open .sidebar { transform: none; }
  .drawer-close { display: inline-flex; }
  .drawer-open .drawer-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: var(--overlay); }
  .drawer-open { overflow: hidden; }
  .topbar-in { padding: 0 8px; gap: .25rem; }
}
@media (min-width: 768px) {
  .has-shell .topbar, .has-shell .main, .has-shell .site-foot { margin-left: var(--sidebar-w); }
  .topbar { top: 0; margin-top: 0; margin-right: 0; padding-left: 0; }
  .topbar-in { padding: 0 20px 0 24px; }
  .topbar-actions { display: flex; }
  .main { padding: 1.75rem 2rem 3rem; }
  .has-shell .main { padding-right: 2rem; }
  .site-foot { margin-top: 0; padding-bottom: 2rem; }
}
@media (min-width: 768px) and (max-width: 1099px) { .topbar-actions .btn:not(.btn-primary) span { display: none; } .topbar-actions .btn:not(.btn-primary) { width: 40px; padding: 0; } }
@media (min-width: 768px) and (max-width: 1023px) { :root { --sidebar-w: 220px; } }

/* ---- page headings ---- */
.display { font-size: clamp(1.5rem, 3vw, 1.875rem); letter-spacing: -.02em; }
.h1 { letter-spacing: -.02em; }
.crumbs a { border-radius: 6px; }

/* ---- document grid: big thumbnails, hover actions ---- */
.doc-grid { gap: .75rem; }
@media (min-width: 640px) { .doc-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; } }
.doc-card { border-radius: var(--r-card); transition: border-color .16s, box-shadow .2s, transform .16s; }
.doc-card:hover { border-color: var(--accent-soft-2); box-shadow: 0 10px 24px -14px rgba(16, 24, 32, .35); }
.doc-thumb { aspect-ratio: 4 / 4.6; padding: 14px 18px 0; background: var(--thumb); }
.doc-thumb img, .pdf-glyph { border-radius: 4px 4px 0 0; box-shadow: 0 0 0 1px rgba(16, 24, 32, .08), 0 4px 12px -6px rgba(16, 24, 32, .3); }
.doc-card:hover .doc-thumb img { transform: none; }
.doc-body { border-top: 1px solid var(--hair); }
.doc-actions { position: absolute; z-index: 4; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transform: translateY(-2px); transition: opacity .16s, transform .16s; }
.doc-item:hover .doc-actions, .doc-item:focus-within .doc-actions { opacity: 1; transform: none; }
.doc-act { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; background: var(--solid); color: var(--text); border: 1px solid var(--hair-2); box-shadow: var(--shadow); }
.doc-act:hover { color: var(--accent); border-color: var(--accent); }
.doc-item:hover .star-badge { opacity: 0; }
.selecting .doc-actions { display: none; }
@media (hover: none) { .doc-actions { display: none; } .doc-item:hover .star-badge { opacity: 1; } }
.doc-item.is-selected .doc-card { box-shadow: 0 0 0 2px var(--accent); }
.doc-list-head { background: var(--fill); }
.row-thumb { border-radius: 4px; }

/* ---- dialogs, toasts, misc surfaces ---- */
.link { color: var(--accent); }

/* ---- auth / sign-in: white marketing layout ---- */
.auth-page .backdrop { background: var(--solid); }
.site-hdr { position: sticky; top: 0; z-index: 30; background: var(--solid); border-bottom: 1px solid var(--hair); padding-top: env(safe-area-inset-top); }
.site-hdr-in { display: flex; align-items: center; gap: 1rem; max-width: 1180px; min-height: 64px; margin: 0 auto; padding: 0 16px; }
.site-hdr nav { display: none; gap: .25rem; margin-left: 1.5rem; }
.site-hdr nav a { padding: .5rem .75rem; border-radius: 8px; font-size: .9375rem; font-weight: 500; color: var(--text-2); }
.site-hdr nav a:hover { background: var(--fill); color: var(--text); }
.site-hdr .hdr-cta { margin-left: auto; display: flex; gap: .5rem; }
@media (min-width: 768px) { .site-hdr nav { display: flex; } }
.auth { min-height: auto; padding-top: 2rem; padding-bottom: 3rem; }
@media (min-width: 1024px) { .auth { padding-top: 4rem; padding-bottom: 4rem; } }
.auth-hero h2 { letter-spacing: -.03em; }
.auth-hero h2 .soft { color: var(--accent); }
.auth-sheet, .auth-card .card { border-radius: var(--r-panel); box-shadow: 0 20px 50px -28px rgba(16, 24, 32, .35); }
.store-cta { display: inline-flex; align-items: center; gap: .6rem; min-height: 48px; padding: 0 1.1rem; border-radius: 10px; background: #111; color: #fff; font-weight: 600; font-size: .875rem; line-height: 1.15; }
.store-cta small { display: block; font-size: .6875rem; font-weight: 500; opacity: .8; }
html.dark .store-cta { background: #fff; color: #111; }
.feature-band { background: var(--paper); border-top: 1px solid var(--hair); padding: 3rem 16px; }
.feature-grid { display: grid; gap: 1rem; max-width: 1180px; margin: 0 auto; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .feature-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.feature-card { padding: 1.25rem; border-radius: var(--r-card); background: var(--solid); border: 1px solid var(--hair); }
.feature-card .f-ic { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-bottom: .75rem; }
.feature-card h3 { font-weight: 650; font-size: 1rem; margin-bottom: .25rem; }
.feature-card p { font-size: .875rem; color: var(--text-2); }
.site-footer { border-top: 1px solid var(--hair); background: var(--solid); padding: 2rem 16px calc(2rem + env(safe-area-inset-bottom)); }
.site-footer-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; max-width: 1180px; margin: 0 auto; font-size: .8125rem; color: var(--text-2); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.site-footer a:hover { color: var(--accent); }
@media (max-width: 1023px) { .store-row .btn { display: none; } .auth-hero { gap: .75rem; } }

/* Ask this document */
.ask-thread { display: flex; flex-direction: column; gap: 8px; max-height: 22rem; overflow-y: auto; }
.ask-thread:empty { display: none; }
.ask-msg { display: flex; flex-direction: column; max-width: 92%; }
.ask-user { align-self: flex-end; align-items: flex-end; }
.ask-assistant { align-self: flex-start; }
.ask-bubble { padding: 8px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; background: var(--fill-2, rgba(120,120,128,.14)); white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-user .ask-bubble { background: var(--ink); color: var(--on-ink); }
.text-edit > summary { cursor: pointer; list-style: none; padding: 6px 0; }
.text-edit > summary::-webkit-details-marker { display: none; }
.text-edit > summary::before { content: "▸ "; opacity: .6; }
.text-edit[open] > summary::before { content: "▾ "; }
.chip-sm { min-height: 22px; padding: 0 .5rem; font-size: .7rem; }

/* Find a tool (finder.js) + select mode */
.finder-row { display: block; padding: .55rem .75rem; border-radius: 12px; cursor: pointer; }
.finder-row.is-active, .finder-row:hover { background: color-mix(in oklab, var(--ink, #111) 7%, transparent); }
.page-select { cursor: pointer; }
.page-select input { accent-color: var(--ink, #111); width: 1rem; height: 1rem; }
.hub-pick summary::-webkit-details-marker { display: none; }
.hub-pick summary { list-style: none; }

/* ---------------------------------------------------------------- document page: one action bar + tool sheets (pagetools.js) */
.doc-head { margin-bottom: .9rem; }
.doc-title { display: flex; align-items: flex-start; gap: .4rem; min-width: 0; }
.doc-title .t-star { margin-top: .45rem; }
.doc-name-btn { display: inline; text-align: left; font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; padding: .1rem .35rem; margin: -.1rem -.35rem; border-radius: 8px; cursor: text; overflow-wrap: anywhere; }
.doc-name-btn:hover, .doc-name-btn:focus-visible { background: var(--fill); }
.doc-name-pen { display: inline-flex; vertical-align: middle; margin-left: .45rem; color: var(--text-3); opacity: .55; }
.doc-name-btn:hover .doc-name-pen, .doc-name-btn:focus-visible .doc-name-pen { opacity: 1; }
.doc-name-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; flex: 1 1 auto; min-width: 0; }
.doc-name-form[hidden] { display: none; }
.doc-name-form .input { flex: 1 1 14rem; min-width: 0; font-size: 1.05rem; font-weight: 600; }
.chip-add { border-style: dashed; border-color: var(--hair-2); color: var(--text); min-height: 30px; }

.doc-bar { position: sticky; top: var(--topbar-h, 65px); z-index: 25; margin: 0 -.5rem 1.1rem; padding: .5rem; background: var(--solid); border: 1px solid var(--hair); border-radius: var(--r-card); box-shadow: 0 6px 18px -14px rgba(16, 24, 32, .35); }
.doc-bar-in { display: flex; gap: .4rem; }
.doc-act { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; padding: 0 .9rem; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text); font-size: .9375rem; font-weight: 650; line-height: 1.15; transition: background .16s, border-color .16s, transform .16s var(--spring); -webkit-tap-highlight-color: transparent; }
.doc-act:hover { background: var(--fill); }
.doc-act:active { transform: scale(.97); }
.doc-act.is-main { background: var(--accent, var(--ink)); color: #fff; }
.doc-act.is-main:hover { filter: brightness(1.06); background: var(--accent, var(--ink)); }
.doc-act[disabled] { opacity: .55; cursor: progress; }
.doc-act svg { flex-shrink: 0; }
.doc-ask { display: none; }
.doc-head { flex-wrap: nowrap; }
.doc-head > .ph-main { flex: 1 1 0; }
.chip-add { position: relative; }
.chip-add::after { content: ""; position: absolute; inset: -8px -4px; }
.sel-bar { position: sticky; top: calc(var(--topbar-h, 65px) + var(--docbar-h, 64px) + 8px); z-index: 24; padding: .6rem .75rem; margin-bottom: .75rem; }
.sel-bar.hidden { display: none; }
.sel-acts { display: contents; }
.sel-bar .sel-done { order: 9; }
.selecting .page-card { outline: 2px dashed var(--hair-2); outline-offset: 3px; }
.selecting .page-card:has(.js-sel:checked) { outline: 2px solid var(--accent, var(--ink)); }

/* page cards: the page fills the card; only a number and a "more" menu underneath */
.page-frame { padding: 0; background: #fff; overflow: hidden; }
.page-frame .page-img { border-radius: 0; box-shadow: none; }
.page-cap { padding: .3rem .4rem .3rem .8rem; gap: .5rem; flex-wrap: nowrap; }
.page-num { font-size: .8125rem; font-weight: 650; color: var(--text-2); }
.page-card.is-current .page-num { color: var(--text); }
.page-more { border-color: transparent; background: transparent; box-shadow: none; }
.page-select { min-height: 36px; }
.page-select input { width: 1.25rem; height: 1.25rem; }
.menu-pop.menu-up { top: auto; bottom: 100%; margin: 0 0 .45rem; transform-origin: bottom right; max-height: min(70vh, 30rem); overflow-y: auto; }

/* tool sheets: big labelled tiles */
.tool-h { margin: 1rem 0 .5rem; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.tool-h:first-child { margin-top: 0; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .5rem; }
.tool-tile { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .3rem; min-height: 88px; padding: .7rem .4rem .6rem; border-radius: 12px; border: 1px solid var(--hair); background: var(--solid); color: var(--text); text-align: center; font: inherit; transition: background .16s, border-color .16s, transform .16s var(--spring); -webkit-tap-highlight-color: transparent; }
.tool-tile[hidden] { display: none; }
.tool-tile:hover { background: var(--fill); border-color: var(--hair-2); }
.tool-tile:active { transform: scale(.97); }
.tool-tile[disabled] { opacity: .45; pointer-events: none; }
.tool-ic { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: var(--fill); color: var(--accent, var(--ink)); }
.tool-lbl { font-size: .8125rem; font-weight: 650; line-height: 1.15; }
.tool-sub { font-size: .6875rem; line-height: 1.2; color: var(--text-3); }
.tool-tile.is-primary { background: var(--accent, var(--ink)); border-color: transparent; color: #fff; }
.tool-tile.is-primary .tool-ic { background: rgba(255, 255, 255, .18); color: #fff; }
.tool-tile.is-danger .tool-ic, .tool-tile.is-danger .tool-lbl { color: var(--danger); }
.pg-pick { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.pg-pick-lbl { min-width: 6.2rem; text-align: center; font-size: .875rem; font-weight: 650; }
.tool-stage { min-height: 0; }
.tool-stage canvas { max-height: 62vh; touch-action: none; }
.repair-panes { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.repair-pane { margin: 0; min-width: 0; background: #111113; border-radius: 12px; overflow: hidden; }
.repair-pane figcaption { padding: .3rem .7rem; font-size: .75rem; font-weight: 650; color: #d4d4d8; }
.repair-pane canvas { display: block; width: 100%; height: auto; max-height: 58vh; object-fit: contain; }
.repair-toggle { display: none; }
.count-total { font-size: 1rem; padding: .25rem .8rem; border-radius: 999px; background: var(--fill); }
.id-stage { display: flex; justify-content: center; padding: .75rem; border-radius: 12px; background: #111113; }
.id-stage canvas { max-width: 100%; max-height: 50vh; touch-action: none; cursor: grab; border-radius: 4px; background: #fff; }
.id-stage canvas:focus-visible { outline: 2px solid #F6DE96; outline-offset: 3px; }
.collage-prev { display: grid; gap: 4px; width: 120px; aspect-ratio: 210 / 297; padding: 8px; margin: 0 auto; border-radius: 4px; background: #fff; box-shadow: 0 0 0 1px var(--hair-2), 0 8px 20px -12px rgba(0, 0, 0, .4); }
.collage-prev.is-letter { aspect-ratio: 8.5 / 11; }
.collage-prev span { display: flex; align-items: center; justify-content: center; border-radius: 2px; background: var(--fill-2, #e5e7eb); color: var(--text-2); font-size: .6875rem; font-weight: 700; }
.code-row { padding: .7rem .8rem; border-radius: 12px; border: 1px solid var(--hair); }
.code-val { font-family: ui-monospace, Menlo, monospace; font-size: .875rem; overflow-wrap: anywhere; }
.long-part { display: flex; align-items: center; gap: .7rem; padding: .5rem; border-radius: 12px; border: 1px solid var(--hair); }
.long-part img { width: 44px; height: 64px; object-fit: cover; object-position: top; border-radius: 4px; background: #fff; box-shadow: 0 0 0 1px var(--hair-2); }
.viewer a.viewer-btn { text-decoration: none; }

@media (max-width: 767px) {
  .doc-bar { position: fixed; top: auto; left: 0; right: 0; bottom: var(--tabbar-h, 61px); z-index: 39; margin: 0; padding: .35rem .5rem .3rem; border-radius: 0; border-width: 1px 0 0; background: var(--glass-nav, var(--solid)); box-shadow: 0 -8px 20px -16px rgba(16, 24, 32, .45); }
  .doc-ask { display: flex; align-items: center; gap: .5rem; width: 100%; min-height: 44px; margin-bottom: .3rem; padding: 0 .9rem; border-radius: 999px; border: 1px solid var(--hair); background: var(--fill); color: var(--text-2); font-size: .875rem; font-weight: 500; text-align: left; }
  .doc-ask svg { color: var(--accent, var(--ink)); }
  .doc-bar-in { gap: .15rem; }
  .doc-act { flex-direction: column; gap: .15rem; min-height: 52px; padding: .25rem .15rem; font-size: .6875rem; font-weight: 650; text-align: center; border-radius: 10px; }
  .doc-act span { display: block; max-width: 100%; }
  .doc-act.is-main { background: transparent; color: var(--accent, var(--ink)); }
  .doc-act.is-main:hover { background: var(--fill); filter: none; }
  .has-docbar .main { padding-bottom: calc(var(--tabbar-h, 61px) + var(--docbar-h, 118px) + 1.5rem); }
  .has-docbar .site-foot { padding-bottom: calc(var(--tabbar-h, 61px) + var(--docbar-h, 118px) + 1rem); margin-top: 0; }
  .has-docbar .toasts { bottom: calc(var(--tabbar-h, 61px) + var(--docbar-h, 118px) + 8px); }
  .sel-bar { top: calc(var(--topbar-h, 64px) + 6px); }
  .doc-head .head-actions summary.btn { width: 44px; min-height: 44px; }
  .doc-name-btn { display: inline-block; min-height: 44px; }
  .sel-bar .btn-sm { min-height: 44px; }
  .sel-bar .sel-done { order: 0; }
  .sel-acts { display: flex; flex: 1 0 100%; gap: .4rem; margin: 0 -.75rem; padding: 0 .75rem 2px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .sel-acts::-webkit-scrollbar { display: none; }
  .sel-acts > *, .sel-acts .btn { flex-shrink: 0; }
  dialog.sheet .btn-sm { min-height: 44px; }
  .page-more { width: 44px !important; min-height: 44px; }
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tool-tile { min-height: 84px; }
  .pg-pick .btn { width: 44px; min-height: 44px; }
  .repair-panes { grid-template-columns: 1fr; }
  .repair-panes[data-show="after"] [data-pane="before"], .repair-panes[data-show="before"] [data-pane="after"] { display: none; }
  .repair-toggle { display: inline-flex; }
  dialog.sheet.sheet-wide, dialog.sheet.sheet-mid { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--r-panel) var(--r-panel) 0 0; max-height: 94dvh; }
  .sheet-foot .btn { flex: 1 1 auto; }
  .viewer-bar { padding: .5rem; }
  .viewer-btn { padding: 0 .7rem; }
}
@media (min-width: 768px) and (max-width: 1100px) { .doc-act { padding: 0 .4rem; font-size: .875rem; gap: .35rem; } }
@media (prefers-reduced-motion: reduce) { .doc-act:active, .tool-tile:active, .start-tile:active { transform: none; } }
@media print { .doc-bar, .sel-bar { display: none !important; } }

/* ---------------------------------------------------------------- home: the three ways to start */
.start-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-bottom: 2rem; }
.start-tile { display: flex; align-items: center; gap: .85rem; min-height: 84px; padding: 1rem 1.1rem; border-radius: var(--r-card); border: 1px solid var(--hair); background: var(--solid); color: var(--text); text-align: left; font: inherit; transition: border-color .16s, box-shadow .16s, transform .16s var(--spring); -webkit-tap-highlight-color: transparent; }
.start-tile:hover { border-color: var(--accent-soft-2, var(--hair-2)); box-shadow: 0 6px 18px -10px rgba(16, 24, 32, .25); transform: translateY(-1px); }
.start-tile:active { transform: scale(.98); }
.start-tile .ic-chip { flex-shrink: 0; }
.start-tile b { display: block; font-size: 1rem; font-weight: 650; line-height: 1.2; }
.start-tile small { display: block; margin-top: .15rem; font-size: .8125rem; line-height: 1.25; color: var(--text-2); }
.start-tile.is-primary { background: var(--accent, var(--ink)); border-color: transparent; color: #fff; }
.start-tile.is-primary small { color: rgba(255, 255, 255, .85); }
.start-tile.is-primary .ic-chip { background: rgba(255, 255, 255, .18); color: #fff; }
.home-more a[href="/app/scan"] { display: none; }
@media (max-width: 767px) {
  .start-grid { gap: .5rem; margin-bottom: 1.5rem; }
  .start-tile { flex-direction: column; align-items: center; justify-content: center; gap: .45rem; min-height: 104px; padding: .8rem .4rem; text-align: center; }
  .start-tile b { font-size: .875rem; }
  .start-tile small { display: none; }
}
