/* Toolbox Entertainment UI prototype: shared design system.
   House pattern from BDOsys (assets/css/app.css): CSS variables, self-hosted IBM Plex, no CDN, light and dark.
   Brand from the Toolbox company profile (Oct 2026): maroon mark #9D2A1A, amber headings, charcoal stone, slate blue.
   Themes: <html data-theme="light|dark"> forces one; no attribute follows the device. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Brand */
  --brand: #9d2a1a;          /* logo maroon */
  --brand-strong: #7f1f12;
  --brand-bright: #d7191e;   /* profile "WHO WE ARE" red */
  --amber: #e9a13b;          /* profile headings */
  --slate: #2e5a73;          /* profile textured blue */
  --stone: #141517;          /* profile charcoal */

  /* Surfaces (light) */
  --bg: #f5f3ef;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --surface-3: #f0ece6;
  --border: #e5dfd6;
  --border-strong: #cfc6b8;
  --text: #1b1917;
  --text-2: #3d3833;
  --muted: #6b635a;
  --faint: #776f66;         /* small helper text: 4.6:1 on the cream background, 5:1 on white */

  --primary: #9d2a1a;
  --primary-hover: #82200f;
  --primary-soft: #f7e8e4;
  --primary-text: #8a2314;
  --on-primary: #ffffff;
  --accent: #915708;         /* amber dark enough for 12 px text on the cream surfaces (4.8:1) */
  --accent-soft: #fbf0dc;

  --success: #1d7a4b; --success-soft: #e3f3ea;
  --warning: #935500; --warning-soft: #fdf1dc;
  --danger:  #c02a2f; --danger-soft:  #fbe6e6;
  --info:    #2e5a73; --info-soft:    #e3edf2;
  --violet:  #5b4bb7; --violet-soft:  #ece9fb;

  /* Office sidebar stays dark in both themes, like the profile's stone pages */
  --side-bg: #151619;
  --side-bg-2: #1d1f23;
  --side-text: #d9d4cd;
  --side-muted: #8d877f;
  --side-active: #ffffff;
  --side-active-bg: rgba(233, 161, 59, .12);
  --side-active-bar: #e9a13b;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 16, 12, .06), 0 1px 3px rgba(20, 16, 12, .05);
  --shadow: 0 4px 14px rgba(20, 16, 12, .08), 0 1px 3px rgba(20, 16, 12, .06);
  --shadow-lg: 0 18px 50px rgba(20, 16, 12, .18);
  --focus: 0 0 0 3px rgba(157, 42, 26, .28);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0f11; --surface: #16171a; --surface-2: #1b1c20; --surface-3: #23252a;
    --border: #2a2c32; --border-strong: #3a3d44;
    --text: #efebe5; --text-2: #d3cec7; --muted: #a39d95; --faint: #7e7870;
    --primary: #c4432c; --primary-hover: #d4513a; --primary-soft: rgba(196, 67, 44, .16); --primary-text: #f2917b; --on-primary: #ffffff;
    --accent: #f0b252; --accent-soft: rgba(240, 178, 82, .14);
    --success: #4cc38a; --success-soft: rgba(76, 195, 138, .14);
    --warning: #f0b252; --warning-soft: rgba(240, 178, 82, .14);
    --danger: #f2706b; --danger-soft: rgba(242, 112, 107, .15);
    --info: #79b3d1; --info-soft: rgba(121, 179, 209, .14);
    --violet: #a99cf2; --violet-soft: rgba(169, 156, 242, .15);
    --side-bg: #0b0c0e; --side-bg-2: #131417;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 6px 18px rgba(0, 0, 0, .45); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
    --focus: 0 0 0 3px rgba(242, 145, 123, .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f11; --surface: #16171a; --surface-2: #1b1c20; --surface-3: #23252a;
  --border: #2a2c32; --border-strong: #3a3d44;
  --text: #efebe5; --text-2: #d3cec7; --muted: #a39d95; --faint: #7e7870;
  --primary: #c4432c; --primary-hover: #d4513a; --primary-soft: rgba(196, 67, 44, .16); --primary-text: #f2917b; --on-primary: #ffffff;
  --accent: #f0b252; --accent-soft: rgba(240, 178, 82, .14);
  --success: #4cc38a; --success-soft: rgba(76, 195, 138, .14);
  --warning: #f0b252; --warning-soft: rgba(240, 178, 82, .14);
  --danger: #f2706b; --danger-soft: rgba(242, 112, 107, .15);
  --info: #79b3d1; --info-soft: rgba(121, 179, 209, .14);
  --violet: #a99cf2; --violet-soft: rgba(169, 156, 242, .15);
  --side-bg: #0b0c0e; --side-bg-2: #131417;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 6px 18px rgba(0, 0, 0, .45); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  --focus: 0 0 0 3px rgba(242, 145, 123, .35);
}

