/* NB FAE Case Summary — light/dark theme, desktop + phone */
:root {
  --red: #d71920; --red-ink: #b3121a; --red-soft: #fdecec; --red-line: #f6c9cb;
  --bg: #f4f5f7; --card: #ffffff; --ink: #17181c; --ink-2: #4a4d55; --muted: #80838c;
  --line: #e4e6ea; --tile: #f3f4f6; --field: #ffffff; --field-line: #d5d8de;
  --ok: #18794e; --ok-soft: #e6f4ec; --warn: #a15c00; --warn-soft: #fff3df; --blue: #1d5bd8; --blue-soft: #e8efff;
  --shadow: 0 1px 2px rgba(16,18,24,.05), 0 6px 24px rgba(16,18,24,.06);
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red: #ff4d55; --red-ink: #ff7a80; --red-soft: #3a1618; --red-line: #5c2427;
    --bg: #111215; --card: #1a1c20; --ink: #eceef2; --ink-2: #c3c6cd; --muted: #8d919a;
    --line: #2b2e34; --tile: #23262b; --field: #15171a; --field-line: #363a41;
    --ok: #5ad19a; --ok-soft: #12301f; --warn: #f0b45c; --warn-soft: #33260f; --blue: #7aa5ff; --blue-soft: #18233d;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 30px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --red: #ff4d55; --red-ink: #ff7a80; --red-soft: #3a1618; --red-line: #5c2427;
  --bg: #111215; --card: #1a1c20; --ink: #eceef2; --ink-2: #c3c6cd; --muted: #8d919a;
  --line: #2b2e34; --tile: #23262b; --field: #15171a; --field-line: #363a41;
  --ok: #5ad19a; --ok-soft: #12301f; --warn: #f0b45c; --warn-soft: #33260f; --blue: #7aa5ff; --blue-soft: #18233d;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 30px rgba(0,0,0,.35); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--font); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--red); min-height: 1.4em; margin: 10px 0 0; font-size: 14px; }
.stack > * + * { margin-top: 14px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--field-line); background: var(--card); cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-ink); border-color: var(--red-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; height: 44px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; min-width: 36px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 14px; font-weight: 600; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
#aiBtn { color: #fff; background: var(--red); border-color: var(--red); }
#aiBtn svg { fill: #fff; stroke: none; }
.chip { display: inline-block; text-align: left; border: 1px solid var(--line); background: var(--tile); border-radius: 999px; padding: 6px 12px;
  margin: 4px 4px 0 0; cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--red-line); background: var(--red-soft); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(900px 500px at 85% -10%, var(--red-soft), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow); }
.auth-title { margin: 6px 0 22px; font-size: 26px; line-height: 1.25; }
.fld { display: block; }
.fld > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input, select, textarea { width: 100%; border: 1px solid var(--field-line); background: var(--field); border-radius: 10px; padding: 9px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }
textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
input[type=radio], input[type=checkbox] { width: auto; accent-color: var(--red); }
.note-box { background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: 10px; padding: 10px 14px; font-size: 14px; }

/* ---------- brand / topbar ---------- */
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--red); color: #fff;
  font: 800 11px/1 Arial, sans-serif; letter-spacing: .02em; flex: none; }
.brand-mark.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 16px; margin-bottom: 18px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; height: 60px; padding: 0 20px;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; white-space: nowrap; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.topnav a:hover { background: var(--tile); }
.topnav a.on { color: var(--red); background: var(--red-soft); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--tile); cursor: pointer; font-weight: 700; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 44px; min-width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; z-index: 30; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 8px;
  text-decoration: none; cursor: pointer; font-size: 14px; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--tile); }
.bottom-tabs { display: none; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 96px; }

/* ---------- hero card ---------- */
.hero { position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px 28px; box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; right: -80px; top: -90px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--red) 22%, transparent), transparent 70%); pointer-events: none; }
.hero h1 { margin: 6px 0 4px; font-size: 30px; line-height: 1.2; letter-spacing: -.01em; }
.hero .sub { margin: 0; color: var(--muted); font-size: 14px; }
.hero-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 18px; position: relative; z-index: 1; }
.tile { background: var(--tile); border-radius: 12px; padding: 10px 14px; min-width: 0; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
button.tile { border: 1px solid transparent; text-align: left; cursor: pointer; }
button.tile.on { border-color: var(--red); background: var(--red-soft); }

/* ---------- list ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 22px 0 12px; }
.search { position: relative; flex: 1 1 280px; }
.search input { padding-left: 38px; height: 42px; }
.search svg { position: absolute; left: 12px; top: 12px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; }
.toolbar select { width: auto; height: 42px; min-width: 120px; }
.toolbar label.check { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; white-space: nowrap; }
.table-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.cases { width: 100%; border-collapse: collapse; font-size: 14px; }
table.cases th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--tile); padding: 10px 14px; white-space: nowrap; }
table.cases td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
table.cases tr.row { cursor: pointer; }
table.cases tr.row:hover td { background: color-mix(in srgb, var(--red-soft) 55%, transparent); }
.cid { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.ttl { font-weight: 600; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.Open { background: var(--blue-soft); color: var(--blue); }
.badge.Close { background: var(--ok-soft); color: var(--ok); }
.badge.Audit { background: var(--warn-soft); color: var(--warn); }
.badge.sev-重大 { background: var(--red-soft); color: var(--red); }
.badge.sev-普通 { background: var(--tile); color: var(--ink-2); }
.badge.sev-輕微 { background: var(--tile); color: var(--muted); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }

/* ---------- case view / form ---------- */
.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; margin-top: 24px; align-items: start; }
.toc { position: sticky; top: 84px; font-size: 13px; }
.toc a { display: flex; gap: 8px; padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--ink-2); }
.toc a:hover { background: var(--card); }
.toc a.on { background: var(--card); color: var(--red); font-weight: 700; box-shadow: var(--shadow); }
.toc a b { font-family: var(--mono); color: var(--muted); font-weight: 600; }
.sec { margin-bottom: 34px; scroll-margin-top: 80px; }
.sec-h { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-size: 21px; }
.sec-no { display: inline-grid; place-items: center; min-width: 36px; height: 26px; padding: 0 8px; border-radius: 7px; background: var(--red); color: #fff;
  font: 700 13px/1 var(--mono); }
