/*
 * TEG Ops, soft ladder (v3 look)
 * ---------------------------------------------------------------------------------------------
 * Loaded after tegops.css and tegops-app.css, so it only has to restate what changes.
 *
 * The idea: TEG's process blue at full strength only on small marks (the one filled button, the active
 * nav icon, the job's progress, data), and its pale tints doing all the area work (the ground, the active
 * nav row, badges, tracks, notices). Panels are soft (20px) and borderless on a blue-grey ground;
 * controls are pills. Type is DM Sans, self-hosted (public/fonts/dm-sans).
 *
 * Sections
 *   1  Tokens (light, dark)
 *   2  Shell: ground, sidebar (every group open), top bar, page header
 *   3  Surfaces: sections, folds, tables, KPI strip
 *   4  Controls: buttons, inputs, tabs as a pill track, segmented, badges, menus, modals
 *   5  Screen touches
 *   6  Phones
 */

/* =============================================================================================
   1. Tokens
   ============================================================================================= */
:root {
    --tg-font: "DM Sans", var(--font-family, "DM Sans"), ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

    /* The ladder: one hue, full strength on marks, tints on areas */
    --tl-blue: #24578b;          /* marks: primary button, active icon, progress, data */
    --tl-blue-hover: #1e4873;
    --tl-ink: #1c3d5f;           /* dark ink of the hue, on its tints */
    --tl-tint-1: #f3f7fb;        /* palest: the ground */
    --tl-tint-2: #e6eff8;        /* badges, notices, hover on blue things */
    --tl-tint-3: #dae7f4;        /* the active nav row, the selected tab track */
    --tl-tint-4: #c9dcef;        /* tracks, borders on tints */

    --tg-bg: #eef3f8;
    --tg-sidebar: #eef3f8;
    --tg-surface: #ffffff;
    --tg-surface-2: #f5f8fb;
    --tg-surface-3: #ebf1f7;
    --tg-hover: rgb(36 87 139 / 0.05);
    --tg-pressed: rgb(36 87 139 / 0.09);

    --tg-border: #e3e9f0;
    --tg-border-subtle: #edf2f6;
    --tg-border-strong: #cbd5e1;

    --tg-heading: #0f1b2a;
    --tg-text: #172333;
    --tg-text-2: #3e4a5a;
    --tg-muted: #5a6573;
    --tg-faint: #646e7b;         /* 4.9:1 on white, 4.5:1 on the ground */

    --tg-accent: var(--tl-blue);
    --tg-accent-hover: var(--tl-blue-hover);
    --tg-accent-text: var(--tl-ink);
    --tg-accent-solid: var(--tl-blue);
    --tg-accent-soft: var(--tl-tint-2);
    --tg-accent-border: var(--tl-tint-4);
    --tg-focus-ring: 0 0 0 3px rgb(36 87 139 / 0.22);

    --tg-info: var(--tl-blue);
    --tg-info-text: var(--tl-ink);
    --tg-info-soft: var(--tl-tint-2);
    --tg-info-border: var(--tl-tint-4);
    --tg-neutral-soft: #eef2f6;
    --tg-neutral-border: #e1e7ee;

    --tg-chart-1: var(--tl-blue);
    --tg-chart-grid: #edf1f5;

    --tg-radius-md: 0.625rem;    /* 10: inner blocks */
    --tg-radius-lg: 0.75rem;     /* 12: wells, menus, inputs' inner parts */
    --tg-radius-xl: 1.25rem;     /* 20: panels */
    --tl-panel: 1.25rem;
    --tl-inner: 0.75rem;

    --tg-control-h: 2.25rem;
}

.dark {
    --tl-blue: #5b93cc;
    --tl-blue-hover: #73a6d9;
    --tl-ink: #b9d3ee;
    --tl-tint-1: #0e131a;
    --tl-tint-2: rgb(91 147 204 / 0.14);
    --tl-tint-3: rgb(91 147 204 / 0.22);
    --tl-tint-4: rgb(91 147 204 / 0.34);
    --tg-bg: #0b1016;
    --tg-sidebar: #0b1016;
    --tg-surface: #121922;
    --tg-surface-2: #161e28;
    --tg-surface-3: #1b2430;
    --tg-border: #212b37;
    --tg-border-subtle: #1a222c;
    --tg-border-strong: #2e3a48;
    --tg-on-accent: #0b1016;
}

/* =============================================================================================
   2. Shell
   ============================================================================================= */
.fi-body, .fi-layout { background: var(--tg-bg); font-family: var(--tg-font); }
.fi-body :is(button, input, select, textarea) { font-family: inherit; }
.fi-body ::selection { background: var(--tl-tint-3); }

