:root {
  --ink: #1b1b1b;
  --ink-soft: #4a4a4a;
  --muted: #6f6f6f;
  --line: #2b2b2b;
  --btn: #2b2b2b;
  --btn-soft: #555;
  --green: #0b8a1d;
  --head: #dcdcdc;
  --bg: #ffffff;
  --err: #b3261e;
  --radius: 32px;
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  font-size: 16px;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
img, video { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
#app { min-height: 100vh; display: flex; flex-direction: column; }
.loading { padding: 80px 24px; text-align: center; color: var(--muted); }

/* ---------- Layout ---------- */
.layout {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 28px 24px;
  display: grid;
  grid-template-columns: 200px minmax(0, 760px) 1fr;
  grid-template-areas: "brand main links";
  column-gap: 28px;
  align-items: start;
}
.brand {
  grid-area: brand;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.15;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.main { grid-area: main; min-width: 0; padding-top: 4px; }
.toplinks { white-space: nowrap;
  grid-area: links;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding-top: 6px;
}
.contact { width: 100%; max-width: 1180px; margin: auto auto 0; padding-top: 24px; padding: 0 28px 48px 256px; font-size: 18px; line-height: 1.25; }
.contact a { text-decoration: none; }
.contact a:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: 16px; font-weight: 500;
  padding: 10px 18px; border-radius: 8px; border: 1.5px solid var(--btn);
  background: #fff; color: var(--btn); cursor: pointer; text-decoration: none;
  transition: transform .06s ease, opacity .15s ease, background .15s ease;
}
.btn:hover { background: #f1f1f1; }
.btn:active { transform: translateY(1px); }
.btn-dark { background: var(--btn); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #087218; }
.btn-lg { font-size: 22px; padding: 22px 34px; border-radius: 10px; }
.btn-sm { background: var(--btn-soft); border-color: var(--btn-soft); color: #fff; font-size: 14px; padding: 7px 14px; border-radius: 6px; }
.btn-sm:hover { background: #333; }
.btn-danger { background: #fff; border-color: #b3261e; color: #b3261e; font-size: 14px; padding: 7px 14px; border-radius: 6px; }
.btn-danger:hover { background: #fdecea; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.linkbtn {
  background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-align: left;
}
.linkbtn:hover { opacity: .7; }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 48px; align-items: center; }
.hero-media { border-radius: 36px; overflow: hidden; background: #ddd; aspect-ratio: 488 / 710; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.hero-media img, .hero-media video { width: 100%; height: 100%; object-fit: cover; }
.hero-copy h1 { font-size: clamp(28px, 3.4vw, 40px); font-weight: 600; line-height: 1.18; letter-spacing: -0.015em; }
.hero-copy .start { margin: 44px 0 28px; font-size: 26px; font-weight: 700; }

/* ---------- Auth ---------- */
.auth-card { max-width: 440px; }
.auth-card h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 8px; }
.auth-card .muted { margin-bottom: 24px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], input[type="date"], select, textarea {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--ink);
  padding: 11px 12px; border: 1.5px solid #8d8d8d; border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0,0,0,.1); }
textarea { resize: vertical; min-height: 96px; line-height: 1.4; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--err); font-size: 14px; min-height: 20px; margin: 0 0 10px; }
.form-ok { color: #1b6e2a; font-size: 15px; margin: 0 0 14px; }
.auth-links { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; font-size: 15px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------- Titles / back ---------- */
.page-title { font-size: clamp(28px, 3.6vw, 38px); font-weight: 700; line-height: 1.12; letter-spacing: -0.015em; }
.back { display: inline-flex; margin: 0 0 8px -4px; padding: 4px; color: var(--ink); }
.back svg { width: 34px; height: 34px; }

/* ---------- Action rows (check-in / 1-1) ---------- */
.actions { margin: 34px 0 30px; display: grid; gap: 16px; }
.action-row { display: grid; grid-template-columns: 190px 1fr; gap: 18px; align-items: center; }
.action-row .btn { width: 100%; }
.action-note { font-size: 14px; color: var(--ink-soft); line-height: 1.3; }
.action-note small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.limit-note {
  font-size: 14px; background: #fff7e0; border: 1px solid #e6c768; color: #5b4500;
  border-radius: 10px; padding: 10px 14px; line-height: 1.35;
}

/* ---------- Cards ---------- */
.card {
  border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 26px 32px; margin-bottom: 14px; position: relative;
}
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 24px; align-items: start; }
.card h2 { font-size: clamp(24px, 2.8vw, 32px); font-weight: 700; color: #3a3a3a; line-height: 1.12; letter-spacing: -0.01em; }
.card-text { font-size: 14px; color: var(--ink-soft); line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-text.empty { color: #8a8a8a; }
.card .stamp-line { margin-top: 12px; font-size: 13px; color: var(--muted); }
.card-actions { display: flex; justify-content: flex-end; margin-top: 12px; gap: 8px; }

.renewal { margin-top: 56px; border-radius: 40px; padding: 24px 34px; display: flex; flex-direction: column; gap: 22px; }
.renewal p { font-size: 15px; }
.renewal-edit { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.renewal-edit label { font-size: 15px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.renewal-edit input[type="date"] { width: auto; }

/* ---------- Tasks ---------- */
.tasks-section { margin-top: 36px; }
.tasks-section > h2 { font-size: 26px; font-weight: 700; margin-bottom: 16px; }
details.month { margin-bottom: 4px; }
details.month > summary {
  list-style: none; cursor: pointer; font-weight: 700; font-size: 15px;
  padding: 10px 4px; display: flex; align-items: center; gap: 10px; user-select: none;
}
details.month > summary::-webkit-details-marker { display: none; }
details.month > summary::before {
  content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  transform: rotate(-45deg); transition: transform .15s ease; margin-right: 2px;
}
details.month[open] > summary::before { transform: rotate(45deg); }
details.month .empty { font-size: 14px; padding: 4px 4px 14px 22px; }

table.tasks { width: 100%; border-collapse: separate; border-spacing: 8px; margin: 0 0 8px -8px; table-layout: fixed; }
table.tasks th { background: var(--head); text-align: left; font-size: 14px; font-weight: 700; padding: 10px 14px; }
table.tasks td { border: 1px solid #555; vertical-align: top; padding: 12px 14px; font-size: 14px; min-height: 120px; background: #fff; }
table.tasks td.row-actions { border: 0; padding: 0; display: table-cell; width: 92px; background: transparent; }
table.tasks th.actions-col { background: transparent; width: 92px; padding: 0; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.stamp { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
table.tasks textarea { min-height: 120px; font-size: 14px; border-radius: 4px; border: 0; padding: 0; resize: vertical; box-shadow: none; }
table.tasks textarea:focus { box-shadow: none; }
table.tasks td.editable:focus-within { outline: 2px solid var(--ink); }
.row-actions .btn { width: 100%; margin-bottom: 8px; }

.add-task { margin: 0 0 18px; padding: 16px; border: 1.5px dashed #9a9a9a; border-radius: 16px; display: grid; gap: 10px; }
.add-task label { font-size: 14px; font-weight: 600; }
.add-task .btn { justify-self: start; }

/* ---------- Teacher ---------- */
.student-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; }
.student-list a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 4px; font-weight: 600; font-size: 18px; text-decoration: none; border-bottom: 1px solid #e3e3e3;
}
.student-list a:hover { background: #f6f6f6; }
.student-list a::after { content: "›"; font-size: 24px; color: var(--muted); }
.student-list .email { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.checkin-row { display: flex; align-items: center; gap: 18px; margin: 20px 0 8px; flex-wrap: wrap; }
.checkin-info { font-size: 14px; color: var(--ink-soft); line-height: 1.4; }
.checkin-info strong { color: var(--ink); }
.settings-panel { margin-top: 56px; border-top: 1.5px solid var(--line); padding-top: 28px; }
.settings-panel h2 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.setting-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; align-items: end; margin-top: 16px; }
.setting-row .field { margin: 0; }
.setting-row.lesson { grid-template-columns: 130px 130px 110px auto; }
.setting-row .btn-sm { height: 44px; }

/* ---------- Break ---------- */
.break-intro { margin: 14px 0 28px; max-width: 560px; color: var(--ink-soft); font-size: 17px; }
.break-card { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 26px 32px; margin-bottom: 16px; }
.break-card h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.break-card p { color: var(--ink-soft); margin-bottom: 18px; font-size: 15px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1b1b1b; color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 15px; z-index: 50;
  transition: opacity .2s ease, transform .2s ease; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--err); }


/* ---------- Next check-in card ---------- */
.card.next { margin: 22px 0 0; padding: 18px 28px; border-radius: 40px; }
.next-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px 28px; align-items: center; }
.card.next h2 { font-size: clamp(22px, 2.4vw, 28px); white-space: nowrap; }
.next-when { font-size: 17px; line-height: 1.25; }
.next-when small { color: var(--muted); font-size: 14px; }
.card.next .linkbtn { font-size: 14px; white-space: nowrap; }
.card.next + .actions { margin-top: 24px; }

/* ---------- Booking picker ---------- */
.book-body { margin-top: 18px; max-width: 640px; }
.tzbox { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 14px; max-width: 420px; font-size: 14px; font-weight: 500; }
.tzbox select { font-size: 15px; }
.picker { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 28px; margin-top: 18px; align-items: start; }
.cal { border: 1.5px solid var(--line); border-radius: 22px; padding: 16px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-nav { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; font-size: 20px; line-height: 1; cursor: pointer; font-family: inherit; }
.cal-nav:hover:not([disabled]) { background: #f1f1f1; }
.cal-nav[disabled] { opacity: .3; cursor: not-allowed; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-wd { font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 50%; font: inherit; font-size: 15px; border: 0; background: transparent; }
button.cal-day { cursor: pointer; background: #ececec; font-weight: 600; }
button.cal-day:hover { background: #d9d9d9; }
button.cal-day.on { background: var(--btn); color: #fff; }
.cal-day.off { color: #b5b5b5; }
.times h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.time-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.time { font: inherit; font-size: 15px; padding: 10px 6px; border-radius: 8px; border: 1.5px solid var(--btn); background: #fff; cursor: pointer; }
.time:hover { background: #f1f1f1; }
.time.on { background: var(--btn); color: #fff; }
.selected { margin: 20px 0 12px; font-size: 16px; }
.book-body > .btn, .picker ~ .btn { margin-top: 6px; }
.confirm-card { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 26px 30px; display: grid; gap: 14px; justify-items: start; }
.confirm-card h2 { font-size: 26px; font-weight: 700; }
.confirm-card p { font-size: 17px; }

/* ---------- Sessions ---------- */
h2.sec { font-size: 26px; font-weight: 700; margin: 8px 0 14px; }
.srow { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 14px 22px; align-items: start; padding: 14px 0; }
.stype { display: flex; flex-direction: column; font-weight: 700; line-height: 1.25; }
.stype span { font-weight: 700; }
.swhen { font-size: 17px; line-height: 1.3; }
.swhen small { color: var(--muted); font-size: 14px; }
.sact { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 14px; }
.main > .tzbox { float: right; margin: 0 0 12px 12px; }

/* ---------- Teacher: check-in summary, settings ---------- */
.checkin-summary { margin-top: 22px; }
.checkin-summary h2.sec { font-size: 20px; margin-bottom: 6px; }
.checkin-dates { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; font-size: 15px; }
.checkin-dates small { color: var(--muted); }
.tag { font-size: 12px; background: #eef5ff; color: #1a4fa0; border-radius: 99px; padding: 2px 8px; margin-left: 4px; }
.settings-panel.sub { margin-top: 36px; }
.settings-panel h2 { font-size: 22px; }
.cal-status { list-style: none; padding: 0; margin: 8px 0 4px; display: grid; gap: 4px; font-size: 14px; }
.cal-status .ok { color: #1b6e2a; }
.cal-status .bad { color: var(--err); }
code.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: #f1f1f1; padding: 4px 8px; border-radius: 6px; overflow-wrap: anywhere; user-select: all; }
.field .hint { margin-top: 4px; font-weight: 400; }

/* ---------- Notice dialog ---------- */
#notice-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 100; }
.notice { background: #fff; border-radius: 22px; padding: 28px; max-width: 420px; width: 100%; display: grid; gap: 14px; justify-items: start; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.notice h2 { font-size: 22px; }
.notice p { font-size: 16px; color: var(--ink-soft); }

/* ---------- Tablet ---------- */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 150px minmax(0, 1fr) auto; column-gap: 20px; }
  .contact { padding-left: 198px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand links" "main main";
    padding: 22px 18px 8px; row-gap: 22px;
  }
  .brand { font-size: 17px; }
  .toplinks { padding-top: 0; font-size: 15px; }
  .contact { padding: 0 18px 40px; font-size: 16px; margin-top: 28px; }

  .hero { grid-template-columns: 1fr; gap: 22px; }
  .hero-media { border-radius: 30px; max-width: 420px; }
  .hero-copy .start { margin: 18px 0 20px; font-size: 22px; }
  .btn-lg { width: 100%; font-size: 20px; padding: 20px; }

  .action-row { grid-template-columns: 1fr; gap: 8px; }
  .action-row .btn { width: auto; justify-self: start; }

  .card { padding: 22px 22px; border-radius: 28px; }
  .card-grid { grid-template-columns: 1fr; gap: 12px; }
  .renewal { margin-top: 36px; border-radius: 30px; padding: 22px; }

  /* tasks → stacked cards */
  table.tasks, table.tasks tbody, table.tasks tr, table.tasks td { display: block; width: 100%; }
  table.tasks { border-spacing: 0; margin: 0; }
  table.tasks thead { display: none; }
  table.tasks tr { border-bottom: 1px solid #cfcfcf; padding: 6px 0 14px; margin-bottom: 10px; }
  table.tasks td { border: 0; padding: 8px 0; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; min-height: 0; }
  table.tasks td::before { content: attr(data-label); font-weight: 700; font-size: 14px; }
  table.tasks td.editable { border: 1px solid #bdbdbd; padding: 8px 10px; border-radius: 8px; margin-bottom: 8px; }
  table.tasks td.row-actions { display: flex; gap: 8px; width: 100%; }
  table.tasks td.row-actions::before { content: none; }
  .row-actions .btn { width: auto; margin: 0; }
  table.tasks textarea { min-height: 90px; }


  .next-grid { grid-template-columns: 1fr; gap: 8px; }
  .card.next { border-radius: 30px; padding: 20px 22px; }
  .picker { grid-template-columns: 1fr; gap: 20px; }
  .srow { grid-template-columns: 1fr auto; }
  .srow .stype { grid-column: 1 / -1; flex-direction: row; gap: 10px; }
  .sact { align-items: flex-end; }
  .main > .tzbox { float: none; margin: 0 0 14px; max-width: none; }
  .setting-row { grid-template-columns: 1fr; }
  .setting-row .btn-sm { height: auto; justify-self: start; }
  .setting-row.lesson { grid-template-columns: 1fr 1fr; }
  .setting-row.lesson .btn-sm { grid-column: 1 / -1; }
  .two-cols { grid-template-columns: 1fr; }
}

/* ---------- Join now / sessions (v3) ---------- */
.btn.join { background: var(--green); border-color: var(--green); color: #fff; text-decoration: none; padding: 7px 16px; font-size: 14px; }
.btn.join:hover { background: #087218; }
.stype a { color: inherit; }
.cal-status .warn { color: var(--ink-soft); }
.student-sessions { margin-top: 30px; }
.student-sessions h2.sec { font-size: 22px; }
.hero-media.is-video { aspect-ratio: 9 / 16; background: #000; }
@media (max-width: 760px) { .hero-media.is-video { max-width: 340px; } }

.hero-media iframe { width: 100%; height: 100%; border: 0; display: block; }
