:root {
    color-scheme: dark;
    --bg: #030405;
    --panel: #0a0d11;
    --panel-soft: #10151c;
    --line: #252d38;
    --text: #f2f4f7;
    --muted: #8d98a8;
    --gold: #c89a31;
    --gold-hover: #dfb447;
    --danger: #d14b4b;
    --ok: #4fa56a;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

.unclass-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    line-height: 10px;
    background: #198754;
    color: #ffffff;
    text-align: center;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .18em;
    z-index: 20001;
    pointer-events: none;
}

a { color: inherit; }

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.brand-small {
    display: flex;
    align-items: center;
    gap: 18px;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: .16em;
}

.brand-small img {
    width: 288px;
    height: 288px;
    object-fit: contain;
}

.top-actions { display: flex; gap: 10px; align-items: center; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 18px;
}

.login-wrap {
    width: min(440px, 100%);
    text-align: center;
}

.login-logo {
    width: min(390px, 90vw);
    max-height: 300px;
    object-fit: contain;
    margin: 0 auto 18px;
    display: block;
}

.card,
.login-card {
    background: linear-gradient(180deg, rgba(16, 21, 28, .96), rgba(7, 9, 12, .98));
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .48);
}

.login-card { padding: 26px; text-align: left; }

.field { margin-bottom: 16px; }
.field label {
    display: block;
    margin-bottom: 7px;
    color: #c5cbd4;
    font-size: 13px;
    font-weight: 750;
    letter-spacing: .06em;
    text-transform: uppercase;
}

input, select {
    width: 100%;
    border: 1px solid #2a3441;
    background: #080b10;
    color: var(--text);
    border-radius: 9px;
    padding: 12px 13px;
    outline: none;
}

