/* === Admin Dashboard — LCARS Layout === */

/* === SIDEBAR — LCARS Left Rail === */
.sidebar {
  width: 240px;
  padding: 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: #000;
  border-right: none;
  gap: 0;
}

/* Top elbow — the signature LCARS corner piece */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  margin-bottom: 0;
  background: var(--lcars-amber);
  border-radius: 0 0 40px 0;
  min-height: 64px;
}

.sidebar-logo .logo-orb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #000;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.sidebar-logo .logo-orb::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lcars-amber);
  transform: translate(-50%, -50%);
}

.sidebar-logo .logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #000;
  text-transform: uppercase;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--lcars-lavender);
  padding: 16px 16px 6px;
  margin-bottom: 0;
  margin-top: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 0 4px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 0 20px 20px 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--lcars-lavender);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: var(--surface2);
  width: calc(100% - 8px);
  text-align: left;
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: 0;
}

.nav-item:hover {
  background: var(--lcars-periwinkle);
  color: #000;
}

.nav-item.active {
  background: var(--lcars-peach);
  color: #000;
  font-weight: 700;
  border-color: transparent;
  box-shadow: none;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav-item.active svg { opacity: 1; }

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--lcars-red);
  color: #fff;
  line-height: 1;
  font-family: var(--mono);
}

.sidebar-spacer { flex: 1; }

/* Bottom elbow piece */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  margin-top: 0;
  border-top: none;
  background: var(--lcars-lavender);
  border-radius: 0 40px 0 0;
  min-height: 56px;
}

.sidebar-user .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--lcars-lavender);
  font-family: var(--mono);
}

