/* OrbitWatch: dense, quiet mission-control styling. Colours are tokens so both themes stay in step. */
:root {
  --bg: #070b14; --bg-2: #0b1120; --card: #0f1728; --card-2: #141e33; --line: #1f2b45; --text: #dbe4f3; --muted: #8b9ab8;
  --accent: #47b8e0; --accent-ink: #04131b; --link: #7cd0ef; --ok: #45c48b; --warn: #e2a948; --bad: #e46a6a; --crit: #ef7d57;
  --map-sea: #0a1222; --map-land: #23324f; --map-grid: #172239;
  --radius: 8px; --gap: 14px; --sidebar: 232px; --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f6fa; --bg-2: #e9eef5; --card: #ffffff; --card-2: #f2f5fa; --line: #d6deea; --text: #13203a; --muted: #55657f;
  --accent: #0b6f96; --accent-ink: #ffffff; --link: #0a6388; --ok: #17744a; --warn: #8f5b00; --bad: #b3261e; --crit: #b2431d;
  --map-sea: #dbe8f3; --map-land: #a9bcd0; --map-grid: #c8d8e8;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; }
[hidden] { display: none !important; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 6px; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 13px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
h3 { font-size: 15px; font-weight: 600; }
h2 a { color: var(--text); }
p { margin: 0 0 8px; }
small, .sub { color: var(--muted); font-size: 12.5px; }
img { max-width: 100%; display: block; }
code, pre { font-family: var(--mono); font-size: 12px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg-2); padding: 10px; border-radius: 6px; }
.break { overflow-wrap: anywhere; display: block; margin-bottom: 10px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 50; background: var(--card); padding: 8px 12px; border-radius: 6px; }

/* Controls */
.btn, button { font: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--card-2); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; border-color: var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 28px; padding: 2px 9px; font-size: 12.5px; }
.btn.icon { min-width: 36px; padding: 4px 8px; }
.btn.quiet { background: none; border-color: transparent; }
.btn.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--link); }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; min-height: 34px; max-width: 100%; }
input[type="checkbox"] { min-height: 0; width: 16px; height: 16px; accent-color: var(--accent); vertical-align: -3px; padding: 0; }
textarea { width: 100%; resize: vertical; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-weight: 550; }
.form label small { font-weight: 400; }
.form label.check, label.check { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; font-weight: 400; }
.form fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 0; min-width: 0; }
.checkrow { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.actions.center { justify-content: center; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.filters input[type="search"] { flex: 1 1 180px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--bg-2); border: 1px solid var(--line); padding: 3px; border-radius: 8px; }
.tabs .btn { background: none; border-color: transparent; min-height: 28px; padding: 2px 10px; }
.tabs .btn.on { background: var(--card-2); border-color: var(--line); color: var(--accent); font-weight: 600; }

/* Shell */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100dvh; }
.shell.collapsed { --sidebar: 60px; }
.shell.collapsed .sidebar .label { display: none; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; background: var(--bg-2); border-right: 1px solid var(--line); padding: 10px 8px; overflow-y: auto; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px; color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: .02em; }
.sidebar nav { display: grid; gap: 1px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--muted); white-space: nowrap; }
.sidebar nav a:hover { background: var(--card); color: var(--text); text-decoration: none; }
.sidebar nav a[aria-current] { background: var(--card-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.ico { width: 18px; text-align: center; flex: none; font-style: normal; }
.count { margin-left: auto; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; text-align: center; }
.count.live { background: var(--bad); color: #fff; }
.side-foot { margin-top: auto; padding-top: 10px; }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 420px; }
.search input { width: 100%; }
.sync { color: var(--warn); font-size: 12.5px; }
.clocks { display: flex; gap: 16px; margin-left: auto; }
.clocks span { display: grid; line-height: 1.15; text-align: right; }
.clocks small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; }
.clock { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 14px; }
.bell { position: relative; }
.bell .count { position: absolute; top: -6px; right: -6px; }
.banner { padding: 6px 16px; background: color-mix(in srgb, var(--warn) 18%, var(--bg)); border-bottom: 1px solid var(--warn); }
main#main { flex: 1; padding: 16px; outline: none; }
.view { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.tabbar, .scrim { display: none; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 0; color: var(--muted); }
.page-head .actions { margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.more { font-size: 12.5px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: var(--gap); align-items: start; }
.cols.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--gap); }
.empty { color: var(--muted); padding: 10px 0; margin: 0; }
.note { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.alert { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); }
.alert.ok { border-color: var(--ok); }
.alert.warn { border-color: var(--warn); }
.alert.bad { border-color: var(--bad); }
.card.error { border-color: var(--bad); }
.loading, .boot { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 48px 16px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--card-2); border: 1px solid var(--ok); border-radius: 6px; padding: 10px 14px; box-shadow: 0 8px 24px #0006; }
.toast.bad { border-color: var(--bad); }

/* Badges */
.badges { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.badge, .chip { display: inline-block; padding: 1px 7px; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 55%, transparent); color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 12%, transparent); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.chip { --c: var(--link); font-weight: 500; white-space: normal; }
.st-confirmed, .st-go, .st-success, .ok { --c: var(--ok); }
.st-inflight { --c: var(--accent); }
.st-tentative, .st-delayed, .st-hold, .st-partial, .warn { --c: var(--warn); }
.st-scrubbed, .st-failure, .bad { --c: var(--bad); }
.st-tbd, .muted { --c: var(--muted); }
.badge.imp-4 { --c: var(--crit); }
.badge.imp-3 { --c: var(--warn); }
.badge.imp-2 { --c: var(--accent); }
.badge.imp-1 { --c: var(--muted); }
.badge.live { --c: var(--bad); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.cls-official { --c: var(--ok); }
.cls-speculation { --c: var(--warn); }
.sub-operational, .sub-active { --c: var(--ok); }
.sub-commissioning, .sub-development { --c: var(--accent); }
.sub-paused { --c: var(--warn); }
.badge.ms.completed { --c: var(--ok); }
.badge.ms.current { --c: var(--accent); }
.badge.bad { --c: var(--bad); }
.badge.ok { --c: var(--ok); }
.badge.warn { --c: var(--warn); }
.star { color: var(--warn); }
.eyebrow { margin: 0 0 4px; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .09em; color: var(--accent); }

/* Lists */
.list { display: grid; grid-template-columns: minmax(0, 1fr); }
.list > * + * { border-top: 1px solid var(--line); }
.list.card { padding-block: 4px; }
.event { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0 10px 10px; border-left: 3px solid transparent; }
.event.imp-4 { border-left-color: var(--crit); }
.event.imp-3 { border-left-color: var(--warn); }
.event.imp-2 { border-left-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.event-main { flex: 1; min-width: 0; }
.event-main h3 { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.event-main h3 a { color: var(--text); }
.event-main p { margin: 0; }
.event-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; max-width: 45%; }
.event-side .badges { justify-content: flex-end; }
.when time { font-size: 13px; }
.when small { display: block; }
.thumb { flex: none; width: 56px; height: 56px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:empty { display: none; }
.news { display: flex; gap: 12px; padding: 10px 0; }
.news > div:last-child { flex: 1; min-width: 0; }
.news h3 { font-size: 14px; margin: 0 0 2px; overflow-wrap: anywhere; }
.news h3 a { color: var(--text); }
.news p { margin: 0 0 4px; }
.news .thumb { width: 84px; height: 62px; }
.summary { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); }
details summary { cursor: pointer; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 5px 0; overflow-wrap: anywhere; }
ul.plain li + li { border-top: 1px solid var(--line); }
.change, .notice { padding: 10px 0; }
.change p { margin: 0 0 2px; }
.change h3, .notice h3 { margin: 0 0 3px; font-size: 14px; }
.change s { color: var(--muted); }
.notice { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.notice > div:first-child { flex: 1 1 260px; min-width: 0; }
.notice.unread { box-shadow: inset 3px 0 0 var(--accent); padding-left: 10px; }
.away-item { padding: 6px 0; }
.away-item .actions { margin: 0 0 6px; }
.live-item { padding-bottom: 12px; }
.wx { padding: 8px 0; }
.facts { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 5px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts ul.plain li { padding: 1px 0; border: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 8px; margin: 8px 0; }
.stats.card { margin: 0; }
.stat { display: grid; line-height: 1.3; }
.stat b { font-family: var(--mono); font-size: 18px; font-variant-numeric: tabular-nums; font-weight: 600; }
.people { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.people li { display: flex; gap: 10px; align-items: center; }
.people img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.people small { display: block; }

/* Countdowns */
.countdown { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--accent); white-space: nowrap; }
.countdown[data-phase="imminent"] { color: var(--warn); }
.countdown[data-phase="inflight"] { color: var(--ok); }
.countdown[data-phase="passed"] { color: var(--muted); font-family: inherit; white-space: normal; text-align: right; }
.countdown.lg { display: block; font-size: 24px; font-weight: 600; }
.countdown.xl { display: block; font-size: clamp(26px, 5vw, 44px); font-weight: 650; margin: 6px 0; }
.countdown.lg[data-phase="passed"], .countdown.xl[data-phase="passed"] { font-size: 16px; text-align: left; }
.countdown-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 10px; }
.countdown-card { display: grid; gap: 2px; padding: 10px 12px; background: var(--card-2); border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.countdown-card:hover { border-color: var(--accent); text-decoration: none; }
.countdown-card span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.countdown-card.imp-4 { border-left: 3px solid var(--crit); }
.countdown-card.imp-3 { border-left: 3px solid var(--warn); }

/* Hero and features */
.hero { display: flex; flex-wrap: wrap; padding: 0; overflow: hidden; }
.hero.imp-4 { border-color: color-mix(in srgb, var(--crit) 60%, var(--line)); }
.hero.imp-3 { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.hero-media { flex: 1 1 260px; max-width: 420px; position: relative; background: var(--bg-2); min-height: 190px; }
.hero-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-media small { position: absolute; left: 0; bottom: 0; right: 0; padding: 3px 8px; background: #000a; color: #cdd; }
.hero-body { flex: 3 1 320px; padding: 16px 18px; min-width: 0; }
.hero-body h1 { font-size: clamp(20px, 3vw, 28px); }
.hero-body h1 a { color: var(--text); }
.big { font-size: 17px; margin-top: 8px; }
.feature-img { width: 100%; height: 150px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }
.patch { max-width: 120px; margin: 8px 0; }
.video { position: relative; aspect-ratio: 16 / 9; width: 100%; max-width: 960px; background: #000; border-radius: var(--radius); overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Dashboard grid */
.widgets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); align-items: start; grid-auto-flow: row dense; }
.widget { display: flex; flex-direction: column; }
.widget.w1 { grid-column: span 1; } .widget.w2 { grid-column: span 2; } .widget.w3 { grid-column: span 3; } .widget.w4 { grid-column: span 4; }
.widget .widget-body { overflow: auto; overscroll-behavior: auto; }
.widget.h1 .widget-body { max-height: 220px; } .widget.h2 .widget-body { max-height: 400px; } .widget.h3 .widget-body { max-height: 720px; }
.widgets.editing .widget { outline: 1px dashed var(--accent); cursor: grab; }
.widget-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.hidden-widgets:empty { display: none; }

/* Calendar */
.cal-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cal-nav h2 { flex: 1; text-align: center; margin: 0; color: var(--text); }
.month-wrap { overflow-x: auto; }
.month { display: grid; grid-template-columns: repeat(7, minmax(92px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-width: 660px; }
.month .dow { background: var(--bg-2); padding: 4px 8px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; }
.cell { background: var(--card); min-height: 104px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cell.other { background: var(--bg-2); }
.cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.daynum { align-self: flex-end; font-size: 12px; color: var(--muted); padding: 0 4px; }
.cal-event { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--line); border-radius: 3px; background: var(--card-2); color: var(--text); padding: 2px 5px; font-size: 11.5px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal-event.imp-4 { border-left-color: var(--crit); } .cal-event.imp-3 { border-left-color: var(--warn); } .cal-event.imp-2 { border-left-color: var(--accent); }
.cal-event.watched { font-weight: 650; }
.cal-event time { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.morecount { font-size: 11px; }
.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; align-items: start; }
.week .card { padding: 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.week .card.today { border-color: var(--accent); }
.week .cal-event { white-space: normal; }
.year-line { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.year-line > li { position: relative; padding: 0 0 14px 18px; }
.year-line > li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.year-line ul { list-style: none; margin: 0; padding: 0; }
.year-line ul li { padding: 4px 8px; border-left: 3px solid var(--line); margin-bottom: 4px; background: var(--card); }
.year-line ul li.imp-4 { border-left-color: var(--crit); } .year-line ul li.imp-3 { border-left-color: var(--warn); }
.year-line .countdown { margin-left: 8px; }
.mini-cal { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; align-content: start; }
.mini-grid .dow { text-align: center; font-size: 11px; color: var(--muted); }
.mini-grid .day { min-height: 34px; padding: 2px; flex-direction: column; gap: 1px; font-size: 12px; background: none; border-color: transparent; }
.mini-grid .day.today { border-color: var(--accent); }
.mini-grid .day.past { color: var(--muted); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.dot.imp-4 { background: var(--crit); } .dot.imp-3 { background: var(--warn); } .dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }

/* Subjects and timeline */
.subject { display: flex; flex-direction: column; gap: 6px; }
.subject h2 { font-size: 16px; text-transform: none; letter-spacing: 0; margin: 0; }
.subject .follow { margin-top: auto; align-self: flex-start; }
.subject-img { width: calc(100% + 28px); max-width: none; height: 130px; object-fit: cover; margin: -14px -14px 6px; border-radius: var(--radius) var(--radius) 0 0; }
.progress-head { margin-bottom: 12px; }
progress { width: 100%; height: 8px; accent-color: var(--ok); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 24px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 5px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--muted); background: var(--card); z-index: 1; }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 14px; bottom: -5px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.ms-completed::before { background: var(--ok); border-color: var(--ok); }
.timeline li.ms-current::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.timeline p { margin: 0; }
.ms-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* APOD, maps, charts, sky */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: var(--gap); }
.apod-card { display: grid; gap: 5px; color: var(--text); align-content: start; }
.apod-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; }
.apod-full { max-width: 1100px; width: 100%; margin-inline: auto; }
.apod-full h2 { font-size: 19px; text-transform: none; letter-spacing: 0; color: var(--text); }
.apod-media { display: grid; place-items: center; background: #000; border-radius: 6px; overflow: hidden; margin-bottom: 8px; }
.apod-media img { max-height: 72vh; width: auto; cursor: zoom-in; }
.apod-media:fullscreen img { max-height: 100vh; max-width: 100vw; cursor: zoom-out; }
.apod-video { width: 100%; max-height: 72vh; }
.credit { color: var(--muted); font-size: 12.5px; }
.worldmap { width: 100%; }
.worldmap canvas { display: block; width: 100%; aspect-ratio: 2 / 1; border-radius: 6px; }
.chart { position: relative; height: 240px; }
.moonbox { display: flex; gap: 16px; align-items: center; }
.moon { width: 88px; height: 88px; flex: none; }
.moon-dark { fill: #1b2338; stroke: var(--line); }
.moon-lit { fill: #e6e9d8; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
tbody th { font-weight: 550; }
tr.dim { color: var(--muted); }
tr.attention th { color: var(--warn); }
td.wrap { min-width: 220px; overflow-wrap: anywhere; }
.row-actions { white-space: nowrap; }
.row-actions .btn { margin-right: 4px; }
.triggers td, .triggers thead th:not(:first-child) { text-align: center; }
.briefing h3 { margin-top: 16px; }
.briefing h2 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 18px; }
.briefing li { margin-bottom: 3px; }

/* Dialog */
.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); }
.modal.wide { width: min(760px, calc(100vw - 24px)); }
.modal::backdrop { background: #000a; }
.modal > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal > header h2 { margin: 0; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 15px; }
.modal-body { padding: 14px; }

/* Sign in and installer */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(360px, 100%); display: grid; gap: 8px; text-align: center; padding: 28px 24px; }
.login img { margin-inline: auto; }
.login form { text-align: left; }
.login .actions { display: grid; }
.install { max-width: 640px; margin: 0 auto; padding: 24px 16px; display: grid; gap: var(--gap); }
.install form label { display: grid; gap: 4px; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { padding: 4px 0; }
.checks li b { display: inline-block; min-width: 64px; }
.checks li.ok b { color: var(--ok); } .checks li.bad b { color: var(--bad); } .checks li.warn b { color: var(--warn); }

/* Mission control */
.shell.fullscreen { grid-template-columns: minmax(0, 1fr); }
.shell.fullscreen > .sidebar, .shell.fullscreen .topbar, .shell.fullscreen > .tabbar { display: none; }
.shell.fullscreen main#main { padding: 0; }
.view.mc { height: 100dvh; padding: 12px 16px; gap: 10px; overflow: hidden; }
.mc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.mc-head h1 { font-size: 16px; letter-spacing: .12em; text-transform: uppercase; margin: 0; }
.mc-head .actions { margin: 0; }
.mc-clocks { display: flex; gap: 28px; }
.mc-clocks span { display: grid; text-align: center; }
.mc-clocks .clock { font-size: clamp(20px, 2.6vw, 34px); }
.mc-live { display: flex; flex-wrap: wrap; gap: 14px; }
.mc-major { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 12px; }
.mc-event { display: grid; gap: 2px; padding: 12px 18px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); color: var(--text); min-width: 0; }
.mc-event:hover { text-decoration: none; border-color: var(--accent); }
.mc-event.imp-4 { border-left-color: var(--crit); } .mc-event.imp-3 { border-left-color: var(--warn); }
.mc-event strong { font-size: clamp(16px, 1.8vw, 24px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.countdown.xxl { font-size: clamp(30px, 4.4vw, 68px); font-weight: 650; line-height: 1.15; }
.countdown.xxl[data-phase="passed"] { font-size: 20px; text-align: left; }
.mc-date { font-size: 24px; }
.mc-panels { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--mc-cols, 2), minmax(0, 1fr)); gap: 12px; }
.mc-panel { display: flex; flex-direction: column; min-height: 0; }
.mc-panel .widget-body { flex: 1; overflow: auto; }
.mc-ticker { overflow: hidden; border-block: 1px solid var(--line); padding: 5px 0; white-space: nowrap; flex: none; }
.mc-ticker-track { display: inline-flex; gap: 48px; padding-left: 24px; animation: ticker 120s linear infinite; }
.mc-ticker:hover .mc-ticker-track { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }
.mc-sync { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }

/* Responsive */
@media (max-width: 1250px) {
  .widgets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .widget.w3, .widget.w4 { grid-column: span 2; }
  .topbar .mc { display: none; }
}
@media (max-width: 1050px) { .clocks { display: none; } .topbar .bell { margin-left: auto; } }
@media (max-width: 899px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); --sidebar: 260px; }
  .shell.collapsed .sidebar .label { display: revert; }
  .sidebar { position: fixed; left: 0; width: min(280px, 84vw); transform: translateX(-102%); transition: transform .2s; visibility: hidden; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .shell.drawer .sidebar { transform: none; visibility: visible; }
  .shell.drawer .scrim { display: block; position: fixed; inset: 0; background: #0009; z-index: 25; }
  .topbar { padding-inline: 10px; }
  .topbar .mc { display: inline-flex; font-size: 12px; padding-inline: 8px; }
  .topbar .bell { display: none; }
  .topbar .sync { display: none; }
  .search { max-width: none; }
  main#main { padding: 12px 10px calc(78px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 35; background: var(--bg-2); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a, .tabbar .btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 56px; border: 0; border-radius: 0; color: var(--muted); font-size: 11px; position: relative; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current] { color: var(--accent); }
  .tabbar .ico { font-size: 18px; }
  .tabbar .count { position: absolute; top: 6px; left: 56%; }
  .shell.fullscreen main#main { padding: 0; }
  .view.mc { height: auto; min-height: 100dvh; overflow: visible; }
  .btn, input, select { min-height: 40px; }
  .btn.small { min-height: 34px; }
  input, select, textarea { font-size: 16px; }
  #toasts { bottom: calc(68px + env(safe-area-inset-bottom)); }
}
@media (max-width: 699px) {
  .widgets { grid-template-columns: minmax(0, 1fr); }
  .widget.w1, .widget.w2, .widget.w3, .widget.w4 { grid-column: span 1; }
  .event { flex-wrap: wrap; gap: 6px 10px; }
  .event .thumb { width: 44px; height: 44px; }
  .event-side { max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .countdown[data-phase="passed"] { text-align: left; }
  .news .thumb { width: 60px; height: 48px; }
  .hero-media { max-width: none; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .facts dd { margin-bottom: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .mc-ticker { overflow-x: auto; }
}
@media print {
  .sidebar, .topbar, .tabbar, .actions, .tabs, #toasts { display: none !important; }
  .shell { display: block; }
  body, .card { background: #fff; color: #000; }
}
