/* Orgestrate — design tokens first; components read tokens only. */
/* Tokens follow GHL's Untitled UI palette: gray scale, primary #155EEF, 40px controls, 8px radius, 12px cards. */
:root {
  --bg: #f2f7fa; --surface: #ffffff; --surface-2: #f9fafb; --surface-3: #f2f4f7;
  --border: #eaecf0; --border-strong: #d0d5dd;
  --text: #101828; --text-2: #344054; --text-3: #667085; --text-4: #98a2b3;
  --accent: #155eef; --accent-hover: #004eeb; --accent-weak: #eff4ff; --accent-text: #ffffff; --accent-ring: rgba(21, 94, 239, .24);
  --warn: #b54708; --warn-weak: #fffaeb; --danger: #d92d20; --danger-weak: #fef3f2; --ok: #067647; --ok-weak: #ecfdf3;
  --tier-a: #155eef; --tier-b: #0e9384; --tier-c: #b54708;
  --radius-sm: 6px; --radius: 8px; --radius-lg: 12px;
  --control: 40px; --control-sm: 32px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05); --shadow: 0 4px 8px -2px rgba(16, 24, 40, .1), 0 2px 4px -2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 24px -4px rgba(16, 24, 40, .08), 0 8px 8px -4px rgba(16, 24, 40, .03);
  --ease: cubic-bezier(.2, .8, .2, 1); --fast: 120ms; --med: 220ms;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  color-scheme: light;
}
/* Dark tokens (Untitled UI dark grays): followed from the OS unless the viewer picked Light; forced when they picked Dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c111d; --surface: #161b26; --surface-2: #1f242f; --surface-3: #262b36;
    --border: #2a303c; --border-strong: #333741;
    --text: #f5f5f6; --text-2: #cecfd2; --text-3: #94969c; --text-4: #85888e;
    --accent: #528bff; --accent-hover: #84adff; --accent-weak: #1a2547; --accent-text: #ffffff; --accent-ring: rgba(82, 139, 255, .32);
    --warn: #fdb022; --warn-weak: #2e2410; --danger: #f97066; --danger-weak: #3a1a17; --ok: #47cd89; --ok-weak: #0f2a1d;
    --tier-a: #528bff; --tier-b: #2ed3b7; --tier-c: #fdb022;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 4px 12px rgba(0,0,0,.45); --shadow-lg: 0 20px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0c111d; --surface: #161b26; --surface-2: #1f242f; --surface-3: #262b36;
    --border: #2a303c; --border-strong: #333741;
    --text: #f5f5f6; --text-2: #cecfd2; --text-3: #94969c; --text-4: #85888e;
    --accent: #528bff; --accent-hover: #84adff; --accent-weak: #1a2547; --accent-text: #ffffff; --accent-ring: rgba(82, 139, 255, .32);
    --warn: #fdb022; --warn-weak: #2e2410; --danger: #f97066; --danger-weak: #3a1a17; --ok: #47cd89; --ok-weak: #0f2a1d;
    --tier-a: #528bff; --tier-b: #2ed3b7; --tier-c: #fdb022;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 4px 12px rgba(0,0,0,.45); --shadow-lg: 0 20px 40px rgba(0,0,0,.6);
    color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[x-cloak] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 var(--s3); font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 var(--s2); font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -3px; }
.icon.sm { width: 16px; height: 16px; }
.btn .icon, .nav .icon, .chip .icon { width: 18px; height: 18px; }
.btn.sm .icon { width: 16px; height: 16px; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: var(--s2); padding: var(--s4); font-weight: 700; letter-spacing: -.01em; }
.brand .mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.brand small { display: block; font-weight: 500; color: var(--text-3); font-size: 11px; }
.nav { padding: 0 var(--s2); display: grid; gap: 1px; }
.nav a { display: flex; align-items: center; gap: var(--s2); padding: 7px var(--s2); border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; transition: background var(--fast) var(--ease), color var(--fast); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.nav a { font-size: 14px; font-weight: 500; }
.nav .count { margin-left: auto; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav .badge { margin-left: auto; }
.side-section { padding: var(--s4) var(--s2) var(--s1); display: flex; align-items: center; justify-content: space-between; }
.side-section h3 { margin: 0 0 0 var(--s2); }
.side-lists { overflow: auto; flex: 1; padding-bottom: var(--s4); }
.side-foot { border-top: 1px solid var(--border); padding: var(--s3) var(--s4); font-size: 12px; color: var(--text-3); display: flex; gap: var(--s3); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.topbar .title { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.topbar .spacer { flex: 1; }
.content { flex: 1; overflow: auto; padding: var(--s5); }
.content.flush { padding: 0; display: flex; flex-direction: column; }

/* Controls */
.btn { display: inline-flex; align-items: center; gap: 6px; height: var(--control); padding: 0 14px; border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 14px var(--font); cursor: pointer; white-space: nowrap; transition: background var(--fast) var(--ease), border-color var(--fast), box-shadow var(--fast); }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:focus-visible, .input:focus, .select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn.sm { height: var(--control-sm); padding: 0 10px; font-size: 13px; }
.btn.icon-only { width: var(--control); padding: 0; justify-content: center; }
.btn.sm.icon-only { width: var(--control-sm); }
.btn-group { display: inline-flex; gap: var(--s2); flex-wrap: wrap; }
.input, .select, textarea { height: var(--control); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: 14px var(--font); min-width: 0; box-shadow: var(--shadow-sm); transition: border-color var(--fast), box-shadow var(--fast); }
.input::placeholder, textarea::placeholder { color: var(--text-4); }
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.4; }
.input.sm, .select.sm { height: var(--control-sm); font-size: 13px; padding: 0 8px; }
.search { position: relative; }
.search .icon { position: absolute; left: 12px; top: 12px; color: var(--text-3); }
.search .input { padding-left: 36px; width: 280px; }
label.field, .field { display: grid; gap: 6px; font-size: 14px; color: var(--text-2); font-weight: 500; }
label.field .hint { font-weight: 400; color: var(--text-3); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.stack { display: grid; gap: var(--s3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card .hd { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--s2); }
.card .hd h2 { margin: 0; }
.card .bd { padding: var(--s4); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s4); align-items: start; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--text-2); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--text-3); }
.chip.primary { border-color: var(--border-strong); color: var(--text); font-weight: 600; }
.chip.clickable { cursor: pointer; transition: background var(--fast); }
.chip.clickable:hover { background: var(--surface-3); }
.chip.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 650; background: var(--surface-3); color: var(--text-2); }
.badge.accent { background: var(--accent-weak); color: var(--accent); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.danger { background: var(--danger-weak); color: var(--danger); }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--text-3); }
.tier { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-weight: 800; font-size: 12px; color: #fff; }
.tier.A { background: var(--tier-a); } .tier.B { background: var(--tier-b); } .tier.C { background: var(--tier-c); } .tier.none { background: var(--surface-3); color: var(--text-3); }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width var(--med) var(--ease); }
.dist { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-3); }
.dist > i { display: block; height: 100%; }

/* Tables */
.table-wrap { overflow: auto; flex: 1; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.t th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 12px; color: var(--text-2); padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.t th.sortable { cursor: pointer; user-select: none; }
.t th.sortable:hover { color: var(--text); }
.t td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.t tbody tr { background: var(--surface); transition: background var(--fast); }
.t tbody tr:hover { background: var(--surface-2); }
.t tbody tr.sel { background: var(--accent-weak); }
.t tbody tr.clickable { cursor: pointer; }
.t td.num, .t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.t .name { font-weight: 600; }
.t .sub { color: var(--text-3); font-size: 12px; }
.cb { width: 34px; }
.pager { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s5); border-top: 1px solid var(--border); background: var(--surface); font-size: 12px; color: var(--text-2); }

/* Conditions builder */
.conds { background: var(--surface); border-bottom: 1px solid var(--border); padding: var(--s3) var(--s5); display: grid; gap: var(--s2); }
.cond { display: grid; grid-template-columns: 220px 150px minmax(160px, 1fr) 32px; gap: var(--s2); align-items: center; }
.cond.group { grid-template-columns: 1fr; border-left: 3px solid var(--border-strong); padding-left: var(--s3); }
.toolbar { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s5); background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.bulkbar { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s5); background: var(--accent-weak); border-bottom: 1px solid var(--accent); color: var(--accent); font-weight: 600; flex-wrap: wrap; }
.marketbar { display: flex; gap: 6px; padding: var(--s2) var(--s5); background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }

/* Drawer & modal */
.scrim { position: fixed; inset: 0; background: rgba(10, 16, 24, .38); z-index: 40; animation: fade var(--med) var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); border-left: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); z-index: 41; display: flex; flex-direction: column; animation: slide var(--med) var(--ease); }
.drawer .hd { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); display: flex; gap: var(--s3); align-items: flex-start; }
.drawer .bd { padding: var(--s4) var(--s5); overflow: auto; flex: 1; }
.modal { position: fixed; z-index: 42; left: 50%; top: 8vh; transform: translateX(-50%); width: min(640px, calc(100vw - 32px)); max-height: 84vh; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: rise var(--med) var(--ease); }
.modal.wide { width: min(960px, calc(100vw - 32px)); }
.modal .hd { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--s2); }
.modal .bd { padding: var(--s4) var(--s5); overflow: auto; }
.modal .ft { padding: var(--s3) var(--s5); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--s2); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 calc(-1 * var(--s5)) var(--s4); padding: 0 var(--s5); }
.tabs button { background: none; border: 0; padding: 8px 10px; font: 500 13px var(--font); color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--accent); border-color: var(--accent); font-weight: 650; }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px var(--s3); margin: 0; }
dl.kv dt { color: var(--text-3); font-size: 12px; padding-top: 6px; }
dl.kv dd { margin: 0; min-width: 0; }
.prov { font-size: 10.5px; color: var(--text-3); }
.pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s3); max-height: 320px; overflow: auto; margin: 0; }

