:root {
    --navy: #111936;
    --navy-soft: #1c2751;
    --purple: #6058de;
    --blue: #3b82f6;
    --green: #168461;
    --red: #c33e58;
    --ink: #17213a;
    --muted: #6e7c92;
    --line: #e1e7f0;
    --surface: #fff;
    --soft: #f4f6fa;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--soft);
    color: var(--ink);
    font: 15px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; }
button, input, textarea { font: inherit; }
button, .button { cursor: pointer; }

.app-body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 20% 85%, rgba(82, 114, 230, .2), transparent 20rem),
        linear-gradient(170deg, #111936, #172148);
    padding: 24px 18px;
    color: #fff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 8px 24px;
    text-decoration: none;
}

.brand > span,
.auth-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(135deg, #6267e8, #8b5de3);
    box-shadow: 0 12px 30px rgba(89, 89, 220, .35);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 900;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong { font-size: 1.03rem; }
.brand small { margin-top: 1px; color: #8798c8; font-size: .55rem; letter-spacing: .08em; }

.sidebar nav {
    display: grid;
    gap: 7px;
}

.sidebar nav a {
    border-radius: 11px;
    padding: 11px 13px;
    color: #b4c0e3;
    font-weight: 700;
    text-decoration: none;
}

.sidebar nav a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.sidebar-user {
    margin-top: auto;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 15px;
    background: rgba(255,255,255,.06);
    padding: 14px;
}

.sidebar-user strong,
.sidebar-user small { display: block; }
.sidebar-user small { margin: 2px 0 11px; color: #93a3cf; font-size: .72rem; overflow-wrap: anywhere; }
.sidebar-user button { border: 0; background: transparent; padding: 0; color: #c4cdf0; font-size: .72rem; font-weight: 800; }

.workspace {
    min-width: 0;
    padding: 0 30px 40px;
}

.topbar {
    min-height: 105px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.topbar small,
.panel-heading small,
.auth-intro > small,
.auth-card > small,
.token-reveal > small {
    color: var(--purple);
    font-size: .63rem;
    font-weight: 900;
    letter-spacing: .13em;
}

h1, h2, p { margin-top: 0; }
.topbar h1 { margin: 2px 0 0; font-size: 1.7rem; letter-spacing: -.04em; }

.flash {
    margin-bottom: 16px;
    border: 1px solid #cce4da;
    border-radius: 12px;
    background: #edfaf4;
    padding: 11px 14px;
    color: #23624d;
    font-weight: 700;
}

.flash.error,
.flash.danger {
    border-color: #f0c6cf;
    background: #fff0f3;
    color: #99344b;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stats-grid article,
.panel {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 13px 35px rgba(22, 33, 67, .05);
}

.stats-grid article { padding: 19px; }
.stats-grid span, .stats-grid strong { display: block; }
.stats-grid span { color: var(--muted); font-size: .72rem; font-weight: 750; }
.stats-grid strong { margin-top: 5px; font-size: 1.9rem; letter-spacing: -.05em; }

.panel {
    margin-bottom: 18px;
    padding: 22px;
}

.narrow-panel { max-width: 850px; }

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 19px;
}

.panel-heading h2 { margin: 2px 0 0; font-size: 1.15rem; letter-spacing: -.025em; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 800;
    text-decoration: none;
}

.button.primary { background: linear-gradient(135deg, #555be0, #7456d8); color: #fff; }
.button.secondary { border-color: #d7dcf4; background: #f3f3ff; color: #4548ab; }
.button.ghost { border-color: var(--line); background: #fff; color: #4d5b70; }
.button.danger { background: #c83c59; color: #fff; }
.button.light { background: #fff; color: #343b99; }
.button.wide { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid #edf0f5; padding: 12px 10px; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #8290a6; font-size: .63rem; letter-spacing: .07em; text-transform: uppercase; }
td { font-size: .78rem; }
td strong, td small { display: block; }
td small { margin-top: 2px; color: #8693a7; font-size: .63rem; }
code { border-radius: 6px; background: #f0f2f7; padding: 3px 6px; color: #475269; font: .72rem ui-monospace, monospace; }

.status {
    display: inline-flex;
    border-radius: 999px;
    background: #e9f8f1;
    padding: 4px 8px;
    color: #217053;
    font-size: .6rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.status.revoked,
.status.deactivated { background: #fff0f2; color: #a3364e; }

.text-link { color: #5156c5; font-weight: 850; text-decoration: none; }

.empty-state {
    border: 1px dashed #d6dce7;
    border-radius: 14px;
    padding: 28px;
    color: var(--muted);
    text-align: center;
}
.empty-state strong { color: var(--ink); }
.empty-state p { margin: 4px 0 0; }

form label {
    display: grid;
    gap: 6px;
    margin-bottom: 15px;
    color: #44516a;
    font-size: .73rem;
    font-weight: 800;
}

input, textarea {
    width: 100%;
    border: 1px solid #d9dfe9;
    border-radius: 10px;
    outline: none;
    background: #fff;
    padding: 11px 12px;
    color: var(--ink);
}

input:focus, textarea:focus { border-color: #7477d9; box-shadow: 0 0 0 3px rgba(98, 103, 232, .11); }

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

.notice {
    margin: 12px 0 18px;
    border-left: 4px solid #5b62d9;
    border-radius: 8px;
    background: #f0f2ff;
    padding: 12px 14px;
    color: #4d5682;
}
.notice strong { color: #313b6e; }
.notice p { margin: 3px 0 0; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 18px; }
.details { margin: 0; }
.details > div { display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid #edf0f5; padding: 10px 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 750; text-align: right; overflow-wrap: anywhere; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.token-reveal {
    margin-bottom: 18px;
    border-radius: 20px;
    background:
        radial-gradient(circle at 90% 20%, rgba(68, 201, 222, .25), transparent 20rem),
        linear-gradient(135deg, #172451, #423a9c);
    padding: 25px;
    color: #fff;
}
.token-reveal > small { color: #91dcec; }
.token-reveal > strong { display: block; margin: 9px 0 14px; font: 700 clamp(1rem, 3vw, 1.65rem) ui-monospace, monospace; letter-spacing: .04em; overflow-wrap: anywhere; }
.token-reveal p { margin: 12px 0 0; color: rgba(255,255,255,.65); font-size: .72rem; }

pre {
    overflow: auto;
    border-radius: 14px;
    background: #11182e;
    padding: 18px;
    color: #dbe5ff;
    font: .73rem/1.7 ui-monospace, monospace;
}
.fingerprint { display: block; margin-top: 8px; overflow-wrap: anywhere; }
.microcopy { color: var(--muted); font-size: .7rem; }

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(86, 90, 220, .12), transparent 28rem),
        #f2f4f9;
}

.auth-card,
.auth-intro {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #fff;
    padding: clamp(26px, 5vw, 42px);
    box-shadow: 0 24px 65px rgba(20, 30, 67, .1);
}

.login-card { width: min(450px, 100%); }
.auth-card .auth-mark { margin-bottom: 20px; }
.auth-card h1, .auth-intro h1 { margin: 7px 0; font-size: 2rem; letter-spacing: -.045em; }
.auth-card > p, .auth-intro > p { color: var(--muted); }

.install-shell {
    width: min(1050px, 100%);
    display: grid;
    grid-template-columns: .9fr 1.1fr;
    gap: 18px;
}

.auth-intro {
    background:
        radial-gradient(circle at 20% 90%, rgba(84, 199, 220, .16), transparent 22rem),
        linear-gradient(145deg, #111936, #27265f);
    color: #fff;
}
.auth-intro > p { color: #a8b4d7; }
.requirements { display: grid; gap: 8px; margin-top: 24px; }
.requirements div { display: flex; align-items: center; gap: 9px; border-radius: 10px; background: rgba(255,255,255,.07); padding: 9px 11px; font-size: .72rem; }
.requirements span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: rgba(63, 207, 158, .18); color: #76e0ba; }
.requirements .failed span { background: rgba(244, 84, 114, .17); color: #ff91a6; }

@media (max-width: 950px) {
    .app-body { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: static; height: auto; }
    .sidebar nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sidebar-user { display: none; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    .workspace { padding: 0 14px 30px; }
    .topbar { min-height: 90px; }
    .topbar .button { display: none; }
    .sidebar nav { grid-template-columns: minmax(0, 1fr); }
    .stats-grid, .field-grid, .detail-grid, .install-shell { grid-template-columns: minmax(0, 1fr); }
    .panel { padding: 17px; }
    .auth-body { padding: 12px; }
    .auth-card, .auth-intro { padding: 24px 19px; }
}
