/* AMOS Middleware Platform — Visual Baseline (Task 7, 2026-05-30) */
/* Enterprise aviation software: calm, readable, data-dense, professional. */

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
    /* Palette */
    --bg:           #f7f8fa;
    --surface:      #ffffff;
    --border:       #e3e6ea;
    --text:         #1c2024;
    --text-muted:   #5b6470;
    --accent:       #1f6feb;
    --accent-hover: #1a5fd0;
    --danger:       #c0392b;
    --ok:           #1e7e46;
    --warn:         #9a6700;

    /* Spacing scale: 4 / 8 / 12 / 16 / 24 / 32 px */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;

    /* Radius + shadow */
    --radius: 6px;
    --shadow: 0 1px 2px rgba(0,0,0,.06);

    /* ── Backward-compat aliases (consumed by existing rules below) ──────── */
    --bg-page:       var(--bg);
    --bg-card:       var(--surface);
    --bg-base:       var(--bg);
    --bg-input:      #eef0f3;
    --text-primary:  var(--text);
    --text-secondary:var(--text-muted);
    --text-dim:      #8e98a4;
    --success:       var(--ok);
    --warning:       var(--warn);
}

/* ── Dark theme token overrides ──────────────────────────────────────────── */
/* Recovered from authentic pre-Task-7 dark palette (amos_snapshot_20260506_093702) */
/* Switching html[data-theme="dark"] flips every component because all rules    */
/* already consume the tokens above — no per-component dark overrides needed.   */

html[data-theme="dark"] {
    /* Core palette */
    --bg:           #0f1117;
    --surface:      #1a1f2e;
    --border:       #2d3748;
    --text:         #e2e8f0;
    --text-muted:   #a0aec0;
    --accent:       #4a90d9;
    --accent-hover: #5a9fe8;
    --danger:       #fc8181;
    --ok:           #48bb78;
    --warn:         #f6ad55;

    /* Shadow deeper on dark backgrounds */
    --shadow: 0 2px 8px rgba(0,0,0,.35);

    /* Backward-compat aliases */
    --bg-page:        var(--bg);
    --bg-card:        var(--surface);
    --bg-base:        var(--bg);
    --bg-input:       #0d1117;
    --text-primary:   var(--text);
    --text-secondary: var(--text-muted);
    --text-dim:       #8b98a8;
    --success:        var(--ok);
    --warning:        var(--warn);
}

/* ── Theme toggle button ──────────────────────────────────────────────────── */

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 5px 8px;
    transition: background-color .12s ease, color .12s ease;
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--bg-input);
    color: var(--text);
}

/* ── Reset ────────────────────────────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

body {
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--sp-5);
}

.container-wide {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 var(--sp-5);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-4) 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--sp-5);
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ── Top navbar ───────────────────────────────────────────────────────────── */

.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--sp-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.navbar-brand:hover {
    text-decoration: none;
    color: var(--accent);
}

/* ── Navbar nav area ─────────────────────────────────────────────────────── */

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    flex: 1;
    padding: 0 var(--sp-4);
    min-width: 0;
}

/* Operator-tier flat links */
.navbar-nav .nav-link {
    display: inline-block;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-muted);
    white-space: nowrap;
    transition: background-color .12s ease;
    text-decoration: none;
}
.navbar-nav .nav-link:hover {
    background-color: var(--bg-input);
    color: var(--text);
    text-decoration: none;
}
.navbar-nav .nav-link.active,
.navbar-nav .nav-link[aria-current="page"] {
    color: var(--accent);
    background-color: rgba(31,111,235,.08);
    font-weight: 500;
}

/* Navbar links that live outside .navbar-nav (e.g. direct children) */
.navbar > a.nav-link,
.navbar-nav > a.nav-link {
    /* same as above — covered */
}

/* ── Admin nav group (<details> + <summary>) ─────────────────────────────── */

.navbar-nav .nav-group {
    position: relative;
}

.navbar-nav .nav-group-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;   /* remove default <summary> marker */
    user-select: none;
    white-space: nowrap;
    transition: background-color .12s ease;
}
/* Remove default summary triangle in all browsers */
.navbar-nav .nav-group-toggle::-webkit-details-marker { display: none; }
.navbar-nav .nav-group-toggle::marker              { display: none; }

