:root {
  --ink: #17152b;
  --muted: #6d6988;
  --line: rgba(23, 21, 43, 0.08);
  --primary: #5b46f5;
  --primary-2: #7c6cff;
  --primary-soft: #efeaff;
  --teal: #0e9f8f;
  --teal-soft: #e5f8f5;
  --coral: #ff6d4d;
  --amber: #f5a524;
  --surface: rgba(255, 255, 255, 0.78);
  --shadow: 0 18px 50px rgba(67, 56, 140, 0.12);
  --radius: 22px;
  --rail: 292px;
  --font: "Outfit", "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 480px at -10% -10%, #ddd6ff 0%, transparent 55%),
    radial-gradient(700px 420px at 110% 0%, #c8f6ef 0%, transparent 50%),
    radial-gradient(600px 400px at 80% 110%, #ffe4d8 0%, transparent 46%),
    #f4f5fb;
  overflow: hidden;
}
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
.app { display: grid; grid-template-columns: var(--rail) 1fr; height: 100%; }
.rail {
  margin: 16px 0 16px 16px;
  padding: 18px 14px;
  border-radius: 28px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 16px; }
.mark {
  width: 44px; height: 44px; border-radius: 16px;
  background: linear-gradient(145deg, #6d5ef7, #22c1b2);
  display: grid; place-items: center; color: white; font-weight: 700;
  box-shadow: 0 10px 24px rgba(91,70,245,.35);
}
.brand b { display: block; font-size: 18px; letter-spacing: -0.03em; }
.brand span { color: var(--muted); font-size: 12px; }
.nav { overflow: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 4px; }
.nav button {
  border: 0; background: transparent; text-align: left;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 16px; color: #3c3858; font-weight: 560; font-size: 14.5px;
  transition: transform .2s ease, background .2s ease, color .2s ease;
}
.nav button svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav button:hover { background: rgba(91,70,245,.08); transform: translateX(2px); }
.nav button.active {
  background: linear-gradient(90deg, #5b46f5, #7464f8);
  color: white;
  box-shadow: 0 10px 20px rgba(91,70,245,.28);
}
.role {
  margin-top: 12px; background: #f6f4ff; border-radius: 18px; padding: 10px;
}
.role label { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 2px 6px 6px; }
.role select, .top select, .field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: white; border-radius: 14px; padding: 10px 12px; color: var(--ink);
}
.stage { min-width: 0; display: flex; flex-direction: column; padding: 16px 16px 16px 14px; }
.top {
  display: flex; gap: 12px; align-items: center; margin-bottom: 14px;
}
.search {
  flex: 1; background: rgba(255,255,255,.75); border: 1px solid white; border-radius: 18px;
  padding: 12px 14px; box-shadow: 0 8px 24px rgba(67,56,140,.06);
}
.chip, .ghost, .primary, .soft {
  border: 0; border-radius: 14px; padding: 10px 14px; font-weight: 640;
}
.ghost { background: white; color: var(--ink); border: 1px solid var(--line); }
.primary { background: linear-gradient(180deg, #6d5ef7, #533cf0); color: white; box-shadow: 0 10px 22px rgba(91,70,245,.28); }
.soft { background: var(--primary-soft); color: #4636c8; }
.view { flex: 1; min-height: 0; overflow: auto; padding-right: 4px; }
.view-enter { animation: rise .45s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.hero, .card, .doc {
  background: var(--surface); border: 1px solid rgba(255,255,255,.85); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.hero { padding: 22px; display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 14px; overflow: hidden; position: relative; }
.hero:after {
  content: ""; position: absolute; right: -40px; top: -50px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(91,70,245,.28), transparent 68%);
}
.kicker { color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; letter-spacing: -0.04em; }
h1 { font-size: 34px; line-height: 1.05; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 12px; }
.card { padding: 16px 16px 14px; }
.stat b { display: block; font-size: 28px; margin-top: 6px; }
.stat span { color: var(--teal); font-size: 12px; font-weight: 700; }
.split { grid-template-columns: 1.4fr .8fr; }
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.row {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 12px; border-radius: 16px; background: white; border: 1px solid var(--line);
  animation: rise .5s both;
}
.row:nth-child(2) { animation-delay: .05s; }
.row:nth-child(3) { animation-delay: .1s; }
.row:nth-child(4) { animation-delay: .15s; }
.pill { font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 999px; background: var(--teal-soft); color: #0b7b6e; }
.pill.warn { background: #fff4df; color: #9a6408; }
.pill.hot { background: #ffe8e2; color: #c2412d; }
.pill.neutral { background: #f1f0f7; color: #5c5874; }
.toolbar { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 12px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 640; }
.field.full { grid-column: 1 / -1; }
.bars { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.bar { height: 10px; background: #eceaf6; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #5b46f5, #22c1b2); width: 0; animation: fill 1s ease forwards; }
@keyframes fill { to { width: var(--w); } }
.exam {
  display: grid; grid-template-columns: 220px 1fr; gap: 12px; min-height: 520px;
}
.qmap { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.qmap button, .alt {
  border: 1px solid var(--line); background: white; border-radius: 12px; padding: 10px;
}
.qmap button.on, .alt.on { border-color: #5b46f5; background: #efeaff; color: #3d2ed0; font-weight: 700; }
.timer { font-variant-numeric: tabular-nums; font-size: 28px; font-weight: 720; }
.timer.low { color: var(--coral); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.doc { padding: 28px; background: white; }
.doc h2 { font-family: var(--serif); font-weight: 560; font-size: 32px; }
.cert {
  border: 10px solid #efeaff; outline: 1px solid #d9d2ff; padding: 28px; text-align: center; background:
    radial-gradient(400px 160px at 50% 0%, #f4f0ff, transparent 70%), white;
}
.cert h2 { font-family: var(--serif); font-size: 40px; }
.modal {
  position: fixed; inset: 0; background: rgba(23,21,43,.42); display: none; place-items: center; padding: 20px; z-index: 20;
}
.modal.show { display: grid; animation: rise .25s ease; }
.modal .card { width: min(640px, 100%); background: white; }
.toast {
  position: fixed; right: 22px; bottom: 22px; background: #17152b; color: white; padding: 12px 14px; border-radius: 16px;
  transform: translateY(20px); opacity: 0; transition: .3s ease; z-index: 30;
}
.toast.show { opacity: 1; transform: none; }

.menu-btn { display: none; border: 0; background: white; border-radius: 14px; padding: 10px 12px; font-weight: 700; }
.backdrop { display: none; }
@media (max-width: 1100px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; height: auto; min-height: 100%; }
  .menu-btn { display: inline-flex; align-items: center; }
  .rail {
    position: fixed; z-index: 40; inset: 10px auto 10px 10px; width: min(320px, calc(100vw - 20px));
    margin: 0; max-height: none; transform: translateX(-115%); transition: transform .28s ease;
  }
  .rail.open { transform: none; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(23,21,43,.38); z-index: 35; }
  .stage { height: auto; padding: 12px; }
  .top { flex-wrap: wrap; }
  .search { min-width: 100%; order: 3; }
  .stats { grid-template-columns: 1fr 1fr; }
  .split, .exam, .form { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 28px; }
  .row { flex-wrap: wrap; }
  .view { overflow: visible; }
}
@media (max-width: 720px) {
  .stats, .qmap { grid-template-columns: 1fr 1fr; }
  .top select, .ghost, .primary { min-height: 44px; }
  .nav button { min-height: 44px; }
  .modal { padding: 10px; align-items: end; }
  .modal .card { width: 100%; max-height: 88vh; overflow: auto; }
  .toast { left: 12px; right: 12px; bottom: 12px; }
  .cert { padding: 16px; }
  .cert h2 { font-size: 30px; }
  .timer { font-size: 22px; }
}

.nav a { display:block; padding:11px 12px; border-radius:16px; color:#3c3858; text-decoration:none; font-weight:650; }
.nav a:hover { background:rgba(91,70,245,.08); }

.nav a { position: relative; overflow: hidden; transition: .25s ease; }
.nav a.active, .nav a:hover { background: linear-gradient(90deg,#5b46f5,#7464f8); color: white; transform: translateX(4px); }
.field input, .field textarea, .field select {
  border: 1.5px solid #e4e1f4; background: #fbfbfe; transition: border .2s ease, box-shadow .2s ease, transform .2s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: #5b46f5; box-shadow: 0 0 0 4px rgba(91,70,245,.15); transform: translateY(-1px);
}
.primary, .ghost { transition: transform .2s ease, box-shadow .2s ease; }
.primary:hover { transform: translateY(-2px); }
.card, .hero { animation: rise .45s ease both; }