.fi-sidebar, .fi-sidebar-header, .fi-topbar, .fi-topbar > nav { background: var(--tg-bg); border: 0; box-shadow: none; }
.fi-topbar { backdrop-filter: none; -webkit-backdrop-filter: none; min-height: 3.5rem; }

/* Sidebar: every group open, a quiet label over its items; the active item is a tint pill with the hue's ink. */
/* 21 destinations in six groups fit a 1440x900 laptop without the sidebar scrolling: 30px rows, 12px between groups. */
.fi-sidebar-nav { padding: 0.25rem 0.75rem 1rem; row-gap: 0; }
.fi-sidebar-nav-groups { row-gap: 0.75rem; }
.fi-sidebar-group { row-gap: 0; }
.fi-sidebar-group-btn { min-height: 1.5rem; padding: 0 0.75rem; cursor: default; background: none; }
.fi-sidebar-group-btn:hover { background: none; }
.fi-sidebar-group-label { font-size: var(--tg-fs-xs); font-weight: 500; color: var(--tg-faint); letter-spacing: 0; text-transform: none; line-height: 1rem; }
.fi-sidebar-group.fi-active > .fi-sidebar-group-btn .fi-sidebar-group-label { color: var(--tg-faint); }
.fi-sidebar-group-items { row-gap: 0; padding-bottom: 0; }
.fi-sidebar-group:not(.fi-collapsed) > .fi-sidebar-group-items { padding-bottom: 0; }
.fi-sidebar-item-btn { min-height: 1.875rem; padding: 0 0.625rem 0 0.75rem; border-radius: 999px; column-gap: 0.625rem; }
.fi-sidebar-item-btn > .fi-icon { width: 1.0625rem; height: 1.0625rem; color: var(--tg-muted); }
.fi-sidebar-item-label { font-size: var(--tg-fs-md); font-weight: 450; color: var(--tg-text-2); }
.fi-sidebar-item-btn:hover { background: var(--tg-hover); }
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn { background: var(--tl-tint-3); box-shadow: none; }
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-label { color: var(--tl-ink); font-weight: 600; }
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn > .fi-icon { color: var(--tl-blue); }
/* Counts: only the queues that need someone carry one (each has a tooltip naming what it counts). */
.fi-sidebar-item-badge-ctn { display: flex; }
.fi-sidebar-item-badge-ctn .fi-badge {
    min-height: 1.25rem; min-width: 1.25rem; padding: 0 0.375rem; justify-content: center;
    background: transparent; box-shadow: none; color: var(--tg-muted); font-size: var(--tg-fs-xs); font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.fi-sidebar-item.fi-active .fi-sidebar-item-badge-ctn .fi-badge { color: var(--tl-ink); }

/* Global search: a white pill on the ground (wide on laptops, as wide as the bar allows on phones). */
.fi-global-search-field .fi-input-wrp { background: var(--tg-surface); box-shadow: none; border-radius: 999px; min-width: 0; }
@media (min-width: 64rem) { .fi-global-search-field .fi-input-wrp { min-width: 18rem; } }
.fi-global-search-field .fi-input-wrp:focus-within { box-shadow: inset 0 0 0 1px var(--tl-blue), var(--tg-focus-ring); }
.fi-global-search-results-ctn { border-radius: var(--tl-inner); }

/* Page header: a confident noun title, its line under it, actions on the right. */
.fi-page-header-main-ctn { padding-block: 1.75rem 2rem; row-gap: 1.5rem; }
.fi-header-heading { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.025em; line-height: 2.125rem; color: var(--tg-heading); }
.fi-header-subheading { font-size: var(--tg-fs-md); color: var(--tg-muted); margin-top: 0.25rem; }
.fi-breadcrumbs { margin-bottom: 0.25rem; }
.fi-breadcrumbs-item-label { font-size: var(--tg-fs-sm); }

/* =============================================================================================
   3. Surfaces
   ============================================================================================= */
.tg-section, .tg-card { background: var(--tg-surface); border: 0; border-radius: var(--tl-panel); box-shadow: none; }
.tg-section.is-plain { border-radius: 0; background: transparent; }
.tg-section-header { padding: 1.25rem 1.5rem 1rem; }
.tg-section-title { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; color: var(--tg-heading); }
.tg-section-body { padding: 0.25rem 1.5rem 1.5rem; }

/* Folded sections read as one soft white row; open, the row becomes the panel's head. */
.tg-section.is-fold { background: var(--tg-surface); }
.tg-fold-head { border-radius: var(--tl-panel); box-shadow: none; padding: 1rem 1.5rem; }
.tg-fold-head:hover { background: var(--tg-surface-2); }
.tg-section.is-open > .tg-fold-head { border-radius: var(--tl-panel) var(--tl-panel) 0 0; }
.tg-fold-head .tg-section-title { font-size: var(--tg-fs-md); font-weight: 600; }

/* Filament's own containers take the same panel. */
.fi-ta-ctn, .fi-section:not(.fi-section-not-contained), .fi-wi-stats-overview-stat, .fi-fo-repeater-item, .fi-in-entry-wrp .fi-section {
    background: var(--tg-surface); border: 0; border-radius: var(--tl-panel); box-shadow: none;
}
.fi-ta-ctn { overflow: hidden; }
.fi-ta-header-cell { font-size: var(--tg-fs-xs); font-weight: 500; color: var(--tg-muted); text-transform: none; letter-spacing: 0; background: transparent; }
.fi-ta-row { transition: background var(--tg-dur) var(--tg-ease); }
.fi-ta-row:hover { background: var(--tl-tint-1); }
.fi-ta-cell, .fi-ta-header-cell { font-variant-numeric: tabular-nums; }
.fi-ta-ctn .fi-ta-header-toolbar { border-color: var(--tg-border-subtle); }
.fi-pagination { padding-inline: 0.5rem; }

/* The headline numbers sit together in one white panel, split by space. */
.tg-kpi-strip { background: var(--tg-surface); border-radius: var(--tl-panel); padding: 1.25rem 1.5rem; gap: 1.5rem; }
.tg-kpi-label { font-size: var(--tg-fs-sm); font-weight: 500; color: var(--tg-muted); }
.tg-kpi-value { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.tg-kpi-sub { font-size: var(--tg-fs-xs); color: var(--tg-muted); }

/* Notices on tints of the hue. */
.tg-callout { border-radius: var(--tl-inner); box-shadow: none; }
.tg-callout.is-info, .tg-callout.is-accent { background: var(--tl-tint-2); border-color: transparent; color: var(--tl-ink); }

/* =============================================================================================
   4. Controls
   ============================================================================================= */
.fi-btn { border-radius: 999px; font-weight: 600; }
.fi-btn.fi-size-md { min-height: var(--tg-control-h); padding-inline: 1rem; }
.fi-btn.fi-color-primary:not(.fi-outlined) { background: var(--tl-blue); color: #fff; }
.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-disabled):not([disabled]):hover { background: var(--tl-blue-hover); }
/* Secondary buttons: white with a real 1px edge (not a drawn shadow), so every button is flat. */
.fi-btn:not(.fi-color):not(.fi-outlined), .fi-btn.fi-color-gray:not(.fi-outlined) { background: var(--tg-surface); box-shadow: none; border: 1px solid var(--tg-border-strong); color: var(--tg-text); }
.fi-btn.fi-outlined { box-shadow: none; border: 1px solid var(--tg-border-strong); }
.fi-btn.fi-color:not(.fi-outlined) { box-shadow: none; }
.fi-icon-btn { border-radius: 999px; }
.fi-link { font-weight: 500; }

.fi-input-wrp { border-radius: var(--tl-inner); }
.fi-select-input, .fi-fo-select .fi-input-wrp { border-radius: var(--tl-inner); }
.fi-fo-field-label-content, .fi-fo-field-wrp-label { font-weight: 500; }

/* Tabs: a pill track. The selected tab is white on the tint; counts stay where a queue needs someone. */
.fi-tabs:not(.fi-vertical) {
    display: inline-flex; width: auto; max-width: 100%; gap: 0.125rem; padding: 0.25rem;
    background: var(--tl-tint-3); border: 0; border-radius: 999px; box-shadow: none; overflow-x: auto;
}
.fi-tabs.fi-contained:not(.fi-vertical) { padding-inline: 0.25rem; }
.fi-tabs:not(.fi-vertical) .fi-tabs-item { border: 0; margin: 0; border-radius: 999px; padding: 0.375rem 0.875rem; min-height: 2rem; white-space: nowrap; }
.fi-tabs:not(.fi-vertical) .fi-tabs-item:hover { background: rgb(255 255 255 / 0.55); }
.fi-tabs:not(.fi-vertical) .fi-tabs-item.fi-active { background: var(--tg-surface); box-shadow: none; }
.fi-tabs-item .fi-tabs-item-label { color: var(--tg-text-2); font-weight: 500; }
.fi-tabs-item.fi-active .fi-tabs-item-label { color: var(--tl-ink); font-weight: 600; }
.fi-tabs-item .fi-badge { background: transparent; box-shadow: none; padding: 0 0.125rem; min-height: 0; color: var(--tg-muted); font-weight: 500; }
.fi-tabs-item .fi-badge:not(.fi-color-gray) { color: var(--tl-ink); }
.dark .fi-tabs:not(.fi-vertical) .fi-tabs-item.fi-active { background: var(--tg-surface-3); }

/* Our own segmented controls take the same track. */
.tg-seg { background: var(--tl-tint-3); border: 0; border-radius: 999px; padding: 0.25rem; box-shadow: none; }
.tg-seg > :is(button, a) { border-radius: 999px; }
.tg-seg > :is(button, a)[aria-pressed="true"], .tg-seg > .is-active, .tg-seg > [aria-current] { background: var(--tg-surface); color: var(--tl-ink); box-shadow: none; }

/* Badges and status pills: pale tints with the dark of their own hue, no outline. */
.fi-badge { border-radius: 999px; box-shadow: none; font-weight: 500; }
.fi-badge.fi-color-gray { box-shadow: none; }
.fi-badge.fi-color-primary, .fi-badge.fi-color-info { background: var(--tl-tint-2); color: var(--tl-ink); box-shadow: none; }
.fi-badge:is(.fi-color-success, .fi-color-warning, .fi-color-danger) { box-shadow: none; }
.tg-badge { border-radius: 999px; box-shadow: none; }

/* What floats keeps its shadow: menus, popovers, modals. */
.fi-dropdown-panel { border-radius: var(--tl-inner); }
.fi-modal-window { border-radius: var(--tl-panel); }
.fi-modal-footer .fi-btn { min-width: 6rem; }
.fi-no-notification { border-radius: var(--tl-inner); }

/* =============================================================================================
   5. Screen touches
   ============================================================================================= */
/* Job page: the progress, the next move and who owes it are panels like the rest: no outline, no gradient.
   A held or stuck job edges its waiting card in amber; a move that is yours tints the next-step bar. */
.jb-steps, .jb-next, .jb-wait { box-shadow: none; border: 0; border-radius: var(--tl-panel); }
.jb-steps { padding: 1.25rem 1.5rem; }
.jb-next { padding: 1rem 1.5rem; }
.jb-next.is-mine { background: var(--tl-tint-2); box-shadow: none; }
.jb-wait { padding: 1.25rem 1.5rem; background: var(--tg-surface); }
.jb-wait.is-hold, .jb-wait.is-stuck { background: var(--tg-surface); box-shadow: none; border: 1px solid var(--tg-warning-border); }

/* Job progress: the hue marks how far the job has come. */
.jb-step.is-done .jb-step-dot, .jb-step.is-current .jb-step-dot { border-color: var(--tl-blue); }
.jb-step.is-done .jb-step-dot { background: var(--tl-blue); }

/* Labels are sentence case at a readable size everywhere, the crew's phone included: no tracked capitals. */
:is(.fj-h, .mj-date, .fj-facts dt, .fj-value small, .fj-ptag, .mj-day dt, .lb-point, .tg-eyebrow, .tg-login-eyebrow,
    .tg-login-roles-head, .fi-modal-eyebrow, .tg-study-menu-label, .tg-trace-kind) { text-transform: none; letter-spacing: 0; }
.fj-h { font-size: var(--tg-fs-sm); font-weight: 600; color: var(--tg-heading); }
:is(.fj-facts dt, .mj-day dt) { font-size: var(--tg-fs-xs); font-weight: 500; color: var(--tg-muted); }
.fj-value small, .fj-ptag { font-size: var(--tg-fs-xs); }
.mj-date { font-size: var(--tg-fs-xs); }

/* Schedule: its two numbers span the canvas like every other strip, so the panel never stops short. */
.sc-kpis { max-width: none; }

/* Login: one soft card on the ground. */
.fi-simple-layout { background: var(--tg-bg); }
.fi-simple-main { background: var(--tg-surface); border-radius: var(--tl-panel); box-shadow: none; }

/* =============================================================================================
   6. Phones
   ============================================================================================= */
@media (max-width: 47.99rem) {
    .fi-header-heading { font-size: 1.375rem; line-height: 1.75rem; }
    .fi-page-header-main-ctn { padding-block: 1rem 1.25rem; }
    .tg-kpi-strip { padding: 1rem; gap: 1rem; }
    .fi-tabs:not(.fi-vertical) { display: flex; }
}

/* Overview: the two lists share a bottom edge; each closes on its footer link, pinned to the panel's foot. */
.ov-cols > .tg-section { display: flex; flex-direction: column; }
.ov-cols > .tg-section > .tg-section-body { flex: 1; display: flex; flex-direction: column; }
.ov-cols .tg-list { flex: 1; display: flex; flex-direction: column; }
.ov-cols .ov-att-more { margin-top: auto; color: var(--tl-ink); font-weight: 500; }
/* List sublines read at 13px. */
.ov-job-meta, .ov-att-meta, .bd-meta, .tg-list-item-meta { font-size: var(--tg-fs-sm); }