.navbar-nav .nav-group-toggle::after {
    content: "▾";
    font-size: 0.7rem;
    opacity: 0.6;
}
.navbar-nav .nav-group[open] > .nav-group-toggle::after {
    content: "▴";
}

.navbar-nav .nav-group-toggle:hover {
    background-color: var(--bg-input);
    color: var(--text);
}

/* Visually subordinate: slightly muted label compared to operator links */
.navbar-nav .nav-group > .nav-group-toggle {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    opacity: .85;
}

/* Admin dropdown panel */
.navbar-nav .nav-group-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    padding: var(--sp-2) 0;
    z-index: 200;
}

/* Sub-group sections inside the panel */
.navbar-nav .nav-subgroup {
    padding: var(--sp-2) 0 var(--sp-1);
}
.navbar-nav .nav-subgroup + .nav-subgroup {
    border-top: 1px solid var(--border);
    margin-top: var(--sp-1);
}

.navbar-nav .nav-subgroup-label {
    display: block;
    padding: var(--sp-1) var(--sp-4);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    opacity: .7;
}

/* Links inside the admin panel */
.navbar-nav .nav-group-panel .nav-link {
    display: block;
    padding: var(--sp-2) var(--sp-4);
    font-size: 0.875rem;
    color: var(--text-muted);
    border-radius: 0;
    white-space: nowrap;
    transition: background-color .12s ease;
}
.navbar-nav .nav-group-panel .nav-link:hover {
    background-color: var(--bg-input);
    color: var(--text);
    text-decoration: none;
}
.navbar-nav .nav-group-panel .nav-link.active {
    color: var(--accent);
    background-color: rgba(31,111,235,.06);
}

/* ── P1: four-mode nav — mode tabs + per-mode sidebar ────────────────────────
   aimos_render_nav() (app/Views/nav.php) now echoes a <nav class="mode-tabs">
   (rendered inline in the top .navbar-nav row) followed by an
   <aside class="mode-sidebar"> for the active mode's sections. The sidebar is
   taken out of normal flow (position: fixed) so its DOM nesting inside
   .navbar-nav doesn't constrain it to the 52px top-bar row — it renders as a
   real left column below the bar. Blue/accent is reserved for navigation only;
   every color here comes from the existing --… tokens (light + dark both
   covered automatically since the tokens flip under html[data-theme="dark"]). */

.mode-tabs {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    height: 100%;
}

.mode-tabs a {
    display: inline-block;
    padding: var(--sp-2) var(--sp-3);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color .12s ease, border-color .12s ease;
}
.mode-tabs a:hover {
    color: var(--text);
    text-decoration: none;
}
.mode-tabs a.active,
.mode-tabs a[aria-current="page"] {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.mode-sidebar {
    position: fixed;
    top: 52px;                 /* .navbar height */
    left: 0;
    bottom: 0;
    width: 220px;
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: var(--sp-4) 0;
    z-index: 90;                /* below .navbar (z-index: 100) */
}

.nav-section + .nav-section {
    margin-top: var(--sp-4);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border);
}

.nav-section-label {
    display: block;
    padding: 0 var(--sp-4) var(--sp-2);
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    opacity: .75;
}

/* Sidebar links — more specific than .navbar-nav .nav-link so these rules win
   the cascade for the (structurally nested) .nav-link elements inside
   .mode-sidebar, without touching the legacy .navbar-nav .nav-link rules
   above (kept until the pre-P1 admin dropdown CSS is retired separately). */
.mode-sidebar .nav-link {
    display: block;
    padding: var(--sp-2) var(--sp-4);
    font-size: 0.875rem;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    border-radius: 0;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.mode-sidebar .nav-link:hover {
    background-color: var(--bg-input);
    color: var(--text);
    text-decoration: none;
}
.mode-sidebar .nav-link.active,
.mode-sidebar .nav-link[aria-current="page"] {
    color: var(--accent);
    background-color: var(--bg-input);
    border-left-color: var(--accent);
    font-weight: 500;
}

/* Give page content room for the fixed sidebar, only on pages where one is
   actually rendered (logged-out pages like login.php have no .mode-sidebar). */
body:has(.mode-sidebar) .container,
body:has(.mode-sidebar) .container-wide {
    margin-left: 220px;
}

/* ── Navbar user area ─────────────────────────────────────────────────────── */

.navbar-user {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Search box — ID selector overrides .form-control width:100% so media queries can shrink it. */
#globalSearch {
    width: 220px;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4);
    box-shadow: var(--shadow);
}

