/* ============================================================
   Cryonic Control — fleet-command console theme
   ============================================================ */
:root {
  /* COLOURS LIVE IN css/skin-default.css, generated by tools/build-theme.mjs
     from the same palette that produces the overlay's token dictionary. They
     are not repeated here: two hand-maintained copies of one palette drift,
     and the point of generating them is that they cannot.

     What remains below is NOT palette data — type stacks and a HUD metric are
     the same whatever colour the skin is. */
  --mono: ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --sans: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --tick: 3px; /* HUD corner bracket thickness */
}


* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
}

/* fixed atmosphere layer: nebula glow + telemetry grid + vignette */
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(130% 90% at 50% -20%, rgba(79,195,247,.10), transparent 55%),
    radial-gradient(90% 60% at 105% -8%, rgba(255,152,0,.06), transparent 55%),
    radial-gradient(120% 70% at 50% 120%, rgba(0,0,0,.6), transparent 60%);
}
.grid-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(79,195,247,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,195,247,.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 78% 60% at 50% 0%, #000 30%, transparent 100%);
}

/* CRT scanlines */
.scan {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
}

/* cockpit-canopy HUD corner brackets framing the viewport */
.hud { position: fixed; inset: 9px; z-index: 30; pointer-events: none; }
.hud-c { position: absolute; width: 26px; height: 26px; border: 2px solid var(--accent); opacity: .5;
  filter: drop-shadow(0 0 5px rgba(79,195,247,.4)); }
.hud-c.tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.hud-c.tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.hud-c.bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.hud-c.br { bottom: 0; right: 0; border-left: none; border-top: none; }

/* ---- top command bar ---------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 0 22px; height: 56px;
  background: linear-gradient(180deg, #101822, #0A0E14);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(79,195,247,.14), 0 10px 30px -22px rgba(0,0,0,.95);
}
.brand {
  font-family: var(--mono); font-weight: 700; letter-spacing: .14em;
  color: var(--gold); font-size: 15px; white-space: nowrap;
  display: flex; align-items: baseline; gap: 8px;
  text-shadow: 0 0 14px rgba(255,213,79,.4);
}
.brand-sub { color: var(--accent); font-weight: 500; font-size: 11px; letter-spacing: .3em; }

.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  padding: 8px 12px; border-radius: 4px; border: 1px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
}
.nav a:hover { color: var(--text); background: rgba(255,255,255,.03); }
.nav a.active { color: var(--accent); border-color: rgba(79,195,247,.4); background: var(--accent-dim); text-shadow: 0 0 10px rgba(79,195,247,.5); }
.nav a#logout { margin-left: auto; color: var(--muted); }
.nav a#logout:hover { color: var(--red); }

.whoami {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  letter-spacing: .04em; white-space: nowrap;
}

/* ---- main view ---------------------------------------------- */
.view {
  position: relative; z-index: 1;
  max-width: 1040px; margin: 0 auto; padding: 34px 22px 80px;
}

/* ---- card with HUD corner brackets -------------------------- */
.card {
  position: relative;
  background:
    linear-gradient(90deg, var(--accent), transparent 52%) top left / 100% 2px no-repeat,
    linear-gradient(180deg, #14202c, var(--bg-panel));
  padding: 24px 26px;
  margin-bottom: 22px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  box-shadow: inset 0 0 0 1px var(--border);
  filter: drop-shadow(0 12px 24px rgba(0,0,0,.5)) drop-shadow(0 0 12px rgba(79,195,247,.06));
}

.eyebrow {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .26em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 6px;
  text-shadow: 0 0 10px rgba(255,213,79,.35);
}
.eyebrow::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(255,213,79,.4), rgba(255,213,79,.04) 60%, transparent);
}
.card h2 {
  margin: 0 0 4px; font-size: 21px; font-weight: 650; letter-spacing: -.01em;
  text-shadow: 0 0 20px rgba(79,195,247,.14);
}
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

/* ---- forms -------------------------------------------------- */
.field { display: block; margin-bottom: 14px; }
.field > label {
  display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
input[type=text], input[type=url], input[type=number], select, textarea {
  width: 100%; background: var(--bg-sunk); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 9px 11px; font-family: var(--mono); font-size: 13px;
  transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 74px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 180px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---- buttons ------------------------------------------------ */
.btn, .btn-danger, .btn-ghost {
  font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid; padding: 9px 18px; cursor: pointer;
  background: transparent; transition: background .12s, color .12s, border-color .12s, box-shadow .12s;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.btn { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.btn:hover { background: rgba(79,195,247,.26); box-shadow: 0 0 16px rgba(79,195,247,.28); }
.btn-danger { color: var(--red); border-color: var(--red); background: var(--red-dim); }
.btn-danger:hover { background: rgba(239,83,80,.24); }
.btn-ghost { color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn:disabled, .btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 11px; }

/* ---- tables ------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); text-align: left; font-weight: 500;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
td { padding: 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }
.tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 3px; border: 1px solid var(--border); color: var(--muted);
}
.tag.scope { color: var(--accent); border-color: rgba(79,195,247,.4); }

.empty { color: var(--muted); font-family: var(--mono); font-size: 13px; padding: 22px 4px; }

/* ---- coalition sub-panels + chips --------------------------- */
.subcard {
  background: var(--bg-sunk);
  box-shadow: inset 0 0 0 1px var(--border-soft);
  padding: 15px 17px; margin-bottom: 12px;
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 11px 100%, 0 calc(100% - 11px));
}
.subcard:last-child { margin-bottom: 0; }
.subcard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.subcard-head strong { font-size: 15px; letter-spacing: .01em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  background: rgba(79,195,247,.08); border: 1px solid var(--border); padding: 3px 5px 3px 9px;
}
.chip button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 0 2px;
}
.chip button:hover { color: var(--red); }

/* ---- login -------------------------------------------------- */
.login {
  max-width: 420px; margin: 12vh auto 0; text-align: center; padding: 40px 34px;
}
.login .eyebrow { margin-bottom: 14px; }
.login h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: -.01em; }
.login p { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.login .btn { font-size: 13px; padding: 12px 22px; }

/* ---- toast -------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 50;
  font-family: var(--mono); font-size: 13px; letter-spacing: .02em;
  padding: 11px 18px; border: 1px solid var(--border); background: var(--bg-panel);
  color: var(--text); max-width: 90vw;
}
.toast.error { border-color: var(--red); color: #ffd7d6; }
.toast.success { border-color: var(--green); color: #cdeccf; }

/* ---- fixed telemetry status bar (console signature) --------- */
.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  height: 28px; padding: 0 18px;
  background: linear-gradient(0deg, #0A0E14, rgba(10,14,20,.72));
  border-top: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted);
}
.statusbar .sep { color: var(--border); }
.statusbar .accent { color: var(--accent); }
.statusbar .live { margin-left: auto; color: var(--green); display: flex; align-items: center; gap: 7px; }
.statusbar .live i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 8px var(--green), 0 0 2px var(--green);
}

/* ---- responsive --------------------------------------------- */
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px 16px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .whoami { order: 2; }
  .view { padding: 22px 16px 64px; }
}

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

/* ---- roster (nested inside an order row) -------------------- */
.subcard table th { font-size: 10px; }
.subcard table td { padding: 6px 8px; }
