:root {
    --bg: #0b100f;
    --panel: #121a18;
    --panel-2: #182320;
    --line: #2b3935;
    --text: #e8eee9;
    --muted: #91a098;
    --accent: #a7c17a;
    --accent-2: #d8e7b2;
    --danger: #d56d64;
    --warning: #d4aa5a;
    --success: #6fb38c;
    --shadow: 0 18px 50px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
        radial-gradient(circle at top right, rgba(132, 161, 93, .12), transparent 28%),
        var(--bg);
    background-size: 28px 28px, 28px 28px, auto, auto;
    color: var(--text);
    font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.topbar {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 12px clamp(18px, 4vw, 52px);
    border-bottom: 1px solid var(--line);
    background: rgba(9, 14, 13, .92);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid var(--accent);
    color: var(--accent-2);
    font-weight: 900;
    letter-spacing: .08em;
    clip-path: polygon(12% 0, 88% 0, 100% 12%, 100% 88%, 88% 100%, 12% 100%, 0 88%, 0 12%);
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .08em; text-transform: uppercase; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .08em; }

nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
nav a, .link-button {
    padding: 9px 12px;
    border: 0;
    background: transparent;
    color: var(--muted);
}
nav a:hover, .link-button:hover { color: var(--text); background: var(--panel-2); }
nav form { margin: 0; }

.container { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 54px; }
.container.narrow { width: min(900px, calc(100% - 32px)); }

.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 28px;
    padding: 30px;
    margin-bottom: 24px;
    border: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(167, 193, 122, .11), rgba(18, 26, 24, .96) 42%);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: "";
    width: 190px;
    height: 190px;
    border: 1px solid rgba(167, 193, 122, .16);
    position: absolute;
    right: -72px;
    top: -88px;
    transform: rotate(45deg);
}
.hero.compact { padding: 24px 28px; }
.hero h1 { margin: 3px 0 6px; font-size: clamp(28px, 4vw, 46px); line-height: 1.08; letter-spacing: -.03em; }
.hero p { margin: 0; color: var(--muted); max-width: 820px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-weight: 800; font-size: 11px; }
.hero-status { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 1; }
.hero-status small { color: var(--muted); white-space: nowrap; }

.panel {
    background: rgba(18, 26, 24, .94);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}