.card-header {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid var(--border);
}

/* ── Dashboard tiles ──────────────────────────────────────────────────────── */

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: var(--sp-5);
}

.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-5);
    text-align: center;
    transition: background-color .12s ease;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    display: block;
    box-shadow: var(--shadow);
}
.tile:hover {
    background-color: var(--bg-input);
    border-color: var(--accent);
    text-decoration: none;
    color: var(--text);
}

.tile-icon {
    font-size: 2rem;
    margin-bottom: var(--sp-3);
    color: var(--accent);
}

.tile-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.tile-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tile-badge {
    display: inline-block;
    background: var(--danger);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    vertical-align: middle;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */

.form-group {
    margin-bottom: var(--sp-4);
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: var(--sp-2) var(--sp-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color .12s ease;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(31,111,235,.15);
}
.form-control::placeholder {
    color: var(--text-muted);
    opacity: .7;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235b6470' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 4px;
}

.form-help {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 4px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: var(--sp-2) var(--sp-4);
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .12s ease;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover {
    text-decoration: none;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn-success {
    background: var(--ok);
    color: #fff;
}
.btn-success:hover {
    background: #196637;
    color: #fff;
}

.btn-warning {
    background: var(--warn);
    color: #1a1a1a;
}
.btn-warning:hover {
    background: #7a5200;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #9b2d22;
    color: #fff;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--border);
    color: var(--text);
}

.btn-sm {
    padding: var(--sp-1) var(--sp-3);
    font-size: 0.8rem;
}

.btn-group {
    display: flex;
    gap: var(--sp-2);
}

/* ── Tables ───────────────────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: var(--sp-2) var(--sp-3);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-input);
    text-align: left;
    cursor: pointer;
    user-select: none;
    position: relative;
}
th:hover {
    color: var(--accent);
}
th.sort-asc::after  { content: ' ▲'; font-size: 0.65rem; }
th.sort-desc::after { content: ' ▼'; font-size: 0.65rem; }

td {
    text-align: left;
    font-size: 0.9rem;
}

tr:nth-child(even) td {
    background: rgba(0,0,0,.02);
}
tr:hover td {
    background: rgba(31,111,235,.03);
}

/* ── Badges / Status ──────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 2px var(--sp-2);
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: rgba(30,126,70,.1);   color: var(--ok); }
.badge-warning { background: rgba(154,103,0,.1);   color: var(--warn); }
.badge-danger  { background: rgba(192,57,43,.1);   color: var(--danger); }
.badge-info    { background: rgba(31,111,235,.1);  color: var(--accent); }
.badge-muted   { background: rgba(91,100,112,.1);  color: var(--text-muted); }

/* ── Alerts ───────────────────────────────────────────────────────────────── */

.alert {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius);
    margin-bottom: var(--sp-4);
    font-size: 0.9rem;
    border: 1px solid;
}

.alert-success { background: rgba(30,126,70,.08);  border-color: var(--ok);     color: var(--ok); }
.alert-warning { background: rgba(154,103,0,.08);  border-color: var(--warn);   color: var(--warn); }
.alert-danger  { background: rgba(192,57,43,.08);  border-color: var(--danger); color: var(--danger); }
.alert-info    { background: rgba(31,111,235,.08); border-color: var(--accent); color: var(--accent); }

/* ── Login page ───────────────────────────────────────────────────────────── */

.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-box .card {
    padding: var(--sp-6);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--sp-5);
}

.login-logo h2 {
    font-size: 1.5rem;
    color: var(--accent);
    font-weight: 700;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* ── Review split view ────────────────────────────────────────────────────── */

.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 60vh;
}

.split-view .source-panel {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4);
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    line-height: 1.5;
}

.split-view .edit-panel {
    overflow-y: auto;
}

/* ── Field flags (data quality) ───────────────────────────────────────────── */

.field-flagged {
    border-left: 3px solid var(--warn);
    padding-left: 8px;
}

.field-low-confidence {
    border-left: 3px solid var(--danger);
    padding-left: 8px;
}

.field-missing-required {
    border-left: 3px solid var(--danger);
    padding-left: 8px;
    background: rgba(192,57,43,.05);
    border-radius: 0 4px 4px 0;
}

.confidence-indicator {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.confidence-high { background: rgba(30,126,70,.12);  color: var(--ok); }
.confidence-mid  { background: rgba(154,103,0,.12);  color: var(--warn); }
.confidence-low  { background: rgba(192,57,43,.12);  color: var(--danger); }

/* ── Upload / drop zone ───────────────────────────────────────────────────── */

.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px var(--sp-5);
    text-align: center;
    transition: background-color .12s ease;
    cursor: pointer;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent);
    background: rgba(31,111,235,.04);
}

