/* ==========================================================================
   GlobalAid "AEGIS 2090" — command-deck layer on top of apple.css
   Dark-first, neon-edged HUD glass, perspective grid horizon, reactive light.
   Brand stays navy + green; electric blue is the only added accent.
   ========================================================================== */

:root {
  --gaa-neon: #35f08a;          /* signal green, lit */
  --gaa-neon-2: #7dffc0;
  --gaa-volt: #4d9dff;          /* electric blue accent */
  --gaa-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --gaa-glow: 0 0 0 1px rgba(53,240,138,.35), 0 0 22px rgba(53,240,138,.28), 0 0 60px rgba(53,240,138,.12);
}
:root[data-gaa-mode="dark"] {
  --gaa-bg: #03060d;
  --gaa-surface: rgba(10, 19, 40, .58);
  --gaa-surface-solid: #0a1328;
  --gaa-surface-2: rgba(22, 40, 82, .45);
  --gaa-field: rgba(120, 160, 255, .07);
  --gaa-text: #eaf2ff;
  --gaa-text-2: #8fa3c8;
  --gaa-hair: rgba(120, 170, 255, .14);
  --gaa-hair-2: rgba(120, 170, 255, .28);
  --gaa-aurora-a: rgba(31, 78, 190, .55);
  --gaa-aurora-b: rgba(27, 150, 80, .34);
  --gaa-aurora-c: rgba(77, 157, 255, .16);
}

/* ---------- the room: deep space + perspective grid horizon ---------- */
:root[data-gaa-mode="dark"] html { background-color: var(--gaa-bg) !important; }   /* body stays transparent so the layers behind it show */
:root[data-gaa-mode="dark"] body::before { opacity: .95; }
:root[data-gaa-mode="dark"] body::after {
  inset: auto 0 0 0; height: 58vh; z-index: -1; opacity: 1;
  background-image:
    linear-gradient(to right, rgba(53,240,138,.20) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(77,157,255,.20) 1px, transparent 1px);
  background-size: 64px 64px; background-position: center 0;
  transform: perspective(520px) rotateX(64deg); transform-origin: bottom center;
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0,0,0,.55) 38%, transparent 82%);
          mask-image: linear-gradient(to top, #000 0%, rgba(0,0,0,.55) 38%, transparent 82%);
  animation: gaa-grid-run 6s linear infinite;
}
@keyframes gaa-grid-run { to { background-position: center 64px; } }

/* film grain + scanlines: a barely-there sense of a display */
.gaa-crt { position: fixed; inset: 0; z-index: 2500; pointer-events: none; opacity: .5; mix-blend-mode: overlay;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.035) 0 1px, transparent 1px 3px); }
:root:not([data-gaa-mode="dark"]) .gaa-crt { opacity: .12; }

