/* Torch Labs UI foundation.
 *
 * Every page used to declare its own copy of the palette, and the copies had
 * drifted into two near-identical themes: two grounds (#06080b / #05070a), two
 * foregrounds, two border colours under two different names (--border / --line),
 * two greens, two reds, two ambers, and two radius scales. Nothing was wrong
 * enough to look broken on its own page — which is exactly why moving between
 * pages felt like moving between products.
 *
 * This file is the single source. Pages load it before their own <style> and
 * declare only what is genuinely theirs (a page-specific max width, say).
 * The compact pages' names are kept as aliases so their CSS reads unchanged
 * while resolving to the same values as everywhere else.
 */
:root{
  color-scheme:dark;

  /* Ground: three planes, darkest to lightest. Neutral greys, the dark of
     the workspace apps people already live in (Notion, Google, ClickUp),
     rather than a tinted navy: content reads as content, and the one
     colour on screen is the brand orange where it means something. */
  --bg:#191919;
  --bg2:#202020;
  --bg3:#2a2a2a;

  /* Edges: quiet hairlines, one step up for inputs, one more for hover. */
  --border:#2e2e2e;
  --border2:#3b3b3b;
  --border3:#4d4d4d;
  --hairline:rgba(255,255,255,.05);
  --track:rgba(255,255,255,.12);

  /* Ink: primary, secondary, tertiary. Each at or above 4.5:1 on every ground above. */
  --text:#ececec;
  --text2:#b4b4b4;
  --text3:#939393;

  /* Brand. The flame from the company mark, and the ink that reads on it. */
  --accent:#f97316;
  --accent2:#fb923c;
  --accent-ink:#111827;
  --accent-dim:rgba(249,115,22,.1);
  --accent-soft:rgba(249,115,22,.12);
  --accent-wash:rgba(249,115,22,.06);
  --accent-glow:rgba(249,115,22,.2);
  --accent-select:rgba(249,115,22,.25);

  /* State. One green, one red, one amber — for the whole product. */
  --success:#10b981;
  --success-dim:rgba(16,185,129,.1);
  --danger:#ef4444;
  --danger-dim:rgba(239,68,68,.1);
  --warn:#f59e0b;
  --warn-dim:rgba(245,158,11,.1);

  /* Category hues, for surfaces that colour-code a catalogue. */
  --cyan:#22d3ee;
  --green:#34d399;
  --rose:#fb7185;
  --yellow:#facc15;

  /* Category hues for apps and quick actions: the icon takes the hue, its tile
     a flat 14% tint of it (no gradient). Core is the accent, one step lighter. */
  --cat-core:#fb923c;
  --cat-sales:#38bdf8;
  --cat-marketing:#fb7185;
  --cat-finance:#34d399;
  --cat-operations:#c084fc;
  --cat-hr:#f0abfc;
  --cat-customer:#60a5fa;

  /* Balance meters read as good / watch / nearly gone. */
  --usage-color-good:#34d399;
  --usage-color-warn:#f59e0b;
  --usage-color-danger:#ef4444;

  /* Type. Inter carries the whole interface — labels, numbers and times
     included, with tabular figures where columns line up. The mono is kept
     for things that really are code: keys, certificate numbers, pairing codes.
     --mono is Inter now so every existing label follows without a rewrite. */
  --sans:'Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
  --mono:var(--sans);
  --code:'IBM Plex Mono',ui-monospace,monospace;

  /* Geometry: one pair of radii, controls and containers. */
  --r:8px;
  --r2:12px;

  /* Elevation: a real offset and a soft falloff, never a coloured halo. */
  --shadow-card:0 1px 2px rgba(0,0,0,.3),0 14px 34px -18px rgba(0,0,0,.6);
  --shadow-pop:0 2px 6px rgba(0,0,0,.35),0 18px 48px -12px rgba(0,0,0,.6);

  /* Aliases kept for the compact pages, resolving to the same values. */
  --line:var(--border);
  --line2:var(--border2);
  --muted:var(--text2);
  --dim:var(--text3);
  --panel:var(--bg2);
  --panel2:var(--bg3);
}

