:root {
    --bg: #0b0e12;
    --surface: #131820;
    --surface-raised: #191f28;
    --line: #2a323e;
    --text: #f4f6f8;
    --muted: #9ca8b7;
    --accent: #d6af54;
    --accent-dark: #a98533;
    --good: #67d69b;
    --warning: #f1c65b;
    --danger: #ff7a7a;
    --radius: 16px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 20% -10%, rgba(214, 175, 84, .12), transparent 33rem),
        var(--bg);
    color: var(--text);
}

a { color: inherit; }

button, input { font: inherit; }

.skip-link {
    position: fixed;
    top: .5rem;
    left: .5rem;
    z-index: 10;
    transform: translateY(-160%);
    padding: .65rem .9rem;
    background: var(--text);
    color: var(--bg);
    border-radius: 8px;
}

.skip-link:focus { transform: translateY(0); }

.topbar {
    min-height: 68px;
    padding: 0 clamp(1rem, 4vw, 3rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    background: rgba(11, 14, 18, .88);
    backdrop-filter: blur(16px);
}

.wordmark {
    text-decoration: none;
    font-weight: 850;
    letter-spacing: -.04em;
    font-size: 1.25rem;
}

.wordmark span { color: var(--accent); font-weight: 600; }

.account-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--muted);
    font-size: .9rem;
}

.account-menu a, .link-button {
    color: var(--muted);
    text-decoration: none;
}

.account-menu a:hover, .link-button:hover { color: var(--text); }
.account-menu form { margin: 0; }
.account-name { color: var(--text); }

.link-button {
    appearance: none;
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
}

.page-shell {
    width: min(100% - 2rem, 1040px);
    margin: 0 auto;
    padding: clamp(2rem, 6vw, 4.5rem) 0;
}

.page-shell.wide { width: min(100% - 2rem, 1320px); }

.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .5rem; font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -.045em; line-height: 1; }
h2 { margin-bottom: 0; font-size: 1.35rem; letter-spacing: -.025em; }

.eyebrow {
    margin-bottom: .55rem;
    color: var(--accent);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.muted { color: var(--muted); line-height: 1.55; }
.refresh-state { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.refresh-error { color: var(--danger); }

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

.door-card, .empty-state {
    padding: 1.35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(255,255,255,.025), transparent 60%), var(--surface);
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
}

.empty-state { grid-column: 1 / -1; text-align: center; padding: 3.5rem 1.5rem; }

.door-card-header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.door-kicker { margin-bottom: .3rem; color: var(--muted); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .6rem;
    border: 1px solid;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 750;
}

.badge::before { content: ''; width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; }
.badge-online { color: var(--good); border-color: rgba(103,214,155,.3); background: rgba(103,214,155,.07); }
.badge-offline { color: var(--danger); border-color: rgba(255,122,122,.3); background: rgba(255,122,122,.07); }

.status-rows { margin: 1.35rem 0; border-top: 1px solid var(--line); }
.status-row { display: flex; align-items: center; justify-content: space-between; padding: .72rem 0; border-bottom: 1px solid var(--line); }
.status-label { color: var(--muted); font-size: .88rem; }
.status-value { font-weight: 700; font-size: .9rem; }
.status-value.normal { color: var(--good); }
.status-value.warning { color: var(--warning); }
.status-value.danger { color: var(--danger); }

.door-card-footer { display: grid; }

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: .72rem 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 760;
    cursor: pointer;
}

.button-primary { background: var(--accent); color: #171105; }
.button-primary:hover { background: #e3c06c; }
.button-disabled { background: var(--surface-raised); color: #74808e; border-color: var(--line); cursor: not-allowed; }

.foundation-note {
    display: flex;
    gap: .9rem;
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(214, 175, 84, .22);
    border-radius: 12px;
    background: rgba(214, 175, 84, .06);
}

.foundation-note p { margin: .25rem 0 0; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.foundation-icon { flex: 0 0 1.4rem; height: 1.4rem; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #171105; font-weight: 900; font-size: .8rem; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth-card { width: min(100%, 420px); padding: clamp(1.5rem, 6vw, 2.5rem); border: 1px solid var(--line); border-radius: 20px; background: rgba(19,24,32,.94); box-shadow: 0 30px 90px rgba(0,0,0,.36); }
.auth-card h1 { font-size: 2.2rem; }
.brand-mark { width: 3rem; height: 3rem; display: grid; place-items: center; margin-bottom: 1.5rem; border-radius: 12px; background: var(--accent); color: #171105; font-weight: 900; letter-spacing: -.08em; }

.stacked-form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.stacked-form label { display: grid; gap: .45rem; font-size: .86rem; font-weight: 650; }
.stacked-form input { width: 100%; padding: .8rem .85rem; border: 1px solid var(--line); border-radius: 10px; outline: none; background: #0d1117; color: var(--text); }
.stacked-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(214,175,84,.12); }

.alert { margin: 1.25rem 0; padding: .85rem 1rem; border-radius: 10px; line-height: 1.4; }
.alert-error { color: #ffd4d4; border: 1px solid rgba(255,122,122,.28); background: rgba(255,122,122,.08); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th, td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
code { color: #c3cbd6; font-size: .75rem; }
.outcome { font-weight: 750; text-transform: capitalize; }
.outcome-succeeded, .outcome-observed { color: var(--good); }
.outcome-denied, .outcome-failed { color: var(--danger); }
.empty-table { padding: 3rem; text-align: center; color: var(--muted); }

.skeleton { border-radius: 8px; background: linear-gradient(90deg, #1d242d 25%, #252e39 50%, #1d242d 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton-title { width: 50%; height: 1.4rem; margin-bottom: 2rem; }
.skeleton-line { height: 1rem; margin: .8rem 0; }
.skeleton-line.short { width: 68%; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 680px) {
    .door-grid { grid-template-columns: 1fr; }
    .page-heading { align-items: start; flex-direction: column; gap: .8rem; }
    .topbar { align-items: flex-start; padding-top: 1rem; padding-bottom: 1rem; }
    .account-menu { align-items: flex-end; flex-direction: column; gap: .45rem; }
    .account-name { display: none; }
}

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

