/* RMA Log — mobile-first, light/dark via system preference */
:root {
  color-scheme: light;
  --bg: #eceff4;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --border: #dde2ea;
  --border-strong: #c5ccd7;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #e8efff;
  --on-primary: #ffffff;
  --focus: #2563eb;
  --open: #1d4ed8;   --open-bg: #e6eeff;
  --wait: #a15c00;   --wait-bg: #fff3d6;
  --done: #15803d;   --done-bg: #e3f6e9;
  --bad: #b91c1c;    --bad-bg: #fde8e8;
  --repeat: #7c3aed; --repeat-bg: #f1eaff;
  --danger: #b91c1c;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e1e0d9;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 64px;
  --top-h: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0c0e12;
    --surface: #171a21;
    --surface-2: #1f232c;
    --border: #2a2f3a;
    --border-strong: #3a4150;
    --text: #e8eaef;
    --text-2: #b4bac6;
    --muted: #9aa1ae;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-soft: #1a2742;
    --on-primary: #ffffff;
    --focus: #60a5fa;
    --open: #8db4ff;   --open-bg: #1a2742;
    --wait: #f5c46b;   --wait-bg: #33280f;
    --done: #6fd394;   --done-bg: #12301f;
    --bad: #ff8a8a;    --bad-bg: #3a1717;
    --repeat: #c4a6ff; --repeat-bg: #2a1f45;
    --danger: #ff8a8a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: #2c2c2a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--font);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.0625rem; font-weight: 600; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .875em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.mono { font-family: var(--mono); font-size: .9375em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.text-warn { color: var(--wait); font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 1000; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.narrow { max-width: 560px; }

/* ---------- Shell ---------- */
.main { padding: 16px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); max-width: 1280px; margin: 0 auto; }
.no-nav .main { padding-bottom: 32px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none !important; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: var(--on-primary); }
.brand-mark .icon { width: 18px; height: 18px; }
.brand-mark.lg { width: 52px; height: 52px; border-radius: 14px; }
.brand-mark.lg .icon { width: 28px; height: 28px; }

.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top-h);
  display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand span:last-child { display: none; }
.top-search { flex: 1; display: flex; align-items: center; position: relative; max-width: 560px; margin-left: auto; }
.top-search .search-ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.top-search input[type=search] {
  width: 100%; padding-left: 40px !important; padding-right: 48px !important; height: 40px; padding: 0 44px 0 40px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 16px;
}
.top-search .icon-btn { position: absolute; right: 2px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.bottom-nav a, .bottom-nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .75rem; font-weight: 500; color: var(--muted); background: none; border: 0; text-decoration: none; min-height: 48px;
}
.bottom-nav .active { color: var(--primary); }
.bottom-nav .icon { width: 22px; height: 22px; }
.bn-plus { display: grid; place-items: center; width: 44px; height: 32px; border-radius: 12px; background: var(--primary); color: var(--on-primary); }
.bottom-nav .bn-new { color: var(--text); }

.sidebar { display: none; }

@media (min-width: 1024px) {
  body.has-nav { padding-left: 248px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 16px;
    position: fixed; inset: 0 auto 0 0; width: 248px; padding: 20px 14px; z-index: 30;
    background: var(--surface); border-right: 1px solid var(--border);
  }
  .sidebar .brand { padding: 0 8px; font-size: 1.0625rem; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav a, .side-user a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
    color: var(--text-2); font-weight: 500; text-decoration: none; transition: background .15s, color .15s;
  }
  .side-nav a:hover, .side-user a:hover { background: var(--surface-2); color: var(--text); }
  .side-nav a.active, .side-user a.active { background: var(--primary-soft); color: var(--primary); }
  .side-sep { height: 1px; background: var(--border); margin: 8px 4px; }
  .side-user { margin-top: auto; display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--border); padding-top: 12px; }
  .side-user a { flex: 1; min-width: 0; }
  .side-user a span { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; }
  .side-user small { color: var(--muted); font-size: .75rem; text-transform: capitalize; }
  .topbar { padding-left: 24px; }
  .topbar .brand { display: none; }
  .top-search { margin-left: 0; }
  .bottom-nav, .sheet { display: none !important; }
  .main { padding: 24px 32px 48px; }
  .hide-lg { display: none !important; }
}
@media (max-width: 1023px) { .show-lg { display: none !important; } }
@media (max-width: 639px) { .hide-sm { display: none !important; } }
@media (min-width: 640px) { .show-sm { display: none !important; } }