/* States */
.empty { text-align: center; padding: 56px var(--s5); color: var(--text-2); }
.empty .glyph { width: 44px; height: 44px; margin: 0 auto var(--s3); border-radius: 12px; background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; }
.empty .glyph .icon { width: 22px; height: 22px; }
.empty h2 { margin-bottom: 6px; }
.empty p { margin: 0 auto var(--s4); max-width: 440px; color: var(--text-3); }
.skel { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.alert { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3); border-radius: var(--radius); font-size: 13px; border: 1px solid; }
.alert.warn { background: var(--warn-weak); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert.danger { background: var(--danger-weak); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert.info { background: var(--accent-weak); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.toasts { position: fixed; bottom: var(--s4); right: var(--s4); z-index: 60; display: grid; gap: var(--s2); width: 360px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 13px; display: flex; gap: var(--s2); align-items: flex-start; animation: rise var(--med) var(--ease); }
.toast.error { background: var(--danger); color: #fff; }
.jobtray { position: fixed; bottom: var(--s4); left: 264px; z-index: 55; display: grid; gap: var(--s2); width: 340px; }
.job { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s3); display: grid; gap: 6px; font-size: 12.5px; }
.job .row { justify-content: space-between; flex-wrap: nowrap; }
.drop { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: var(--s5); text-align: center; color: var(--text-3); transition: border-color var(--fast), background var(--fast); }
.drop.over { border-color: var(--accent); background: var(--accent-weak); color: var(--accent); }
.list-row { display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s2); border-radius: var(--radius-sm); color: var(--text-2); font-size: 13px; cursor: pointer; text-decoration: none; }
.list-row:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.list-row.on { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.list-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.list-row .ct { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tree-child td:first-child { padding-left: 32px; }
@keyframes fade { from { opacity: 0 } }
@keyframes slide { from { transform: translateX(24px); opacity: 0 } }
@keyframes rise { from { transform: translate(var(--tx, 0), 8px); opacity: 0 } }
.modal { --tx: -50%; }
@keyframes shimmer { to { background-position: -200% 0 } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .split, .grid2, .grid3 { grid-template-columns: 1fr; }
  .cond { grid-template-columns: 1fr 1fr; }
  .search .input { width: 100%; }
  .jobtray { left: var(--s4); }
}
.card .ft { padding: var(--s3) var(--s4); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--s2); }
details summary { cursor: pointer; font-size: 13px; padding: 4px 0; }
/* Cards own their overflow; two-column layouts stack before they crowd. */
.card { min-width: 0; overflow-x: auto; }
.split > *, .stack > * { min-width: 0; }
@media (max-width: 1200px) { .split { grid-template-columns: 1fr; } }
.marketbar .chip { flex: none; max-width: none; }
.t td .mono { white-space: nowrap; }
.t td .btn-group { flex-wrap: nowrap; justify-content: flex-end; }
.t td.num .row { flex-wrap: nowrap; }
.theme-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); margin-left: auto; }
.theme-switch button { display: grid; place-items: center; width: 26px; height: 22px; border: 0; border-radius: 4px; background: transparent; color: var(--text-3); cursor: pointer; transition: background var(--fast) var(--ease), color var(--fast); }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.theme-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.side-foot { align-items: center; }
.side-foot { flex-wrap: wrap; row-gap: var(--s2); }
.side-foot > span { white-space: nowrap; }
.side-foot .theme-switch { margin-left: 0; width: 100%; justify-content: space-between; }
.side-foot .theme-switch button { flex: 1; }

/* ── Modeling, Central File, Import v2, slots, sync (GHL-style surfaces) ───────────────────── */
.side-scroll { flex: 1; overflow: auto; min-height: 0; padding-bottom: var(--s4); }
.side-lists { overflow: visible; flex: none; }
.nav a .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a.sub { padding-left: 28px; font-size: 13px; }
.obj-ico { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; flex: none;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 72%, var(--text)); }
.obj-ico.lg { width: 40px; height: 40px; border-radius: 10px; }
.obj-ico.lg .icon { width: 22px; height: 22px; }
.page-head { padding: var(--s5) var(--s5) 0; display: grid; gap: var(--s2); background: var(--surface); border-bottom: 1px solid var(--border); }
.page-head .crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-3); }
.page-head .crumbs a { color: var(--text-3); }
.page-head .row1 { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.page-head .row1 h1 { font-size: 24px; font-weight: 600; }
.page-head p.sub { margin: 0; color: var(--text-3); }
.page-head .tabs { margin: var(--s2) calc(-1 * var(--s5)) 0; border-bottom: 0; }
.tabs button { font-size: 14px; padding: 10px 4px; margin-right: var(--s4); font-weight: 600; color: var(--text-3); }
.tabs button:hover { color: var(--text-2); }
.obj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s4); }
.obj-card { display: grid; gap: var(--s3); padding: var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast) var(--ease); text-align: left; color: inherit; font: inherit; }
.obj-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.obj-card .top { display: flex; gap: var(--s3); align-items: center; }
.obj-card h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text); }
.obj-card .meta { display: flex; gap: var(--s4); font-size: 13px; color: var(--text-3); }
.obj-card .meta b { color: var(--text); font-weight: 600; }
.obj-card p { margin: 0; font-size: 13px; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.obj-card.new { border-style: dashed; place-content: center; text-align: center; color: var(--text-3); min-height: 150px; }
.obj-card.new:hover { color: var(--accent); border-color: var(--accent); }
.origin { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-3); white-space: nowrap; }
.origin.own { background: var(--accent-weak); color: var(--accent); }
.origin.inherited { background: var(--ok-weak); color: var(--ok); }
.folder-head td { background: var(--surface-2); font-weight: 600; color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* The GHL slide-in: 500px, layered shadow, sticky footer */
.slidein { position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100vw); background: var(--surface); z-index: 45; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg), -1px 0 0 var(--border); animation: slide var(--med) var(--ease); }
.slidein.wide { width: min(880px, 100vw); }
.slidein .hd { padding: var(--s5) var(--s5) var(--s4); display: flex; gap: var(--s3); align-items: flex-start; border-bottom: 1px solid var(--border); }
.slidein .hd h2 { margin: 0; font-size: 18px; font-weight: 600; color: var(--text); }
.slidein .hd p { margin: 2px 0 0; color: var(--text-3); font-size: 14px; }
.slidein .bd { padding: var(--s5); overflow: auto; flex: 1; display: grid; gap: var(--s5); align-content: start; }
.slidein .ft { padding: var(--s4) var(--s5); border-top: 1px solid var(--border); display: flex; gap: var(--s3); justify-content: flex-end; background: var(--surface); }
.slidein .ft .btn { min-width: 96px; justify-content: center; }
.scrim.over { z-index: 44; }
.section-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; }
.section-sub { font-size: 13px; color: var(--text-3); margin: -2px 0 0; }
.choice-list { display: grid; gap: var(--s2); }
.choice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface);
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast); }
.choice:hover { border-color: var(--border-strong); }
.choice.on { border-color: var(--accent); background: var(--accent-weak); box-shadow: 0 0 0 1px var(--accent); }
.choice input { margin-top: 3px; accent-color: var(--accent); }
.choice b { display: block; font-weight: 600; color: var(--text); font-size: 14px; }
.choice span { color: var(--text-3); font-size: 13px; }
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.type-tile { display: grid; justify-items: center; gap: 6px; padding: var(--s3) var(--s2); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; font: 500 13px var(--font); color: var(--text-2); transition: border-color var(--fast), background var(--fast); }
.type-tile:hover { border-color: var(--border-strong); background: var(--surface-2); }
.type-tile.on { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }
.keyrow { display: flex; gap: var(--s2); align-items: center; }
.keyrow .input { flex: 1; }
.keytoggle { width: var(--control); height: var(--control); display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text-3); cursor: pointer; flex: none; }
.keytoggle.on { color: var(--accent); border-color: var(--accent); background: var(--accent-weak); }
.keyline { font: 12px var(--mono); color: var(--text-3); margin-top: 4px; }
.preview-box { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: var(--s4); background: var(--surface-2); display: grid; gap: 6px; }
.preview-box .lbl { font-size: 14px; font-weight: 500; color: var(--text-2); }
.preview-box .lbl .req { color: var(--danger); }
.sentence { padding: var(--s3) var(--s4); border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; color: var(--text-2); }
.sentence b { color: var(--text); }
.opt-row { display: grid; grid-template-columns: 1fr 1fr 40px; gap: var(--s2); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.seg button { white-space: nowrap; border: 0; background: var(--surface); padding: 0 12px; height: var(--control-sm); font: 600 13px var(--font); color: var(--text-2); cursor: pointer; border-right: 1px solid var(--border-strong); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--surface-3); color: var(--text); }
.seg button.on.important { background: var(--accent-weak); color: var(--accent); }
.seg button.on.ignore { background: var(--surface-3); color: var(--text-3); }

