:root {
  color-scheme: light;
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #163a56;
  --muted: #5a7590;
  --line: #d3e4f0;
  --green: #3375ac;
  --green-soft: #e7f3fa;
  --warn: #8d3414;
  --warn-soft: #f8e7dc;
  --chip: #e7f3fa;
  --shadow: 0 8px 24px rgba(22, 58, 86, 0.06);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 400px at 10% -10%, #e7f3fa, transparent 50%),
    var(--bg);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

button:disabled { opacity: 0.45; cursor: default; }

.category-toggle.sub {
  margin-left: 12px;
  width: calc(100% - 12px);
}

h3.group-label.sub { margin-left: 12px; }

.category-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 8px 0;
}

.note-line {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.time-pair { display: inline-flex; gap: 4px; }

.time-pair select { width: auto; }

.month-head, .month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.month-head {
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.month-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 68px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 4px;
  text-align: left;
  font-size: 0.68rem;
  line-height: 1.25;
}

.month-cell.muted-day { opacity: 0.4; }

.month-cell.today { box-shadow: inset 0 0 0 2px var(--green); }

.month-cell.picked { background: var(--green-soft); }

#root { min-height: 100vh; }

.app {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 16px 16px 108px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 14px;
}

h1, h2, h3 { font-weight: 650; letter-spacing: -0.03em; margin: 0; }

h1 { font-size: 1.7rem; }

h2 { font-size: 1.25rem; }

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

.small { font-size: 0.86rem; }

.corner-icons {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 6;
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-btn.on { background: var(--green); color: #ffffff; }

.card, .student-box, .class-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card { padding: 14px; margin-bottom: 12px; }

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.row input[type="time"],
.row input[type="date"],
.row select { width: auto; }

.spread { justify-content: space-between; }

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

label.field { display: grid; gap: 4px; font-size: 0.86rem; color: var(--muted); }

input[type="text"], input[type="search"], input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
}

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

.btn, .btn-quiet, .btn-warn {
  border-radius: 999px;
  border: 0;
  padding: 10px 14px;
  background: var(--green);
  color: #ffffff;
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

.btn-quiet {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
}

.btn-warn { background: var(--warn); }

.btn:disabled { opacity: 0.45; cursor: default; }

.list-button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

.list-open {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
}

.trial-pill {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 4px 10px;
  background: #e7f3fa;
  color: #245f8a;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.3;
}

.trial-pill.on {
  background: #3375ac;
  color: #ffffff;
}

.trial-pill.awaiting {
  background: #f3e2b8;
  color: #6a4b10;
}

.trial-pill.awaiting.on {
  background: #6a4b10;
  color: #fff8ea;
}

.trial-actions {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  background: var(--chip);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.82rem;
}

.nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 20px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
  background: #3375ac;
  border-radius: 18px;
  z-index: 5;
}

.nav button {
  border: 0;
  background: transparent;
  color: #e7f3fa;
  border-radius: 14px;
  padding: 10px 4px;
}

.nav button.active { background: #ffffff; color: #3375ac; }

.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: 12px;
  padding: 8px 10px;
}

.ok {
  background: var(--green-soft);
  color: var(--green);
  border-radius: 12px;
  padding: 8px 10px;
}

.day-block { margin-bottom: 28px; }

.day-head { margin-bottom: 18px; }

.class-card { padding: 12px; margin-bottom: 14px; cursor: pointer; }

.slot-pin { margin: 0; padding: 0; border: 0; align-items: center; }

.slot-students { margin-top: 20px; }

.slot-students .student-box:first-child { margin-top: 0; }

.class-card.over, .class-card.clash { border-color: #e2b39a; }

.student-box {
  padding: 10px;
  margin-top: 8px;
  box-shadow: none;
}

.drag-handle { touch-action: none; }

.student-box.absent { opacity: 0.72; }

.icon-btn {
  border: 0;
  background: var(--chip);
  border-radius: 999px;
  width: 32px;
  height: 32px;
}

.icon-btn.on { background: #3375ac; color: #ffffff; }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.check input { width: 20px; height: 20px; margin-top: 2px; }

.phone-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.phone-line span {
  color: var(--ink);
  font-weight: 650;
}

.phone-line input { flex: 1; }

.material-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 8px;
  align-items: start;
}

.print-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  margin-bottom: 12px;
}

.print-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.print-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.print-beside { min-width: 0; }

.print-beside .print-meta { margin: 0; }

.print-beside .print-meta + .print-meta { margin-top: 2px; }

.summary-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0 6px;
}

.summary-head .summary-title { font-weight: 650; }

.summary-head .print-flag { flex: none; font-weight: 400; }

.print-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  line-height: 1;
}