/* ---------- type ---------- */
:root[data-gaa-mode="dark"] h1, :root[data-gaa-mode="dark"] h2, :root[data-gaa-mode="dark"] h3, :root[data-gaa-mode="dark"] h4, :root[data-gaa-mode="dark"] h5 { color: var(--gaa-text); }
.card .h1, .card div.h1 { font-family: var(--gaa-mono) !important; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.gaa-pill b { font-family: var(--gaa-mono); letter-spacing: -.03em; }
:root[data-gaa-mode="dark"] .card .h1 { text-shadow: 0 0 24px rgba(53,240,138,.35); }
.card-title, .sidebar-header, .table thead th, table th { font-family: var(--gaa-mono); font-size: .66rem !important; letter-spacing: .16em !important; }
.gaa-crumbs { font-family: var(--gaa-mono); letter-spacing: .08em; text-transform: uppercase; font-size: .68rem; }
.gaa-crumbs b { color: var(--gaa-neon); }
:root:not([data-gaa-mode="dark"]) .gaa-crumbs b { color: var(--gaa-green); }

/* ---------- HUD panels ---------- */
.card { --mx: 50%; --my: 0%; position: relative; isolation: isolate; overflow: visible; }
:root[data-gaa-mode="dark"] .card { border-color: var(--gaa-hair) !important; box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 24px 70px -28px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.05) !important; }
.card { background-image: radial-gradient(520px circle at var(--mx) var(--my), rgba(53,240,138,.085), transparent 42%) !important; }
:root:not([data-gaa-mode="dark"]) .card { background-image: radial-gradient(520px circle at var(--mx) var(--my), rgba(27,127,46,.07), transparent 42%) !important; }
/* corner brackets */
.card::before, .card::after { content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; opacity: .85; transition: all .35s var(--gaa-ease); z-index: 3; }
.card::before { top: -1px; left: -1px; border-top: 2px solid var(--gaa-neon); border-left: 2px solid var(--gaa-neon); border-top-left-radius: var(--gaa-radius); }
.card::after { right: -1px; bottom: -1px; border-bottom: 2px solid var(--gaa-volt); border-right: 2px solid var(--gaa-volt); border-bottom-right-radius: var(--gaa-radius); }
.card:hover::before, .card:hover::after { width: 34px; height: 34px; }
:root:not([data-gaa-mode="dark"]) .card::before { border-color: var(--gaa-green); } :root:not([data-gaa-mode="dark"]) .card::after { border-color: var(--gaa-navy-3); }
/* the existing card hover lift keeps working; add a light sweep */
.card .card-header { position: relative; }
.card .card-header::after { content: ""; position: absolute; left: 1.4rem; right: 1.4rem; bottom: -1px; height: 1px; background: linear-gradient(90deg, var(--gaa-neon), var(--gaa-volt), transparent); opacity: .6; }

/* ---------- sidebar as a ship's rail ---------- */
:root[data-gaa-mode="dark"] body .sidebar-content { background: linear-gradient(180deg, rgba(8,22,56,.92), rgba(3,9,24,.96)) !important; border-color: rgba(77,157,255,.22); }
body .sidebar-content::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 1px; background: linear-gradient(to bottom, transparent, var(--gaa-neon), var(--gaa-volt), transparent); opacity: .55; animation: gaa-pulse-edge 4.5s ease-in-out infinite; pointer-events: none; }
@keyframes gaa-pulse-edge { 50% { opacity: .15; } }
body .sidebar-item.active > .sidebar-link:not([data-bs-toggle]),
body .sidebar-item.active > a.sidebar-link:not([data-bs-toggle]) { background: linear-gradient(90deg, rgba(53,240,138,.28), rgba(53,240,138,.04)) !important; color: #fff !important; box-shadow: inset 3px 0 0 var(--gaa-neon), 0 0 28px -8px rgba(53,240,138,.8) !important; }
body .sidebar-link:hover { box-shadow: inset 3px 0 0 var(--gaa-volt); }
.gaa-sys { display: flex; align-items: center; gap: 8px; margin: 0 18px 8px; padding: 6px 12px; border-radius: 980px; font: 600 .62rem var(--gaa-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--gaa-neon-2); background: rgba(53,240,138,.08); border: 1px solid rgba(53,240,138,.28); }
.gaa-sys i { width: 7px; height: 7px; border-radius: 50%; background: var(--gaa-neon); box-shadow: 0 0 10px var(--gaa-neon); animation: gaa-blink 1.8s ease-in-out infinite; }
@keyframes gaa-blink { 50% { opacity: .25; transform: scale(.7); } }

/* ---------- top bar HUD ---------- */
.gaa-clock { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.15; margin-left: auto; margin-right: .6rem; padding-right: .9rem; border-right: 1px solid var(--gaa-hair); font-family: var(--gaa-mono); }
.gaa-clock b { font-size: .95rem; color: var(--gaa-text); letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.gaa-clock span { font-size: .6rem; letter-spacing: .2em; color: var(--gaa-text-2); text-transform: uppercase; }
@media (max-width: 767.98px) { .gaa-clock { display: none; } }
:root[data-gaa-mode="dark"] body .navbar { border-color: rgba(77,157,255,.22); box-shadow: 0 18px 50px -24px rgba(0,0,0,.9), 0 0 0 1px rgba(0,0,0,.4); }

/* ---------- controls ---------- */
.btn-primary { position: relative; overflow: hidden; background: linear-gradient(135deg, #35d97a 0%, #17a24a 55%, #0f7a35 100%) !important; box-shadow: 0 0 0 1px rgba(53,240,138,.45), 0 10px 30px -10px rgba(53,240,138,.75), inset 0 1px 0 rgba(255,255,255,.35) !important; }
.btn-primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.45) 48%, transparent 66%); transform: translateX(-120%); transition: transform .7s var(--gaa-ease); pointer-events: none; }
.btn-primary:hover::after { transform: translateX(120%); }
div.btn.btn-primary::after { display: none; }
.gaa-ripple { position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255,255,255,.55); transform: scale(0); animation: gaa-ripple .6s ease-out forwards; }
@keyframes gaa-ripple { to { transform: scale(2.6); opacity: 0; } }

