:root {
  --bg: #eef2ff;
  --card: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --ok: #059669;
  --warn: #d97706;
  --holiday: #e11d48;
  --weekend: #94a3b8;
  --radius: 12px;
  --shadow: 0 6px 18px rgba(79, 70, 229, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(160deg, #eef2ff 0%, #fdf2f8 100%);
  color: var(--ink);
  line-height: 1.45;
}

/* ---------- header ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { font-size: 30px; }
.topbar h1 { margin: 0; font-size: 18px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle { margin: 1px 0 0; opacity: 0.92; font-size: 12px; }

.admin-actions { display: flex; gap: 6px; }
.btn { padding: 7px 12px; border: none; border-radius: 10px; font-weight: 700; font-size: 13px; cursor: pointer; background: #fff; color: var(--brand); }
.btn-primary { background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; }
.btn.ghost { background: rgba(255,255,255,0.16); color:#fff; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* ---------- main ---------- */
main { padding: 12px; max-width: 760px; margin: 0 auto; }

.grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 13px 14px;
  box-shadow: var(--shadow);
  border: 1px solid #ece7ff;
}
.card h2 { margin: 0 0 9px; font-size: 16px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.list li { padding: 6px 0; border-bottom: 1px dashed #e7e5f4; display: flex; gap: 8px; align-items: baseline; }
.list li:last-child { border-bottom: none; }
.list .date { color: var(--muted); font-size: 11.5px; min-width: 74px; flex-shrink: 0; }
.list .empty { color: var(--muted); font-style: italic; }

/* ---------- today hero ---------- */
.hero {
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  color: #fff;
  border: none;
}
.hero h2 { color:#fff; }
.hero .big { font-size: 20px; font-weight: 800; }
.hero .sub { font-size: 13px; opacity: 0.95; margin-top: 2px; }
.hero .chips { display:flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { background: rgba(255,255,255,0.18); padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }

/* ---------- week rows ---------- */
.week { display: flex; flex-direction: column; gap: 5px; }
.day-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; border-radius: 9px; background: #f8f7ff; border: 1px solid #ece7ff; }
.day-row .day-name { font-weight: 600; font-size: 13px; flex: 0 0 64px; }
.day-row .day-subjects { font-size: 11.5px; color: var(--muted); flex: 1; min-width: 0; overflow-wrap: break-word; }
.pill { font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 999px; color:#fff; white-space: nowrap; }
.pill.ok { background: var(--ok); }
.pill.holiday { background: var(--holiday); }
.pill.weekend { background: var(--weekend); }
.pill.warn { background: var(--warn); }

/* ---------- chat ---------- */
.chat { height: 170px; overflow-y: auto; background: #f8f7ff; border: 1px solid #ece7ff; border-radius: 10px; padding: 9px; display: flex; flex-direction: column; gap: 7px; margin-bottom: 8px; font-size: 13.5px; }
.bubble { max-width: 90%; padding: 7px 10px; border-radius: 12px; white-space: pre-wrap; line-height: 1.4; word-wrap: break-word; }
.bubble.user { align-self: flex-end; background: var(--brand); color: #fff; }
.bubble.bot { align-self: flex-start; background: #fff; border: 1px solid #ece7ff; }
.chat-form { display: flex; gap: 6px; }
.chat-form input { flex: 1; padding: 9px 11px; border: 1px solid #d6d3f5; border-radius: 10px; font-size: 14px; min-width: 0; }
.chat-form button { padding: 9px 14px; border: none; border-radius: 10px; background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700; cursor: pointer; }

/* ---------- accordion ---------- */
.accordion details { border: 1px solid #ece7ff; border-radius: 9px; margin-bottom: 5px; padding: 7px 10px; background: #f8f7ff; font-size: 13.5px; }
.accordion summary { cursor: pointer; font-weight: 600; }
.accordion .topics { margin: 6px 0 0; padding-left: 16px; color: var(--muted); font-size: 12.5px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.stat { background: #f8f7ff; border: 1px solid #ece7ff; border-radius: 10px; padding: 9px; text-align: center; }
.stat .num { font-size: 20px; font-weight: 800; color: var(--brand); }
.stat .lbl { font-size: 11px; color: var(--muted); }

/* ---------- child lookup ---------- */
.lookup { display: flex; flex-direction: column; gap: 8px; }
.lookup select, .lookup input { padding: 9px 11px; border: 1px solid #d6d3f5; border-radius: 10px; font-size: 14px; width: 100%; }
.fee-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed #e7e5f4; font-size: 13px; }
.fee-row:last-child { border-bottom: none; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 14px; }

@media (max-width: 420px) {
  .topbar h1 { font-size: 15px; }
  .logo { font-size: 26px; }
}
