:root {
    color-scheme: dark;
    --bg: #08100e;
    --surface: #101a17;
    --surface-2: #15231f;
    --border: #263b34;
    --text: #edf7f2;
    --muted: #91a99f;
    --accent: #d8ff57;
    --accent-ink: #172000;
    --danger: #ff6b6b;
    --success: #65e6a5;
}

* { box-sizing: border-box; }

html { font-family: "Segoe UI", Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% 5%, #173329 0, transparent 34rem), var(--bg); }
a { color: inherit; }

.site-header, .site-footer, .page-shell { width: min(1440px, calc(100% - 40px)); margin-inline: auto; }
.site-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.site-header nav { display: flex; align-items: center; gap: 22px; }
.site-header nav a, .link-button { color: var(--muted); text-decoration: none; font: inherit; }
.site-header nav a:hover, .link-button:hover { color: var(--text); }
.brand { font-size: .82rem; font-weight: 800; letter-spacing: .2em; text-decoration: none; }
.page-shell { padding: 56px 0 80px; }
.site-footer { padding: 24px 0 40px; color: var(--muted); border-top: 1px solid var(--border); font-size: .82rem; }
.inline-form { display: inline; }
.link-button { border: 0; background: transparent; cursor: pointer; padding: 0; }

h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2.25rem, 5vw, 5rem); line-height: .98; letter-spacing: -.045em; margin-bottom: 22px; }
h2 { font-size: 1.4rem; margin-bottom: 6px; }
.eyebrow { display: inline-block; margin-bottom: 16px; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .18em; }
.lead-copy { max-width: 620px; color: var(--muted); font-size: 1.15rem; line-height: 1.65; }

.hero-shell { min-height: 58vh; display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; }
.hero-actions { display: flex; gap: 12px; margin-top: 30px; }
.status-panel { min-width: 240px; padding: 22px; display: flex; gap: 14px; align-items: center; border: 1px solid var(--border); background: rgba(16, 26, 23, .84); }
.status-panel small, .status-panel strong { display: block; }
.status-panel small { margin-top: 4px; color: var(--muted); }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--success); box-shadow: 0 0 22px var(--success); }

.button { min-height: 42px; padding: 10px 18px; display: inline-flex; justify-content: center; align-items: center; border: 1px solid transparent; border-radius: 5px; text-decoration: none; font: inherit; font-weight: 700; cursor: pointer; }
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-secondary { background: transparent; border-color: var(--border); color: var(--text); }
.button-block { width: 100%; }

.login-shell { min-height: 64vh; display: grid; grid-template-columns: 1fr minmax(320px, 440px); gap: clamp(40px, 10vw, 150px); align-items: center; }
.login-copy p { color: var(--muted); max-width: 520px; font-size: 1.05rem; }
.form-card, .table-panel, .center-card { border: 1px solid var(--border); background: rgba(16, 26, 23, .93); box-shadow: 0 24px 80px rgba(0, 0, 0, .22); }
.form-card { padding: 28px; display: grid; gap: 10px; }
.form-card label { margin-top: 8px; color: var(--muted); font-size: .82rem; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid var(--border); border-radius: 4px; background: #091310; color: var(--text); padding: 12px 13px; font: inherit; }
input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); border-color: var(--accent); }
.validation-summary, .field-error { color: var(--danger); font-size: .84rem; }
.validation-summary:empty, .field-error:empty { display: none; }
.field-hint { color: var(--muted); }
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: 18px; height: 18px; }

.center-card { width: min(580px, 100%); margin: 6vh auto; padding: 48px; text-align: center; }
.center-card h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
.center-card p { color: var(--muted); }
.success-mark { width: 54px; height: 54px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 50%; background: var(--success); color: #082417; font-size: 1.5rem; font-weight: 900; }
code { color: var(--accent); font-family: "Cascadia Mono", Consolas, monospace; }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 34px; }
.page-heading h1 { font-size: clamp(2.2rem, 5vw, 4.2rem); margin-bottom: 12px; }
.page-heading p { color: var(--muted); margin: 0; }
.admin-identity { min-width: 190px; padding: 16px 18px; border-left: 2px solid var(--accent); background: var(--surface); }
.admin-identity small, .admin-identity strong { display: block; }
.admin-identity small { color: var(--muted); margin-bottom: 4px; }

.alert { margin-bottom: 20px; padding: 13px 16px; border-left: 3px solid; background: var(--surface); }
.alert-success { border-color: var(--success); }
.alert-error { border-color: var(--danger); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); margin-bottom: 24px; }
.metrics div { padding: 18px 22px; border-right: 1px solid var(--border); }
.metrics div:last-child { border-right: 0; }
.metrics strong { display: block; font-size: 1.65rem; }
.metrics span { color: var(--muted); font-size: .82rem; }

.workspace-grid { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 24px; align-items: start; }
.entitlement-form { position: sticky; top: 20px; }
.table-panel { min-width: 0; }
.search-row { padding: 18px; display: grid; grid-template-columns: 1fr auto; gap: 10px; border-bottom: 1px solid var(--border); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
td small { display: block; margin-top: 5px; color: var(--muted); }
.note-cell { max-width: 260px; color: var(--muted); }
.badge { display: inline-flex; padding: 4px 7px; border-radius: 3px; font-size: .69rem; font-weight: 900; letter-spacing: .08em; }
.badge-active { color: #052416; background: var(--success); }
.badge-inactive { color: #2a0808; background: var(--danger); }
.danger-button { border: 0; background: transparent; color: var(--danger); cursor: pointer; font: inherit; font-weight: 700; }
.empty-state { padding: 46px; color: var(--muted); text-align: center; }

@media (max-width: 900px) {
    .hero-shell, .login-shell, .workspace-grid { grid-template-columns: 1fr; }
    .hero-shell { align-content: center; }
    .status-panel { width: 100%; }
    .entitlement-form { position: static; }
    .page-heading { align-items: start; flex-direction: column; }
    .admin-identity { width: 100%; }
}

@media (max-width: 600px) {
    .site-header, .site-footer, .page-shell { width: min(100% - 24px, 1440px); }
    .site-header nav { gap: 12px; }
    .page-shell { padding-top: 34px; }
    .metrics { grid-template-columns: 1fr; }
    .metrics div { border-right: 0; border-bottom: 1px solid var(--border); }
    .metrics div:last-child { border-bottom: 0; }
    .hero-actions { flex-direction: column; }
    .center-card { padding: 30px 20px; }
}