/* Central File */
.file-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr) 400px; gap: var(--s4); padding: var(--s5); align-items: start; }
.file-layout .main-col { display: contents; }
.file-host { container-type: inline-size; }
@container (max-width: 1440px) { .file-layout { grid-template-columns: 280px minmax(0, 1fr) 352px; gap: var(--s3); padding: var(--s4); } }
@container (max-width: 1060px) { .file-layout { grid-template-columns: 260px minmax(0, 1fr); } .file-layout .main-col { display: grid; gap: var(--s3); align-content: start; min-width: 0; } }
@container (max-width: 700px) { .file-layout { grid-template-columns: 1fr; } }
.fold { border-bottom: 1px solid var(--border); }
.fold:last-child { border-bottom: 0; }
.fold > button { width: 100%; display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); background: none; border: 0; cursor: pointer; font: 600 14px var(--font); color: var(--text); }
.fold > button .icon { transition: transform var(--fast); }
.fold.closed > button .icon.chev { transform: rotate(-90deg); }
.fold .fbody { padding: 0 var(--s4) var(--s4); display: grid; gap: var(--s3); }
.fv { display: grid; gap: 2px; }
.fv .k { font-size: 12px; color: var(--text-3); font-weight: 500; }
.fv .v { font-size: 14px; color: var(--text); word-break: break-word; }
.fv .v.none { color: var(--text-4); }
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 32px 1fr; gap: var(--s3); padding: var(--s3) 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 15px; top: 40px; bottom: -12px; width: 2px; background: var(--border); }
.tl:last-child::before { display: none; }
.tl .dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.tl .dot .icon { width: 16px; height: 16px; }
.tl.import .dot { background: var(--accent-weak); color: var(--accent); }
.tl.ghl .dot { background: var(--ok-weak); color: var(--ok); }
.tl.edit .dot { background: var(--warn-weak); color: var(--warn); }
.tl.link .dot { background: color-mix(in srgb, #7a5af8 14%, transparent); color: #7a5af8; }
.tl .when { font-size: 12px; color: var(--text-3); }
.tl .what { font-weight: 600; color: var(--text); }
.tl .fields { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rail { display: grid; gap: var(--s4); }
.rail .card .hd { padding: var(--s3) var(--s4); }
.rail .card .hd h2 { font-size: 14px; }
.assoc-item { display: flex; align-items: center; gap: var(--s2); padding: 6px 0; border-bottom: 1px solid var(--border); }
.assoc-item:last-child { border-bottom: 0; }
.assoc-item a { font-weight: 500; }
.rawgrid { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 2px var(--s3); font-size: 12.5px; }
.rawgrid dt { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rawgrid dd { margin: 0; word-break: break-word; }

/* Import wizard */
.stepper { display: flex; gap: 0; padding: var(--s4) var(--s5); background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.step { display: flex; align-items: center; gap: var(--s2); padding-right: var(--s5); color: var(--text-3); font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer; background: none; border: 0; font-family: var(--font); }
.step .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); font-size: 13px; background: var(--surface); }
.step.on { color: var(--accent); }
.step.on .n { border-color: var(--accent); background: var(--accent-weak); }
.step.done { color: var(--text-2); }
.step.done .n { border-color: var(--accent); background: var(--accent); color: #fff; }
.step:disabled { cursor: default; opacity: .6; }
.step + .step::before { content: ""; width: 32px; height: 2px; background: var(--border); margin-right: var(--s3); }
.maptable td { vertical-align: middle; }
.maptable .samples { font-size: 12px; color: var(--text-3); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.maptable tr.ignored td { opacity: .55; }
.reason { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.reason.warn { color: var(--warn); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3); }
.stat { padding: var(--s4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.stat .n { font-size: 26px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--text-3); }
.stat.primary .n { color: var(--accent); }
.stat.warn .n { color: var(--warn); }
.stat.danger .n { color: var(--danger); }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state.running, .state.verified, .state.applying, .state.confirmed { background: var(--accent-weak); color: var(--accent); }
.state.completed, .state.applied, .state.done { background: var(--ok-weak); color: var(--ok); }
.state.paused, .state.draft, .state.mapped { background: var(--warn-weak); color: var(--warn); }
.state.failed, .state.discarded { background: var(--danger-weak); color: var(--danger); }

/* Slots */
.board { display: flex; gap: var(--s4); overflow-x: auto; padding: var(--s5); align-items: flex-start; flex: 1; }
.board .col { flex: 0 0 300px; background: var(--surface-3); border-radius: var(--radius-lg); padding: var(--s3); display: grid; gap: var(--s2); max-height: calc(100vh - 180px); overflow: auto; }
.board .col h3 { display: flex; justify-content: space-between; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); margin: 4px 4px 6px; }
.board .tilecard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s3); box-shadow: var(--shadow-sm); display: grid; gap: 2px; font-size: 13px; }
.board .tilecard a { font-weight: 600; }
.zipmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s2); }
.zipcell { border-radius: var(--radius); padding: var(--s2) var(--s3); background: color-mix(in srgb, var(--accent) calc(var(--w) * 1%), var(--surface)); border: 1px solid var(--border);
  color: var(--text); font-variant-numeric: tabular-nums; }
.zipcell b { display: block; font-size: 13px; }
.zipcell span { font-size: 12px; color: var(--text-2); }
.metric { font-size: 48px; font-weight: 600; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }

/* Sync plans */
.plan-step { display: grid; grid-template-columns: 28px 1fr auto; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--border); align-items: start; }
.plan-step:last-child { border-bottom: 0; }
.plan-step .num { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text-2); }
.plan-step.done .num { background: var(--ok); color: #fff; }
.plan-step.failed .num { background: var(--danger); color: #fff; }
.plan-step .notes { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.target { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.target.ghl { background: var(--warn-weak); color: var(--warn); }
.target.local { background: var(--surface-3); color: var(--text-3); }
.drift-item { display: flex; gap: var(--s2); align-items: flex-start; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.drift-item:last-child { border-bottom: 0; }
.rule-row { display: grid; grid-template-columns: minmax(200px, 1.3fr) 140px minmax(160px, 1fr) 110px 40px; gap: var(--s2); align-items: center; }
@media (max-width: 1400px) { .rule-row { grid-template-columns: 1fr 1fr; } }
.code { font: 12px var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s3); white-space: pre-wrap; word-break: break-all; color: var(--text-2); max-height: 160px; overflow: auto; }

/* Icon rail with popups: the menu takes 64px, its pages open beside it */
.shell { grid-template-columns: 64px 1fr; }
.rail-nav { position: relative; z-index: 30; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: var(--s3) 0; gap: var(--s2); min-height: 0; }
.rail-brand .mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.rail-brand:hover { text-decoration: none; }
.rail-icons { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; padding-top: var(--s2); }
.rail-foot { display: flex; flex-direction: column; gap: 4px; }
.rail-sep { width: 28px; height: 1px; background: var(--border); margin: 6px 0; }
.ri { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: var(--text-3); cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast); }
.ri:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.ri.on { background: var(--accent-weak); color: var(--accent); }
.ri.open { background: var(--surface-3); color: var(--text); }
.ri:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ri .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.ri .dot.warn { background: var(--warn); }
.ri[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; background: var(--text); color: var(--bg);
  font: 600 12px var(--font); padding: 5px 9px; border-radius: 6px; pointer-events: none; z-index: 60; box-shadow: var(--shadow); }
.ri.open[data-tip]:hover::after { display: none; }
.flyout { position: fixed; left: 72px; width: 300px; max-height: calc(100vh - 80px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: var(--s2) 0; z-index: 50; }
.flyout.wide { width: 340px; }
.flyout .fly-hd { display: flex; align-items: center; justify-content: space-between; padding: var(--s2) var(--s4) var(--s1); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.flyout .fly-hd b { font-weight: 700; }
.flyout .fly-ft { border-top: 1px solid var(--border); margin-top: var(--s2); padding: var(--s2) var(--s4) var(--s1); font-size: 13px; }
.flyout .nav { padding: 0 var(--s2); }
.jobtray { left: 80px; }
@media (max-width: 900px) { .shell { grid-template-columns: 56px 1fr; } .rail-nav { display: flex; } .flyout { left: 60px; width: min(300px, calc(100vw - 72px)); } .jobtray { left: 64px; } }

.t .pin-end { position: sticky; right: 0; background: var(--surface); box-shadow: -8px 0 8px -8px rgba(16,24,40,.12); }
.t thead .pin-end { background: var(--surface-2); }
.t tbody tr:hover .pin-end { background: var(--surface-2); }

/* Composer */
.composer-tabs { display: flex; flex-wrap: wrap; gap: 4px var(--s4); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); }
.composer-tabs > .row { flex-wrap: wrap !important; }
.ctab-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-4); margin-right: 4px; }
.ctab { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--text-2); font: 600 13px var(--font); cursor: pointer; white-space: nowrap; }
.ctab:hover { background: var(--surface-3); }
.ctab.on { background: var(--accent-weak); color: var(--accent); }
.ctab.off { color: var(--text-4); }
.composer textarea { min-height: 76px; }
.tl.message .dot { background: color-mix(in srgb, #0BA5EC 16%, transparent); color: #0BA5EC; }

/* The Central File's right rail: a strip of icons, one panel open beside it */
.side-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 52px; gap: var(--s2); align-items: start; min-width: 0; }
.side-icons { position: sticky; top: var(--s4); display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.si { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-3); cursor: pointer; }
.si:hover { background: var(--surface-3); color: var(--text); }
.si.on { background: var(--accent-weak); color: var(--accent); }
.si .ct { position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font: 700 10px/16px var(--font); font-style: normal; text-align: center; }
.si[data-tip]:hover::after { content: attr(data-tip); position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); white-space: nowrap; background: var(--text); color: var(--bg);
  font: 600 12px var(--font); padding: 5px 9px; border-radius: 6px; pointer-events: none; z-index: 60; }
.file-layout .rail { min-width: 0; }
.center-col { display: grid; gap: var(--s4); align-content: start; min-width: 0; }
.nav > *, .list-row { min-width: 0; max-width: 100%; }
.choice-list.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .choice-list.cols3 { grid-template-columns: 1fr; } }
.choice > div { min-width: 0; }

