:root {
    color-scheme: dark;
    --bg: #080d13;
    --sidebar: #0b1119;
    --card: #131a24;
    --surface: #18212d;
    --line: #283447;
    --accent: #2ed3c3;
    --accent-hover: #45e0d1;
    --text: #f5f7fa;
    --muted: #7184a4;
    --danger: #ff5a47;
    --success: #21d4c2;
    --warning: #f4bd62;
    --shadow: 0 24px 70px rgba(0, 0, 0, .32);
    font-family: "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; max-width: 100%; overflow-x: hidden; background: var(--bg); }
body { min-height: 100vh; max-width: 100%; overflow-x: hidden; margin: 0; color: var(--text); background: var(--bg); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; }

.auth-shell { width: min(1120px, calc(100% - 40px)); min-height: 100vh; margin: 0 auto; display: grid; align-items: center; padding: 52px 0; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, 460px); gap: clamp(56px, 9vw, 130px); align-items: center; }
.auth-layout > *, .auth-card, .setup-card { min-width: 0; max-width: 100%; }
.auth-brand { max-width: 580px; }
.auth-brand > img { width: 112px; height: 112px; margin-bottom: 34px; border: 1px solid rgba(46, 211, 195, .3); border-radius: 28px; object-fit: cover; box-shadow: 0 20px 56px rgba(0, 0, 0, .36); }
.eyebrow { display: block; margin-bottom: 12px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1, h2 { letter-spacing: -.04em; line-height: 1.08; }
h1 { margin-bottom: 16px; font-family: "Segoe UI Variable Display", "Segoe UI", sans-serif; font-size: clamp(42px, 5vw, 66px); }
h1 span { color: var(--muted); }
h2 { margin: 0; font-size: 25px; }
p { color: var(--muted); }
.auth-brand > p { max-width: 540px; font-size: 17px; }
.trust-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.trust-list span { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; color: #a9b5c7; font-size: 12px; font-weight: 650; }

.card, .content-card { border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.auth-card { padding: 36px; }
.card-heading { margin-bottom: 25px; }
.card-heading p { margin: 9px 0 0; font-size: 13px; }
.form-stack { display: grid; gap: 17px; }
.form-stack label, .action-form label { display: grid; gap: 7px; color: #c6d0de; font-size: 12px; font-weight: 700; }
.form-stack label small { color: var(--muted); font-weight: 500; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line); outline: 0; border-radius: 10px; color: var(--text); background: #0b1119; transition: border-color .16s, box-shadow .16s; }
input, select { height: 48px; padding: 0 13px; }
textarea { padding: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 211, 195, .11); }
.button { min-height: 44px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 10px; padding: 0 18px; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 800; transition: background .16s, border-color .16s, transform .16s; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #03201e; background: var(--accent); }
.button.primary:hover { background: var(--accent-hover); }
.button.ghost { border-color: var(--line); color: #bdc8d7; background: var(--surface); }
.danger-button { border-color: rgba(255, 90, 71, .5); color: #ffd2cc; background: rgba(255, 90, 71, .12); }
.setup-link { display: block; margin-top: 23px; color: var(--muted); text-align: center; font-size: 12px; text-decoration: none; }
.setup-link:hover, .text-link:hover, .back-link:hover { color: var(--text); }
.alert, .flash { border: 1px solid; border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.alert { margin-bottom: 20px; }
.alert.error, .flash.error { border-color: rgba(255, 90, 71, .35); color: #ffbcb3; background: rgba(255, 90, 71, .09); }
.flash.success { border-color: rgba(33, 212, 194, .32); color: #96eee5; background: rgba(33, 212, 194, .09); }

.setup-wrap { width: min(720px, 100%); margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 18px; color: var(--muted); font-size: 13px; text-decoration: none; }
.setup-card { padding: clamp(28px, 5vw, 48px); }
.setup-card h1 { font-size: clamp(36px, 5vw, 52px); }
.secret-box { margin: 25px 0; padding: 20px; border: 1px solid rgba(46, 211, 195, .25); border-radius: 12px; background: rgba(46, 211, 195, .055); }
.secret-box span, .secret-box strong, .secret-box small { display: block; }
.secret-box span { margin-bottom: 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.secret-box strong { color: var(--accent-hover); overflow-wrap: anywhere; font-size: 16px; letter-spacing: .08em; }
.secret-box small { margin-top: 8px; color: #9aa9be; }
.recovery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 25px 0; }
.recovery-grid code { padding: 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent-hover); background: #0b1119; text-align: center; }
.subtle-form { margin-top: 20px; text-align: center; }
.subtle-form button { border: 0; color: var(--muted); background: none; cursor: pointer; font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 25px 18px; border-right: 1px solid #1d2939; background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 27px; border-bottom: 1px solid #1d2939; text-decoration: none; }
.brand img { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; }
.brand span, .brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.sidebar nav { display: grid; gap: 5px; padding: 24px 0; }
.sidebar nav a { min-height: 42px; display: flex; align-items: center; border: 1px solid transparent; border-radius: 9px; padding: 0 13px; color: #899ab2; text-decoration: none; font-size: 13px; font-weight: 700; }
.sidebar nav a:hover { color: var(--text); background: var(--surface); }
.sidebar nav a.active { border-color: rgba(46, 211, 195, .25); color: var(--accent-hover); background: rgba(46, 211, 195, .08); }
.sidebar-user { margin-top: auto; padding: 16px 10px 4px; border-top: 1px solid #1d2939; }
.sidebar-user span, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user span { font-size: 13px; font-weight: 750; }
.sidebar-user small { margin: 3px 0 13px; color: var(--muted); font-size: 10px; }
.sidebar-user form { margin: 0; }
.sidebar-user button { border: 0; padding: 0; color: #899ab2; background: none; cursor: pointer; font-size: 11px; }
.sidebar-user button:hover { color: var(--danger); }
.main-content { width: min(1400px, 100%); margin: 0 auto; padding: 45px clamp(28px, 4vw, 62px) 70px; }
.main-content > .flash { margin-bottom: 20px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 31px; }
.page-heading.compact { margin-bottom: 23px; }
.page-heading h1 { margin-bottom: 7px; font-size: clamp(36px, 4vw, 52px); }
.page-heading p { margin: 0; font-size: 14px; }
.server-status { display: flex; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 9px; color: #a7b5c8; font-size: 11px; font-weight: 750; }
.server-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(33, 212, 194, .1); }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.metric-card { min-height: 150px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.metric-card span, .metric-card strong, .metric-card small { display: block; }
.metric-card span { color: #9aa9be; font-size: 12px; font-weight: 700; }
.metric-card strong { margin: 13px 0 4px; font-size: 31px; letter-spacing: -.05em; }
.metric-card small { color: var(--muted); font-size: 11px; }
.content-card { padding: 25px; box-shadow: none; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading .eyebrow { margin-bottom: 6px; }
.text-link { color: var(--accent); font-size: 12px; font-weight: 750; text-decoration: none; }
.audit-list { display: grid; }
.audit-list article { min-height: 64px; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 14px; border-top: 1px solid #202c3b; }
.audit-icon { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.audit-icon.ok { background: var(--success); }
.audit-list strong, .audit-list span { display: block; }
.audit-list strong { font-size: 12px; }
.audit-list span, .audit-list time { color: var(--muted); font-size: 10px; }

.search-bar { display: grid; grid-template-columns: minmax(260px, 520px) auto auto; gap: 9px; margin-bottom: 18px; }
.table-card { padding: 0; overflow: visible; }
.table-summary { padding: 17px 20px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.table-summary strong { color: var(--text); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 12px 16px; color: var(--muted); background: #0f1620; text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
td { min-height: 64px; padding: 14px 16px; border-top: 1px solid #202c3b; color: #bdc8d7; vertical-align: middle; }
td > strong, td > small { display: block; }
td > small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.person strong, .person span { display: block; }
.person strong { color: var(--text); font-size: 12px; }
.person span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.status { display: inline-flex; align-items: center; gap: 6px; border: 1px solid; border-radius: 999px; padding: 5px 8px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.status.success { border-color: rgba(33, 212, 194, .28); color: #77e7dc; background: rgba(33, 212, 194, .08); }
.status.danger { border-color: rgba(255, 90, 71, .3); color: #ff9f93; background: rgba(255, 90, 71, .08); }
.status.warning { border-color: rgba(244, 189, 98, .3); color: #f4ca85; background: rgba(244, 189, 98, .08); }
.action-menu { position: relative; }
.action-menu summary { width: max-content; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; color: #b8c4d4; background: var(--surface); cursor: pointer; list-style: none; font-weight: 700; }
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu[open] .action-form { display: grid; }
.action-form { position: absolute; z-index: 10; right: 0; top: 38px; width: 330px; display: none; gap: 11px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #101722; box-shadow: var(--shadow); }
.action-form input, .action-form select { height: 40px; }
.pagination { min-height: 58px; display: flex; align-items: center; justify-content: center; gap: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pagination a { color: var(--accent); text-decoration: none; font-weight: 750; }
.empty-state { padding: 30px; color: var(--muted); text-align: center; }
.nowrap { white-space: nowrap; }
.release-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .7fr); gap: 18px; margin-bottom: 20px; }
.release-publish, .release-guidance { min-width: 0; }
.release-help { margin: -5px 0 20px; font-size: 12px; }
.manifest-input { min-height: 210px; font-size: 11px; line-height: 1.55; }
.release-guidance ul { display: grid; gap: 12px; margin: 22px 0 0; padding: 0; list-style: none; }
.release-guidance li { position: relative; padding-left: 18px; color: #aab7c9; font-size: 12px; }
.release-guidance li::before { content: ""; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(46, 211, 195, .08); }
.release-table { margin-top: 0; }

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 200px minmax(0, 1fr); }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .main-content { padding-inline: 24px; }
}

@media (max-width: 720px) {
    .auth-shell { width: min(100% - 26px, 560px); padding: 28px 0; }
    .auth-layout { grid-template-columns: 1fr; gap: 34px; }
    .auth-layout > * { width: 100%; }
    .auth-brand > img { width: 78px; height: 78px; margin-bottom: 22px; border-radius: 20px; }
    .trust-list { display: none; }
    .app-shell { display: block; }
    .sidebar { position: static; width: 100%; height: auto; display: grid; grid-template-columns: 1fr; padding: 14px; }
    .brand { padding: 0 0 13px; }
    .sidebar nav { grid-template-columns: repeat(4, 1fr); padding: 13px 0 0; }
    .sidebar nav a { justify-content: center; padding: 0 6px; font-size: 11px; }
    .sidebar-user { display: none; }
    .main-content { padding: 28px 13px 50px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .metric-card { min-height: 130px; padding: 18px; }
    .search-bar { grid-template-columns: 1fr auto; }
    .search-bar .ghost { display: none; }
    .recovery-grid { grid-template-columns: 1fr; }
    .release-layout { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
    .metric-grid { grid-template-columns: 1fr; }
    .auth-card, .setup-card { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