.dropzone-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: var(--sp-3);
}

.dropzone-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.dropzone-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: var(--sp-2);
    opacity: .8;
}

/* ── Progress ─────────────────────────────────────────────────────────────── */

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin: var(--sp-2) 0;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease;
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-5);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-4);
}

.modal-header h3 {
    font-size: 1.05rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.modal-footer {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-2);
}

/* ── Pagination ───────────────────────────────────────────────────────────── */

.pagination {
    display: flex;
    gap: 4px;
    list-style: none;
    margin-top: 20px;
    justify-content: center;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 var(--sp-2);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: border-color .12s ease, background-color .12s ease;
}
.pagination a:hover {
    border-color: var(--accent);
    text-decoration: none;
}
.pagination .active span {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Utilities ────────────────────────────────────────────────────────────── */

.text-success { color: var(--ok); }
.text-warning { color: var(--warn); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

.mt-1 { margin-top: var(--sp-2); }
.mt-2 { margin-top: var(--sp-4); }
.mt-3 { margin-top: var(--sp-5); }
.mb-1 { margin-bottom: var(--sp-2); }
.mb-2 { margin-bottom: var(--sp-4); }
.mb-3 { margin-bottom: var(--sp-5); }

.d-flex         { display: flex; }
.align-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-1          { gap: var(--sp-2); }
.gap-2          { gap: var(--sp-4); }

.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────────────────────────── */

/* At mid-width desktops compress the navbar to prevent nav item clipping.
   The operator picker + search box + other user-area items can crowd out nav
   links at 1440–1600px. Strategy: shrink search, tighten nav-link padding,
   reduce user-area gap, and cap the operator picker select. */
@media (max-width: 1600px) {
    #globalSearch {
        width: 160px;
    }
    .navbar-user {
        gap: var(--sp-2);
    }
    .navbar-nav {
        gap: 0;
    }
    .navbar-nav .nav-link,
    .navbar-nav .nav-group-toggle {
        padding-left: var(--sp-2);
        padding-right: var(--sp-2);
    }
}

@media (max-width: 1440px) {
    #globalSearch {
        width: 130px;
    }
    .navbar-user {
        gap: 6px;
    }
    /* operator picker has inline styles — need !important to shrink at this breakpoint */
    #operatorPickerWrap {
        padding: 3px 4px !important;
        gap: 4px !important;
    }
    #operatorPickerSelect {
        max-width: 100px !important;
    }
    .navbar-nav .nav-link,
    .navbar-nav .nav-group-toggle {
        padding-left: 6px;
        padding-right: 6px;
        font-size: 0.82rem;
    }
}

@media (max-width: 1280px) {
    #globalSearch {
        width: 100px;
    }
    .navbar-user {
        gap: 4px;
    }
    #operatorPickerWrap {
        padding: 2px 4px !important;
        gap: 2px !important;
    }
    #operatorPickerSelect {
        max-width: 75px !important;
    }
    .navbar-nav .nav-link,
    .navbar-nav .nav-group-toggle {
        padding-left: 4px;
        padding-right: 4px;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .split-view {
        grid-template-columns: 1fr;
    }
    .tile-grid {
        grid-template-columns: 1fr 1fr;
    }
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: var(--sp-3) var(--sp-4);
        gap: var(--sp-2);
    }
    .navbar-nav {
        flex-wrap: wrap;
        padding: 0;
    }
    #globalSearch {
        width: 140px;
    }
}

@media (max-width: 480px) {
    .tile-grid {
        grid-template-columns: 1fr;
    }
}
