:root {
  --pico-font-size: 95%;
  --accent: #6d28d9;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --muted: #64748b;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f8fafc;
}

.demo-banner {
  background: #fef3c7;
  color: #78350f;
  border-bottom: 1px solid #fcd34d;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  text-align: center;
}

.page-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding-top: 1.5rem;
}

.page-header h1 {
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
}

.lead {
  color: #334155;
  max-width: 60rem;
}

.reset-button {
  white-space: nowrap;
  flex-shrink: 0;
}

.steps {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.steps .step {
  background: white;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  width: auto;
  margin: 0;
}

.steps .step[aria-current="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.step-number {
  display: inline-block;
  width: 1.4rem;
  height: 1.4rem;
  line-height: 1.4rem;
  border-radius: 50%;
  background: rgba(100, 116, 139, 0.15);
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.step-badge:empty {
  display: none;
}

.step-badge {
  font-size: 0.75rem;
  background: rgba(100, 116, 139, 0.18);
  border-radius: 999px;
  padding: 0 0.45rem;
}

.card {
  background: white;
  margin-bottom: 1.2rem;
  padding: 1rem 1.2rem;
}

.card > header {
  margin-bottom: 0.8rem;
  padding: 0.6rem 1.2rem;
}

.card h2 {
  font-size: 1.15rem;
  margin: 0;
}

.card h2 small {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85rem;
}

.card-header-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.card-header-row input[type="search"] {
  max-width: 20rem;
  margin: 0;
}

.hint {
  background: #ede9fe;
  border-left: 4px solid var(--accent);
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
}

.rule {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
}

.table-scroll {
  overflow-x: auto;
}

table {
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

th.num,
td.num {
  text-align: right;
  white-space: nowrap;
}

.grid-table input {
  width: 6.5rem;
  margin: 0;
  padding: 0.3rem 0.5rem;
  height: auto;
  text-align: right;
}

.grid-footer {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.grid-footer label {
  margin: 0;
}

.grid-footer input {
  width: 6rem;
  margin: 0;
  padding: 0.3rem 0.5rem;
  height: auto;
}

.students-table td {
  vertical-align: top;
}

.students-table input[type="date"] {
  margin: 0;
  padding: 0.25rem 0.4rem;
  height: auto;
  width: 9.5rem;
  font-size: 0.85rem;
}

.student-name {
  font-weight: 600;
}

.student-family,
.detail {
  color: var(--muted);
  font-size: 0.8rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 0.05rem 0.2rem 0.05rem 0.55rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.chip button {
  border: none;
  background: transparent;
  color: var(--bad);
  padding: 0 0.35rem;
  margin: 0;
  width: auto;
  line-height: 1.2;
  font-size: 0.95rem;
}

.add-course {
  margin: 0;
  padding: 0.2rem 0.4rem;
  height: auto;
  font-size: 0.8rem;
  width: auto;
  max-width: 14rem;
}

.price {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}

.flash {
  animation: flash 1.6s ease-out;
}

@keyframes flash {
  0% { background: #fde68a; }
  100% { background: transparent; }
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.warn { background: #fef3c7; color: var(--warn); }
.badge.bad { background: #fee2e2; color: var(--bad); }
.badge.neutral { background: #e2e8f0; color: #334155; }
.badge.level-1 { background: #fef9c3; color: #854d0e; }
.badge.level-2 { background: #ffedd5; color: #9a3412; }
.badge.level-3 { background: #fee2e2; color: var(--bad); }

.stats {
  font-size: 0.9rem;
}

.import-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.import-actions > * {
  width: auto;
  margin: 0;
}

.upload-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.upload-row input[type="file"] {
  flex: 1 1 16rem;
  margin: 0;
}

.upload-row button {
  width: auto;
  margin: 0;
}

.counters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 0.8rem 0;
}

.counter {
  border-radius: 8px;
  padding: 0.7rem;
  text-align: center;
}

.counter strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1.1;
}

.counter.ok { background: #dcfce7; color: var(--ok); }
.counter.warn { background: #fef3c7; color: var(--warn); }
.counter.bad { background: #fee2e2; color: var(--bad); }

.review {
  border: 1px solid #fcd34d;
  border-left: 4px solid var(--warn);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.7rem;
  background: #fffbeb;
}

.review.decided {
  border-color: #cbd5e1;
  border-left-color: #94a3b8;
  background: #f8fafc;
}

.review-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-weight: 600;
}

.review p {
  margin: 0.35rem 0;
  font-size: 0.9rem;
}

.review .action-hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.review-buttons {
  display: flex;
  gap: 0.5rem;
}

.review-buttons button {
  width: auto;
  margin: 0;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
}

.notice {
  background: #e0f2fe;
  color: #075985;
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  font-size: 0.88rem;
  margin: 0.4rem 0;
}

.message {
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.message.error {
  background: #fee2e2;
  color: #7f1d1d;
  border: 1px solid #fca5a5;
}

.message.info {
  background: #dcfce7;
  color: #14532d;
  border: 1px solid #86efac;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: -0.6rem;
}

.no-mail {
  background: #f1f5f9;
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  font-size: 0.88rem;
}

.reminder {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.7rem;
}

.reminder-head {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.reminder-head a[role="button"] {
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
  margin: 0;
}

.reminder.suspended {
  background: #f8fafc;
  border-style: dashed;
}

.reminder details {
  margin: 0.5rem 0 0;
}

.reminder pre {
  white-space: pre-wrap;
  font-size: 0.82rem;
  background: #f8fafc;
  padding: 0.7rem;
  border-radius: 6px;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.small-button {
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  margin: 0;
  width: auto;
}

.page-footer {
  color: var(--muted);
  padding-bottom: 2rem;
}

@media (max-width: 720px) {
  .page-header {
    flex-direction: column;
  }

  .page-header h1 {
    font-size: 1.3rem;
  }

  .students-table thead {
    display: none;
  }

  .students-table tr {
    display: block;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.5rem 0;
  }

  .students-table td {
    display: block;
    border: none;
    padding: 0.15rem 0.3rem;
  }

  .students-table td[data-label]::before {
    content: attr(data-label) " : ";
    color: var(--muted);
    font-size: 0.78rem;
  }

  .counter strong {
    font-size: 1.4rem;
  }

  .counter {
    font-size: 0.78rem;
  }
}