.sidebar-user .user-name { font-size: 14px; font-weight: 700; color: #000; text-transform: uppercase; letter-spacing: 0.06em; }
.sidebar-user .user-role { font-size: 12px; color: #333; text-transform: uppercase; letter-spacing: 0.06em; }

/* === MAIN CONTENT AREA === */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 24px 24px;
  gap: 0;
  background: #000;
}

/* Top bar — LCARS horizontal bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  margin-bottom: 16px;
  padding: 14px 0 14px;
  border-bottom: 3px solid var(--lcars-periwinkle);
  position: relative;
}

.topbar::before {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 120px;
  height: 3px;
  background: var(--lcars-amber);
}

.topbar h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lcars-amber);
}

.topbar-search {
  position: relative;
}

.topbar-search input {
  font-family: var(--mono);
  font-size: 15px;
  padding: 9px 14px 9px 36px;
  border-radius: 20px;
  border: 2px solid var(--lcars-periwinkle);
  background: #000;
  color: var(--lcars-sky);
  width: 220px;
  outline: none;
  transition: all 0.2s;
}

.topbar-search input:focus {
  width: 280px;
  border-color: var(--lcars-amber);
  background: #050505;
}

.topbar-search input::placeholder { color: var(--text-light); }

.topbar-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--lcars-periwinkle);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--lcars-periwinkle);
  background: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  position: relative;
  color: var(--lcars-lavender);
}

.icon-btn:hover {
  background: var(--lcars-lavender);
  color: #000;
}

.icon-btn svg { width: 18px; height: 18px; }

.icon-btn .notif-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lcars-red);
  border: 2px solid #000;
}

/* Stats row — LCARS Master Systems Display */
.stats-row {
  display: flex;
  gap: 0;
  flex-shrink: 0;
  margin-bottom: 12px;
  background: var(--surface2);
  border-left: 6px solid var(--lcars-amber);
  border-radius: 0 20px 20px 0;
  overflow: hidden;
  height: 300px;
  animation: fadeUp 0.4s ease both;
}

/* Ship display area — Titan.DS MSD (loaded from titan-msd.svg) */
.msd-ship {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px;
  background: #000;
}
.msd-ship svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Saucer sectors — always visible as cyan decor (matches Titan.DS reference
   at www.mewho.com/titan where group opacity = 0.7). Alert zones override the
   --cyan variable via msd-status-* class to recolor in place. */
#TitanEps_groupCircularBlocks { opacity: 0.7; }

/* --- Saucer 13-block sweep animation (always on, including during alerts) ---
   A single bright pulse travels around the ring. Drives OPACITY (not fill) so
   problem-block status colors can layer their own fill-color blink on top. */
@keyframes saucerBlockSweep {
  0%, 90%, 100% { opacity: 0.45; }
  4%, 8%        { opacity: 1; }
  14%           { opacity: 0.7; }
}
/* Sweep applies to ALL blocks (healthy + problem) — the scan keeps running
   even when a sector is flagged. Each block's sweep delay is stored in a CSS
   var so the status-blink rule below can re-use it without rewriting delays. */
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(1)  { --sweepDelay: calc(6.5s *  0 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(2)  { --sweepDelay: calc(6.5s *  1 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(3)  { --sweepDelay: calc(6.5s *  2 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(4)  { --sweepDelay: calc(6.5s *  3 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(5)  { --sweepDelay: calc(6.5s *  4 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(6)  { --sweepDelay: calc(6.5s *  5 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(7)  { --sweepDelay: calc(6.5s *  6 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(8)  { --sweepDelay: calc(6.5s *  7 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(9)  { --sweepDelay: calc(6.5s *  8 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(10) { --sweepDelay: calc(6.5s *  9 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(11) { --sweepDelay: calc(6.5s * 10 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(12) { --sweepDelay: calc(6.5s * 11 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(13) { --sweepDelay: calc(6.5s * 12 / 14); }
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block]:nth-child(14) { --sweepDelay: calc(6.5s * 13 / 14); }

#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block] {
  animation-name: saucerBlockSweep;
  animation-duration: 6.5s;
  animation-delay: var(--sweepDelay, 0s);
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  transition: fill 0.6s ease;
}

/* --- Problem blocks: sweep continues (opacity) while status-colored blink
   cycles the fill color. The two animations layer; sweep delay is reused from
   the --sweepDelay var so the problem block still keeps its place in the scan. --- */
@keyframes statusBlinkPurple {
  0%, 100% { fill: #9B59D6; }
  50%      { fill: #4A1A7A; }
}
@keyframes statusBlinkOrange {
  0%, 100% { fill: #FF8844; }
  50%      { fill: #CC4400; }
}
@keyframes statusBlinkRed {
  0%, 100% { fill: #FF3355; }
  50%      { fill: #AA0022; }
}
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block].msd-status-purple {
  animation-name: saucerBlockSweep, statusBlinkPurple;
  animation-duration: 6.5s, 1.8s;
  animation-delay: var(--sweepDelay, 0s), 0s;
  animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite, infinite;
}
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block].msd-status-orange {
  animation-name: saucerBlockSweep, statusBlinkOrange;
  animation-duration: 6.5s, 1.4s;
  animation-delay: var(--sweepDelay, 0s), 0s;
  animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite, infinite;
}
#ov-msd #TitanEps_groupCircularBlocks [data-saucer-circular-block].msd-status-red {
  animation-name: saucerBlockSweep, statusBlinkRed;
  animation-duration: 6.5s, 0.9s;
  animation-delay: var(--sweepDelay, 0s), 0s;
  animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite, infinite;
}

/* Stroke-only decorative paths inside the saucer default to black per SVG spec
   when fill attr is missing. Titan.DS reference explicitly fills them none.
   This rule neutralises the 60+ stray black patches on blockLines, small boxes,
   bridge blocks, etc. without touching paths that intentionally have a fill. */
#TitanEps_saucer path[stroke]:not([fill]) { fill: none; }

/* Status color overrides — applied to <g>/<path> sections via JS.
   Overriding CSS custom properties cascades to all children that use var(--cyan*) fills. */
.msd-status-purple {
  --cyan: #9B59D6;
  --cyanLight: #BB77EE;
  --cyanDark: #7B2FBE;
  --cyanDarker: #4A1A7A;
  --cyanLighter: #DD99FF;
  --cyanLightest: #EECCFF;
}
.msd-status-orange {
  --cyan: #FF8844;
  --cyanLight: #FFAA66;
  --cyanDark: #FF6633;
  --cyanDarker: #CC4400;
  --cyanLighter: #FFCC99;
  --cyanLightest: #FFE0CC;
}
.msd-status-red {
  --cyan: #FF3355;
  --cyanLight: #FF5577;
  --cyanDark: #DD1133;
  --cyanDarker: #AA0022;
  --cyanLighter: #FF8899;
  --cyanLightest: #FFBBCC;
}

/* Glow effect for alert sectors — makes status colors pop against dark background */
.msd-glow {
  filter: drop-shadow(0 0 6px currentColor) drop-shadow(0 0 12px currentColor);
}
.msd-status-purple.msd-glow { filter: drop-shadow(0 0 6px #9B59D6) drop-shadow(0 0 14px #7B2FBE); }
.msd-status-orange.msd-glow { filter: drop-shadow(0 0 6px #FF8844) drop-shadow(0 0 14px #FF6633); }
.msd-status-red.msd-glow    { filter: drop-shadow(0 0 6px #FF3355) drop-shadow(0 0 14px #DD1133); }

/* Red alert blink for duplicates */
@keyframes msdRedBlink {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.msd-blink { animation: msdRedBlink 1.2s ease-in-out infinite; }

/* Orange warn pulse for issues */
@keyframes msdWarnPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
.msd-warn { animation: msdWarnPulse 2s ease-in-out infinite; }

/* === TITAN.DS "LIVING SHIP" ANIMATION — ported from mewho.com/titan ===
   Subsystems are DIM by default (--dimLevel = 0.3). JS adds data-ani-* attributes
   to #TitanEps_ship, which this CSS uses to light up specific subsystems. */

/* Force ship to full-brightness base so continuous keyframe animations on
   children (coils, bussard, misc lights, dash bars) are visible. The per-
   element @keyframes below do all the dimming/blinking — no JS toggling. */
#ov-msd #TitanEps_ship { --dimLevel: 1 !important; --blinkDimLevel: 0.3 !important; }

#ov-msd #TitanEps_ship #TitanEps_stardrive,
#ov-msd #TitanEps_ship #TitanEps_stardriveLights,
#ov-msd #TitanEps_ship [data-pylon],
#ov-msd #TitanEps_ship [data-nacelle],
#ov-msd #TitanEps_ship #TitanEps_saucerLights {
  opacity: 1 !important;
}

#ov-msd #TitanEps_ship #TitanEps_saucerOutline { stroke-opacity: 1 !important; }

/* Hide the red-alert ship outline — mewho shows it only in red-alert mode, but
   our SVG leaves it rendered. */
#ov-msd #TitanEps_shipOutline { display: none !important; }

/* Subtle warp-coil glow is always on so the animated coils pop */
#ov-msd #TitanEps_ship [data-coil] { filter: drop-shadow(0 0 2.5px currentColor); }

/* Legacy msd-blink/msd-warn: colored status blinks now handle this (see
   statusBlink{Purple,Orange,Red}) so these rules are intentionally removed. */

/* === REAL mewho.com/titan KEYFRAMES — continuous blinking/dimming ===
   These are copied verbatim from www.mewho.com/titan/main-*.css so the
   saucer lights, hull indicators, dash bars, and warp coils blink with the
   exact cadence of the reference design. The SVG already carries the
   data-misc-lights, data-pulsating, data-dash-bar-ani, data-dash-bar-blinking
   hooks — we just activate them here. */

@keyframes miscLightsAni {
  0%,8%   { opacity: 1; }
  11%,25% { opacity: 0.4; }
  31%,37% { opacity: 1; }
  38%,50% { opacity: 0; }
  52%,56% { opacity: 0.4; }
  64%,72% { opacity: 0; }
  74%,81% { opacity: 1; }
  88%,93% { opacity: 0.4; }
  96%,97.5% { opacity: 0; }
  98%,100% { opacity: 1; }
}
@keyframes pulsatingAni {
  0%,25%  { opacity: 1; }
  50%,60% { opacity: var(--pulsatingDim, 0.3); }
  75%,100%{ opacity: 1; }
}
@keyframes pulsatingColorAni {
  0%,25%  { fill: var(--pulsatingFromColor, var(--grayLight)); }
  50%,60% { fill: var(--pulsatingToColor, var(--grayDarker));
            opacity: var(--pulsatingDim, 1);
            fill-opacity: var(--pulsatingToOpacity, 1); }
  75%,100%{ fill: var(--pulsatingFromColor, var(--grayLight)); }
}
@keyframes dashBarAni {
  0%        { transform: scaleY(0.7); }
  5%,13%    { transform: scaleY(0.55); animation-timing-function: ease-in-out; }
  15%,23%   { transform: scaleY(0.25); animation-timing-function: ease-out; }
  27%,28%   { transform: scaleY(0.85); animation-timing-function: ease-in; }
  31%,47%   { transform: scaleY(0.4);  animation-timing-function: steps(7); }
  51%       { transform: scaleY(0);    animation-timing-function: ease-in; }
  57%,70.5% { transform: scaleY(0.6); }
  72%,76%   { transform: scaleY(0.95); animation-timing-function: ease-out; }
  80%,95%   { transform: scaleY(0.17); animation-timing-function: ease-in-out; }
  98%,100%  { transform: scaleY(0.47); }
}
@keyframes dashBarBlinking {
  0%,20%     { visibility: visible; }
  20.1%      { visibility: hidden; animation-timing-function: step-end; }
  20.3%,81%  { visibility: visible; }
  81.1%      { visibility: hidden; animation-timing-function: step-end; }
  81.3%,81.7%{ visibility: visible; }
  81.8%      { visibility: hidden; animation-timing-function: step-end; }
  82%,100%   { visibility: visible; }
}
@keyframes titanBlink1 {
  0%   { opacity: 1; }
  30%  { opacity: 0.4; }
  100% { opacity: 1; }
}
@keyframes titanBlink2 {
  0%   { opacity: 1; }
  10%  { opacity: var(--blinkDimLevel, 0.3); }
  20%  { opacity: calc(var(--blinkDimLevel, 0.3) + (1 - var(--blinkDimLevel, 0.3)) * 0.8); }
  30%  { opacity: calc(var(--blinkDimLevel, 0.3) + (1 - var(--blinkDimLevel, 0.3)) * 0.8); }
  40%  { opacity: var(--blinkDimLevel, 0.3); }
  60%  { opacity: calc(var(--blinkDimLevel, 0.3) + (1 - var(--blinkDimLevel, 0.3)) * 0.7); }
  100% { opacity: 1; }
}
@keyframes titanBlinks {
  0%   { opacity: 1; }
  4%   { opacity: 0; }
  8%   { opacity: 1; }
  15%  { opacity: 0.5; }
  30%  { opacity: 1; }
  100% { opacity: 1; }
}

/* --- Activate the continuous animations on SVG hooks --- */

/* White "misc" lights flicker across the hull — 40s cycle exactly like mewho.
   Longhand (NOT shorthand) so the per-element animation-delay set inline by JS
   isn't clobbered by the shorthand resetting delay to 0s. */
#ov-msd [data-misc-lights] circle {
  animation-name: miscLightsAni !important;
  animation-duration: 40s !important;
  animation-timing-function: ease !important;
  animation-iteration-count: infinite !important;
  animation-direction: alternate !important;
  animation-fill-mode: forwards !important;
  animation-play-state: running !important;
}

/* Generic pulsating elements (impulse, bussard glow highlights, etc.) */
#ov-msd [data-pulsating] {
  --pulsatingDim: 0.3;
  animation: pulsatingAni var(--pulsatingDur, 2.33s) ease var(--pulsatingDelay, 0s) infinite forwards !important;
}
#ov-msd [data-pulsating-color] {
  --pulsatingDim: 1;
  --pulsatingFromColor: var(--grayLight);
  --pulsatingToColor: var(--grayDarker);
  --pulsatingToOpacity: 1;
  animation: pulsatingColorAni var(--pulsatingDur, 2.33s) ease var(--pulsatingDelay, 0s) infinite forwards !important;
}

/* Dash bars (vertical level indicators on the hull/nacelle panels) */
#ov-msd [data-dash-bar-ani] {
  transform-origin: center;
  animation: dashBarAni 4.7s ease infinite alternate !important;
}
#ov-msd [data-dash-bar-blinking] {
  animation: dashBarBlinking 30.1s infinite !important;
}

/* Warp coils — base state is DIM. JS ("coil spotlight") picks ONE random coil
   per nacelle, adds .coil-active for a single blink, then rolls on to the next
   random pick. Each nacelle has its own independent cycle. */
/* Coils stay at full brightness; the "active" spotlight briefly dims then
   returns — a subtle blink rather than a light-up from dark. */
@keyframes coilBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
#ov-msd #TitanEps_ship [data-coil].coil-active {
  animation: coilBlink 1.1s ease-in-out 1 forwards;
}

/* Bussard collectors — warm pulse with color shift (orange → deep red glow) */
@keyframes bussardPulse {
  0%, 100% { opacity: 0.55; filter: drop-shadow(0 0 3px var(--orange, #FF6753)); }
  50%      { opacity: 1;    filter: drop-shadow(0 0 10px var(--orangeLight, #FF977B)); }
}
#ov-msd #TitanEps_ship [data-bussard] {
  animation: bussardPulse 2.6s ease-in-out 0s infinite;
}

/* Nacelle body stays STATIC — no sweep/scan animation on [data-base-fill]. */

/* Nacelle outer impulse when active — gentle pulse */
#ov-msd #TitanEps_ship [data-outer-impulse] {
  --blinkDimLevel: 0.5;
  animation: titanBlink1 2.2s ease 0.3s infinite normal forwards;
}

/* Saucer bridge blocks — occasional hit-flash (blinks keyframe) */
#ov-msd #TitanEps_ship [data-bridge-block-a],
#ov-msd #TitanEps_ship [data-bridge-block-b] {
  animation: titanBlinks 5.3s ease infinite;
}

/* Inner small boxes on the saucer — scattered quick flickers with per-element delay */
#ov-msd #TitanEps_ship #TitanEps_innerSmallBoxes [data-style="2"] {
  animation: titanBlink1 3.1s ease infinite;
}
#ov-msd #TitanEps_ship #TitanEps_innerSmallBoxes [data-style="3"] {
  --blinkDimLevel: 0.2;
  animation: titanBlink2 1.9s ease 0.4s infinite normal forwards;
}

/* Respect reduced-motion — kill every TitanEps animation, freeze lit */
@media (prefers-reduced-motion: reduce) {
  #ov-msd #TitanEps_ship { --dimLevel: 1; }
  #ov-msd #TitanEps_ship *,
  #ov-msd [data-misc-lights] circle,
  #ov-msd [data-pulsating],
  #ov-msd [data-dash-bar-ani],
  #ov-msd [data-dash-bar-blinking] {
    animation: none !important;
    transition: none !important;
  }
}

/* Legend panel */
.msd-legend {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 18px;
  gap: 8px;
  border-left: 3px solid var(--lcars-periwinkle);
  background: #0a0a0a;
}
.msd-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--lcars-sky);
  letter-spacing: 0.04em;
}
.msd-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.msd-legend-dot.reviewed { background: #37A6D1; }
.msd-legend-dot.needs-review { background: #9B59D6; }
.msd-legend-dot.issues { background: #FF6753; }
.msd-legend-dot.duplicates { background: #EE3344; }
.msd-legend-count {
  margin-left: auto;
  font-weight: 700;
  font-size: 14px;
}
.msd-legend-count.reviewed { color: #37A6D1; }
.msd-legend-count.needs-review { color: #9B59D6; }
.msd-legend-count.issues { color: #FF6753; }
.msd-legend-count.duplicates { color: #EE3344; }

.msd-legend-total {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--lcars-periwinkle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-top: 4px;
  border-top: 1px solid rgba(153,153,255,0.15);
  margin-top: 2px;
}

.msd-title {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--lcars-periwinkle);
  margin-bottom: 4px;
}

/* Filters row */
.filters-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  margin-bottom: 12px;
}

.filter-chip {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 20px;
  border: 2px solid var(--lcars-periwinkle);
  background: #000;
  color: var(--lcars-lavender);
  cursor: pointer;
  outline: none;
  transition: all 0.15s;
  appearance: none;
  -webkit-appearance: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-chip:hover, .filter-chip:focus {
  background: var(--lcars-periwinkle);
  color: #000;
}

select.filter-chip {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23CC99FF' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.filters-spacer { flex: 1; }

/* Table card — LCARS panel */
.table-card {
  flex: 1;
  background: var(--surface);
  border: none;
  border-radius: 0 24px 24px 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  animation: fadeUp 0.4s ease 0.2s both;
  border-left: 6px solid var(--lcars-amber);
  border-top: 2px solid var(--lcars-periwinkle);
}

.table-scroll {
  flex: 1;
  overflow: auto;
}

/* Invoice list table */
.inv-table, .v-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.inv-table th, .v-table th { padding: 12px 14px; text-align: left; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--lcars-lavender); border-bottom: 2px solid var(--lcars-periwinkle); position: sticky; top: 0; background: #0a0a0a; z-index: 2; }
.inv-table td, .v-table td { padding: 12px 14px; border-bottom: 1px solid rgba(153,153,255,0.08); color: var(--lcars-sky); }
.inv-table tbody tr, .v-table tbody tr { cursor: pointer; transition: all 0.1s; }
.inv-table tbody tr:hover, .v-table tbody tr:hover { background: rgba(255,153,0,0.06); }
.inv-table tbody tr:active { background: rgba(255,153,0,0.12); }

/* Views */
#list-view { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
#detail-view, #vendor-view, #alerts-view, #add-view { display: none; flex-direction: column; flex: 1; overflow: hidden; }

/* === VENDOR VIEW === */
.vendor-topbar { padding: 14px 24px; border-bottom: 3px solid var(--lcars-peach); display: flex; align-items: center; gap: 12px; flex-shrink: 0; background: #000; }
.vendor-topbar h2 { font-size: 18px; font-weight: 700; flex: 1; text-transform: uppercase; letter-spacing: 0.08em; color: var(--lcars-peach); }
.vendor-content { flex: 1; display: flex; overflow: hidden; }
.vendor-sidebar { width: 280px; border-right: 3px solid var(--lcars-lavender); display: flex; flex-direction: column; overflow: hidden; background: #050505; }
.vendor-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.vendor-item { padding: 10px 16px; border-bottom: 1px solid rgba(153,153,255,0.08); cursor: pointer; transition: all 0.1s; }
.vendor-item:hover { background: rgba(204,153,255,0.06); }
.vendor-item.active { background: rgba(255,153,0,0.1); border-left: 4px solid var(--lcars-amber); }
.vendor-item .v-name { font-weight: 700; font-size: 14px; color: var(--lcars-amber); text-transform: uppercase; letter-spacing: 0.04em; }
.vendor-item .v-meta { font-size: 11px; color: var(--lcars-periwinkle); margin-top: 3px; display: flex; gap: 10px; font-family: var(--mono); }
.vendor-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; padding: 16px; border-bottom: 2px solid var(--lcars-periwinkle); flex-shrink: 0; }
.price-up { color: var(--lcars-red); }
.price-down { color: var(--lcars-amber); }
.price-same { color: var(--lcars-periwinkle); }
.price-bar { display: flex; align-items: center; gap: 6px; }
.price-arrow { font-size: 11px; font-weight: 700; }

/* Merge bar */
.merge-bar { padding: 12px 16px; background: rgba(255,153,0,0.06); border: 2px solid var(--lcars-amber); border-radius: 12px; margin: 8px 16px 12px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.merge-bar .merge-count { font-size: 14px; font-weight: 700; color: var(--lcars-amber); }
.merge-bar .merge-input { flex: 1; }
.merge-bar .merge-names { font-size: 11px; color: var(--lcars-periwinkle); margin-top: 4px; max-height: 40px; overflow: auto; }
.v-table .merge-cb { width: 16px; height: 16px; cursor: pointer; accent-color: var(--lcars-amber); }
.product-cell { display: flex; align-items: center; gap: 4px; }
.product-cell .product-name { flex: 1; font-weight: 600; color: var(--lcars-sky); }
.product-cell .find-btn { color: var(--lcars-periwinkle); text-decoration: none; font-size: 13px; opacity: 0; transition: opacity 0.15s; }
.product-cell .edit-btn { background: none; border: 1px solid transparent; color: var(--lcars-periwinkle); font-size: 13px; cursor: pointer; padding: 1px 6px; border-radius: 4px; opacity: 0; transition: all 0.15s; font-family: var(--font); }
.product-cell .edit-btn:hover { background: rgba(255,153,0,0.1); border-color: var(--lcars-amber); color: var(--lcars-amber); }
.v-table tr:hover .find-btn, .v-table tr:hover .edit-btn { opacity: 1; }

/* === AI MERGE SUGGESTIONS === */
.ai-merge-panel { padding: 12px 16px; background: #050505; border-bottom: 2px solid var(--lcars-periwinkle); flex-shrink: 0; max-height: 50vh; overflow: auto; }
.ai-merge-panel .ai-title { font-size: 13px; font-weight: 700; color: var(--lcars-amber); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.ai-merge-panel .ai-title .close { cursor: pointer; margin-left: auto; color: var(--lcars-periwinkle); font-size: 14px; }
.ai-merge-group { padding: 10px 14px; border: 2px solid var(--lcars-periwinkle); border-radius: 12px; margin-bottom: 8px; background: #0a0a0a; }
.ai-merge-group .group-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ai-merge-group .group-target { font-weight: 700; font-size: 14px; color: var(--lcars-amber); }
.ai-merge-group .group-arrow { color: var(--lcars-periwinkle); font-size: 12px; }
.ai-merge-group .group-sources { font-size: 12px; color: var(--lcars-sky); line-height: 1.6; }
.ai-merge-group .group-sources span { background: var(--surface2); padding: 1px 6px; border-radius: 3px; margin-right: 4px; display: inline-block; margin-bottom: 2px; }
.ai-merge-group .group-actions { display: flex; gap: 6px; margin-top: 8px; }
.ai-merge-group.done { opacity: 0.3; pointer-events: none; }

/* === UNIT FIXER === */
.unit-fixer-panel { padding: 12px 16px; background: #050505; border-bottom: 2px solid var(--lcars-tan); flex-shrink: 0; max-height: 60vh; overflow: auto; }
.unit-fixer-panel .uf-title { font-size: 13px; font-weight: 700; color: var(--lcars-tan); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.unit-fixer-panel .uf-title .close { cursor: pointer; margin-left: auto; color: var(--lcars-periwinkle); font-size: 14px; }
.uf-row { padding: 10px 14px; border: 2px solid var(--lcars-periwinkle); border-radius: 12px; margin-bottom: 8px; background: #0a0a0a; }
.uf-row .uf-product { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--lcars-amber); }
.uf-row .uf-current { font-size: 12px; color: var(--lcars-periwinkle); margin-bottom: 8px; }
.uf-row .uf-current span { background: var(--surface2); padding: 1px 6px; border-radius: 3px; margin-right: 4px; }
.uf-row .uf-options { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.uf-option { padding: 5px 14px; border-radius: 20px; border: 2px solid var(--lcars-periwinkle); background: #000; color: var(--lcars-lavender); font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.15s; font-family: var(--font); text-transform: uppercase; }
.uf-option:hover { border-color: var(--lcars-amber); background: rgba(255,153,0,0.08); color: var(--lcars-amber); }
.uf-option.active { border-color: var(--lcars-amber); background: var(--lcars-amber); color: #000; }
.uf-row.done { opacity: 0.3; pointer-events: none; }

/* === FIND IN INVOICES MODAL === */
.find-modal-bg { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.85); z-index: 100; display: flex; align-items: center; justify-content: center; }
.find-modal { background: #0a0a0a; border: 3px solid var(--lcars-lavender); border-radius: 0 24px 24px 0; width: 900px; max-width: 95vw; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; border-left: 8px solid var(--lcars-amber); }
.find-modal-header { padding: 16px 20px; border-bottom: 2px solid var(--lcars-periwinkle); display: flex; align-items: center; gap: 10px; }
.find-modal-header h3 { font-size: 16px; font-weight: 700; flex: 1; color: var(--lcars-amber); text-transform: uppercase; letter-spacing: 0.08em; }
.find-modal-header .close { cursor: pointer; color: var(--lcars-periwinkle); font-size: 18px; }
.find-modal-header .close:hover { color: var(--lcars-amber); }
.find-modal-body { flex: 1; overflow: auto; padding: 8px; }
.find-row { padding: 10px 14px; border: 2px solid rgba(153,153,255,0.12); border-radius: 12px; margin-bottom: 6px; cursor: pointer; transition: all 0.1s; display: flex; align-items: center; gap: 12px; }
.find-row:hover { border-color: var(--lcars-amber); background: rgba(255,153,0,0.06); }
.find-row .find-info { flex: 1; }
.find-row .find-vendor { font-weight: 700; font-size: 13px; color: var(--lcars-amber); text-transform: uppercase; }
.find-row .find-details { font-size: 12px; color: var(--lcars-periwinkle); margin-top: 2px; font-family: var(--mono); }
.find-row .find-price { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--lcars-sky); }
.month-pills { display: flex; gap: 3px; }
.month-pill { min-width: 28px; border-radius: 4px; font-size: 9px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-family: var(--mono); padding: 2px 4px; line-height: 1.2; }
.pill-label { font-size: 7px; font-weight: 600; opacity: 0.85; letter-spacing: 0.03em; }

/* === STATEMENT VIEW === */
#stmt-view { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.stmt-content { flex: 1; display: flex; overflow: hidden; gap: 0; }

/* Years column — LCARS vertical bar */
.stmt-col-years {
  width: 72px; min-width: 72px; display: flex; flex-direction: column;
  background: #050505;
  border-right: 3px solid var(--lcars-lavender);
}
.stmt-years-header {
  padding: 14px 0; text-align: center; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--lcars-lavender);
  border-bottom: 2px solid var(--lcars-lavender);
}
.stmt-year-btn {
  display: block; width: 100%; padding: 12px 0; border: none; background: transparent;
  color: var(--lcars-periwinkle); font-family: var(--mono); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.1s; text-align: center;
}
.stmt-year-btn:hover { background: rgba(204,153,255,0.08); color: var(--lcars-lavender); }
.stmt-year-btn.active { background: var(--lcars-amber); color: #000; border-right: none; }

/* Months column */
.stmt-col-months {
  width: 280px; min-width: 280px; display: flex; flex-direction: column;
  background: #000; border-right: 3px solid var(--lcars-periwinkle); overflow: hidden;
}
.stmt-months-header {
  padding: 14px 20px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--lcars-lavender); border-bottom: 2px solid var(--lcars-periwinkle);
}
.stmt-months-body { flex: 1; overflow-y: auto; padding: 8px; }

.stmt-month-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 0 16px 16px 0;
  cursor: pointer; transition: all 0.1s; font-size: 15px; font-weight: 700; color: var(--lcars-lavender); margin-bottom: 2px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.stmt-month-row:hover { background: rgba(204,153,255,0.08); }
.stmt-month-row.active { background: var(--lcars-amber); color: #000; }
.stmt-month-row .m-arrow { font-size: 9px; width: 12px; text-align: center; transition: transform 0.2s; }
.stmt-month-row .m-arrow.open { transform: rotate(90deg); }
.stmt-month-row.active .m-arrow { color: #000; }
.stmt-month-row .m-name { flex: 1; }
.stmt-month-row .m-total { font-family: var(--mono); font-size: 12px; font-weight: 700; }

.stmt-vendor-list { padding-left: 6px; }
.stmt-vendor-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 20px;
  border-radius: 0 12px 12px 0; cursor: pointer; transition: all 0.1s;
  font-size: 13px; color: var(--lcars-periwinkle); font-weight: 600; margin-bottom: 1px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.stmt-vendor-row:hover { background: rgba(255,153,0,0.06); color: var(--lcars-sky); }
.stmt-vendor-row.active { background: rgba(255,153,0,0.12); color: var(--lcars-amber); border-left: 3px solid var(--lcars-amber); }
.stmt-vendor-row .sv-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stmt-vendor-row .sv-amount { font-family: var(--mono); font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--lcars-sky); }
.stmt-vendor-row .sv-paid {
  width: 20px; height: 20px; border-radius: 5px; border: 2px solid var(--lcars-periwinkle);
  background: transparent; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0; transition: all 0.15s;
  color: transparent; cursor: pointer;
}
.stmt-vendor-row .sv-paid:hover { border-color: var(--lcars-amber); }
.stmt-vendor-row .sv-paid.checked { background: var(--lcars-amber); border-color: var(--lcars-amber); color: #000; }

/* Detail column */
.stmt-col-detail {
  flex: 0 0 34%; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
}
.stmt-detail-card {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  background: #050505; border-right: 3px solid var(--lcars-peach);
}
.stmt-detail-header {
  padding: 14px 20px; font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--lcars-lavender); border-bottom: 2px solid var(--lcars-peach);
  display: flex; align-items: center; gap: 10px;
}
.stmt-detail-header .stmt-vendor-name { font-size: 14px; font-weight: 700; color: var(--lcars-amber); text-transform: uppercase; letter-spacing: 0.06em; }
.stmt-detail-body { flex: 1; overflow-y: auto; padding: 0 12px 12px; }

.stmt-loc-block {
  background: #0a0a0a; border: 2px solid var(--lcars-periwinkle); border-radius: 0 16px 16px 0;
  margin-top: 10px; overflow: hidden; transition: border-color 0.2s;
  border-left: 4px solid var(--lcars-amber);
}
.stmt-loc-block:hover { border-color: var(--lcars-amber); }
.stmt-loc-header {
  display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid rgba(153,153,255,0.1);
}
.stmt-loc-header .loc-name { font-size: 15px; font-weight: 700; flex: 1; color: var(--lcars-amber); text-transform: uppercase; letter-spacing: 0.06em; }
.stmt-loc-header .loc-total { font-size: 16px; font-weight: 700; font-family: var(--mono); color: var(--lcars-sky); }

.stmt-inv-table { width: 100%; border-collapse: collapse; }
.stmt-inv-table th {
  padding: 7px 12px; text-align: left; font-size: 10px; font-weight: 700;
  color: var(--lcars-lavender); text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid rgba(153,153,255,0.1);
}
.stmt-inv-table th:last-child { text-align: right; }
.stmt-inv-table td {
  padding: 8px 12px; font-size: 13px; font-family: var(--mono); color: var(--lcars-sky);
  border-bottom: 1px solid rgba(153,153,255,0.06); font-weight: 500;
}
.stmt-inv-table td:last-child { text-align: right; font-weight: 700; }
.stmt-inv-table tr { cursor: pointer; transition: background 0.1s; }
.stmt-inv-table tr:hover { background: rgba(255,153,0,0.06); }
.stmt-inv-table tr.active-row { background: rgba(255,153,0,0.1); }
.stmt-inv-table tr:last-child td { border-bottom: none; }

.stmt-grand-total {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 12px 20px; border-top: 3px solid var(--lcars-amber); margin-top: auto; flex-shrink: 0;
}
.stmt-grand-total .gt-label { font-size: 14px; color: var(--lcars-lavender); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.stmt-grand-total .gt-value { font-size: 24px; font-weight: 700; font-family: var(--mono); color: var(--lcars-amber); }

/* Preview column */
.stmt-col-preview {
  flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: #000;
}
.stmt-preview-header {
  padding: 14px 20px; font-size: 15px; font-weight: 700;
  border-bottom: 2px solid var(--lcars-periwinkle); flex-shrink: 0;
  color: var(--lcars-lavender); text-transform: uppercase; letter-spacing: 0.08em;
}
.stmt-preview-body { flex: 1; overflow-y: auto; background: #050505; padding: 8px; }
.stmt-preview-body img { width: 100%; display: block; border-radius: 8px; user-select: none; border: 2px solid var(--lcars-periwinkle); }

/* Reconcile modal */
.recon-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.recon-modal {
  background: #0a0a0a; border: 3px solid var(--lcars-lavender);
  border-radius: 0 24px 24px 0; width: 560px; max-width: 95vw; max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden;
  border-left: 8px solid var(--lcars-peach);
}
.recon-modal-header {
  padding: 18px 22px; border-bottom: 2px solid var(--lcars-periwinkle);
  display: flex; align-items: center; gap: 10px;
}
.recon-modal-header h3 { font-size: 17px; font-weight: 700; flex: 1; color: var(--lcars-peach); text-transform: uppercase; letter-spacing: 0.08em; }
.recon-modal-close {
  cursor: pointer; color: var(--lcars-periwinkle); font-size: 18px;
  background: none; border: none; padding: 4px 8px; border-radius: 8px;
  transition: all 0.1s;
}
.recon-modal-close:hover { color: var(--lcars-amber); background: rgba(255,153,0,0.08); }
.recon-modal-body { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }

.upload-zone {
  border: 2px dashed var(--lcars-periwinkle); border-radius: 12px;
  padding: 16px 12px; text-align: center; cursor: pointer; transition: all 0.15s;
  background: #050505; margin-bottom: 8px;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--lcars-amber); background: rgba(255,153,0,0.05); }
.upload-zone-text { font-size: 14px; color: var(--lcars-lavender); text-transform: uppercase; letter-spacing: 0.06em; }
.upload-zone-sub { font-size: 11px; color: var(--lcars-periwinkle); margin-top: 3px; }
.file-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.file-chip {
  display: flex; align-items: center; gap: 5px;
  background: var(--surface2); border: 2px solid var(--lcars-periwinkle);
  border-radius: 8px; padding: 4px 8px; font-size: 11px; font-family: var(--mono); color: var(--lcars-sky);
}
.file-chip-thumb { width: 24px; height: 24px; object-fit: cover; border-radius: 3px; }
.file-chip-remove { cursor: pointer; color: var(--lcars-periwinkle); font-size: 13px; }
.file-chip-remove:hover { color: var(--lcars-red); }
.recon-btn {
  width: 100%; padding: 10px; border-radius: 20px;
  border: 2px solid var(--lcars-amber); background: transparent;
  color: var(--lcars-amber); font-family: var(--font); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.06em;
}
.recon-btn:hover { background: var(--lcars-amber); color: #000; }
.recon-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.recon-summary { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.recon-stat {
  flex: 1; min-width: 60px; padding: 8px 6px; border-radius: 8px;
  border: 2px solid var(--lcars-periwinkle); background: #050505; text-align: center;
}
.recon-stat-num { font-size: 20px; font-weight: 700; font-family: var(--mono); color: var(--lcars-amber); }
.recon-stat-label { font-size: 10px; color: var(--lcars-lavender); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }
.recon-totals {
  padding: 10px; border-radius: 8px; border: 2px solid var(--lcars-periwinkle);
  background: #050505; font-size: 12px; margin-bottom: 8px;
}
.recon-total-row { display: flex; justify-content: space-between; padding: 4px 0; color: var(--lcars-sky); }
.recon-total-row.diff { border-top: 2px solid var(--lcars-amber); padding-top: 6px; margin-top: 4px; font-weight: 700; color: var(--lcars-amber); }

/* === PRINT === */
@media print {
  .sidebar, .topbar, .stats-row, .filters-row, .detail-topbar, .vendor-topbar, .stmt-col-years, .stmt-col-preview { display: none !important; }
  body, html { background: #fff !important; color: #000 !important; overflow: visible !important; height: auto !important; }
  #app { height: auto !important; overflow: visible !important; }
  .main { padding: 0 !important; }
}

/* === STARDATE CLOCK === */
.stardate-display {
  padding: 10px 16px;
  background: var(--surface2);
  border-bottom: 2px solid rgba(255,153,0,0.2);
}
.stardate-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--lcars-periwinkle);
  margin-bottom: 2px;
}
.stardate-value {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--lcars-amber);
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.stardate-clock {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--lcars-sky);
  margin-top: 2px;
  letter-spacing: 0.06em;
}

/* === BOOT SEQUENCE OVERLAY === */
.boot-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
}
.boot-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}
.boot-inner {
  width: 520px;
  max-width: 90vw;
}
.boot-header {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  color: var(--lcars-amber);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 24px;
  border-bottom: 3px solid var(--lcars-amber);
  padding-bottom: 12px;
}
.boot-log {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--lcars-sky);
  line-height: 1.8;
  min-height: 200px;
  margin-bottom: 20px;
}
.boot-log .boot-line {
  opacity: 0;
  animation: bootLineIn 0.15s ease-out forwards;
}
.boot-log .boot-line.ok { color: var(--lcars-amber); }
.boot-log .boot-line.sys { color: var(--lcars-lavender); }
.boot-log .boot-line.warn { color: var(--lcars-tan); }
.boot-log .boot-line.highlight { color: var(--lcars-peach); font-weight: 700; }
@keyframes bootLineIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
.boot-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.boot-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--lcars-amber), var(--lcars-peach), var(--lcars-lavender));
  border-radius: 3px;
  transition: width 0.15s linear;
}

/* === TRANSPORTER BEAM EFFECT === */
@keyframes transporterMaterialize {
  0% { opacity: 0; filter: brightness(3) blur(8px); }
  30% { opacity: 0.6; filter: brightness(2) blur(4px); }
  60% { opacity: 0.85; filter: brightness(1.4) blur(1px); }
  100% { opacity: 1; filter: brightness(1) blur(0); }
}
@keyframes transporterSparkle {
  0% { background-position: 0% 0%; opacity: 0.7; }
  50% { opacity: 0.3; }
  100% { background-position: 100% 100%; opacity: 0; }
}
.transporter-beam {
  animation: transporterMaterialize 0.7s ease-out both;
}
.transporter-sparkle {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 10;
  background: radial-gradient(ellipse at 30% 20%, rgba(255,153,0,0.4) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 60%, rgba(204,153,255,0.3) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 40%, rgba(255,204,153,0.3) 0%, transparent 40%);
  background-size: 200% 200%;
  animation: transporterSparkle 0.8s ease-out forwards;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .sidebar { width: 64px; padding: 0; }
  .sidebar-logo .logo-text,
  .nav-item span,
  .sidebar-section-label,
  .sidebar-user .user-info,
  .nav-item .nav-badge { display: none; }
  .nav-item { justify-content: center; padding: 10px; border-radius: 0; width: 100%; }
  .sidebar-logo { border-radius: 0; justify-content: center; padding: 16px 8px; }
  .sidebar-user { border-radius: 0; justify-content: center; padding: 14px 8px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .main { padding: 16px; }
  .vendor-content { flex-direction: column; }
  .vendor-sidebar { width: 100%; max-height: 35vh; border-right: none; border-bottom: 3px solid var(--lcars-lavender); }
}

/* === OVERVIEW VIEW === */
#overview-view { display: none; flex-direction: column; gap: 0; flex: 1; min-height: 0; }
.overview-body { flex: 1; overflow-y: auto; padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 20px; }

.ov-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ov-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 6px solid var(--lcars-amber);
  padding: 16px 18px; cursor: pointer;
  transition: background 0.15s, border-left-color 0.15s, transform 0.15s;
  display: flex; flex-direction: column; gap: 6px;
}
.ov-stat:hover { background: var(--surface2); transform: translateY(-1px); }
.ov-stat.violet { border-left-color: var(--lcars-lavender); }
.ov-stat.peach { border-left-color: var(--lcars-peach); }
.ov-stat.red { border-left-color: var(--lcars-red); }
.ov-stat .lbl { font-size: 11px; color: var(--text-dim); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.ov-stat .num { font-family: 'JetBrains Mono', monospace; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--lcars-amber); }
.ov-stat.violet .num { color: var(--lcars-lavender); }
.ov-stat.peach .num { color: var(--lcars-peach); }
.ov-stat.red .num { color: var(--lcars-red); }

.ov-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ov-tile {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 20px; text-decoration: none; color: #000;
  background: var(--lcars-amber); border-radius: 0 20px 0 20px;
  font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  transition: filter 0.15s, transform 0.15s;
  cursor: pointer; border: none; text-align: left;
}
.ov-tile:hover { filter: brightness(1.15); transform: translateY(-1px); }
.ov-tile.peach { background: var(--lcars-peach); }
.ov-tile.violet { background: var(--lcars-lavender); }
.ov-tile.tan { background: var(--lcars-tan); }
.ov-tile .title { font-size: 14px; font-weight: 700; }
.ov-tile .sub { font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 500; letter-spacing: 0.05em; text-transform: none; opacity: 0.8; }

.ov-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--lcars-amber);
  padding: 16px 20px; min-height: 200px;
}
/* Quick Actions row under the ship — horizontal layout, no min-height */
.ov-panel-actions { min-height: 0; padding: 14px 20px; }
.ov-panel-actions #ov-actions {
  flex-direction: row !important;
  flex-wrap: wrap;
  gap: 10px;
}
.ov-panel-actions #ov-actions .ov-action { flex: 1 1 220px; }
.ov-panel h3 {
  font-size: 11px; font-weight: 700; color: var(--lcars-amber);
  text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 12px;
}
.ov-item {
  display: grid; grid-template-columns: 52px 1fr;
  gap: 10px; padding: 8px 0; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.ov-item:last-child { border-bottom: none; }
.ov-item .time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--lcars-peach); font-weight: 600;
}
.ov-item .text { color: var(--text); line-height: 1.45; }
.ov-item .text b { color: var(--lcars-tan); font-weight: 700; }
.ov-item.status-ok .time { color: var(--lcars-lavender); }
.ov-item.status-warn .time { color: var(--lcars-peach); }
.ov-item.status-err .time { color: var(--lcars-red); }

/* MSD is now full-width at the top of the overview; Quick Actions sits below */
#ov-msd {
  margin-bottom: 0;
  position: relative;
  height: clamp(460px, 62vh, 720px);
  width: 100%;
}

/* Interactive MSD sectors — hover brightens (no transform — scale caused hover flicker on SVG shapes) */
#ov-msd [data-msd-status] { transition: filter 0.15s; }
#ov-msd [data-msd-status]:hover { filter: brightness(1.4) drop-shadow(0 0 4px currentColor); }

/* Overview skin toggle — small pill row in top-right of the MSD panel */
.msd-skin-toggle {
  position: absolute;
  top: 10px; right: 12px;
  z-index: 30;
  display: flex;
  gap: 2px;
  font-family: 'JetBrains Mono', monospace;
}
.msd-skin-toggle button {
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-dim, #aaa);
  border: 1px solid var(--border, rgba(255,255,255,0.15));
  padding: 5px 12px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.msd-skin-toggle button:first-child { border-radius: 12px 2px 2px 12px; }
.msd-skin-toggle button:last-child  { border-radius: 2px 12px 12px 2px; }
.msd-skin-toggle button:hover { color: var(--lcars-amber, #ff9966); border-color: var(--lcars-amber, #ff9966); }
.msd-skin-toggle button.active {
  background: var(--lcars-amber, #ff9966);
  color: #000;
  border-color: var(--lcars-amber, #ff9966);
}

/* MSD popover that appears when you click a sector */
.msd-popover {
  position: absolute; top: 16px; right: 16px;
  width: 320px; max-width: calc(100% - 32px);
  background: #000; border: 1px solid var(--border);
  border-radius: 8px; padding: 0; z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  animation: fadeUp 0.2s ease both;
  font-family: 'DM Sans', system-ui, sans-serif;
}
.msd-pop-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-left: 4px solid var(--lcars-amber);
  border-bottom: 1px solid var(--border);
}
.msd-pop-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; flex: 1;
}
.msd-pop-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-dim);
}
.msd-pop-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 20px; cursor: pointer; padding: 0 4px;
  line-height: 1; transition: color 0.15s;
}
.msd-pop-close:hover { color: var(--lcars-red); }
.msd-pop-body {
  max-height: 240px; overflow-y: auto; padding: 6px 0;
}
.msd-pop-item {
  display: grid; grid-template-columns: 1fr auto auto auto;
  gap: 8px; padding: 8px 14px; cursor: pointer;
  font-size: 12px; align-items: center;
  transition: background 0.12s;
  border-bottom: 1px solid var(--border);
}
.msd-pop-item:last-child { border-bottom: none; }
.msd-pop-item:hover { background: var(--surface2); }
.msd-pop-v { color: var(--text); font-weight: 600; }
.msd-pop-n { color: var(--text-dim); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.msd-pop-d { color: var(--text-dim); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.msd-pop-t { color: var(--lcars-peach); font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600; }
.msd-pop-more {
  padding: 6px 14px; font-size: 11px; color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace; text-align: center;
}
.msd-pop-empty {
  padding: 18px 14px; font-size: 13px; color: var(--lcars-lavender);
  text-align: center;
}
.msd-pop-foot {
  padding: 10px 14px; border-top: 1px solid var(--border);
  text-align: right;
}
.msd-pop-viewall {
  background: var(--lcars-amber); color: #000; border: none;
  padding: 6px 12px; border-radius: 4px; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; transition: filter 0.15s;
}
.msd-pop-viewall:hover { filter: brightness(1.15); }

/* Clickable legend items */
.msd-legend-clickable { cursor: pointer; transition: background 0.15s; padding: 4px 8px; border-radius: 4px; }
.msd-legend-clickable:hover { background: rgba(255,153,0,0.08); }

/* Quick Actions inside overview */
#ov-actions { display: flex; flex-direction: column; gap: 8px; }
.ov-action {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg, #000); border: 1px solid var(--border);
  border-left: 3px solid var(--lcars-amber);
  border-radius: 0 6px 6px 0;
  color: var(--text); font-size: 13px; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background 0.15s, border-left-color 0.15s, transform 0.12s;
}
.ov-action:hover {
  background: var(--surface2); border-left-color: var(--lcars-peach);
  transform: translateX(2px);
}
.ov-action-label { letter-spacing: 0.02em; }
.ov-action-key {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; min-width: 22px; text-align: center;
  background: var(--surface2); color: var(--lcars-peach);
  border: 1px solid var(--border); border-radius: 4px;
  letter-spacing: 0;
}

@media (max-width: 1024px) {
  .ov-panel-actions #ov-actions .ov-action { flex-basis: 100%; }
}
