:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  --bg: #0b1218;
  --surface: #101922;
  --panel: #15212b;
  --panel-2: #192733;
  --ink: #edf4f7;
  --muted: #879aa7;
  --line: #263642;
  --line-strong: #38505f;
  --amber: #f2b84b;
  --green: #4ed2a0;
  --cyan: #4ccbd2;
  --danger: #d85d62;
  --shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(76, 203, 210, .06), transparent 28rem),
    linear-gradient(rgba(255,255,255,.013) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.013) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 28px 28px, 28px 28px, auto;
}

.header {
  max-width: 1040px;
  margin: auto;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 900; letter-spacing: 1.8px; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .55px; text-transform: uppercase; }
.mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; color: #111920; background: #f2f5f6; font-size: 24px; font-weight: 950; }
.badge { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid #285540; border-radius: 6px; color: var(--green); background: rgba(78,210,160,.05); font-size: 9px; font-weight: 900; letter-spacing: 1px; }
.badge i, .system-line i, .command-strip i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }

main { width: 100%; max-width: 984px; margin: 28px auto 54px; padding: 0 20px; }
h1 { margin: 7px 0 16px; font-size: 34px; line-height: 1.12; letter-spacing: -1px; }
h2 { margin: 0 0 17px; font-size: 22px; letter-spacing: -.3px; }
h3 { margin: 0 0 11px; font-size: 16px; }
p, li { font-size: 14px; line-height: 1.65; }
p { margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow { margin-bottom: 12px; color: var(--cyan); font-size: 9px; font-weight: 900; letter-spacing: 1.8px; text-transform: uppercase; }

.card { width: 100%; min-width: 0; margin-bottom: 18px; padding: 28px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg, rgba(25,39,51,.96), rgba(18,29,38,.98)); box-shadow: var(--shadow); }
.loading-card { max-width: 620px; margin: 70px auto; }
.hero { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 34px; align-items: center; width: 100%; min-width: 0; margin-bottom: 20px; padding: 36px; border: 1px solid var(--line-strong); border-radius: 16px; background: linear-gradient(135deg, #14212b, #0f181f); box-shadow: var(--shadow); }
.hero p { color: #a9b8c1; }
.home-hero { position: relative; overflow: hidden; }
.home-hero:after { content: ""; position: absolute; right: -70px; bottom: -100px; width: 260px; height: 260px; border: 1px solid rgba(76,203,210,.13); border-radius: 50%; box-shadow: 0 0 0 35px rgba(76,203,210,.025), 0 0 0 70px rgba(76,203,210,.018); pointer-events: none; }
.system-line { display: flex; gap: 22px; margin-top: 23px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.system-line span { display: flex; align-items: center; gap: 7px; }
.metric, .score { position: relative; z-index: 1; min-width: 145px; text-align: center; }
.metric { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.metric b, .score b { display: inline-block; color: var(--amber); font-size: 54px; line-height: 1; letter-spacing: -3px; }
.metric span, .metric small, .score small { display: block; margin-top: 8px; color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: 1.2px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid > * { min-width: 0; }
.wide { grid-column: 1 / -1; }
.nested { margin-top: 18px; }
.field { display: block; margin-bottom: 17px; color: #bdc9d0; font-size: 11px; font-weight: 750; letter-spacing: .25px; }
.field input, .field select, .filters input, .filters select { display: block; width: 100%; min-height: 46px; margin-top: 8px; padding: 12px 13px; border: 1px solid var(--line-strong); border-radius: 7px; outline: none; color: var(--ink); background: #0f181f; font: inherit; font-size: 13px; }
.field input:focus, .field select:focus, .filters input:focus, .filters select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(76,203,210,.11); }
.field input::placeholder, .filters input::placeholder { color: #627681; }
details { margin: 2px 0 10px; }
summary { color: var(--cyan); cursor: pointer; font-size: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 15px 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.check input { width: 18px; height: 18px; flex: none; accent-color: var(--amber); }

button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 12px 18px; border: 0; border-radius: 7px; color: #111820; background: var(--amber); font-size: 12px; font-weight: 900; text-decoration: none; cursor: pointer; transition: transform .12s, background .12s, border-color .12s; }
button:hover, .button:hover { background: #ffc75c; }
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .38; cursor: not-allowed; }
.secondary, .button.secondary { color: var(--ink); background: #1b2a35; border: 1px solid var(--line-strong); }
.secondary:hover, .button.secondary:hover { background: #243542; }
.danger { color: #fff; background: var(--danger); }
.link-button { min-height: auto; padding: 6px; color: var(--cyan); background: transparent; }
.link-button:hover { background: transparent; color: #78e2e7; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }

.history > div { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.history a { color: var(--amber); font-weight: 800; }
.command-strip { display: flex; justify-content: space-between; margin-bottom: 14px; color: var(--muted); font-family: Consolas, monospace; font-size: 8px; letter-spacing: 1px; }
.command-strip span { display: flex; align-items: center; gap: 7px; }
.test-shell { max-width: 780px; margin: auto; }
.test-head, .question-meta { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.test-head { margin-bottom: 12px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.test-head h2 { margin: 0; }
.test-indicators { display: flex; gap: 30px; align-items: flex-end; text-align: right; }
.test-indicators small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: 1px; }
.test-count b { color: var(--cyan); font-size: 24px; }
.test-count b span { color: var(--muted); font-size: 10px; }
.timer { color: var(--amber); font: 850 21px/1 Consolas, monospace; font-variant-numeric: tabular-nums; }
.progress { height: 5px; margin: 17px 0; overflow: hidden; border-radius: 5px; background: #22323d; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green)); box-shadow: 0 0 12px rgba(76,203,210,.3); }
.question-meta { margin-bottom: 12px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .7px; text-transform: uppercase; }
.question { border-top: 3px solid var(--amber); }
.question h1 { max-width: 700px; font-size: 25px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0; }
.option { display: flex; align-items: center; gap: 12px; min-height: 58px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 7px; color: #d5e0e5; background: #111b23; cursor: pointer; font-size: 13px; line-height: 1.45; }
.option:hover, .option.selected { border-color: var(--cyan); color: #fff; background: rgba(76,203,210,.07); box-shadow: inset 3px 0 var(--cyan); }
.option input { width: 17px; height: 17px; flex: none; accent-color: var(--cyan); }
.save-state { color: var(--muted); font-size: 10px; }
.question .actions { justify-content: flex-end; }

.result-hero { grid-template-columns: minmax(220px,.75fr) minmax(360px,1.25fr); align-items: stretch; }
.result-heading { display: flex; flex-direction: column; justify-content: center; }
.result-heading h1 { font-size: 27px; }
.score-panel { display: grid; grid-template-columns: 120px 1fr; gap: 22px; align-items: center; padding: 20px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.score { display: flex; flex-wrap: wrap; align-items: baseline; align-content: center; min-height: 122px; padding-right: 20px; border-right: 1px solid var(--line); }
.score span { color: var(--muted); font-size: 15px; }
.score small { width: 100%; }
.result-bars { display: grid; gap: 16px; }
.result-bars i { position: relative; display: block; height: 5px; margin-top: 12px; background: linear-gradient(90deg, var(--green) var(--value), #2a3945 var(--value)); }
.result-bars span { position: absolute; bottom: 8px; left: 0; overflow: hidden; max-width: 76%; color: var(--muted); font-size: 8px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.result-bars b { position: absolute; right: 0; bottom: 8px; color: #b8c5cc; font-size: 8px; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.status { display: inline-block; margin-bottom: 12px; padding: 5px 8px; border-radius: 4px; font-size: 8px; font-weight: 900; letter-spacing: .65px; text-transform: uppercase; }
.status.ok { color: var(--green); border: 1px solid #285540; background: rgba(78,210,160,.06); }
.status.warn { color: var(--amber); border: 1px solid #634f29; background: rgba(242,184,75,.07); }
.section-score { margin: 8px 0 14px; color: var(--amber); font-size: 28px; font-weight: 900; }

#notice { position: fixed; z-index: 20; left: 50%; bottom: 24px; max-width: calc(100vw - 32px); padding: 13px 18px; border: 1px solid var(--line-strong); border-radius: 7px; color: #fff; background: #17252f; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 20px); transition: .2s; font-size: 12px; }
#notice.show { opacity: 1; transform: translate(-50%, 0); }
body > footer { display: flex; justify-content: space-between; max-width: 984px; margin: 20px auto; padding: 20px; border-top: 1px solid var(--line); color: var(--muted); font: 8px/1.4 Consolas, monospace; letter-spacing: .6px; }
.error-text { color: #ff8e91; }

table { width: 100%; border-collapse: collapse; font-size: 11px; }
th, td { padding: 12px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 8px; letter-spacing: .8px; text-transform: uppercase; }
td small { display: block; margin-top: 4px; color: var(--muted); }
.scroll { overflow: auto; }

.admin-body { display: grid; grid-template-columns: 250px 1fr; background: var(--bg); }
.admin-nav { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; width: 250px; padding: 24px 18px; border-right: 1px solid var(--line); color: #fff; background: #0d151c; }
.admin-nav .mark { color: #111920; background: #f2f5f6; }
.admin-nav .brand small, .nav-user small { color: var(--muted); }
.admin-nav nav { display: grid; gap: 5px; margin-top: 35px; }
.admin-nav nav button { justify-content: flex-start; color: #9fb0ba; background: transparent; font-weight: 650; }
.admin-nav nav button.active, .admin-nav nav button:hover { color: var(--ink); background: #182630; box-shadow: inset 3px 0 var(--amber); }
.nav-user { display: grid; gap: 5px; margin-top: auto; }
.nav-user .link-button { justify-content: flex-start; color: var(--cyan); }
.admin-main { max-width: none; margin: 0 0 40px 250px; padding: 32px 38px; }
.admin-main > header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.admin-main > header h1 { margin: 0; }
.metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 20px; }
.metrics article { position: relative; overflow: hidden; padding: 24px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.metrics article:after { content: ""; position: absolute; right: 0; bottom: 0; width: 70%; height: 3px; background: linear-gradient(90deg, transparent, var(--green)); }
.metrics b { display: block; color: var(--amber); font-size: 36px; }
.metrics span { color: var(--muted); font-size: 10px; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 10px; margin-bottom: 18px; }
.filters input, .filters select { margin: 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 15px; margin-top: 18px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 35px; }
dl { display: grid; grid-template-columns: 140px 1fr; margin: 0; font-size: 11px; }
dt, dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
dt { color: var(--muted); }
dd { overflow-wrap: anywhere; }
.role-row { display: grid; grid-template-columns: 160px repeat(5,auto) auto; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.login-wrap { display: grid; place-items: center; max-width: none; height: 100vh; }
.login-card { width: min(420px,calc(100vw - 32px)); }
.login-card .brand { margin-bottom: 30px; }
.loading { padding: 60px; color: var(--muted); text-align: center; }

@media (max-width: 800px) {
  .header { padding: 16px 18px; }
  .brand { font-size: 13px; }
  .brand small { font-size: 8px; }
  .mark { width: 38px; height: 38px; font-size: 21px; }
  main { margin-top: 16px; padding: 0 12px; }
  h1 { font-size: 29px; }
  .hero, .result-hero, .result-grid, .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .hero { padding: 24px; }
  .metric { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: baseline; text-align: left; }
  .metric small, .metric span { display: inline; }
  .metric b { font-size: 42px; }
  .card { padding: 21px; }
  .options { grid-template-columns: 1fr; }
  .test-head { align-items: flex-start; padding: 16px; }
  .test-indicators { gap: 18px; }
  .test-head h2 { font-size: 18px; }
  .question h1 { font-size: 21px; }
  .score-panel { grid-template-columns: 95px 1fr; gap: 14px; padding: 14px; }
  .score { min-height: 110px; padding-right: 13px; }
  .score b { font-size: 46px; }
  .actions > * { flex: 1; }
  body > footer { padding: 16px; }
  .admin-body { display: block; }
  .admin-nav { position: static; width: auto; min-height: auto; }
  .admin-nav nav { grid-template-columns: 1fr 1fr; margin: 20px 0; }
  .nav-user { margin-top: 15px; }
  .admin-main { margin: 0; padding: 22px 14px; }
  .metrics, .filters { grid-template-columns: 1fr; }
  .role-row { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
  .header { gap: 10px; }
  .header .brand { min-width: 0; letter-spacing: 1.2px; }
  .badge { flex: 0 0 auto; padding: 6px 8px; font-size: 8px; }
  .header .brand small { max-width: 120px; white-space: normal; }
  .home-hero h1 { font-size: 28px; }
  .system-line { flex-wrap: wrap; }
  .test-indicators { display: grid; gap: 8px; }
  .score-panel { grid-template-columns: 1fr; }
  .score { min-height: auto; padding: 0 0 13px; border-right: 0; border-bottom: 1px solid var(--line); }
  .result-heading h1 { font-size: 24px; }
}
