/* SaaFE-EOS renderer styles. Colours only through tokens (UI_FRAMEWORK §10 theme); no hex outside the token blocks.
   Layout rule (UI_FRAMEWORK §10.2): the page never scrolls; only grids and panes scroll inside a fixed frame.

   Three layers (after aimsa doc/design (MSA colour standard), user 2026-10-29):
     Layer 1 primitives  -> raw colour scales, never used by components
     Layer 2 semantics   -> --bg / --surface / --text / --primary / --ok … , one set per theme, same names
     Layer 3 components  -> everything below "Layout" uses Layer 2 only
   Light = "Sunshine" (cream + sunset orange), Dark = "Aurora" (night sky + ice cyan),
   Plain = white + light grey, orange only on buttons, links and icons (user 2026-10-31).
   Dark 2 = "Ember": warm charcoal + orange, soft off-white text at ~13:1 instead of Aurora's 16:1 glare, orange only on
   buttons, links and active states (customer feedback 2026-11-03: Aurora tires the eyes). */

/* ---- Layer 1: primitives ---------------------------------------------------------------------------- */
:root {
  --ice-50: #ecfeff; --ice-100: #cffafe; --ice-200: #a5f3fc; --ice-300: #67e8f9; --ice-400: #22d3ee;
  --ice-500: #06b6d4; --ice-600: #0891b2; --ice-700: #0e7490; --ice-800: #155e75; --ice-900: #164e63;
  --sun-50: #fff7ed; --sun-100: #ffedd5; --sun-200: #fed7aa; --sun-300: #fdba74; --sun-400: #fb923c;
  --sun-500: #f97316; --sun-600: #ea580c; --sun-700: #c2410c; --sun-800: #9a3412; --sun-900: #7c2d12;
  --night-100: #d8eef9; --night-200: #8aa0b8; --night-300: #6b87a4; --night-400: #2c5070; --night-500: #1f3a52;
  --night-600: #16314a; --night-700: #122236; --night-800: #0a1828; --night-900: #050b1a;
  --char-50: #e6e1da; --char-100: #aaa29a; --char-200: #8a827a; --char-300: #7a7066; --char-400: #514940;
  --char-500: #3d3731; --char-600: #2f2a26; --char-700: #2a2622; --char-750: #34302b; --char-800: #1e1b18; --char-900: #141210;
  --cream-50: #fefaf3; --cream-100: #fef5e7; --cream-200: #fbeacc; --cream-300: #f3e6c6; --cream-400: #e9d9b8;
  --slate-50: #f8fafc; --slate-100: #f1f5f9; --slate-200: #e2e8f0; --slate-300: #cbd5e1; --slate-400: #94a3b8; --slate-500: #64748b; --slate-600: #475569; --slate-700: #334155;
  --slate-800: #1e293b; --slate-900: #0f172a;
  --emerald-400: #34d399; --emerald-600: #059669; --emerald-700: #047857;
  --amber-400: #fbbf24; --amber-600: #d97706; --amber-700: #b45309;
  --red-400: #f87171; --red-600: #dc2626; --red-700: #b91c1c;
  --sky-400: #38bdf8; --sky-600: #0284c7; --sky-700: #0369a1;
  --white: #ffffff;

  /* geometry (theme independent) */
  --radius: 6px;
  --radius-lg: 10px;
  --topbar-h: 40px;
  --row-h: 24px;
  --input-h: 22px;
  --label-w: 104px;
  /* Latin first, then the CJK font for the interface language (<html lang>, i18n.js): Simplified Chinese in Microsoft
     YaHei (user 2026-11-08), also for Chinese data under the English interface; Traditional in JhengHei; Japanese in
     Yu Gothic / Meiryo so kanji do not take Chinese glyph shapes. */
  --font-latin: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans";
  --font: var(--font-latin), "Microsoft YaHei", "PingFang SC", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, "Cascadia Code", SFMono-Regular, Menlo, Consolas, monospace;
}
:root:lang(zh-Hant) { --font: var(--font-latin), "Microsoft JhengHei", "PingFang TC", "Microsoft YaHei", sans-serif; }
:root:lang(ja) { --font: var(--font-latin), "Yu Gothic UI", "Yu Gothic", Meiryo, "Hiragino Sans", "Microsoft YaHei", sans-serif; }

/* ---- Layer 2: semantics — Light "Sunshine" (default) -------------------------------------------------- */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: var(--cream-50);            /* page */
  --surface: var(--white);          /* cards, panes, grids */
  --surface-2: var(--cream-100);    /* inputs, table head, hover areas */
  --surface-3: var(--cream-200);
  --text: var(--slate-800);
  --text-strong: var(--slate-900);
  --text-muted: var(--slate-600);
  --text-faint: var(--slate-500);
  --border: var(--cream-400);
  --border-soft: var(--cream-300);
  --border-strong: #dcc69d;
  --input-border: #9a8460;          /* edge of an editable input: ≥ 3:1 on surface and inputs (WCAG 1.4.11, L22) */
  --primary: var(--sun-600);        /* brand: buttons, links, active */
  --primary-strong: var(--sun-700);
  --primary-ink: var(--sun-700);     /* primary as text on a surface (4.5:1, WCAG 1.4.3) */
  --primary-soft: rgba(249, 115, 22, 0.10);
  --primary-text: var(--white);     /* text on primary */
  --heading: var(--sun-700);        /* section titles, grid headers */
  --link: var(--sun-700);
  --ok: var(--emerald-700);
  --ok-soft: rgba(5, 150, 105, 0.10);
  --warn: var(--amber-700);
  --warn-soft: rgba(217, 119, 6, 0.12);
  --bad: var(--red-700);
  --bad-soft: rgba(220, 38, 38, 0.09);
  --info: var(--sky-700);
  --info-soft: rgba(2, 132, 199, 0.10);
  --violet: #7e22ce;
  --violet-soft: rgba(126, 34, 206, 0.10);
  --focus-ring: 0 0 0 3px rgba(249, 115, 22, 0.28);
  --row-stripe: rgba(251, 234, 204, 0.30);
  --row-hover: rgba(249, 115, 22, 0.07);
  --badge-bg: var(--cream-200);
  --required-bg: #dbeafe;          /* required inputs: clear cool tint + left bar, readonly stays cream */
  --overlay: rgba(15, 23, 42, 0.35);
  --shadow: 0 1px 2px rgba(31, 41, 55, 0.06), 0 2px 8px rgba(31, 41, 55, 0.05);
  --shadow-lg: 0 12px 36px rgba(31, 41, 55, 0.18);
  --brand-gradient: linear-gradient(135deg, var(--sun-500), var(--sun-600));
}

/* ---- Layer 2: semantics — Dark "Aurora" ----------------------------------------------------------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--night-900);
  --surface: var(--night-800);
  --surface-2: var(--night-700);
  --surface-3: #18304a;
  --text: var(--night-100);
  --text-strong: var(--white);
  --text-muted: var(--night-200);
  --text-faint: var(--night-300);
  --border: var(--night-500);
  --border-soft: var(--night-600);
  --border-strong: var(--night-400);
  --input-border: #56789a;
  --primary: var(--ice-400);
  --primary-strong: var(--ice-500);
  --primary-ink: var(--primary);
  --primary-soft: rgba(34, 211, 238, 0.12);
  --primary-text: var(--night-900);
  --heading: var(--ice-400);
  --link: var(--ice-300);
  --ok: var(--ice-300);
  --ok-soft: rgba(103, 232, 249, 0.12);
  --warn: var(--amber-400);
  --warn-soft: rgba(251, 191, 36, 0.12);
  --bad: var(--red-400);
  --bad-soft: rgba(248, 113, 113, 0.12);
  --info: var(--sky-400);
  --info-soft: rgba(56, 189, 248, 0.12);
  --violet: #c084fc;
  --violet-soft: rgba(192, 132, 252, 0.14);
  --focus-ring: 0 0 0 3px rgba(34, 211, 238, 0.35);
  --row-stripe: rgba(18, 34, 54, 0.45);
  --row-hover: rgba(34, 211, 238, 0.07);
  --badge-bg: var(--night-700);
  --required-bg: #143a5c;
  --overlay: rgba(5, 11, 26, 0.75);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.6);
  --brand-gradient: linear-gradient(135deg, var(--ice-400), var(--ice-500));
}

/* ---- Layer 2: semantics — "Plain" (light; only what differs from Sunshine) -------------------------- */
:root[data-theme="plain"] {
  color-scheme: light;
  --bg: var(--white);
  --surface: var(--white);
  --surface-2: var(--slate-50);
  --surface-3: var(--slate-100);
  --border: var(--slate-200);
  --border-soft: var(--slate-100);
  --border-strong: var(--slate-300);
  --input-border: var(--slate-500);   /* ≥ 3:1 on white (WCAG 1.4.11, L22) */
  --heading: var(--slate-700);
  --row-stripe: rgba(241, 245, 249, 0.55);
  --row-hover: rgba(249, 115, 22, 0.05);
  --badge-bg: var(--slate-100);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);
  --brand-gradient: linear-gradient(135deg, var(--sun-600), var(--sun-600));
}

/* ---- Layer 2: semantics — Dark 2 "Ember" (warm charcoal + orange) ------------------------------------ */
:root[data-theme="dark2"] {
  color-scheme: dark;
  --bg: var(--char-900);
  --surface: var(--char-800);
  --surface-2: var(--char-700);
  --surface-3: var(--char-750);
  --text: var(--char-50);           /* 13:1 on surface: readable without halation */
  --text-strong: #f5f1eb;
  --text-muted: var(--char-100);
  --text-faint: var(--char-200);
  --border: var(--char-500);
  --border-soft: var(--char-600);
  --border-strong: var(--char-400);
  --input-border: var(--char-300);  /* ≥ 3:1 on inputs (WCAG 1.4.11) */
  --primary: var(--sun-400);
  --primary-ink: var(--primary);
  --primary-strong: var(--sun-300);
  --primary-soft: rgba(251, 146, 60, 0.14);
  --primary-text: #1a1006;          /* dark text on orange buttons, 8:1 */
  --heading: #f2c9a0;               /* soft apricot: section titles and grid headers without neon */
  --link: var(--sun-300);
  --ok: var(--emerald-400);
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warn: #facc15;                  /* yellow, kept apart from the orange primary */
  --warn-soft: rgba(250, 204, 21, 0.12);
  --bad: var(--red-400);
  --bad-soft: rgba(248, 113, 113, 0.13);
  --info: var(--sky-400);
  --info-soft: rgba(56, 189, 248, 0.12);
  --violet: #c084fc;
  --violet-soft: rgba(192, 132, 252, 0.14);
  --focus-ring: 0 0 0 3px rgba(251, 146, 60, 0.38);
  --row-stripe: rgba(255, 255, 255, 0.025);
  --row-hover: rgba(251, 146, 60, 0.08);
  --badge-bg: var(--char-700);
  --required-bg: #3a2a1a;          /* warm tint + left bar, distinct from readonly surface-2 */
  --overlay: rgba(10, 8, 6, 0.72);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.6);
  --brand-gradient: linear-gradient(135deg, var(--sun-400), var(--sun-500));
}

/* Older names kept as aliases of the semantics so existing rules and module CSS keep working. */
:root {
  --danger: var(--bad); --danger-soft: var(--bad-soft); --danger-text: var(--white);
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.04);     /* buttons */
  --shadow-up: 0 -2px 8px rgba(0, 0, 0, 0.06);    /* phone bottom bar */
  --band-0: rgba(250, 204, 21, 0.16); --band-1: rgba(56, 189, 248, 0.14);  /* Detail.band_by rows */
  --band-2: rgba(74, 222, 128, 0.16); --band-3: rgba(244, 114, 182, 0.13);
  --success: var(--ok); --success-soft: var(--ok-soft);
  --warning: var(--warn); --warning-soft: var(--warn-soft);
  --ring: var(--focus-ring); --focus: var(--primary);
  --muted: var(--text-muted); --accent: var(--primary);
}
:root[data-theme="dark"], :root[data-theme="dark2"] {
  --danger: var(--bad); --danger-soft: var(--bad-soft); --danger-text: var(--bg);
  --success: var(--ok); --success-soft: var(--ok-soft);
  --warning: var(--warn); --warning-soft: var(--warn-soft);
  --ring: var(--focus-ring); --focus: var(--primary);
  --muted: var(--text-muted); --accent: var(--primary);
}
/* Print is always light (UI_FRAMEWORK §10). */
@media print {
  :root, :root[data-theme="dark"], :root[data-theme="dark2"] { --bg: #ffffff; --surface: #ffffff; --surface-2: #ffffff; --text: #000000; }
}

/* Layout */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: var(--font); font-size: 12.5px; line-height: 1.35; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--text-faint); }

.app { display: flex; flex-direction: column; height: 100vh; }
.topbar { height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px 0 8px;
  background: var(--surface); border-bottom: 1px solid var(--border); z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.2px; color: var(--text); }
.brand::before { content: "S"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px;
  background: var(--primary); color: var(--primary-text); font-size: 13px; font-weight: 800; }
.brand:hover { text-decoration: none; }
/* the site's own icon (SAAFE_FAVICON / custom/branding) replaces the "S"; index.html adds .has-icon once it loads */
.brand-icon { display: none; }
.brand.has-icon .brand-icon { display: block; width: 22px; height: 22px; border-radius: 6px; object-fit: contain; }
.brand.has-icon::before { display: none; }
.module-badge { font-family: var(--mono); font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--badge-bg); color: var(--text-muted); white-space: nowrap; }
.spacer { flex: 1; }
.user-chip { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; }
.theme-switch select { height: 26px; padding: 0 6px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: 12px; }
.body { display: flex; flex: 1; min-height: 0; position: relative; }
/* In-app navigation (saafe.js): the next page renders hidden over the current one, then they cross-fade. */
.main.page-entering { position: absolute; inset: 0; visibility: hidden; pointer-events: none; }
.main.page-old { pointer-events: none; }
.main.page-leaving { position: absolute; inset: 0; pointer-events: none; animation: page-out 140ms ease-in forwards; }
.main.page-enter { animation: page-in 200ms cubic-bezier(0.2, 0.7, 0.3, 1); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes page-out { to { opacity: 0; } }
.nav-progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 6; pointer-events: none;
  background: var(--primary); transform-origin: left; transform: scaleX(0); opacity: 0; transition: opacity 0.2s; }
.nav-progress.on { opacity: 1; animation: nav-progress 1.5s cubic-bezier(0.1, 0.6, 0.3, 1) forwards; }
@keyframes nav-progress { from { transform: scaleX(0.05); } to { transform: scaleX(0.9); } }
@media (prefers-reduced-motion: reduce) {
  .main.page-enter, .main.page-leaving { animation-duration: 1ms; }
}
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 6px 10px 8px;
  overflow: hidden; }