/* ---------- Reset and base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
/* A link inside running text is told apart by more than its colour (WCAG 1.4.1). */
p a:not(.btn), .hint a, .t2 a, .t-sub a, .sub a, .muted a, td a:not(.btn), .list-row .t2 a, .kv a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 10px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: background .15s var(--ease), border-color .15s var(--ease), transform .05s; white-space: nowrap; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.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; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-lg { min-height: 46px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 38px; padding: 0; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input-group { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.input-group:focus-within { border-color: var(--primary); box-shadow: var(--focus); }
.input-group .input { border: 0; box-shadow: none; padding: 8px 0; min-height: 38px; background: transparent; }
.input-group .ico { color: var(--muted); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }

/* ---------- Cards, panels ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.divider { height: 1px; background: var(--border); margin: 6px 0; }

/* KPI tiles */
.kpi { padding: 16px 18px; display: grid; gap: 6px; }
.kpi-label { font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 13px; color: var(--muted); }
.trend-up { color: var(--success); font-weight: 600; }
.trend-down { color: var(--danger); font-weight: 600; }
.kpi-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }

/* ---------- Badges, chips, avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.b-success { background: var(--success-soft); color: var(--success); }
.b-warning { background: var(--warning-soft); color: var(--warning); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-brand { background: var(--primary-soft); color: var(--primary-text); }
.b-violet { background: var(--violet-soft); color: var(--violet); }
.b-amber { background: var(--accent-soft); color: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-2); }
.chip:hover { background: var(--surface-3); }
.chip[aria-pressed="true"], .chip[aria-current="page"], .chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--slate); flex: none; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.avatars { display: flex; }
.avatars .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatars .avatar:first-child { margin-left: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-2); }
.table .t-main { font-weight: 600; color: var(--text); }
.table .t-sub { font-size: 12.5px; color: var(--muted); }
@media (max-width: 720px) {
  .table.responsive thead { display: none; }
  .table.responsive tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table.responsive td { padding: 0; border: 0; }
  .table.responsive td[data-hide-sm] { display: none; }
}

/* Progress */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.progress.ok > span { background: var(--success); }
.progress.warn > span { background: var(--warning); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 14px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--primary); }

/* Empty, alert */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty .ico { width: 36px; height: 36px; color: var(--faint); }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: 14px; }
.alert .ico { margin-top: 2px; }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: var(--text); }
.alert-warning .ico { color: var(--warning); }
.alert-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-danger .ico { color: var(--danger); }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert-info .ico { color: var(--info); }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-success .ico { color: var(--success); }

