/* Primary: light · Secondary: dark (html[data-theme="dark"]) */
:root {
  color-scheme: light;
  --bg0: #f3f6fb;
  --bg1: #e7eef7;
  --fg: #0b1220;
  --muted: #5b6b80;
  --line: rgba(15, 23, 42, 0.12);
  --accent: #0f766e;
  --accent2: #0369a1;
  --warn: #d97706;
  --danger: #dc2626;
  --ok: #15803d;
  --card: rgba(255, 255, 255, 0.88);
  --glow: rgba(15, 118, 110, 0.22);
  --sky-a: rgba(14, 165, 233, 0.14);
  --sky-b: rgba(45, 212, 191, 0.1);
  --sky-c: rgba(99, 102, 241, 0.08);
  --sky-base: linear-gradient(180deg, #f8fafc 0%, #eef3f9 48%, #e6eef7 100%);
  --horizon-fade: linear-gradient(
    180deg,
    transparent,
    rgba(226, 232, 240, 0.45) 35%,
    rgba(226, 232, 240, 0.92)
  );
  --horizon-glow: rgba(15, 118, 110, 0.08);
  --unit-from: #0f172a;
  --unit-to: #0369a1;
  --ring-inner: radial-gradient(circle at 50% 40%, #ffffff, #e8eef6 75%);
  --star-opacity: 0.22;
  --btn-primary-fg: #f8fafc;
  --btn-ghost-hover-bg: rgba(15, 23, 42, 0.04);
  --btn-ghost-hover-border: rgba(15, 23, 42, 0.2);
  --summary-fg: rgba(11, 18, 32, 0.9);
  --admin-card-bg: rgba(255, 255, 255, 0.95);
  --font: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --display: "Orbitron", var(--font);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg0: #03050a;
  --bg1: #0a101c;
  --fg: #f4f7fb;
  --muted: #8b97a8;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #5eead4;
  --accent2: #38bdf8;
  --warn: #fbbf24;
  --danger: #f87171;
  --ok: #4ade80;
  --card: rgba(12, 18, 30, 0.72);
  --glow: rgba(94, 234, 212, 0.35);
  --sky-a: rgba(56, 189, 248, 0.16);
  --sky-b: rgba(94, 234, 212, 0.08);
  --sky-c: rgba(99, 102, 241, 0.1);
  --sky-base: linear-gradient(180deg, #02040a 0%, #070d18 45%, #05080f 100%);
  --horizon-fade: linear-gradient(
    180deg,
    transparent,
    rgba(8, 14, 28, 0.4) 30%,
    rgba(4, 8, 16, 0.95)
  );
  --horizon-glow: rgba(94, 234, 212, 0.05);
  --unit-from: #ffffff;
  --unit-to: #9fd9ff;
  --ring-inner: radial-gradient(circle at 50% 40%, #101826, #05070d 70%);
  --star-opacity: 0.55;
  --btn-primary-fg: #041018;
  --btn-ghost-hover-bg: rgba(255, 255, 255, 0.04);
  --btn-ghost-hover-border: rgba(255, 255, 255, 0.25);
  --summary-fg: rgba(244, 247, 251, 0.88);
  --admin-card-bg: rgba(8, 12, 20, 0.85);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ---- Atmospheric background ---- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 700px at 50% -10%, var(--sky-a), transparent 55%),
    radial-gradient(900px 500px at 80% 100%, var(--sky-b), transparent 50%),
    radial-gradient(700px 400px at 10% 80%, var(--sky-c), transparent 45%),
    var(--sky-base);
  pointer-events: none;
}

.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, currentColor, transparent),
    radial-gradient(1px 1px at 30% 70%, currentColor, transparent),
    radial-gradient(1.5px 1.5px at 70% 30%, currentColor, transparent),
    radial-gradient(1px 1px at 85% 60%, currentColor, transparent),
    radial-gradient(1px 1px at 50% 50%, currentColor, transparent),
    radial-gradient(1px 1px at 15% 85%, currentColor, transparent),
    radial-gradient(1.2px 1.2px at 92% 12%, currentColor, transparent);
  color: var(--fg);
  opacity: var(--star-opacity);
  animation: twinkle 8s ease-in-out infinite alternate;
}

html:not([data-theme="dark"]) .sky::after {
  /* Soft cloud dots instead of bright stars on light */
  opacity: 0.12;
}

@keyframes twinkle {
  from {
    opacity: calc(var(--star-opacity) * 0.65);
  }
  to {
    opacity: var(--star-opacity);
  }
}

.horizon {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28vh;
  z-index: 0;
  background: var(--horizon-fade);
  pointer-events: none;
}

.horizon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 12%;
  width: min(48vw, 420px);
  height: min(48vw, 420px);
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 40%,
    rgba(255, 255, 255, 0.35),
    var(--horizon-glow) 40%,
    transparent 68%
  );
  filter: blur(2px);
  opacity: 0.9;
}

/* ---- Shell ---- */
.shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(1rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: inherit;
  text-decoration: none;
  line-height: 0;
  max-width: min(480px, 70vw);
}
.brand:hover {
  text-decoration: none;
  opacity: 0.95;
}
/*
 * Always serve the full-res 1983px PNG (no low-res srcset).
 * Height ~56–72px → plenty of source pixels for 2x/3x screens.
 */