/* Light theme. Same names, same meaning: only the values change (js/theme.js sets data-theme on <html>).
   Text and accent values are the darker steps so each still reads at 4.5:1 on the light grounds. */
:root[data-theme="light"]{
  color-scheme:light;
  --bg:#f6f6f4;
  --bg2:#ffffff;
  --bg3:#efefec;
  --border:#e2e2de;
  --border2:#d0d0ca;
  --border3:#b6b6af;
  --hairline:rgba(0,0,0,.06);
  --track:rgba(0,0,0,.1);
  --text:#1c1c1a;
  --text2:#4f4f4a;
  --text3:#666660;
  --accent:#c2410c;
  --accent2:#ea580c;
  --accent-ink:#ffffff;
  --accent-dim:rgba(194,65,12,.1);
  --accent-soft:rgba(194,65,12,.12);
  --accent-wash:rgba(194,65,12,.06);
  --accent-glow:rgba(194,65,12,.18);
  --accent-select:rgba(234,88,12,.22);
  --success:#047857;
  --success-dim:rgba(4,120,87,.1);
  --danger:#dc2626;
  --danger-dim:rgba(220,38,38,.08);
  --warn:#b45309;
  --warn-dim:rgba(180,83,9,.1);
  --cyan:#0e7490;
  --green:#047857;
  --rose:#be123c;
  --yellow:#a16207;
  --cat-core:#c2410c;
  --cat-sales:#0369a1;
  --cat-marketing:#be123c;
  --cat-finance:#047857;
  --cat-operations:#7e22ce;
  --cat-hr:#a21caf;
  --cat-customer:#1d4ed8;
  --usage-color-good:#047857;
  --usage-color-warn:#b45309;
  --usage-color-danger:#dc2626;
  --shadow-card:0 1px 2px rgba(0,0,0,.06),0 10px 28px -16px rgba(0,0,0,.18);
  --shadow-pop:0 2px 6px rgba(0,0,0,.08),0 16px 40px -12px rgba(0,0,0,.22);
}

/* Surfaces that used a translucent white on the dark theme need a translucent black on the light one. */
:root[data-theme="light"] .dash-chip{background:rgba(0,0,0,.06)}
:root[data-theme="light"] .toast-undo:hover{background:rgba(0,0,0,.06)}
:root[data-theme="light"] .dash-focus{background:linear-gradient(180deg,rgba(0,0,0,.03),transparent)}
:root[data-theme="light"] .btn.warn:hover{color:#fff}

/* `hidden` means hidden.
 *
 * The attribute is only a UA-stylesheet `display:none`, so any rule that sets
 * a display — a `display:flex` toolbar, an inline style — silently outranks it
 * and the element stays on screen. Pages had started patching that one
 * component at a time (`.workspace-view[hidden]`, `.tab-group[hidden]`), which
 * only fixes the cases someone already tripped over. This settles it once. */
[hidden]{display:none !important}

/* Browser surfaces the page did not draw still belong to the design. */
::selection{background:var(--accent-select);color:var(--text)}
input,select,textarea{caret-color:var(--accent)}
input::placeholder,textarea::placeholder{color:var(--text3);opacity:1}
*{scrollbar-width:thin;scrollbar-color:var(--border2) transparent}
::-webkit-scrollbar{width:11px;height:11px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--border2);border-radius:100px;border:3px solid transparent;background-clip:padding-box}
::-webkit-scrollbar-thumb:hover{background:var(--border3)}

/* One focus ring, on every control, on every page. */
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,
textarea:focus-visible,summary:focus-visible,[tabindex]:focus-visible{
  outline:2px solid var(--accent);outline-offset:2px
}

@media (prefers-reduced-motion: reduce){
  /* Travel and entrances are the vestibular triggers; state feedback is not,
     so transitions shorten rather than disappear. */
  *,*::before,*::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.12s !important;
    scroll-behavior:auto !important;
  }
  .spinner{animation-duration:1.4s !important;animation-iteration-count:infinite !important}
}