/* ---------- Bottom sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 90; }
.sheet-backdrop, .modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); animation: fade .2s ease-out; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface);
  border-radius: 18px 18px 0 0; padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; animation: slideup .22s ease-out;
}
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 4px auto 8px; }
.sheet-panel a, .sheet-panel button {
  display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 12px; border-radius: 10px;
  color: var(--text); background: none; border: 0; width: 100%; font-weight: 500; text-decoration: none; text-align: left;
}
.sheet-panel a:active, .sheet-panel button:active { background: var(--surface-2); }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- Page header ---------- */
.page-head { margin: 4px 0 16px; display: flex; flex-direction: column; gap: 4px; }
.page-head .muted { font-size: .9375rem; }
.head-row { display: flex; flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; color: var(--text-2); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 500; min-height: 36px; margin-left: -4px; }
.back .icon { width: 18px; height: 18px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-title .icon { width: 18px; height: 18px; color: var(--muted); }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-title-row .card-title { margin: 0; }
.count { font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.link-sm { font-size: .875rem; font-weight: 500; }
.empty { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-ic { width: 40px; height: 40px; color: var(--muted); stroke-width: 1.5; }
.empty-inline { padding: 8px 0; }
.detail-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .detail-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }
.report-grid { display: grid; gap: 16px; margin-top: 16px; }
@media (min-width: 900px) { .report-grid { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: .9375rem;
  text-decoration: none !important; white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger-ghost:hover { background: var(--bad-bg); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .875rem; }
.btn-lg { min-height: 50px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .5; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px;
  background: transparent; border: 0; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.btn-scan { border-radius: 0 10px 10px 0; margin-left: -1px; padding: 0 14px; }
.btn-scan span { font-size: .875rem; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .quick-status label { font-size: .875rem; font-weight: 600; color: var(--text-2); }
.req { color: var(--danger); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input-group { display: flex; align-items: stretch; position: relative; }
.input-group input { border-radius: 10px 0 0 10px; }
.input-group .icon-btn { position: absolute; right: 0; top: 0; }
.input-group:has(> .icon-btn) input { border-radius: 10px; padding-right: 48px; }
.help { font-size: .8125rem; color: var(--muted); }
.field-error { display: flex; gap: 6px; align-items: flex-start; font-size: .875rem; color: var(--danger); font-weight: 500; }
.field-error .icon { width: 16px; height: 16px; margin-top: 2px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger) !important; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.grid-2, .grid-3 { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.record-form { display: flex; flex-direction: column; gap: 16px; max-width: 920px; }
.form-section { display: flex; flex-direction: column; gap: 16px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 1rem; }
.step { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: .8125rem; font-weight: 700; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-height: 32px; padding: 4px 12px; border-radius: 999px; font-size: .8125rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.used { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

.action-bar {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; gap: 8px; justify-content: flex-end; padding: 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.action-bar.static { position: static; box-shadow: none; margin-top: 16px; }
.action-bar .btn-primary { flex: 1; max-width: 220px; }
@media (max-width: 639px) { .action-bar .btn { flex: 1; padding: 0 10px; } .action-bar .btn-ghost { flex: 0 0 auto; } }
@media (min-width: 1024px) { .action-bar { bottom: 16px; } }

.upload-row { display: grid; gap: 12px; }
@media (min-width: 640px) { .upload-row { grid-template-columns: 1fr 1fr; } }
.upload-btn {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 16px; min-height: 72px;
  border: 2px dashed var(--border-strong); border-radius: var(--radius); cursor: pointer; background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.upload-btn:hover, .upload-btn:focus-within { border-color: var(--primary); background: var(--primary-soft); }
.upload-btn > .icon { width: 28px; height: 28px; color: var(--primary); }
.upload-btn span { display: flex; flex-direction: column; }
.upload-btn small { color: var(--muted); font-size: .8125rem; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.preview { display: flex; flex-wrap: wrap; gap: 8px; }
.preview:empty { display: none; }
.preview .pv { position: relative; width: 88px; height: 88px; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.preview .pv img { width: 100%; height: 100%; object-fit: cover; }
.preview .pv.file { display: flex; align-items: center; justify-content: center; padding: 6px; font-size: .6875rem; text-align: center; word-break: break-all; }
.preview .pv button { position: absolute; top: 2px; right: 2px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; }
.preview .pv button .icon { width: 14px; height: 14px; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb-item { position: relative; width: 100px; height: 100px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.thumb-del { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; background: rgba(0,0,0,.6); color: #fff; border-radius: 50%; }
.file-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; padding: 6px; font-size: .6875rem; text-align: center; word-break: break-all; color: var(--text-2); }

/* ---------- Alerts / toasts ---------- */
.alert, .toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: .9375rem; border: 1px solid transparent; }
.alert .icon, .toast .icon { margin-top: 1px; }
.alert-error, .toast-error { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert-warn { background: var(--wait-bg); color: var(--wait); border-color: color-mix(in srgb, var(--wait) 25%, transparent); }
.alert-info { background: var(--open-bg); color: var(--open); border-color: color-mix(in srgb, var(--open) 25%, transparent); }
.toast-success { background: var(--done-bg); color: var(--done); border-color: color-mix(in srgb, var(--done) 25%, transparent); }
.alert a, .toast a { color: inherit; text-decoration: underline; font-weight: 600; }
.toast { align-items: center; animation: pop .2s ease-out; }
.toast span { flex: 1; }
.toast .icon-btn { width: 32px; height: 32px; color: inherit; }
.password-reveal code.big { font-size: 1.125rem; padding: 4px 10px; margin: 0 8px; }
.password-reveal p { margin-top: 6px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .8125rem; font-weight: 600; white-space: nowrap; text-decoration: none !important;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge .icon { width: 14px; height: 14px; }
.badge-open { background: var(--open-bg); color: var(--open); }
.badge-wait { background: var(--wait-bg); color: var(--wait); }
.badge-done { background: var(--done-bg); color: var(--done); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-repeat { background: var(--repeat-bg); color: var(--repeat); }
.badge-admin { background: var(--primary-soft); color: var(--primary); }
.badge-neutral { background: var(--surface-2); color: var(--text-2); }
.badge.sm { padding: 1px 7px; font-size: .75rem; gap: 3px; }
.badge.sm .icon { width: 12px; height: 12px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 768px) { .kpis { grid-template-columns: repeat(5, 1fr); } .kpis-3 { grid-template-columns: repeat(3, 1fr); } }
.kpis-3 { grid-template-columns: repeat(3, 1fr); }
.kpi {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); text-decoration: none !important;
  transition: border-color .15s;
}
a.kpi:hover { border-color: var(--primary); }
.kpi-label { font-size: .8125rem; font-weight: 600; color: var(--text-2); }
.kpi-value { font-size: 1.875rem; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.kpi-value.sm { font-size: 1.125rem; padding: 6px 0; }
.kpi-sub { font-size: .75rem; color: var(--muted); }
.kpis > :last-child:nth-child(odd) { grid-column: span 2; }
@media (min-width: 768px) { .kpis > :last-child:nth-child(odd) { grid-column: auto; } }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.qa {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; min-height: 92px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-weight: 600; text-align: left; text-decoration: none !important; box-shadow: var(--shadow);
}
.qa .icon { width: 26px; height: 26px; color: var(--primary); }
.qa-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.qa-primary .icon { color: var(--on-primary); }
.qa:active { transform: scale(.98); }

/* ---------- Lists ---------- */
.status-bars, .hbars, .item-list, .visit-list, .timeline, .history, .file-list { list-style: none; margin: 0; padding: 0; }
.status-bars li a { display: grid; grid-template-columns: 170px 1fr 36px; align-items: center; gap: 10px; padding: 6px 0; color: var(--text); text-decoration: none; min-height: 44px; }
.sb-track, .hb-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.sb-fill, .hb-fill { display: block; height: 100%; border-radius: 999px; min-width: 2px; }
.sb-open { background: var(--open); } .sb-wait { background: var(--wait); }
.hb-fill { background: var(--series-1); }
.sb-val, .hb-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 10px; padding: 6px 0; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9375rem; }
.hb-val small { color: var(--muted); font-weight: 500; }

.item-list li + li, .file-list li + li { border-top: 1px solid var(--border); }
.item-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; color: var(--text); text-decoration: none; min-height: 52px; }
.il-main, .il-side { display: flex; flex-direction: column; gap: 2px; }
.il-main small { color: var(--muted); }
.il-side { align-items: flex-end; }

.file-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.file-list li > a:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .icon { color: var(--muted); }

.visit-list a { display: flex; align-items: center; gap: 10px; padding: 8px; margin: 0 -8px; border-radius: 8px; color: var(--text); text-decoration: none; }
.visit-list a:hover { background: var(--surface-2); }
.visit-list li.current a { background: var(--primary-soft); }
.visit-no { font-weight: 700; color: var(--muted); width: 28px; }
.visit-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.visit-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.timeline li { position: relative; display: flex; gap: 12px; padding: 0 0 14px 0; font-size: .9375rem; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); margin-top: 5px; flex-shrink: 0; }
.timeline small { display: block; color: var(--muted); font-size: .8125rem; }

.history > li { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding-bottom: 8px; }
.h-marker span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .875rem; }
.history > li:not(:last-child) .h-marker { position: relative; }
.history > li:not(:last-child)::before { content: ""; position: absolute; left: 20px; top: 44px; bottom: 0; width: 2px; background: var(--border); }
.h-body { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; min-width: 0; }
.h-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.h-gap { grid-column: 2; font-size: .8125rem; color: var(--muted); padding: 2px 0 10px; font-weight: 500; }
.h-gap.warn { color: var(--wait); }

/* ---------- Key/value ---------- */
.kvs { margin: 0; display: flex; flex-direction: column; }
.kv { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 10px 0; border-top: 1px solid var(--border); }
.kv:first-child { border-top: 0; padding-top: 0; }
.kv dt { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
@media (min-width: 640px) { .kv { grid-template-columns: 180px 1fr; gap: 16px; } }
.kvs.compact .kv { padding: 4px 0; border: 0; grid-template-columns: 90px 1fr; gap: 8px; font-size: .9375rem; }

.quick-status { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; padding: 12px 16px; }
@media (min-width: 640px) { .quick-status { flex-direction: row; align-items: center; gap: 16px; } .quick-status select { max-width: 320px; } }
.danger-zone { margin-top: 4px; }

/* ---------- Gallery / lightbox ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.gallery-item { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.gallery-item:hover img { transform: scale(1.04); }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .92); display: flex; align-items: center; justify-content: center; animation: fade .2s ease-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100vw; max-height: 86dvh; object-fit: contain; }
.lightbox .icon-btn { position: absolute; color: #fff; background: rgba(255,255,255,.12); border-radius: 50%; width: 48px; height: 48px; }
.lb-close { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-caption { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #ddd; font-size: .875rem; padding: 0 16px; }

.upload-progress { margin-bottom: 12px; }
.upload-progress .bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.upload-progress .bar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }

/* ---------- Modal (scanner) ---------- */
.modal { position: fixed; inset: 0; z-index: 150; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-panel { position: relative; width: 100%; max-width: 520px; background: var(--surface); border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); animation: slideup .22s ease-out; }
@media (min-width: 640px) { .modal { align-items: center; } .modal-panel { border-radius: 16px; animation: pop .2s ease-out; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.scan-reader { width: 100%; min-height: 260px; border-radius: 12px; overflow: hidden; background: #000; }
.scan-reader video { width: 100% !important; height: auto !important; display: block; }
.scan-reader img[alt="Info icon"], .scan-reader img[alt="Camera based scan"] { display: none !important; }
#scan-hint { margin: 10px 0; text-align: center; }
.scan-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.scan-actions .btn { flex: 1; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.filter-more summary { cursor: pointer; font-weight: 600; color: var(--text-2); min-height: 32px; display: flex; align-items: center; }
.filter-grid { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 640px) { .filter-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .filter-grid { grid-template-columns: repeat(4, 1fr); align-items: end; } }
.filter-actions, .filter-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-inline select, .filter-inline input { width: auto; flex: 1 1 160px; }
.filter-row { gap: 12px; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; align-self: flex-start; }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 12px; border-radius: 8px; font-size: .875rem; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg-item input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg-item input:focus-visible + span { outline: 3px solid var(--focus); }

/* ---------- Tables (cards on phones) ---------- */
.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact td, .table.compact th { padding: 8px 10px; }
.card > .table.compact { margin: 0 -16px -16px; width: calc(100% + 32px); }
.clamp { max-width: 340px; }
.row-muted td { opacity: .55; }
.td-actions { text-align: right; position: relative; }
.inline-edit summary { list-style: none; }
.inline-edit summary::-webkit-details-marker { display: none; }
.edit-pop { text-align: left; margin-top: 10px; padding: 14px; background: var(--surface-2); border-radius: 10px; min-width: 260px; }
.edit-pop-foot { text-align: left; margin-top: 6px; }
.table-toggle { margin-top: 12px; }
.table-toggle summary { cursor: pointer; font-size: .875rem; font-weight: 600; color: var(--text-2); min-height: 32px; }
.table-toggle .table { margin-top: 8px; }

@media (max-width: 767px) {
  .table-card .table thead { display: none; }
  .table-card .table, .table-card .table tbody, .table-card .table tr, .table-card .table td { display: block; width: 100%; }
  .table-card .table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table-card .table tr:last-child { border-bottom: 0; }
  .table-card .table td { padding: 2px 0; border: 0; display: flex; gap: 12px; }
  .table-card .table td[data-label]::before { content: attr(data-label); flex: 0 0 96px; font-size: .8125rem; color: var(--muted); font-weight: 600; padding-top: 2px; }
  .table-card .table td:first-child::before { display: none; }
  .table-card .table td:first-child { font-size: 1rem; padding-bottom: 6px; flex-wrap: wrap; align-items: center; }
  .clamp { max-width: none; }
  .td-actions { text-align: left; }
  .card > .table.compact { margin: 0; width: 100%; }
  .table-card .table.compact td { padding: 2px 0; }
}

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 260px; }
.chart-legend { display: flex; gap: 16px; font-size: .875rem; color: var(--text-2); margin: -4px 0 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.lg-1 { background: var(--series-1); } .lg-2 { background: var(--series-2); }

/* ---------- Auth ---------- */
.auth { min-height: calc(100dvh - 64px); display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 400px; padding: 28px 24px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; margin-bottom: 24px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Print ---------- */
@media print {
  body.has-nav { padding: 0; background: #fff; color: #000; }
  .sidebar, .topbar, .bottom-nav, .no-print, .toast, .back, .action-bar { display: none !important; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .detail-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(4, 1fr); }
  a { color: #000; }
}

/* =================== v2: intake types, hero, tabs, audit =================== */
:root {
  --c-teal: #0f766e;   --c-teal-bg: #d5f5ef;
  --c-violet: #6d28d9; --c-violet-bg: #ece6fd;
  --c-amber: #a14d07;  --c-amber-bg: #fdefc8;
  --c-blue: #1d4ed8;   --c-blue-bg: #e0e9ff;
  --c-rose: #be123c;   --c-rose-bg: #ffe2e8;
  --c-slate: #334155;  --c-slate-bg: #e3e8ef;
}
@media (prefers-color-scheme: dark) {
  :root {
    --c-teal: #5eead4;   --c-teal-bg: #0f2f2c;
    --c-violet: #c4b5fd; --c-violet-bg: #2a2147;
    --c-amber: #fcd34d;  --c-amber-bg: #33270c;
    --c-blue: #93b4ff;   --c-blue-bg: #1a2742;
    --c-rose: #fda4af;   --c-rose-bg: #3a1720;
    --c-slate: #cbd5e1;  --c-slate-bg: #262c36;
  }
}
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .8125rem; font-weight: 700; white-space: nowrap; }
.pill.sm { padding: 1px 8px; font-size: .75rem; font-weight: 600; }
.pill-teal { background: var(--c-teal-bg); color: var(--c-teal); }
.pill-violet { background: var(--c-violet-bg); color: var(--c-violet); }
.pill-amber { background: var(--c-amber-bg); color: var(--c-amber); }
.pill-blue { background: var(--c-blue-bg); color: var(--c-blue); }
.pill-rose { background: var(--c-rose-bg); color: var(--c-rose); }
.pill-slate { background: var(--c-slate-bg); color: var(--c-slate); }
.tc-teal { --tc: var(--c-teal); --tc-bg: var(--c-teal-bg); }
.tc-violet { --tc: var(--c-violet); --tc-bg: var(--c-violet-bg); }
.tc-amber { --tc: var(--c-amber); --tc-bg: var(--c-amber-bg); }
.tc-blue { --tc: var(--c-blue); --tc-bg: var(--c-blue-bg); }
.tc-rose { --tc: var(--c-rose); --tc-bg: var(--c-rose-bg); }
.tc-slate { --tc: var(--c-slate); --tc-bg: var(--c-slate-bg); }
.dot-teal, .dot-violet, .dot-amber, .dot-blue, .dot-rose, .dot-slate { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-teal { background: var(--c-teal); } .dot-violet { background: var(--c-violet); } .dot-amber { background: var(--c-amber); }
.dot-blue { background: var(--c-blue); } .dot-rose { background: var(--c-rose); } .dot-slate { background: var(--c-slate); }
.badge.badge-lg { font-size: .875rem; padding: 4px 12px; }
.badge-wait .dot { background: var(--wait); }
.sb-done { background: var(--done); } .sb-bad { background: var(--bad); }

/* Section label (small caps heading above groups) */
.section-label { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 4px 0 10px; }

/* Dashboard start cards */
.start { margin-bottom: 20px; }
.start-grid { display: grid; gap: 12px; }
@media (min-width: 768px) { .start-grid { grid-template-columns: repeat(3, 1fr); } }
.start-card {
  position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 16px; min-height: 88px;
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--tc, var(--primary));
  border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none !important; text-align: left; font: inherit; cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.start-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.start-card:active { transform: scale(.99); }
.start-ic { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; background: var(--tc-bg, var(--primary-soft)); color: var(--tc, var(--primary)); }
.start-ic .icon { width: 24px; height: 24px; }
.start-body { display: flex; flex-direction: column; gap: 2px; padding-right: 56px; }
.start-body small { color: var(--muted); font-size: .8125rem; line-height: 1.35; }
.start-open { position: absolute; top: 14px; right: 14px; font-size: .75rem; font-weight: 700; color: var(--tc, var(--primary)); background: var(--tc-bg, var(--primary-soft)); padding: 2px 8px; border-radius: 999px; }
.start-scan { --tc: var(--primary); --tc-bg: var(--primary-soft); }

/* Form: intake type cards */
.type-cards { display: grid; gap: 10px; }
@media (min-width: 768px) { .type-cards { grid-template-columns: repeat(3, 1fr); } }
.type-card {
  position: relative; display: flex; gap: 12px; padding: 14px 44px 14px 14px; min-height: 76px; cursor: pointer;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: border-color .15s, background .15s;
}
.type-card:hover { border-color: var(--tc); }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card .tc-body { display: flex; flex-direction: column; gap: 2px; }
.type-card small { color: var(--muted); font-size: .8125rem; line-height: 1.35; }
.type-card .tc-check { position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; color: transparent; }
.type-card .tc-check .icon { width: 14px; height: 14px; stroke-width: 3; }
.type-card:has(input:checked) { border-color: var(--tc); background: var(--tc-bg); }
.type-card:has(input:checked) .tc-check { background: var(--tc); border-color: var(--tc); color: #fff; }
.type-card:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.type-cards.has-error .type-card { border-color: var(--danger); }
.record-form .card { border-left: 4px solid transparent; }
.record-form .card:focus-within { border-left-color: var(--primary); }

/* Collapsed "recent answers" */
.recent summary { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600; color: var(--primary); cursor: pointer; min-height: 32px; list-style: none; }
.recent summary::-webkit-details-marker { display: none; }
.recent summary .icon { width: 14px; height: 14px; }
.recent[open] summary { margin-bottom: 6px; }

/* Hero header (case & device) */
.hero { padding: 20px; margin: 8px 0 16px; border-top: 4px solid var(--primary); }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hero-title { font-size: 1.75rem; margin: 12px 0 4px; line-height: 1.2; word-break: break-all; }
.hero-label { font-size: 1rem; font-weight: 600; font-family: var(--font); }
.hero-device { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; color: var(--text-2); }
.kv-inline { display: inline-flex; gap: 6px; align-items: baseline; }
.kv-inline > span:first-child { font-size: .75rem; font-weight: 700; color: var(--muted); }
.hero-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--border); }
@media (min-width: 768px) { .hero-facts { grid-template-columns: repeat(4, 1fr); } }
.hero-facts dt { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hero-facts dd { margin: 2px 0 0; font-weight: 600; }
.hero-notes { margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: .9375rem; }

.status-pills { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.sp-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sp-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sp {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: .875rem;
  transition: background .15s, border-color .15s, color .15s;
}
.sp .icon { width: 16px; height: 16px; stroke-width: 3; }
.sp:hover { border-color: var(--primary); color: var(--primary); }
.sp-done:hover { border-color: var(--done); color: var(--done); }
.sp-bad:hover { border-color: var(--bad); color: var(--bad); }
.sp-wait:hover { border-color: var(--wait); color: var(--wait); }
.sp.current { cursor: default; color: #fff; border-color: transparent; opacity: 1; }
.sp-open.current { background: var(--open); } .sp-wait.current { background: var(--wait); }
.sp-done.current { background: var(--done); } .sp-bad.current { background: var(--bad); }
@media (prefers-color-scheme: dark) { .sp.current { color: #0c0e12; } }

/* Overflow menu */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); animation: pop .15s ease-out;
}
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 8px;
  background: none; border: 0; color: var(--text); font-weight: 500; text-decoration: none !important; text-align: left;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.menu-pop .danger { color: var(--danger); }
.menu-pop form { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }

/* Device journey strip */
.journey { margin-bottom: 16px; padding: 14px 16px; }
.journey-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.journey-head .strong { display: inline-flex; align-items: center; gap: 8px; }
.journey-head .icon { width: 18px; height: 18px; color: var(--repeat); }
.journey-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.journey-list li { flex: 0 0 auto; scroll-snap-align: start; }
.journey-list a { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--border); color: var(--text); text-decoration: none; min-width: 190px; background: var(--surface); }
.journey-list a:hover { border-color: var(--primary); }
.journey-list li.current a { border-color: var(--primary); background: var(--primary-soft); }
.j-no { font-weight: 800; color: var(--muted); }
.j-body { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.j-body small { color: var(--muted); font-size: .75rem; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs > button, .tabs > a {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; margin-bottom: -2px;
  background: none; border: 0; border-bottom: 3px solid transparent; color: var(--text-2); font-weight: 600; text-decoration: none !important; white-space: nowrap;
}
.tabs > button:hover, .tabs > a:hover { color: var(--text); }
.tabs > [aria-selected=true], .tabs > a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { background: var(--surface); border: 1px solid var(--border); }
.js .pane[hidden] { display: none; }

/* Detail facts */
.detail-cols { display: grid; gap: 16px; }
@media (min-width: 900px) { .detail-cols { grid-template-columns: 1fr 1fr; align-items: start; } }
.info-card .card-title { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.facts { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.fact dt { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.fact dd { margin: 0; font-size: 1rem; word-break: break-word; }
.facts.compact { gap: 6px; margin: 10px 0; }
.facts.compact .fact { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.facts.compact dt { margin: 2px 0 0; }
.facts.compact dd { font-size: .9375rem; }
.not-filled { margin-top: 12px; }

/* Device case history */
.history { display: flex; flex-direction: column; gap: 0; }
.history > li { display: block; }
.h-case { padding: 14px 16px; }
.h-case .h-head { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none !important; flex-wrap: wrap; padding: 0; }
.h-no { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; flex-shrink: 0; }
.h-title { display: flex; flex-direction: column; flex: 1; min-width: 140px; }
.h-title small { color: var(--muted); }
.h-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.history > li.h-gap { grid-column: auto; display: flex; align-items: center; gap: 6px; padding: 10px 0 10px 28px; margin-left: 19px; border-left: 2px dashed var(--border-strong); color: var(--muted); font-size: .8125rem; font-weight: 600; }
.history > li.h-gap .icon { width: 14px; height: 14px; }
.history > li.h-gap.warn { color: var(--wait); border-left-color: var(--wait); }
.history > li::before { display: none !important; }

/* Audit log */
.audit { list-style: none; margin: 0; padding: 0; }
.audit > li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.audit > li:first-child { border-top: 0; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: .8125rem; font-weight: 800; }
.audit-note .avatar { background: var(--wait-bg); color: var(--wait); }
.audit-status .avatar { background: var(--done-bg); color: var(--done); }
.audit-record_deleted .avatar, .audit-attachment_deleted .avatar { background: var(--bad-bg); color: var(--bad); }
.audit-body { min-width: 0; }
.audit-line { line-height: 1.4; }
.audit-line time { display: block; font-size: .8125rem; color: var(--muted); }
@media (min-width: 640px) { .audit-line time { display: inline; margin-left: 8px; } }
.audit-details { margin-top: 4px; color: var(--text-2); font-size: .9375rem; word-break: break-word; }
.note-text { margin-top: 6px; padding: 10px 12px; background: var(--wait-bg); border-radius: 0 10px 10px 10px; white-space: normal; }
.diff { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.diff li { display: grid; gap: 2px; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; font-size: .875rem; }
@media (min-width: 640px) { .diff li { grid-template-columns: 170px 1fr; gap: 12px; } }
.diff-f { font-weight: 700; color: var(--text-2); }
.diff-v { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; word-break: break-word; }
.diff del { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1px; }
.diff ins { color: var(--done); text-decoration: none; font-weight: 600; }
.diff-arrow { color: var(--muted); }
.note-form { display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.note-form label { font-size: .875rem; font-weight: 600; color: var(--text-2); }
.note-actions { display: flex; justify-content: flex-end; }

/* Case list */
.type-tabs { margin-bottom: 12px; }
.filter-top { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.filter-q { flex: 1 1 280px; }
.filter-more summary { list-style: none; gap: 6px; }
.filter-more summary::-webkit-details-marker { display: none; }
.filter-more summary .icon { width: 16px; height: 16px; transition: transform .15s; }
.filter-more[open] summary .icon { transform: rotate(90deg); }
.filter-more .filter-actions { margin-top: 12px; }
.row-tags { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-left: 6px; }
.row-tags .icon { width: 14px; height: 14px; vertical-align: -2px; }
.rec-table td:first-child { box-shadow: inset 4px 0 0 var(--tc, transparent); }
.rec-table tr.row-teal { --tc: var(--c-teal); } .rec-table tr.row-violet { --tc: var(--c-violet); } .rec-table tr.row-amber { --tc: var(--c-amber); }
.rec-table tr.row-blue { --tc: var(--c-blue); } .rec-table tr.row-rose { --tc: var(--c-rose); } .rec-table tr.row-slate { --tc: var(--c-slate); }
@media (max-width: 767px) {
  .rec-table tr { box-shadow: inset 4px 0 0 var(--tc, transparent); }
  .rec-table td:first-child { box-shadow: none; }
}

/* Settings */
.color-row { display: flex; gap: 8px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; position: relative; }
.swatch input { position: absolute; opacity: 0; }
.swatch:has(input:checked) { border-color: var(--text); }
.swatch:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.sw-teal { background: var(--c-teal); } .sw-violet { background: var(--c-violet); } .sw-amber { background: var(--c-amber); }
.sw-blue { background: var(--c-blue); } .sw-rose { background: var(--c-rose); } .sw-slate { background: var(--c-slate); }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { font-size: .875rem; font-weight: 600; color: var(--text-2); margin-bottom: 2px; padding: 0; }
.edit-pop .field label { font-size: .8125rem; }
.back { margin-bottom: 4px; }

[hidden] { display: none !important; }
.snapshot { margin: 8px 0 0; display: grid; grid-template-columns: 1fr; gap: 4px 16px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: .875rem; }
@media (min-width: 640px) { .snapshot { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.snapshot > div { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
.snapshot dt { color: var(--muted); font-weight: 600; }
.snapshot dd { margin: 0; word-break: break-word; }
@media (max-width: 639px) {
  .sp-list { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .sp-list::-webkit-scrollbar { display: none; }
  .sp { flex: 0 0 auto; scroll-snap-align: start; }
  .hero { padding: 16px; }
  .hero-top { align-items: flex-start; }
}

/* Devices list */
@media (min-width: 768px) { .kpis-4 { grid-template-columns: repeat(4, 1fr); } }
.kpi-active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary), var(--shadow); }
.kpi-active .kpi-label { color: var(--primary); }
.list-count { margin: -4px 0 8px; }
.dev-table td { vertical-align: top; }
.dev-table td > * + * { margin-top: 3px; }
.dev-table td { line-height: 1.35; }
.dev-table td:not(.issue-cell) > span, .dev-table td > div { display: block; }
.dev-id { display: flex; flex-direction: column; gap: 2px; color: var(--text); text-decoration: none !important; }
.dev-id:hover .strong { color: var(--primary); }
.idline { display: flex; gap: 6px; align-items: baseline; font-size: .875rem; }
.idline > span:first-child { font-size: .6875rem; font-weight: 700; color: var(--muted); min-width: 28px; }
.cell-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.issue-cell { max-width: 260px; font-size: .875rem; }
.issue-cell > span { display: block; }
.issue-cell > * + * { margin-top: 4px; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag { display: inline-block !important; font-size: .75rem; font-weight: 600; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.text-open { color: var(--open); font-weight: 600; }
.people { min-width: 150px; }
.people span { display: block; font-size: .875rem; white-space: nowrap; }
.people span + span { margin-top: 6px; }
.people small { display: block; font-size: .6875rem; font-weight: 700; color: var(--muted); line-height: 1.2; }
@media (max-width: 767px) { .people span { display: flex; gap: 6px; align-items: baseline; } .people span + span { margin-top: 0; } .people small { display: inline; } }
.act-who { display: flex !important; align-items: center; gap: 6px; font-weight: 600; font-size: .875rem; }
.avatar.sm { width: 24px; height: 24px; font-size: .625rem; flex-shrink: 0; }
.dev-table .badge .icon { width: 12px; height: 12px; }
.dev-table .icon { width: 14px; height: 14px; vertical-align: -2px; }
.dev-table tr { --tc: transparent; }
.dev-table td:first-child { box-shadow: inset 4px 0 0 var(--tc); }
.dev-table tr.row-teal { --tc: var(--c-teal); } .dev-table tr.row-violet { --tc: var(--c-violet); } .dev-table tr.row-amber { --tc: var(--c-amber); }
.dev-table tr.row-blue { --tc: var(--c-blue); } .dev-table tr.row-rose { --tc: var(--c-rose); } .dev-table tr.row-slate { --tc: var(--c-slate); }
@media (max-width: 767px) {
  .dev-table tr { box-shadow: inset 4px 0 0 var(--tc); padding: 14px 14px 14px 18px !important; }
  .dev-table td:first-child { box-shadow: none; }
  .dev-table td, .dev-table td:first-child { display: flex !important; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 3px 0 !important; }
  .dev-table td[data-label]::before { display: none !important; }
  .dev-table td > *, .dev-table td > * + * { margin: 0 !important; flex: 0 1 auto !important; }
  .dev-table .dev-id { flex-direction: row; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; }
  .dev-table .dev-id .strong { width: 100%; font-size: 1.0625rem; }
  .dev-table td[data-label="Last case"] { padding-top: 8px !important; }
  .dev-table .cell-tags { display: flex; }
  .issue-cell { max-width: none; }
  .issue-cell .clamp-2 { width: 100%; }
  .people { min-width: 0; }
  .people span { display: inline-flex !important; gap: 4px; }
  .people small { display: inline !important; }
  .dev-table td[data-label="Last activity"] { padding-top: 8px !important; margin-top: 6px; border-top: 1px solid var(--border) !important; }
}
}

/* Diagnostic reports */
.report-card { margin-top: 16px; }
.report + .report { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.report-name { display: flex; flex-direction: column; min-width: 0; word-break: break-all; }
.report-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.report-actions .badge .icon { width: 12px; height: 12px; }
.report-preview { margin-top: 10px; }
.report-preview summary { cursor: pointer; font-weight: 600; font-size: .875rem; color: var(--primary); min-height: 36px; display: flex; align-items: center; }
.report-text { margin: 8px 0 0; max-height: 480px; overflow: auto; padding: 12px; background: #0f1115; color: #d7dbe3; border-radius: 10px; font: 12.5px/1.5 var(--mono); white-space: pre; }
.report-chip { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.report-chip a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: .875rem; }
.report-chip .icon { color: var(--muted); }
.upload-report { min-height: 64px; }
span.label { font-size: .875rem; font-weight: 600; color: var(--text-2); }
.file-list .tag { margin-left: 4px; }

/* Issue column: one short line, full text on hover */
.issue-text { display: block; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .875rem; color: var(--text); }
@media (max-width: 767px) { .issue-text { max-width: 100%; } }

/* Pager (JS swaps rows in place) */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.card > .pager { margin: 0; }
section.card[data-paged] > .pager { margin: 8px -16px -16px; border-radius: 0 0 var(--radius) var(--radius); }
.pager-info { font-size: .875rem; color: var(--text-2); }
.pager-pages { display: flex; align-items: center; gap: 4px; }
.pg { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; border-radius: 10px; font-weight: 600; font-size: .9375rem; color: var(--text-2); text-decoration: none !important; font-variant-numeric: tabular-nums; }
a.pg:hover { background: var(--surface-2); color: var(--text); }
.pg.current { background: var(--primary); color: var(--on-primary); }
span.pg-nav { opacity: .35; }
.pg .icon { width: 18px; height: 18px; }
.pg-gap { color: var(--muted); padding: 0 2px; }
.pager-per { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--text-2); }
.pager-per select { width: auto !important; min-height: 36px !important; padding: 4px 32px 4px 10px !important; }
[data-paged] { position: relative; }
[data-paged].is-loading [data-paged-body] { opacity: .45; transition: opacity .15s; }
[data-paged].is-loading::after { content: ""; position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; margin: -14px; border: 3px solid var(--primary); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@media (max-width: 639px) { .pager { justify-content: center; } .pager-info { width: 100%; text-align: center; } }

/* Reports */
.report-section { margin-bottom: 16px; }
.rt-wrap { overflow-x: auto; margin: 0 -16px; }
.rt-wrap .table { min-width: 100%; }
.rt td { white-space: nowrap; }
.rt th { white-space: normal; vertical-align: bottom; line-height: 1.25; min-width: 64px; }
.rt th:first-child { min-width: 120px; }
.rt td:first-child, .rt th:first-child { padding-left: 16px; }
.rt td:last-child, .rt th:last-child { padding-right: 16px; }
.rt-text { display: inline-block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.rt-note { margin-top: 10px; }
.obar { display: flex; gap: 2px; width: 140px; height: 10px; border-radius: 4px; overflow: hidden; background: var(--surface); vertical-align: middle; }
.obar > span { display: block; min-width: 3px; }
.ob-good { background: var(--done); } .ob-bad { background: var(--bad); } .ob-open { background: var(--open); }
.ob-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8125rem; color: var(--text-2); margin: -4px 0 8px; }
.ob-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ob-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.meter { display: inline-block; width: 70px; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; vertical-align: middle; margin-right: 8px; }
.meter > span { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.meter-n { display: inline-block; min-width: 24px; text-align: right; }
.heat th[scope=row] { text-align: left; font-weight: 600; text-transform: none; letter-spacing: 0; font-size: .875rem; color: var(--text); background: transparent; }
.heat thead th { white-space: normal; min-width: 84px; vertical-align: bottom; }
.heat-cell { background: color-mix(in srgb, var(--series-1) var(--lvl), var(--surface)); font-variant-numeric: tabular-nums; font-weight: 600; border-left: 2px solid var(--surface); }
.heat-cell.on-dark { color: #fff; }
.report-grid .table.compact { margin: 0; }
@media (max-width: 767px) {
  .rt-wrap .table thead { display: table-header-group !important; }
  .rt-wrap .table, .rt-wrap .table tbody, .rt-wrap .table tr, .rt-wrap .table td { display: revert !important; }
  .rt-wrap .table td::before { display: none !important; }
}

/* ===== Edit dialog (Settings, Users) ===== */
.dlg { width: min(520px, calc(100vw - 32px)); max-height: min(86dvh, 760px); padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
.dlg[open] { display: flex; flex-direction: column; animation: pop .18s ease-out; }
.dlg::backdrop { background: rgba(10, 12, 16, .55); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px 14px 20px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { font-size: 1.0625rem; }
.dlg-body { padding: 18px 20px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.dlg-body form { display: flex; flex-direction: column; gap: 14px; }
.dlg-body form + form { border-top: 1px solid var(--border); padding-top: 16px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dlg-foot .btn-primary { min-width: 120px; }
@media (max-width: 639px) {
  .dlg { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92dvh; }
  .dlg[open] { animation: slideup .22s ease-out; }
  .dlg-body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .dlg-foot .btn { flex: 1; }
}

/* ===== Mobile pass ===== */
.rot90 { transform: rotate(90deg); }
.detail-grid > *, .report-grid > *, .detail-cols > *, .start-grid > * { min-width: 0; }
.filter-inline select, .filter-inline input { min-width: 0; max-width: 100%; }
.link-sm { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; margin: -12px -4px; }
.hero-facts dd a { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0; }

/* Combobox */
.combo { position: relative; }
.combo input { padding-right: 48px !important; }
.combo-btn { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 44px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); border-radius: 8px; }
.combo-list { position: absolute; z-index: 70; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 6px; list-style: none; max-height: 260px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); }
.combo-list li { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.combo-list li:hover, .combo-list li.active { background: var(--primary-soft); color: var(--primary); }
.combo-list li[aria-selected=true] { font-weight: 700; }
.combo-list li[aria-selected=true]::after { content: "✓"; margin-left: auto; color: var(--primary); }
.combo-list .combo-new { color: var(--primary); font-weight: 600; border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; margin-top: 4px; }

/* Filters collapsed on phones */
.filter-collapse > summary { display: flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; color: var(--text-2); cursor: pointer; list-style: none; }
.filter-collapse > summary::-webkit-details-marker { display: none; }
.filter-collapse > summary .icon { width: 16px; height: 16px; transition: transform .15s; }
.filter-collapse[open] > summary .icon { transform: rotate(90deg); }
@media (min-width: 768px) { .filter-collapse > summary { display: none; } }

@media (max-width: 1023px) {
  /* Form mode: no app chrome, a slim save bar pinned to the bottom */
  body.form-mode .bottom-nav, body.form-mode .topbar { display: none !important; }
  body.form-mode .main { padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.form-mode .action-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0;
    border-radius: 0; border-width: 1px 0 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); box-shadow: 0 -6px 20px rgba(16, 24, 40, .10);
  }
  body.form-mode .action-bar .btn-primary { max-width: none; }
}
.btn-cancel .icon { display: none; }
@media (max-width: 420px) {
  .action-bar .btn-cancel { flex: 0 0 44px !important; padding: 0 !important; }
  .action-bar .btn-cancel .lbl { display: none; }
  .action-bar .btn-cancel .icon { display: block; }
}

@media (max-width: 639px) {
  /* Case header: tags, title, facts, status — actions last, full width */
  .hero { display: flex; flex-direction: column; }
  .hero-top { display: contents; }
  .hero .head-actions { order: 10; margin-top: 14px; flex-wrap: nowrap; }
  .hero .head-actions > .btn-primary { flex: 1; }
  /* "…" menu opens as a bottom sheet */
  .menu[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: 140; background: rgba(10, 12, 16, .45); }
  .menu-pop { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 150; min-width: 0; border-radius: 18px 18px 0 0; padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); animation: slideup .2s ease-out; }
  .menu-pop a, .menu-pop button { min-height: 52px; font-size: 1rem; }
  .page-head .head-actions .btn { min-width: 44px; }
}
/* Save / Cancel always reachable in a long dialog */
.dlg-body form .dlg-foot { position: sticky; bottom: -20px; margin: 4px -20px -20px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); z-index: 1; }
@media (max-width: 639px) { .dlg-body form .dlg-foot { bottom: calc(-20px - env(safe-area-inset-bottom)); } }

/* Downloads */
.dl-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.dl-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.dl-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--done-bg); color: var(--done); flex-shrink: 0; }
.dl-ic .icon { width: 28px; height: 28px; }
.dl-main { flex: 1 1 260px; min-width: 0; }
.dl-main h2 { font-size: 1.125rem; word-break: break-all; }
.dl-link { margin-top: 6px; }
.dl-link code { font-size: .8125rem; }
.dl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dl-help ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
@media (max-width: 639px) { .dl-actions { width: 100%; } .dl-actions .btn { flex: 1; } }
