/* ═══ Clean look: loaded last by index.html, over every other stylesheet ═════════════════════════════════════
   One calm layer for the whole app: more air, fewer lines and shadows, quieter labels, and the second-order controls
   (the "All ›" of a menu group, a task's Take it / Pass on, the extra filters of a list) kept out of sight until they
   are wanted. Only presentation: no screen loses a control, keyboard and screen readers reach everything as before.
   Remove the <link> in index.html to go back to the previous look. Uses the tokens of tokens.css (light and dark). */

:root {
  --cl-radius: 12px;
  --cl-gap: 16px;
  --cl-line: rgba(15, 23, 42, .07);
  --bg: #f7f8fa;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cl-line: rgba(255, 255, 255, .07); } }
:root[data-theme="dark"] { --cl-line: rgba(255, 255, 255, .07); }

body { background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* ─── Cards: flat, soft edge, room inside ─── */
.card { border: 1px solid var(--cl-line); border-radius: var(--cl-radius); box-shadow: none; background: var(--surface); }
.card-h { padding: 14px 18px 10px; border-bottom: 0; }
.card-h h3 { font-size: 15px; font-weight: 600; letter-spacing: 0; }
.card-h .sub { font-size: 12.5px; }
.card-b { padding: 14px 18px 16px; }
.card-b.tight { padding: 0; }
.card-f { padding: 10px 18px; border-top: 1px solid var(--cl-line); }

/* ─── Page title row ─── */
.page-h { margin-bottom: 18px; align-items: center; }
.page-h h2 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.page-h p { font-size: 13px; }

/* ─── KPI tiles: a label and one number ─── */
.kpis { gap: var(--cl-gap); }
.kpi { border: 1px solid var(--cl-line); border-radius: var(--cl-radius); box-shadow: none; padding: 16px 18px; }
.kpi .l { font-size: 12.5px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); }
.kpi .v { font-size: 26px; margin-top: 4px; }
.kpi .d { font-size: 12px; }

/* ─── Tables: taller rows, quiet header, lines only between rows ─── */
.tbl th { font-size: 12.5px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--cl-line); background: var(--surface); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--cl-line); font-size: 14px; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tbody tr.clickable { cursor: pointer; }
.pager { padding: 12px 16px; gap: 10px; }

/* ─── Buttons: one strong action, the rest light ─── */
.btn { border-radius: 8px; }
.btn:not(.primary):not(.btn-primary):not(.danger):not(.btn-danger) { border-color: var(--cl-line); box-shadow: none; }
.btn:not(.primary):not(.btn-primary):not(.danger):not(.btn-danger):hover { background: var(--surface-2); }

/* ─── Inputs ─── */
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { border-radius: 8px; }

/* ─── List toolbar: search first; extra filters behind "Filters" (modules.js) ─── */
.toolbar { gap: 10px; margin-bottom: 14px; }
.toolbar #list-q { min-width: 260px; }
.toolbar .tb-more[hidden] { display: none !important; }
.toolbar .tb-more { display: contents; }
.toolbar .tb-filters-btn .n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; }
.actions .tb-menu { position: relative; }
.actions .tb-menu > summary { list-style: none; }
.actions .tb-menu > summary::-webkit-details-marker { display: none; }
.actions .tb-menu .tb-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; min-width: 170px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg, var(--shadow)); }
.actions .tb-menu .tb-pop .btn { justify-content: flex-start; border: 0; width: 100%; }