.panel-heading {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,.018);
}
.panel-heading h2 { margin: 0; font-size: 16px; letter-spacing: .05em; text-transform: uppercase; }
.panel-heading span { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.panel > p { padding: 0 18px 18px; color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-grid a { border: 1px solid var(--line); background: var(--panel); padding: 18px; }
.stat-grid a:hover { border-color: var(--accent); transform: translateY(-1px); }
.stat-grid small, .stat-grid strong { display: block; }
.stat-grid small { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .12em; }
.stat-grid strong { font-size: 30px; margin-top: 4px; }

.filter-bar, .action-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.filter-bar { padding: 14px; border: 1px solid var(--line); background: var(--panel); }
.filter-bar input { flex: 1 1 320px; }
.action-bar form { margin: 0; }
.revoke-form { display: flex; gap: 8px; flex: 1 1 430px; }
.revoke-form input { flex: 1; }

input, select, textarea {
    width: 100%;
    color: var(--text);
    background: #0d1412;
    border: 1px solid #35443f;
    padding: 11px 12px;
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(167, 193, 122, .1); }
textarea { resize: vertical; }
label > span { display: block; margin-bottom: 7px; color: var(--accent-2); font-size: 12px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
label small { display: block; margin-top: 6px; color: var(--muted); }

.form-panel { padding-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 20px; }
.span-2 { grid-column: span 2; }
.secret-field { border: 1px dashed rgba(167, 193, 122, .38); padding: 15px; background: rgba(167, 193, 122, .035); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px; }

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    font-weight: 750;
    letter-spacing: .025em;
}
.button:hover { filter: brightness(1.08); }
.button.primary { background: var(--accent); color: #11180f; border-color: var(--accent); }
.button.secondary { background: transparent; }
.button.danger { border-color: rgba(213, 109, 100, .68); color: #ffd5d2; background: rgba(213, 109, 100, .12); }
.button.full { width: 100%; }
.button:disabled { opacity: .45; cursor: not-allowed; }

.alert { border: 1px solid; padding: 13px 15px; margin-bottom: 18px; }
.alert-success { border-color: rgba(111, 179, 140, .6); background: rgba(111, 179, 140, .1); color: #ccebd8; }
.alert-error { border-color: rgba(213, 109, 100, .68); background: rgba(213, 109, 100, .1); color: #ffd5d2; }
.notice { border-left: 3px solid var(--warning); background: rgba(212, 170, 90, .08); padding: 15px 17px; color: #dacaa7; margin: 20px 0; }

.badge { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 9px; border: 1px solid; font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.badge-active { color: #c8f0d7; border-color: var(--success); background: rgba(111, 179, 140, .12); }
.badge-scheduled { color: #f1deb7; border-color: var(--warning); background: rgba(212, 170, 90, .12); }
.badge-draft { color: #c6d0cc; border-color: #65716d; background: rgba(101, 113, 109, .12); }
.badge-expired { color: #c3c8c5; border-color: #555f5b; background: rgba(85, 95, 91, .12); }
.badge-revoked { color: #ffd5d2; border-color: var(--danger); background: rgba(213, 109, 100, .13); }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.table-link { color: var(--accent-2); font-weight: 750; }
.table-link:hover { color: var(--accent); }
.block { display: block; color: var(--muted); margin-top: 3px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 800; }
.small { font-size: 12px; }

.metadata-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metadata-grid > div { padding: 18px; border-right: 1px solid var(--line); }
.metadata-grid > div:last-child { border-right: 0; }
.metadata-grid small, .metadata-grid strong { display: block; }
.metadata-grid small { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .09em; margin-bottom: 4px; }
.prewrap { white-space: pre-wrap; }

.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.code-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); }
.code-grid > div { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 10px 12px; background: var(--panel); text-align: center; font-family: "SFMono-Regular", Consolas, monospace; }
.code-grid span { color: var(--muted); }
.code-grid strong { color: var(--accent-2); }
.code-grid.compact { grid-template-columns: repeat(2, 1fr); }
.matrix td, .matrix th { text-align: center; font-family: "SFMono-Regular", Consolas, monospace; }
.matrix.alphabet td { min-width: 37px; }
.matrix.auth td { font-size: 16px; letter-spacing: .08em; }
.token-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--line); }
.token-grid > div { background: var(--panel); padding: 14px; text-align: center; }
.token-grid small, .token-grid strong { display: block; }
.token-grid small { color: var(--muted); }
.token-grid strong { font-family: "SFMono-Regular", Consolas, monospace; letter-spacing: .15em; color: var(--accent-2); }

.login-shell { min-height: calc(100vh - 190px); display: grid; place-items: center; }
.login-card { width: min(470px, 100%); border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); padding: 32px; }
.login-card h1 { font-size: 38px; margin: 6px 0 8px; }
.login-card > p { color: var(--muted); margin-bottom: 22px; }
.login-card label { display: block; margin-bottom: 15px; }
.classification-strip { margin: 24px -32px -32px; padding: 10px; text-align: center; background: repeating-linear-gradient(135deg, #b89850 0, #b89850 12px, #1b1a13 12px, #1b1a13 24px); color: white; font-size: 11px; font-weight: 900; letter-spacing: .16em; text-shadow: 0 1px 2px #000; }

.check-list { padding: 10px 18px 18px; }
.check-list > div { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check { width: 62px; text-align: center; border: 1px solid; font: 800 10px/1.8 "SFMono-Regular", Consolas, monospace; }
.check.ok { color: #c8f0d7; border-color: var(--success); }
.check.fail { color: #ffd5d2; border-color: var(--danger); }

.empty { text-align: center; padding: 30px; color: var(--muted); }
.empty h1, .empty h3 { color: var(--text); }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 20px clamp(18px, 4vw, 52px); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

@media (max-width: 1050px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
    .metadata-grid { grid-template-columns: repeat(2, 1fr); }
    .metadata-grid > div:nth-child(2) { border-right: 0; }
    .two-columns { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .topbar { position: static; align-items: flex-start; flex-direction: column; }
    nav { width: 100%; }
    .hero { align-items: flex-start; flex-direction: column; padding: 22px; }
    .hero-status { align-items: flex-start; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .metadata-grid { grid-template-columns: 1fr; }
    .metadata-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .code-grid { grid-template-columns: repeat(2, 1fr); }
    .token-grid { grid-template-columns: repeat(3, 1fr); }
    footer { flex-direction: column; }
}


.section-heading { margin-top: 8px; border-top: 1px solid var(--line); }
.signal-table td:first-child { width: 42%; }
.signal-section .procedure-note {
    margin: 0;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}
.signal-columns { align-items: start; }
.legacy-notice { margin-top: 0; }


.communications-columns { align-items: start; }
.procedure-table td:first-child { width: 32%; }
.codeword-table td:last-child { width: 38%; }
.communications-section .procedure-note {
    margin: 0;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}


.flash-total {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(146, 169, 114, .06);
}
.flash-total small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}
.flash-total strong {
    min-width: 48px;
    text-align: center;
    font: 900 28px/1 "SFMono-Regular", Consolas, monospace;
    color: var(--accent-2);
}
.flash-total span { color: var(--muted); font-size: 12px; }
.flash-code-table td { text-align: center; }
