:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --bg: #080b12;
  --bg-soft: #0d111b;
  --panel: rgba(17, 22, 34, .86);
  --panel-strong: #121827;
  --panel-hover: #171e30;
  --line: rgba(255,255,255,.095);
  --line-strong: rgba(255,255,255,.16);
  --text: #f7f8fb;
  --muted: #9ba6ba;
  --muted-2: #6f7b91;
  --accent: #8b7cff;
  --accent-2: #50a7ff;
  --accent-soft: rgba(139,124,255,.14);
  --success: #4fd1a5;
  --success-soft: rgba(79,209,165,.12);
  --danger: #ff7188;
  --danger-soft: rgba(255,113,136,.12);
  --warning: #f3bc68;
  --shadow: 0 26px 70px rgba(0,0,0,.34);
  --radius: 22px;
  --radius-sm: 14px;
}
* { box-sizing:border-box; }
html { min-height:100%; background:var(--bg); }
body {
  margin:0;
  min-height:100vh;
  color:var(--text);
  background:
    radial-gradient(circle at 18% -12%, rgba(80,167,255,.16), transparent 34rem),
    radial-gradient(circle at 88% 0%, rgba(139,124,255,.16), transparent 31rem),
    linear-gradient(180deg,#090c14 0%,#080b12 48%,#070910 100%);
}
a { color:#b8b0ff; text-decoration:none; }
a:hover { color:#d3ceff; }
button, input, select, textarea { font:inherit; }
button, .button-link { transition:transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease; }
button:hover:not(:disabled), .button-link:hover { transform:translateY(-1px); }
button:disabled { opacity:.58; cursor:wait; }
.shell { max-width:1180px; margin:0 auto; padding:22px 28px 56px; }
.site-header {
  height:58px; display:flex; align-items:center; justify-content:space-between; gap:20px;
  margin-bottom:28px;
}
.brand { display:inline-flex; align-items:center; gap:11px; color:var(--text); font-weight:760; letter-spacing:-.02em; }
.brand:hover { color:var(--text); }
.brand-mark { width:32px; height:32px; border-radius:10px; display:grid; place-items:center; color:white;
  background:linear-gradient(145deg,var(--accent-2),var(--accent)); box-shadow:0 9px 24px rgba(98,116,255,.28); }
.brand-mark svg { width:18px; height:18px; }
.header-user { display:flex; align-items:center; gap:10px; color:var(--muted); font-size:14px; }
.header-user .avatar { width:30px; height:30px; border-radius:50%; display:grid; place-items:center; font-size:12px; font-weight:800; color:#fff; background:#222a3c; border:1px solid var(--line); }
.card {
  background:linear-gradient(180deg,rgba(20,25,39,.92),rgba(14,18,29,.92));
  border:1px solid var(--line); border-radius:var(--radius); padding:26px;
  box-shadow:0 1px 0 rgba(255,255,255,.02), var(--shadow);
  backdrop-filter:blur(16px);
}
h1,h2,h3,p { margin-top:0; }
h1 { font-size:clamp(34px,4vw,48px); line-height:1.03; letter-spacing:-.045em; margin-bottom:12px; }
h2 { font-size:22px; letter-spacing:-.025em; }
.muted, small { color:var(--muted); }
.eyebrow { font-size:11px; font-weight:850; letter-spacing:.16em; text-transform:uppercase; color:#8fa1bd; margin-bottom:8px; }
.pill { display:inline-flex; align-items:center; gap:7px; padding:6px 10px; border-radius:999px; background:#171d2b; border:1px solid var(--line); color:#bdc5d5; font-size:12px; font-weight:700; }
.pill.success { background:var(--success-soft); color:#8be3c6; border-color:rgba(79,209,165,.22); }
.pill.admin { background:var(--accent-soft); color:#c5bdff; border-color:rgba(139,124,255,.26); }
.status-dot { width:7px; height:7px; border-radius:50%; background:currentColor; box-shadow:0 0 0 4px rgba(255,255,255,.03); }
label { display:block; margin:14px 0; font-size:13px; font-weight:720; color:#c5ccda; }
input,select,textarea {
  width:100%; margin-top:7px; padding:12px 13px; border-radius:12px;
  border:1px solid var(--line-strong); background:#0c111c; color:var(--text); outline:none;
}
input:focus,select:focus,textarea:focus { border-color:rgba(139,124,255,.72); box-shadow:0 0 0 3px rgba(139,124,255,.13); }
textarea { resize:vertical; }
button, .button-link {
  border:1px solid var(--line-strong); border-radius:12px; background:#171d2b; color:var(--text);
  padding:11px 15px; cursor:pointer; font-weight:730;
}
button:hover:not(:disabled), .button-link:hover { background:#1d2537; border-color:rgba(255,255,255,.22); color:white; }
button.primary { background:linear-gradient(135deg,#6b8cff,#8b6fff); border:0; color:white; box-shadow:0 12px 30px rgba(108,112,255,.23); }
button.primary:hover:not(:disabled) { box-shadow:0 15px 34px rgba(108,112,255,.31); }
button.danger { color:#ff9aac; border-color:rgba(255,113,136,.25); background:var(--danger-soft); }
.error { padding:11px 13px; border-radius:12px; color:#ff9bad; background:var(--danger-soft); border:1px solid rgba(255,113,136,.22); }
.divider { display:flex; align-items:center; gap:13px; margin:23px 0; color:var(--muted-2); font-size:12px; text-transform:uppercase; letter-spacing:.1em; }
.divider::before,.divider::after { content:""; flex:1; height:1px; background:var(--line); }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.check-label { display:flex; align-items:center; gap:10px; padding-top:28px; }
.check-label input { width:auto; margin:0; }
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th,td { text-align:left; padding:13px 12px; border-bottom:1px solid var(--line); vertical-align:top; }
th { font-size:11px; text-transform:uppercase; letter-spacing:.09em; color:#77839a; }
tr:last-child td { border-bottom:0; }
code,pre { font-family:"SFMono-Regular",Consolas,"Liberation Mono",monospace; }
code { color:#cbd3e4; }
pre { white-space:pre-wrap; overflow-wrap:anywhere; padding:15px; background:#090d15; border:1px solid var(--line); border-radius:12px; }
.break { overflow-wrap:anywhere; }

/* Login / authentication */
.auth-page { min-height:calc(100vh - 112px); display:grid; place-items:center; padding:24px 0 56px; }
.auth-wrap { width:min(100%,470px); }
.auth-brand { display:flex; flex-direction:column; align-items:center; text-align:center; margin-bottom:24px; }
.auth-logo { width:58px; height:58px; border-radius:18px; display:grid; place-items:center; margin-bottom:16px; color:white;
  background:linear-gradient(145deg,#55adff,#8a72ff); box-shadow:0 18px 46px rgba(91,111,255,.28); }
.auth-logo svg { width:31px; height:31px; }
.auth-brand h1 { font-size:34px; margin:0 0 8px; }
.auth-brand p { margin:0; color:var(--muted); line-height:1.5; }
.auth-card { padding:28px; }
.auth-context { display:flex; align-items:center; gap:10px; padding:11px 13px; margin-bottom:20px; border-radius:13px; background:#0d1422; border:1px solid var(--line); color:#bac4d6; font-size:13px; }
.auth-context-icon { width:28px; height:28px; border-radius:9px; display:grid; place-items:center; background:var(--accent-soft); color:#b7adff; flex:0 0 auto; }
.passkey-button { width:100%; min-height:72px; display:flex; align-items:center; justify-content:flex-start; gap:15px; padding:15px 17px; text-align:left; border:1px solid rgba(139,124,255,.35); background:linear-gradient(135deg,rgba(69,111,255,.19),rgba(139,93,255,.17)); }
.passkey-button:hover:not(:disabled) { background:linear-gradient(135deg,rgba(69,111,255,.26),rgba(139,93,255,.23)); border-color:rgba(139,124,255,.56); }
.passkey-icon { width:43px; height:43px; border-radius:13px; display:grid; place-items:center; color:#fff; background:linear-gradient(145deg,#568eff,#8b6eff); box-shadow:0 8px 20px rgba(89,95,255,.23); flex:0 0 auto; }
.passkey-icon svg { width:23px; height:23px; }
.passkey-copy { display:flex; flex-direction:column; gap:2px; }
.passkey-copy strong { font-size:16px; }
.passkey-copy span { color:#aeb8cb; font-size:12px; font-weight:500; }
.password-panel { margin-top:0; }
.password-panel button[type=submit] { width:100%; margin-top:5px; }
.auth-status { min-height:20px; margin:14px 0 0; font-size:13px; text-align:center; color:var(--muted); }
.auth-footer { margin-top:17px; display:flex; justify-content:center; gap:8px; align-items:center; color:#68758b; font-size:12px; }
.auth-footer svg { width:14px; height:14px; }

/* App shell / home */
.dashboard-hero { display:flex; justify-content:space-between; align-items:flex-end; gap:24px; margin-bottom:22px; }
.dashboard-hero h1 { margin-bottom:7px; }
.role-row { display:flex; flex-wrap:wrap; gap:8px; }
.app-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.app-tile { padding:18px; border-radius:17px; border:1px solid var(--line); background:#0d121e; }
.app-tile strong { display:block; margin-bottom:5px; }
.quick-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:22px; }

/* Admin */
.admin-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:20px; }
.admin-head h1 { margin:0 0 7px; }
.stat-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-bottom:18px; }
.stat-card { position:relative; overflow:hidden; display:flex; flex-direction:column; gap:6px; padding:20px; border:1px solid var(--line); border-radius:18px; background:linear-gradient(180deg,#131927,#0f1420); color:inherit; text-decoration:none; }
.stat-card::after { content:""; position:absolute; width:100px; height:100px; right:-38px; top:-42px; border-radius:50%; background:rgba(124,109,255,.1); }
.stat-card strong { font-size:34px; letter-spacing:-.04em; }
.stat-card small { color:#79859b; }
.section-title { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:14px; }
.section-title h2 { margin:0; }
.user-card { margin-top:16px; }
.mini-stats { display:flex; gap:18px; margin:12px 0; color:var(--muted); }
details { margin-top:16px; border-top:1px solid var(--line); padding-top:14px; }
summary { cursor:pointer; font-weight:730; color:#c8d0df; }
.compact-form { margin-top:12px; }
.secret-card { border-color:rgba(139,124,255,.36); background:linear-gradient(180deg,rgba(61,52,112,.22),rgba(14,18,29,.92)); margin-bottom:16px; }
.hint { margin-bottom:0; font-size:13px; color:var(--muted); }
.setup-card { max-width:760px; margin:40px auto 0; }
.key-list { margin:10px 0 16px; border:1px solid var(--line); border-radius:14px; overflow:hidden; }
.key-row { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:13px 14px; border-bottom:1px solid var(--line); background:#0d121d; }
.key-row:last-child { border-bottom:0; }
.event-badge { display:inline-flex; align-items:center; gap:6px; padding:5px 8px; border-radius:9px; background:#141b29; color:#b9c3d6; font-family:"SFMono-Regular",Consolas,monospace; font-size:12px; }
.event-badge.success { color:#8de0c5; background:var(--success-soft); }
.event-badge.security { color:#c6bdff; background:var(--accent-soft); }
.empty-state { padding:26px; text-align:center; color:var(--muted); border:1px dashed var(--line-strong); border-radius:16px; background:#0c1019; }

@media (max-width:760px) {
  .shell { padding:16px 16px 40px; }
  .site-header { margin-bottom:16px; }
  .stat-grid,.form-grid,.app-grid { grid-template-columns:1fr; }
  .admin-head,.dashboard-hero { flex-direction:column; align-items:flex-start; }
  .check-label { padding-top:0; }
  .key-row { align-items:flex-start; flex-direction:column; }
  .auth-page { min-height:calc(100vh - 90px); padding-top:10px; }
  .auth-card { padding:22px; }
}

/* Central SSO logout */
.logout-page .auth-wrap { width:min(100%,520px); }
.logout-page .auth-brand { margin-bottom:20px; }
.logout-logo { margin-bottom:13px; }
.logout-status-badge {
  display:inline-flex; align-items:center; gap:8px; margin-bottom:14px; padding:7px 11px;
  border-radius:999px; color:#8be3c6; background:var(--success-soft);
  border:1px solid rgba(79,209,165,.22); font-size:12px; font-weight:780;
}
.logout-status-badge .status-dot { width:7px; height:7px; }
.logout-page .auth-brand p { max-width:460px; }
.logout-page .auth-brand p strong { color:#c8d0df; }
.logout-card { text-align:center; padding:30px; }
.logout-check {
  width:52px; height:52px; margin:0 auto 18px; border-radius:16px; display:grid; place-items:center;
  color:#8be3c6; background:var(--success-soft); border:1px solid rgba(79,209,165,.22);
  box-shadow:0 14px 34px rgba(31,145,111,.12);
}
.logout-check svg { width:27px; height:27px; }
.logout-copy h2 { margin-bottom:8px; font-size:21px; }
.logout-copy p { max-width:390px; margin:0 auto; color:var(--muted); line-height:1.55; font-size:14px; }
.logout-actions { display:grid; gap:10px; margin-top:24px; }
.logout-actions .button-link { width:100%; min-height:48px; display:flex; align-items:center; justify-content:center; gap:10px; }
.logout-primary {
  color:white; border-color:rgba(139,124,255,.35);
  background:linear-gradient(135deg,rgba(69,111,255,.34),rgba(139,93,255,.34));
  box-shadow:0 12px 30px rgba(108,112,255,.16);
}
.logout-primary:hover { color:white; background:linear-gradient(135deg,rgba(69,111,255,.44),rgba(139,93,255,.43)); border-color:rgba(139,124,255,.58); }
.logout-secondary { color:#c5ccda; background:#101624; }
