:root {
  --bg0: #0b1210;
  --bg1: #13201a;
  --ink: #eef6f1;
  --muted: #8fa59a;
  --line: rgba(220, 240, 230, 0.12);
  --panel: rgba(18, 36, 28, 0.82);
  --accent: #6bcf9a;
  --accent-2: #d4b36a;
  --bad: #ff9b9b;
  --font: "Noto Sans SC", "DM Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(700px 420px at 10% -10%, rgba(107, 207, 154, 0.16), transparent 55%),
    radial-gradient(640px 380px at 100% 0%, rgba(212, 179, 106, 0.1), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1));
}
.hidden { display: none !important; }
.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: min(420px, 100%);
  padding: 28px 24px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
}
.brand, .brand-mini {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
}
.gate-card h1, .topbar h1 {
  margin: 6px 0 8px;
  font-size: 1.55rem;
}
.tag, .sub, .hint { color: var(--muted); font-size: 0.9rem; }
.hint { min-height: 1.2em; margin: 8px 0 0; }
input, textarea, select {
  width: 100%;
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.28);
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  color-scheme: dark;
}
select option { background: #13201a; color: var(--ink); }
textarea { resize: vertical; line-height: 1.5; }
.btn-primary, .btn-ghost {
  margin-top: 12px;
  border-radius: 12px;
  min-height: 42px;
  padding: 0 16px;
  font: inherit;
  cursor: pointer;
}
.btn-primary {
  border: 0;
  background: linear-gradient(135deg, #7ad7a8, #4fb884);
  color: #0b1a12;
  font-weight: 700;
}
.btn-ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}
.app {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 16px 16px 40px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.top-actions { display: flex; gap: 8px; align-items: center; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}
.badge.on {
  border-color: rgba(107,207,154,0.4);
  color: #9de0b8;
  background: rgba(107,207,154,0.1);
}
.badge.off {
  border-color: rgba(255,155,155,0.4);
  color: #ffb0b0;
  background: rgba(255,155,155,0.1);
}
.closed-banner {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,155,155,0.35);
  background: rgba(255,120,120,0.1);
  color: #ffc9c9;
}
.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 14px;
  min-height: 70vh;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}
.side, .card, .main {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.side { padding: 12px; align-self: start; }
.side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.side-head h2 { margin: 0; font-size: 1rem; }
.student-list { display: grid; gap: 6px; max-height: 70vh; overflow: auto; }
.stu-btn {
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
}
.stu-btn:hover { border-color: var(--line); }
.stu-btn.active {
  border-color: rgba(107,207,154,0.45);
  background: rgba(107,207,154,0.12);
}
.stu-btn small { display: block; color: var(--muted); margin-top: 2px; }
.main { padding: 16px; min-width: 0; }
.empty { color: var(--muted); padding: 40px 8px; text-align: center; }
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.panel-head h2 { margin: 0; }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}
.card { padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; font-size: 1rem; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.card-actions select {
  margin-top: 0;
  width: auto;
  min-width: 120px;
}
.card-actions .btn-ghost {
  margin-top: 0;
  min-height: 38px;
}
.card-actions .btn-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}
.check input { width: auto; margin: 0; }
.chart-wrap { position: relative; min-height: 220px; }
.timeline { display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.tl-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.06);
  font-size: 0.88rem;
  line-height: 1.45;
}
.tl-item .meta { color: var(--muted); font-size: 0.78rem; margin-bottom: 4px; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 40;
}
.modal-card {
  width: min(420px, 100%);
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #13201a;
}
.form-actions { display: flex; gap: 8px; }
.form-actions .btn-primary, .form-actions .btn-ghost { flex: 1; }
.field-label {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}
.field-label select,
.field-label input {
  margin-top: 0;
}
.row .field-label { margin-top: 10px; }
.tl-item .tl-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.tl-item .tl-actions button {
  margin-top: 0;
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.78rem;
}
.hint.ok { color: #9de0b8; }
.hint.err { color: #ffb0b0; }
.chart-tip { margin: 0 0 8px; }
.chart-wrap { cursor: crosshair; }
.card .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.card .form-actions .btn-primary,
.card .form-actions .btn-ghost {
  flex: 0 0 auto;
  margin-top: 8px;
}
