:root {
    color-scheme: dark;
    --bg: #020604;
    --panel: rgba(3, 17, 10, .92);
    --line: rgba(0, 255, 120, .28);
    --line-strong: rgba(0, 255, 120, .62);
    --text: #c8f7d8;
    --muted: #70a982;
    --green: #00ff78;
    --red: #ff5c68;
    font-family: "JetBrains Mono", "IBM Plex Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.admin-body { min-height: 100vh; background: radial-gradient(circle at 18% 10%, rgba(0,255,120,.065), transparent 26rem), #020604; }
.admin-matrix { position: fixed; inset: 0; pointer-events: none; opacity: .16; background-image: linear-gradient(rgba(0,255,120,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(0,255,120,.018) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(to bottom, #000, transparent 88%); }
.admin-panel { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(4,22,13,.94), rgba(2,12,7,.94)); box-shadow: 0 0 26px rgba(0,255,120,.08); }
.admin-kicker { color: var(--green); font-size: .72rem; letter-spacing: .16em; }
h1, h2 { margin: 0; font-weight: 700; }
h1 { font-size: clamp(1.45rem, 2.5vw, 2.35rem); letter-spacing: -.035em; }
h2 { margin-top: 1.35rem; margin-bottom: .75rem; color: var(--green); font-size: .88rem; letter-spacing: .08em; text-transform: uppercase; }
p { color: var(--muted); line-height: 1.65; }
code { color: var(--green); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.auth-panel { width: min(680px, 100%); padding: clamp(28px, 5vw, 58px); position: relative; overflow: hidden; }
.auth-panel::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--green), transparent); }
.auth-panel h1 { margin-top: 8px; }
.auth-form { display: grid; gap: 18px; margin-top: 28px; }
.admin-link { display: inline-block; margin-top: 24px; color: var(--muted); text-decoration: none; font-size: .78rem; }
.admin-link:hover { color: var(--green); }
label { display: grid; gap: 7px; color: var(--muted); font-size: .72rem; letter-spacing: .08em; }
input, select, textarea { width: 100%; border: 1px solid rgba(0,255,120,.22); background: rgba(0,0,0,.34); color: var(--text); padding: 11px 12px; outline: none; border-radius: 2px; }
input:focus, select:focus, textarea:focus { border-color: var(--line-strong); box-shadow: 0 0 0 2px rgba(0,255,120,.08); }
textarea { resize: vertical; line-height: 1.5; }
.admin-btn { border: 1px solid var(--line); background: rgba(0,255,120,.035); color: var(--text); padding: 10px 14px; cursor: pointer; letter-spacing: .06em; font-size: .72rem; text-decoration: none; }
.admin-btn:hover { border-color: var(--line-strong); background: rgba(0,255,120,.08); }
.admin-btn--primary { color: #001b0c; background: var(--green); border-color: var(--green); font-weight: 800; }
.admin-btn--primary:hover { background: #7cffb2; }
.admin-message { margin: 20px 0; padding: 12px 14px; border: 1px solid; font-size: .76rem; }
.admin-message--ok { color: var(--green); border-color: rgba(0,255,120,.35); background: rgba(0,255,120,.05); }
.admin-message--error { color: var(--red); border-color: rgba(255,92,104,.42); background: rgba(255,92,104,.05); }
.admin-topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: rgba(2,8,5,.94); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.admin-topbar > div { display: grid; gap: 3px; }
.admin-topbar strong { font-size: .95rem; letter-spacing: .08em; }
.admin-topbar nav { display: flex; align-items: center; gap: 8px; }
.admin-topbar form { margin: 0; }
.admin-layout { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 228px minmax(0,1fr); gap: 18px; padding: 18px; position: relative; z-index: 1; }
.admin-sidebar { align-self: start; position: sticky; top: 86px; display: grid; padding: 12px; gap: 7px; }
.admin-sidebar__status { display: flex; justify-content: space-between; gap: 8px; padding: 12px 9px 18px; border-bottom: 1px solid var(--line); font-size: .68rem; color: var(--muted); }
.admin-sidebar__status strong { color: var(--green); }
.admin-nav { text-align: left; border: 1px solid transparent; background: transparent; padding: 13px 10px; cursor: pointer; color: var(--muted); font-size: .76rem; letter-spacing: .05em; }
.admin-nav:hover, .admin-nav.is-active { color: var(--green); border-color: var(--line); background: rgba(0,255,120,.045); }
.admin-sidebar__footer { margin-top: 18px; padding: 12px 8px; border-top: 1px solid var(--line); color: #477659; font-size: .65rem; line-height: 1.6; }
.admin-workspace { min-width: 0; }
.admin-view { display: none; }
.admin-view.is-active { display: block; }
.admin-view__head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 6px 0 18px; }
.admin-view__head h1 { margin-top: 4px; }
.admin-actions { display: flex; gap: 8px; }
.admin-toast { opacity: 0; transform: translateY(-5px); transition: .18s ease; position: fixed; right: 22px; top: 84px; z-index: 50; max-width: 520px; padding: 12px 14px; pointer-events: none; border: 1px solid var(--line); background: #06140c; font-size: .72rem; }
.admin-toast.is-visible { opacity: 1; transform: none; }
.admin-toast.is-error { color: var(--red); border-color: rgba(255,92,104,.55); }
.admin-toast.is-ok { color: var(--green); }
.mission-editor-layout, .two-column { display: grid; grid-template-columns: minmax(220px, 285px) minmax(0, 1fr); gap: 16px; align-items: start; }
.mission-browser, .two-column > aside { padding: 10px; max-height: calc(100vh - 150px); overflow: auto; position: sticky; top: 86px; }
.admin-list { display: grid; gap: 7px; }
.admin-list button { width: 100%; text-align: left; border: 1px solid rgba(0,255,120,.14); background: rgba(0,0,0,.22); color: var(--muted); padding: 11px; cursor: pointer; display: grid; gap: 4px; }
.admin-list button strong { color: var(--text); }
.admin-list button small { color: #4e805d; }
.admin-list button:hover, .admin-list button.is-active { border-color: var(--line-strong); background: rgba(0,255,120,.05); }
.admin-list button.is-active strong { color: var(--green); }
.mission-editor, .editor-card { padding: clamp(16px, 2.5vw, 28px); }
.editor-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 22px; }
.editor-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 10px 12px; cursor: pointer; font-size: .72rem; }
.editor-tab.is-active { color: var(--green); border-color: var(--green); }
.editor-pane { display: none; }
.editor-pane.is-active { display: block; }
.field-grid { display: grid; gap: 12px; }
.field-grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.field-grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.field-grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.check-field { display: flex; flex-direction: row; align-items: center; gap: 9px; min-height: 54px; padding: 12px; border: 1px solid rgba(0,255,120,.18); }
.check-field input { width: auto; accent-color: var(--green); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.check-grid label { display: flex; flex-direction: row; align-items: center; gap: 8px; border: 1px solid rgba(0,255,120,.14); padding: 10px; }
.check-grid input { width: auto; accent-color: var(--green); }
.editor-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.editor-footer > span:first-child { margin-right: auto; color: var(--muted); font-size: .72rem; }
.json-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.json-toolbar span { margin-left: auto; color: var(--muted); font-size: .7rem; }
.json-editor { min-height: 62vh; white-space: pre; tab-size: 2; font-size: .78rem; color: #9dffbe; }
.json-editor--campaign { min-height: 68vh; }
.word-editor { min-height: 58vh; white-space: pre; }
.admin-hint { font-size: .72rem; }
.difficulty-admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.difficulty-card { padding: 20px; }
.difficulty-card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.difficulty-card__head strong { color: var(--green); }
.difficulty-card .field-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.system-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.metric { padding: 18px; display: grid; gap: 7px; }
.metric span { color: var(--muted); font-size: .68rem; }
.metric strong { color: var(--green); font-size: 1rem; }
@media (max-width: 1100px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; display: flex; overflow-x: auto; }
    .admin-sidebar__status, .admin-sidebar__footer { display: none; }
    .admin-nav { white-space: nowrap; }
    .mission-browser, .two-column > aside { position: static; max-height: 300px; }
    .field-grid--4, .difficulty-card .field-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .system-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
    .admin-topbar { align-items: flex-start; flex-direction: column; }
    .admin-topbar nav { width: 100%; flex-wrap: wrap; }
    .admin-layout { padding: 10px; }
    .mission-editor-layout, .two-column { grid-template-columns: 1fr; }
    .field-grid--2, .field-grid--3, .field-grid--4, .difficulty-card .field-grid, .difficulty-admin-grid, .system-grid { grid-template-columns: 1fr; }
    .admin-view__head { align-items: flex-start; flex-direction: column; }
    .admin-actions { width: 100%; }
    .json-editor { min-height: 55vh; }
}
.special-admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.special-admin-card { border: 1px solid rgba(0,255,120,.16); background: rgba(0,0,0,.18); padding: 10px; }
.special-admin-card .check-field { min-height: auto; margin-bottom: 8px; padding: 8px 10px; }
@media (max-width: 760px) { .special-admin-grid { grid-template-columns: 1fr; } }

/* ===== 0.5.0 control-plane additions ===== */
.admin-btn--danger {
    border-color: rgba(255, 77, 94, .55);
    color: #ff8792;
}
.admin-btn--danger:hover,
.admin-btn--danger:focus-visible {
    border-color: #ff4d5e;
    background: rgba(255, 77, 94, .08);
}
.admin-hint--boss {
    margin: 20px 0;
    padding: 12px 14px;
    border-left: 2px solid rgba(255, 107, 214, .7);
    background: rgba(255, 107, 214, .04);
}
.audit-log {
    display: grid;
    gap: 6px;
    margin-top: 14px;
    max-height: 360px;
    overflow: auto;
}
.audit-log__row {
    display: grid;
    grid-template-columns: 190px 170px 1fr;
    gap: 12px;
    padding: 9px 10px;
    border: 1px solid rgba(0, 255, 120, .1);
    font-size: 12px;
}
.audit-log__row time { color: rgba(124, 255, 178, .55); }
.audit-log__row strong { color: #7cffb2; }
.audit-log__row span { color: rgba(234, 255, 242, .82); overflow-wrap: anywhere; }
.audit-log__empty { padding: 16px; color: rgba(124, 255, 178, .55); border: 1px dashed rgba(0, 255, 120, .14); }
@media (max-width: 820px) { .audit-log__row { grid-template-columns: 1fr; } }

/* ===== 0.9.0 live-service & multi-campaign control ===== */
.campaign-switch {
    margin: 0 0 12px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
}
.campaign-switch select { margin-top: 2px; }
.live-service-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}
.live-service-grid__wide { grid-column: 1 / -1; }
.live-editor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.live-editor-head h2 { margin: 4px 0 0; }
.live-json-editor { min-height: 520px; }
.live-json-editor--short { min-height: 360px; }
#campaign-editor-select { min-width: min(360px, 42vw); width: auto; }
@media (max-width: 980px) {
    .live-service-grid { grid-template-columns: 1fr; }
    .live-service-grid__wide { grid-column: auto; }
    #campaign-editor-select { width: 100%; min-width: 0; }
}
@media (max-width: 620px) {
    .live-editor-head { flex-direction: column; }
    .live-editor-head .admin-btn { width: 100%; }
    .live-json-editor { min-height: 420px; }
}

/* ===== 0.10.0 deployment readiness ===== */
.deployment-summary {
    border: 1px solid rgba(122, 255, 174, .16);
    padding: 7px 10px;
    font-size: .68rem;
    letter-spacing: .06em;
    color: rgba(221,255,231,.7);
}
.deployment-summary.is-pass { border-color: rgba(0,255,120,.36); color: #8dffb7; }
.deployment-summary.is-fail { border-color: rgba(255,59,59,.42); color: #ff8e8e; }
.deployment-checks { display: grid; gap: 7px; margin-top: 12px; }
.deployment-check {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 12px;
    align-items: start;
    border: 1px solid rgba(122,255,174,.1);
    padding: 10px 12px;
    background: rgba(0,0,0,.18);
}
.deployment-check > span { font-size: .64rem; letter-spacing: .08em; }
.deployment-check > div { display: grid; gap: 3px; }
.deployment-check strong { color: rgba(229,255,237,.88); font-size: .75rem; }
.deployment-check small { color: rgba(193,238,207,.55); font-size: .68rem; line-height: 1.45; }
.deployment-check.is-pass > span { color: #00ff78; }
.deployment-check.is-warn > span { color: #ffd000; }
.deployment-check.is-fail > span { color: #ff6363; }
.metric strong.is-pass { color: #00ff78; }
.metric strong.is-fail { color: #ff6363; }