.sec-h small { font-size: 13px; font-weight: 500; color: var(--muted); }
.sec-note { margin: -4px 0 14px; font-size: 13px; color: var(--ink-2); background: var(--red-soft); border-left: 3px solid var(--red); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kv { display: grid; grid-template-columns: 220px minmax(0, 1fr); border-top: 1px solid var(--line); }
.kv:first-child { border-top: 0; }
.kv > .k { padding: 14px 18px; font-weight: 700; font-size: 14px; background: var(--tile); }
.kv > .v { padding: 14px 18px; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.kv > .v.blank { color: var(--muted); font-style: italic; }
.kv .hint { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 4px; white-space: pre-line; }
.sub-grid { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 14px; white-space: normal; }
.sub-grid dt { font-weight: 700; color: var(--ink-2); font-size: 13px; padding-top: 1px; }
.sub-grid dd { margin: 0; white-space: pre-wrap; }
.box { font-family: var(--font); }

/* form rows */
.frow { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; padding: 16px 18px; border-top: 1px solid var(--line); }
.frow:first-child { border-top: 0; }
.frow > .lab { font-weight: 700; font-size: 14px; }
.frow > .lab .req { color: var(--red); margin-left: 2px; }
.frow > .lab .hint { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 4px; white-space: pre-line; line-height: 1.5; }
.frow.small-input input { max-width: 180px; }
.radios { display: flex; flex-wrap: wrap; gap: 8px; }
.radios label { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--field-line); border-radius: 10px; cursor: pointer; font-size: 14px; }
.radios label:has(input:checked) { border-color: var(--red); background: var(--red-soft); color: var(--red); font-weight: 700; }
.radios .clear { border-style: dashed; color: var(--muted); }
.parts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.parts .fld.full { grid-column: 1 / -1; }
.parts textarea { min-height: 70px; }
.analysis { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--tile); }
.analysis-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 700; font-size: 14px; }
.kb-item { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 4px 8px; align-items: start; padding: 10px 0; border-top: 1px dashed var(--line); }
.kb-item:first-child { border-top: 0; padding-top: 0; }
.kb-item .kb-body { display: grid; gap: 8px; }
.kb-item .kb-body .radios label { padding: 4px 10px; font-size: 13px; }
input:disabled { background: var(--tile); color: var(--ink-2); cursor: not-allowed; }
.fname-inline { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.fname { font-family: var(--mono); font-size: 13px; background: var(--tile); border: 1px dashed var(--field-line); border-radius: 10px; padding: 10px 12px; overflow-wrap: anywhere; }
.quick { margin-top: 6px; }
.savebar { position: sticky; bottom: 0; z-index: 15; display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 12px 16px; margin: 0 -4px;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.savebar .state { margin-right: auto; font-size: 13px; color: var(--muted); }

/* ---------- drawer (AI) ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(460px, 100vw); display: flex; flex-direction: column;
  background: var(--card); border-left: 1px solid var(--line); box-shadow: -10px 0 40px rgba(0,0,0,.14); }
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(10,12,16,.35); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ai-scope { display: flex; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ai-scope label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.ai-log { flex: 1; overflow-y: auto; padding: 16px; }
.ai-tip p { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.msg { margin-bottom: 14px; max-width: 92%; }
.msg.user { margin-left: auto; background: var(--red); color: #fff; padding: 9px 13px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.msg.bot { background: var(--tile); padding: 11px 14px; border-radius: 14px 14px 14px 4px; }
.msg.bot p { margin: 0 0 8px; } .msg.bot p:last-child { margin: 0; }
.msg.bot ul, .msg.bot ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.bot .cite { display: inline-block; margin: 0 2px; padding: 0 7px; border-radius: 6px; background: var(--red-soft); color: var(--red); font-size: 12px; font-weight: 700;
  text-decoration: none; vertical-align: 1px; }
.msg.bot .sources { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; }
.msg.bot .sources a { display: block; color: var(--ink-2); }
.msg.err { color: var(--red); }
.dots::after { content: "…"; animation: blink 1s infinite; } @keyframes blink { 50% { opacity: .2; } }
.ai-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.ai-input textarea { min-height: 44px; height: 44px; }

/* ---------- dialog / toast ---------- */
dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(640px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10,12,16,.45); }
.dlg { padding: 22px 24px; }
.dlg h2 { margin: 0 0 4px; font-size: 20px; }
.dlg .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.dlg .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg textarea { min-height: 260px; font-size: 13px; }
.rcpt { font-size: 13px; background: var(--tile); border-radius: 10px; padding: 8px 12px; overflow-wrap: anywhere; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s; z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* date, guidance, locked fields */
.ymd { display: flex; gap: 8px; position: relative; max-width: 260px; }
.ymd input[data-key] { font-family: var(--mono); }
.ymd input.bad { border-color: var(--red); background: var(--red-soft); }
.ymd .btn { height: auto; padding: 0 10px; }
.ymd-picker { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.guide { margin-bottom: 8px; padding: 8px 12px; border-radius: 8px; background: var(--blue-soft); color: var(--ink); font-size: 13px; line-height: 1.5; border-left: 3px solid var(--blue); }
.guide::before { content: "填寫引導："; font-weight: 700; color: var(--blue); }
textarea:disabled { background: var(--tile); color: var(--muted); cursor: not-allowed; }
.frow.is-off .lab { color: var(--muted); }
.sub-grid.wide { grid-template-columns: 170px minmax(0, 1fr); }
.analysis-h span { font-weight: 700; }

/* search */
.search-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; padding: 20px; margin-top: 22px; }
.search-form .full { grid-column: 1 / -1; }
.search-form .fld > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.search-form .search input { height: 44px; }
.date-range { display: flex; gap: 6px; align-items: center; }
.date-range input { min-width: 0; }
.cond-row { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr) auto; gap: 8px; margin-bottom: 8px; }
.search-actions { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.results { margin-top: 4px; }
.result { display: block; padding: 16px 18px; margin-bottom: 10px; text-decoration: none; transition: border-color .15s; }
.result:hover { border-color: var(--red); }
.result-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.result-title { font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.hits { list-style: none; margin: 10px 0 0; padding: 10px 12px; background: var(--tile); border-radius: 10px; font-size: 13.5px; }
.hits li + li { margin-top: 4px; }
.hits b { color: var(--ink-2); margin-right: 8px; }
mark { background: color-mix(in srgb, var(--red) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.back-link { position: relative; z-index: 1; display: inline-block; margin-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--red); text-decoration: none; }

/* admin */
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th { text-align: left; font-size: 12px; color: var(--muted); background: var(--tile); padding: 10px 12px; }
table.users td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.users select { width: auto; padding: 5px 8px; }
.add-user { display: grid; grid-template-columns: 2fr 1.2fr 1fr 1fr 1.2fr auto; gap: 10px; align-items: end; padding: 16px; border-bottom: 1px solid var(--line); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .frow, .kv { grid-template-columns: 1fr; gap: 8px; }
  .kv > .k { padding: 10px 14px 6px; background: none; color: var(--muted); font-size: 13px; }
  .kv > .v { padding: 0 14px 14px; }
  .add-user { grid-template-columns: 1fr 1fr; }
  .search-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .topnav, .brand-text, #aiBtn span { display: none; }
  .topbar { padding: 0 16px; gap: 10px; }
  .wrap { padding: 16px 16px 110px; }
  .hero { padding: 20px 18px; } .hero h1 { font-size: 24px; }
  .parts, .dlg .grid2 { grid-template-columns: 1fr; }
  .search-form { grid-template-columns: 1fr; padding: 16px; }
  .cond-row { grid-template-columns: 1fr auto; }
  .cond-row select { grid-column: 1 / -1; }
  table.cases thead { display: none; }
  table.cases, table.cases tbody, table.cases tr, table.cases td { display: block; width: 100%; }
  table.cases tr.row { padding: 12px 14px; border-top: 1px solid var(--line); }
  table.cases td { border: 0; padding: 2px 0; }
  table.cases td.hide-sm { display: none; }
  .toolbar select { flex: 1 1 40%; min-width: 0; }
  .bottom-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-template-columns: repeat(4, 1fr);
    background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-tabs a, .bottom-tabs button { padding: 14px 0; text-align: center; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink-2); background: none; border: 0; }
  .bottom-tabs .on { color: var(--red); }
  .savebar { bottom: 58px; }
  table.users thead { display: none; }
  table.users tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
  table.users td { border: 0; padding: 2px 12px; }
}
@media print {
  .topbar, .bottom-tabs, .toc, .hero-actions, .savebar, .drawer { display: none !important; }
  .layout { display: block; } body { background: #fff; }
}
