/* =========================================================================
   Content System — design system
   Aesthetic: dark glass / holographic (deep navy + cyan + backdrop blur)
   ========================================================================= */

:root {
  /* Palette ---------------------------------------------------------------- */
  --ink-0:  #02030a;
  --ink-1:  #05070f;
  --ink-2:  #0a0f1f;
  --ink-3:  #111932;
  --ink-4:  #1a2447;

  --fog-1:  rgba(18, 26, 54, 0.55);
  --fog-2:  rgba(22, 32, 68, 0.45);
  --fog-3:  rgba(40, 56, 110, 0.30);

  --edge-1: rgba(120, 180, 255, 0.10);
  --edge-2: rgba(120, 180, 255, 0.22);
  --edge-3: rgba(120, 180, 255, 0.40);

  --text-1: #e7ecf5;
  --text-2: #a7b3cd;
  --text-3: #6b7897;
  --text-4: #3f4a66;

  --cyan:       #4fd1ff;
  --cyan-soft:  #8fe4ff;
  --cyan-glow:  rgba(79, 209, 255, 0.45);
  --cyan-haze:  rgba(79, 209, 255, 0.12);

  --violet:     #9a7cff;
  --violet-glow: rgba(154, 124, 255, 0.35);

  --mint:       #3ddc97;
  --amber:      #ffc56d;
  --rose:       #ff5d8f;

  /* Typography ------------------------------------------------------------- */
  --font-sans: 'Inter', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, 'Cascadia Mono', Menlo, monospace;

  /* Spacing / radii -------------------------------------------------------- */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Shadows ---------------------------------------------------------------- */
  --shadow-panel:
    0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 24px 60px -20px rgba(0, 0, 0, 0.75),
    0 0 0 1px var(--edge-1);

  --shadow-glow:
    0 0 0 1px var(--edge-2),
    0 0 24px -4px var(--cyan-glow);

  --shadow-inset-hair: 0 1px 0 rgba(255, 255, 255, 0.04) inset;

  /* Motion ----------------------------------------------------------------- */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* Reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--ink-0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; letter-spacing: -0.01em; color: var(--text-1); }
h1 { font-size: 28px; letter-spacing: -0.02em; }
h2 { font-size: 20px; letter-spacing: -0.015em; }
h3 { font-size: 16px; }
p  { margin: 0; }
a  { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--cyan-soft); text-shadow: 0 0 12px var(--cyan-glow); }
hr { border: 0; height: 1px; background: var(--edge-1); margin: var(--space-5) 0; }
code, pre, kbd { font-family: var(--font-mono); }
svg { display: inline-block; vertical-align: middle; }

::selection { background: var(--cyan-haze); color: var(--cyan-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ink-3);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); background-clip: padding-box; }

/* =========================================================================
   Global background — aurora + grid
   ========================================================================= */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1200px 800px at 85% -10%, rgba(79, 209, 255, 0.18), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(154, 124, 255, 0.20), transparent 60%),
    radial-gradient(600px 400px at 50% 50%,  rgba(79, 209, 255, 0.06), transparent 60%),
    linear-gradient(180deg, var(--ink-0) 0%, var(--ink-1) 40%, var(--ink-0) 100%);
  filter: saturate(110%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgba(120, 180, 255, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(120, 180, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.8), transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.8), transparent 75%);
  pointer-events: none;
}

/* =========================================================================
   Utility primitives
   ========================================================================= */

.muted  { color: var(--text-3); }
.dim    { color: var(--text-2); }
.mono   { font-family: var(--font-mono); }
.caps   {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}
.tabular { font-variant-numeric: tabular-nums; }

.row { display: flex; align-items: center; gap: var(--space-3); }
.row--between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack-lg { gap: var(--space-5); }
.grid { display: grid; gap: var(--space-5); }

/* =========================================================================
   Glass panel — the core design primitive
   ========================================================================= */

.panel {
  position: relative;
  background: linear-gradient(180deg, var(--fog-1), var(--fog-2));
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-panel);
  padding: var(--space-5);
  isolation: isolate;
}

.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(120, 180, 255, 0.35),
    rgba(120, 180, 255, 0.02) 30%,
    rgba(120, 180, 255, 0.02) 70%,
    rgba(154, 124, 255, 0.25)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