/* Numbers line up in columns without needing a monospace face. */
body{font-feature-settings:"cv11","ss01";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
td,th,time,.tnum{font-variant-numeric:tabular-nums}

/* Status chips carry raw values ("pending", "not registered"). Only the
   first letter is raised, so they read in sentence case like the tags in any
   workspace app, and chips already written that way stay as written.
   ::first-letter needs a block container, so text-only chips become
   inline-block; a chip with an icon keeps its flex layout. */
.badge,.slot-badge,.role-badge,.upcoming-badge,.chip{white-space:nowrap}
.badge:not(:has(svg)),.slot-badge:not(:has(svg)),.role-badge:not(:has(svg)),.upcoming-badge:not(:has(svg)),.chip:not(:has(svg)){display:inline-block;vertical-align:middle;line-height:1.4}
.badge::first-letter,.slot-badge::first-letter,.role-badge::first-letter,.upcoming-badge::first-letter,.chip::first-letter{text-transform:uppercase}

/* ── Disabled buttons ──
   One look for "you can't press this yet", on every page and every variant
   (primary, success, danger, outline): neutral ground, secondary ink, no
   orange. Opacity alone left a disabled primary looking pressable (F2).
   !important because each page's variants (.btn.primary, .btn.success …)
   would otherwise out-rank a shared rule. */
button:disabled,
.btn:disabled,
.btn[aria-disabled="true"],
.btn-full:disabled,
.btn-rail:disabled{
  background:var(--bg3) !important;
  background-image:none !important;
  color:var(--text3) !important;
  border-color:var(--border2) !important;
  box-shadow:none !important;
  opacity:1 !important;
  transform:none !important;
  cursor:not-allowed !important;
}

/* ── Tabs: one component everywhere (F3) ──
   A segmented switch between views of the same page: Attendance, Leave and
   Training admin, Scheduling, Settings and the employee editor. Buttons carry
   role="tab" and aria-selected; the selected one is lifted, not orange. */
.tw-tabs{display:inline-flex;background:var(--bg3);border:1px solid var(--border);border-radius:var(--r);padding:3px;gap:2px;margin-bottom:18px}
.tw-tab{appearance:none;border:none;background:none;color:var(--text3);font-family:var(--sans);font-size:13px;font-weight:600;padding:6px 14px;border-radius:6px;cursor:pointer;display:inline-flex;align-items:center;gap:7px;transition:color .15s ease,background-color .15s ease}
.tw-tab:hover{color:var(--text2)}
.tw-tab[aria-selected="true"]{background:var(--bg);color:var(--text);box-shadow:0 1px 2px rgba(0,0,0,.35)}
.tw-tab-count{font-family:var(--mono);font-size:12px;font-weight:700;background:var(--border2);color:var(--text2);border-radius:100px;padding:0 6px;min-width:18px;text-align:center}
.tw-tab[aria-selected="true"] .tw-tab-count{background:var(--bg3);color:var(--text2)}
.tw-tab-count.hot,
.tw-tab[aria-selected="true"] .tw-tab-count.hot{background:var(--warn);color:var(--accent-ink)}
.tw-tab:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.tw-tabs .tw-tab{white-space:nowrap}
@media (max-width:720px){
  /* Scroll rather than squeeze: natural widths, and the row scrolls if it
     doesn't fit, so the last tab never sits under the floating feedback button. */
  .tw-tabs{display:flex;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .tw-tabs::-webkit-scrollbar{display:none}
  .tw-tab{flex:0 0 auto;justify-content:center;padding:8px 14px;font-size:12px}
  .tw-tab-count{display:none}
  .tw-tab[aria-selected="true"] .tw-tab-count,
  .tw-tab-count.hot{display:inline-block}
}
@media (pointer:coarse){.tw-tab{min-height:40px}}

/* Visually hidden, still read by screen readers. */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* Small "?" links to Help at the known hard spots (#11). */
.help-link{font-size:12px;font-weight:600;color:var(--accent);text-decoration:none;white-space:nowrap}
.help-link:hover{text-decoration:underline}

/* ── People's pictures (js/avatar.js): initials until a picture arrives, then the picture ── */
.tav{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:50%;overflow:hidden;background:var(--bg3);color:var(--text2);border:1px solid var(--border2);font-weight:700;letter-spacing:.02em;line-height:1;user-select:none}
.tav img{display:block;width:100%;height:100%;object-fit:cover}
.tav.has-photo{border-color:transparent}
.tav-sm{width:28px;height:28px;font-size:11px}
.tav-md{width:36px;height:36px;font-size:13px}
.tav-lg{width:64px;height:64px;font-size:22px}
.tav-xl{width:112px;height:112px;font-size:38px}

/* Disclosure rows are finger-sized on a phone or tablet. */
@media (max-width:800px),(pointer:coarse){details>summary{min-height:36px}}

/* Controls take the page's typeface: the browser default (Arial) showed on filter pills, selects and small buttons that did not name a font. */
:where(button,input,select,textarea){font-family:inherit}

/* Check boxes and radios are 16px and take the accent colour; summary rows are never shorter than a small control. */
:where(input[type=checkbox],input[type=radio]){width:16px;height:16px;accent-color:var(--accent)}
:where(summary){min-height:24px}

/* States shared by every page (js/ui-states.js, js/admin-live.js) */
.ui-failed{padding:28px 16px;text-align:center;color:var(--text2)}
.ui-failed p{margin:0 0 12px;font-size:13px}
.ui-chips{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.ui-chip{min-height:24px;padding:3px 10px;border:1px solid var(--border2);border-radius:999px;background:transparent;color:var(--text2);font-size:12px;cursor:pointer}
.ui-chip:hover{border-color:var(--accent);color:var(--text)}
.ui-chip[aria-pressed="true"]{border-color:var(--accent);color:var(--text);background:var(--bg3)}
.ui-chip:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.live-stamp{align-self:center;margin-left:10px;font-size:12px;color:var(--text3);white-space:nowrap}

/* In-app confirm / ask dialogs (js/ui-dialog.js) */
.ui-dialog{position:fixed;inset:0;margin:auto;height:fit-content;max-height:calc(100vh - 32px);overflow:auto;width:min(440px,calc(100vw - 32px));padding:0;border:1px solid var(--border2);border-radius:12px;background:var(--bg2);color:var(--text);box-shadow:0 18px 48px rgba(0,0,0,.55)}
.ui-dialog::backdrop{background:rgba(0,0,0,.6)}
.ui-dialog-form{display:flex;flex-direction:column;gap:12px;padding:20px}
.ui-dialog-title{margin:0;font-size:16px;font-weight:650}
.ui-dialog-text{margin:0;font-size:13.5px;line-height:1.5;color:var(--text2);white-space:pre-line;overflow-wrap:anywhere}
.ui-dialog-label{display:flex;flex-direction:column;gap:6px;font-size:12.5px;color:var(--text2)}
.ui-dialog-input{width:100%;box-sizing:border-box;padding:9px 10px;border:1px solid var(--border2);border-radius:8px;background:var(--bg);color:var(--text);font:inherit;font-size:14px}
.ui-dialog-input:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.ui-dialog-problem{margin:-4px 0 0;font-size:12.5px;color:var(--danger,#f87171)}
.ui-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}
.ui-dialog-btn{min-height:36px;padding:0 16px;border:1px solid var(--border2);border-radius:8px;background:var(--bg3);color:var(--text);font:inherit;font-size:13.5px;cursor:pointer}
.ui-dialog-btn:hover{border-color:var(--border3)}
.ui-dialog-btn:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.ui-dialog-primary{border-color:var(--accent);background:var(--accent);color:#111;font-weight:600}
.ui-dialog-danger{border-color:var(--danger,#ef4444);background:var(--danger,#ef4444);color:#fff}

/* Unsent-draft note (js/drafts.js) and the sign-in-ending bar (js/session-watch.js) */
.ui-draft-note{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 14px;padding:9px 12px;border:1px solid var(--border2);border-radius:8px;background:var(--bg3);color:var(--text2);font-size:13px}
.ui-draft-discard{min-height:28px;padding:0 10px;border:1px solid var(--border2);border-radius:6px;background:transparent;color:var(--text);font:inherit;font-size:12.5px;cursor:pointer}
.ui-draft-discard:hover{border-color:var(--border3)}
.ui-draft-discard:focus-visible,.session-watch-btn:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.session-watch{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);z-index:400;display:flex;align-items:center;gap:14px;max-width:min(640px,calc(100vw - 32px));padding:12px 14px;border:1px solid var(--accent);border-radius:10px;background:var(--bg2);color:var(--text);font-size:13.5px;line-height:1.45;box-shadow:0 12px 32px rgba(0,0,0,.5)}
.session-watch[hidden]{display:none}
.session-watch-ended{border-color:var(--danger,#ef4444)}
.session-watch-btn{flex:none;min-height:34px;padding:0 14px;border:1px solid var(--accent);border-radius:8px;background:var(--accent);color:#111;font:inherit;font-size:13px;font-weight:600;cursor:pointer}
@media (max-width:520px){.session-watch{flex-direction:column;align-items:stretch;bottom:12px}}

/* Click-to-sort table headers (js/table-sort.js) */
.ts-btn{display:inline-flex;align-items:center;gap:5px;margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;letter-spacing:inherit;text-transform:inherit;text-align:inherit;cursor:pointer}
.ts-btn:hover{color:var(--text)}
.ts-btn:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:3px}
.ts-arrow{display:inline-block;min-width:1ch;color:var(--accent)}
th[aria-sort="ascending"] .ts-btn,th[aria-sort="descending"] .ts-btn{color:var(--text)}

/* Print. Paper is always light, whatever theme the screen uses: the light palette, no chrome, tables in full.
   Applies to timesheets, leave, schedule, device records, payroll and anything else someone prints. */
@media print{
  :root,:root[data-theme]{
  color-scheme:light;
  --bg:#f6f6f4;
  --bg2:#ffffff;
  --bg3:#efefec;
  --border:#e2e2de;
  --border2:#d0d0ca;
  --border3:#b6b6af;
  --hairline:rgba(0,0,0,.06);
  --track:rgba(0,0,0,.1);
  --text:#1c1c1a;
  --text2:#4f4f4a;
  --text3:#666660;
  --accent:#c2410c;
  --accent2:#ea580c;
  --accent-ink:#ffffff;
  --accent-dim:rgba(194,65,12,.1);
  --accent-soft:rgba(194,65,12,.12);
  --accent-wash:rgba(194,65,12,.06);
  --accent-glow:rgba(194,65,12,.18);
  --accent-select:rgba(234,88,12,.22);
  --success:#047857;
  --success-dim:rgba(4,120,87,.1);
  --danger:#dc2626;
  --danger-dim:rgba(220,38,38,.08);
  --warn:#b45309;
  --warn-dim:rgba(180,83,9,.1);
  --cyan:#0e7490;
  --green:#047857;
  --rose:#be123c;
  --yellow:#a16207;
  --cat-core:#c2410c;
  --cat-sales:#0369a1;
  --cat-marketing:#be123c;
  --cat-finance:#047857;
  --cat-operations:#7e22ce;
  --cat-hr:#a21caf;
  --cat-customer:#1d4ed8;
  --usage-color-good:#047857;
  --usage-color-warn:#b45309;
  --usage-color-danger:#dc2626;
  --shadow-card:0 1px 2px rgba(0,0,0,.06),0 10px 28px -16px rgba(0,0,0,.18);
  --shadow-pop:0 2px 6px rgba(0,0,0,.08),0 16px 40px -12px rgba(0,0,0,.22);
  }
  html,body{background:#fff!important;color:#000!important}
  body,body.has-app-shell{padding-left:0!important}
  .app-side,.app-top,.side-scrim,.admin-bar,.admin-mtop,.admin-scrim,.topbar,.session-watch,.ui-dialog,.toast-stack,
  .ts-arrow,[data-noprint],.live-stamp,.ui-chips,.ui-draft-note,.tour-launcher{display:none!important}
  button,.btn,.btn-sm,input[type=button],input[type=submit],select{display:none!important}
  .ts-btn{display:inline!important;font-weight:700}
  .tbl-wrap{overflow:visible!important;border-color:#bbb!important}
  table{width:100%!important;border-collapse:collapse}
  thead{display:table-header-group}
  tr,.card,.p-card{break-inside:avoid}
  *{box-shadow:none!important;text-shadow:none!important}
  a{color:inherit!important;text-decoration:none}
  @page{margin:14mm}
}
