:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d23;
  --muted: #6b7280;
  --border: #e3e6ea;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --success: #16a34a;
  font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --surface: #1e2128;
    --text: #e7e9ec;
    --muted: #9aa1ac;
    --border: #2c3038;
    --accent: #4d8dff;
    --accent-text: #0b1020;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar .brand { font-weight: 600; font-size: 1.1rem; }
.topbar nav a { margin-left: 1.2rem; color: var(--muted); }
.topbar nav a:hover { color: var(--text); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }

.muted { color: var(--muted); }

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.class-list { list-style: none; padding: 0; margin: 0; }
.class-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}
.class-list li:last-child { border-bottom: none; }

.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li {
  padding: 0.6rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  background: var(--border);
}
.messages li.success { background: rgba(22, 163, 74, 0.15); color: var(--success); }
.messages li.error { background: rgba(220, 38, 38, 0.15); color: var(--danger); }

form.plain p { margin: 0.75rem 0; display: flex; flex-direction: column; gap: 0.3rem; }
form.plain input, form.plain select {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
form.plain label { font-size: 0.85rem; color: var(--muted); }

.key-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.75rem; }

#mark-grid { margin-top: 1rem; }

.tabulator { border: 1px solid var(--border); background: var(--surface); }
.tabulator-row { background: var(--surface); color: var(--text); }
.tabulator-row.tabulator-row-even { background: var(--bg); }
.tabulator-col { background: var(--surface) !important; color: var(--text) !important; border-right: 1px solid var(--border) !important; }
.tabulator-cell { border-right: 1px solid var(--border); }
.tabulator-cell.cell-error { background: rgba(220, 38, 38, 0.2) !important; }
.tabulator-cell.cell-saved { background: rgba(22, 163, 74, 0.18) !important; transition: background 1.5s ease; }