input:focus, select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(200, 154, 49, .15);
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    border: 1px solid #343e4b;
    border-radius: 9px;
    background: #151b24;
    color: var(--text);
    padding: 10px 16px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover { background: #1b2330; }
.btn-quiet { min-height: 38px; padding: 8px 12px; background: transparent; color: #cbd2dc; }
.btn-quiet:hover { background: #111720; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #080808; }
.btn-primary:hover { background: var(--gold-hover); }
.btn-danger { border-color: rgba(209, 75, 75, .65); color: #ffb0b0; }
.btn-danger:hover { background: rgba(209, 75, 75, .12); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .42; cursor: not-allowed; }

.alert {
    margin: 0 0 16px;
    border: 1px solid #4b3540;
    background: #211117;
    color: #ffc3ca;
    border-radius: 9px;
    padding: 11px 13px;
    font-size: 14px;
}

.alert.ok { border-color: #275b38; background: #0e2114; color: #a8efbd; }
.alert.info { border-color: #3e4b5d; background: #111824; color: #c9d7eb; }

.grid-four {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.module-card {
    min-height: 220px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.module-card h2 { margin: 0 0 8px; font-size: 26px; }
.module-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.module-card.disabled .module-tag,
.module-card.disabled h2,
.module-card.disabled p,
.module-card.disabled > .btn { opacity: .48; }
.module-card.disabled .module-icon { opacity: .68; }
.module-tag {
    display: inline-flex;
    align-self: flex-start;
    border: 1px solid #343e49;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}


.module-tag-private {
    color: #e1c16e;
    border-color: rgba(200, 154, 49, .72);
    background: rgba(200, 154, 49, .12);
}

.private-card { border-color: rgba(200, 154, 49, .38); }

.module-tag-available {
    color: #78d991;
    border-color: rgba(79, 165, 106, .72);
    background: rgba(79, 165, 106, .12);
}

.page-title { margin: 0; font-size: clamp(28px, 4vw, 44px); }
.page-subtitle { color: var(--muted); margin: 8px 0 0; }

.section { padding: 22px; margin-bottom: 18px; }
.section h2 { margin: 0 0 16px; }
.section h3 { margin: 0 0 12px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.form-grid .wide { grid-column: 1 / -1; }

.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #202731;
    text-align: left;
    vertical-align: top;
}
.users-table th { color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-actions form { display: inline-flex; gap: 8px; align-items: center; }
.inline-actions input, .inline-actions select { width: auto; min-width: 120px; padding: 8px 10px; }

.status { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.status.ok { color: #7bd897; }
.status.off { color: #e68b8b; }
.muted { color: var(--muted); }

.qr-wrap {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 22px;
    align-items: center;
}
.qr-wrap img { width: 210px; height: 210px; background: white; padding: 8px; border-radius: 8px; }
.secret {
    display: block;
    word-break: break-all;
    background: #05070a;
    border: 1px solid #29313c;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.recovery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.recovery-grid code { background: #05070a; border: 1px solid #29313c; border-radius: 7px; padding: 9px; }

@media (max-width: 760px) {
    .brand-small img { width: 144px; height: 144px; }
    .module-tooltip-anchor { width: 80px; height: 80px; flex-basis: 80px; }
    .module-icon { width: 80px; height: 80px; flex-basis: 80px; font-size: 44px; }
    .grid-four, .form-grid { grid-template-columns: 1fr; }
    .qr-wrap { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .users-table, .users-table tbody, .users-table tr, .users-table td { display: block; width: 100%; }
    .users-table thead { display: none; }
    .users-table tr { border-bottom: 1px solid #2b333f; padding: 12px 0; }
    .users-table td { border: 0; padding: 7px 0; }
}

.module-title-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 14px 0 10px;
}

.module-title-row h2 { margin: 0; }

.module-copy {
    min-width: 0;
}

.module-copy p {
    margin-top: 6px;
}

.module-icon {
    width: 96px;
    height: 96px;
    flex: 0 0 96px;
    display: grid;
    place-items: center;
    border: 1px solid #343e49;
    border-radius: 12px;
    background: #080b10;
    font-size: 54px;
    line-height: 1;
}

.module-icon-image { overflow: hidden; }
.module-icon-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}


.module-icon-media {
    overflow: hidden;
    padding: 0;
}

.module-icon-media img,
.module-icon-media video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}


.module-tooltip-anchor {
    position: relative;
    width: 96px;
    height: 96px;
    flex: 0 0 96px;
    display: grid;
    place-items: center;
    overflow: visible;
}

.module-tooltip-anchor > .module-icon {
    flex: none;
}

/* ACHILLES portal tooltips and always-visible Private card */
.has-tooltip {
    position: relative;
    cursor: help;
    outline: none;
}

.has-tooltip::before,
.has-tooltip::after {
    position: absolute;
    left: 50%;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}

.has-tooltip::after {
    content: attr(data-tooltip);
    bottom: calc(100% + 13px);
    width: max-content;
    max-width: min(320px, 70vw);
    transform: translate(-50%, 5px);
    border: 1px solid #3a4553;
    border-radius: 8px;
    background: #111720;
    color: #eef2f7;
    padding: 9px 11px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    white-space: normal;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
}

.has-tooltip::before {
    content: "";
    bottom: calc(100% + 7px);
    width: 10px;
    height: 10px;
    transform: translate(-50%, 5px) rotate(45deg);
    border-right: 1px solid #3a4553;
    border-bottom: 1px solid #3a4553;
    background: #111720;
}

.has-tooltip:hover::before,
.has-tooltip:hover::after,
.has-tooltip:focus-visible::before,
.has-tooltip:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

.has-tooltip:hover::after,
.has-tooltip:focus-visible::after {
    transform: translate(-50%, 0);
}

.has-tooltip:hover::before,
.has-tooltip:focus-visible::before {
    transform: translate(-50%, 0) rotate(45deg);
}

.private-locked {
    border-color: rgba(95, 105, 119, .35);
}

.private-locked .module-tag,
.private-locked h2,
.private-locked p,
.private-locked > .btn {
    opacity: .46;
}

.private-locked .module-icon {
    color: #7f8996;
    border-color: #2a313b;
    background: #080a0d;
}

.brand-small {
    gap: 0;
}
