:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: #121923;
  --surface-2: #18212d;
  --line: #283545;
  --text: #edf4fb;
  --muted: #9fb0c2;
  --primary: #62d6a5;
  --primary-dark: #0f3d30;
  --blue: #70b7ff;
  --warn: #f4c96b;
  --danger: #ff7e8d;
  --radius: 18px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 10% 0, #142737 0, transparent 34rem), var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.site-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 12px clamp(18px, 4vw, 56px); border-bottom: 1px solid rgba(159, 176, 194, .16); background: rgba(11, 15, 20, .84); backdrop-filter: blur(18px); }
.brand { display: flex; gap: 12px; align-items: center; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #09251c; background: linear-gradient(135deg, var(--primary), #9debd0); font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: var(--muted); }
.session-summary { display: flex; align-items: center; gap: 12px; }

main { width: min(1420px, calc(100% - 36px)); margin: 0 auto; padding: 42px 0 64px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(2rem, 4vw, 3.7rem); line-height: 1.05; letter-spacing: -.04em; }
h2 { margin-bottom: 8px; font-size: 1.25rem; }
.eyebrow { margin-bottom: 8px; color: var(--primary); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.65; }

.auth-layout { min-height: calc(100vh - 210px); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .65fr); gap: clamp(36px, 8vw, 110px); align-items: center; }
.auth-copy { max-width: 760px; }
.auth-copy > p:not(.eyebrow) { max-width: 690px; color: #bcc9d7; font-size: 1.08rem; line-height: 1.8; }
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0; list-style: none; }
.feature-list li { padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; color: #cbd7e3; background: rgba(18, 25, 35, .64); }
.feature-list li::before { content: "✓"; margin-right: 9px; color: var(--primary); font-weight: 900; }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(24, 33, 45, .94), rgba(15, 22, 31, .96)); box-shadow: 0 22px 70px rgba(0, 0, 0, .2); }
.auth-card, .stack { display: grid; gap: 18px; padding: clamp(24px, 4vw, 36px); }
label { display: grid; gap: 7px; color: #dce6ef; font-size: .92rem; font-weight: 650; }
label small { color: var(--muted); font-weight: 400; line-height: 1.5; }
input, select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #354659; border-radius: 10px; outline: none; color: var(--text); background: #0d141d; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(98, 214, 165, .15); }

.button { min-height: 42px; padding: 9px 15px; border: 1px solid transparent; border-radius: 10px; color: var(--text); background: transparent; font-weight: 750; }
.button:disabled { cursor: wait; opacity: .55; }
.button.primary { color: #082219; background: var(--primary); }
.button.secondary { border-color: #3d5369; background: #1d2a38; }
.button.ghost { border-color: var(--line); }
.button.danger { border-color: rgba(255, 126, 141, .5); color: #ffc2c9; background: rgba(112, 25, 39, .28); }
.button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }

.notice { position: fixed; z-index: 30; top: 82px; left: 50%; width: min(680px, calc(100% - 32px)); transform: translateX(-50%); padding: 13px 16px; border: 1px solid rgba(98, 214, 165, .45); border-radius: 12px; color: #dffbed; background: rgba(13, 55, 43, .96); box-shadow: 0 18px 60px #0008; }
.notice.error { border-color: rgba(255, 126, 141, .5); color: #ffe1e5; background: rgba(76, 22, 31, .97); }

.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.page-heading { margin-bottom: 28px; }
.page-heading h1 { font-size: clamp(2rem, 3vw, 3rem); }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: rgba(18, 25, 35, .78); }
.metric strong { display: block; margin-top: 6px; font-size: 1.9rem; }
.metric span { color: var(--muted); font-size: .83rem; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .8fr); gap: 18px; margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fixed-role-note { display: grid; gap: 5px; padding: 12px 14px; border: 1px solid #355242; border-radius: 10px; color: #d8eee5; background: rgba(20, 65, 48, .28); }
.fixed-role-note span { color: var(--muted); font-size: .82rem; line-height: 1.55; }
.invite-result { display: grid; align-content: start; gap: 18px; padding: clamp(24px, 4vw, 36px); border-color: rgba(98, 214, 165, .42); }
.invite-result code { display: block; overflow-wrap: anywhere; padding: 18px; border-radius: 12px; color: #c9ffea; background: #091510; font-size: 1.05rem; letter-spacing: .06em; }
.legacy-invite { padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: rgba(9, 15, 21, .55); }
.legacy-invite summary { cursor: pointer; color: #cbd7e3; font-size: .85rem; font-weight: 750; }
.legacy-invite[open] summary { margin-bottom: 12px; }
.legacy-invite .muted { margin-bottom: 10px; font-size: .8rem; }
.legacy-invite code { padding: 12px; font-size: .82rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }

.table-card { margin-top: 18px; overflow: hidden; }
.table-card .section-heading { padding: 22px 24px 12px; }
.count-pill, .status { display: inline-flex; align-items: center; width: max-content; min-height: 28px; padding: 4px 9px; border-radius: 999px; color: #c8d5e1; background: #263545; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.status.ok { color: #b9f7dc; background: #174537; }
.status.warn { color: #ffe9ac; background: #4f3e17; }
.status.error { color: #ffd0d6; background: #552531; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { min-width: 115px; padding: 14px 16px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .78rem; letter-spacing: .03em; }
td strong, td small { display: block; }
td small { max-width: 300px; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
td .button { min-height: 34px; padding: 6px 10px; font-size: .8rem; }
.empty-row { padding: 28px; color: var(--muted); text-align: center; }

.security-banner { display: grid; gap: 7px; margin-bottom: 18px; padding: 18px 20px; border: 1px solid rgba(98, 214, 165, .35); border-radius: 14px; background: rgba(17, 67, 52, .28); }
.security-banner span { color: #b9cabc; line-height: 1.6; }
.password-card { display: grid; grid-template-columns: minmax(220px, .55fr) minmax(0, 1fr); gap: 28px; margin-top: 18px; padding: 24px; }
.password-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
footer { padding: 24px; border-top: 1px solid rgba(159, 176, 194, .12); color: #77889a; text-align: center; font-size: .82rem; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .password-card { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  main { width: min(100% - 24px, 1420px); padding-top: 26px; }
  .site-header { padding-inline: 12px; }
  .session-summary #current-user { display: none; }
  .auth-layout { grid-template-columns: 1fr; align-content: start; }
  .auth-copy { padding-top: 20px; }
  .feature-list, .metric-grid, .field-row, .password-form { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; }
  .page-heading .button { white-space: nowrap; }
  h1 { font-size: 2.25rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .button { transition: transform .16s ease, filter .16s ease; }
}