/* ---------- Toasts (BDOsys window.UI.toast pattern) ---------- */
.toasts { position: fixed; right: 16px; bottom: 76px; z-index: 90; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .25s var(--ease); }
.toast .ico { margin-top: 1px; }
.toast.success .ico { color: #6ee7a8; }
.toast.error .ico { color: #ff9b95; }
.toast.warning .ico { color: #ffcf7a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Modal / drawer ---------- */
dialog.modal { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); }
dialog.modal.wide { width: min(880px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(10, 8, 6, .55); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 20px; overflow: auto; max-height: calc(100vh - 200px); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------- Sync bar (BDOsys outbox bar pattern) ---------- */
.syncbar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 80; display: none; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 99px; background: var(--stone); color: #f2eee8; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: calc(100vw - 24px); }
.syncbar.show { display: flex; }
.syncbar .dot { width: 9px; height: 9px; border-radius: 50%; background: #4cc38a; flex: none; }
.syncbar.offline .dot { background: #f0b252; }
.syncbar.syncing .dot { background: #79b3d1; animation: pulse 1s infinite; }
.syncbar.error .dot { background: #f2706b; }
.syncbar .btn { min-height: 30px; border-radius: 99px; background: rgba(255,255,255,.1); border-color: transparent; color: #fff; font-size: 12.5px; }
.syncbar .btn:hover { background: rgba(255,255,255,.18); }
@keyframes pulse { 50% { opacity: .35; } }

.net-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 99px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
.net-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.net-pill.offline .dot { background: var(--warning); }
.net-pill.syncing .dot { background: var(--info); animation: pulse 1s infinite; }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Theme switch control */
.theme-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border); }
.theme-switch button { width: 30px; height: 26px; border-radius: 99px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Prototype ribbon */
.proto-ribbon { position: fixed; left: 12px; bottom: 14px; z-index: 70; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 99px; background: var(--surface); border: 1px dashed var(--border-strong); font-size: 12px; color: var(--muted); box-shadow: var(--shadow-sm); }
.proto-ribbon a { font-weight: 600; }
@media (max-width: 900px) { .proto-ribbon { display: none; } }

/* Document (quote / invoice preview), printable */
.doc { background: #fff; color: #1b1917; border-radius: 6px; box-shadow: var(--shadow); padding: 40px 44px; font-size: 13.5px; }
.doc h1 { font-size: 26px; letter-spacing: .04em; color: #9d2a1a; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 18px; border-bottom: 3px solid #9d2a1a; }
.doc .doc-logo { width: 150px; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 18px; }
.doc th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6b635a; border-bottom: 1px solid #ddd5ca; padding: 8px 6px; }
.doc td { padding: 9px 6px; border-bottom: 1px solid #eee8df; }
.doc .doc-total td { font-weight: 700; font-size: 15px; border-top: 2px solid #1b1917; border-bottom: 0; }
.doc .doc-muted { color: #6b635a; }
.doc .doc-group td { background: #f7f3ee; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #6b635a; }
@media (max-width: 720px) { .doc { padding: 22px 18px; } .doc .doc-head { flex-direction: column; } }

@media print {
  body { background: #fff; }
  .no-print, .syncbar, .toasts, .proto-ribbon { display: none !important; }
  .doc { box-shadow: none; padding: 0; }
}

/* The hidden attribute always wins over component display rules (.grid, .card, .alert, .field). */
[hidden] { display: none !important; }
/* Document titles are h2 so a page keeps one h1. */
.doc .doc-title { font-size: 26px; letter-spacing: .04em; color: #9d2a1a; margin: 0; }

/* Footer credit (house rule). */
.powered-by { font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.powered-by strong { font-weight: 600; color: var(--text-2); }
.powered-by:hover { text-decoration: none; }
.powered-by:hover strong { color: var(--primary-text); }
.side .powered-by, .sf-bottom .powered-by { color: #8d877f; }
.side .powered-by strong, .sf-bottom .powered-by strong { color: #d9d4cd; }
.side .powered-by:hover strong, .sf-bottom .powered-by:hover strong { color: #e9a13b; }
.powered-line { text-align: center; padding: 14px 0 4px; }

/* Small utilities used across pages: danger text, and a form that sits in a row of buttons. */
.text-danger { color: var(--danger); }
form.inline { display: inline-flex; margin: 0; }

/* ---------- Help: guided tours, the help drawer, the one-time tour offer (assets/js/help.js) ---------- */
.tb-tour { position: fixed; inset: 0; z-index: 2000; pointer-events: none; }
/* One thing at a time: the "Update available" notice waits while a tour is on screen. */
body:has(.tb-tour) #tb-update { display: none; }
.tb-tour.no-target { background: rgba(10, 11, 13, .62); pointer-events: auto; }
.tb-tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(10, 11, 13, .62), 0 0 0 3px var(--primary); pointer-events: none; transition: all .25s ease; }
.tb-tour-pop { position: fixed; pointer-events: auto; width: min(380px, calc(100vw - 24px)); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 16px 18px 14px; }
.tb-tour-pop h2 { font-size: 18px; margin: 6px 0 4px; line-height: 1.3; }
.tb-tour-text { color: var(--text-2); font-size: 14.5px; line-height: 1.55; }
.tb-tour-text p { margin: 0 0 8px; }
.tb-tour-text ul { margin: 0 0 8px; padding-left: 18px; }
.tb-tour-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tb-tour-count { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.tb-tour-x { background: none; border: 0; color: var(--muted); cursor: pointer; min-width: 32px; min-height: 32px; border-radius: 8px; }
.tb-tour-x:hover { color: var(--text); background: var(--surface-2); }
.tb-tour-dots { display: flex; gap: 5px; margin: 8px 0 12px; flex-wrap: wrap; }
.tb-tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.tb-tour-dots i.on { background: var(--primary); width: 18px; border-radius: 4px; }
.tb-tour-foot { display: flex; align-items: center; gap: 8px; }
.tb-tour-foot .spacer { flex: 1; }
.tb-tour-pop.sheet { left: 0; right: 0; bottom: 0; top: auto; width: 100%; border-radius: 18px 18px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.tb-tour-pop.sheet .btn { min-height: 44px; }
.tb-help { position: fixed; inset: 0; z-index: 1900; }
.tb-help-scrim { position: absolute; inset: 0; background: rgba(10, 11, 13, .45); }
.tb-help-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--surface); color: var(--text); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(16px); opacity: 0; transition: transform .2s ease, opacity .2s ease; }
.tb-help.open .tb-help-drawer { transform: none; opacity: 1; }
.tb-help-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 18px 10px; border-bottom: 1px solid var(--border); }
.tb-help-head h2 { font-size: 20px; margin: 2px 0 0; }
.tb-help-body { padding: 14px 18px 24px; overflow-y: auto; }
.tb-help-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; }
.tb-help-sum { color: var(--text-2); line-height: 1.55; margin: 0 0 12px; }
.tb-help-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tb-help-task { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface-2); }
.tb-help-task summary { cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: 14.5px; min-height: 24px; }
.tb-help-task ol { margin: 0; padding: 0 14px 12px 34px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.tb-help-task li { margin-bottom: 4px; }
.tb-help-links { display: grid; gap: 8px; }
.tb-help-keys { font-size: 12.5px; margin-top: 18px; }
.tb-help-offer { position: fixed; right: 16px; bottom: 16px; z-index: 1800; width: min(360px, calc(100vw - 32px)); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px 14px; display: grid; gap: 10px; }
.tb-help-offer strong { display: block; }
.tb-help-offer span { color: var(--text-2); font-size: 13.5px; }
.tb-help-offer .row { justify-content: flex-end; }
/* Phones: sit above the bottom tab bar (portal 66 px, office about 60 px). */
@media (max-width: 760px) { body .tb-help-offer { bottom: calc(80px + env(safe-area-inset-bottom)); right: 12px; } }
@media (prefers-reduced-motion: reduce) { .tb-tour-spot, .tb-help-drawer { transition: none; } }
@media print { .tb-tour, .tb-help, .tb-help-offer, [data-help-open] { display: none !important; } }
/* The guide pages */
.guide-toc { display: flex; flex-wrap: wrap; gap: 6px; }
.guide-topic { scroll-margin-top: 80px; }
.guide-topic h2 { display: flex; align-items: center; gap: 10px; }
.guide-steps { counter-reset: gs; list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.guide-steps > li { counter-increment: gs; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.guide-steps > li::before { content: counter(gs); width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft, var(--surface-2)); color: var(--primary); font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.guide-task { border-top: 1px solid var(--border); padding: 12px 0; }
.guide-task:first-child { border-top: 0; }
.guide-task h3 { font-size: 15.5px; margin: 0 0 8px; }
@media print { .guide-noprint, .side, .topbar, .bottomnav, .p-nav, .p-appbar { display: none !important; } .guide-topic { break-inside: avoid-page; } }
/* Phones: the fold-out "What is on the screen" on the guide pages is a 44 px touch target. */
@media (max-width: 899px) { details.guide-noprint > summary { padding: 11px 0; cursor: pointer; } }