/* Corner reticles — little L-brackets at each corner for the holographic feel */
.panel--reticle::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: calc(var(--r-lg) - 4px);
  background:
    linear-gradient(var(--cyan), var(--cyan)) top left     / 12px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) top left     / 1px 12px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) top right    / 12px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) top right    / 1px 12px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) bottom left  / 12px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) bottom left  / 1px 12px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) bottom right / 12px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) bottom right / 1px 12px no-repeat;
  opacity: 0.35;
  pointer-events: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--edge-1);
}
.panel-title { font-size: 14px; font-weight: 600; letter-spacing: 0.02em; }

/* =========================================================================
   Forms
   ========================================================================= */

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field > label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.input, .textarea, .select {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--text-1);
  background: rgba(5, 7, 15, 0.55);
  border: 1px solid var(--edge-1);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background 160ms var(--ease-out);
  box-shadow: var(--shadow-inset-hair);
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--edge-2); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--edge-3);
  background: rgba(5, 7, 15, 0.75);
  box-shadow:
    var(--shadow-inset-hair),
    0 0 0 3px var(--cyan-haze),
    0 0 22px -2px var(--cyan-glow);
}

.textarea { resize: vertical; min-height: 96px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  font: inherit;
  font-weight: 500;
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--edge-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 160ms var(--ease-out);
  letter-spacing: 0.01em;
}
.btn:hover {
  border-color: var(--edge-3);
  background: rgba(120, 180, 255, 0.06);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn--primary {
  color: #021822;
  background:
    linear-gradient(180deg, #9be7ff 0%, var(--cyan) 60%, #37b8e8 100%);
  border-color: transparent;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 10px 30px -8px var(--cyan-glow),
    0 0 0 1px rgba(79, 209, 255, 0.5);
  font-weight: 600;
}
.btn--primary:hover {
  background:
    linear-gradient(180deg, #b5efff 0%, #74dbff 60%, #4ac7ec 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 14px 36px -6px var(--cyan-glow),
    0 0 0 1px rgba(79, 209, 255, 0.7);
}

.btn--ghost { background: transparent; border-color: var(--edge-1); color: var(--text-2); }
.btn--ghost:hover { color: var(--text-1); border-color: var(--edge-2); background: rgba(255,255,255,0.02); }

.btn--danger { color: var(--rose); border-color: rgba(255, 93, 143, 0.4); }
.btn--danger:hover { background: rgba(255, 93, 143, 0.08); border-color: rgba(255, 93, 143, 0.7); }

.btn-block { width: 100%; }

/* =========================================================================
   Badges / status pills
   ========================================================================= */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: 999px;
  border: 1px solid var(--edge-1);
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.02);
  text-transform: uppercase;
}
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.pill--ok      { color: var(--mint);   border-color: rgba(61, 220, 151, 0.35); }
.pill--warn    { color: var(--amber);  border-color: rgba(255, 197, 109, 0.35); }
.pill--danger  { color: var(--rose);   border-color: rgba(255, 93, 143, 0.35); }
.pill--info    { color: var(--cyan);   border-color: rgba(79, 209, 255, 0.40); }
.pill--muted   { color: var(--text-3); border-color: var(--edge-1); }

/* =========================================================================
   Boot / splash screen (used by HomeController placeholder)
   ========================================================================= */

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
}
.boot-screen { text-align: center; max-width: 520px; }
.boot-screen h1 {
  font-size: 36px;
  letter-spacing: -0.025em;
  background: linear-gradient(180deg, #ffffff 0%, #bcd3ec 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  margin-bottom: var(--space-2);
}
.boot-screen .muted { font-size: 14px; }

.boot-orb {
  width: 128px;
  height: 128px;
  margin: 0 auto var(--space-6);
  border-radius: 50%;
  position: relative;
  background:
    radial-gradient(circle at 35% 35%, rgba(255,255,255,0.9), rgba(79, 209, 255, 0.6) 30%, rgba(79, 209, 255, 0.1) 60%, transparent 70%);
  filter: blur(0.3px);
  box-shadow:
    0 0 80px 10px var(--cyan-glow),
    0 0 160px 20px rgba(154, 124, 255, 0.25);
  animation: orb-pulse 4s var(--ease-in-out) infinite;
}
.boot-orb::after {
  content: '';
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  border: 1px dashed rgba(120, 180, 255, 0.25);
  animation: orb-ring 20s linear infinite;
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1);   filter: blur(0.3px) brightness(1); }
  50%      { transform: scale(1.03); filter: blur(0.3px) brightness(1.15); }
}
@keyframes orb-ring {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* =========================================================================
   Auth layout (login screen)
   ========================================================================= */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
}
.auth .panel { width: 100%; max-width: 420px; padding: var(--space-6); }
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.auth-brand .brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background:
    radial-gradient(circle at 35% 35%, #ffffff 0%, var(--cyan) 35%, #1a4d6b 80%);
  box-shadow:
    0 0 0 1px var(--edge-3),
    0 0 24px -4px var(--cyan-glow);
}
.auth-brand .brand-name {
  font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-2);
}
.auth-title { text-align: center; margin-bottom: var(--space-5); }
.auth-title h1 { font-size: 22px; }
.auth-title p  { color: var(--text-3); margin-top: 4px; }
.auth-footer   { text-align: center; margin-top: var(--space-5); font-size: 12px; color: var(--text-4); }
.auth-error {
  background: rgba(255, 93, 143, 0.08);
  border: 1px solid rgba(255, 93, 143, 0.35);
  color: var(--rose);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: var(--space-4);
}