.brand-logo {
  display: block;
  height: clamp(3.5rem, 9vw, 4.5rem); /* ~56–72px */
  width: auto;
  max-width: min(460px, 70vw);
  object-fit: contain;
  object-position: left center;
  image-rendering: auto;
  -webkit-user-drag: none;
  user-select: none;
  transform: translateZ(0);
  backface-visibility: hidden;
}
/* Wordmark is light-on-transparent for dark UIs; darken for light theme */
html:not([data-theme="dark"]) .brand-logo {
  filter: brightness(0) opacity(0.88);
}
@media (min-width: 900px) {
  .brand {
    max-width: 520px;
  }
  .brand-logo {
    height: 4.5rem; /* 72px */
    max-width: 500px;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.theme-toggle:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}
.theme-toggle .icon-sun {
  display: none;
}
.theme-toggle .icon-moon {
  display: inline;
}
html[data-theme="dark"] .theme-toggle .icon-sun {
  display: inline;
}
html[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

.nav-links {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.82rem;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
}
.nav-links a:hover {
  color: var(--fg);
}
.nav-links a.nav-current {
  color: var(--fg);
  font-weight: 600;
}

.page-history .shell {
  justify-content: flex-start;
}

.history-page {
  flex: 1;
  width: 100%;
  padding: 0.5rem 0 1.5rem;
}

.history-standalone {
  margin-top: 0.5rem;
}

.history-standalone .history-head h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  letter-spacing: 0.06em;
}

.history-cta {
  margin-top: 1.75rem;
}

/* ---- Hero / mission ---- */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.25rem;
  padding: 1rem 0 2rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.kicker {
  font-size: 0.75rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.mission-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 6vw, 3.6rem);
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-wrap: balance;
  text-shadow: 0 0 40px rgba(56, 189, 248, 0.25);
}

.mission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  color: var(--muted);
  font-size: 0.95rem;
}
.mission-meta strong {
  color: var(--fg);
  font-weight: 500;
}

.phase-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.phase-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--glow);
}
.phase-pill.live .dot {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.8);
  animation: pulse 1.2s ease-in-out infinite;
}
.phase-pill.success .dot {
  background: var(--ok);
}
.phase-pill.scrub .dot,
.phase-pill.hold .dot {
  background: var(--warn);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

/* ---- Countdown ---- */
.countdown-wrap {
  width: 100%;
  margin-top: 0.5rem;
}

.t-minus {
  font-family: var(--display);
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.5rem, 2vw, 1rem);
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.unit {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(0.85rem, 2.5vw, 1.35rem) 0.5rem;
  backdrop-filter: blur(12px);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.unit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(94, 234, 212, 0.08),
    transparent 40%
  );
  pointer-events: none;
}

.unit .value {
  font-family: var(--display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.8rem, 8vw, 3.5rem);
  line-height: 1;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, var(--unit-from) 20%, var(--unit-to) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.unit .label {
  margin-top: 0.55rem;
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.ring {
  --p: 0;
  width: min(220px, 48vw);
  height: min(220px, 48vw);
  margin: 1.25rem auto 0;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent) calc(var(--p) * 1%),
    rgba(255, 255, 255, 0.08) 0
  );
  display: grid;
  place-items: center;
  box-shadow: 0 0 50px rgba(94, 234, 212, 0.15);
  transition: background 0.4s linear;
}
.ring-inner {
  width: 82%;
  height: 82%;
  border-radius: 50%;
  background: var(--ring-inner);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0.5rem;
}
.ring-inner .big {
  font-family: var(--display);
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  letter-spacing: 0.06em;
}
.ring-inner .sub {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.25rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Unscheduled / empty states */
.empty-card {
  max-width: 36rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  backdrop-filter: blur(12px);
}
.empty-card h2 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: 0.06em;
}
.empty-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.desc {
  max-width: 36rem;
  margin: 0.25rem auto 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

/* CTAs */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--btn-primary-fg);
  box-shadow: 0 8px 28px var(--glow);
}
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--fg);
}
.btn-ghost:hover {
  border-color: var(--btn-ghost-hover-border);
  background: var(--btn-ghost-hover-bg);
}

.stream-box {
  width: min(100%, 720px);
  margin: 0.75rem auto 0;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}
.stream-box iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.stream-box[hidden] {
  display: none !important;
}

/* ---- Launch history timeline ---- */
.history {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0.5rem 0 1rem;
}

.history-head {
  text-align: center;
  margin-bottom: 1.75rem;
}

.history-head .kicker {
  margin: 0 0 0.5rem;
}

.history-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  letter-spacing: 0.06em;
}

.history-lede {
  margin: 0.65rem auto 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 0;
}

.history-list::before {
  content: "";
  position: absolute;
  left: 0.85rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(
    180deg,
    rgba(94, 234, 212, 0.55),
    rgba(56, 189, 248, 0.15),
    transparent
  );
}