/* 3-1s */
.three-one { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); align-items: start; }
@media (max-width: 1100px) { .three-one { grid-template-columns: 1fr; } }
.to-col.done .hd { border-top: 3px solid var(--ok); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.to-col.close .hd { border-top: 3px solid var(--accent); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.to-col.aging .hd { border-top: 3px solid var(--warn); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.callsheet { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: var(--s4); padding: var(--s4); overflow: auto; flex: 1; min-height: 0; align-items: start; }
.callsheet .cs-file > div { height: auto !important; }
.callsheet .cs-file .page-head { display: none; }
.callsheet .cs-file .file-layout { padding: 0; }
@media (max-width: 1000px) { .callsheet { grid-template-columns: 1fr; } }

/* The cascade (Portals' ui-cascade): the current level fills the panel; parents collapse into strips on its edge */
.cascade { position: fixed; top: 0; bottom: 0; left: 64px; width: 300px; z-index: 40; background: var(--surface); border-right: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.cascade.pinned { box-shadow: none; }
.shell:has(.cascade.pinned:not([style*="display: none"])) { grid-template-columns: 364px 1fr; }
.shell:has(.cascade.pinned:not([style*="display: none"])) .rail-nav { width: 64px; }
.cascade-frame { display: flex; height: 100%; }
.cascade-level { flex: 1; min-width: 0; padding: 8px 12px 16px; overflow: auto; }
.cascade-top { display: flex; justify-content: flex-end; gap: 2px; }
.cascade-top .btn.on { color: var(--accent); }
.cascade-back { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font: 500 14px var(--font); cursor: pointer; }
.cascade-back:hover { background: var(--surface-2); }
.cascade-heading { padding: 6px 12px 14px; }
.cascade-heading .eyebrow { font-size: 12px; color: var(--text-3); }
.cascade-heading h2 { margin: 2px 0 0; font-size: 20px; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; color: var(--text); }
.cascade-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cascade-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 12px 0 14px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); font: 500 14px var(--font); text-align: left; cursor: pointer; }
.cascade-item > span:first-child { color: var(--text-2); flex: none; }
.cascade-item .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cascade-item .hint { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cascade-item:hover { background: var(--surface-2); }
.cascade-item.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.cascade-item.active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.cascade-strips { display: flex; flex-direction: row-reverse; }
.cascade-strip { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 42px; padding: 16px 0; border: 0; border-left: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); font: 550 14px var(--font); cursor: pointer; }
.cascade-strip:first-child { background: var(--surface-3); color: var(--accent); }
.cascade-strip .v { writing-mode: vertical-rl; white-space: nowrap; }
.cascade-strip:hover { background: var(--accent-weak); color: var(--accent); }
@media (max-width: 900px) { .cascade { left: 56px; width: min(300px, calc(100vw - 56px)); } }

/* The header menu: domain switcher + related workspace tabs (GHL's module bar) */
.domain-bar { display: flex; align-items: stretch; gap: var(--s4); height: 48px; padding: 0 var(--s5); background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 2px 3px rgba(0,0,0,.04); position: relative; z-index: 20; }
.dom-switch { position: relative; display: flex; align-items: center; }
.dom-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: 600 14px var(--font); cursor: pointer; }
.dom-btn:hover { background: var(--surface-2); }
.dom-menu { position: absolute; top: calc(100% + 6px); left: 0; width: 560px; max-height: 70vh; overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s4);
  padding: var(--s3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 50; }
.dom-hd { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 6px 8px; }
.dom-menu a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 14px; }
.dom-menu a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.dom-menu a.on { background: var(--accent-weak); color: var(--accent); }
.dom-tabs { display: flex; align-items: stretch; gap: var(--s5); overflow-x: auto; scrollbar-width: none; min-width: 0; }
.dom-tabs a { display: flex; align-items: center; white-space: nowrap; color: #4B5563; font: 500 14px var(--font); border-bottom: 2px solid transparent; }
.dom-tabs a:hover { color: var(--text); text-decoration: none; }
.dom-tabs a.on { color: #38A0DB; border-bottom-color: #38A0DB; }
:root[data-theme="dark"] .dom-tabs a { color: var(--text-2); }
@media (max-width: 700px) { .dom-menu { width: calc(100vw - 90px); grid-template-columns: 1fr; } }

/* The Central File: three resizable cards that fit the screen and scroll inside, plus the icon rail (GHL's contact page) */
.rec-page { display: flex; flex-direction: column; height: 100vh; min-height: 0; background: var(--bg); }
.rec-grid { flex: 1; min-height: 0; display: grid; gap: 0; padding: 12px 8px 12px 12px; align-items: stretch; }
.rec-card { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.gutter { cursor: col-resize; position: relative; }
.gutter::after { content: ''; position: absolute; top: 50%; left: 50%; width: 4px; height: 36px; transform: translate(-50%, -50%); border-radius: 2px; background: var(--border-strong); opacity: .6; }
.gutter:hover::after { background: var(--accent); opacity: 1; }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); cursor: pointer; flex: none; }
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.add { color: var(--accent); }
.avatar { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #D1E9FF; color: #175CD3; font: 600 14px var(--font); flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; background: var(--surface-3); color: var(--text-2); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* left */
.rl-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.rl-head h2 { margin: 0; font-size: 16px; font-weight: 500; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-nav { display: flex; align-items: center; gap: 2px; font-size: 14px; color: var(--text); }
.rl-scroll { flex: 1; min-height: 0; overflow: auto; padding: 0 14px 14px; }
.rl-identity { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 12px; display: grid; gap: 12px; }
.rl-name { font-size: 15px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rl-meta .k, .rl-tags .k, .rec-right .k { font-size: 14px; color: var(--text-2); margin-bottom: 4px; }
.rl-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rl-tags .k { margin: 0 4px 0 0; }
.seg3 { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.seg3 button { border: 0; border-right: 1px solid var(--border); background: var(--surface); padding: 6px 8px; font: 500 13px var(--font); color: var(--text-2); cursor: pointer; }
.seg3 button:last-child { border-right: 0; }
.seg3 button.on { background: var(--surface-3); color: var(--text); }
.fold-card { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.fold-hd { width: 100%; display: flex; align-items: center; gap: 8px; padding: 12px 14px; border: 0; background: var(--surface-2); font: 500 14px var(--font); color: var(--text); cursor: pointer; text-align: left; }
.fold-card.closed .fold-hd .chev { transform: rotate(-90deg); }
.fold-bd { padding: 6px 14px 10px; }
.fv2 { padding: 10px 0; }
.fv2 .k { font-size: 14px; color: #667085; margin-bottom: 4px; }
.fv2 .v { font-size: 13px; color: #344054; min-height: 22px; padding: 2px 6px; margin: 0 -6px; border-radius: 6px; cursor: text; word-break: break-word; }
.fv2 .v:hover { background: var(--surface-2); outline: 1px solid var(--border); }
.fv2 .v.none { color: var(--text-4); }
:root[data-theme="dark"] .fv2 .v { color: var(--text); } :root[data-theme="dark"] .fv2 .k { color: var(--text-3); }
/* centre */
.rc-tabs { display: flex; align-items: center; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--border); min-height: 48px; }
.rc-tabs > button:not(.icon-btn) { display: inline-flex; align-items: center; gap: 6px; height: 48px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; font: 500 14px var(--font); color: var(--text-2); cursor: pointer; }
.rc-tabs > button.on { color: var(--accent); border-bottom-color: var(--accent); }
.rc-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.rc-scroll { flex: 1; min-height: 0; overflow: auto; padding: 14px; }
.thread { display: flex; flex-direction: column; gap: 10px; }
.thread .day { align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; color: var(--text-2); margin: 6px 0; }
.bubble { max-width: 78%; padding: 10px 12px; border-radius: 12px; background: var(--surface-3); align-self: flex-start; display: grid; gap: 4px; }
.bubble.outbound { align-self: flex-end; background: var(--accent-weak); }
.bubble .bh { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 600; }
.bubble .bb { white-space: pre-wrap; word-break: break-word; font-size: 14px; color: var(--text); }
.rc-compose { padding: 10px 14px 14px; border-top: 1px solid var(--border); }
.cbar { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.cpick { display: flex; align-items: center; gap: 2px; padding: 0 10px; border: 0; border-right: 1px solid var(--border); background: transparent; color: var(--accent); cursor: pointer; border-radius: 8px 0 0 8px; height: 100%; min-height: 44px; }
.cinput { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; resize: none; padding: 12px; font: 14px var(--font); background: transparent; color: var(--text); min-height: 44px; outline: none; }
.csend { width: 52px; border: 0; border-radius: 0 7px 7px 0; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; }
.csend:disabled { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); cursor: default; }
.dd { position: relative; }
.dd-menu { position: absolute; top: calc(100% + 4px); right: 0; min-width: 220px; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: grid; gap: 2px; }
.dd-menu.up { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; max-height: 60vh; overflow: auto; }
.dd-menu button, .dd-menu a { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: 14px var(--font); text-align: left; cursor: pointer; }
.dd-menu button:hover, .dd-menu a:hover { background: var(--surface-2); text-decoration: none; }
.dd-menu button.on { background: var(--accent-weak); color: var(--accent); }
/* right */
.rr-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.rr-head h2 { margin: 0; font-size: 14px; font-weight: 500; color: var(--text); }
.rr-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); }
.rr-add { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--text-2); font: 500 13px var(--font); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.rr-add:hover { background: var(--surface-2); color: var(--text); }
.rr-scroll { flex: 1; min-height: 0; overflow: auto; padding: 8px 16px 16px; }
.ag { padding: 10px 0; border-bottom: 1px solid var(--border); }
.ag:last-child { border-bottom: 0; }
.ag-hd { display: flex; align-items: center; gap: 4px; }
.ag-t { border: 0; background: transparent; font: 500 13px var(--font); color: var(--text); cursor: pointer; padding: 0; }
.ag-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; min-width: 0; }
.ag-row a { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-empty { display: grid; justify-items: center; gap: 8px; padding: 14px 8px; text-align: center; }
.ag-empty b { font-size: 12px; font-weight: 600; color: var(--text); }
.ag-empty.big { padding: 36px 8px; }
.glyph-sm { color: var(--text-3); }
.btn.weak { background: var(--accent-weak); color: var(--accent); border-color: transparent; box-shadow: none; }
.pr { display: flex; align-items: flex-start; gap: 10px; padding: 9px 6px; margin: 0 -6px; border-radius: 8px; color: var(--text); }
.pr:hover { background: var(--surface-2); text-decoration: none; }
/* the rail inside the grid */
.rec-grid .side-icons { position: static; margin-left: 8px; align-self: start; }
@media (max-width: 1100px) { .rec-grid { padding: 8px; } }
.callsheet .cs-file .rec-page { height: calc(100vh - 150px); }
.callsheet .cs-file .rec-grid { padding: 0; }

/* Workspaces editor: the three cards as the Central File lays them out */
.si-sep { display: block; height: 1px; margin: 6px 8px; background: var(--border); }
a.si { display: grid; place-items: center; color: inherit; }
.ws-page { padding: 0; display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 0; flex: 1; }
.ws-nav { border-right: 1px solid var(--border); padding: var(--s3) var(--s2); overflow: auto; background: var(--surface); align-content: start; }
.ws-main { overflow: auto; padding: var(--s5); min-width: 0; }
.ws-name { font-size: 18px; font-weight: 600; max-width: 420px; }
.ws-layers { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.ws-layer { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.ws-layer + .ws-layer::before { content: ''; }
.ws-layer.here { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.unsaved { font: 600 14px var(--font); color: #B54708; background: #FFFAEB; padding: 4px 10px; border-radius: 6px; align-self: center; }
.ws-main { container-type: inline-size; }
.ws-board { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
@container (min-width: 620px) { .ws-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 980px) { .ws-board { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr); } }
@media (max-width: 900px) { .ws-page { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); } .ws-nav { border-right: 0; border-bottom: 1px solid var(--border); max-height: 180px; } }
.ws-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.ws-card select { max-width: 100%; }
.ws-card header h2 { margin: 0; font-size: 15px; font-weight: 600; }
.ws-card header p { margin: 2px 0 0; }
.ws-rail { border-style: dashed; }
.ws-pick select { width: 100%; }
.ws-list-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ws-rows { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ws-rows.inh { background: var(--surface-2); }
.ws-rows.inh .ws-row { opacity: .8; }
.ws-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-bottom: 1px solid var(--border); min-width: 0; font-size: 14px; }
.ws-row:last-child { border-bottom: 0; }
.ws-row.off span:not(.muted) { color: var(--text-4); text-decoration: line-through; }
.ws-row .icon-btn { width: 24px; height: 24px; }
.ws-row .icon-btn.on { color: var(--accent); }
.ws-widths { display: grid; gap: 10px; padding: 14px; }
.ws-widths .field { max-width: 180px; }

/* No room for three cards: the right panel floats over the centre card, beside the rail */
.rec-grid { position: relative; }
.rec-grid.overlay .rec-right { position: absolute; top: 12px; bottom: 12px; right: 72px; width: var(--rr); z-index: 20; box-shadow: var(--shadow-lg); }
.callsheet .cs-file .rec-grid.overlay .rec-right { top: 0; bottom: 0; right: 64px; }

/* the cascade marks the way to the current page */
.cascade-item.trail { color: var(--accent); }
.cascade-item.trail > span:first-child { color: var(--accent); }
.cascade-item.trail::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 45%, transparent); }

/* The header mega menu */
.domain-bar { z-index: 25; }
.domain-bar .dom-switch { position: static; }
.mega { position: absolute; top: calc(100% + 4px); left: 12px; right: 12px; max-width: 1180px; max-height: min(78vh, 720px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden; }
.mega-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.mega-search { flex: 1; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-3); }
.mega-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.mega-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 14px var(--font); color: var(--text); }
.mega-body { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 20px; padding: 14px 16px 18px; align-items: start; }
.mega-col { display: grid; gap: 2px; min-width: 0; }
.mega-records { grid-column: 1 / -1; padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.mega-hd { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 6px 8px; }
.mega-all { margin-left: auto; font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.mega-spaces { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.mega-space { border: 1px solid var(--border); border-radius: 10px; padding: 6px; display: grid; gap: 1px; align-content: start; min-width: 0; }
.mega-space.on { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: color-mix(in srgb, var(--accent-weak) 40%, var(--surface)); }
.mega-space-hd, .mega-sub, .mega-link { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; color: var(--text-2); font-size: 14px; min-width: 0; }
.mega-space-hd { color: var(--text); }
.mega-sub { padding-left: 38px; font-size: 13px; }
.mega-space-hd:hover, .mega-sub:hover, .mega-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.mega-sub.on, .mega-link.on { background: var(--accent-weak); color: var(--accent); }
.mega-space .ct, .mega-link .ct { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.mega-space-ft { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 6px 8px 2px; margin-top: 4px; border-top: 1px dashed var(--border); }
.mega-space-ft a { font-size: 12px; color: var(--text-3); }
.mega-space-ft a:hover { color: var(--accent); }
@media (max-width: 700px) { .mega { left: 6px; right: 6px; } .mega-body { grid-template-columns: 1fr; } }

/* cascade modes: push sits in the layout; overlay floats and collapses on its own */
.cascade-top { align-items: center; }
.cmode { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-3); gap: 2px; }
.cmode button { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font: 500 12px var(--font); cursor: pointer; }
.cmode button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.cascade.overlay { box-shadow: 0 12px 32px rgba(16,24,40,.18), 0 2px 6px rgba(16,24,40,.08); }

/* Fit: the stage and track step aside so the cards sit straight in the grid */
.rec-stage, .rec-track { display: contents; }
.rec-dots { display: none; }
/* Columns: a carousel of cards at their minimum widths, snapping into place; the rail stays put */
.rec-grid.columns { display: flex; gap: 8px; }
.rec-grid.columns .rec-stage { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.rec-grid.columns .rec-track { display: flex; gap: 12px; flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-padding: 0 12px;
  overscroll-behavior-x: contain; scrollbar-width: none; padding: 2px 2px 4px; outline: none; }
.rec-grid.columns .rec-track::-webkit-scrollbar { display: none; }
.rec-grid.columns .gutter { display: none; }
.rec-grid.columns .rec-card { flex: 0 0 auto; scroll-snap-align: center; transition: box-shadow .2s, border-color .2s, opacity .2s; }
.rec-grid.columns .rec-card:first-child { scroll-snap-align: start; }
.rec-grid.columns .rec-card:last-child { scroll-snap-align: end; }
/* every card leaves room for its neighbours to peek in (~200px, less on small screens) so you can tell there is more */
.rec-grid.columns .rec-track { --peek: clamp(40px, 16%, 200px); }
.rec-grid.columns .rec-card { width: calc(100% - 2 * (var(--peek) + 12px)); min-width: min(300px, 100%); max-width: 960px; }
.rec-grid.columns .rec-right { position: static; box-shadow: none; }
.rec-grid.columns .rec-card:not(.staged) { opacity: .82; }
.rec-grid.columns .rec-card.staged { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: 0 4px 16px rgba(16,24,40,.08); opacity: 1; }
.rec-grid.columns .side-icons { flex: none; margin-left: 0; }
.rec-grid.columns .rec-dots { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 0 0; flex: none; position: relative; }
.rec-dots .dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: var(--border-strong); cursor: pointer; transition: width .25s ease, background .25s ease; }
.rec-dots .dot:hover { background: var(--text-3); }
.rec-dots .dot.on { width: 24px; background: var(--accent); }
.rec-dots .dot-arrow { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); cursor: pointer; }
.rec-dots .dot-arrow:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.rec-dots .dot-arrow:disabled { opacity: .3; cursor: default; }
.rec-dots .dot-label { position: absolute; right: 4px; font-size: 12px; color: var(--text-3); max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .rec-dots .dot-label { display: none; } }
@media (prefers-reduced-motion: reduce) { .rec-grid.columns .rec-track { scroll-behavior: auto; } .rec-dots .dot { transition: none; } }

/* Split view: the chosen cards share the frame; the rest step out of it */
.rec-grid.columns.split .rec-track { scroll-snap-type: none; }
.rec-grid.columns.split .rec-card:not(.in-split) { display: none; }
.rec-grid.columns.split .rec-card.in-split { flex: 1 1 0; width: auto !important; min-width: 300px; opacity: 1; box-shadow: none; border-color: var(--border); }
.rec-dots .dot.on + .dot.on { margin-left: -2px; }
.rec-dots .dot-hint { position: absolute; left: 4px; font-size: 12px; color: var(--text-4); }
.split-chip { position: absolute; right: 4px; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px 0 10px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 999px; background: var(--accent-weak); color: var(--accent); font: 600 12px var(--font); cursor: pointer; }
.split-chip:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
@media (max-width: 760px) { .rec-dots .dot-hint { display: none; } .rec-grid.columns.split .rec-card.in-split { min-width: 240px; width: auto !important; } }

/* A panel that isn't in view slides in over the cards (Columns mode) */
.rec-grid.columns .rec-stage { position: relative; }
.slide-scrim { position: absolute; inset: 0 0 34px 0; background: rgba(16,24,40,.12); border-radius: 12px; z-index: 24; pointer-events: none; }
.rec-grid.columns .rec-card.rec-right.slide { display: flex; position: absolute; top: 2px; bottom: 38px; right: 2px; width: min(420px, calc(100% - 24px)) !important; z-index: 25; opacity: 1;
  border-color: var(--border); box-shadow: -12px 0 32px rgba(16,24,40,.16), 0 2px 6px rgba(16,24,40,.08); animation: slide-in .22s cubic-bezier(.2,.8,.2,1); }
@keyframes slide-in { from { transform: translateX(calc(100% + 24px)); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .rec-grid.columns .rec-card.rec-right.slide { animation: none; } }
/* Split view keeps its gutters: drag to share the frame differently */
.rec-grid.columns.split .rec-track { gap: 0; }
.rec-grid.columns.split .gutter.on { display: block; flex: none; width: 10px; }
.rec-grid.columns.split .rec-card.in-split { min-width: 260px; }

/* Card sizes (view options): mobile cards keep a phone's width; content cards expand */
.rec-grid.columns .rec-card.content { min-width: min(var(--cmin, 480px), 100%); }
.rec-grid.columns .rec-card.mobile { width: var(--mw, 400px); min-width: min(var(--mw, 400px), 100%); max-width: var(--mw, 400px); }
.rec-grid.columns.split .rec-track { justify-content: center; }
.rec-grid.columns.split .rec-card.in-split.mobile { flex: 0 0 var(--mw, 400px); width: var(--mw, 400px) !important; min-width: 0; }
.rec-grid.columns.split .rec-card.in-split.content { min-width: min(var(--cmin, 480px), 100%); }
.rec-grid.columns .rec-card.rec-right.slide.mobile { width: min(var(--mw, 400px), calc(100% - 24px)) !important; max-width: none; }
.rec-grid.columns .rec-card.rec-right.slide.content { width: min(820px, calc(100% - 24px)) !important; max-width: none; }

.ws-sizes .ws-row { gap: 6px; }
.ws-sizes select.input.sm { width: 104px; height: 30px; padding: 0 6px; font-size: 13px; }
.ws-sizes input.input.sm { width: 76px; height: 30px; padding: 0 6px; font-size: 13px; }
.ws-sizes .origin { font-size: 11px; }
fieldset.view-opts { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px 12px; margin: 4px 0; }
fieldset.view-opts legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 700px) { .grid3 { grid-template-columns: 1fr; } }

/* cards drawn from the object's Cards: each fills its card frame */
.card-fill { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
/* the Pipeline card */
.pc-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.pc-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.pc-scroll { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 16px; }
.stage-track { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
.stage-track li { flex: 1 1 0; min-width: 84px; }
.stage-track .stage { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 34px; padding: 0 14px 0 18px; border: 0; background: var(--surface-3);
  color: var(--text-2); font: 500 13px var(--font); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); cursor: pointer; }
.stage-track li:first-child .stage { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 6px 0 0 6px; padding-left: 12px; }
.stage-track button.stage:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 16%, var(--surface-3)); color: var(--text); }
.stage-track .stage.done { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--accent); }
.stage-track .stage.on { background: var(--accent); color: #fff; font-weight: 600; }
.stage-track .stage i { font-style: normal; font-size: 11px; padding: 0 6px; border-radius: 999px; background: rgba(255,255,255,.25); }
.stage-track.sm .stage { height: 26px; font-size: 12px; cursor: default; }
.stage-track.sm .stage:not(.on) i { background: var(--surface); }
.pipe { display: grid; gap: 10px; }
.pipe-board { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pipe-col { flex: 0 0 180px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px; display: grid; gap: 6px; align-content: start; }
.pipe-col-hd { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 2px 4px; }
.pipe-col-hd .ct { margin-left: auto; color: var(--text-3); }
.pipe-opp { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px; display: grid; gap: 4px; min-width: 0; }
.pipe-opp a { font-size: 13px; font-weight: 500; }
.pipe-opp select { width: 100%; }
.pipe-empty { color: var(--text-4); text-align: center; font-size: 12px; padding: 6px; }

/* An object's Cards, and the catalog */
.oc-lines { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; align-items: start; }
.oc-line .hd { display: grid; gap: 2px; }
.oc-list { list-style: none; margin: 0; padding: 4px 8px 8px; display: grid; gap: 2px; }
.oc-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; min-width: 0; }
.oc-row:hover { background: var(--surface-2); }
.oc-row.off { opacity: .55; }
.oc-n { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: var(--surface-3); font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cc-kind { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 8px; align-content: start; }
.cc-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-weak); color: var(--accent); flex: none; }

/* The Pipeline card: a narrow vertical stack of stage blocks */
.pipe-card .pc-head { padding: 12px 12px; gap: 6px; }
.pipe-card .pc-head h2 { flex: 1; font-size: 13px; }
.pipe-card .pc-scroll { padding: 10px; }
.pc-field { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: 0 2px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pstack { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; position: relative; }
.pstack::before { content: ''; position: absolute; left: 19px; top: 14px; bottom: 14px; width: 2px; background: var(--border); }
.pblock { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text-2); font: 500 13px var(--font); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.pblock:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.pb-dot { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 700; }
.pb-txt { display: grid; min-width: 0; line-height: 1.25; }
.pb-sub { font-size: 11px; color: var(--text-3); font-weight: 500; }
.pblock.current { border-color: var(--accent); background: var(--accent-weak); color: var(--accent); font-weight: 600; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.pblock.current .pb-dot { background: var(--accent); color: #fff; }
.pblock.current .pb-sub { color: var(--accent); }
.pblock.next { border-style: dashed; border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); color: var(--text); }
.pblock.later { color: var(--text-3); background: var(--surface-2); }
.pblock.done, .pblock.fold { min-height: 34px; color: var(--text-3); background: var(--surface-2); }
.pblock.done .pb-dot, .pblock.fold .pb-dot { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: var(--accent); width: 22px; height: 22px; }
.pc-less { border: 0; background: transparent; color: var(--accent); padding: 6px 2px 0; cursor: pointer; }
.pc-hint { margin: 8px 2px 0; }
.rec-grid .rec-card[data-kind="pipeline"] .ag-empty { padding: 12px 4px; }
/* a stage's slide-out */
.pipe-slide { position: absolute; top: 12px; bottom: 12px; z-index: 26; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column;
  box-shadow: 0 16px 40px rgba(16,24,40,.18), 0 2px 6px rgba(16,24,40,.08); animation: ps-in .2s cubic-bezier(.2,.8,.2,1); }
@keyframes ps-in { from { transform: translateX(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pipe-slide { animation: none; } }
.rec-grid.columns .pipe-slide { bottom: 38px; }
.ps-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 12px; border-bottom: 1px solid var(--border); }
.ps-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.ps-status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); flex: none; }
.ps-status.current { background: var(--accent); color: #fff; }
.ps-status.next { background: var(--accent-weak); color: var(--accent); }
.ps-body { flex: 1; min-height: 0; overflow: auto; padding: 14px; display: grid; gap: 12px; align-content: start; }
.ps-sec { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.ps-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ps-steps li { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.ps-n { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 999px; background: var(--surface-3); font-size: 11px; font-weight: 700; color: var(--text-2); }

/* Settings › Facilities */
.fac-page { padding: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 0; flex: 1; }
.fac-nav { border-right: 1px solid var(--border); padding: var(--s3) var(--s2); overflow: auto; background: var(--surface); align-content: start; }
.fac-main { overflow: auto; padding: var(--s5); min-width: 0; }
.dot-st { width: 8px; height: 8px; border-radius: 999px; background: var(--border-strong); margin-left: auto; flex: none; }
.dot-st.on { background: #12B76A; }
.fac-h { margin: 0 0 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.fac-svcs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.fac-svc { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: grid; gap: 8px; align-content: start; }
.chip.warn { background: #FFFAEB; color: #B54708; }
.fac-types { display: flex; flex-wrap: wrap; gap: 4px 14px; max-height: 120px; overflow: auto; }
@media (max-width: 900px) { .fac-page { grid-template-columns: 1fr; } .fac-nav { border-right: 0; border-bottom: 1px solid var(--border); } }

/* The Activity switcher (the logo) */
.act-switch { position: relative; display: flex; justify-content: center; }
.rail-brand { display: grid; justify-items: center; gap: 2px; border: 0; background: transparent; cursor: pointer; padding: 0; }
.act-chip { max-width: 56px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.act-pop { position: absolute; left: calc(100% + 8px); top: 0; width: 340px; max-height: 80vh; overflow: auto; z-index: 60; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: grid; gap: 2px; }
.act-hd { display: grid; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.act-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; color: var(--text); font: 14px var(--font); }
.act-item > span:last-child { display: grid; gap: 2px; }
.act-item:hover { background: var(--surface-2); }
.act-item.on { background: var(--accent-weak); }
.act-ico { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); }
.act-item.on .act-ico { background: var(--accent); color: #fff; }
.act-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* The Org-context switcher (beside Records) */
.org-switch { position: relative; display: flex; align-items: center; margin-right: -8px; }
.org-btn { background: var(--surface-2); }
.org-menu { left: 0; right: auto; top: calc(100% + 4px); min-width: 280px; max-height: 70vh; overflow: auto; }
.chip.sm { font-size: 10px; padding: 1px 6px; }
.chip.off { opacity: .5; text-decoration: line-through; }
/* Organization */
.org-roles { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) { .org-roles { grid-template-columns: 1fr; } }
.act-cell { min-width: 64px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font: 600 12px var(--font); cursor: pointer; color: var(--text-3); }
.act-cell.on { background: #ECFDF3; color: #067647; border-color: #ABEFC6; }
.act-cell.off { background: #FEF3F2; color: #B42318; border-color: #FECDCA; }
.act-cell.inherit.is-off { color: #B42318; }
/* Inbox */
.inbox-item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }
.inbox-item.awaiting { border-left: 3px solid #F79009; }
.inbox-item.assigned { border-left: 3px solid var(--accent); }

/* The Pipeline card on the stage is a control surface: no card frame — its stage blocks stand on the page */
.rec-grid .rec-card[data-kind="pipeline"], .rec-grid.columns .rec-card[data-kind="pipeline"].staged, .rec-grid.columns .rec-card[data-kind="pipeline"] {
  background: transparent; border: 0; box-shadow: none; border-radius: 0; opacity: 1; }
.rec-card[data-kind="pipeline"] .pc-head { padding: 4px 2px 10px; border-bottom: 0; }
.rec-card[data-kind="pipeline"] .pc-head h2 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.rec-card[data-kind="pipeline"] .pc-scroll { padding: 0 2px 8px; }
.rec-card[data-kind="pipeline"] .pc-field { display: none; }
.rec-card[data-kind="pipeline"] .pstack { gap: 8px; }
.rec-card[data-kind="pipeline"] .pstack::before { display: none; }
.rec-card[data-kind="pipeline"] .pblock { min-height: 48px; border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.06); }
.rec-card[data-kind="pipeline"] .pblock:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(16,24,40,.10); }
.rec-card[data-kind="pipeline"] .pblock.later { background: var(--surface); }
.rec-card[data-kind="pipeline"] .pblock.current { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent), 0 4px 12px rgba(21,94,239,.18); }
.rec-card[data-kind="pipeline"] .pblock.done, .rec-card[data-kind="pipeline"] .pblock.fold { min-height: 36px; background: color-mix(in srgb, var(--surface) 70%, transparent); box-shadow: none; }
.rec-card[data-kind="pipeline"] .pblock { transition: transform .12s, box-shadow .15s, border-color .15s; }
@media (prefers-reduced-motion: reduce) { .rec-card[data-kind="pipeline"] .pblock { transition: none; } .rec-card[data-kind="pipeline"] .pblock:hover { transform: none; } }

/* long-press reordering (dots, rail icons) */
[x-reorder] [data-reorder] { touch-action: none; }
.reordering { cursor: grabbing; }
[data-reorder].dragging { position: relative; z-index: 5; transition: none !important; box-shadow: 0 6px 16px rgba(16,24,40,.25); }
.rec-dots .dot.dragging { width: 26px; height: 12px; background: var(--accent); }
.side-icons .si.dragging { background: var(--surface); outline: 2px solid var(--accent); }
.reordering [data-reorder].drop-before { box-shadow: -3px 0 0 var(--accent); }
.side-icons.reordering [data-reorder].drop-before { box-shadow: 0 -3px 0 var(--accent); }
.side-icons .si.docked { position: relative; }
.side-icons .si.docked::after { content: ''; position: absolute; left: 4px; top: 50%; width: 3px; height: 14px; transform: translateY(-50%); border-radius: 2px; background: var(--accent); }

/* sign-in */
.signin-page { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 16px; }
.signin-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow-lg); }
.signin-card h1 { margin: 0; font-size: 22px; }
.signin-brand { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.signin-brand .mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 800; }
.alert.danger { background: #FEF3F2; color: #B42318; border: 1px solid #FECDCA; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.setup-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: #FFFAEB; color: #B54708; font-size: 13px; border-bottom: 1px solid #FEDF89; }
.setup-bar span:nth-child(2) { flex: 1; }
.org-me { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; border-top: 1px solid var(--border); margin-top: 4px; }

/* the action bar: just the text block (and a drop zone); the action's other fields open in a modal */
.rc-compose { position: relative; }
.cmore { width: 36px; border: 0; border-left: 1px solid var(--border); background: transparent; color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.cmore:hover { background: var(--surface-2); color: var(--text); }
.rc-compose.dropping .cbar { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.drop-hint { position: absolute; inset: 6px 10px 10px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--accent); border-radius: 10px;
  background: color-mix(in srgb, var(--accent-weak) 85%, transparent); color: var(--accent); pointer-events: none; }

/* The drill-down: a page's levels as stacked cards in a scrolling track (Finder's column view) */
.drill-page { display: flex; flex-direction: column; height: 100vh; min-height: 0; }
.drill-track { --peek: clamp(24px, 6%, 120px); flex: 1; min-height: 0; display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; padding: 12px 16px 6px;
  scrollbar-width: none; overscroll-behavior-x: contain; }
.drill-track::-webkit-scrollbar { display: none; }
.drill-card { flex: 0 0 auto; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  scroll-snap-align: center; transition: border-color .2s, box-shadow .2s, opacity .2s; }
.drill-card:first-child { scroll-snap-align: start; }
.drill-card:last-child { scroll-snap-align: end; }
.drill-card.mobile { width: min(380px, calc(100% - 40px)); }
.drill-card.content { width: min(960px, calc(100% - 2 * var(--peek) - 24px)); min-width: min(480px, calc(100% - 40px)); }
.drill-card.focus { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: 0 4px 16px rgba(16,24,40,.08); }
.drill-card:not(.focus) { opacity: .9; }
.drill-hd { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); min-height: 52px; }
.drill-hd h2 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drill-bd { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px 16px; }
.drill-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: 14px var(--font); min-width: 0; }
.drill-row:hover { background: var(--surface-2); }
.drill-row.on { background: var(--accent-weak); color: var(--accent); }
.drill-row .ct { margin-left: auto; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.drill-row .chev { color: var(--text-4); flex: none; }
.drill-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 10px 10px 4px; }
.drill-nav { display: flex; align-items: center; gap: 12px; padding: 4px 16px 10px; min-height: 36px; }
.drill-crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; overflow: hidden; }
.drill-crumb { display: inline-flex; align-items: center; gap: 2px; min-width: 0; color: var(--text-4); }
.drill-crumb button { border: 0; background: transparent; padding: 2px 6px; border-radius: 6px; font: 13px var(--font); color: var(--text-2); cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drill-crumb button:hover { background: var(--surface-2); }
.drill-crumb button.on { color: var(--text); font-weight: 600; }
.drill-dots { display: flex; padding: 0; position: static; }
.sys-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 18px; }
.sys-fields .k { font-size: 12px; color: var(--text-3); }
.sys-fields .v { font-size: 14px; color: var(--text); word-break: break-word; }
.sys-sec { margin-top: 18px; }
.sys-sec h3 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
@media (max-width: 700px) { .drill-nav .drill-crumbs { display: none; } }

/* pages whose lists became drill cards */
.drill-card.nav.drill-list { overflow: auto; padding: 8px; align-content: start; display: grid; gap: 2px; background: var(--surface); }
.drill-card.drill-pad { overflow: auto; padding: var(--s5); display: block; }
.drill-inline { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 360px; margin: 0 -16px; }
.drill-card .drill-bd > .stack > .card { box-shadow: none; }

/* drill cards hold sections, not cards in cards: inner cards lose their frame and sit as sections; the scrollbar keeps its own gutter */
.drill-bd, .drill-card.drill-pad { scrollbar-width: thin; scrollbar-gutter: stable; padding-bottom: 28px; }
.drill-card .drill-bd.stack { padding: 0; gap: 0; }
.drill-card .drill-bd > .stack { gap: 0; }
.drill-card .drill-bd > .stack > .card, .drill-card .drill-bd > .card { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.drill-card .drill-bd > .stack > .card + .card { border-top: 1px solid var(--border); }
.drill-card .drill-bd > .stack > .card > .hd { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.drill-card .drill-bd > .stack > .card .t thead th { position: sticky; top: 56px; z-index: 1; }
.drill-card .list-row:focus-visible, .drill-card .drill-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* the action bar's stack: one tab per action, sent together */
.cstack { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.ctab { display: inline-flex; align-items: center; gap: 5px; max-width: 180px; height: 28px; padding: 0 4px 0 9px; border: 1px solid var(--border); border-radius: 8px 8px 2px 2px;
  background: var(--surface-2); color: var(--text-2); font: 500 12px var(--font); cursor: pointer; }
.ctab.on { background: var(--surface); color: var(--accent); border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.ctab.warn:not(.on) { border-color: #FEC84B; }
.ctab-x { display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 4px; background: transparent; color: var(--text-3); cursor: pointer; }
.ctab-x:hover { background: var(--surface-3); color: var(--text); }
.cbar-fields { display: flex; gap: 6px; flex-wrap: wrap; }
.cbar-fields .cbf { flex: 1 1 180px; min-width: 0; }
.cbar-fields .cbf input, .cbar-fields .cbf select { width: 100%; }
.csend { position: relative; }
.csend-n { position: absolute; top: 3px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #fff; color: var(--accent); font: 700 10px/16px var(--font); font-style: normal; }
.tpl-menu { left: auto; right: 0; min-width: 280px; }
.dd-menu.up.tpl-menu { left: auto; right: 0; }

.dry-call { display: grid; gap: 4px; padding: 8px 10px; border: 1px dashed var(--border-strong); border-radius: 8px; }
.dry-call pre { margin: 0; max-height: 160px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 6px; white-space: pre-wrap; word-break: break-word; }

/* Settings › Activity */
.act-filters { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px 0; }
.act-ev { align-items: flex-start; }
.act-when { flex: none; width: 76px; padding-top: 2px; }
.act-pre { margin: 0; max-height: 280px; overflow: auto; background: var(--surface-2); padding: 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; }

/* ── drill-downs, reworked: cards fill the width when they fit, scroll only when they don't, and can be resized ── */
.drill-track { scroll-snap-type: none; gap: 10px; padding: 12px 16px 8px; }
.drill-card { position: relative; transition: border-color .2s, box-shadow .2s; }
.drill-card:not(.focus) { opacity: 1; }
.drill-card.mobile { width: 380px; flex: 0 0 auto; }
.drill-card.content { width: 720px; min-width: 420px; flex: 0 0 auto; }
.drill-card.drill-last { flex: 1 0 auto; width: auto; min-width: min(560px, calc(100% - 40px)); }
.drill-card.mobile.drill-last { min-width: 380px; max-width: none; }
.drill-card.focus { border-color: var(--border); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent), 0 6px 18px rgba(16,24,40,.07); }
.drill-handle { position: absolute; top: 0; right: -8px; bottom: 0; width: 10px; cursor: col-resize; z-index: 3; }
.drill-handle::after { content: ''; position: absolute; top: 50%; left: 4px; width: 3px; height: 36px; border-radius: 3px; transform: translateY(-50%); background: var(--border-strong); opacity: 0; transition: opacity .15s; }
.drill-card:hover > .drill-handle::after, .drill-card.resizing > .drill-handle::after { opacity: 1; }
.drill-handle:hover::after, .drill-card.resizing > .drill-handle::after { background: var(--accent); }
.drill-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; padding: 2px 16px 10px; min-height: 34px; }
.drill-nav .drill-dots { justify-self: center; }
.drill-nav.single .drill-dots { display: none; }

/* ── form fields: one polished set ── */
.input, .select, textarea { border-radius: 8px; border-color: var(--border-strong); background-color: var(--surface); box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.input:hover:not(:disabled):not(:focus), .select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: color-mix(in srgb, var(--text-3) 55%, var(--border-strong)); }
.input:focus, .select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent), 0 1px 2px rgba(16,24,40,.05); }
.input:disabled, .select:disabled, textarea:disabled { background-color: var(--surface-2); color: var(--text-3); box-shadow: none; cursor: not-allowed; }
.input.sm, .select.sm { height: 32px; font-size: 13px; padding: 0 10px; border-radius: 7px; }
select.select, select.input { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
select.select.sm, select.input.sm { padding-right: 28px; background-position: right 8px center; background-size: 14px; }
:root[data-theme="dark"] select.select, :root[data-theme="dark"] select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2398A2B3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
textarea { padding: 9px 12px; line-height: 1.45; }
.field { display: grid; gap: 6px; font: 500 13px var(--font); color: var(--text-2); }
.field > .hint, .field .hint { font-weight: 400; color: var(--text-3); font-size: 12px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
input[type="number"].input { font-variant-numeric: tabular-nums; }
/* search: the icon centred in the field, whatever its size */
.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search > span:first-child, .search > .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; z-index: 1; }
.search > span:first-child svg, .search > .icon svg { width: 16px; height: 16px; }
.search .input { padding-left: 34px !important; }
.search .input.sm { padding-left: 32px !important; }
.drill-card.content:not(.drill-last) { width: clamp(420px, 40%, 640px); }
.drill-card.mobile:not(.drill-last) { width: clamp(300px, 30%, 380px); }
.drill-card.drill-last { min-width: min(480px, calc(100% - 24px)); }
.drill-handle { right: -6px; width: 8px; }
.drill-card.drill-last { flex: 1 1 0; width: auto; }

/* a drill level shown over the stage: slide-in (no scrim), drawer (with a scrim), or modal */
.drill-card.as-slide, .drill-card.as-drawer { position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(640px, calc(100vw - 120px)) !important; min-width: 0 !important; z-index: 46;
  box-shadow: -16px 0 40px rgba(16,24,40,.18), 0 2px 8px rgba(16,24,40,.08); animation: drill-slide .22s cubic-bezier(.2,.8,.2,1); }
.drill-card.as-drawer { top: 0; right: 0; bottom: 0; border-radius: 12px 0 0 12px; width: min(820px, calc(100vw - 80px)) !important; z-index: 48; }
.drill-card.as-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(760px, calc(100vw - 48px)) !important; min-width: 0 !important;
  height: min(80vh, 760px); z-index: 48; box-shadow: 0 24px 64px rgba(16,24,40,.28); animation: drill-pop .18s ease-out; }
@keyframes drill-slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes drill-pop { from { transform: translate(-50%, -48%) scale(.98); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drill-card.as-slide, .drill-card.as-drawer, .drill-card.as-modal { animation: none; } }
.drill-card .drill-x { position: absolute; top: 12px; right: 12px; z-index: 4; background: var(--surface); }
.drill-card.as-slide .drill-hd, .drill-card.as-drawer .drill-hd, .drill-card.as-modal .drill-hd { padding-right: 52px; }
.drill-card.as-slide > .drill-handle, .drill-card.as-drawer > .drill-handle, .drill-card.as-modal > .drill-handle { display: none; }
.drill-scrim { position: fixed; inset: 0; background: rgba(16,24,40,.32); z-index: 47; }
.drill-mode-menu { position: fixed; top: auto; right: auto; min-width: 200px; z-index: 60; }
.rec-dots .dot.over { background: color-mix(in srgb, var(--accent) 40%, var(--border-strong)); outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 1px; }
.search > span:first-child .icon, .search > span:first-child svg { position: static !important; top: auto; left: auto; }

.pol-emit { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.pol-emit .input, .pol-emit .select { background-color: var(--surface); }

/* drill dots: one row, evenly spaced, nothing touching */
.drill-nav .drill-dots { display: flex; align-items: center; gap: 8px; }
.drill-nav .drill-dots .dot { flex: none; display: block; height: 8px; margin: 0; }
.drill-nav .drill-dots .dot.on + .dot.on { margin-left: 0; }
.drill-nav .drill-dots .dot.over { outline: 0; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }

/* slide-ins sit like the cascade menu: flush, full height, pinned to the side they come in from; stacked levels share
   the one panel — the deepest shows, a back row returns to the one under it */
.drill-card.as-slide { top: 0; bottom: 0; right: 0; left: auto; border-radius: 0; border: 0; border-left: 1px solid var(--border);
  width: min(560px, calc(100vw - 96px)) !important; z-index: 46; box-shadow: var(--shadow-lg); }
.drill-card.as-slide.from-left { right: auto; left: 64px; border-left: 0; border-right: 1px solid var(--border); animation-name: drill-slide-l; }
.shell:has(.cascade.pinned:not([style*="display: none"])) .drill-card.as-slide.from-left { left: 364px; }
.drill-card.as-slide.slide-under { visibility: hidden; pointer-events: none; animation: none; }
.drill-card.as-slide:has(> .slide-back) { animation: drill-cascade .18s cubic-bezier(.2,.8,.2,1); }
.slide-back { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); font: 500 13px var(--font); text-align: left; cursor: pointer; flex: none; }
.slide-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-back:hover { color: var(--text); background: var(--surface-3); }
.slide-back:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.drill-card.as-slide:has(> .slide-back) > .drill-x { top: 52px; }
@keyframes drill-slide-l { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes drill-cascade { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drill-card.as-slide.from-left, .drill-card.as-slide:has(> .slide-back) { animation: none; } }

/* Settings › Events */
.ev-filters { display: grid; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.ev-filters .select { flex: 1; min-width: 0; }
.ev-filters .search, .ev-filters .search .input { width: 100%; }
.ev-row { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; color: inherit; }
.ev-kind { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font: 600 11px var(--font); flex: none; background: var(--accent-weak); color: var(--accent); }
.ev-kind.command { background: var(--warn-weak); color: var(--warn); }
.ev-tally { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); flex: none; }
.ev-tally > span { display: inline-flex; align-items: center; gap: 3px; }
.warn-t { color: var(--warn); }
.danger-t { color: var(--danger); }
.ev-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ev-meta > div { display: grid; gap: 2px; min-width: 0; }
.ev-meta b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-t { font: 600 11px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 6px; }
.ev-fields { display: grid; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ev-field { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(90px, 1fr) minmax(80px, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; }
.ev-field + .ev-field { border-top: 1px solid var(--border); }
.ev-frows { display: grid; gap: 8px; }
.ev-fwrap { display: grid; gap: 6px; }
.ev-frow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 132px 52px 92px; gap: 6px; align-items: center; }
.ev-frow.hd { padding: 0 2px; }
.ev-frow input[type=checkbox] { justify-self: center; }
.ev-raise { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.ev-raise .input, .ev-raise .select { background-color: var(--surface); }
.ev-result { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--ok-weak); color: var(--ok); }
.form-err { padding: 8px 12px; border-radius: 8px; background: var(--danger-weak, #FEE4E2); color: var(--danger, #B42318); font-size: 13px; }
@media (max-width: 640px) { .ev-frow { grid-template-columns: 1fr 1fr; } .ev-frow.hd { display: none; } .ev-field { grid-template-columns: 1fr 1fr; } }

/* Settings › Labels & translation */
.lb-ed { display: flex; align-items: center; gap: 6px; }
.lb-langs { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; margin-top: var(--s3); }
.lb-lang { display: grid; gap: 3px; min-width: 150px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.lb-lang:hover { border-color: var(--border-strong); }
.lb-lang.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.lb-lang .meter { height: 4px; }
.lb-collect { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; align-self: center; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-weak); }
.lb-filters { display: grid; grid-template-columns: minmax(0, 1fr) 190px 150px 150px; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.lb-filters .search, .lb-filters .search .input { width: 100%; }
.lb-bulk { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--accent-weak); border-bottom: 1px solid var(--border); }
.lb-head { display: grid; grid-template-columns: 20px minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.lb-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.lb-row.on { background: var(--accent-weak); }
.lb-row.dim { opacity: .6; }
.lb-row > input[type=checkbox], .lb-head > input[type=checkbox] { margin-top: 3px; }
.lb-src { display: grid; gap: 4px; min-width: 0; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.lb-src:hover .lb-text { color: var(--accent); }
.lb-text { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.lb-meta { display: flex; gap: 6px; align-items: center; min-width: 0; flex-wrap: wrap; }
.lb-meta .chip { font-size: 11px; padding: 1px 6px; }
.lb-ph { font-family: var(--mono, ui-monospace, monospace); font-size: .88em; padding: 0 3px; border-radius: 4px; background: var(--warn-weak); color: var(--warn); }
.lb-edit { position: relative; display: grid; gap: 4px; }
.lb-edit textarea { resize: none; min-height: 34px; overflow: hidden; line-height: 1.4; padding-right: 28px; }
.lb-edit textarea.bad { border-color: var(--danger); }
.lb-st { position: absolute; right: 8px; top: 8px; color: var(--text-3); pointer-events: none; }
.lb-st.ok { color: var(--ok); }
.lb-st.err { color: var(--danger); }
.lb-st.busy .icon { animation: spin 1s linear infinite; }
.lb-err { color: var(--danger); }
.lb-source { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.lb-place { padding: 3px 0; overflow-wrap: anywhere; color: var(--text-2); }
.lb-lrows { display: grid; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.lb-lrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 14px; align-items: center; padding: 10px 14px; }
.lb-lrow + .lb-lrow { border-top: 1px solid var(--border); }
.lb-show { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) { .lb-filters { grid-template-columns: 1fr 1fr; } .lb-filters .search { grid-column: 1 / -1; } .lb-row, .lb-head { grid-template-columns: 20px minmax(0, 1fr); } .lb-edit { grid-column: 2; } .lb-head > span:last-child { display: none; } }

/* the inbox's other sources */
.inbox-h { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font: 600 13px var(--font); color: var(--text-2); }
.inbox-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.inbox-row:hover { border-color: var(--border-strong); }
.inbox-main { flex: 1; min-width: 0; display: grid; gap: 2px; color: inherit; text-decoration: none; }
.inbox-check { flex: none; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: transparent; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.inbox-check:hover { border-color: var(--ok); color: var(--ok); }
.inbox-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.consent-grid { padding: 4px 10px 8px; }
.consent-grid .t td, .consent-grid .t th { text-align: center; padding: 6px 8px; }
.consent-grid .t td:first-child, .consent-grid .t th:first-child { text-align: left; }

.plan-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; counter-reset: st; }
.plan-steps li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.plan-steps li .badge { flex: none; margin-top: 1px; }

.lb-slug { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.lb-id { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 12px; }
.lb-id .field > span:first-child { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.lb-uuid { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-phs { display: grid; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.lb-ph-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: center; padding: 8px 12px; }
.lb-ph-row + .lb-ph-row { border-top: 1px solid var(--border); }
.lb-ph-row.hd { padding-bottom: 4px; }
.lb-examples { display: grid; gap: 6px; }
.lb-example { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); font-size: 14px; line-height: 1.45; }
.lb-ex { font-weight: 600; color: var(--accent); }
@media (max-width: 640px) { .lb-id, .lb-ph-row { grid-template-columns: 1fr; } }

/* presenters */
.pv-color { display: inline-flex; align-items: center; gap: 8px; }
.pv-color i { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--border-strong); flex: none; }
.pv-color code { font-size: 12px; color: var(--text-2); }
.pv-pick input[type=color] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; flex: none; }

/* Access & grants: what each scope is for */
.gr-feats { display: grid; gap: 6px; }
.gr-feat { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.gr-feat.on { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: var(--ok-weak); }
.gr-feat input { margin-top: 3px; }

/* Settings › Calendars */
.cal-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-weak); color: var(--accent); flex: none; }
.cal-row { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; color: inherit; }
.cal-now { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.cal-now-i, .cal-ahead > div { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.cal-now-i b, .cal-ahead b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cal-ahead { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.cal-days { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-day { min-width: 48px; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-2); font: 500 13px var(--font); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.cal-day.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cal-day:focus-visible, .cal-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-grid { display: grid; grid-template-columns: 34px repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { font: 600 11px var(--font); color: var(--text-3); text-align: center; text-transform: uppercase; padding-bottom: 2px; }
.cal-wk { display: grid; place-items: center; font-size: 11px; color: var(--text-3); grid-column: 1; }
.cal-cell { height: 38px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: 500 13px var(--font); cursor: pointer; }
.cal-cell.blank { border-color: transparent; background: transparent; cursor: default; }
.cal-cell.off { background: var(--surface-2); color: var(--text-3); }
.cal-cell.closed { background: var(--danger-weak); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.cal-cell.half { background: var(--warn-weak); color: var(--warn); }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 700; }
.cal-key { display: flex; gap: 14px; margin-top: 8px; }
.cal-key span { display: inline-flex; align-items: center; gap: 6px; }
.cal-sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border); background: var(--surface); display: inline-block; }
.cal-sw.off { background: var(--surface-2); }
.cal-sw.closed { background: var(--danger-weak); border-color: var(--danger); }
.cal-sw.half { background: var(--warn-weak); border-color: var(--warn); }
.cal-closure { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); margin-top: 8px; }
.cal-closure .input { background-color: var(--surface); }

/* an operator signed in as someone (Tenancy's operator links) */
.operator-banner { position: sticky; top: 0; z-index: 60; padding: 6px 16px; background: var(--warn-weak); color: var(--warn); border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); font-size: 13px; text-align: center; }
.operator-banner button { margin-left: 8px; border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 6px; padding: 1px 8px; font: inherit; cursor: pointer; }

/* Insights (Smart Scoring) */
.ins-tabs { margin-top: var(--s3); flex-wrap: wrap; }
.ins-tabs button { display: inline-flex; gap: 6px; align-items: center; }
.ins-row { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; color: inherit; }
.ins-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-weak); color: var(--c, var(--accent)); flex: none; }
.ins-band { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; background: var(--accent-weak); color: var(--accent); font: 600 12px var(--font); white-space: nowrap; }
.ins-band.sm { padding: 1px 7px; font-size: 11px; min-width: 22px; justify-content: center; }
.ins-bar { display: flex; height: 22px; border-radius: 8px; overflow: hidden; gap: 2px; }
.ins-bar i { display: grid; place-items: center; min-width: 18px; background: color-mix(in srgb, var(--accent) 70%, transparent); color: #fff; font: 600 11px var(--font); font-style: normal; }
.ins-bar i:nth-child(2) { background: color-mix(in srgb, var(--accent) 50%, transparent); } .ins-bar i:nth-child(3) { background: color-mix(in srgb, var(--accent) 32%, transparent); } .ins-bar i:nth-child(n+4) { background: var(--surface-3); color: var(--text-2); }
.ins-lb { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.ins-rank { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); font: 600 12px var(--font); color: var(--text-2); flex: none; }
.ins-rank.gold { background: #FEF0C7; color: #B54708; }
.ins-meter { position: relative; width: 120px; height: 6px; border-radius: 3px; background: var(--surface-3); flex: none; }
.ins-meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.ins-meter.big { width: 100%; height: 10px; margin-top: 6px; }
.ins-mile { position: absolute; top: -3px; width: 3px; height: 16px; border-radius: 2px; background: var(--border-strong); transform: translateX(-1px); }
.ins-mile.hit { background: var(--ok); }
.ins-track { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.ins-hit { display: flex; align-items: baseline; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.ins-hit b { min-width: 36px; text-align: right; color: var(--ok); }
.ins-hit.sm b { min-width: 28px; font-size: 12px; }
.ins-badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); flex: none; }
.ins-spark { display: flex; align-items: flex-end; gap: 2px; height: 56px; }
.ins-spark i { flex: 1; min-width: 3px; background: color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 2px 2px 0 0; }
.ins-give { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.ins-rec { border-bottom: 1px solid var(--border); padding: 4px 0; }
.ins-rec-hd { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; }

/* detail cards: content sits at the top instead of spreading over the height */
.drill-card .drill-bd.stack { align-content: start; }

/* The 3-1s: the Sheet */
.sheet-page { display: flex; flex-direction: column; height: 100vh; min-height: 0; }
.sheet-page { --p0: #12B76A; --p1: #F04438; --p2: #F79009; --p3: #2E90FA; --paging: #98A2B3; }
.sheet-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.sheet-card { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.sheet-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm, 0 1px 3px rgba(16,24,40,.08)); }
.sheet-mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sheet-mini span { display: grid; place-items: center; gap: 1px; padding: 6px 0; border-radius: 8px; background: var(--surface-2); border-top: 3px solid var(--c); }
.sheet-mini b { font-size: 16px; } .sheet-mini i { font-style: normal; font-size: 11px; color: var(--text-3); }
.p0 { --c: var(--p0); } .p1 { --c: var(--p1); } .p2 { --c: var(--p2); } .p3 { --c: var(--p3); } .paging { --c: var(--paging); }
.sheet-pos { display: inline-grid; place-items: center; min-width: 38px; height: 22px; padding: 0 7px; border-radius: 6px; background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent); color: var(--c, var(--accent)); font: 700 12px var(--font); flex: none; }
.sheet-head .row1 { flex-wrap: wrap; }
.sheet-search { width: 240px; } .sheet-search .input { width: 100%; }
.sheet-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: var(--s3); }
.sheet-metric { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-top: 3px solid var(--c); border-radius: 10px; background: var(--surface); text-align: left; font: inherit; color: inherit; cursor: pointer; min-width: 0; }
.sheet-metric:hover { border-color: var(--border-strong); border-top-color: var(--c); }
.sheet-metric b { font-size: 22px; line-height: 1.1; }
.sheet-metric .meter { height: 5px; } .sheet-metric .meter > i { background: var(--c); }
.sheet-alerts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sheet-alert { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 0; font: 500 12px var(--font); cursor: pointer; background: var(--warn-weak); color: var(--warn); }
.sheet-alert.danger { background: var(--danger-weak); color: var(--danger); }
.ok-t { color: var(--ok); }
.sheet-body { flex: 1; min-height: 0; overflow: auto; padding: 4px 24px 40px; display: flex; flex-direction: column; gap: 14px; }
.sheet-body > * { flex: none; }
.sl .table-wrap { overflow-x: auto; overflow-y: visible; flex: none; }
.sl { flex: none; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 12px; background: var(--surface); overflow: hidden; transition: box-shadow .15s, border-color .15s; }
.sl.over { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent); }
.sl-hd { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; user-select: none; }
.sl-hd h2 { margin: 0; font-size: 15px; }
.sl-caret { transition: transform .15s; color: var(--text-3); } .sl-caret.open { transform: rotate(180deg); }
.sl-lanes { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 0 14px 8px; }
.sl-t tr.worked td { background: color-mix(in srgb, var(--ok) 5%, transparent); }
.sl-t tr.dragging { opacity: .45; }
.sl-t tr[draggable="true"] { cursor: grab; }
.empty.sm { padding: 18px; } .empty.sm p { margin: 0; }
.sheet-work { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); z-index: 46; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: drill-slide .22s cubic-bezier(.2,.8,.2,1); }
.sw-hd { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.sw-name { font: 600 16px var(--font); color: var(--text); text-decoration: none; display: block; } .sw-name:hover { color: var(--accent); }
.sw-bd { flex: 1; overflow: auto; padding: 16px; }
.sw-acts { display: grid; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.sw-moves { display: flex; flex-wrap: wrap; gap: 6px; }
.sw-moves .mv { border-color: color-mix(in srgb, var(--c) 45%, var(--border)); color: var(--c); background: var(--surface); }
.sw-h { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
@media (max-width: 900px) { .sheet-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } .sheet-search { width: 100%; order: 9; } .sheet-body { padding: 4px 12px 40px; } }