/* =========================================================================
   App shell — sidebar + main
   ========================================================================= */

.shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--space-5);
  border-right: 1px solid var(--edge-1);
  background: linear-gradient(180deg, rgba(5, 7, 15, 0.85), rgba(5, 7, 15, 0.65));
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 4px 8px;
}
.sidebar-brand .brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background:
    radial-gradient(circle at 35% 35%, #ffffff 0%, var(--cyan) 35%, #1a4d6b 80%);
  box-shadow: 0 0 0 1px var(--edge-3), 0 0 18px -4px var(--cyan-glow);
}
.sidebar-brand .brand-name {
  font-size: 12px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* Workspace switcher */
.ws-switcher {
  position: relative;
  background: rgba(5, 7, 15, 0.5);
  border: 1px solid var(--edge-1);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), background 160ms var(--ease-out);
}
.ws-switcher:hover { border-color: var(--edge-2); background: rgba(5, 7, 15, 0.7); }
.ws-switcher .ws-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
  flex: 0 0 auto;
}
.ws-switcher .ws-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.ws-switcher .ws-chev {
  color: var(--text-3);
  font-size: 10px;
}

/* Sidebar nav */
.nav-section {
  display: flex; flex-direction: column; gap: 2px;
}
.nav-heading {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-4);
  padding: 0 8px;
  margin-bottom: 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text-2);
  border-radius: var(--r-sm);
  font-size: 13px;
  position: relative;
  transition: color 120ms, background 120ms;
}
.nav-link:hover { color: var(--text-1); background: rgba(120, 180, 255, 0.05); }
.nav-link[aria-current='page'] {
  color: var(--text-1);
  background:
    linear-gradient(90deg, rgba(79, 209, 255, 0.14), rgba(79, 209, 255, 0) 80%);
}
.nav-link[aria-current='page']::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}
.nav-link .nav-icon {
  width: 16px; height: 16px; opacity: 0.8;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--edge-1);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b4b80, #1a2447);
  border: 1px solid var(--edge-2);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-1);
  letter-spacing: 0.05em;
}

/* Main area */
.main { padding: var(--space-6); max-width: 1400px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-6);
}
.topbar h1 {
  font-size: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #c9d6ec 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar .sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
}

.metric {
  padding: var(--space-5);
}
.metric .metric-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.14em; }
.metric .metric-value {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 4px;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
.metric .metric-value .unit { color: var(--text-3); font-size: 14px; font-weight: 400; margin-left: 6px; }
.metric .metric-trend { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.metric .metric-trend .up   { color: var(--mint); }
.metric .metric-trend .down { color: var(--rose); }

/* Simple table */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table th, .table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge-1);
}
.table th {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-4);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.015);
}
.table tbody tr:hover td { background: rgba(120, 180, 255, 0.03); }
.table tbody tr:last-child td { border-bottom: 0; }

.empty {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--text-3);
  border: 1px dashed var(--edge-1);
  border-radius: var(--r-md);
}

/* =========================================================================
   Small helpers — keep last so they can override earlier specificity
   ========================================================================= */

.hide { display: none !important; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--edge-1);
  }
  .main { padding: var(--space-5); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