.form-control:focus, .form-select:focus, .field input:focus, .form-field input:focus, .form-field select:focus {
  border-color: var(--gaa-neon) !important; box-shadow: 0 0 0 1px var(--gaa-neon), 0 0 0 5px rgba(53,240,138,.16), 0 0 26px rgba(53,240,138,.18) !important;
}
:root:not([data-gaa-mode="dark"]) .form-control:focus, :root:not([data-gaa-mode="dark"]) .form-select:focus, :root:not([data-gaa-mode="dark"]) .field input:focus { border-color: var(--gaa-green) !important; box-shadow: 0 0 0 4px rgba(27,127,46,.16) !important; }

.table tbody tr { position: relative; }
.table tbody tr:hover > td:first-child { box-shadow: inset 3px 0 0 var(--gaa-neon); }
.table-hover > tbody > tr:hover > *, .table tbody tr:hover > td { background-color: rgba(53,240,138,.06) !important; }
.badge.bg-success, .badge-success-light { box-shadow: 0 0 14px -2px rgba(53,240,138,.55); color: #5dffa7 !important; background: rgba(53,240,138,.14) !important; }
:root:not([data-gaa-mode="dark"]) .badge.bg-success { color: #137a2e !important; box-shadow: none; }

/* ---------- quick-action dock → holo tiles ---------- */
.gaa-tile { --mx: 50%; --my: 0%; background-image: radial-gradient(260px circle at var(--mx) var(--my), rgba(53,240,138,.16), transparent 60%) !important; transform-style: preserve-3d; }
:root[data-gaa-mode="dark"] .gaa-tile { border-color: rgba(77,157,255,.22); }
.gaa-tile:hover { border-color: var(--gaa-neon) !important; box-shadow: var(--gaa-glow), var(--gaa-shadow-lg); }
.gaa-tile .ic { box-shadow: 0 0 0 1px rgba(255,255,255,.12) inset, 0 12px 26px -10px rgba(31,59,130,.95), 0 0 24px -4px rgba(77,157,255,.55); }
.gaa-tile.go .ic { box-shadow: 0 0 0 1px rgba(255,255,255,.2) inset, 0 12px 26px -10px rgba(23,120,43,.95), 0 0 28px -2px rgba(53,240,138,.8); }
.gaa-tile .ic svg { filter: drop-shadow(0 0 6px rgba(255,255,255,.55)); }
.gaa-pill { border-color: rgba(53,240,138,.35); box-shadow: 0 0 24px -8px rgba(53,240,138,.6); }
:root[data-gaa-mode="dark"] .gaa-pill b { color: var(--gaa-neon); text-shadow: 0 0 14px rgba(53,240,138,.6); }
.gaa-hello h2 { font-size: clamp(1.7rem, 2.6vw, 2.5rem); background: linear-gradient(100deg, var(--gaa-text) 30%, var(--gaa-neon-2) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root:not([data-gaa-mode="dark"]) .gaa-hello h2 { background: linear-gradient(100deg, var(--gaa-navy) 30%, var(--gaa-green) 100%); -webkit-background-clip: text; background-clip: text; }

/* progress chips + palette + steps */
.gaa-steps { border-color: rgba(77,157,255,.25); }
.gaa-step.now i { background: var(--gaa-grad); box-shadow: 0 0 16px rgba(53,240,138,.8); }
.gaa-cmd-box { border-color: rgba(53,240,138,.4); box-shadow: 0 0 0 1px rgba(53,240,138,.25), 0 40px 120px -30px rgba(0,0,0,.95), 0 0 80px -10px rgba(53,240,138,.25); }
.gaa-cmd-item.sel { box-shadow: inset 3px 0 0 var(--gaa-neon-2), 0 0 24px -6px rgba(53,240,138,.7); }
.gaa-lights button { box-shadow: 0 0 8px rgba(255,255,255,.18); }

/* ---------- sign-in: a viewport of its own ---------- */
.gaa-particles { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.auth-card { box-shadow: 0 0 0 1px rgba(53,240,138,.18), 0 50px 140px -30px rgba(0,0,0,.9), 0 0 120px -20px rgba(53,240,138,.22) !important; }
.gaa-boot { font-family: var(--gaa-mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gaa-neon); min-height: 1.1em; margin: -.2rem 0 .7rem; opacity: .9; }
:root:not([data-gaa-mode="dark"]) .gaa-boot { color: var(--gaa-green); }
.gaa-boot::after { content: "▍"; margin-left: 2px; animation: gaa-caret 1s steps(1) infinite; }
@keyframes gaa-caret { 50% { opacity: 0; } }

/* ---------- page entrance: cross-document view transitions where supported ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: .22s ease both gaa-vt-out; }
::view-transition-new(root) { animation: .38s var(--gaa-ease) both gaa-vt-in; }
@keyframes gaa-vt-out { to { opacity: 0; transform: scale(.992); filter: blur(4px); } }
@keyframes gaa-vt-in { from { opacity: 0; transform: translateY(10px) scale(1.004); filter: blur(5px); } }

::selection { background: rgba(53,240,138,.35); color: #fff; }
* { scrollbar-color: rgba(53,240,138,.45) transparent; }
::-webkit-scrollbar-thumb { background: rgba(53,240,138,.4); }

@media (prefers-reduced-motion: reduce) {
  :root[data-gaa-mode="dark"] body::after, body .sidebar-content::after, .gaa-sys i { animation: none !important; }
  .gaa-particles { display: none; }
}
@media print { .gaa-crt, .gaa-particles { display: none !important; } }

/* sign-in / auth contrast on the dark deck */
:root[data-gaa-mode="dark"] .auth-hero span { color: var(--gaa-neon-2); background: rgba(53,240,138,.10); border: 1px solid rgba(53,240,138,.3); }
:root[data-gaa-mode="dark"] .auth-links .accent, :root[data-gaa-mode="dark"] a { color: var(--gaa-volt); }
:root[data-gaa-mode="dark"] .auth-body::after { color: var(--gaa-neon); text-shadow: 0 0 14px rgba(53,240,138,.6); }
:root[data-gaa-mode="dark"] .gaa-hello h2 + p, :root[data-gaa-mode="dark"] .text-muted { color: var(--gaa-text-2) !important; }

/* mono figures must never wrap inside the narrow stat cards */
.card .h1, .card div.h1 { font-size: clamp(1.35rem, 1.9vw, 1.9rem) !important; white-space: nowrap; }
/* section banners on the long form keep a readable title */
div.btn.btn-primary .card-title, div.btn.btn-primary h5 { font-size: .9rem !important; letter-spacing: .14em !important; color: #fff !important; text-transform: uppercase; }

/* ---- Professional mode: aurora, perspective grid and sidebar glow ONLY on the sign-in screens ---- */
body:not(:has(.auth-shell))::before,
body:not(:has(.auth-shell))::after,
body:not(:has(.auth-shell)) .sidebar-content::before,
body:not(:has(.auth-shell)) .sidebar-content::after { display: none !important; animation: none !important; background-image: none !important; }
body:not(:has(.auth-shell)) .gaa-particles { display: none !important; }
body:not(:has(.auth-shell)) .card,
body:not(:has(.auth-shell)) .gaa-tile { background-image: none !important; }

/* ---- wide grids: the pinned Action column must stay OPAQUE (also on hover), so scrolled cells never show through ---- */
table.gaa-wide th:last-child, table.gaa-wide td:last-child { background-color: var(--gaa-surface-solid) !important; background-image: none !important; z-index: 3; }
table.gaa-wide thead th:last-child { z-index: 4; }
.table-hover > tbody > tr:hover > td:last-child, .table tbody tr:hover > td:last-child { background-color: var(--gaa-surface-solid) !important; background-image: linear-gradient(rgba(53,240,138,.08), rgba(53,240,138,.08)) !important; }
table.gaa-wide td:last-child { padding-left: 14px; box-shadow: -14px 0 16px -14px rgba(0,0,0,.55); }

/* ======================= Sidebar: fixed panel, scrolling menu, roomy spacing ======================= */
body .sidebar { position: sticky; top: 0; align-self: flex-start; height: 100vh; max-height: 100vh; }
body .sidebar-content { display: flex; flex-direction: column; height: calc(100vh - 24px); min-height: 0; overflow: hidden; margin: 12px 0 12px 12px; }
body .sidebar-brand { flex: 0 0 auto; padding: 1.25rem 1.25rem .75rem; }
body .sidebar-user { flex: 0 0 auto; padding: .25rem 1rem .9rem; border-bottom: 1px solid rgba(255,255,255,.07); margin-bottom: .35rem; }
body .sidebar-user-title { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body .sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: scroll; overflow-x: hidden; padding: .35rem 0 1.25rem; margin: 0; list-style: none;
  scrollbar-width: thin; scrollbar-color: rgba(52,240,160,.55) rgba(255,255,255,.07); scrollbar-gutter: stable; overscroll-behavior: contain; }
body .sidebar-nav::-webkit-scrollbar { width: 9px; }
body .sidebar-nav::-webkit-scrollbar-track { background: rgba(255,255,255,.06); border-radius: 9px; margin: 6px 0; }
body .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(52,240,160,.55); border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
body .sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(52,240,160,.85); background-clip: content-box; }
/* soft fade so it is obvious more items are below */
body .sidebar-content::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 28px; pointer-events: none; background: linear-gradient(to top, rgba(6,14,36,.95), transparent); border-radius: 0 0 28px 28px; z-index: 2; display: block !important; width: auto !important; top: auto !important; animation: none !important; }

body .sidebar-header { padding: 1.15rem 1.5rem .5rem; margin-top: .35rem; }
body .sidebar-item { margin: 4px 0; }
body .sidebar-link, body a.sidebar-link { margin: 0 12px; padding: .78rem 1rem; display: flex; align-items: center; gap: .75rem; line-height: 1.3; min-height: 2.9rem; }
body .sidebar-link svg, body .sidebar-link i { flex: 0 0 auto; width: 20px; height: 20px; }
body .sidebar-dropdown { padding: 2px 0 6px; }
body .sidebar-dropdown .sidebar-item { margin: 3px 0; }
body .sidebar-dropdown .sidebar-link { padding: .62rem 1rem .62rem 2.9rem; min-height: 2.5rem; font-size: .93rem; }
body .sidebar-link[data-bs-toggle="collapse"] { justify-content: flex-start; }
body .sidebar-link[data-bs-toggle="collapse"]::after { margin-left: auto; }
body .sidebar-item.active > .sidebar-link[data-bs-toggle="collapse"] { background: rgba(255,255,255,.06) !important; }
@media (max-height: 640px) { body .sidebar-link, body a.sidebar-link { padding: .6rem 1rem; min-height: 2.4rem; } body .sidebar-item { margin: 2px 0; } }

/* native bar hidden; the always-visible rail (future.js) replaces it */
body .sidebar-nav { scrollbar-width: none; padding-right: 14px; }
body .sidebar-nav::-webkit-scrollbar { display: none; }
.gaa-sb { position: absolute; right: 5px; width: 6px; border-radius: 6px; background: rgba(255,255,255,.12); z-index: 3; display: none; }
.gaa-sb i { position: absolute; left: 0; right: 0; top: 0; border-radius: 6px; background: linear-gradient(180deg, #34f0a0, #18c58a); min-height: 36px; cursor: grab; box-shadow: 0 0 10px rgba(52,240,160,.35); transition: background .2s; }
.gaa-sb i:hover { background: #7bffc4; }
.gaa-sb:before { content: ""; position: absolute; inset: 0 -6px; }   /* wider grab area */
body .sidebar-content:not(.gaa-more)::after { opacity: 0; }
