@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;600;700&family=Fira+Code:wght@400;500;600&display=swap');

:root {
  color-scheme: dark;
  --navy-950: #0b1220;
  --navy-900: #0f172a;
  --navy-800: #16233a;
  --navy-750: #1a2942;
  --ink: #f7fbff;
  --muted: #9fb0c6;
  --faint: #6f829b;
  --line: rgba(194, 216, 244, .16);
  --line-strong: rgba(194, 216, 244, .3);
  --blue: #7dd3fc;
  --blue-deep: #1e5c91;
  --green: #5ee0a0;
  --green-bg: rgba(40, 148, 100, .18);
  --amber: #f9c879;
  --amber-bg: rgba(176, 113, 30, .2);
  --red: #ffa8a8;
  --red-bg: rgba(176, 53, 53, .2);
  --radius: 11px;
  --shadow: 0 16px 44px rgba(0, 0, 0, .16);
}

* { box-sizing: border-box; }
html { background: var(--navy-950); }
body {
  margin: 0;
  min-width: 320px;
  background: var(--navy-900);
  color: var(--ink);
  font-family: "Fira Sans", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); }
a:hover { color: #bae6fd; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 254px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  padding: 24px 16px; border-right: 1px solid var(--line);
  background: #0c1627;
  display: flex; flex-direction: column; gap: 26px;
}
.brand { color: var(--ink); text-decoration: none; display: block; padding: 3px 10px; }
.brand-mark { display: flex; align-items: center; gap: 10px; font-family: "Fira Code", monospace; font-size: .77rem; color: var(--blue); }
.brand-mark::before { content: ""; display: block; width: 9px; height: 9px; background: var(--green); box-shadow: 0 0 0 4px rgba(94, 224, 160, .14); }
.brand strong { display: block; margin-top: 6px; font-size: 1.22rem; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); margin-top: 1px; font-size: .78rem; }

.nav { display: grid; gap: 3px; }
.nav a { color: var(--muted); text-decoration: none; min-height: 44px; padding: 10px 12px; border-left: 2px solid transparent; transition: color .18s ease, background .18s ease, border-color .18s ease; }
.nav a:hover { color: var(--ink); background: rgba(125, 211, 252, .07); }
.nav a.active { color: var(--ink); background: rgba(125, 211, 252, .10); border-left-color: var(--blue); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 14px; padding: 0 10px; }
.status-dot { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.status-dot::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; margin-top: 3px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(94, 224, 160, .12); }
.status-dot.is-error::before { background: var(--red); box-shadow: 0 0 0 3px rgba(255, 168, 168, .12); }
.logout-form { margin: 0; }
.text-button { width: 100%; border: 0; background: transparent; color: var(--muted); text-align: left; padding: 8px 0; cursor: pointer; }
.text-button:hover { color: var(--ink); }

.main { min-width: 0; }
.topbar { min-height: 78px; padding: 18px clamp(20px, 4vw, 56px); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; background: rgba(15, 23, 42, .92); }
.breadcrumb { color: var(--muted); font-size: .87rem; }
.topbar-status { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: .83rem; }
.topbar-status b { color: var(--ink); font-weight: 600; }
.main-inner { max-width: 1240px; margin: 0 auto; padding: 38px clamp(20px, 4vw, 56px) 64px; }
.page-heading { margin-bottom: 29px; }
h1 { margin: 0; max-width: 26ch; font-size: clamp(1.65rem, 3vw, 2.34rem); letter-spacing: -.035em; line-height: 1.08; }
.page-heading p { max-width: 65ch; color: var(--muted); margin: 10px 0 0; }

