/* ═══ Control-tower polish on top of base.css (docs/UI_CONTROL_TOWER.md, in the brand of docs/UI_BRAND.md) ═══
   Loaded after the feature sheets (app, forms, nav, analytics, roundtrip, twin, copilot) and before components.css, so
   it only aligns their chrome with the primitives of base.css: turquoise-tinted hairlines, 6 px control radii, the teal
   focus ring, the dense form controls, overlays and scrollbars. It defines no primitive of its own and no token. */

/* Tokens: css/tokens.css (the one token file). */

/* ─── Global feel ───────────────────────────────────────── */
::selection { background: var(--ice-3); color: var(--ink); }
/* placeholders in the meta teal-grey (5.2:1 on --surface-2, 6.1 dark), not the browser's #757575 (4.3 / 3.2): on a search
   box with no visible label the placeholder is the only words on the field */
::placeholder { color: var(--muted); opacity: 1; }
.num, table.tbl td.num, table.tbl th.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Shell chrome (classic shell; the desk shell is shell.css) ─── */
.app.shell > .topbar {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.app.shell > .app-workspace > .sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: inset 3px 0 0 var(--brand);
}
.sidebar-foot { border-top: 1px solid var(--line); color: var(--muted); }

/* hub tabs: accent text on the soft fill with a 2 px accent underline */
.hub-tab { position: relative; border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; margin-bottom: 0; }
.hub-tab.active { background: var(--accent-soft); color: var(--accent-text); }
.hub-tab.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px;
  background: var(--accent);
}

/* search & top-bar buttons */
.search-btn { border-radius: var(--r-sm); background: var(--surface-2); }
.search-btn:hover { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.app.shell .topbar .icon-btn { border-radius: var(--r-sm); }

/* ─── Navigation (classic sidebar of nav.css) ───────────── */
.nav-item, .nav-q { border-radius: var(--r-nav); }
.nav-item:hover, .nav-q:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; box-shadow: none; }
.nav-hub-h { border-radius: var(--r-nav); }
.nav-search input { border-radius: var(--r-sm); }
.nav-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }

/* ─── Tables: a clickable row reads as one ─── */
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover td { background: var(--sel); }
.tbl-wrap { border-radius: var(--r-md); }

/* ─── Forms (forms.css): 28 px controls, 6 px radius, a 2 px accent focus ring with the soft halo outside it ─── */
.fld > label:not(.check-row):not(.ewb2-chk) { font-weight: 600; letter-spacing: .01em; }
.fld input:not([type=checkbox]):not([type=file]):not([type=radio]),
.fld select,
.fld textarea,
.auth-form .fld input {
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
/* a field the pointer is over shows its turquoise edge; the teal border plus a 1 px teal ring (4.8:1 on the field, 3:1
   needed) shows the keyboard where it is; the same selector weight as forms.css's focus rule, so text inputs, selects
   and textareas all get it */
.fld input:not([type=checkbox]):not([type=file]):not([type=radio]):not(:focus):hover, .fld select:not(:focus):hover,
.fld textarea:not(:focus):hover, select.sel:not(:focus):hover, input.inp:not(:focus):hover { border-color: var(--accent-line); }
.fld input:not([type=checkbox]):not([type=file]):focus, .fld select:focus, .fld textarea:focus,
.auth-form .fld input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft);
}
.toolbar input[type=search], .toolbar select, .toolbar input[type=date], .toolbar input[type=number] { border-radius: var(--r-sm); }
.form-actions {
  border-top: 1px solid var(--line);
  background: var(--surface);
  border-radius: 0 0 var(--r-md) var(--r-md);
}
.lines { border-radius: var(--r-md); }

/* ─── Overlays ──────────────────────────────────────────── */
.modal { border-radius: var(--r-lg); box-shadow: var(--e3), var(--highlight); }
.modal-h { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.palette { border-radius: var(--r-lg); box-shadow: var(--e3), var(--highlight); }
.toast { border-radius: var(--r-sm); box-shadow: var(--e2); }
.drawer { box-shadow: var(--e2); }

/* ─── Auth ──────────────────────────────────────────────── */
.auth-card { border-radius: var(--r-lg); box-shadow: var(--e3); }
.auth-card .brand { background: none; }
.auth-form h2 { font-family: var(--font-head); letter-spacing: var(--ls-title); }

/* ─── Scrollbars ────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
