:root {
    --bg: #050607;
    --panel: #101214;
    --panel-2: #15181b;
    --line: #24282d;
    --text: #f5f5f7;
    --muted: #9ca0a8;
    --neon: #00ff9d;
    --blue: #62a8ff;
    --amber: #ffd166;
}

* { box-sizing: border-box; }
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 8%, rgba(0, 255, 157, 0.11), transparent 28%),
        radial-gradient(circle at 90% 12%, rgba(98, 168, 255, 0.11), transparent 26%),
        linear-gradient(180deg, #070809 0%, #050607 46%, #070809 100%);
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
}
a { color: inherit; }
.shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 1.2rem 0 3.5rem; }
#systems-content { transition: opacity .16s ease, transform .16s ease; }
.systems-loading #systems-content { opacity: .42; transform: translateY(4px); pointer-events: none; }
.top {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .85rem 1rem;
    margin: .35rem 0 1rem;
    background: linear-gradient(180deg, rgba(14, 17, 19, .96), rgba(7, 9, 11, .94));
    border: 1px solid rgba(36, 40, 45, .82);
    border-radius: 16px;
    box-shadow: 0 16px 38px rgba(0, 0, 0, .28);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 200;
}
.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(245, 245, 247, .96);
    box-shadow: 0 0 0 1px rgba(0,255,157,.24), 0 10px 24px rgba(0,0,0,.28);
}
.brand-wordmark { display: inline-flex; align-items: baseline; }
.brand-name { color: var(--text); font-weight: 200; }
.brand-suffix { color: var(--neon); font-weight: 800; }
.nav { display: flex; flex-wrap: wrap; gap: .5rem; }
.nav a, .button {
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .7rem .9rem;
    background: rgba(16, 18, 20, .82);
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.nav a:hover, .nav a.active, .button:hover { border-color: rgba(0, 255, 157, .45); background: var(--panel-2); }
.button.primary { background: var(--neon); border-color: var(--neon); color: #001c10; }
.button.ghost { background: transparent; }
.hero { min-height: 260px; display: grid; align-content: end; margin: 1.5rem 0 1.2rem; }
.eyebrow { color: var(--neon); text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 800; }
h1 { font-size: clamp(2rem, 6vw, 4rem); letter-spacing: 0; margin: .4rem 0; }
h2, h3 { margin: 0 0 .8rem; }
.muted { color: var(--muted); line-height: 1.55; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.grid.public-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hub-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 1rem; align-items: stretch; }
.card {
    background: linear-gradient(180deg, rgba(21, 24, 27, .92), rgba(12, 14, 16, .92));
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: 0 18px 44px rgba(0,0,0,.22);
}
.card a { text-decoration: none; }
.tool-card {
    min-height: 210px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
    background: linear-gradient(180deg, rgba(21, 24, 27, .94), rgba(11, 13, 15, .94));
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.25rem;
    transition: transform .22s ease, border-color .22s ease, background .22s ease;
}
.tool-card:hover { transform: translateY(-4px); border-color: rgba(0,255,157,.48); background: linear-gradient(180deg, #171b1e, #0d1012); }
.tool-card i, .tool-icon, .tool-mark {
    width: 34px;
    height: 34px;
    margin-bottom: 1.1rem;
}
.tool-card i, .tool-icon { color: var(--neon); }
.tool-mark {
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid rgba(0,255,157,.38);
    background: rgba(0,255,157,.08);
    color: var(--neon);
    font-weight: 800;
    letter-spacing: .02em;
}
.tool-card i { display: none; }
.tool-card-footer { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .85rem; }
.pill { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 999px; padding: .32rem .6rem; color: var(--muted); font-size: .78rem; }
.form { display: grid; gap: 1rem; }
label { display: grid; gap: .4rem; color: var(--muted); font-weight: 700; }
input, textarea, select, button { font-size: 16px; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #090b0d; color: var(--text); padding: .85rem; font-family: inherit; }
textarea { min-height: 120px; resize: vertical; }
.systems-menu-button,
.systems-nav-close,
.systems-nav-backdrop {
    display: none;
}
.menu-bars {
    display: grid;
    gap: 4px;
}
.menu-bars i {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}
.result {
    margin-top: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    background: #080a0c;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    min-height: 90px;
}
.board { display: grid; grid-template-columns: repeat(3, minmax(80px, 120px)); gap: .5rem; }
.cell { aspect-ratio: 1; border: 1px solid var(--line); background: #0c0f11; color: var(--text); border-radius: 8px; font-size: 2rem; font-weight: 800; }
.score { font-size: clamp(4rem, 12vw, 7rem); font-weight: 800; letter-spacing: -.08em; margin: 0; }
.status-line { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: .7rem; align-items: end; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1rem; }
.side-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 210px;
}
.side-panel-list {
    display: grid;
    gap: .7rem;
    margin-top: 1rem;
}
.side-panel-list span {
    display: flex;
    justify-content: space-between;
    gap: .8rem;
    padding-bottom: .7rem;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
}
.side-panel-list span:last-child { border-bottom: 0; }
.password-meter {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #080a0c;
    border: 1px solid var(--line);
    overflow: hidden;
}
.password-meter span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--amber), var(--neon));
    transition: width .25s ease;
}
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.option-tile {
    display: flex;
    align-items: center;
    gap: .55rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .85rem;
    background: rgba(8,10,12,.7);
    color: var(--text);
}
.option-tile input { width: auto; }
.password-output { font-size: 1.05rem; font-weight: 800; letter-spacing: .02em; }
.subtle-note { font-size: .85rem; color: var(--muted); margin: 0; }
.qr-box { display: none; margin-top: 1rem; }
.qr-box.active { display: block; }
.qr-box img { width: 180px; height: 180px; border-radius: 8px; border: 1px solid var(--line); background: #fff; padding: .5rem; }
.status-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--neon); box-shadow: 0 0 0 4px rgba(0,255,157,.12); }
.status-dot.warn { background: var(--amber); box-shadow: 0 0 0 4px rgba(255,209,102,.14); }
.status-row { display: grid; grid-template-columns: minmax(160px, 1fr) auto; align-items: center; gap: .35rem 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.status-row small { grid-column: 1 / -1; }
.status-row:last-child { border-bottom: 0; }

@media (max-width: 780px) {
    .systems-menu-button {
        position: sticky;
        top: 0;
        z-index: 45;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: .55rem;
        width: 100%;
        min-height: 48px;
        border: 0;
        border-bottom: 1px solid var(--line);
        background: rgba(7, 9, 11, .96);
        color: var(--text);
        font-weight: 900;
        cursor: pointer;
    }

    .top {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 60;
        align-items: stretch;
        justify-content: flex-start;
        flex-direction: column;
        width: min(86vw, 320px);
        height: 100dvh;
        overflow-y: auto;
        margin: 0;
        border-radius: 0;
        border-top: 0;
        border-bottom: 0;
        border-left: 0;
        transform: translateX(-105%);
        transition: transform .22s ease;
    }

    .systems-menu-open .top {
        transform: translateX(0);
    }

    .systems-nav-close {
        position: absolute;
        top: .9rem;
        right: .9rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        color: var(--text);
        font-size: 1.4rem;
        cursor: pointer;
    }

    .systems-nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 55;
        display: block;
        pointer-events: none;
        opacity: 0;
        background: rgba(0, 0, 0, .58);
        transition: opacity .22s ease;
    }

    .systems-menu-open .systems-nav-backdrop {
        pointer-events: auto;
        opacity: 1;
    }

    .brand {
        padding-right: 3rem;
    }

    .grid, .grid.two, .grid.public-tools, .hub-layout, .option-grid { grid-template-columns: 1fr; }
    .hero { min-height: 190px; }
    .copy-row { grid-template-columns: 1fr; }
    .nav, .hero-actions, .status-line { width: 100%; }
    .nav a, .button { justify-content: center; width: 100%; }
}

@media (max-width: 520px) {
    .shell { width: min(100% - 1rem, 1180px); }
    .status-row { grid-template-columns: 1fr; }
    .status-row .pill { justify-self: start; }
    .board { grid-template-columns: repeat(3, minmax(64px, 1fr)); }
    .cell { font-size: 1.6rem; }
    .password-output { overflow-wrap: anywhere; }
}

.timeline-item {
    display: grid;
    gap: .25rem;
    padding: .85rem 0;
    border-bottom: 1px solid var(--line);
}

.timeline-item:last-child { border-bottom: 0; }
.timeline-item small { color: var(--muted); }

.protocol-hero { min-height: 220px; }
.protocol-search,
.protocol-message,
.protocol-history,
.protocol-progress,
.protocol-summary {
    max-width: 920px;
    margin-top: 1rem;
}
.protocol-search { display: grid; gap: .9rem; }
.protocol-form {
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
    align-items: end;
}
.protocol-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.progress-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .8rem;
    margin-top: 1rem;
}
.progress-step {
    position: relative;
    display: grid;
    gap: .35rem;
    min-height: 132px;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(8, 10, 12, .72);
}
.progress-marker {
    width: 13px;
    height: 13px;
    border-radius: 999px;
    border: 2px solid var(--line);
    background: #080a0c;
}
.progress-step.is-done {
    border-color: rgba(0, 255, 157, .34);
    background: rgba(0, 255, 157, .06);
}
.progress-step.is-done .progress-marker {
    border-color: var(--neon);
    background: var(--neon);
    box-shadow: 0 0 0 5px rgba(0, 255, 157, .11);
}
.progress-step.is-current {
    border-color: rgba(98, 168, 255, .58);
}
.progress-step small {
    color: var(--muted);
    line-height: 1.45;
}

@media (max-width: 780px) {
    .protocol-form, .progress-steps { grid-template-columns: 1fr; }
    .protocol-summary { align-items: flex-start; flex-direction: column; }
}