/* ─── Sidebar: calm groups; "All ›" shows on hover / focus only ─── */
.app.shell .sg .gh .gall { opacity: 0; transition: opacity .15s; }
.app.shell .sg:hover .gh .gall, .app.shell .sg .gh .gall:focus-visible, .app.shell .sg .gh .gall[aria-expanded="true"] { opacity: 1; }
.app.shell .sg .gh .gt { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.app.shell .sg + .sg { margin-top: 6px; }

/* ─── Today / task rows: what it is, how much, how long; owner buttons on hover ─── */
.app.shell.desk .tk { padding-top: 12px; padding-bottom: 12px; }
.app.shell.desk .tk .tk-o .tk-own .btn, .app.shell.desk .tk .tk-own .btn { opacity: 0; transition: opacity .15s; }
.app.shell.desk .tk:hover .tk-own .btn, .app.shell.desk .tk:focus-within .tk-own .btn { opacity: 1; }
.app.shell.desk .tk .tk-own.free > span { color: var(--muted); }
.app.shell.desk .tk .tk-r { display: none; }
.app.shell.desk .tk:hover .tk-r, .app.shell.desk .tk:focus-within .tk-r { display: block; }
@media (hover: none) {
  .app.shell.desk .tk .tk-own .btn { opacity: 1; }
}

/* ─── Forms ─── */
.sf-blk, .rec-panel { border-color: var(--cl-line); box-shadow: none; border-radius: var(--cl-radius); }
.fld label { font-weight: 500; }

/* ─── Record page panels ─── */
.rec-panel { padding: 16px 18px; }
.rec-cap { font-size: 12.5px; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 500; }

/* ─── Popups: the form's own heading is the title; only the close button floats in the corner ─── */
.fpop { position: relative; width: min(960px, 100%); border-color: var(--cl-line); }
.fpop-h { position: absolute; top: 12px; right: 12px; z-index: 25; padding: 0; border: 0; background: transparent; }
.fpop-h h3 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fpop-h .btn { width: 32px; height: 32px; border-radius: 50%; }
.fpop-b { padding: 22px 28px 0; }
.fpop-b .page-h, .fpop-b .sf-head { padding-right: 44px; }

/* a form with nothing to show on its right (no live figures, nothing noticed) uses the whole width */
.sf-grid:has(> .sf-side.sf-side-empty) { grid-template-columns: minmax(0, 1fr); }
/* in a popup the form's main column takes the room it has (the live figures keep their column when they show) */
.fpop .sf { --sf-left: 1fr; max-width: none; }
/* the popup is as tall as its form (up to the screen) */
.fpop { height: auto; max-height: min(92vh, 100%); }
.fpop-b { padding-bottom: 0; }
@media (max-width: 767px) { .fpop { max-height: 100%; height: 100%; } }

/* ─── Insight panel: the finding and the next step; the technical footnote and the feedback buttons on hover ─── */
.insp .ifoot .imeta, .insp .ifoot .recheck { display: none; }
.insp:hover .ifoot .imeta, .insp:focus-within .ifoot .imeta, .insp:hover .ifoot .recheck, .insp:focus-within .ifoot .recheck { display: inline; }
.insp .ifoot .iacts { opacity: 0; transition: opacity .15s; }
.insp:hover .ifoot .iacts, .insp:focus-within .ifoot .iacts { opacity: 1; }
@media (hover: none) { .insp .ifoot .iacts { opacity: 1; } }

/* ─── Keyboard focus that can be seen (UI UX Pro Max: focus states, 3:1 indicator) ─── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fld input:not([type=checkbox]):not([type=file]):focus, .fld select:focus, .fld textarea:focus, .auth-form .fld input:focus,
.lines td input:focus, .lines td select:focus, .toolbar input:focus, .toolbar select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
/* light buttons keep a visible edge */
.btn:not(.primary):not(.btn-primary):not(.danger):not(.btn-danger) { border-color: var(--line-2); }
/* clickable things say so */
a, button, summary, [role="button"], tr.clickable, .tb-menu > summary { cursor: pointer; }
/* hover feedback: short and calm */
.btn, .tbl tbody tr td, .app.shell .sg .gh .gall { transition: background-color .15s ease, border-color .15s ease, opacity .15s ease; }
@media (prefers-reduced-motion: reduce) { .btn, .tbl tbody tr td, .app.shell .sg .gh .gall, .fpop-back { transition: none !important; animation: none !important; } }
/* the popup opens softly */
.fpop-back { animation: fpop-in .16s ease-out; }
@keyframes fpop-in { from { opacity: 0; } to { opacity: 1; } }
.insp .thumbs button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.fpop-h .btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ─── One search, at the top of the sidebar (screens, LRs, trucks, bills; Ctrl K): the top bar's box is not repeated ─── */
@media (min-width: 768px) {
  .app.shell.desk .sb-find {
    display: flex; flex: none; align-items: center; gap: 8px; height: 36px; margin: 4px 10px 10px; padding: 0 10px;
    border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--muted);
    font: 400 13.5px/20px var(--font-ui); text-align: left; cursor: text;
  }
  .app.shell.desk .sb-find:hover { border-color: var(--accent-line); color: var(--ink-2); }
  .app.shell.desk .sb-find svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
  .app.shell.desk .sb-find span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app.shell.desk .sb-find::after { content: "Ctrl K"; flex: none; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); color: var(--ink-2); font: 500 10.5px/16px var(--font-mono); }
  .app.shell.desk.sb-mini .sb-find { justify-content: center; width: 44px; margin: 4px auto 10px; padding: 0; }
  .app.shell.desk.sb-mini .sb-find span, .app.shell.desk.sb-mini .sb-find::after { display: none; }
  .app.shell.desk .topbar .search-btn { display: none; }
}

/* ─── Masters page (views/plus/masters.js): one row of tabs, scrolling sideways; the table below ─── */
.ms-tabs { display: flex; gap: 2px; margin: 0 0 16px; padding: 0 0 0; overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid var(--line); }
.ms-tabs a { flex: none; padding: 10px 14px 9px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; border-radius: 6px 6px 0 0; }
.ms-tabs a:hover { color: var(--ink); background: var(--surface-2); }
.ms-tabs a[aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--accent); }
.ms-tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* the tab already names the table: its list keeps only the one-line description and the ⋯ menu */
.ms-panel .page-h { margin-bottom: 12px; }
.ms-panel .page-h h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ms-tabs { scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
.ms-tabs::-webkit-scrollbar { display: none; }
