/* =============================================================
 * Clever Transco TMS — Shared shell CSS (topbar + tabnav + theme)
 *
 * Used by all pages that include the modern shell. Inter +
 * JetBrains Mono fonts must be loaded by the page itself.
 * ============================================================= */

  /* ============================================================
     THEME VARIABLES — Light (default) + Dark
     Toggle by setting data-theme="dark" on <html>.
     The bootstrap script in tms-shell-nav.js sets this pre-paint.
     ============================================================ */
  :root {
    /* Surfaces */
    --surface-page:        #f1f5f9;
    --surface-card:        rgba(255,255,255,0.92);
    --surface-card-end:    rgba(248,251,253,0.92);
    --surface-card-solid:  #ffffff;
    --surface-card-alt:    #f9fafb;
    --surface-elev:        rgba(255,255,255,0.98);
    --surface-elev-end:    rgba(248,251,253,0.98);

    /* Borders */
    --border-card:         rgba(28,116,166,0.10);
    --border-card-hover:   rgba(86,194,239,0.28);
    --border-subtle:       #e8eaed;
    --border-divider:      rgba(28,116,166,0.08);

    /* Text */
    --text-primary:        #050810;
    --text-secondary:      #4b5563;
    --text-muted:          #6b7280;
    --text-heading:        #003258;
    --text-link:           #1C74A6;
    --text-on-dark:        #ffffff;

    /* Shadows */
    --shadow-card:         0 1px 0 rgba(255,255,255,0.9) inset, 0 18px 40px -22px rgba(5,8,16,0.18), 0 2px 8px rgba(28,116,166,0.06);
    --shadow-card-hover:   0 1px 0 rgba(255,255,255,0.9) inset, 0 24px 60px -22px rgba(28,116,166,0.22), 0 6px 18px rgba(86,194,239,0.10);
    --shadow-modal:        0 30px 80px -20px rgba(5,8,16,0.45), 0 18px 50px -18px rgba(28,116,166,0.20), inset 0 1px 0 rgba(255,255,255,0.9);

    /* Body */
    --body-bg:             #f1f5f9;

    color-scheme: light;
  }

  :root[data-theme="dark"] {
    /* Surfaces — dark navy glass (lifted for card pop) */
    --surface-page:        #050810;
    --surface-card:        rgba(26,38,62,0.92);
    --surface-card-end:    rgba(20,30,52,0.92);
    /* NOTE: these two are the OPAQUE no-glass fallback. On pages with the freight-map
       backdrop, tms-glass.css overrides BOTH to translucent glass (search
       "SURFACE TOKEN PAIR"). They are a PAIR — never change one without the other. */
    --surface-card-solid:  #131e36;
    --surface-card-alt:    #18243f;
    --surface-elev:        rgba(30,44,72,0.96);
    --surface-elev-end:    rgba(24,36,60,0.96);

    /* Borders */
    --border-card:         rgba(86,194,239,0.16);
    --border-card-hover:   rgba(86,194,239,0.42);
    --border-subtle:       rgba(255,255,255,0.08);
    --border-divider:      rgba(255,255,255,0.06);

    /* Text */
    --text-primary:        #f1f5f9;
    --text-secondary:      rgba(241,245,249,0.72);
    --text-muted:          rgba(241,245,249,0.52);
    --text-heading:        #d8f2ff;
    --text-link:           #56C2EF;
    --text-on-dark:        #ffffff;

    /* Shadows */
    --shadow-card:         0 1px 0 rgba(255,255,255,0.05) inset, 0 18px 40px -22px rgba(0,0,0,0.55), 0 2px 8px rgba(86,194,239,0.08);
    --shadow-card-hover:   0 1px 0 rgba(255,255,255,0.08) inset, 0 24px 60px -22px rgba(86,194,239,0.30), 0 6px 18px rgba(86,194,239,0.10);
    --shadow-modal:        0 30px 80px -20px rgba(0,0,0,0.75), 0 18px 50px -18px rgba(86,194,239,0.25), inset 0 1px 0 rgba(255,255,255,0.06);

    /* Body */
    --body-bg:             #050810;

    color-scheme: dark;
  }

  /* Smooth color/border/shadow transitions when toggling theme */
  html, body, .card, .kpi, .start-here, .start-here .sh-row, .morning-brief,
  .eod-handoff, .pnl-board, .revenue-rhythm, .section-divider,
  .queue-chip, .action-pop, .modal {
    transition: background-color .35s ease, border-color .35s ease, color .35s ease, box-shadow .35s ease;
  }

  /* ============================================================
     UNIVERSAL DARK MODE OVERRIDES
     These apply to ANY page that includes this shared CSS.
     Page-specific overrides go in the individual mockup files.
     ============================================================ */
  :root[data-theme="dark"] body { background: var(--body-bg) !important; color: var(--text-primary) !important; }

  /* Universal .card flips dark */
  :root[data-theme="dark"] .card {
    background: linear-gradient(180deg, var(--surface-card) 0%, var(--surface-card-end) 100%) !important;
    border: 1px solid var(--border-card) !important;
    box-shadow: var(--shadow-card) !important;
    color: var(--text-primary);
  }
  :root[data-theme="dark"] .card:hover {
    border-color: var(--border-card-hover) !important;
    box-shadow: var(--shadow-card-hover) !important;
  }
  :root[data-theme="dark"] .card-head {
    background: linear-gradient(180deg, var(--tint-sky-1, rgba(86,194,239,0.06)) 0%, transparent 100%) !important;
    border-bottom: 1px solid var(--border-divider) !important;
  }
  :root[data-theme="dark"] .card-head h2 { color: var(--text-heading) !important; }
  :root[data-theme="dark"] .card-head .sub { color: var(--text-secondary) !important; }
  :root[data-theme="dark"] .card-body { color: var(--text-primary); }
  :root[data-theme="dark"] .card b, :root[data-theme="dark"] .card strong { color: var(--text-primary) !important; }

  /* Universal row dividers — catch every *-row class */
  :root[data-theme="dark"] [class*="-row"] {
    border-bottom-color: var(--line-white-1, rgba(255,255,255,0.06)) !important;
  }
  :root[data-theme="dark"] [class*="-row"]:last-child {
    border-bottom-color: transparent !important;
  }

  /* Universal .qa buttons (white pills → dark glass) */
  :root[data-theme="dark"] .qa {
    background: var(--tint-white-1, rgba(255,255,255,0.05)) !important;
    border: 1px solid var(--line-sky-3, rgba(86,194,239,0.25)) !important;
    color: var(--text-primary) !important;
    font-weight: 700 !important;
  }
  :root[data-theme="dark"] .qa:hover {
    background: var(--tint-sky-2, rgba(86,194,239,0.12)) !important;
    border-color: var(--line-sky-4, rgba(86,194,239,0.50)) !important;
    color: var(--ct-sky, #56C2EF) !important;
  }
  :root[data-theme="dark"] .qa.primary {
    background: linear-gradient(135deg, var(--ct-blue, #1C74A6), var(--ct-sky, #56C2EF)) !important;
    color: var(--ct-white, #fff) !important;
    border-color: transparent !important;
  }
  :root[data-theme="dark"] .qa.primary:hover {
    background: linear-gradient(135deg, var(--ct-sky, #56C2EF), var(--ct-sky, #56C2EF)) !important;
    color: #06121F !important;
  }

  /* Tables */
  :root[data-theme="dark"] table { color: var(--text-primary) !important; }
  :root[data-theme="dark"] table th {
    color: var(--text-muted) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    background: var(--tint-white-1, rgba(255,255,255,0.02)) !important;
  }
  :root[data-theme="dark"] table td { border-bottom: 1px solid var(--border-divider) !important; }
  :root[data-theme="dark"] table tr:nth-child(even) { background: var(--tint-white-1, rgba(255,255,255,0.02)) !important; }
  :root[data-theme="dark"] table tr:hover td { background: var(--tint-sky-1, rgba(86,194,239,0.06)) !important; }

  /* Inputs / selects / textareas */
  :root[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
  :root[data-theme="dark"] select,
  :root[data-theme="dark"] textarea {
    background: var(--tint-white-1, rgba(255,255,255,0.05)) !important;
    border-color: var(--border-subtle) !important;
    color: var(--text-primary) !important;
  }
  :root[data-theme="dark"] input::placeholder,
  :root[data-theme="dark"] textarea::placeholder { color: var(--text-muted) !important; }

  /* Action modals / popovers — .view-as-pop removed in Phase 29s, has its own
     canonical glass rule at line 473 (Phase 29r) so it doesn't fight legacy. */
  :root[data-theme="dark"] .action-pop,
  :root[data-theme="dark"] .action-modal,
  :root[data-theme="dark"] .modal,
  :root[data-theme="dark"] .flag-modal,
  :root[data-theme="dark"] .ooo-modal {
    background: linear-gradient(180deg, var(--surface-elev) 0%, var(--surface-elev-end) 100%) !important;
    border-color: var(--border-card-hover) !important;
    box-shadow: var(--shadow-modal) !important;
    color: var(--text-primary) !important;
  }

  /* View-as dropdown — flip row content for dark mode */
  :root[data-theme="dark"] .view-as-head {
    background: var(--tint-white-1, rgba(255,255,255,0.04)) !important;
    color: rgba(86,194,239,0.85) !important;
    border-bottom-color: var(--line-white-2, rgba(255,255,255,0.08)) !important;
  }
  :root[data-theme="dark"] .view-as-row {
    border-bottom-color: var(--line-white-1, rgba(255,255,255,0.06)) !important;
  }
  :root[data-theme="dark"] .view-as-row .name { color: var(--ct-sky, #56C2EF) !important; }
  :root[data-theme="dark"] .view-as-row .role { color: rgba(241,245,249,0.6) !important; }
  :root[data-theme="dark"] .view-as-row:hover {
    background: var(--tint-sky-2, rgba(86,194,239,0.12)) !important;
  }
  :root[data-theme="dark"] .view-as-row:hover .name { color:var(--t-ink) !important; }
  :root[data-theme="dark"] .view-as-row.active {
    background: var(--tint-sky-3, rgba(86,194,239,0.18)) !important;
  }
  :root[data-theme="dark"] .view-as-row.active .name { color: var(--ct-white, #fff) !important; }
  :root[data-theme="dark"] .view-as-row .check { color: var(--ct-good, #6ee7b7) !important; }
  :root[data-theme="dark"] .view-as-row .av {
    background: linear-gradient(135deg, var(--ct-sky, #56C2EF), var(--ct-blue, #1C74A6)) !important;
    color: #050810 !important;
    box-shadow: 0 0 0 2px var(--tint-sky-3, rgba(86,194,239,0.18));
  }
  :root[data-theme="dark"] .view-as-foot {
    background: var(--tint-white-1, rgba(255,255,255,0.03)) !important;
    color: rgba(241,245,249,0.55) !important;
    border-top-color: var(--line-white-1, rgba(255,255,255,0.06)) !important;
  }
  :root[data-theme="dark"] .view-as-foot a { color: var(--ct-sky, #56C2EF) !important; }
  /* Custom scrollbar — dark variant */
  :root[data-theme="dark"] .view-as-pop::-webkit-scrollbar-track {
    background: var(--tint-white-1, rgba(255,255,255,0.02)) !important;
  }
  :root[data-theme="dark"] .view-as-pop::-webkit-scrollbar-thumb {
    background: var(--line-sky-3, rgba(86,194,239,0.3)) !important;
  }
  :root[data-theme="dark"] .view-as-pop::-webkit-scrollbar-thumb:hover {
    background: rgba(86,194,239,0.5) !important;
  }

  /* Inline-style catch — flip any element with inline white/cream backgrounds */
  :root[data-theme="dark"] [style*="background:#fff"],
  :root[data-theme="dark"] [style*="background: #fff"],
  :root[data-theme="dark"] [style*="background:#ffffff"],
  :root[data-theme="dark"] [style*="background: #ffffff"],
  :root[data-theme="dark"] [style*="background:white"],
  :root[data-theme="dark"] [style*="background: white"],
  :root[data-theme="dark"] [style*="background: linear-gradient(180deg, #fff"],
  :root[data-theme="dark"] [style*="background: linear-gradient(135deg, #E3F2FB"],
  :root[data-theme="dark"] [style*="background: linear-gradient(135deg, #d1fae5"],
  :root[data-theme="dark"] [style*="background: #f0fdf4"],
  :root[data-theme="dark"] [style*="background:#f0fdf4"],
  :root[data-theme="dark"] [style*="background:var(--ct-cta-tint-08)"],
  :root[data-theme="dark"] [style*="background:var(--ct-cta-tint-08)"],
  :root[data-theme="dark"] [style*="background: #E3F2FB"],
  :root[data-theme="dark"] [style*="background:#E3F2FB"],
  :root[data-theme="dark"] [style*="background:var(--t-page)"],
  :root[data-theme="dark"] [style*="background:var(--t-page)"],
  :root[data-theme="dark"] [style*="background:var(--t-page)"],
  :root[data-theme="dark"] [style*="background:var(--t-page)"],
  :root[data-theme="dark"] [style*="background:var(--ct-cta-tint-08)"],
  :root[data-theme="dark"] [style*="background:var(--ct-cta-tint-08)"],
  :root[data-theme="dark"] [style*="background: #f8fafc"],
  :root[data-theme="dark"] [style*="background:#f8fafc"] {
    background: var(--tint-sky-1, rgba(86,194,239,0.06)) !important;
    border-color: var(--border-subtle) !important;
    color: var(--text-primary) !important;
  }
  /* When the footer pill catches the inline-bg flip, also brighten the <b> inside */
  :root[data-theme="dark"] [style*="background:var(--t-page)"] b,
  :root[data-theme="dark"] [style*="background:var(--t-page)"] b,
  :root[data-theme="dark"] [style*="background:var(--t-page)"] b,
  :root[data-theme="dark"] [style*="background:var(--t-page)"] b,
  :root[data-theme="dark"] [style*="background:var(--ct-cta-tint-08)"] b,
  :root[data-theme="dark"] [style*="background:var(--ct-cta-tint-08)"] b {
    color: var(--ct-white, #fff) !important;
  }
  /* Specifically force the colored dollar totals (SALES TOTAL / DISPATCHER TOTAL etc.)
     to brand colors when they were #047857 (green) — keep semantic green but brighter */
  :root[data-theme="dark"] [style*="background:var(--t-page)"] [style*="color:var(--ct-good)"],
  :root[data-theme="dark"] [style*="background:var(--t-page)"] [style*="color:var(--ct-good)"],
  :root[data-theme="dark"] [style*="background:var(--t-page)"] [style*="color:var(--ct-good)"],
  :root[data-theme="dark"] [style*="background:var(--t-page)"] [style*="color:var(--ct-good)"] {
    color: var(--ct-good, #6ee7b7) !important;
  }
  :root[data-theme="dark"] [style*="background:var(--t-page)"] [style*="color:#003258"],
  :root[data-theme="dark"] [style*="background:var(--t-page)"] [style*="color:#003258"],
  :root[data-theme="dark"] [style*="background:var(--t-page)"] [style*="color: #003258"],
  :root[data-theme="dark"] [style*="background:var(--t-page)"] [style*="color: #003258"] {
    color: var(--ct-sky, #56C2EF) !important;
  }

  /* Inline-style navy text → flip to light */
  :root[data-theme="dark"] [style*="color: #003258"],
  :root[data-theme="dark"] [style*="color:#003258"] { color: var(--text-heading) !important; }
  :root[data-theme="dark"] [style*="color:var(--t-ink)"],
  :root[data-theme="dark"] [style*="color:var(--t-ink)"] { color: var(--text-primary) !important; }
  :root[data-theme="dark"] [style*="color: #4b5563"],
  :root[data-theme="dark"] [style*="color:#4b5563"] { color: var(--text-secondary) !important; }
  :root[data-theme="dark"] [style*="color:var(--t-ink-2)"],
  :root[data-theme="dark"] [style*="color:var(--t-ink-2)"] { color: var(--text-muted) !important; }
  :root[data-theme="dark"] [style*="color: #9ca3af"],
  :root[data-theme="dark"] [style*="color:#9ca3af"] { color: var(--text-muted) !important; }

  /* Generic muted classes */
  :root[data-theme="dark"] .muted,
  :root[data-theme="dark"] .text-muted,
  :root[data-theme="dark"] .meta { color: var(--text-muted) !important; }

  /* ============================================================
     THEME TOGGLE BUTTON (rendered in topbar by tms-shell-nav.js)
     ============================================================ */
  .theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 999px;
    background: var(--tint-white-2, rgba(255,255,255,0.08));
    border: 1px solid var(--line-white-3, rgba(255,255,255,0.14));
    color: var(--ct-white, #fff);
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
    flex-shrink: 0;
    padding: 0;
  }
  .theme-toggle:hover {
    background: var(--tint-sky-3, rgba(86,194,239,0.20));
    border-color: var(--line-sky-4, rgba(86,194,239,0.45));
    transform: translateY(-1px);
  }
  .theme-toggle svg {
    width: 16px; height: 16px;
    transition: transform .4s cubic-bezier(.2,.7,.2,1);
  }
  .theme-toggle .icon-sun  { display: none; }
  .theme-toggle .icon-moon { display: block; }
  :root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
  :root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

  /* =========== TOP NAV (2026 dark glass) =========== */
  .topbar {
    height: 60px;
    background:
      linear-gradient(135deg, #050810 0%, #0a1a2e 100%); /* perf17: OPAQUE top bar (was .92/.88). With blur removed, a translucent bar flashed the map through on scroll = "headers go away". */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 1px solid var(--line-sky-2, rgba(86,194,239,0.18));
    box-shadow: var(--sh-deep-lg, 0 8px 32px rgba(5,8,16,0.25));
    color: var(--ct-white, #fff);
    display: flex; align-items: center;
    padding: 0 20px; gap: 20px;
    /* Phase 29 — bumped from 50 to 100 to clearly outrank the sticky tabnav
       (z-index 49) and ensure our dropdowns float above it. */
    position: sticky; top: 0; z-index: 100;
  }
  .brand {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; user-select: none;
    text-decoration: none; color: inherit;
  }
  .brand .mark {
    width: 36px; height: 36px; border-radius: var(--r-ctl, 10px);
    /* Owl icon as background — single source · every page gets it · no HTML changes needed */
    background: url('../assets/branding/ct-logo-icon-color.png') center/contain no-repeat;
    color: transparent;             /* hides any inline "CT" text without affecting layout */
    font-size: 0;                   /* belt-and-suspenders text-hide */
    display: grid; place-items: center;
    overflow: hidden;
    flex-shrink: 0;
  }
  /* When a page explicitly uses <img> inside .mark (e.g., branding page), let it through */
  .brand .mark img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
  }
  .brand .mark:has(img) {
    background: transparent;
    padding: 2px;
  }
  .brand .name {
    font-weight: 800; font-size: var(--fz-14h, 14.5px);
    letter-spacing: -0.01em;
    line-height: 1.1;
    color: var(--ct-white, #fff);
  }
  .brand .sub, .brand .tag {
    font-family: var(--ct-font-figures, 'JetBrains Mono', monospace);
    font-size: var(--fz-10, 10px); font-weight: 500;
    color: rgba(86,194,239,0.85);
    letter-spacing: 0.08em; text-transform: uppercase;
    margin-top: 1px;
  }
  .nav-search { flex: 1; max-width: 560px; position: relative; }
  .nav-search input {
    width: 100%; height: 38px;
    padding: 0 70px 0 40px;
    background: var(--tint-white-1, rgba(255,255,255,0.05));
    border: 1px solid var(--line-white-3, rgba(255,255,255,0.1));
    border-radius: var(--r-ctl, 10px);
    color: var(--ct-white, #fff); font-size: var(--fz-13, 13px); font-weight: 500;
    font-family: inherit;
    outline: none;
    transition: all 0.15s;
  }
  .nav-search input::placeholder { color: rgba(255,255,255,0.35); }
  .nav-search input:focus {
    background: var(--tint-white-2, rgba(255,255,255,0.08));
    border-color: var(--line-sky-4, rgba(86,194,239,0.5));
    box-shadow: 0 0 0 4px var(--tint-sky-2, rgba(86,194,239,0.1));
  }
  .nav-search svg {
    position: absolute; left: 13px; top: 50%;
    transform: translateY(-50%);
    width: 15px; height: 15px;
    color: rgba(255,255,255,0.4);
  }
  .nav-search .kbd {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    font-family: var(--ct-font-figures, 'JetBrains Mono', monospace);
    font-size: var(--fz-10, 10px); font-weight: 600;
    color: rgba(255,255,255,0.4);
    background: var(--tint-white-1, rgba(255,255,255,0.06));
    border: 1px solid var(--line-white-3, rgba(255,255,255,0.1));
    padding: 3px 7px; border-radius: 5px;
    pointer-events: none;
  }
  .nav-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
  .icon-btn {
    width: 38px; height: 38px; border-radius: var(--r-ctl, 10px);
    background: var(--tint-white-1, rgba(255,255,255,0.04));
    border: 1px solid var(--line-white-1, rgba(255,255,255,0.06));
    color: rgba(255,255,255,0.75);
    display: grid; place-items: center;
    position: relative; cursor: pointer;
    transition: all 0.15s;
  }
  .icon-btn:hover {
    background: var(--tint-white-2, rgba(255,255,255,0.1));
    color: var(--ct-white, #fff); border-color: var(--line-sky-3, rgba(86,194,239,0.3));
  }
  .icon-btn .dot {
    position: absolute; top: 7px; right: 7px;
    width: 9px; height: 9px; border-radius: 50%;
    background:var(--ct-bad-solid);
    box-shadow: 0 0 8px var(--ct-bad-solid, #dc2626), 0 0 0 2px #050810;
    animation: pulse 2s ease-in-out infinite;
  }
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
  }
  /* User chip: dark glass pill (keeps #userChip API for existing JS + view-as dropdown) */
  .user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 14px 4px 5px;
    background: var(--tint-white-1, rgba(255,255,255,0.06));
    border: 1px solid var(--line-white-2, rgba(255,255,255,0.08));
    border-radius: 999px;
    color: var(--ct-white, #fff); font-size: var(--fz-12h, 12.5px); font-weight: 600;
    cursor: pointer; position: relative;
    transition: all 0.15s;
    margin-left: 4px;
  }
  .user-chip:hover {
    background: var(--tint-white-2, rgba(255,255,255,0.1));
    border-color: var(--line-sky-3, rgba(86,194,239,0.3));
  }
  .user-chip .av {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--ct-sky, #56C2EF), var(--ct-blue, #1C74A6));
    color: #050810;
    display: grid; place-items: center;
    font-weight: 800; font-size: var(--fz-11, 11px);
    box-shadow: 0 2px 8px rgba(86,194,239,0.4);
  }
  .user-chip .caret { font-size: var(--fz-9, 9px); opacity: 0.7; margin-left: 2px; color: rgba(255,255,255,0.6); }
  .user-chip .preview-tag {
    font-family: var(--ct-font-figures, 'JetBrains Mono', monospace);
    font-size: var(--fz-9, 9px); font-weight: 800; letter-spacing: 0.06em;
    background: linear-gradient(135deg, var(--ct-sky, #56C2EF), var(--ct-blue, #1C74A6)); color: #050810;
    padding: 2px 7px; border-radius: 999px;
    margin-left: 4px; text-transform: uppercase;
    box-shadow: 0 0 0 1px var(--line-sky-3, rgba(86,194,239,0.3));
  }
  /* View-as picker dropdown */
  .view-as-pop {
    /* Phase 29s — canonical brand glass from tms-glass.css.
       Single source of truth — the old conflicting rule at line 175 was
       removed in Phase 29s, so this no longer needs !important. */
    position: fixed; top: 64px; right: 20px;
    color:var(--t-ink);
    /* AUDIT FIX 2026-08-16 (#2 — the profile dropdown was see-through)
       The panel was 36%-opaque glass, so the page read straight through it: in
       dark mode the "Recently viewed" labels were unreadable, in light mode the
       New Load button showed through the rows. It HAD already been made opaque
       — but only in clever-transco-3.0-home.css, and THIS file is the one the
       shell (clever-transco-tms.html) actually loads, so the fix never reached
       the dropdown anybody uses. Same miss as the notif-panel glass bug.
       If either file's .view-as-pop is touched again, change both. */
    background: #f7fafd;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 1px solid rgba(203,213,225,0.9);
    border-radius: var(--r-panel, 14px);
    box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 26px 56px -32px rgba(20,55,90,0.4);
    width: 300px; max-height: 70vh; overflow-y: auto;
    /* Phase 30.8 — explicit z-index hierarchy. User-chip dropdown is more
       critical (holds sign-out, view-as) so it sits above the notif panel
       (which is 2147483646). Both still float above everything else. */
    z-index: 2147483647; display: none;
  }
  :root[data-theme="dark"] .view-as-pop {
    color: #e2e8f0;
    /* AUDIT FIX 2026-08-16 (#2): opaque — see the light-mode note above. */
    background: #101a2e;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-color: var(--line-sky-3, rgba(86,194,239,0.30));
    box-shadow: 0 1px 0 var(--line-white-1, rgba(255,255,255,0.06)) inset, 0 26px 56px -32px rgba(0,0,0,0.6);
  }
  /* Visible scrollbar so users know the list scrolls when there are many users */
  .view-as-pop::-webkit-scrollbar { width: 8px; }
  .view-as-pop::-webkit-scrollbar-track { background: #f3f4f6; border-radius: 4px; }
  .view-as-pop::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
  .view-as-pop::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
  .view-as-pop.open { display: block; }
  .view-as-head {
    /* Phase 29u — glass header matching the notif-panel: faint brand-blue tint
       so it reads as a section header but doesn't break the frosted-glass feel */
    padding: 11px 14px; border-bottom: 1px solid var(--line-white-4, rgba(255,255,255,.22));
    font-size: var(--fz-10h, 10.5px); font-weight: 800; color: var(--ct-blue, #1C74A6);
    text-transform: uppercase; letter-spacing: 0.06em;
    background: var(--tint-blue-2, rgba(28,116,166,0.10));
  }
  /* Phase 29t — rows must be transparent so the glass shows through */
  .view-as-row {
    display: grid; grid-template-columns: 28px 1fr auto;
    gap: 10px; align-items: center;
    padding: 8px 14px; cursor: pointer;
    border-bottom: 1px solid var(--line-white-4, rgba(255,255,255,.18));
    background: transparent;
  }
  .view-as-row:hover { background: var(--tint-white-4, rgba(255,255,255,.20)); }
  .view-as-row.active { background: var(--tint-sky-3, rgba(86,194,239,.18)); }
  .view-as-row:last-child { border-bottom: 0; }
  .view-as-row .av {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--ct-blue, #1C74A6), var(--ct-navy, #003258));
    display: grid; place-items: center;
    font-size: var(--fz-10h, 10.5px); font-weight: 800; color: var(--ct-white, #fff);
  }
  .view-as-row .name { font-size: var(--fz-12h, 12.5px); font-weight: 600; color:var(--t-ink); }
  .view-as-row .role { font-size: var(--fz-10h, 10.5px); color:var(--t-ink-2); }
  .view-as-row .check { color:var(--ct-good); font-weight: 800; font-size: var(--fz-14, 14px); }
  /* Phase 29t — footer transparent so glass shows through */
  .view-as-foot {
    padding: 10px 14px; border-top: 1px solid var(--line-white-4, rgba(255,255,255,.18));
    background: transparent; font-size: var(--fz-11, 11px); color:var(--t-ink-2);
  }
  .view-as-foot a { color: var(--ct-blue, #1C74A6); font-weight: 600; }

  /* =========== SECOND NAV: navy band w/ glass dropdowns =========== */
  .tabnav {
    background:
      linear-gradient(180deg, #0a1a2e 0%, #081424 100%); /* perf17: OPAQUE tab bar (was .96/.92) */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-top: 1px solid var(--line-sky-3, rgba(86,194,239,0.25));
    border-bottom: 1px solid var(--line-sky-1, rgba(86,194,239,0.15));
    box-shadow:
      0 4px 18px rgba(5,8,16,0.25),
      inset 0 1px 0 rgba(86,194,239,0.08);
    display: flex; align-items: stretch;
    padding: 0 6px; height: 48px;
    position: sticky; top: 60px; z-index: 49;
    overflow-x: auto;
    /* Hide scrollbar but stay scrollable */
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* IE / old Edge */
  }
  .tabnav::-webkit-scrollbar { display: none; }   /* Chrome / Safari / Edge */
  .tabnav .tab-wrap { position: relative; display: flex; flex-shrink: 0; }
  .tabnav .tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 0 10px; height: 48px;
    font-family: inherit;
    font-size: var(--fz-12h, 12.5px); font-weight: 600;
    color: rgba(255,255,255,0.88);
    letter-spacing: -0.005em;
    background: transparent;
    border: 0; border-bottom: 2px solid transparent;
    cursor: pointer; white-space: nowrap; user-select: none;
    text-decoration: none;
    transition: color 0.12s, background 0.12s, border-color 0.12s;
    position: relative;
  }
  .tabnav .tab:hover {
    color: var(--ct-white, #fff);
    background: var(--tint-sky-2, rgba(86,194,239,0.08));
    text-decoration: none;
  }
  .tabnav .tab.active {
    color: var(--ct-white, #fff);
    background:
      linear-gradient(180deg, var(--tint-sky-1, rgba(86,194,239,0.06)) 0%, var(--tint-sky-3, rgba(86,194,239,0.18)) 100%);
    border-bottom-color: var(--ct-sky, #56C2EF);
    box-shadow: inset 0 -2px 12px rgba(86,194,239,0.25);
  }
  .tabnav .tab.active::before {
    content: '';
    position: absolute; left: 0; right: 0; bottom: -2px;
    height: 2px;
    background: var(--ct-sky, #56C2EF);
    box-shadow: 0 0 12px rgba(86,194,239,0.7);
  }
  .tabnav .tab.open {
    color: var(--ct-white, #fff);
    background: var(--tint-sky-3, rgba(86,194,239,0.2));
    border-bottom-color: var(--ct-sky, #56C2EF);
  }
  .tabnav .tab .tab-ic {
    width: 15px; height: 15px;
    color: rgba(86,194,239,0.9);
    flex-shrink: 0;
  }
  .tabnav .tab.active .tab-ic,
  .tabnav .tab.open .tab-ic { color: var(--ct-sky, #56C2EF); filter: drop-shadow(0 0 4px rgba(86,194,239,0.6)); }
  .tabnav .tab:hover .tab-ic { color: var(--ct-sky, #56C2EF); }
  /* Carets hidden — hover/click reveals the menu, no chevron clutter */
  .tabnav .tab .caret { display: none; }
  /* Override old red issues badge with modern style */
  .tabnav .tab .badge {
    font-family: var(--ct-font-figures, 'JetBrains Mono', monospace);
    font-size: var(--fz-10, 10px); font-weight: 700;
    padding: 1px 7px; border-radius: 999px;
    line-height: 16px; letter-spacing: 0.02em;
    background:var(--ct-bad-solid); color: var(--ct-white, #fff);
    box-shadow: 0 0 12px rgba(220,38,38,0.4);
    animation: badgePulse 2.4s ease-in-out infinite;
  }
  .tabnav .tab .tab-badge {
    font-family: var(--ct-font-figures, 'JetBrains Mono', monospace);
    font-size: var(--fz-10, 10px); font-weight: 700;
    padding: 1px 7px; border-radius: 999px;
    line-height: 16px; letter-spacing: 0.02em;
  }
  .tabnav .tab .tab-badge.cyan {
    background: var(--tint-sky-3, rgba(86,194,239,0.18));
    color: var(--ct-sky, #56C2EF);
    border: 1px solid var(--line-sky-3, rgba(86,194,239,0.35));
  }
  @keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 12px rgba(220,38,38,0.4); }
    50%      { box-shadow: 0 0 18px rgba(220,38,38,0.85); }
  }

  /* Dropdowns (glass cards) — appended to <body> by the shell JS to escape
     .tabnav's containing block (backdrop-filter on .tabnav creates a containing
     block for fixed descendants AND overflow-x:auto clips them). Selectors must
     work regardless of the dropdown's DOM ancestor, so they use .tms-dropdown
     instead of .tabnav .dropdown. */
  .tms-dropdown {
    position: fixed; top: 108px; left: 0;
    min-width: 280px;
    /* Solid panel (matches the goal/reminder modal skin) — was translucent and
       read see-through over the live map in both themes. */
    background: #131e36;
    border: 1px solid var(--line-sky-3, rgba(86,194,239,0.28));
    border-top: 0;
    border-radius: 0 0 14px 14px;
    box-shadow: 0 24px 60px rgba(5,8,16,0.55), 0 0 0 1px rgba(255,255,255,0.04) inset;
    padding: 8px;
    display: none;
    z-index: 200;
    font-family: var(--ct-font, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
  }
  .tms-dropdown.open { display: block; animation: ddIn 0.16s ease-out; }
  .tms-dropdown.wide { min-width: 360px; }
  @keyframes ddIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .tms-dropdown .dd-group + .dd-group {
    border-top: 1px solid var(--line-white-1, rgba(255,255,255,0.06));
    margin-top: 6px; padding-top: 6px;
  }
  .tms-dropdown .dd-label {
    padding: 8px 12px 4px;
    font-family: var(--ct-font-figures, 'JetBrains Mono', monospace);
    font-size: var(--fz-9h, 9.5px); font-weight: 600;
    color: rgba(86,194,239,0.7);
    text-transform: uppercase; letter-spacing: 0.08em;
  }
  .tms-dropdown .dd-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    border-radius: var(--r-ctl-sm, 8px);
    color: rgba(255,255,255,0.85);
    cursor: pointer; text-decoration: none;
    transition: all 0.12s;
  }
  .tms-dropdown .dd-item:hover {
    background: var(--tint-sky-2, rgba(86,194,239,0.1));
    color: var(--ct-white, #fff);
    text-decoration: none;
  }
  .tms-dropdown .dd-item .dd-ic {
    width: 28px; height: 28px; border-radius: 7px;
    background: var(--tint-sky-2, rgba(86,194,239,0.1));
    color: var(--ct-sky, #56C2EF);
    display: grid; place-items: center; flex-shrink: 0;
    transition: all 0.12s;
  }
  .tms-dropdown .dd-item .dd-ic svg { width: 13px; height: 13px; }
  .tms-dropdown .dd-item:hover .dd-ic {
    background: var(--tint-sky-3, rgba(86,194,239,0.2));
    color: var(--ct-white, #fff);
  }
  .tms-dropdown .dd-item .dd-txt { flex: 1; line-height: 1.3; }
  .tms-dropdown .dd-item .dd-nm { font-size: var(--fz-13, 13px); font-weight: 600; color: inherit; }
  .tms-dropdown .dd-item .dd-sub { font-size: var(--fz-11, 11px); color: rgba(255,255,255,0.45); font-weight: 400; margin-top: 2px; }
  .tms-dropdown .dd-item .dd-pill {
    font-family: var(--ct-font-figures, 'JetBrains Mono', monospace);
    font-size: var(--fz-9, 9px); font-weight: 700;
    padding: 2px 7px; border-radius: 999px;
    letter-spacing: 0.04em; text-transform: uppercase;
    flex-shrink: 0;
  }
  .tms-dropdown .dd-item .dd-pill.soon {
    background: var(--tint-white-1, rgba(255,255,255,0.06));
    color: rgba(255,255,255,0.4);
  }
  .tms-dropdown .dd-item .dd-pill.new {
    background: var(--wash-good-bright-3, rgba(74,222,128,0.15));
    color: #10B981;
    border: 1px solid rgba(74,222,128,0.25);
  }
  .tms-dropdown .dd-item.disabled { cursor: not-allowed; opacity: 0.55; }
  .tms-dropdown .dd-item.disabled:hover { background: transparent; color: rgba(255,255,255,0.55); }

  /* LIGHT-MODE nav dropdowns (were dark glass in both themes) */
  :root[data-theme="light"] .tms-dropdown{
    background:var(--ct-white, #ffffff) !important;
    -webkit-backdrop-filter:none !important;backdrop-filter:none !important;
    border:1px solid rgba(200,220,240,.8) !important;border-top:0 !important;
    box-shadow:0 24px 60px rgba(20,55,90,.28), 0 0 0 1px rgba(255,255,255,.5) inset !important;
  }
  :root[data-theme="light"] .tms-dropdown .dd-group + .dd-group{border-top:1px solid rgba(20,60,100,.10) !important;}
  :root[data-theme="light"] .tms-dropdown .dd-label{color:var(--ct-blue, #1C74A6) !important;}
  :root[data-theme="light"] .tms-dropdown .dd-item{color:var(--t-ink) !important;}
  :root[data-theme="light"] .tms-dropdown .dd-item:hover{background:var(--tint-blue-2, rgba(28,116,166,.10)) !important;color:var(--t-ink) !important;}
  :root[data-theme="light"] .tms-dropdown .dd-item .dd-ic{background:var(--tint-blue-2, rgba(28,116,166,.10)) !important;color:var(--ct-blue, #1C74A6) !important;}
  :root[data-theme="light"] .tms-dropdown .dd-item:hover .dd-ic{background:var(--tint-blue-3, rgba(28,116,166,.18)) !important;color:var(--ct-blue, #1C74A6) !important;}
  :root[data-theme="light"] .tms-dropdown .dd-item .dd-sub{color:#5b7184 !important;}
  :root[data-theme="light"] .tms-dropdown .dd-item .dd-pill.soon{background:rgba(20,60,100,.08) !important;color:var(--t-ink-2) !important;}
  :root[data-theme="light"] .tms-dropdown .dd-item.disabled:hover{background:transparent !important;color:var(--t-ink-2) !important;}

  /* =========== PAGE CONTENT BREATHING ROOM ===========
   * Apply padding-top to the FIRST element that follows the sticky tabnav,
   * so page content doesn't sit flush against the chrome. Uses the adjacent
   * sibling selector so spacing is baked into the content area (no visible
   * gap stripe regardless of body background color).
   */
  .tabnav + * { padding-top: 0; }   /* was 18px — that gap showed the map between the menu and the first card */

  /* ============================================================
     LIGHT-MODE NAV — theme-aware topbar + tabnav (frosted light)

     2026-09-14 · these were :root[data-theme="light"], so with NO data-theme
     attribute the cascade fell through to the bare .topbar rule above - a
     near-black gradient - and painted a black masthead over a white page. The
     shell's JavaScript does the opposite: getAttribute('data-theme') || 'light',
     and tms-theme-bootstrap.js falls back to light. Script and stylesheet
     disagreed about the default, and any moment the attribute was missing (a
     stale cached build without the bootstrap, a script error before it runs) the
     nav went dark on its own.

     :not([data-theme="dark"]) makes the stylesheet agree with the script: light
     unless dark is explicitly chosen. Dark mode is unaffected - it still needs
     its attribute, which is the only state that should be opt-in.
     ============================================================ */
  :root:not([data-theme="dark"]) .topbar{
    background:linear-gradient(135deg, var(--ct-white, #ffffff) 0%, #eef3fa 100%) !important; /* perf17 completion 2026-08-20: OPAQUE light top bar (was .82/.80). The perf17 pass
       made the dark topbar, the dark tabnav and the LIGHT TABNAV opaque and removed the
       blur, but missed this one — so in light mode the freight map and the page's own
       KPI text showed straight through the header on scroll, colliding with the clocks
       and the user chip. Same bug the dark rule above already documents. */
    border-bottom:1px solid rgba(20,60,100,.12) !important;
    box-shadow:0 8px 28px -18px rgba(20,55,90,.30) !important; color:var(--t-ink) !important;
  }
  :root:not([data-theme="dark"]) .brand .name{color:var(--t-ink) !important;}
  :root:not([data-theme="dark"]) .brand .sub, :root:not([data-theme="dark"]) .brand .tag{color:#5b7184 !important;}
  :root:not([data-theme="dark"]) .nav-search input{background:var(--t-glass) !important;border:1px solid rgba(20,60,100,.14) !important;color:var(--t-ink) !important;}
  :root:not([data-theme="dark"]) .nav-search input::placeholder{color:var(--t-ink-2) !important;}
  :root:not([data-theme="dark"]) .nav-search svg{color:var(--t-ink-2) !important;}
  :root:not([data-theme="dark"]) .nav-search .kbd{background:var(--tint-blue-2, rgba(28,116,166,.1)) !important;border:1px solid var(--line-blue-4, rgba(28,116,166,.25)) !important;color:var(--ct-blue, #1C74A6) !important;}
  :root:not([data-theme="dark"]) .icon-btn{color:var(--t-ink) !important;}
  :root:not([data-theme="dark"]) .icon-btn:hover{background:var(--tint-blue-2, rgba(28,116,166,.1)) !important;}
  :root:not([data-theme="dark"]) .user-chip{background:var(--t-glass) !important;border:1px solid rgba(20,60,100,.14) !important;color:var(--t-ink) !important;}
  :root:not([data-theme="dark"]) .user-chip .caret{color:#5b7184 !important;}
  :root:not([data-theme="dark"]) .ctms-trigger{background:var(--t-glass) !important;border:1px solid rgba(20,60,100,.14) !important;color:var(--t-ink) !important;}
  :root:not([data-theme="dark"]) .theme-toggle{background:var(--tint-blue-2, rgba(28,116,166,.1)) !important;border:1px solid rgba(20,60,100,.14) !important;color:var(--t-ink) !important;}
  :root:not([data-theme="dark"]) .tabnav{
    background:linear-gradient(180deg, var(--ct-white, #ffffff) 0%, #eef3fa 100%) !important; /* perf17: OPAQUE light tab bar (was .80/.74) */
    border-top:1px solid rgba(20,60,100,.10) !important;border-bottom:1px solid rgba(20,60,100,.10) !important;
    box-shadow:0 4px 18px -10px rgba(20,55,90,.18) !important;
  }
  :root:not([data-theme="dark"]) .tabnav .tab{color:var(--t-ink-2) !important;}
  :root:not([data-theme="dark"]) .tabnav .tab:hover, :root:not([data-theme="dark"]) .tabnav .tab.active{color:var(--t-ink) !important;}
  :root:not([data-theme="dark"]) .tabnav .tab .tab-ic{color:#7a93b0 !important;}
  :root:not([data-theme="dark"]) .tabnav .tab.active .tab-ic, :root:not([data-theme="dark"]) .tabnav .tab:hover .tab-ic{color:var(--ct-blue, #1C74A6) !important;filter:drop-shadow(0 0 4px rgba(28,116,166,.4)) !important;}
  :root:not([data-theme="dark"]) .tabnav .tab.active::before{background:var(--ct-blue, #1C74A6) !important;}
  :root:not([data-theme="dark"]) .tabnav .tab .tab-badge.cyan{background:var(--tint-blue-3, rgba(28,116,166,.14)) !important;color:var(--ct-blue, #1C74A6) !important;}
  /* My Portal CTA → white frosted glass to match the page */
  :root:not([data-theme="dark"]) #myPortalLink{
    background:var(--t-glass) !important;
    -webkit-backdrop-filter:blur(8px) saturate(160%);backdrop-filter:blur(8px) saturate(160%);
    border:1px solid var(--line-blue-4, rgba(28,116,166,.28)) !important;
    color:var(--t-ink) !important;
    box-shadow:0 6px 16px -10px rgba(20,55,90,.35), inset 0 1px 0 rgba(255,255,255,.6) !important;
  }
  :root:not([data-theme="dark"]) #myPortalLink *{color:var(--t-ink) !important;fill:var(--ct-blue, #1C74A6) !important;stroke:var(--ct-blue, #1C74A6) !important;}
  :root:not([data-theme="dark"]) #myPortalLink:hover{background:var(--t-glass) !important;}
  /* NN avatar → frosty light-blue circle with navy initials (was heavy dark circle) */
  :root:not([data-theme="dark"]) .user-chip .av{
    background:var(--tint-sky-3, rgba(86,194,239,.20)) !important;
    color:var(--t-ink) !important;
    border:1px solid var(--line-blue-4, rgba(28,116,166,.3)) !important;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.5) !important;
  }

  /* If the next element is itself a .pageheader/.page/.app wrapper with its own
     padding, add the gap as a separator. */
  .tabnav + .pageheader,
  .tabnav + header,
  .tabnav + main { margin-top: 0; padding-top: 22px; }

  /* =============================================================
     PORTAL SUB-BAR — small breadcrumb strip under the tabnav.
     Holds "← Home / My Portal · Whatever" + a LIVE/MOCK pill on the right.
     Used by my-portal.html, my-portal-dispatcher.html, my-portal-ops.html.
     ============================================================= */
  .portal-sub {
    background: var(--ct-white, #fff);
    border-bottom: 1px solid #e8eaed;
    padding: 10px 22px;
    display: flex; align-items: center; gap: 14px;
    font-size: var(--fz-11h, 11.5px); color:var(--t-ink-2);
    /* Defensive: stay above body::before texture overlay (z-index: 0) and
       any inline gradient backgrounds set on the portal pages. */
    position: relative;
    z-index: 2;
  }
  .portal-sub .crumbs { display: flex; align-items: center; gap: 6px; }
  .portal-sub .crumbs a {
    color: var(--ct-blue, #1C74A6); font-weight: 600;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px;
    border: 1px solid #d6e4ef; border-radius: var(--r-ctl-sm, 6px);
    background: #f5fafd;
    text-decoration: none;
    transition: background .12s, border-color .12s;
  }
  .portal-sub .crumbs a:hover {
    background: #e8f2fa; border-color: var(--ct-blue, #1C74A6);
    text-decoration: none;
  }
  .portal-sub .crumbs svg { width: 12px; height: 12px; }
  .portal-sub .crumbs .sep { color: #c4ccd5; }
  .portal-sub .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
  .portal-sub .live-pill {
    background: #ecfdf5; color:var(--ct-good);
    font-size: var(--fz-10, 10px); font-weight: 800;
    padding: 3px 8px; border-radius: 999px;
    letter-spacing: .04em;
    display: inline-flex; align-items: center; gap: 5px;
  }
  .portal-sub .live-pill::before {
    content: "";
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--ct-good-solid, #059669);
  }

  /* Dark mode flips */
  :root[data-theme="dark"] .portal-sub {
    background: var(--tint-white-1, rgba(255,255,255,0.03)) !important;
    border-bottom-color: var(--line-white-1, rgba(255,255,255,0.06)) !important;
    color: rgba(216,224,236,0.6) !important;
  }
  :root[data-theme="dark"] .portal-sub .crumbs a {
    background: var(--tint-sky-2, rgba(86,194,239,0.1)) !important;
    border-color: var(--line-sky-3, rgba(86,194,239,0.25)) !important;
    color: #67e8f9 !important;
  }
  :root[data-theme="dark"] .portal-sub .crumbs a:hover {
    background: var(--tint-sky-3, rgba(86,194,239,0.2)) !important;
    border-color: var(--ct-sky, #56C2EF) !important;
  }
  :root[data-theme="dark"] .portal-sub .crumbs .sep { color: var(--tint-white-4, rgba(255,255,255,0.2)) !important; }
  :root[data-theme="dark"] .portal-sub .live-pill {
    background: var(--wash-good-4, rgba(5,150,105,0.18)) !important;
    color: var(--ct-good, #6ee7b7) !important;
  }

  /* =============================================================
     MOBILE RESPONSIVE — TOPBAR / TABNAV / PORTAL-SUB
     Phones: <= 540px. Small phones: <= 420px.
     ============================================================= */
  @media (max-width: 720px) {
    /* Topbar: shrink padding, hide kbd shortcut */
    .topbar { padding: 0 12px; gap: 10px; height: 56px; }
    .brand .tag { display: none; }   /* hide "TMS · v2026.05" subtitle */
    .nav-search .kbd { display: none; }
    .nav-search input { padding: 0 12px 0 36px; font-size: var(--fz-13, 13px); }
    .nav-search { max-width: none; }
    .nav-actions { gap: 4px; }
    .user-chip { padding: 4px 8px 4px 4px; font-size: var(--fz-11h, 11.5px); }
    .user-chip span:not(.caret):not(.preview-tag) { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    /* Tabnav: horizontal scroll instead of wrap */
    .tabnav {
      overflow-x: auto;
      flex-wrap: nowrap;
      scrollbar-width: none;       /* Firefox */
    }
    .tabnav::-webkit-scrollbar { display: none; }  /* Safari/Chrome */
    .tab-wrap { flex-shrink: 0; }
    /* Portal sub-bar */
    .portal-sub { padding: 8px 14px; flex-wrap: wrap; gap: 8px; font-size: var(--fz-11, 11px); }
  }
  @media (max-width: 540px) {
    /* Even tighter for phones */
    .brand .name { font-size: var(--fz-12h, 12.5px); }
    .brand .mark { width: 32px; height: 32px; }
    .nav-search { display: none; }   /* search bar hidden on tiny phones */
    .icon-btn { width: 34px; height: 34px; }
    .user-chip .av { width: 24px; height: 24px; font-size: var(--fz-10, 10px); }
    .user-chip span:not(.caret):not(.preview-tag) { max-width: 60px; }
    .theme-toggle { width: 28px; height: 28px; }
    .theme-toggle svg { width: 14px; height: 14px; }
  }

  /* =============================================================
     MOBILE RESPONSIVE — GLOBAL CONTENT SAFETY NET
     Phase-42 mobile pass · 2026-06-02
     Generic fallback for content panes that weren't built mobile-aware.
     Catches the 3 most common breaks: horizontal-scrolling tables,
     overflowing modals, oversized KPI grids. Scoped to the shell
     so per-page CSS can still override.
     ============================================================= */
  @media (max-width: 720px) {
    /* Any page-level table without its own wrapper gets horizontal scroll */
    .data-table, .ar-table, .ap-table, .ld-table, .lb-table, table.table {
      display: block;
      max-width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
    /* Modals/overlays: clamp to viewport with safe margins */
    .modal, .ct-modal, .gmodal, .fp-modal {
      max-width: calc(100vw - 24px) !important;
      max-height: calc(100vh - 48px);
      overflow-y: auto;
    }
    /* Common KPI/card grids → single column */
    .kpi-grid, .card-grid, .stats-grid, .metric-grid {
      grid-template-columns: 1fr !important;
    }
    /* Two-column page layouts → stack */
    .two-col, .split-view, .page-layout-2col {
      grid-template-columns: 1fr !important;
      flex-direction: column !important;
    }
    /* Generic body padding shrink */
    body { padding-left: 0; padding-right: 0; }
  }

  /* =============================================================
     ACCESSIBILITY — KEYBOARD FOCUS + REDUCED MOTION
     Phase-42 a11y pass · 2026-06-02
     Global keyboard-only focus ring (visible only when navigating
     via Tab/keyboard, not on mouse click — uses :focus-visible).
     Per-page styles can override; this is the safety-net default.
     ============================================================= */
  :focus-visible {
    outline: 2px solid var(--ct-sky, #56C2EF);        /* brand cyan accent */
    outline-offset: 2px;
    border-radius: var(--r-ctl-sm, 4px);
    box-shadow: 0 0 0 4px var(--tint-sky-3, rgba(86, 194, 239, 0.18));
  }
  /* Don't kill the page's own focus styling on inputs — match brand instead */
  input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--ct-sky, #56C2EF);
    outline-offset: 1px;
    box-shadow: 0 0 0 3px rgba(86, 194, 239, 0.22);
  }
  /* Skip a11y outline noise on the page body / scroll containers */
  body:focus, body:focus-visible, [tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }

  /* Respect prefers-reduced-motion globally — animations + transitions become near-instant */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
      scroll-behavior: auto !important;
    }
  }

  /* =============================================================
     PRINT — global baseline so every page prints cleanly.

     Strips chrome (topbar, tabs, sub-bars, FABs, toggles, toasts,
     drawers, modals) and forces a black-on-white printable view of
     the actual page content. Per-page print sheets can still layer
     extra rules on top.

     Audit P2 #47 · 2026-06-10
     ============================================================= */
  @media print {
    /* Hide all chrome on print */
    .topbar, .tabnav, .portal-sub, .tms-dropdown, .view-as-pop,
    .theme-toggle, .tms-help-fab, .help-launcher, .ct-toast,
    [class*="-fab"], [data-role="topbar"], [data-role="tabnav"] {
      display: none !important;
    }
    /* Force black-on-white printable */
    body {
      background: #fff !important;
      color: #000 !important;
      padding-top: 0 !important;
      margin-top: 0 !important;
    }
    .card, [class*="card"], section, article {
      background: #fff !important;
      box-shadow: none !important;
      border-color: #ccc !important;
      color: #000 !important;
      page-break-inside: avoid;
    }
    /* Tables stay readable */
    table, tr, td, th {
      page-break-inside: avoid;
      color: #000 !important;
      background: transparent !important;
    }
    /* Modals expanded inline OR hidden */
    .modal, [role="dialog"], [class*="modal-"], [class*="drawer"] {
      display: none !important;
    }
  }

  /* =============================================================
     MOBILE — global baseline for narrow phones (<=480px).

     Collapses common multi-column grids to single column, lets
     tables scroll horizontally, tightens sticky elements and
     FABs, and clamps modals to viewport. Each page can override
     individual selectors but these are the safety net.

     Audit P2 #47 · 2026-06-10
     ============================================================= */
  @media (max-width: 480px) {
    /* Collapse common grids */
    .kpi-strip, .grid2, .grid3, .grid4, .field-grid, .forms-grid,
    .cov-grid, .three-col, .two-col {
      grid-template-columns: 1fr !important;
    }
    /* Tables scroll horizontally */
    table {
      display: block;
      overflow-x: auto;
      white-space: nowrap;
    }
    /* Sticky elements tighten */
    .topbar { font-size: var(--fz-12, 12px); padding: 6px 8px !important; }
    .tabnav { overflow-x: auto; white-space: nowrap; font-size: var(--fz-12, 12px); }
    /* FABs tighten */
    .tms-help-fab, [class*="-fab"], .help-launcher {
      right: 12px !important;
      bottom: 12px !important;
      transform: scale(0.85);
    }
    /* Modals full-width */
    .modal, [role="dialog"] {
      max-width: 100vw !important;
      margin: 8px !important;
    }
  }
