:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #eef3fb;
  --surface-selected: #e6efff;
  --border: #d9e3f0;
  --border-strong: #bdd0ec;
  --text: #162033;
  --text-muted: #5f6d85;
  --primary: #2152ff;
  --primary-strong: #193fc6;
  --success: #177d52;
  --warning: #b26a00;
  --danger: #b42318;
  --shadow: 0 16px 48px rgba(20, 38, 76, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #eef3fb 0%, #f8fafd 100%);
  color: var(--text);
}

body {
  padding: 24px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  max-width: 1480px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h1,
.panel h2,
.login-card h2 {
  margin: 4px 0 0;
  font-size: clamp(1.5rem, 2vw, 2rem);
  line-height: 1.1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.session-badge,
.flash,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.9rem;
}

.session-badge {
  background: rgba(33, 82, 255, 0.12);
  color: var(--primary-strong);
  font-weight: 600;
}

.view--centered {
  min-height: calc(100vh - 160px);
  display: grid;
  place-items: center;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(217, 227, 240, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(100%, 460px);
  padding: 32px;
  display: grid;
  gap: 28px;
}

.muted {
  margin: 8px 0 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.stack-md {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(33, 82, 255, 0.12);
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font-weight: 700;
  transition: transform 0.12s ease, background 0.18s ease, opacity 0.18s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.button--full {
  width: 100%;
}

.button--primary {
  background: var(--primary);
  color: #fff;
}

.button--primary:hover:not(:disabled) {
  background: var(--primary-strong);
}

.button--success {
  background: rgba(23, 125, 82, 0.12);
  color: var(--success);
}

.button--secondary {
  background: rgba(33, 82, 255, 0.12);
  color: var(--primary-strong);
}

.button--warning {
  background: rgba(178, 106, 0, 0.12);
  color: var(--warning);
}

.button--danger {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.button--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.form-error {
  min-height: 1.4em;
  margin: 0;
  color: var(--danger);
  font-size: 0.95rem;
}

.status-row {
  min-height: 52px;
  margin-bottom: 8px;
}

.flash {
  width: fit-content;
  max-width: 100%;
  font-weight: 600;
}

.flash--info {
  background: rgba(33, 82, 255, 0.12);
  color: var(--primary-strong);
}

.flash--success {
  background: rgba(23, 125, 82, 0.12);
  color: var(--success);
}

.flash--danger {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  padding: 22px;
  display: grid;
  gap: 10px;
}

.kpi-card strong {
  font-size: clamp(1.5rem, 2vw, 2.25rem);
  line-height: 1;
}

.kpi-card span {
  color: var(--text-muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.secondary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 20px;
  margin-top: 20px;
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filter-chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 9px 13px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
}

.filter-chip.is-active {
  background: rgba(33, 82, 255, 0.12);
  border-color: rgba(33, 82, 255, 0.3);
  color: var(--primary-strong);
}

.count-pill {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(21, 28, 42, 0.08);
  padding: 0 7px;
  font-size: 0.8rem;
}

.table-shell {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.table-wrap {
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.table th,
.table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: rgba(238, 243, 251, 0.85);
}

.table tbody tr {
  transition: background 0.16s ease;
}

.table tbody tr:hover {
  background: rgba(33, 82, 255, 0.04);
}

.table tbody tr.is-selected {
  background: var(--surface-selected);
}

.table tbody tr:last-child td,
.table thead tr:last-child th {
  border-bottom: 0;
}

.row-button {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
}

.subline {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 10px;
}

.badge--neutral {
  background: rgba(21, 28, 42, 0.08);
  color: var(--text);
}

.badge--info {
  background: rgba(33, 82, 255, 0.12);
  color: var(--primary-strong);
}

.badge--success {
  background: rgba(23, 125, 82, 0.12);
  color: var(--success);
}

.badge--warning {
  background: rgba(178, 106, 0, 0.12);
  color: var(--warning);
}

.badge--danger {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.detail-grid {
  display: grid;
  gap: 16px;
}

.detail-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface-muted);
}

.detail-block h3 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.definition-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.definition-list div {
  display: grid;
  gap: 6px;
}

.definition-list dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.definition-list dd {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.detail-highlight {
  display: grid;
  gap: 14px;
}

.detail-highlight p {
  margin: 0;
  line-height: 1.55;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.help-text {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.empty-state {
  padding: 26px;
  color: var(--text-muted);
  line-height: 1.6;
}

.pedagogy-panel {
  align-self: start;
}

.pedagogy-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  line-height: 1.65;
}

.pedagogy-list li + li {
  margin-top: 10px;
}

@media (max-width: 1200px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content-grid,
  .secondary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    padding: 16px;
  }

  .topbar,
  .panel-head {
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .definition-list,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .table {
    min-width: 560px;
  }
}

@media (max-width: 520px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .login-card,
  .panel {
    padding: 20px;
  }
}