.check .print-flag { align-self: center; }

.check .print-flag input { margin: 0; }

.note-sub {
  margin: 6px 0 0;
  padding: 6px 8px;
  background: #e7f3fa;
  border: 0;
  border-radius: 10px;
}

.print-pick { cursor: pointer; }

.print-pick > input { pointer-events: none; }

.past-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 12px;
}

.past-col {
  background: #f4f9fc;
  border-radius: 12px;
  padding: 8px;
  min-height: 72px;
}

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(22, 58, 86, 0.35);
  display: grid;
  align-items: end;
  z-index: 6;
}

.sheet .card {
  margin: 0;
  border-radius: 20px 20px 0 0;
  max-height: 80vh;
  overflow: auto;
  padding: 16px 16px 28px;
}

.drag-ghost {
  position: fixed;
  z-index: 8;
  pointer-events: none;
  background: var(--green);
  color: white;
  padding: 8px 10px;
  border-radius: 12px;
  transform: translate(-30%, -120%);
}

.drop-target { outline: 2px solid var(--green); }

.tuition-top { align-items: flex-start; }

@media (max-width: 1040px) {
  .tuition-top { padding-right: 80px; }
}

.tuition-title p { margin: 2px 0 8px; }

.timetable-nav { margin-bottom: 12px; }

.timetable-now {
  color: var(--ink);
  font-size: 0.95rem;
}

.tuition-side {
  margin-left: auto;
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.tuition-side p { margin: 0; }

.tuition-flags {
  display: flex;
  gap: 12px;
  align-items: center;
}

.tuition-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
}

.tuition-flag input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.tuition-date {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

@media (max-width: 640px) {
  .past-grid { grid-template-columns: 1fr; }
  .topbar { align-items: stretch; flex-direction: column; }
  .topbar.tuition-top { flex-direction: row; align-items: flex-start; }
}

.apply-page {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 16px 16px 32px;
}

.apply-page h1 { margin-bottom: 8px; }

.apply-date-title {
  margin-top: 8px;
  font-size: 1.55rem;
}

.apply-chosen {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--green);
  color: #ffffff;
  font-size: 1.08rem;
  font-weight: 650;
}

.apply-contact-row {
  display: flex;
  gap: 8px;
  align-items: end;
}

.apply-contact-row .field { flex: 1 1 0; min-width: 0; }

.apply-contact-row .phone-line,
.apply-contact-row select {
  height: 46px;
}

.apply-contact-row .phone-line {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0 12px;
}

.apply-contact-row .phone-line input {
  border: 0;
  background: transparent;
  padding: 0;
  height: 100%;
  border-radius: 0;
}

.apply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.apply-logo {
  height: 52px;
  width: auto;
  display: block;
}

.apply-icons {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.apply-icon {
  display: flex;
  width: 36px;
  height: 36px;
}

.apply-icon svg { width: 36px; height: 36px; display: block; }

.apply-calendar, .apply-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.apply-head {
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.apply-day {
  min-height: 64px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 4px;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.apply-day.outside { color: var(--muted); }

.apply-day.today strong { text-decoration: underline; }

.apply-day.many { border: 2px solid #3375ac; }

.apply-day.few { border: 2px solid #c4a035; }

.apply-day.full { border: 2px solid #a33b2b; }

.apply-day.shut { opacity: 0.45; }

.apply-day small { display: block; color: var(--muted); font-size: 0.62rem; }

.apply-slot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.apply-slot:last-child { border-bottom: 0; }

.apply-slot input { flex: none; }