@media (min-width: 640px) {
  .history-list::before {
    left: 1.1rem;
  }
}

.h-card {
  position: relative;
  margin: 0 0 1rem 0;
  padding: 1.15rem 1.15rem 1.15rem 2.5rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
  text-align: left;
}

@media (min-width: 640px) {
  .h-card {
    padding-left: 3rem;
  }
}

.h-card::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 1.45rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--glow);
  border: 2px solid #05080f;
  z-index: 1;
}

@media (min-width: 640px) {
  .h-card::before {
    left: 0.8rem;
  }
}

.h-card.result-lost::before,
.h-card.result-anomaly::before {
  background: var(--danger);
  box-shadow: 0 0 14px rgba(248, 113, 113, 0.55);
}

.h-card.result-partial::before {
  background: var(--warn);
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.45);
}

.h-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-bottom: 0.35rem;
}

.h-date {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--accent2);
}

.h-result {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.h-result.success {
  color: var(--ok);
  border-color: rgba(74, 222, 128, 0.35);
}
.h-result.lost,
.h-result.anomaly {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
}
.h-result.partial {
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.35);
}

.h-name {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.h-meta {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.h-meta strong {
  color: var(--fg);
  font-weight: 500;
}

.h-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0 0 0.65rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.h-summary {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--summary-fg);
}

.h-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.history-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1rem;
}

.foot {
  margin-top: auto;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}
.foot .disclaimer {
  opacity: 0.7;
  letter-spacing: 0.02em;
}
.foot a {
  color: inherit;
}

.updated {
  font-family: var(--mono);
  font-size: 0.68rem;
  opacity: 0.55;
}

/* ---- Admin ---- */
body.admin {
  background: var(--bg0);
}
.admin-wrap {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1.15rem 3rem;
}
.admin-wrap h1 {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  margin: 0 0 0.35rem;
}
.admin-wrap .lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
html[data-theme="dark"] .card {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}
.field label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--fg);
  padding: 0.7rem 0.8rem;
  font: inherit;
  font-size: 0.95rem;
}
.field textarea {
  min-height: 90px;
  resize: vertical;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(94, 234, 212, 0.35);
  border-color: rgba(94, 234, 212, 0.5);
}
.field .hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 560px) {
  .row2 {
    grid-template-columns: 1fr;
  }
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.mode-toggle button {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0.85rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.mode-toggle button.active {
  border-color: rgba(94, 234, 212, 0.55);
  color: var(--fg);
  background: rgba(94, 234, 212, 0.1);
  box-shadow: 0 0 20px rgba(94, 234, 212, 0.12);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.status-msg {
  min-height: 1.25rem;
  font-size: 0.85rem;
  color: var(--accent);
  margin-top: 0.75rem;
}
.status-msg.err {
  color: var(--danger);
}

.login-box {
  max-width: 380px;
  margin: 15vh auto 0;
}

/* ── Admin: graphical history editor ── */
.admin-wrap {
  max-width: 820px;
}

.history-admin-card {
  margin-top: 1.25rem;
}

.history-admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.history-admin-title {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  margin: 0 0 0.25rem;
}

.history-admin-lead {
  margin: 0;
  max-width: 28rem;
}

.history-admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.history-editor {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-editor-empty {
  text-align: center;
  padding: 1.75rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
}

.history-editor-empty p {
  margin: 0 0 1rem;
}

.hist-edit-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--admin-card-bg);
  overflow: hidden;
}

.hist-edit-card.result-lost,
.hist-edit-card.result-anomaly {
  border-color: rgba(248, 113, 113, 0.28);
}

.hist-edit-card.result-success {
  border-color: rgba(74, 222, 128, 0.18);
}

.hist-edit-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--line);
}

.hist-edit-head-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.75rem;
  min-width: 0;
}

.hist-edit-badge {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.hist-edit-badge.success {
  color: var(--ok);
  border-color: rgba(74, 222, 128, 0.4);
}
.hist-edit-badge.lost,
.hist-edit-badge.anomaly {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.4);
}
.hist-edit-badge.partial {
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.4);
}

.hist-edit-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.hist-edit-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent2);
}

.hist-edit-actions {
  display: flex;
  gap: 0.35rem;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
}
.icon-btn:hover:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.08);
}
.icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.icon-btn.danger:hover:not(:disabled) {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
}

.hist-edit-body {
  padding: 1rem;
}

.hist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.85rem;
}

.hist-grid .field {
  margin-bottom: 0;
}

.hist-grid .field-full {
  grid-column: 1 / -1;
}

.hist-grid textarea {
  min-height: 72px;
}

.history-admin-foot {
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 560px) {
  .hist-grid {
    grid-template-columns: 1fr;
  }
}

/* Force hide: .btn { display:inline-flex } was overriding bare [hidden] */
[hidden],
.hidden {
  display: none !important;
}

@media (max-width: 480px) {
  .countdown {
    gap: 0.4rem;
  }
  .unit {
    border-radius: 12px;
    padding: 0.7rem 0.25rem;
  }
  .unit .label {
    letter-spacing: 0.12em;
    font-size: 0.58rem;
  }
}