.flash { padding: 12px 15px; margin: 0 0 24px; border: 1px solid; border-radius: var(--radius); }
.flash.success { color: #b8f4d3; border-color: rgba(94, 224, 160, .42); background: var(--green-bg); }
.flash.error { color: #ffd0d0; border-color: rgba(255, 168, 168, .45); background: var(--red-bg); }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--navy-800); box-shadow: var(--shadow); }
.panel > .panel-header { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.panel-title { margin: 0; font-size: 1.05rem; letter-spacing: -.012em; }
.panel-description { margin: 5px 0 0; color: var(--muted); max-width: 65ch; font-size: .9rem; }
.panel-body { padding: 22px; }
.panel-footer { padding: 16px 22px; border-top: 1px solid var(--line); background: rgba(4, 12, 24, .16); }

.metric { padding: 20px 22px; min-height: 127px; position: relative; overflow: hidden; }
.metric::after { content: ""; position: absolute; right: -17px; top: -31px; width: 100px; height: 100px; border: 1px solid var(--line); transform: rotate(45deg); }
.metric-label { display: block; color: var(--muted); font-size: .83rem; }
.metric-value { position: relative; z-index: 1; display: block; margin-top: 16px; font-family: "Fira Code", monospace; font-size: 2rem; letter-spacing: -.08em; }
.metric-note { margin: 7px 0 0; color: var(--faint); font-size: .78rem; }

.form-stack { display: grid; gap: 19px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 7px; }
.field label, .legend { color: #d8e5f5; font-size: .88rem; font-weight: 600; }
.field .help { margin: 0; color: var(--muted); font-size: .79rem; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; min-height: 44px;
  padding: 10px 12px; background: #0d192a; color: var(--ink); outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
textarea { min-height: 104px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #71849c; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(125, 211, 252, .55); outline-offset: 2px; }

.checkbox-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 0; }
.checkbox-row input, .radio-item input { accent-color: var(--green); width: 18px; height: 18px; }
.checkbox-row label, .radio-item label { color: #d8e5f5; cursor: pointer; }
.radio-group { display: grid; gap: 9px; }
.radio-item { display: flex; align-items: center; gap: 10px; min-height: 36px; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 9px 15px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; text-decoration: none; font-weight: 600; font-size: .91rem; transition: transform .15s ease, background .18s ease, border-color .18s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #05120d; background: var(--green); }
.button.primary:hover { background: #91efbd; color: #05120d; }
.button.secondary { color: #dcecff; border-color: var(--line-strong); background: #20314c; }
.button.secondary:hover { background: #2a405f; }
.button.danger { color: #ffd4d4; border-color: rgba(255, 168, 168, .42); background: rgba(176, 53, 53, .14); }
.button.danger:hover { background: rgba(176, 53, 53, .3); }
.button.small { min-height: 36px; padding: 6px 10px; font-size: .8rem; }

.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 999px; font-family: "Fira Code", monospace; font-size: .68rem; white-space: nowrap; }
.badge.ok { color: #b8f4d3; background: var(--green-bg); border-color: rgba(94, 224, 160, .35); }
.badge.warn { color: #ffe1ac; background: var(--amber-bg); border-color: rgba(249, 200, 121, .35); }
.badge.muted { color: var(--muted); background: rgba(159, 176, 198, .08); }
.badge.error { color: #ffd0d0; background: var(--red-bg); border-color: rgba(255, 168, 168, .35); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 670px; }
th, td { border-bottom: 1px solid var(--line); padding: 13px 15px; vertical-align: top; text-align: left; }
th { color: var(--muted); font-size: .73rem; font-family: "Fira Code", monospace; font-weight: 500; }
td { font-size: .86rem; }
tbody tr:last-child td { border-bottom: 0; }
.compact-copy { margin: 0; color: var(--muted); font-size: .81rem; word-break: break-word; }
.code { font-family: "Fira Code", monospace; font-size: .79rem; color: #d9ebff; }

.question-list { display: grid; gap: 12px; }
.question-card { padding: 18px; border: 1px solid var(--line); background: #111e32; }
.question-top { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; }
.question-name { margin: 0; font-size: 1rem; line-height: 1.36; }
.options-list { margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; list-style: none; }
.option { color: var(--muted); padding: 7px 8px; border: 1px solid var(--line); background: rgba(0, 0, 0, .1); font-size: .82rem; overflow-wrap: anywhere; }
.option.correct { color: #b8f4d3; border-color: rgba(94, 224, 160, .38); }
.question-actions { display: flex; gap: 8px; margin-top: 15px; }
.inline-form { margin: 0; }

.callout { border-left: 3px solid var(--blue); padding: 13px 15px; background: rgba(125, 211, 252, .07); color: #dbeefe; font-size: .88rem; }
.callout.warn { border-left-color: var(--amber); background: var(--amber-bg); color: #ffedc9; }
.empty { padding: 38px 22px; text-align: center; color: var(--muted); }
.empty h2 { margin: 0; color: var(--ink); font-size: 1.12rem; }
.empty p { max-width: 45ch; margin: 8px auto 18px; }

.login-layout { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 17% 20%, #1f4465 0, transparent 34%), var(--navy-950); }
.login-card { width: min(100%, 445px); padding: 31px; border: 1px solid var(--line-strong); background: #101c30; box-shadow: 0 28px 80px rgba(0, 0, 0, .35); }
.login-card h1 { margin-top: 18px; }
.login-card p { color: var(--muted); }
.login-mark { display: flex; align-items: center; gap: 9px; color: var(--blue); font-family: "Fira Code", monospace; font-size: .8rem; }
.login-mark::before { content: ""; width: 9px; height: 9px; background: var(--green); }
.login-card .button { width: 100%; margin-top: 3px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; padding: 16px 20px; display: grid; grid-template-columns: 1fr; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .nav { display: flex; overflow-x: auto; gap: 2px; padding-bottom: 1px; }
  .nav a { border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
  .nav a.active { border-left-color: transparent; border-bottom-color: var(--blue); }
  .sidebar-bottom { display: none; }
  .main-inner { padding-top: 28px; }
}
@media (max-width: 680px) {
  .topbar { min-height: 62px; padding: 12px 20px; }
  .topbar-status { display: none; }
  .grid.two, .grid.three, .form-row { grid-template-columns: 1fr; }
  .main-inner { padding: 25px 16px 44px; }
  .panel > .panel-header, .panel-body, .panel-footer { padding-left: 16px; padding-right: 16px; }
  .options-list { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