.main > .toolbar, .main > .filters, .main > .pager, .main > .page-head { flex: none; }
.main > .table-wrap, .main > .list-body { flex: 1 1 auto; min-height: 0; }
/* List body = facet bar (left, EOS position) + table */
.list-body { display: flex; gap: 8px; min-height: 0; }
.list-body > .table-wrap { flex: 1 1 auto; min-width: 0; }
/* List + detail (ListPage.detail_pane): list column | splitter | form pane; each scrolls inside itself. */
.list-body.with-detail { gap: 0; }
.list-body.with-detail > .facet-bar { margin-right: 8px; }
.list-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; flex: 0 0 520px; }
.list-col > .table-wrap { flex: 1 1 auto; min-height: 0; }
.list-col > .pager { flex: none; }
.split-bar { flex: 0 0 9px; cursor: col-resize; position: relative; touch-action: none; }
.split-bar::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: var(--border); }
.split-bar:hover::after { width: 3px; left: 3px; background: var(--primary); }
.detail-pane { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.detail-form { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.detail-form > .page-head { flex: none; }
.detail-empty { margin: auto; color: var(--text-faint); }
/* Detail tab: the header form fills the tab; a last-row textarea takes the rest of the height. */
.detail-form > .pane { min-height: 0; }
.detail-form .record-summary .meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.detail-form .pane-body > .form-rows { min-height: 100%; border: none; border-radius: 0; box-shadow: none; padding: 6px 8px 8px; }
/* Compact list beside the pane: declared widths hold (long names end in "…"), the table never pushes prices out. */
.list-col table.grid { table-layout: fixed; }
.list-col table.grid th, .list-col table.grid td { padding: 0 6px; }
/* Numbers in the compact list: one size smaller, same-width digits, never cut to "…" (user 2026-10-31). */
.list-col table.grid td.num { font-size: 11.5px; font-variant-numeric: tabular-nums; text-overflow: clip; padding: 0 5px; }
table.grid tbody tr.selected, table.grid tbody tr.selected:hover { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.facet-bar { flex: 0 0 190px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); padding: 6px 8px 10px; font-size: 12px; box-shadow: var(--shadow); }
.facet-bar.collapsed { flex-basis: 30px; padding: 6px 4px; overflow: hidden; }
.facet-bar.collapsed .facet-group, .facet-bar.collapsed .facet-head span, .facet-bar.collapsed .facet-head .link-btn { display: none; }
.facet-head { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 2px; }
.facet-head .link-btn { margin-left: auto; border: none; background: none; color: var(--primary); cursor: pointer; font-size: 11px;
  text-transform: none; letter-spacing: 0; padding: 0; }
.facet-collapse { margin-left: auto; border: none; background: none; color: var(--text-faint); cursor: pointer; font-size: 13px; padding: 0 2px; }
.facet-head .link-btn + .facet-collapse { margin-left: 4px; }
.facet-collapse:hover { color: var(--text); }
.facet-title { font-size: 10.5px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--heading); margin: 9px 0 2px; }
.facet-value { display: flex; width: 100%; align-items: center; gap: 6px; border: none; background: transparent; padding: 2px 6px;
  border-radius: var(--radius); cursor: pointer; color: var(--text); text-align: left; font-size: 12px; line-height: 17px; }
.facet-value:hover { background: var(--row-hover); }
.facet-value.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.facet-value .lbl { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet-value .n { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.facet-value.on .n { color: var(--primary); }
.facet-more { display: block; border: none; background: transparent; color: var(--primary); cursor: pointer; font-size: 11px;
  padding: 2px 6px; }
.facet-more:hover { text-decoration: underline; }
table.grid th.tick, table.grid td.tick { width: 28px; padding: 0 6px; text-align: center; }
table.grid .tick input { margin: 0; vertical-align: middle; accent-color: var(--primary); }
.bulk-count { font-size: 12px; }
/* batch kit: notice above / instead of rows, tool-bar filters of a detail tab, checklist notes */
.list-notice { font-size: 12px; padding: 4px 6px; }
.pane-tools .detail-filter { display: flex; align-items: center; gap: 4px; margin: 0; }
.pane-tools .detail-filter .error:empty { display: none; }
.action-checklist .note { font-size: 11px; }
/* Status as coloured text in list cells (badges stay for form summaries) */
.st-text { font-weight: 600; }
.st-text.ok { color: var(--ok); }
.st-text.info { color: var(--info); }
.st-text.warn { color: var(--warn); }
.st-text.bad { color: var(--bad); }
.st-text.off { color: var(--text-faint); font-weight: 500; }
/* Search history chips (after the search box) */
.search-history { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; max-width: 520px; }
.chip-h { display: inline-flex; align-items: stretch; height: 22px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  overflow: hidden; font-size: 11.5px; }
.chip-h .term { border: none; background: transparent; padding: 0 2px 0 9px; cursor: pointer; color: var(--text-muted); max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-h .x { border: none; background: transparent; padding: 0 7px 0 4px; cursor: pointer; color: var(--text-faint); font-size: 13px; line-height: 1; }
.chip-h:hover { border-color: var(--primary); }
.chip-h .term:hover { color: var(--text); }
.chip-h .x:hover { color: var(--danger); }
.chip-h.on { border-color: var(--primary); background: var(--primary-soft); }
.chip-h.on .term { color: var(--primary); font-weight: 600; }
.recent-empty { font-size: 11.5px; padding: 6px 2px; }
/* My Recent dropdown (user 2026-10-31): under its toolbar button, placed by list.js placePopover() like Filters. */
.recent-menu { display: none; position: fixed; z-index: 40; width: 300px; max-width: calc(100vw - 16px); overflow: auto;
  padding: 6px 8px 8px; font-size: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.recent-menu.open { display: block; }
.recent-menu .facet-head { display: flex; align-items: center; }
.recent-menu .facet-head .link-btn { margin-left: auto; }
.recent-item { display: flex; align-items: center; gap: 4px; padding: 2px 4px 2px 6px; border-radius: var(--radius); }
.recent-item:hover { background: var(--row-hover); }
.recent-item a { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; color: var(--text); text-decoration: none; line-height: 1.25; }
.recent-item a b { font-family: var(--mono); font-size: 11.5px; color: var(--primary); font-weight: 600; }
.recent-item a .nm { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item .x { border: none; background: transparent; color: var(--text-faint); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; visibility: hidden; }
.recent-item:hover .x { visibility: visible; }
.recent-item .x:hover { color: var(--danger); }
/* Thumbnails in lists, Gallery tabs, lightbox */
table.grid td .thumb { height: 20px; width: auto; max-width: 56px; vertical-align: middle; border-radius: 3px; border: 1px solid var(--border);
  cursor: zoom-in; background: var(--surface-2); }
.thumb-n { font-size: 10.5px; color: var(--text-faint); margin-left: 4px; font-family: var(--mono); }
.gallery { display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 12px; }
.gallery figure { margin: 0; display: flex; flex-direction: column; gap: 3px; }
.gallery img { max-height: 200px; max-width: 360px; border: 1px solid var(--border); border-radius: var(--radius); cursor: zoom-in;
  background: var(--surface-2); }
.gallery figcaption { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.modal.lightbox { max-width: none; width: auto; max-height: none; padding: 10px 12px 12px; }
.lightbox-body img { display: block; max-width: 92vw; max-height: 82vh; cursor: zoom-out; border-radius: var(--radius); }
/* Home page: 9220 module package, static/home.css */

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; line-height: 1; font-weight: 500;
  white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.45; cursor: default; }
/* a dialog button whose request is still running (shell.js openModal): a small turning ring after the label */
.modal .btn.busy { cursor: progress; }
.modal .btn.busy::after { content: ""; width: 10px; height: 10px; margin-left: 6px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: btn-busy 0.8s linear infinite; }
@keyframes btn-busy { to { transform: rotate(360deg); } }
.btn-sm { height: 22px; padding: 0 8px; font-size: 12px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { filter: brightness(1.08); background: var(--primary); }
.btn-danger { background: var(--surface); border-color: var(--border-strong); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.icon-btn { border: none; background: transparent; cursor: pointer; font-size: 17px; padding: 4px 8px; color: var(--text-muted);
  border-radius: var(--radius); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 420px; display: flex; gap: 6px; }
.toolbar .search input { flex: 1; height: 26px; }
/* ListPage.status (user 2026-12-05): which outside service the list works with, a dot for whether it answers */
.page-status { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; margin-left: auto;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface); font-size: 12px; color: var(--text-muted);
  white-space: nowrap; cursor: default; }
.page-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex: none; }
.page-status.tone-ok .dot { background: var(--ok); }
.page-status.tone-warn .dot { background: var(--warn); }
.page-status.tone-error .dot { background: var(--bad); }
.page-status.tone-error { color: var(--bad); border-color: var(--bad); }
.page-status.on-phone { flex: none; padding: 0 6px; border: none; background: none; } /* phone: the dot only */
.page-status.on-phone .label { display: none; } /* the words stay in aria-label and title */

/* Inputs */
input[type="text"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="password"],
input[type="email"], select, textarea {
  width: 100%; height: var(--input-h); padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); transition: border-color 0.12s, box-shadow 0.12s; }
select { padding-right: 4px; }
textarea { height: auto; min-height: 44px; padding: 3px 6px; resize: vertical; line-height: 1.35; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input[readonly], textarea[readonly], select:disabled, .readonly input, .readonly select, .readonly textarea {
  background: var(--surface-2); color: var(--text-muted); border-color: var(--border); box-shadow: none; }
/* Required fields: tinted input as well as the red star (user 2026-10-29); readonly / locked ones stay as they are. */
.field.required:not(.readonly) input:not([readonly]), .field.required:not(.readonly) select:not(:disabled),
.field.required:not(.readonly) textarea:not([readonly]) { background: var(--required-bg); border-left: 3px solid var(--info); }
/* Numbers are typed, never stepped: no spinner anywhere (user 2026-10-29 header, 2026-11-03 everywhere — the arrows
   invite clicks); right aligned in the dense header. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0; }
.form-row input[type="number"] { text-align: right; padding-right: 5px; }
/* "$" before an amount, "%" after a percent, drawn inside the box (the input keeps its own border and states) */
.num-adorn { position: relative; display: block; min-width: 0; }
.num-adorn > input { text-align: right; }
.num-adorn.pre > input { padding-left: 16px; }
.num-adorn.post > input { padding-right: 18px; }
.num-sign { position: absolute; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 12px;
  pointer-events: none; }
.num-adorn.pre > .num-sign { left: 6px; }
.num-adorn.post > .num-sign { right: 6px; }
.field { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); align-items: center; column-gap: 8px;
  row-gap: 1px; }
.field label { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field.tall { align-items: start; }
.field.tall label { padding-top: 4px; }
.field .error { grid-column: 2; color: var(--danger); font-size: 11.5px; line-height: 1.2; }
.field .error:empty { display: none; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field.stacked { grid-template-columns: 1fr; row-gap: 3px; }
.field.stacked .error { grid-column: 1; }
.yesno { display: flex; align-items: center; gap: 8px; height: var(--input-h); }
.yesno input { width: 15px; height: 15px; margin: 0; accent-color: var(--primary); }
.lookup { position: relative; }
/* lookup_multi (user 2026-11-07): chips for every choice inside one box, all shown (the box grows a line if needed) */
.lookup-multi { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 3px; min-height: var(--input-h);
  padding: 1px 3px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: text; }
.lookup-multi:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.lookup-multi .chips { display: contents; }
.lookup-multi .chip { display: inline-flex; align-items: center; gap: 2px; height: 16px; padding: 0 3px 0 5px;
  border-radius: 3px; background: var(--surface-3); font-size: 11.5px; white-space: nowrap; }
.lookup-multi .chip.main { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.lookup-multi .chip-x { border: none; background: transparent; padding: 0 1px; cursor: pointer; color: var(--text-muted);
  font-size: 12px; line-height: 1; }
.lookup-multi .chip-x:hover { color: var(--bad); }
.lookup-multi input[type="text"] { flex: 1 1 24px; min-width: 24px; width: 24px; height: 18px; border: none; padding: 0 2px;
  box-shadow: none; background: transparent; }
.lookup-multi.readonly { background: var(--surface-2); cursor: default; }
.lookup-multi .options { right: auto; min-width: 220px; }
.lookup .options { position: absolute; top: 100%; left: 0; right: 0; z-index: 10; margin-top: 2px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 240px;
  overflow-y: auto; min-width: 260px; }
.lookup .options div { padding: 6px 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lookup .options div:hover { background: var(--row-hover); }
.lookup .options div.active { background: var(--row-hover); box-shadow: inset 2px 0 0 var(--primary); }
/* lookup_params: "Pick Agency first" while the source field is empty (not a choice) */
.lookup .options div.hint, .lookup .options div.hint:hover { color: var(--text-muted); cursor: default; background: transparent; }

/* Filters */
.filters { display: none; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.filters.open { display: grid; }
.filters .actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
/* Toolbar icon buttons (user 2026-10-31): square, label in the tooltip; a badge counts e.g. filters in effect. */
.btn-icon { position: relative; width: 26px; height: 26px; padding: 0; justify-content: center; color: var(--text-muted); }
.btn-icon:hover { color: var(--text); }

.btn-icon .ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; }
.btn-badge { position: absolute; top: -6px; right: -6px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px;
  background: var(--primary); color: var(--primary-text); font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; }
.btn-badge[hidden] { display: none; }
/* Filter panel floats under its button over the list (does not push it down), sized to its fields; Clear / Apply
   take the last cell. */
.filter-anchor { position: relative; display: inline-flex; }
/* position: fixed + left / top set by list.js placeFilters() when it opens: it stays inside the window however far
   right the button has moved (search-history chips). */
.filter-anchor .filters { position: fixed; z-index: 40; width: max-content; max-width: calc(100vw - 16px); overflow: auto;
  grid-template-columns: repeat(3, minmax(240px, 290px)); gap: 6px 16px; padding: 10px 12px; box-shadow: var(--shadow-lg); }
@media (max-width: 1000px) { .filter-anchor .filters { grid-template-columns: repeat(2, minmax(220px, 290px)); } }
.filter-anchor .filters .actions { grid-column: -2 / -1; align-self: end; justify-content: flex-end; gap: 8px; }
.filter-anchor .filters .actions .btn { height: 28px; padding: 0 14px; }
.filter-anchor .filters .actions .btn-apply { padding: 0 22px; font-weight: 600; }

/* Table */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
table.grid th, table.grid td { height: var(--row-h); padding: 0 8px; border-bottom: 1px solid var(--border); text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
table.grid th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); font-weight: 600; font-size: 11.5px;
  color: var(--text-muted); user-select: none; box-shadow: inset 0 -1px 0 var(--border); }
table.grid th.sortable { cursor: pointer; }
table.grid th.sortable:hover { color: var(--text); }
table.grid th .dir { color: var(--link); font-size: 10px; margin-left: 4px; }
table.grid tbody tr:nth-child(even) { background: var(--row-stripe); }
table.grid tbody tr:hover { background: var(--row-hover); }
/* Col.tone_field: a cell coloured by another field (ok / info / warn / bad / off) */
table.grid td.tone-ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
table.grid td.tone-warn { background: var(--warn-soft); }
table.grid td.tone-bad { background: var(--bad-soft); color: var(--danger); font-weight: 600; }
table.grid td.tone-info { background: var(--primary-soft); }
table.grid tbody tr.clickable { cursor: pointer; }
table.grid tbody tr:last-child td { border-bottom-color: transparent; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.center { text-align: center; }
table.grid tfoot td { font-weight: 600; background: var(--surface-2); }
/* Col format status_icon (user 2026-11-07): one coloured icon per status; the facet bar repeats it as the legend */
table.grid td.st-ico { text-align: center; padding: 0 2px; }
table.grid td.st-ico .ico, .facet-ico .ico { width: 15px; height: 15px; vertical-align: middle; fill: none; stroke: currentColor;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.facet-ico { display: inline-flex; width: 16px; flex: none; }
.st-ico.ok { color: var(--ok); }
.st-ico.info { color: var(--info); }
.st-ico.warn { color: var(--warn); }
.st-ico.bad { color: var(--bad); }
.st-ico.off { color: var(--text-faint); }
.st-ico .ico path[d^="M8 5.5"] { fill: currentColor; }
/* Col.copy (user 2026-11-07): hovering the cell shows a copy icon at its right end; it covers the text tail only */
table.grid td.copyable { position: relative; }
table.grid td .copy-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: none;
  width: 18px; height: 18px; padding: 0; border: 1px solid var(--border); border-radius: 4px; cursor: pointer;
  background: var(--surface); color: var(--text-muted); align-items: center; justify-content: center; }
table.grid td.copyable:hover .copy-btn { display: inline-flex; }
table.grid td .copy-btn:hover { color: var(--primary); border-color: var(--primary); }
table.grid td .copy-btn .ico { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
table.grid .row-actions { display: flex; gap: 4px; align-items: center; height: var(--row-h); }
table.grid tr.inline-edit td { padding: 2px 6px; overflow: visible; }
table.grid tr.inline-edit td.row-actions { padding-right: 10px; }
table.grid tr.inline-extra td { height: auto; padding: 4px 10px 8px; white-space: normal; overflow: visible; max-width: none;
  background: var(--surface-2); }
table.grid tr.inline-extra .field.tall textarea { min-height: 40px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
  background: var(--badge-bg); color: var(--text-muted); line-height: 1.5; }
.badge.ok { color: var(--success); background: var(--success-soft); }
.badge.warn { color: var(--warning); background: var(--warning-soft); }
.badge.off { color: var(--text-muted); background: var(--badge-bg); }
.pager { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12.5px; }
.pager select { width: auto; height: 24px; padding: 0 4px; }
.empty { padding: 18px; text-align: center; color: var(--text-muted); }

/* Form: header area in columns, details in a tab pane (UI_FRAMEWORK §10.2) */
.page-head { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.page-head .page-actions { display: flex; gap: 6px; }
/* FormPage.icon_actions: back arrow, title ... icon buttons at the right */
.page-head.icons .page-back:empty { display: none; }
.page-head.icons .page-actions { gap: 4px; }
.record-summary { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.save-state { font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.save-state.dirty { color: var(--warn); font-weight: 600; }
/* autosave (BASE_KIT_AUTOSAVE §3.4–§3.8): status + Undo, conflicts, fields edited in a dialog */
.save-state.autosave { display: inline-flex; align-items: center; gap: 4px; }
.save-state.bad { color: var(--bad); font-weight: 600; }
.save-state .btn-link { background: none; border: 0; padding: 0 2px; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
.save-state .btn-link:disabled { color: var(--text-faint); cursor: default; text-decoration: none; }
.save-state .autosave-undo { margin-left: 6px; }
.autosave-notice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0; padding: 6px 10px;
  border: 1px solid var(--warn); background: var(--warn-soft); border-radius: var(--radius); font-size: 13px; color: var(--text); }
.autosave-notice[hidden] { display: none; }
.has-conflict input, .has-conflict select, .has-conflict textarea { border-color: var(--warn); }
.conflict-box { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; padding: 4px 6px;
  background: var(--warn-soft); border-radius: var(--radius); font-size: 12px; }
.conflict-box .btn { min-height: 0; padding: 1px 8px; font-size: 12px; }
.dialog-edit input, .dialog-edit select, .dialog-edit textarea { cursor: pointer; }
.dialog-edit-btn { background: none; border: 0; padding: 0 4px; margin-left: 4px; color: var(--primary); cursor: pointer; font-size: 12px; }
.field-dialog { min-width: min(420px, 80vw); }
.field-dialog .dialog-note { margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.field-dialog .dialog-note.warn { color: var(--bad); }
.field-dialog .dialog-preview { margin-top: 8px; font-size: 12px; }
.field-dialog .dialog-preview-head { color: var(--text-muted); }
.field-dialog .dialog-preview ul { margin: 4px 0 0; padding-left: 18px; max-height: 160px; overflow: auto; }
.record-summary .meta { color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }
.form-columns { display: grid; gap: 6px; flex: 0 1 auto; min-height: 0; overflow: auto; align-items: start; }
.form-columns.cols-1 { grid-template-columns: 1fr; }
.form-columns.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-columns.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-columns.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-columns.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.form-column { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 5px 10px 7px; box-shadow: var(--shadow); }
.form-card h3 { margin: 0 0 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--text-faint); }
.form-grid { display: grid; gap: 3px 10px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-actions { display: flex; gap: 8px; }
/* Dense header rows (UI_FRAMEWORK §2 premise 4): EOS-style, label above the input, fixed widths, no cards */
.form-rows { flex: none; display: flex; flex-direction: column; gap: 3px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 3px 8px 5px; }
.form-row { display: flex; flex-wrap: wrap; align-items: start; gap: 0 8px; min-width: 0; width: 100%; }
/* Header fold (user 2026-10-31): orange arrow at the start of row 1; folded, only row 1 shows. */
.head-fold { flex: none; align-self: end; width: 16px; height: 22px; padding: 0; border: none; background: transparent;
  color: var(--primary); font-size: 18px; line-height: 22px; cursor: pointer; margin-right: -4px; }
.head-fold:hover { background: var(--primary-soft); border-radius: var(--radius); }
.form-rows.head-folded > :not(:first-child) { display: none; }
.form-row .field, .form-band-side .field { flex: 0 0 auto; grid-template-columns: 1fr; row-gap: 0; min-width: 0; }
.form-row .field label, .form-band-side .field label { font-size: 10.5px; line-height: 13px; color: var(--text-muted); }
.form-row .field.tall label, .form-band-side .field.tall label { padding-top: 0; }
.form-row .field .error, .form-band-side .field .error { grid-column: 1; }
.form-row .field textarea { height: 44px; min-height: 0; }
/* A band = two rows on the left + cells spanning both on the right (notes / remarks), textarea as tall as both. */
.form-band { display: flex; align-items: stretch; gap: 0 8px; min-width: 0; width: 100%; }
.form-band-rows { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.form-band-side { display: flex; align-items: stretch; gap: 0 8px; min-width: 0; }
.form-band-side .field { flex: 1 1 0; grid-template-rows: auto minmax(0, 1fr); }
.form-band-side .field textarea { height: 100%; min-height: 0; resize: none; }
.form-band-side .field { position: relative; }
/* Group break between header rows (Gap, UI_LAYOUT_GUIDE L3): extra space + hairline. */
.form-gap { height: 5px; border-bottom: 1px solid var(--border-soft); margin: 0 0 4px; }
.form-grid-rows .form-gap { margin: 0; align-self: center; height: 0; }
/* Grid mode (row_grid, L5): one grid for all rows, so columns line up; spanning cells (notes) fill their rows. */
.form-grid-rows { display: grid; column-gap: 8px; row-gap: 3px; align-items: start; }
.form-grid-rows .field { min-width: 0; grid-template-columns: 1fr; row-gap: 0; }
.form-grid-rows .field label { font-size: 10.5px; line-height: 13px; color: var(--text-muted); }
.form-grid-rows .field.tall label { padding-top: 0; }
.form-grid-rows .field .error { grid-column: 1; }
.form-grid-rows .field.span-rows { position: relative; align-self: stretch; grid-template-rows: auto minmax(0, 1fr); }
.form-grid-rows .field.span-rows textarea { height: 100%; min-height: 0; resize: none; }
.form-grid-rows input[type="number"] { text-align: right; padding-right: 5px; -moz-appearance: textfield; appearance: textfield; }
.form-grid-rows input[type="number"]::-webkit-inner-spin-button,
.form-grid-rows input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.form-grid-rows .yesno { height: var(--input-h); gap: 5px; }
.form-grid-rows select { padding-left: 5px; }
input::placeholder, textarea::placeholder { color: var(--text-faint); font-style: italic; }
.fold-cell { flex: 0 0 auto !important; min-width: 0 !important; }
.fold-toggle { height: var(--input-h); padding: 0 8px; border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: transparent; color: var(--text-muted); cursor: pointer; font-size: 11.5px; white-space: nowrap; }
.fold-toggle:hover { border-color: var(--primary); color: var(--text); }
.fold-toggle.has-values { color: var(--text); border-style: solid; }
.form-fold-row { padding-top: 1px; }
.btn-back { padding: 0 8px; color: var(--text-muted); }
/* Locked fields (def.field_locks): read-only look, dashed edge, click opens the action that changes them */
.field.locked input { border-style: dashed; cursor: pointer; }
.field.locked .lock-hint { color: var(--text-faint); font-size: 10px; margin-left: 4px; text-transform: none; }
.action-checklist { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 8px; }
.action-checklist label { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: var(--radius);
  font-size: 12.5px; cursor: pointer; }
.action-checklist label:hover { background: var(--row-hover); }
.action-checklist input { margin: 0; accent-color: var(--primary); }
.action-checklist .rows { margin-left: auto; color: var(--text-faint); font-family: var(--mono); font-size: 11px; }
.action-preview .hint { font-size: 11.5px; }
/* 24 × 24 px hit area (WCAG 2.5.8, L24), pulled up over the label line so it takes no height. */
.field .expand { position: absolute; top: -6px; right: -4px; width: 24px; height: 24px; display: flex; align-items: center;
  justify-content: center; border: none; background: transparent; color: var(--text-faint); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0; }
.field .expand:hover { color: var(--primary); }
textarea.big { width: 100%; min-height: 280px; resize: vertical; }
.form-row .yesno { height: var(--input-h); gap: 5px; }
.form-row select, .form-band-side select { padding-left: 5px; } /* dense cells are narrow: give the text the room */

.pane { flex: 1 1 0; min-height: 120px; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.pane-tabs { flex: none; display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); }
.pane-tabs button { height: 28px; border: none; background: transparent; padding: 0 10px; cursor: pointer;
  color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; }
.pane-tabs button:hover { color: var(--text); }
.pane-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.pane-tabs button:disabled { color: var(--text-faint); cursor: default; }
.pane-tabs .count { font-family: var(--mono); font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--badge-bg);
  color: var(--text-muted); line-height: 18px; }
.pane-tabs button.active .count { background: var(--primary-soft); color: var(--primary); }
.pane-tabs .pane-tools { margin-left: auto; display: flex; gap: 6px; padding: 0 2px; }
/* Tab icons (user 2026-11-15): icon + word; .compact (form.js createPane, row short of room) keeps the icon only */
.pane-tabs button { flex: none; white-space: nowrap; }
.pane-tabs .pane-tools { flex: none; white-space: nowrap; }
.pane-tabs button .ico { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.pane-tabs.compact button.has-icon .tab-text { display: none; }
.pane-tabs.compact button { padding: 0 8px; gap: 4px; }
.pane-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
.pane-body > table.grid { border: none; }
.pane-body .table-wrap { border: none; border-radius: 0; box-shadow: none; }
.pane-body .empty { padding: 20px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 12px 0 8px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.audit-diff { font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; color: var(--text-muted); line-height: 1.4; }
.audit-diff b { color: var(--text); font-weight: 500; }
.tag-picker { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.tag-group-title { font-size: 11px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-faint);
  margin-bottom: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px; border: 1px solid var(--border-strong);
  border-radius: 999px; background: var(--surface); cursor: pointer; user-select: none; font-size: 12.5px; }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 500; }
.chip.stale { border-style: dashed; }
.chip input { width: 13px; height: 13px; margin: 0; accent-color: var(--primary); }
.chip input:disabled { cursor: default; }
table.grid td.wrap { white-space: normal; max-width: none; height: auto; padding: 6px 10px; }

/* Misc */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow-lg); max-width: 420px; }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
.toast small { display: block; color: var(--text-muted); font-family: var(--mono); font-size: 11px; margin-top: 4px; }
.modal-backdrop { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: center;
  justify-content: center; z-index: 40; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); min-width: 320px;
  max-width: 720px; width: min(92vw, 720px); max-height: 85vh; overflow: auto; padding: 16px 20px; }
.modal h3 { margin: 0 0 12px; font-size: 15px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px 28px 24px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.login-card h1::before { content: "S"; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--primary); color: var(--primary-text); font-size: 16px; font-weight: 800; }
.login-card .sub { color: var(--text-muted); font-size: 13px; margin: -8px 0 4px; }
.login-card .field { grid-template-columns: 1fr; }
.login-card input { height: 34px; }
.login-card .btn { height: 34px; justify-content: center; }
.login-card .login-microsoft { height: 38px; text-decoration: none; font-size: 14px; }
.menu-who .menu-who-account { margin-top: 2px; white-space: nowrap; }
.menu-who .menu-who-account:empty { display: none; }
.login-card .login-password { display: flex; flex-direction: column; gap: 14px; }
.login-card .login-password[hidden] { display: none; }
.login-card .login-other { align-self: center; background: none; border: 0; padding: 0; color: var(--text-muted);
  font-size: 12px; cursor: pointer; text-decoration: underline; }
.error-box { color: var(--danger); font-size: 13px; }
.error-box:empty { display: none; }
.error-box:empty { display: none; }
.json { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; background: var(--surface-2);
  padding: 8px; border-radius: var(--radius); max-height: 200px; overflow: auto; }
.muted { color: var(--text-muted); }
@media (max-width: 900px) {
  html, body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .main { overflow: visible; }
  .form-columns.cols-2, .form-columns.cols-3, .form-columns.cols-4 { grid-template-columns: 1fr; }
  .form-grid.cols-2, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .pane { min-height: 320px; }
}
@media print {
  .topbar, .toolbar, .pager, .page-actions, .pane-tabs { display: none !important; }
}

/* Documents tab (DocumentsTab feature): generate panel + versions list */
.documents { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px; min-height: 0; }
.doc-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.doc-toolbar label { font-size: 12px; color: var(--muted); }
.doc-toolbar select { height: var(--input-h); width: auto; min-width: 120px; max-width: 320px; }
.doc-list { overflow: auto; min-height: 0; }
.doc-list tr.muted td { color: var(--muted); }
.doc-list .row-actions { white-space: nowrap; }

/* Action dialogs (Action.input_model): inputs on top, preview below */
.modal.action-dialog { min-width: 520px; max-width: 760px; }
.action-dialog .action-inputs { display: grid; grid-template-columns: 1fr; gap: 6px; }
.action-dialog .action-preview { margin-top: 10px; max-height: 320px; overflow: auto; font-size: 12px; }
.action-dialog .action-preview table.grid { margin-top: 6px; }
.action-dialog .action-preview .kv { display: grid; grid-template-columns: max-content 1fr; column-gap: 12px; row-gap: 2px; }
.action-dialog .action-preview .kv b { color: var(--muted); font-weight: 500; }
.action-dialog .action-preview .warn { color: var(--danger); }
/* Date slots (date_slots.js, 6460 Generate tours): tabs Pick dates / Paste; the boxes in two columns, each with its
   weekday and the preview's result (the tour code) beside it. */
.field.date-slots { display: block; }
.date-slots-tabs { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.date-slots-tabs label { margin-right: 8px; }
.date-slots-tabs .tab { border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  padding: 2px 10px; border-radius: 4px; font-size: 12px; cursor: pointer; }
.date-slots-tabs .tab.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.date-slots-grid { display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; gap: 3px 18px; margin-bottom: 4px; }
.date-slot { display: grid; grid-template-columns: 18px 132px 34px minmax(0, 1fr); align-items: center; column-gap: 6px; }
.date-slot .no { text-align: right; font-size: 11px; }
.date-slot .day { font-size: 11.5px; }
.date-slot .result { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-slot .result.muted { font-weight: 400; }
.date-slots-paste textarea { width: 100%; }
/* Shift dates (user 2026-10-31, second review): inputs on one line, each label beside its box; the dates now / new
   stay on top while the list scrolls; one line per order. The dialog takes most of the screen. */
.modal.action-dialog.wide { width: min(1100px, 94vw); max-width: none; }
.action-dialog.wide .action-inputs { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 18px; }
.action-dialog.wide .action-inputs .field { grid-template-columns: max-content auto; column-gap: 6px; }
.action-dialog.wide .action-inputs .field input[type=date] { width: 128px; }
.action-dialog.wide .action-inputs .field input[type=number] { width: 52px; }
.action-dialog.wide .action-inputs .field:last-child { flex: 1; min-width: 260px; grid-template-columns: max-content 1fr; }
.action-dialog.wide .action-inputs .field .error { width: 0; white-space: nowrap; } /* never widens the row */
.action-dialog.wide .action-preview { max-height: calc(86vh - 170px); overflow-x: hidden; }
.action-dialog .action-preview.stale { opacity: .45; pointer-events: none; }
.action-dialog .action-preview > .warn { margin: 6px 0; padding: 6px 8px; border-left: 3px solid var(--danger);
  background: var(--row-hover); }
table.shift-compare { position: sticky; top: 0; z-index: 1; background: var(--surface); border-collapse: collapse;
  margin-bottom: 6px; font-family: var(--mono); font-size: 12px; box-shadow: 0 1px 0 var(--border); }
.shift-compare th { font-family: var(--font); font-weight: 500; color: var(--text-muted); text-align: left; padding: 2px 14px 2px 0; }
.shift-compare td { padding: 2px 14px 2px 0; white-space: nowrap; color: var(--text-faint); }
.shift-compare td.lbl { font-family: var(--font); color: var(--text-muted); }
.shift-compare tr.new td { color: var(--text); }
.shift-compare tr.new td.changed { font-weight: 700; color: var(--primary); }
.shift-compare td .field { display: inline-grid; grid-template-columns: auto; vertical-align: middle; }
.shift-compare td .field label { display: none; }
.shift-compare td .field input[type=date] { width: 128px; }
.shift-compare td .field input[type=number] { width: 52px; }
.shift-compare td .field .error { width: 0; white-space: nowrap; font-family: var(--font); }
.shift-compare td .sub { margin-left: 6px; }
.shift-compare .delta { font-family: var(--font); font-weight: 600; padding: 1px 8px; border-radius: 10px;
  background: var(--surface-2); color: var(--primary); }
.action-checklist .checklist-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: 6px; }
.action-checklist .group-head { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.action-checklist .group-head > label { font-weight: 600; }
.action-checklist .group-head .rows { margin-left: 0; }
.action-checklist .group-head .fold { border: 0; background: none; cursor: pointer; padding: 0 4px; color: var(--text-muted); }
table.grid.shift-details { margin: 0; width: 100%; min-width: 0; table-layout: fixed; font-size: 12px; }
.shift-details td { padding: 2px 6px; vertical-align: top; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift-details col.tick { width: 26px; }
.shift-details col.item { width: 25%; }
/* "07-24 Fri – 07-25 Sat" in the mono font needs ~175 px */
.shift-details col.status { width: 196px; }
.shift-details col.now { width: 178px; }
.shift-details col.after { width: 192px; }
.shift-details td.status .badge { font-size: 10.5px; }
.shift-details td.status label.flag { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 0;
  font-size: 11px; color: var(--warning, var(--danger)); cursor: pointer; }
.shift-details td.now { color: var(--text-faint); font-family: var(--mono); }
.shift-details td.after { font-family: var(--mono); font-weight: 600; }
.shift-details td.more { color: var(--text-muted); font-size: 11px; white-space: normal; }
.shift-details td.more .note { font-size: 11px; }
.shift-details tr.off td { opacity: .45; }
.shift-details tr.off td.tick, .shift-details tr.off td.more { opacity: 1; }
.shift-details tr.off td.after { text-decoration: line-through; }

/* Orders tab (OrdersTab feature): EOS Hotel Order tab style, one block per order */
.orders { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px; min-height: 0; }
.order-list { display: flex; flex-direction: column; gap: 6px; }
/* Service / Land Order: filter bar at the left, it stays in view while the orders scroll (user 2026-11-08) */
.orders-split { display: flex; align-items: flex-start; gap: 8px; padding-left: 8px; min-height: 0; }
.orders-split > .orders { flex: 1 1 auto; min-width: 0; padding-left: 0; }
.orders-facets { flex: 0 0 170px; position: sticky; top: 6px; margin-top: 6px; max-height: calc(100vh - 220px); }
.order-block { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
/* Head: one row of values (user 2026-10-31), hotel on the left 60 % over the room lines, meal / order / memo /
   buttons on the right 40 % over the meals (user 2026-11-01: was 2/3 : 1/3, the meals were too narrow).
   `.order-cols` and `.order-lines-2` share the 3fr / 2fr split, gap and padding, so the head and the lines line up.
   The head is a darker band than the white lines under it. */
.order-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: 12px; padding: 0 8px; }
.order-head { align-items: center; min-height: 24px; background: var(--surface-3); border-bottom: 1px solid var(--border); }
/* Fixed columns (UX review 2026-10-29): every order's IN / OUT / hotel / amount / buttons sit in the same place, so
   21 orders can be scanned without re-finding each field. Only the hotel name and the memo flex. */
/* Left at 60 %: tighter gaps and cells so the hotel name keeps ~90 px at 1366 px (MM-DD needs 40, Cancel by 44). */
.oh-grid { display: grid; align-items: center; column-gap: 6px; min-width: 0; }
.oh-grid.left { grid-template-columns: 14px 50px 50px 22px 34px 62px minmax(80px, 1fr) 44px 56px 90px 70px 18px; }
.oh-grid.right { grid-template-columns: 54px 30px 50px 86px minmax(0, 1fr) auto; }
.oh-grid .oh-actions { justify-self: end; }
.oh-caret { border: none; background: transparent; color: var(--primary); font-weight: 700; cursor: pointer; padding: 0; height: 15px; width: 14px;
  font-size: 13px; line-height: 15px; text-align: left; }
.oh-caret:disabled { cursor: default; opacity: 0; }
/* Collapse / expand all in the filter bar: the same arrow one size larger, no frame (user 2026-10-31). */
.oh-caret.all { width: 22px; height: 26px; font-size: 18px; line-height: 26px; text-align: center; margin-left: 4px; }
.oh-caret.all:hover { background: var(--primary-soft); border-radius: var(--radius); }
.oh-cell { display: flex; flex-direction: column; min-width: 0; }
.oh-cell span { font-size: 12px; line-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oh-cell.hotel span { font-weight: 600; }
.oh-cell.ok span { color: var(--ok); font-weight: 600; }
.oh-cell.mono span { font-family: var(--mono); }
.oh-cell.num span { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.oh-cell.status > span { display: flex; align-items: center; height: 15px; }
.oh-cell .badge { padding: 0 7px; font-size: 11px; line-height: 15px; height: 15px; }
/* Status icon (user 2026-11-07), coloured like the status text */
.oh-cell.st-ico .ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.oh-cell.st-ico.ok { color: var(--ok); }
.oh-cell.st-ico.info { color: var(--info); }
.oh-cell.st-ico.warn { color: var(--warn); }
.oh-cell.st-ico.bad { color: var(--bad); }
.oh-cell.st-ico.off { color: var(--text-faint); }
/* Hotel order: head + lines on the left, the order total as a box at the right end of the whole order; a line
   between the rooms half and the meals half runs down through head and lines (user 2026-11-07). The line sits in
   the middle of the 12 px gap: 8 px padding + 3 / 5 of the width left after padding and gap + 6 px. */
.order-block.hotel { display: grid; grid-template-columns: minmax(0, 1fr) 96px; }
.ob-main { position: relative; min-width: 0; }
.ob-total { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 10px;
  border-left: 1px solid var(--border-strong); background: var(--surface-3); font-size: 13.5px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--text-strong); white-space: nowrap; }
.oh-cell .mark { height: 15px; min-width: 15px; vertical-align: top; }
.oh-actions { display: flex; gap: 4px; margin-left: auto; }
.oh-actions .btn { height: 22px; padding: 0 7px; font-size: 11.5px; }
.oh-actions .btn.more { padding: 0 6px; font-size: 14px; line-height: 1; }
.oh-actions .btn-icon { width: 24px; height: 22px; padding: 0; }
.more-wrap { position: relative; }
.more-wrap .menu { position: absolute; right: 0; top: calc(100% + 2px); z-index: 6; min-width: 160px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; }
.menu-item { border: none; background: transparent; text-align: left; padding: 5px 10px; border-radius: var(--radius);
  cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.menu-item:hover { background: var(--row-hover); }
.menu-item.danger { color: var(--danger); }
.oh-memo { flex-direction: row; gap: 8px; font-size: 11.5px; line-height: 15px; white-space: nowrap; overflow: hidden; }
.oh-memo-part { min-width: 0; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.oh-memo-part:only-child { flex: 1; }
.oh-memo-part:hover { text-decoration: underline; }
.memo-full { white-space: pre-wrap; font-size: 12.5px; line-height: 1.45; max-height: 60vh; overflow: auto; user-select: text; }
.oh-memo-part b { font-size: 10px; color: var(--text-faint); margin-right: 3px; }
.oh-memo-part.svc { color: var(--bad); }
/* Rooms on the left, meals / extras on the right, under the head's two halves; no column titles (user 2026-10-31). */
.order-lines-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: 12px; padding: 0 8px; align-items: start; }
.order-lines-2 .no-lines { padding: 5px 8px; color: var(--text-faint); font-size: 11.5px; }
.order-lines th, .order-lines td { height: 22px; font-size: 12px; padding: 0 4px; }
.order-lines th { color: var(--text-muted); }
.order-lines td.link { cursor: pointer; }
/* Hotel lines: the memo is the last column, wrapped and shown whole (user 2026-11-01); money is never cut. */
.order-lines td.memo-wrap { height: auto; white-space: pre-wrap; max-width: none; padding: 3px 4px; line-height: 15px;
  font-size: 11.5px; color: var(--text-muted); }
.order-lines td.num { padding: 0 3px; text-overflow: clip; font-variant-numeric: tabular-nums; }
.order-lines td.link:hover { text-decoration: underline; }
.order-block.collapsed .order-lines-2 { display: none; }
/* The line between rooms and meals runs through the lines only, not the one-row head (user 2026-11-07); it sits in the
   middle of the 12 px gap: 8 px padding + 3 / 5 of the width left after padding and gap + 6 px. */
.order-lines-2 { position: relative; }
.order-lines-2::after { content: ""; position: absolute; top: 0; bottom: 0; left: calc(8px + (100% - 28px) * 0.6 + 6px);
  border-left: 1px solid var(--border-strong); pointer-events: none; }
/* Quick tooltip of the hotel head (orders_tab.js quickTips): field name on the first line, the value below. */
.quick-tip { position: fixed; z-index: 50; max-width: 340px; padding: 5px 8px; border-radius: var(--radius);
  background: var(--text-strong); color: var(--surface); font-size: 12px; line-height: 1.4; white-space: pre-line;
  box-shadow: var(--shadow-lg); pointer-events: none; }
.quick-tip::first-line { font-weight: 700; }
.order-lines tbody tr:last-child td { border-bottom: none; }
.order-summary { margin-left: auto; font-size: 12px; }

/* Guest list as the printed rooming list (Detail layout "rooms", guest_rooms.js, user 2026-10-31): two columns, one
   block per room shaded in turn; the room (number, type, beds) on the left, its guests beside it. Names sit close
   and a size larger, the remark takes what is left on the right; the room number is light so the eye goes to the
   names. Inputs look like text until hovered or focused. */
.guest-rooms { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 20px; padding: 4px 8px 8px;
  align-items: start; }
.gr-col { min-width: 0; }
.gr-block { display: grid; grid-template-columns: 136px minmax(0, 1fr); column-gap: 6px; align-items: stretch; padding: 2px 0;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.gr-block.alt { background: var(--surface-3); }
.gr-guests { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.gr-guest { display: grid; column-gap: 4px; align-items: center; min-height: 23px;
  grid-template-columns: 22px 52px 112px 140px 40px minmax(60px, 1fr) 46px; }
.gr-head { position: sticky; top: 0; z-index: 1; background: var(--surface); border-bottom: 1.5px solid var(--text-muted);
  padding: 3px 0 2px; }
.gr-head span { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap; overflow: hidden; }
.gr-head .gr-guest { min-height: 0; }
.gr-head .gr-rm { justify-content: flex-start; gap: 18px; padding-left: 8px; }
.gr-head .gr-guest span:first-child { text-align: right; }
.gr-rm { display: flex; align-items: center; gap: 2px; position: relative; }
.gr-rm-no { width: 40px; display: flex; flex-direction: column; align-items: center; }
.gr-rm-no small { font-size: 10px; color: var(--text-faint); line-height: 11px; }
/* room type and beds side by side, so a one-guest room takes one line (user 2026-11-07: 15-20 rooms on a screen) */
.gr-room { width: 92px; display: flex; align-items: center; gap: 2px; }
.gr-room .gr-sel.occ { width: 40px; flex: none; }
.guest-rooms input.gr-in, .guest-rooms select.gr-sel { width: 100%; min-width: 0; height: 21px; padding: 0 3px; font-size: 12.5px;
  border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text-strong); box-shadow: none; }
.guest-rooms select.gr-sel { padding: 0 1px; appearance: none; -webkit-appearance: none; cursor: pointer; }
.guest-rooms input.gr-in:hover:not([readonly]), .guest-rooms select.gr-sel:hover:not(:disabled) { border-color: var(--input-border); }
.guest-rooms input.gr-in:focus, .guest-rooms select.gr-sel:focus { border-color: var(--primary); background: var(--surface);
  box-shadow: var(--focus-ring); }
.guest-rooms input.gr-in.rm { height: 26px; font-size: 18px; font-weight: 600; color: var(--text-faint); text-align: center; padding: 0;
  -moz-appearance: textfield; appearance: textfield; }
.guest-rooms input.gr-in.rm::-webkit-inner-spin-button, .guest-rooms input.gr-in.rm::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0; }
.guest-rooms input.gr-in.last, .guest-rooms input.gr-in.first { font-size: 13.5px; }
.guest-rooms input.gr-in.last { font-weight: 700; }
.guest-rooms select.gr-sel.occ { font-weight: 600; height: 19px; color: var(--text-muted); }
.guest-rooms select.gr-sel.beds { font-size: 11px; height: 17px; color: var(--text-faint); }
.guest-rooms input.gr-in.remark { color: var(--text-muted); }
/* a migrated rooming-list row: the whole room in one text across Last and First, read-only */
.guest-rooms input.gr-in.legacy { grid-column: span 2; font-weight: 600; color: var(--text-muted); }
.gr-seq { border: none; background: transparent; padding: 0; font-size: 11px; color: var(--text-faint); text-align: right;
  cursor: pointer; font-variant-numeric: tabular-nums; }
.gr-seq:hover { color: var(--link); text-decoration: underline; }
.gr-age { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.gr-hint { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; }
/* Row buttons: strike out / bring back and delete, faint until the room is hovered; "+" adds a guest to the room. */
.gr-acts { display: flex; justify-content: flex-end; gap: 1px; }
.gr-btn { border: none; background: transparent; padding: 0; width: 22px; height: 21px; color: var(--text-faint); cursor: pointer;
  border-radius: var(--radius); opacity: 0.45; display: inline-grid; place-items: center; }
.gr-block:hover .gr-btn { opacity: 1; }
.gr-btn:hover { color: var(--primary); background: var(--primary-soft); }
.gr-btn.del:hover { color: var(--bad); background: var(--bad-soft); }
.gr-btn.add { position: absolute; left: 0; bottom: 0; width: 18px; height: 18px; }
.gr-btn .ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; }
/* Corrections for the hotel: a removed guest is struck through, a new one highlighted. */
.gr-guest.off input.gr-in, .gr-guest.off .gr-age { text-decoration: line-through; text-decoration-color: var(--bad);
  color: var(--text-faint); }
.gr-guest.off .gr-btn.restore { opacity: 1; color: var(--primary); }
.gr-guest.new { background: var(--ok-soft); border-radius: var(--radius); box-shadow: inset 3px 0 0 var(--ok); }
.gr-guest.new input.gr-in.last, .gr-guest.new input.gr-in.first { color: var(--ok); }


/* ---- Layer 3 refresh (aimsa recipes, 2026-10-29) ------------------------------------------------------ */
html, body { background: var(--bg); width: 100%; }
a { color: var(--link); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.brand::before { background: var(--brand-gradient); color: var(--primary-text); }
.brand { color: var(--text-strong); }
.module-badge { background: var(--primary-soft); color: var(--heading); border: 1px solid var(--border-soft); }
/* F2 Search (quick_open.js): where the page name used to be */
.quick-open-btn { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 4px; margin: 0 6px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-muted);
  font: inherit; font-size: 12px; cursor: pointer; }
.quick-open-btn:hover { border-color: var(--primary); color: var(--text); }
.quick-open-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.quick-open-btn kbd, .quick-open-hint kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-strong); }
.modal.quick-open-modal { align-self: flex-start; margin-top: 12vh; width: min(560px, 92vw); max-width: none; }
.quick-open { display: flex; flex-direction: column; gap: 6px; }
.quick-open-input { height: 32px; padding: 0 10px; border: 1px solid var(--input-border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.quick-open-input:focus { outline: none; box-shadow: var(--focus-ring); }
.quick-open-list { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; }
.quick-open-item { display: flex; align-items: center; gap: 10px; min-height: 28px; padding: 3px 8px; border-radius: var(--radius);
  cursor: pointer; }
.quick-open-item code { flex: 0 0 auto; min-width: 40px; font-family: var(--mono); color: var(--text-muted); }
.quick-open-item .qo-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-open-item .qo-group { font-size: 12px; color: var(--text-muted); }
.quick-open-item.active { background: var(--primary-soft); }
.quick-open-item.active code { color: var(--primary-strong); }
.quick-open-none { padding: 12px 8px; color: var(--text-muted); }
.quick-open-hint { margin: 0; font-size: 12px; color: var(--text-muted); }
.btn { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-xs); }
.btn:hover { border-color: var(--primary); background: var(--row-hover); }
.btn-primary { background: var(--brand-gradient); border-color: transparent; color: var(--primary-text); font-weight: 600; }
.btn-primary:hover { background: var(--brand-gradient); filter: brightness(1.08); border-color: transparent; }
.btn-danger { color: var(--bad); border-color: var(--border); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
input[type="text"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="password"],
input[type="email"], select, textarea { background: var(--surface-2); border-color: var(--input-border); color: var(--text); }
input:hover, select:hover, textarea:hover { border-color: var(--text-muted); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
input[readonly], textarea[readonly], select:disabled, .readonly input, .readonly select, .readonly textarea {
  background: transparent; border-style: dashed; border-color: var(--border-strong); color: var(--text-muted); }
.field label, .form-row .field label { color: var(--text-muted); }
.field label .req { color: var(--bad); }
.form-rows, .form-card, .pane, .table-wrap, .filters { background: var(--surface); border-color: var(--border);
  box-shadow: var(--shadow); }
.form-card h3, .tag-group-title { color: var(--heading); }
table.grid th { background: var(--surface-2); color: var(--heading); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
table.grid td { border-bottom-color: var(--border-soft); }
table.grid tbody tr:nth-child(even) { background: var(--row-stripe); }
table.grid tbody tr:hover { background: var(--row-hover); }
table.grid tfoot td { background: var(--surface-2); color: var(--text-strong); }
.pane-tabs { background: var(--surface-2); border-bottom-color: var(--border); }
.pane-tabs button { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; font-size: 11.5px; }
.pane-tabs button:hover { color: var(--text); }
.pane-tabs button.active { color: var(--heading); border-bottom-color: var(--primary); }
.pane-tabs .count { background: var(--badge-bg); color: var(--text-muted); }
.pane-tabs button.active .count { background: var(--primary-soft); color: var(--heading); }
.badge { border: 1px solid transparent; }
.badge.ok { color: var(--ok); background: var(--ok-soft); border-color: currentColor; }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: currentColor; }
.badge.bad { color: var(--bad); background: var(--bad-soft); border-color: currentColor; }
.badge.info { color: var(--info); background: var(--info-soft); border-color: currentColor; }
.badge.off { color: var(--text-faint); background: var(--badge-bg); border-color: var(--border); }
.record-summary .code { color: var(--heading); font-weight: 600; }
.record-summary .name { color: var(--text-strong); }
.toast { background: var(--surface); border-color: var(--border); color: var(--text); }
.toast.error { border-left-color: var(--bad); }
.toast.success { border-left-color: var(--ok); }
.modal-backdrop { background: var(--overlay); }
/* 9800 eye stays out of a dialog (it sat on the phone sheet's close button); its hotkey still opens it */
body:has(.modal-backdrop) .efa-root:not(.open) { visibility: hidden; }
.modal { background: var(--surface); border: 1px solid var(--border); }
.modal h3 { color: var(--heading); }
.lookup .options { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-lg); }
.lookup .options div:hover, .lookup .options div.active { background: var(--row-hover); }
.login-wrap { background: var(--bg); }
.login-card { background: var(--surface); border-color: var(--border); }
.login-card h1::before { background: var(--brand-gradient); color: var(--primary-text); }
.theme-switch select { background: var(--surface-2); }
.oh-cell.num span { color: var(--text-strong); }
.order-block { border-color: var(--border); }
.order-block:hover { border-color: var(--border-strong); }

.body { position: relative; }
.order-lines { table-layout: fixed; }
.order-lines td { overflow: hidden; text-overflow: ellipsis; }

/* Hotel Order / Service-Land Order tabs: EOS's status and error markers in theme colours (2026-10-29).
   Hotel (EOS grid_hotel_order_tab_by_tour_code): IN / OUT cells show the state, the RM cell turns red when the
   order's rooms differ from the guest list. Land (grid_land_order_by_tour_code): the row text shows the state. */
/* One colour per state, shared by the state buttons in the toolbar and the orders under them (user 2026-10-31):
   not confirmed amber, confirmed green, voucher issued blue, cancellation requested red, cancelled grey. */
.st-attn  { --st: var(--warn);  --st-bg: var(--warn-soft); }
.st-ok    { --st: var(--ok);    --st-bg: var(--ok-soft); }
.st-issued{ --st: var(--info);  --st-bg: var(--info-soft); }
.st-cxl   { --st: var(--text-faint); --st-bg: var(--badge-bg); }
.st-req   { --st: var(--bad);   --st-bg: var(--bad-soft); }
.st-novch { --st: var(--violet); --st-bg: var(--violet-soft); }
.st-draft { --st: var(--text-muted); --st-bg: var(--surface-3); }
.order-block.st-cxl { opacity: 0.6; }
.order-block.st-cxl .oh-cell span { text-decoration: line-through; text-decoration-color: var(--text-faint); }
.oh-cell.state { background: var(--st-bg); color: var(--st); border-radius: var(--radius); padding: 0 4px; }
.oh-cell.state span { text-overflow: clip; font-variant-numeric: tabular-nums; }  /* MM-DD is never cut (user 2026-11-02) */
.oh-cell.state small { color: var(--st); opacity: 0.85; }
.oh-cell.err { background: var(--bad-soft); border-radius: var(--radius); padding: 0 4px; }
.oh-cell.err span, .oh-cell.err small { color: var(--bad); }
.mark { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; line-height: 1; }
.mark.err { background: var(--bad); color: var(--danger-text); }
.mark.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid currentColor; }
.mark.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid currentColor; }
.mark.dollar { background: var(--ok-soft); color: var(--ok); }
.mark.q { background: var(--warn-soft); color: var(--warn); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 4px; align-items: center; font-size: 11px; color: var(--text-muted); }
/* State buttons: a button in the state's colour with its count; pressed = filled. */
.legend-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--radius);
  border: 1px solid var(--st); background: var(--st-bg); color: var(--st); cursor: pointer; font-size: 12px; font-weight: 600; }
.legend-chip:hover { box-shadow: inset 0 0 0 1px var(--st); }
.legend-chip.on { background: var(--st); color: var(--surface); }
.legend-chip b { font-family: var(--mono); font-weight: 700; color: inherit; }
.orders-filters { padding: 0; flex-wrap: wrap; row-gap: 4px; }
/* Driver & guide room (hotel_driver_guide_room): a violet band instead of the grey head, so it reads as "not a guest
   room" at a glance (user 2026-10-31). */
/* 2026-11-07 (user: not distinct enough): the whole order is violet — head, lines and total — not only the head. */
.order-block.dg-room { border-left: 4px solid var(--violet); background: color-mix(in srgb, var(--violet) 7%, var(--surface)); }
.order-block.dg-room .order-head { background: color-mix(in srgb, var(--violet) 16%, var(--surface)); }
.order-block.dg-room .ob-total { background: color-mix(in srgb, var(--violet) 16%, var(--surface)); }
.order-block.dg-room .order-lines td { background: transparent; }
/* Guest rooms / Driver & guide rooms filter buttons beside the state buttons */
.kind-guest { --st: var(--text-muted); --st-bg: var(--surface-3); }
.kind-dg { --st: var(--violet); --st-bg: var(--violet-soft); }
/* Field label tones (fields.py label_tone): a field people should notice */
.field label.tone-violet { color: var(--violet); font-weight: 700; }
/* A label with a hover note (the model's description) */
.field label.has-help { text-decoration: underline dotted var(--text-faint); text-underline-offset: 2px; cursor: help; }
/* Compact date box in dense rows (user 2026-11-07): smaller text and calendar button, so a date cell is ~108 px */
.form-row input[type="date"], .form-band-rows input[type="date"] { font-size: 12px; padding: 0 2px 0 4px; }
.form-row input[type="date"]::-webkit-calendar-picker-indicator,
.form-band-rows input[type="date"]::-webkit-calendar-picker-indicator { margin-left: 0; padding: 0; width: 12px; }
/* widget "radio": a few fixed choices in one line */
.radio-row { display: flex; align-items: center; gap: 8px; height: var(--input-h); }
.radio-opt { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.radio-opt input { margin: 0; accent-color: var(--primary); }
/* centred small counts (B / L / D) */
.field.center input { text-align: center !important; padding-right: 0 !important; }
/* Pick from contract, hotel (hotel_rate_picker.js, user 2026-11-07): two tabs — Contract (filters left, rows with
   prices right; rows not covering the check-in faint) and Hotel requests (latest prices, this tour's marked).
   A click on a row picks that price. */
.modal.picker-modal { width: min(1280px, 96vw); max-width: none; }
.picker { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.picker-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.picker-tab { border: none; border-bottom: 2px solid transparent; background: transparent; padding: 5px 12px; cursor: pointer;
  font-size: 12px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted);
  display: inline-flex; gap: 6px; align-items: center; }
.picker-tab .n { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.picker-tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.picker-hint { font-size: 11.5px; }
.picker-main { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px; min-height: 0; }
.picker-facets { border-right: 1px solid var(--border); padding-right: 8px; max-height: 58vh; overflow: auto; }
.facet-check { display: flex; align-items: center; gap: 5px; font-size: 12px; cursor: pointer; }
.picker-table { max-height: 58vh; overflow: auto; min-width: 0; }
.picker-grid th, .picker-grid td { height: 26px; font-size: 12px; padding: 0 6px; white-space: nowrap; }
.picker-grid td.note { max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }
.picker-grid td.strong { font-weight: 700; }
.picker-grid tbody tr { cursor: pointer; }
.picker-grid tbody tr:hover td { background: var(--primary-soft); }
.picker-grid tbody tr.off td { color: var(--text-faint); }
.picker-grid td.price:hover { outline: 1.5px solid var(--primary); outline-offset: -2px; font-weight: 700; color: var(--primary); }
.picker-grid.picker-refs tbody tr.mine td { background: var(--info-soft); }
.picker-grid.picker-refs tbody tr.mine:hover td { background: var(--primary-soft); }
.picker-grid.picker-refs td.ok { color: var(--ok); font-weight: 600; }
.mark.dg { background: var(--violet); color: var(--surface); padding: 0 5px; }
.orders-filters input[type="text"] { width: 280px; height: var(--input-h); }
.orders-filters label.check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text); cursor: pointer; }
.orders-filters label.check input { margin: 0; accent-color: var(--primary); }
table.land-orders td { vertical-align: top; }
table.land-orders tr.land-row td { color: var(--st); }
table.land-orders tr.land-row.st-ok td { color: var(--text); }
table.land-orders tr.land-row.st-cxl td { text-decoration: line-through; text-decoration-color: var(--text-faint); }
table.land-orders tr.land-row td.sup b { color: inherit; }
table.land-orders tr.land-row td.sup small { display: block; color: var(--text-muted); font-size: 11px; white-space: normal;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table.land-orders tr.land-row td.stat small { display: block; font-size: 10px; color: var(--text-faint); }
table.land-orders tr.day-head td { background: var(--surface-2); color: var(--heading); font-weight: 600; font-size: 11.5px;
  height: 22px; letter-spacing: 0.3px; }
table.land-orders tr.land-lines td { padding: 0 0 4px 28px; background: var(--surface); }
table.land-orders .caret { cursor: pointer; color: var(--text-faint); user-select: none; }
table.land-orders .tick input { margin: 2px 0 0; accent-color: var(--primary); cursor: pointer; } /* Print vouchers */
.btn.print-ticked { position: relative; }
.btn.print-ticked .tick-count { position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 999px; background: var(--primary); color: var(--primary-text); font-size: 10px; line-height: 15px; text-align: center; }
table.land-orders tr.land-row:hover td { background: var(--row-hover); }

/* Tab strip of the bottom pane as a distinct band (user 2026-10-29): the tour header above is white cards, the
   orders / guests pane below starts with a tinted strip and a brand-coloured edge, so the two zones read apart. */
.pane { border-top: 3px solid var(--primary); }
.pane-tabs { background: var(--surface-3); border-bottom: 1px solid var(--border-strong); padding: 4px 8px 0; gap: 3px; align-items: flex-end; }
.pane-tabs button { height: 27px; margin-bottom: -1px; border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0;
  background: transparent; color: var(--text-muted); }
.pane-tabs button:hover { background: var(--surface-2); color: var(--text); }
.pane-tabs button.active { background: var(--surface); border-color: var(--border-strong); color: var(--primary-ink); font-weight: 600; }
.pane-tabs .pane-tools { align-self: center; padding-bottom: 3px; }

/* Rich-text field (richtext.js, gap batch 1 B14): small toolbar above a contenteditable box, same look as textarea. */
.rt-box { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); }
.rt-box:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.rt-toolbar { position: relative; display: flex; gap: 2px; padding: 1px 2px; border-bottom: 1px solid var(--border); }
.rt-toolbar[hidden] { display: none; }
.rt-btn { min-width: 22px; height: 20px; padding: 0 4px; border: 0; border-radius: var(--radius); background: transparent;
  color: var(--text-muted); font-size: 12px; line-height: 20px; cursor: pointer; }
.rt-btn:hover { background: var(--row-hover); color: var(--text); }
.rt-btn.rt-b { font-weight: 700; }
.rt-btn.rt-i { font-style: italic; }
.rt-btn.rt-u { text-decoration: underline; }
.rt-btn.rt-color { color: var(--bad); font-weight: 700; }
.rt-btn.rt-hl { color: var(--warn); }
/* colour / highlight / size pickers under the toolbar (EOS's TinyMCE palette) */
.rt-pop { position: absolute; top: 100%; left: 2px; z-index: 30; display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px;
  padding: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); }
.rt-swatch { width: 20px; height: 20px; padding: 0; border: 1px solid var(--border-strong); border-radius: 3px; cursor: pointer; }
.rt-swatch:hover { outline: 2px solid var(--primary); }
.rt-swatch.rt-none { background: linear-gradient(135deg, transparent 45%, var(--bad) 45% 55%, transparent 55%) var(--surface); }
.rt-pop-size { flex-direction: column; gap: 0; }
.rt-sizeopt { padding: 2px 10px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.rt-sizeopt:hover { background: var(--row-hover); }
.rt-editor { min-height: 44px; max-height: 240px; overflow-y: auto; padding: 3px 6px; line-height: 1.35; outline: none;
  overflow-wrap: anywhere; }
.rt-editor p { margin: 0; }
/* in a row dialog (itinerary text, feedback #6) the editor gets room to write */
.modal .rt-editor { min-height: 160px; max-height: 50vh; }
.rt-editor ul, .rt-editor ol { margin: 0; padding-left: 20px; }
.field.required:not(.readonly) .rt-editor { background: var(--required-bg); border-left: 3px solid var(--info); }
.readonly .rt-box { background: var(--surface-2); border-color: var(--border); box-shadow: none; }
.readonly .rt-editor { color: var(--text-muted); }
.field.has-error .rt-box { border-color: var(--danger); }
.form-band-side .field .rt-box { height: 100%; }
.form-band-side .field .rt-editor { flex: 1 1 auto; max-height: none; }

/* Top menu bar (EOS-style main menu, 2026-10-30; items from app/ui/menu.yaml). Menus open on click; while one is open,
   hovering the next switches to it. Dropdowns list name left, module code right in small mono. */
.topbar { gap: 6px; padding: 0 10px 0 10px; }
.brand { margin-right: 6px; }
.menubar { display: flex; align-items: stretch; height: 100%; min-width: 0; }
.menu { position: relative; display: flex; }
.menu-btn { border: 0; background: transparent; padding: 0 10px; font-size: 13px; font-weight: 500; color: var(--text);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.menu-btn:hover, .menu.open > .menu-btn { background: var(--row-hover); }
.menu-btn.active { border-bottom-color: var(--primary); color: var(--text-strong); font-weight: 600; }
.menu-btn::after { content: "▾"; margin-left: 4px; font-size: 10px; color: var(--text-faint); }
.menu-btn-user { color: var(--text-muted); }
.menu-drop { display: none; position: absolute; top: 100%; left: 0; z-index: 40; min-width: 220px; padding: 4px 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg); max-height: calc(100vh - var(--topbar-h) - 12px); overflow-y: auto; }
.menubar-user .menu-drop { left: auto; right: 0; }
.menu.open > .menu-drop { display: block; }
.menu-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%;
  padding: 4px 12px 4px 14px; color: var(--text); font-size: 12.5px; white-space: nowrap; border: 0;
  border-left: 3px solid transparent; background: transparent; text-align: left; cursor: pointer; }
.menu-item code { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.menu-item:hover, .menu-item:focus-visible { background: var(--row-hover); text-decoration: none; }
.menu-item.active { background: var(--primary-soft); border-left-color: var(--primary); color: var(--text-strong);
  font-weight: 600; }
.menu-section { padding: 6px 14px 2px; font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--heading); opacity: 0.85; border-top: 1px solid var(--border-soft); margin-top: 3px; }
.menu-sep { border-top: 1px solid var(--border-soft); margin: 4px 0; }
.menu-who { display: flex; flex-direction: column; padding: 4px 14px 6px; border-bottom: 1px solid var(--border-soft);
  margin-bottom: 3px; }
.menu-who small { color: var(--text-muted); }
@media (max-width: 1000px) { .topbar .module-badge { display: none; } .menu-btn { padding: 0 7px; } }
/* Narrow window or 200 % zoom (REVIEW_UX_4200_20261128 E7): the main menu moves to a second row and wraps there,
   instead of running over Search and the user menu. */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; height: auto; min-height: var(--topbar-h); row-gap: 0; padding-top: 4px; }
  .topbar > .menubar:not(.menubar-user) { order: 10; flex: 1 0 100%; flex-wrap: wrap; height: auto;
    border-top: 1px solid var(--border-soft); }
  .topbar > .menubar .menu-btn { min-height: 30px; }
  .topbar > .menubar-user { height: var(--topbar-h); }
}

/* Itinerary layout (itinerary.js, 6000 dev notes §9.1): day heading rows with their fields in place, timed rows
   under them, team headings in bold; the ⠿ handle drags a row or a day. */
.grid.itinerary { table-layout: fixed; width: 100%; }
.grid.itinerary col.handle { width: 22px; }
.grid.itinerary col.time { width: 64px; }
.grid.itinerary col.supplier { width: 90px; }
.grid.itinerary col.confirm { width: 120px; }
.grid.itinerary col.payment { width: 110px; }
.grid.itinerary col.acts { width: 64px; }
.grid.itinerary td { vertical-align: top; }
.grid.itinerary td.handle { cursor: grab; color: var(--text-faint); text-align: center; user-select: none; }
.grid.itinerary td.time { font-variant-numeric: tabular-nums; }
.grid.itinerary td.text .content p { margin: 0; }
.grid.itinerary td.text .content ul, .grid.itinerary td.text .content ol { margin: 0; padding-left: 18px; }
.grid.itinerary td.text .badge { margin-left: 6px; }
.grid.itinerary tr.itin-day td { background: var(--primary-soft); border-top: 2px solid var(--border-strong); padding: 3px 4px; }
.itin-day-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.itin-day-line .day-no { color: var(--heading); min-width: 44px; }
.itin-day-line .day-date { color: var(--text-muted); min-width: 74px; font-variant-numeric: tabular-nums; }
.itin-day-line input { height: 24px; padding: 0 6px; }
.itin-day-line label.meal { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--text-muted); }
.itin-day-line input.meal { width: 64px; }
.itin-day-line .spacer { flex: 1; }
.grid.itinerary tr.itin-heading td { font-weight: 600; color: var(--text-strong); }
.grid.itinerary tr.itin-heading .team { margin-right: 6px; padding: 0 6px; border-radius: var(--radius); background: var(--badge-bg); }
.grid.itinerary tr.itin-item .team { margin-right: 6px; color: var(--primary); font-weight: 600; }
.grid.itinerary tr.off td { color: var(--text-faint); }
.grid.itinerary tr.itin-end td { height: 6px; padding: 0; border: 0; }
.grid.itinerary.dragging tr.itin-end td { height: 14px; }
.grid.itinerary tr.drop-here td { box-shadow: inset 0 2px 0 var(--primary); }
/* in-place editing (user 2026-11-07): text looks like text until clicked, then the rich-text box takes its place */
.inline-rich.editable { cursor: text; border-radius: var(--radius); min-height: 20px; padding: 1px 3px; margin: -1px -3px; }
.inline-rich.editable:hover, .inline-rich.editable:focus-visible { background: var(--row-hover); outline: 1px dashed var(--border-strong); }
.inline-rich.saving { opacity: .55; }
.inline-rich p { margin: 0; }
.inline-rich ul, .inline-rich ol { margin: 0; padding-left: 18px; }
.inline-rich .ph { color: var(--text-faint); font-style: italic; }
.inline-rich-wrap > .rt-field { margin: 0; width: 100%; display: block; } /* no label column */
.inline-rich-wrap > .rt-field .error { margin-top: 2px; }
.inline-rich-wrap .rt-box { width: 100%; }
.itin-day-line .inline-rich-wrap:has(.rt-field) { flex-basis: 100%; order: 10; } /* editing: the title takes its own line */
.inline-rich-wrap > .rt-field > label { display: none; }
.inline-rich-wrap .rt-editor { min-height: 44px; max-height: 260px; overflow: auto; }
.itin-day-line .inline-rich-wrap { flex: 1 1 260px; min-width: 200px; }
.itin-day-line .day-title { font-weight: 600; }
.grid.itinerary td.time input.time-in { width: 52px; height: 22px; padding: 0 3px; border-color: transparent; background: transparent; font-variant-numeric: tabular-nums; }
.grid.itinerary td.time input.time-in:hover, .grid.itinerary td.time input.time-in:focus { border-color: var(--input-border); background: var(--surface); }
.grid.itinerary td.time input.time-hidden { color: var(--text-faint); text-decoration: line-through; }
.grid.itinerary td.text .flags { margin-top: 2px; }
.grid.itinerary td.eos { color: var(--text-faint); font-style: italic; }
.grid.itinerary td.row-actions { white-space: nowrap; text-align: right; }
/* day bar (user 2026-11-08): tick days to show / print only those */
.detail-with-facets > .detail-facets.itin-days { flex-basis: 200px; }
.itin-days .itin-pick { cursor: pointer; font-weight: normal; }
.itin-days .itin-pick input { margin: 0; flex: 0 0 auto; }
.itin-days .facet-note { margin-top: 6px; padding: 0 6px; font-size: 11px; color: var(--text-faint); }

/* Details side by side in one tab (Detail.beside): hotel rooms | meals & extras (2026-11-02) */
.detail-split { display: flex; gap: 0; height: 100%; min-height: 0; }
.split-half { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.split-half + .split-half { border-left: 1px solid var(--border); }
.split-head { flex: none; display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.split-head h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.split-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.split-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
.split-body > table.grid { border: none; width: 100%; }
.autofill-note { grid-column: 1 / -1; min-height: 1.4em; font-size: 12px; }

/* Detail.band_by (user 2026-11-03, after EOS hotel requests): rows of one check-in date share a colour, the next date
   the next one, a firmer line where a new date starts. Four clearly different tints, readable in every theme. */
table.grid tbody tr.stale td { opacity: 0.45; }
table.grid tbody tr.band-0 { background: var(--band-0); }
table.grid tbody tr.band-1 { background: var(--band-1); }
table.grid tbody tr.band-2 { background: var(--band-2); }
table.grid tbody tr.band-3 { background: var(--band-3); }
table.grid tbody tr.band-start > td { border-top: 2px solid var(--border-strong); }
table.grid tbody tr[class*="band-"]:hover { box-shadow: inset 0 0 0 999px var(--row-hover); }

/* Col.format "bar": a percent with a thin bar under it (EOS AVA% / CFM%; user 2026-11-03: number above, bar below,
   not side by side, so the column is narrow) */
.pct-bar { display: inline-flex; flex-direction: column; align-items: stretch; gap: 2px; width: 100%; vertical-align: middle; }
.pct-track { display: block; height: 3px; border-radius: 2px; background: var(--border-soft); overflow: hidden; }
.pct-fill { display: block; height: 100%; border-radius: 2px; background: var(--ok); }
.pct-text { font-size: 11.5px; line-height: 1.1; font-variant-numeric: tabular-nums; text-align: right; }

/* Delete on a detail row: a bin icon, red on hover */
.btn-icon.btn-danger-icon { width: 22px; height: 22px; border-color: transparent; background: transparent; }
.btn-icon.btn-danger-icon:hover { color: var(--bad); background: var(--bad-soft); border-color: var(--bad); }
table.grid th.row-actions { width: 34px; display: table-cell; }
/* Detail cells edited in place (Col.edit, user 2026-11-07): plain text until hovered or focused */
table.grid th.row-actions.icons { width: 64px; }
table.grid td.cell-edit { padding: 0 2px; }
table.grid td.cell-edit .ce-in { width: 100%; min-width: 0; height: 22px; padding: 0 4px; font-size: 12.5px; border: 1px solid transparent;
  border-radius: var(--radius); background: transparent; color: var(--text); box-shadow: none; font-variant-numeric: tabular-nums; }
table.grid td.cell-edit select.ce-in { appearance: none; -webkit-appearance: none; cursor: pointer; padding: 0 2px; }
table.grid td.cell-edit.num .ce-in { text-align: right; -moz-appearance: textfield; }
table.grid td.cell-edit.num .ce-in::-webkit-inner-spin-button, table.grid td.cell-edit.num .ce-in::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0; }
table.grid td.cell-edit .ce-in:hover { border-color: var(--input-border); }
table.grid td.cell-edit .ce-in:focus { border-color: var(--primary); background: var(--surface); box-shadow: var(--focus-ring); }
table.grid td.cell-edit input[type="date"].ce-in { font-size: 12px; padding: 0 2px; }
/* a typed (fixed) tax amount, not from the rate */
table.grid td.cell-edit.fixed .ce-in { color: var(--violet); font-weight: 600; }
table.grid th.row-actions.wide { width: 120px; }
table.grid td.row-actions { white-space: nowrap; padding: 0 4px; }

/* Detail.side_facets: the list page's facet bar at the left of a detail tab */
.detail-with-facets { display: flex; gap: 8px; height: 100%; min-height: 0; padding: 6px 0 0 6px; }
.detail-with-facets > .detail-facets { flex: 0 0 150px; box-shadow: none; }
.detail-with-facets > .detail-main { flex: 1 1 auto; min-width: 0; overflow: auto; }

/* Detail layout "mail": envelopes at the left, the chosen email read at the right */
.mail-split { display: flex; height: 100%; min-height: 0; }
/* left: search on top, the envelopes under it; wide enough for a whole subject (user 2026-11-07) */
.mail-side { flex: 0 0 440px; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.mail-search { margin: 6px 6px 0; }
.mail-list { flex: 1 1 auto; overflow: auto; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.mail-facets { flex: 0 0 180px; margin: 6px 0 6px 6px; }
.mail-facets[hidden] { display: none; }
.mail-card-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); align-self: center; }
.mail-card { display: block; width: 100%; text-align: left; border: 1px solid var(--border-soft); border-radius: var(--radius);
  background: var(--surface); padding: 5px 8px; cursor: pointer; color: var(--text); }
.mail-card:hover { background: var(--row-hover); }
.mail-card.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.mail-card-top { display: flex; align-items: baseline; gap: 6px; font-size: 11px; }
.mail-card-top .st-text { font-weight: 600; white-space: nowrap; }
.mail-card-who { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.mail-card-when { flex: 0 0 auto; font-size: 10.5px; }
/* order / tour Mails tab (user 2026-11-07): received mail has a green edge, sent mail none; an import guess is marked */
.mail-card.in { box-shadow: inset 3px 0 0 var(--ok); }
.mail-card.in.on { box-shadow: inset 3px 0 0 var(--primary); }
.mail-card-suggested { flex: 0 0 auto; padding: 0 5px; border-radius: 8px; font-size: 10px; font-weight: 600;
  color: var(--warn); background: var(--warn-soft); }
.mail-card-subject { margin-top: 2px; font-size: 12.5px; font-weight: 600; color: var(--text-strong); line-height: 1.35;
  overflow-wrap: anywhere; }
.mail-view { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 0; padding: 6px 10px; gap: 6px; }
.mail-tools { display: flex; gap: 6px; align-items: center; }
.mail-head { border-bottom: 1px solid var(--border-soft); padding-bottom: 4px; font-size: 12px; }
.mail-head-row { display: flex; gap: 8px; line-height: 18px; }
.mail-head-label { flex: 0 0 56px; color: var(--text-faint); }
.mail-head-value { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; color: var(--text-strong); }
/* the email is shown on white, as the hotel reads it, whatever the theme */
.mail-frame { flex: 1 1 auto; min-height: 240px; width: 100%; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--white); }
.mail-text { flex: 1 1 auto; overflow: auto; margin: 0; white-space: pre-wrap; font-size: 12px; }

/* Detail.dialog_groups (user 2026-11-03, hotel request line): the row dialog in titled blocks, wider than a plain
   dialog; notes fields take a whole line and a few rows so people see they can write there. */
.modal:has(.dialog-groups) { max-width: 1040px; width: min(96vw, 1040px); }
.dialog-groups { display: flex; flex-direction: column; gap: 8px; }
.dialog-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px 8px; }
.dialog-group > h4 { margin: 0 0 4px; font-size: 11.5px; font-weight: 600; color: var(--heading); text-transform: uppercase;
  letter-spacing: 0.03em; }
.dialog-group .field.span-all { grid-column: 1 / -1; }
.dialog-group .field.span-all textarea { min-height: 64px; }

/* Col.under / Col.wrap: EOS-style stacked cells, a second value in small type below (user 2026-11-03) */
table.grid td:has(> .cell-under), table.grid td.wrap { height: auto; padding-top: 2px; padding-bottom: 2px; line-height: 1.25; }
table.grid td.wrap { white-space: normal; word-break: break-word; }
/* Col.format "lines": one item per line, an item never broken */
table.grid td.lines { height: auto; padding-top: 2px; padding-bottom: 2px; line-height: 1.3; }
table.grid td .cell-line { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.grid td .cell-under { font-size: 10.5px; line-height: 1.2; color: var(--text-muted); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }

/* Detail.group_by: a heading row per group (EOS "Date of Departure : … Agent Name : … TourCode : … QID :") */
table.grid tbody tr.group-head > td { height: 24px; padding: 0 8px; background: var(--surface-2); font-size: 12px; font-weight: 600;
  color: var(--heading); border-top: 2px solid var(--border-strong); max-width: none; }
table.grid tbody tr.group-head a { font-weight: 600; }
table.grid tbody tr.group-head .group-meta { font-weight: 400; color: var(--text-muted); margin-left: 12px; }
table.grid tbody tr.group-head.current > td { box-shadow: inset 3px 0 0 var(--primary); }

/* Split Detail tab (MasterDetailPage.split_details, user 2026-11-07, land order): header fields at the left half,
   their own tabs (Lines | Reminders) at the right half, both the full height of the tab. */
.form-split { display: flex; height: 100%; min-height: 0; }
.form-split > .form-rows { flex: 0 0 50%; min-width: 0; overflow: auto; border: none; border-radius: 0; padding: 6px 10px 8px; gap: 5px; }
.form-split > .form-rows > .form-row:last-child { flex: 1 1 auto; align-items: stretch; }
.form-split > .form-rows > .form-row:last-child .field.tall { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.form-split > .form-rows > .form-row:last-child .field.tall textarea { height: 100%; min-height: 90px; resize: none; }
.form-split > .form-rows > .form-row:last-child .field.tall .rt-box { height: 100%; min-height: 90px; }
.form-split > .form-rows > .form-row:last-child .field.tall .rt-editor { flex: 1 1 auto; max-height: none; }
.form-split > .side-pane { flex: 1 1 0; min-width: 0; border: none; border-left: 1px solid var(--border-strong);
  border-radius: 0; box-shadow: none; }
@media (max-width: 1279px) {
  .form-split { flex-direction: column; overflow: auto; }
  .form-split > .form-rows { flex: none; overflow: visible; }
  .form-split > .side-pane { flex: 1 0 320px; border-left: none; border-top: 1px solid var(--border-strong); }
}

/* Detail layout "cards" (detail_cards.js): one card per line, label above value. */
.dcard-list { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.dcard { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--shadow); overflow: hidden; }
.dcard.clickable { cursor: pointer; }
.dcard.clickable:hover { border-color: var(--primary); }
.dcard-head { display: flex; align-items: center; gap: 10px; padding: 7px 10px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); }
.dcard-heading { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dcard-no { font-family: var(--mono); font-size: 12px; color: var(--text-faint); }
.dcard-tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--primary-soft); color: var(--heading); }
.dcard-title { font-size: 14px; font-weight: 600; color: var(--text); }
.dcard-total { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--heading); white-space: nowrap; }
.dcard-actions { display: flex; gap: 4px; }
.dcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px 14px; padding: 9px 12px; }
.dcard-cell { display: flex; flex-direction: column; min-width: 0; }
.dcard-cell.num .dcard-value { font-family: var(--mono); }
.dcard-label { font-size: 10.5px; line-height: 13px; color: var(--text-muted); }
.dcard-value { font-size: 13px; overflow-wrap: anywhere; }
.dcard-note { padding: 7px 12px 9px; border-top: 1px dashed var(--border); font-size: 13px; white-space: pre-wrap; }
.dcard-sum { display: flex; justify-content: flex-end; align-items: baseline; gap: 10px; padding: 2px 12px; }

/* def.head_fields (user 2026-11-07): which record this is, large in the button row (tour code · tour name) */
.page-head .head-title { flex: 0 1 auto; min-width: 0; font-size: 17px; font-weight: 700; color: var(--heading);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: 6px; }

/* one line above a tab's content saying how to use it (Order history, user 2026-11-07) */
.tab-hint { margin: 6px 8px; padding: 6px 10px; border-left: 3px solid var(--primary); background: var(--primary-soft);
  color: var(--text); font-size: 12px; line-height: 1.5; border-radius: var(--radius); }

/* Attachments tab (features.Attachments, 6220 / 6310 Communication, 2026-11-08): paste zone + card grid */
.attachments { height: 100%; min-height: 0; outline: none; }
.attachments.drag .attach-zone { border-color: var(--primary); background: var(--primary-soft); }
.attach-main { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px; min-height: 0; }
.detail-main > .attach-main { padding-top: 0; }
.attach-zone { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-muted); font-size: 12.5px; }
.attach-zone b { color: var(--text-strong); }
.attach-zone-icon { font-size: 18px; }
.attach-zone .btn { margin-left: auto; }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; align-content: start; }
.attach-card { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; min-width: 0; }
.attach-card.failed { border-color: var(--danger); }
.attach-thumb { display: flex; align-items: center; justify-content: center; height: 130px; padding: 0; overflow: hidden;
  background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius); cursor: zoom-in; }
.attach-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.attach-pre { margin: 0; padding: 6px; width: 100%; height: 100%; overflow: hidden; text-align: left; white-space: pre-wrap;
  overflow-wrap: anywhere; font: 11px/1.45 var(--mono); color: var(--text); }
.attach-icon { font: 600 18px var(--mono); color: var(--primary); }
.attach-icon.kind-pdf { color: var(--danger); }
.attach-missing { padding: 8px; text-align: center; color: var(--text-muted); font-size: 11.5px; }
.attach-card.failed .attach-missing { color: var(--danger-text); }
.attach-note { min-height: 18px; font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; cursor: text; }
.attach-note.empty { font-weight: 400; color: var(--text-faint); }
.attach-note-input { width: 100%; height: 24px; font-size: 12px; }
.attach-source { display: flex; gap: 6px; align-items: center; font-size: 11.5px; overflow: hidden; white-space: nowrap; }
.attach-source a { color: var(--link); overflow: hidden; text-overflow: ellipsis; }
.attach-meta { display: flex; flex-direction: column; color: var(--text-faint); font-size: 11px; min-width: 0; }
.attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.attach-tools { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.attach-move { height: 22px; max-width: 150px; font-size: 11px; }
.attach-del { border: none; background: none; color: var(--text-faint); cursor: pointer; font-size: 13px; padding: 0 2px; }
.attach-del:hover { color: var(--danger); }
.attach-viewer { position: relative; }
.attach-viewer .attach-prev, .attach-viewer .attach-next { position: absolute; top: 45%; font-size: 22px; padding: 2px 10px; }
.attach-viewer .attach-prev { left: 6px; }
.attach-viewer .attach-next { right: 6px; }
.attach-viewer-caption { margin-top: 6px; text-align: center; color: var(--text-muted); font-size: 12px; }
.attach-text-dialog { display: flex; flex-direction: column; gap: 6px; width: min(640px, 80vw); }
.attach-text { width: 100%; font: 12px/1.5 var(--mono); }

/* ==== Phone (BASE_KIT_MOBILE_20261202; user 2026-12-03) ============================================================
   Everything for widths ≤ 640 px lives in this one block; nothing above changes. body.phone is kept by mobile.js so
   the renderers and this block agree on what a phone is. Rules: 44 px hit areas (§3.6), 16 px inputs, one column,
   a left drawer instead of the menu bar (§3.2), cards instead of tables (§3.3), a sticky bottom action bar (§3.4),
   full-screen dialogs and bottom sheets (§3.5). Elements that exist only for the phone (drawer, sheets, bottom bar,
   topbar title) are hidden by default and shown here. */
.menu-toggle, .topbar-title, .drawer, .drawer-backdrop, .bottom-bar, .sheet-backdrop, .desktop-hint, .list-chips,
.phone-only { display: none; }
@media (max-width: 640px) {
  :root { --topbar-h: 44px; --input-h: 44px; --row-h: 44px; --bbar-h: 56px; --hit: 44px; }
  body { font-size: 14px; line-height: 1.4; }
  .phone-only { display: initial; }
  body.phone .desktop-only { display: none !important; }
  .main { padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); gap: 8px; }
  body.has-bottom-bar .main { padding-bottom: calc(var(--bbar-h) + 12px + env(safe-area-inset-bottom)); }

  /* ---- top bar: ☰ · title (badge under it) · search · eye ---- */
  .topbar { height: var(--topbar-h); padding: 0 48px 0 0; gap: 2px; position: sticky; top: 0; }  /* right 48 px: the 9800 eye */
  /* 9800 feedback eye (§3.2: top bar, right end). Its own stylesheet pins it bottom-right and a drag writes inline
     left / bottom, so the phone position is forced; the panel opens downwards (acceptance D2). Not once the user
     has dragged it (efa-moved, eye-for-ai.js place()): then it stays where it was put; double-tap brings it back. */
  body.phone .efa-root:not(.efa-moved) { position: fixed !important; top: 0 !important; right: 2px !important; bottom: auto !important; left: auto !important;
    height: var(--topbar-h); justify-content: center; flex-direction: column-reverse; align-items: flex-end; }
  body.phone .efa-root.efa-left:not(.efa-moved) { align-items: flex-end; }
  body.phone .efa-root.efa-left:not(.efa-moved) .efa-dock { flex-direction: row; }
  .topbar .brand, .topbar .menubar, .topbar .module-badge, .topbar .theme-switch, .topbar .menubar-user, .topbar .spacer { display: none; }
  .menu-toggle { display: inline-grid; place-items: center; width: var(--hit); height: var(--hit); flex: none; border: 0;
    background: transparent; color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; border-radius: var(--radius); }
  .menu-toggle:hover { background: var(--row-hover); }
  .topbar-title { display: flex; flex-direction: column; justify-content: center; flex: 1 1 auto; min-width: 0; line-height: 1.15; }
  .topbar-title .tt-title { font-size: 15px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-title .tt-badge { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .quick-open-btn { height: var(--hit); min-width: var(--hit); margin: 0; padding: 0 10px; border-color: transparent; justify-content: center; }
  .quick-open-btn kbd { display: none; }

  /* ---- drawer ---- */
  .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 59; background: var(--overlay); }
  .drawer { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(320px, 86vw);
    background: var(--surface); box-shadow: var(--shadow-lg); overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
  .drawer-head { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
  .drawer-head strong { font-size: 15px; color: var(--text-strong); }
  .drawer-head small { color: var(--text-muted); font-size: 12px; }
  .drawer-badge { align-self: flex-start; margin-top: 6px; font-size: 11.5px; }
  .drawer-groups { flex: 1 1 auto; padding: 6px 0; }
  .drawer-group-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: var(--hit);
    padding: 0 16px; border: 0; background: transparent; color: var(--text); font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; }
  .drawer-group-btn.active { color: var(--primary); }
  .drawer-group-btn .drawer-caret { color: var(--text-faint); font-size: 12px; transition: transform 0.15s; }
  .drawer-group.open .drawer-caret { transform: rotate(180deg); }
  .drawer-items { padding: 0 0 6px; }
  .drawer-items .menu-section { padding: 8px 16px 2px 28px; }
  .drawer-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--hit); padding: 0 16px 0 28px;
    color: var(--text); font-size: 14.5px; border-left: 3px solid transparent; }
  .drawer-item code { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
  .drawer-item.active { background: var(--primary-soft); border-left-color: var(--primary); color: var(--text-strong); font-weight: 600; }
  .drawer-item:hover { text-decoration: none; background: var(--row-hover); }
  .drawer-foot { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--border); }
  .drawer-pref { display: grid; grid-template-columns: 1fr; gap: 2px; font-size: 12px; color: var(--text-muted); }
  .drawer-pref select { height: var(--hit); font-size: 16px; }
  .drawer-signout { height: var(--hit); justify-content: center; font-size: 15px; }

  /* ---- toasts: bottom, above the action bar, full width minus margins (§3.2) ---- */
  .toasts { left: 8px; right: 8px; bottom: calc(16px + env(safe-area-inset-bottom)); align-items: stretch; }
  body.has-bottom-bar .toasts { bottom: calc(var(--bbar-h) + 12px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; font-size: 14px; }

  /* ---- 44 px hit areas, 16 px inputs (§3.6) ---- */
  .btn, .btn-sm, .btn-icon, .icon-btn, .fold-toggle, .facet-value, .facet-more, .chip, .chip-h, .link-btn, .menu-item,
  .pane-tabs button, .picker-tab, .legend-chip, .oh-caret, .head-fold, .attach-del, .recent-item .x, .chip-h .x, .chip-h .term,
  .lookup-multi .chip-x, .rt-btn, .gr-btn, .sheet-close, .quick-open-item, .theme-switch select, .pager select {
    min-height: var(--hit); min-width: var(--hit); }
  .rt-toolbar { flex-wrap: wrap; }  /* 44 px buttons no longer fit one row: the toolbar wraps instead of widening the form (M2 sweep) */
  .btn, .btn-sm { height: var(--hit); padding: 0 16px; font-size: 15px; }
  .btn-icon { width: var(--hit); height: var(--hit); }
  .btn-icon .ico { width: 20px; height: 20px; }
  .chip-h { height: var(--hit); align-items: center; }
  .btn-icon.btn-danger-icon { width: var(--hit); height: var(--hit); }
  .field .expand { width: var(--hit); height: var(--hit); top: -10px; right: -8px; }
  input[type="text"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="password"],
  input[type="email"], input[type="tel"], input[type="search"], select, .lookup-multi, .quick-open-input {
    height: var(--input-h); min-height: var(--input-h); font-size: 16px; padding: 0 12px; }
  textarea, .rt-editor { font-size: 16px; min-height: 88px; padding: 8px 12px; }
  .form-row .field textarea { height: auto; }
  .yesno, .radio-row { min-height: var(--input-h); height: auto; gap: 12px; flex-wrap: wrap; }
  .radio-opt { min-height: var(--hit); font-size: 15px; }
  /* a tick box keeps its 22 px look inside a 44 px hit area */
  input[type="checkbox"], input[type="radio"] { appearance: none; -webkit-appearance: none; width: var(--hit); height: var(--hit); margin: -11px;
    display: inline-grid; place-items: center; background: none; border: 0; cursor: pointer; flex: none; }
  input[type="checkbox"]::before, input[type="radio"]::before { content: ""; width: 22px; height: 22px; border: 2px solid var(--input-border);
    border-radius: 5px; background: var(--surface); box-sizing: border-box; }
  input[type="radio"]::before { border-radius: 50%; }
  input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { background: var(--primary); border-color: var(--primary); }
  input[type="checkbox"]:checked::after { content: ""; position: absolute; width: 6px; height: 11px; border: solid var(--primary-text);
    border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
  input[type="checkbox"], input[type="radio"] { position: relative; }
  input[type="checkbox"]:indeterminate::before { background: var(--primary-soft); border-color: var(--primary); }
  input[type="checkbox"]:disabled::before, input[type="radio"]:disabled::before { opacity: 0.45; }
  input[type="checkbox"]:focus-visible::before, input[type="radio"]:focus-visible::before { box-shadow: var(--focus-ring); }
  .yesno input, .chip input, table.grid .tick input, .action-checklist input, .facet-check input, .radio-opt input { width: var(--hit); height: var(--hit); margin: -11px 0; }
  .field label, .form-row .field label, .form-grid-rows .field label, .dcard-label { font-size: 13px; line-height: 16px; }
  /* §3.6: text links (card titles, "View all") get a 44 px hit box through padding; inline padding leaves the lines
     where they are, a flex / block link grows */
  /* inline-block, else min-height does nothing and the hit height is the line box: 44 on Windows, 42 on Linux (CI) */
  .main a:not(.btn):not(.dcard):not(.dcard-more):not([class*="shortcut"]):not(.thumb) { display: inline-block; padding-top: 13px; padding-bottom: 13px;
    line-height: 18px; min-height: 44px; box-sizing: border-box; }
  .field .error { font-size: 13px; }
  .facet-collapse { min-width: var(--hit); min-height: var(--hit); padding: 0 8px; }  /* N7: the « in a tab's facet bar */
  a:not(.btn):not(.drawer-item) { min-height: 0; }  /* the drawer items keep their 44 px (acceptance D1) */
  .empty { font-size: 14px; }
  .lookup .options { max-height: 50vh; }
  .lookup .options div { min-height: var(--hit); display: flex; align-items: center; font-size: 15px; }

  /* ---- list page (§3.3): search full width and sticky, Filter / Sort / Select row, cards, Load more ---- */
  .toolbar { gap: 8px; }
  .toolbar .search { flex: 1 1 100%; min-width: 0; max-width: none; position: sticky; top: var(--topbar-h); z-index: 5;
    background: var(--bg); padding: 2px 0; }
  .toolbar .search input { height: var(--input-h); }
  .toolbar .search-history { display: none; }
  .toolbar .filter-anchor .filters, .toolbar .recent-menu { display: none !important; }
  .toolbar .bulk-count, .toolbar .link-btn.select-all-desktop { display: none; }
  .list-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .list-chips:empty { display: none; }
  .list-chip { display: inline-flex; align-items: center; gap: 4px; min-height: var(--hit); padding: 0 6px 0 12px; border: 1px solid var(--primary);
    border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 600; }
  .list-chip .x { border: 0; background: transparent; color: inherit; font-size: 18px; width: 36px; height: var(--hit); cursor: pointer; }
  .list-body { display: block; }
  .list-body > .facet-bar, .list-body > .split-bar, .list-body > .detail-pane { display: none !important; }
  .list-body.with-detail > .list-col { display: contents; }
  .main > .table-wrap, .list-body > .table-wrap, .list-col > .table-wrap { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .card-list { display: flex; flex-direction: column; gap: 8px; }
  .card-list .dcard { border-color: var(--border); }
  .card-list .dcard-head { padding: 8px 12px; gap: 8px; align-items: flex-start; }
  .card-list .dcard-heading { flex-direction: column; align-items: flex-start; gap: 2px; }
  .card-list .dcard-title { font-size: 15px; line-height: 1.3; }
  .card-list .dcard-tag { font-size: 12px; padding: 2px 9px; }
  .card-list .dcard-total { font-size: 17px; }
  .card-list .dcard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; padding: 8px 12px 10px; }
  .card-list .dcard-value { font-size: 14px; }
  .card-list .dcard-more { display: block; width: 100%; min-height: var(--hit); border: 0; border-top: 1px dashed var(--border);
    background: transparent; color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer; }
  .card-list .dcard-actions .btn-icon { width: var(--hit); height: var(--hit); }
  .card-list .dcard .pick { display: grid; place-items: center; width: var(--hit); height: var(--hit); }
  .card-list .dcard .pick input { margin: 0; }
  .card-list .dcard.selected { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
  .card-list .thumb { height: 44px; max-width: 80px; border-radius: 4px; border: 1px solid var(--border); }
  .load-more { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0 8px; color: var(--text-muted); font-size: 13px; }
  .load-more .btn { width: 100%; justify-content: center; }
  .pager.desktop-pager { display: none; }
  .toolbar .sort-select { flex: 1 1 140px; min-width: 0; width: auto; font-size: 16px; }
  .toolbar .btn-badge { top: -4px; right: -4px; }

  /* non-standard pages (§3.3 item 8): a word of warning, then the desktop drawing, scrollable sideways */
  .desktop-hint { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-left: 3px solid var(--warn); background: var(--warn-soft);
    color: var(--text); font-size: 13px; border-radius: var(--radius); }
  .desktop-only-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .desktop-only-wrap table.grid th, .desktop-only-wrap table.grid td { height: auto; min-height: var(--row-h); }

  /* ---- forms (§3.4): one section per card, one field per line, bottom action bar ---- */
  .form-columns.cols-2, .form-columns.cols-3, .form-columns.cols-4, .form-columns.cols-5 { grid-template-columns: 1fr; }
  .form-columns { overflow: visible; flex: none; }
  .form-grid.cols-2, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .form-grid { gap: 10px; }
  .form-card { padding: 10px 12px 12px; }
  .form-card h3 { font-size: 12px; margin-bottom: 8px; }
  .form-card.more-card > h3 { margin: 0; }
  .form-card.more-card > .more-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: var(--hit);
    border: 0; background: transparent; color: var(--heading); font-size: 12px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase;
    cursor: pointer; padding: 0; }
  .form-card.more-card > .form-grid { margin-top: 8px; }
  .field { grid-template-columns: 1fr; row-gap: 4px; }
  .field .error { grid-column: 1; }
  .field.tall label { padding-top: 0; }
  .page-head { flex-wrap: wrap; gap: 6px 10px; }
  .page-head .page-actions { display: none; }
  .page-head .page-back { display: flex; }
  .page-head .save-state { display: none; }
  .page-head .head-title { font-size: 16px; margin-left: 0; white-space: normal; }
  .record-summary { margin-left: 0; flex-wrap: wrap; gap: 6px 10px; }
  .record-summary .meta { white-space: normal; }
  .header-fold { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: var(--hit); padding: 0 12px;
    border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); font-size: 14px; cursor: pointer;
    text-align: left; }
  .header-fold .hf-summary { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
  .header-fold .hf-caret { color: var(--primary); font-weight: 700; }
  .form-header.folded > .form-columns { display: none; }
  .pane { min-height: 0; flex: none; border-top-width: 2px; }
  .pane-body { overflow: visible; }
  .pane-tabs { overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; scrollbar-width: none; padding: 4px 6px 0; }
  .pane-tabs::-webkit-scrollbar { display: none; }
  .pane-tabs button { height: var(--hit); font-size: 13px; padding: 0 12px; }
  .pane-tabs .pane-tools { gap: 8px; }
  .pane-tabs .pane-tools .detail-filter { flex-direction: column; align-items: flex-start; }
  .form-split { flex-direction: column; height: auto; overflow: visible; }
  .form-split > .form-rows, .form-split > .form-columns { flex: none; overflow: visible; }
  .form-split > .side-pane { flex: none; min-height: 240px; border-left: 0; border-top: 1px solid var(--border-strong); }
  .detail-split { flex-direction: column; height: auto; }
  /* stacked halves keep their own height (flex-basis 0 let the second half lie over the first: 6310 Rooms, M5) */
  .split-half { flex: none; }
  .split-head { flex-wrap: wrap; }
  .split-tools { flex-wrap: wrap; }
  .split-half + .split-half { border-left: 0; border-top: 1px solid var(--border); }
  .detail-with-facets { flex-direction: column; height: auto; padding: 6px; }
  .detail-with-facets > .detail-facets { flex: none; display: flex; flex-wrap: wrap; gap: 4px; }
  .detail-with-facets > .detail-facets .facet-group { display: contents; }
  .detail-with-facets > .detail-facets .facet-title { flex-basis: 100%; }
  .detail-with-facets > .detail-facets .facet-value { width: auto; border: 1px solid var(--border); border-radius: 999px; padding: 0 12px; }
  .dcard-list { padding: 8px 0; }
  .orders-split { flex-direction: column; padding-left: 0; }
  /* the order tabs draw cards on a phone (orders_tab.js, REVIEW_UX_MOBILE_TABS_20261205; phone_density.css) */
  .orders-facets { position: static; flex: none; max-height: none; }
  .gallery img { max-width: 100%; }
  table.grid th, table.grid td { font-size: 14px; }
  .audit-diff { white-space: pre-wrap; font-size: 12px; }
  /* History tab as cards (PLAN_MOBILE_ALL M1 item 4): one change per line, "Field: old → new", no JSON */
  .audit-cards { display: flex; flex-direction: column; gap: 8px; }
  .audit-cards .dcard-head { padding: 8px 12px; gap: 8px; }
  .audit-cards .audit-when { color: var(--text-muted); font-size: 13px; }
  .audit-cards .audit-lines { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 10px; font-size: 14px; }
  .audit-cards .audit-line { overflow-wrap: anywhere; } /* a long value without spaces wraps (4220 History, M5) */
  .audit-cards .audit-line b { color: var(--text-strong); font-weight: 600; }
  .audit-cards .audit-line .old { color: var(--text-muted); text-decoration: line-through; }
  .audit-cards .audit-line .arrow { color: var(--text-faint); margin: 0 4px; }
  /* Col.copy on a card (UI-B011): the icon is always shown, in a 44 px hit box that overlaps the value's line */
  .card-list .copy-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--hit); height: var(--hit);
    margin: -13px 0 -13px 2px; padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--text-muted);
    vertical-align: middle; cursor: pointer; }
  .card-list .copy-btn:hover { color: var(--primary); background: var(--row-hover); }
  .card-list .copy-btn .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

  /* ---- bottom action bar (§3.4 item 3) ---- */
  .bottom-bar { display: flex; align-items: center; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; min-height: var(--bbar-h);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: var(--shadow-up); }
  body.kbd-open .bottom-bar { position: static; box-shadow: none; }
  .bbar-status { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .bbar-status.dirty { color: var(--warn); font-weight: 600; }
  .bbar-status.bad { color: var(--bad); font-weight: 600; }
  .bbar-status.ok { color: var(--ok); }
  .bbar-primary { flex: 0 1 auto; max-width: 60%; min-width: 120px; justify-content: center; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
  .bbar-more { width: var(--hit); padding: 0; justify-content: center; font-size: 20px; flex: none; }

  /* ---- dialogs (§3.5): full-screen sheets; confirm as a bottom sheet ---- */
  .modal-backdrop { align-items: flex-end; }
  .modal.sheet { width: 100vw; max-width: none; min-width: 0; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; padding: 0;
    display: flex; flex-direction: column; overflow: hidden; }
  .modal.sheet .modal-head { flex: none; display: flex; align-items: center; gap: 8px; min-height: var(--hit); padding: 4px 4px 4px 16px;
    border-bottom: 1px solid var(--border); }
  .modal.sheet .modal-head h3 { flex: 1 1 auto; margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .modal.sheet .modal-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px 16px; }
  .modal.sheet .modal-actions { flex: none; margin: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border);
    background: var(--surface); justify-content: space-between; }
  .modal.sheet .modal-actions .btn { flex: 1 1 0; justify-content: center; }
  .modal.sheet .modal-actions .btn-primary { flex-grow: 1.4; order: 10; }
  .modal.sheet .modal-actions .btn-danger { order: 5; }
  .modal.action-dialog, .modal.action-dialog.wide, .modal.picker-modal, .modal:has(.dialog-groups), .modal.quick-open-modal, .modal.lightbox {
    width: 100vw; max-width: none; min-width: 0; }
  .modal.quick-open-modal { margin-top: 0; align-self: auto; }
  .quick-open-list { max-height: none; flex: 1 1 auto; }
  .action-dialog .action-preview { max-height: none; }
  .action-dialog.wide .action-inputs { flex-direction: column; align-items: stretch; }
  .action-dialog.wide .action-inputs .field, .action-dialog.wide .action-inputs .field:last-child { grid-template-columns: 1fr; min-width: 0; }
  .action-dialog.wide .action-inputs .field input[type=date], .action-dialog.wide .action-inputs .field input[type=number] { width: 100%; }
  .form-grid.cols-2, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .modal.confirm.bottom-sheet { width: 100vw; max-width: none; min-width: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0;
    padding: 20px 16px calc(12px + env(safe-area-inset-bottom)); font-size: 15px; animation: sheet-up 160ms ease-out; }
  .modal.confirm.bottom-sheet p { margin: 0 0 16px; }
  .modal.confirm.bottom-sheet .modal-actions { justify-content: space-between; }
  .modal.confirm.bottom-sheet .modal-actions .btn { flex: 1 1 0; justify-content: center; }
  .modal.confirm.bottom-sheet .btn-danger { background: var(--bad); border-color: var(--bad); color: var(--danger-text); font-weight: 600; }
  .lightbox-body img { max-width: 100vw; max-height: 85dvh; touch-action: pinch-zoom; }
  .modal.lightbox .modal-body { display: grid; place-items: center; padding: 0; touch-action: pinch-zoom; }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

  /* mobile.js fullscreenSheet(): the Filter page, lookup picker, "…" menus */
  .sheet-backdrop { display: flex; position: fixed; inset: 0; z-index: 45; background: var(--overlay); align-items: flex-end; }
  .sheet { display: flex; flex-direction: column; width: 100vw; background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
  .sheet.full { height: 100dvh; }
  .sheet.bottom { max-height: 85dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; animation: sheet-up 160ms ease-out;
    padding-bottom: env(safe-area-inset-bottom); }
  .sheet-head { flex: none; display: flex; align-items: center; gap: 8px; min-height: var(--hit); padding: 4px 4px 4px 16px; border-bottom: 1px solid var(--border); }
  .sheet-head h3 { flex: 1 1 auto; margin: 0; font-size: 16px; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sheet-head h3:empty { display: none; }
  .sheet.bottom .sheet-head { border-bottom: 0; min-height: 36px; }
  /* a full-screen sheet's title row ends 48 px before the edge: the 9800 eye sits there (D2) */
  .sheet.full .sheet-head, .modal.sheet .modal-head { padding-right: 48px; }
  .sheet-close { display: inline-grid; place-items: center; width: var(--hit); height: var(--hit); border: 0; background: transparent; color: var(--text-muted);
    font-size: 26px; line-height: 1; cursor: pointer; border-radius: var(--radius); flex: none; }
  .sheet-close:hover { background: var(--row-hover); color: var(--text); }
  .sheet-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 8px 16px 12px; }
  .sheet.bottom .sheet-body { padding-top: 0; }
  .sheet-foot { flex: none; display: flex; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border);
    background: var(--surface); }
  .sheet-foot .btn { flex: 1 1 0; justify-content: center; }
  .sheet-foot .btn-primary { flex-grow: 1.4; }
  .sheet-menu { display: flex; flex-direction: column; }
  .sheet-menu-item { display: flex; align-items: center; min-height: 52px; padding: 0 8px; border: 0; border-bottom: 1px solid var(--border-soft);
    background: transparent; color: var(--text); font-size: 16px; text-align: left; cursor: pointer; }
  .sheet-menu-item:last-child { border-bottom: 0; }
  .sheet-menu-item:hover { background: var(--row-hover); }
  .sheet-menu-item.danger { color: var(--bad); }
  .sheet-menu-item:disabled { opacity: 0.45; cursor: default; }
  /* the Filter page: facet groups as wrapped chips, then the filter fields */
  .filter-sheet .facet-group { margin-bottom: 10px; }
  .filter-sheet .facet-title { font-size: 12px; margin: 10px 0 6px; }
  .filter-sheet .facet-values { display: flex; flex-wrap: wrap; gap: 6px; }
  .filter-sheet .facet-value { width: auto; display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; font-size: 14px; }
  .filter-sheet .facet-value.on { border-color: var(--primary); }
  .filter-sheet .facet-value .n { font-size: 12px; }
  .filter-sheet .facet-more { padding: 0 14px; }
  .filter-sheet .filter-fields { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 8px; }
  .filter-sheet .filter-fields:not(:empty) { padding-top: 8px; border-top: 1px solid var(--border); }
  /* the lookup picker: search box on top, recent first */
  .lookup-sheet { display: flex; flex-direction: column; gap: 8px; }
  .lookup-sheet .lookup-rows { display: flex; flex-direction: column; }
  .lookup-sheet .lookup-row { display: flex; align-items: center; min-height: 52px; padding: 0 8px; border: 0; border-bottom: 1px solid var(--border-soft);
    background: transparent; color: var(--text); font-size: 15px; text-align: left; cursor: pointer; }
  .lookup-sheet .lookup-row:hover { background: var(--row-hover); }
  .lookup-sheet .lookup-row.recent::before { content: "\21BA"; color: var(--text-faint); margin-right: 8px; }
  .lookup-sheet .lookup-row.clear { color: var(--text-muted); }
  .lookup-sheet .facet-title { margin: 6px 0 2px; }

  /* a list record opened in a sheet (detail_pane lists, §3.3 item 2): the pane's form fills the sheet, its action bar
     sticks to the sheet's bottom edge */
  .detail-sheet { display: flex; flex-direction: column; min-height: 100%; }
  .detail-sheet .detail-pane { display: block; flex: 1 1 auto; }
  .detail-sheet .detail-form { overflow: visible; }
  .detail-sheet .detail-form .pane-body > .form-rows, .detail-sheet .detail-form .pane-body > .form-columns { min-height: 0; }
  .sheet .bottom-bar, .detail-sheet .bottom-bar { position: sticky; bottom: 0; margin: 8px -16px calc(-12px - env(safe-area-inset-bottom)); }
  .sheet .recent-menu { display: block; position: static; width: auto; max-width: none; box-shadow: none; border: 0; padding: 0; }
  .sheet .recent-item { min-height: var(--hit); }
  .sheet .recent-item a { min-height: var(--hit); justify-content: center; }
  .sheet .recent-item .x { visibility: visible; }

  /* photo widget (§3.4 item 7) */
  .photo-widget { display: flex; flex-direction: column; gap: 8px; }
  .photo-buttons { display: flex; gap: 8px; }
  .photo-buttons .btn { flex: 1 1 0; justify-content: center; }
  .photo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
  .photo-item { position: relative; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    background: var(--surface-2); font-size: 11.5px; }
  .photo-item img { display: block; width: 100%; height: 96px; object-fit: cover; }
  .photo-item .photo-name { padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }
  .photo-item .photo-state { padding: 0 6px 4px; color: var(--text-muted); }
  .photo-item.failed { border-color: var(--bad); }
  .photo-item.failed .photo-state { color: var(--bad); font-weight: 600; white-space: normal; }
  .photo-item progress { width: 100%; height: 4px; }
  .photo-item .photo-x { position: absolute; top: 2px; right: 2px; width: var(--hit); height: var(--hit); border: 0; border-radius: 50%;
    background: var(--overlay); color: var(--white); font-size: 20px; cursor: pointer; display: grid; place-items: center; }
  .photo-item .photo-retry { position: absolute; left: 4px; bottom: 4px; min-height: 36px; }
}

/* Col.icons (user 2026-12-03): an icon before a cell's value, in the function-icon orange */
.lead-ico { display: inline-flex; vertical-align: -3px; margin-right: 5px; color: var(--primary); }
.lead-ico .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; }
.facet-ico .ico { fill: none; stroke: currentColor; }

/* Mobile.card_lines (user 2026-12-03, 3410): compact cards, one line per row of facts, no labels */
.card-list.compact { gap: 6px; }
.card-list.compact .dcard-head { align-items: center; padding: 4px 4px 2px 12px; background: none; border-bottom: 0; }
.card-list.compact .dcard-heading { flex-direction: row; }
.card-list.compact .dcard-title { font-size: 15px; line-height: 1.3; }
.card-list.compact .dcard-lines { display: flex; flex-direction: column; gap: 2px; padding: 0 12px 8px; font-size: 14px; }
.card-list.compact .dcard-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.card-list.compact .dcard-line-main { flex: 1 1 auto; min-width: 0; }
.card-list.compact .dcard-line-main .dcard-value { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; }
.card-list.compact .dcard-aside { flex: none; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.card-list.compact .cell-under { display: inline; font-size: inherit; color: var(--text-muted); }
.card-list.compact .cell-under::before { content: " · "; }
.card-list.compact .dcard-aside .cell-under::before { content: " "; }
.card-list.compact .dcard-value.muted { display: none; }
.card-list.compact .dcard-labelled { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
.card-list.compact .dcard-inline-label { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.radio-opt .lead-ico { margin: 0 1px 0 3px; }
