/* ============================================================================
   3 Gifted Minds — Tuition Calendar
   app.css — design system (Lufga / blue, light + dark)

   Type scale is deliberately generous: tutors range from 20 to 60, so body
   copy sits at 15-16px and nothing meaningful drops below 12px.
   ============================================================================ */

/* ── Lufga (self-hosted, licensed) ─────────────────────────────────────────*/
@font-face { font-family:'Lufga'; src:url('/static/fonts/lufga/Lufga-Regular.woff2') format('woff2');  font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:'Lufga'; src:url('/static/fonts/lufga/Lufga-Medium.woff2') format('woff2');   font-weight:500; font-style:normal; font-display:swap; }
@font-face { font-family:'Lufga'; src:url('/static/fonts/lufga/Lufga-SemiBold.woff2') format('woff2'); font-weight:600; font-style:normal; font-display:swap; }
@font-face { font-family:'Lufga'; src:url('/static/fonts/lufga/Lufga-Bold.woff2') format('woff2');     font-weight:700; font-style:normal; font-display:swap; }

/* ── Tokens — light ────────────────────────────────────────────────────────*/
:root {
  --accent:        #0b5cff;
  --accent-press:  #0a4fd6;
  --accent-soft:   #d7e4ff;
  --accent-tint:   #eef3ff;
  --accent-on-soft:#0b53e6;

  --bg:            #ffffff;
  --surface:       #ffffff;
  --surface-2:     #f2f4f8;
  --surface-3:     #e4e9f1;

  --ink:           #0c1424;
  --ink-2:         #39425a;
  --ink-3:         #616b80;
  --ink-4:         #8b95a8;

  --sep:           rgba(18,28,52,.11);
  --sep-soft:      rgba(18,28,52,.07);

  --red:    #e5484d;  --red-soft:    rgba(229,72,77,.10);
  --orange: #d9760c;  --orange-soft: rgba(240,123,38,.13);
  --green:  #2f9e4f;  --green-soft:  rgba(47,158,79,.12);

  --nav-bg:        #14171d;
  --nav-ink:       #949bab;
  --nav-active-bg: #ffffff;
  --nav-active-ink:#12151b;

  --font: 'Lufga',-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Arial,sans-serif;

  --r-xs: 8px; --r-sm: 12px; --r: 16px; --r-lg: 20px; --r-xl: 26px; --r-pill: 999px;

  --shadow-lg:  0 24px 64px rgba(12,20,36,.18);
  --shadow-nav: 0 8px 26px rgba(12,20,36,.22);
  --ease: cubic-bezier(.32,.72,0,1);
}

/* ── Tokens — dark ─────────────────────────────────────────────────────────*/
[data-theme="dark"] {
  --accent:        #4d8bff;
  --accent-press:  #6ba0ff;
  --accent-soft:   #1b2b48;
  --accent-tint:   #151f36;
  --accent-on-soft:#9dc0ff;

  --bg:            #0a0c10;
  --surface:       #0a0c10;
  --surface-2:     #171b23;
  --surface-3:     #262d38;

  --ink:           #f1f4fa;
  --ink-2:         #ccd3e0;
  --ink-3:         #a3acbd;
  --ink-4:         #7d8698;

  --sep:           rgba(255,255,255,.13);
  --sep-soft:      rgba(255,255,255,.08);

  --red:    #ff6369;  --red-soft:    rgba(255,99,105,.15);
  --orange: #ffa73e;  --orange-soft: rgba(255,159,46,.15);
  --green:  #46c46a;  --green-soft:  rgba(70,196,106,.15);

  --nav-bg:        #21252e;
  --shadow-lg:  0 24px 64px rgba(0,0,0,.66);
  --shadow-nav: 0 8px 28px rgba(0,0,0,.6);
}

/* ── Reset ─────────────────────────────────────────────────────────────────*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--ink);
  min-height: 100vh; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ── Shell + page transition ───────────────────────────────────────────────*/
#shell { transition: opacity .16s ease, transform .16s ease; }
#shell.is-leaving { opacity: 0; transform: translateY(-4px); }

.app-header { position: sticky; top: 0; z-index: 200; background: var(--bg); padding-top: env(safe-area-inset-top); }
.app-header::before { content:''; position: fixed; top:0; left:0; right:0; height: env(safe-area-inset-top); background: var(--bg); z-index: 201; }
.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 960px; margin: 0 auto; padding: 16px 20px 10px;
}
.header-title { font-size: 28px; font-weight: 700; letter-spacing: -.7px; line-height: 1.1; min-width: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-pill);
  background: var(--surface-2); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); transition: background .15s, transform .12s;
}
.icon-btn:active { transform: scale(.9); background: var(--surface-3); }
.icon-btn svg { width: 20px; height: 20px; }

/* `backwards` (not `both`) — a filling animation would leave a stacking
   context behind and trap overlays underneath the fixed nav. */
.page {
  max-width: 960px; margin: 0 auto;
  padding: 4px 20px calc(136px + env(safe-area-inset-bottom));
  animation: pageIn .3s var(--ease) backwards;
}
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page { animation: none; } #shell { transition: none; } }

/* ── Section headings ──────────────────────────────────────────────────────*/
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); margin: 26px 2px 12px; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 2px 12px; }
.section-row .section-title { margin: 0; }
.section-row .month-of { font-size: 18px; font-weight: 700; letter-spacing: -.35px; }
.see-all { font-size: 14.5px; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 4px; }
.muted-note { font-size: 13px; color: var(--ink-4); font-weight: 500; }

/* ── Buttons ───────────────────────────────────────────────────────────────*/
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600; cursor: pointer; border: none; white-space: nowrap;
  transition: transform .12s, background .15s;
}
.btn:active { transform: scale(.96); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-press); }
.btn-soft { background: var(--accent-tint); color: var(--accent-on-soft); }
.btn-ghost { background: var(--surface-2); color: var(--ink-2); }
.btn-sm { padding: 10px 15px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Filter pills ──────────────────────────────────────────────────────────*/
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  background: var(--surface-2); color: var(--ink-2); border: none;
  border-radius: var(--r-pill); padding: 10px 16px;
  font-family: var(--font); font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: background .18s, color .18s, transform .12s;
}
.pill:active { transform: scale(.95); }
.pill.active { background: var(--accent); color: #fff; }
.pill i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.pill.active i { box-shadow: 0 0 0 1.5px rgba(255,255,255,.85); }

/* ── Legend ────────────────────────────────────────────────────────────────*/
.legend { display: flex; flex-wrap: wrap; gap: 9px 16px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); font-weight: 500; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Hero (next lesson) ────────────────────────────────────────────────────*/
.hero { background: var(--accent); color: #fff; border-radius: var(--r-lg); padding: 20px; }
.hero-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; opacity: .85; }
.hero-title { font-size: 23px; font-weight: 700; letter-spacing: -.45px; margin: 8px 0 13px; line-height: 1.25; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; font-size: 15px; opacity: .96; }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta svg { width: 16px; height: 16px; }
.hero-empty { background: var(--surface-2); color: var(--ink-2); }
.hero-empty .hero-label { color: var(--ink-4); opacity: 1; }

/* ── Stats ─────────────────────────────────────────────────────────────────*/
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.stat { background: var(--surface-2); border-radius: var(--r); padding: 16px 8px; text-align: center; }
.stat-num { font-size: 26px; font-weight: 700; letter-spacing: -.6px; }
.stat-lbl { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-top: 4px; }

/* ── Week glance (Home) ────────────────────────────────────────────────────*/
.glance { display: grid; grid-template-columns: repeat(7,1fr); gap: 7px; }
.g-cell {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 13px 0 12px; border-radius: 22px; background: var(--surface-2);
  transition: transform .12s, background .18s;
}
.g-cell:active { transform: scale(.94); }
.g-dow { font-size: 12px; font-weight: 600; color: var(--ink-4); }
.g-num { font-size: 17px; font-weight: 700; color: var(--ink); width: 32px; height: 32px; line-height: 32px; text-align: center; border-radius: 50%; }
.g-cell.today .g-num { background: var(--accent); color: #fff; }
.g-count { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.g-count.zero { color: var(--ink-4); opacity: .55; }
.g-flag { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

/* ── Search ────────────────────────────────────────────────────────────────*/
.search { position: relative; margin-bottom: 11px; }
.search > svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-4); pointer-events: none; }
.search input {
  width: 100%; padding: 14px 44px 14px 45px; border: none; border-radius: var(--r-pill);
  background: var(--surface-2); font-family: var(--font); font-size: 16px; color: var(--ink);
  -webkit-appearance: none; transition: box-shadow .15s;
}
.search input::placeholder { color: var(--ink-4); }
.search input:focus { outline: none; box-shadow: 0 0 0 2px var(--accent); }
.search-clear { display: none; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: none; background: var(--surface-3); color: var(--ink-3); font-size: 13px; cursor: pointer; align-items: center; justify-content: center; }
.search.has-value .search-clear { display: flex; }

/* ── Calendar control bar ──────────────────────────────────────────────────*/
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; row-gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.period { display: flex; align-items: center; gap: 3px; min-width: 0; flex: 1 1 auto; }
.period .month-name {
  font-size: 18.5px; font-weight: 700; letter-spacing: -.4px; padding: 0 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.month-arrow {
  width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0;
  background: var(--surface-2); color: var(--ink-2); font-size: 19px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: background .12s, transform .12s;
}
.month-arrow:active { transform: scale(.9); background: var(--surface-3); }

/* Compact on phones so it can never crowd the Month/Week toggle; the label
   comes back once there is room for it. */
.today-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 32px; height: 32px; padding: 0; border-radius: 50%; border: none;
  background: var(--accent-tint); color: var(--accent-on-soft);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; margin-left: 3px; flex-shrink: 0; transition: transform .12s;
}
.today-btn:active { transform: scale(.9); }
/* Reserve the slot rather than removing it, so the bar never reflows when
   the button appears on navigating away from the current period. */
.today-btn.off { visibility: hidden; pointer-events: none; }
.today-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.today-btn span { display: none; }
@media (min-width: 560px) {
  .today-btn { width: auto; padding: 0 15px; border-radius: var(--r-pill); height: 34px; }
  .today-btn span { display: inline; }
}

.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; flex-shrink: 0; }
.seg button { border: none; background: transparent; padding: 9px 11px; border-radius: var(--r-pill); font-family: var(--font); font-size: 13.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; transition: background .22s var(--ease), color .22s; }
.seg button.active { background: var(--accent); color: #fff; }

/* ── Month grid ────────────────────────────────────────────────────────────*/
.month-grid { display: grid; grid-template-columns: repeat(7,1fr); row-gap: 5px; }
.m-dow { text-align: center; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-4); padding: 2px 0 10px; }
.m-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 5px 0 7px; min-height: 56px; cursor: pointer; border-radius: var(--r-sm); transition: background .12s; }
.m-cell:active { background: var(--surface-2); }
.m-num { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16.5px; font-weight: 500; color: var(--ink-2); transition: background .18s, color .18s; }
.m-cell.other .m-num { color: var(--ink-4); opacity: .6; }
.m-cell.has-events .m-num { font-weight: 700; color: var(--ink); }
.m-cell.selected .m-num { background: var(--accent-soft); color: var(--accent-on-soft); font-weight: 700; }
.m-cell.today .m-num { background: var(--accent); color: #fff; font-weight: 700; }
.m-dots { display: flex; gap: 3px; justify-content: center; height: 6px; }
.m-dot { width: 6px; height: 6px; border-radius: 50%; }

/* ── Week time grid ────────────────────────────────────────────────────────*/
.wk-head { display: grid; grid-template-columns: 46px repeat(7, 1fr); margin-bottom: 8px; }
.wk-hcell { text-align: center; }
.wk-dow { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-4); }
.wk-dnum { font-size: 15px; font-weight: 700; margin: 5px auto 0; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; }
.wk-hcell.today .wk-dnum { background: var(--accent); color: #fff; }

.wk-body { display: grid; grid-template-columns: 46px 1fr; }
.wk-gutter { position: relative; }
.wk-hr { position: absolute; right: 8px; font-size: 11.5px; font-weight: 600; color: var(--ink-4); transform: translateY(-50%); white-space: nowrap; }
.wk-grid {
  position: relative; display: grid; grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--sep-soft); border-bottom: 1px solid var(--sep-soft);
  background-image: repeating-linear-gradient(to bottom, var(--sep-soft) 0 1px, transparent 1px var(--hr, 58px));
}
.wk-col { position: relative; border-right: 1px solid var(--sep-soft); }
.wk-col:last-child { border-right: none; }
.wk-col.today { background: var(--accent-tint); }
.wk-ev { position: absolute; border-radius: 5px; cursor: pointer; overflow: hidden; padding: 2px 4px; transition: transform .1s; }
.wk-ev:active { transform: scale(.94); }
.wk-ev.is-clash-high { box-shadow: inset 0 0 0 2px var(--red); }
.wk-ev.is-clash-medium { box-shadow: inset 0 0 0 2px var(--orange); }
.wk-ev-t { display: none; font-size: 10.5px; font-weight: 700; color: #fff; line-height: 1.2; }
@media (min-width: 720px) { .wk-ev-t { display: block; } }
.wk-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 3; }
.wk-now::before { content: ''; position: absolute; left: -3px; top: -2.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.wk-note { font-size: 13px; color: var(--ink-4); margin-top: 12px; line-height: 1.5; }

/* ── Day header above the lesson list ──────────────────────────────────────*/
.agenda-hdr { display: flex; align-items: center; gap: 10px; padding: 0 2px 14px; margin-top: 24px; }
.ag-date { font-size: 18px; font-weight: 700; letter-spacing: -.4px; }
.badge-today { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 10px; border-radius: var(--r-pill); }
.ag-count { margin-left: auto; font-size: 13.5px; font-weight: 600; color: var(--ink-4); }

/* ── Timeline lesson list ──────────────────────────────────────────────────*/
.timeline { display: flex; flex-direction: column; }
.tl-time { background: var(--surface-2); border-radius: var(--r-xs); text-align: center; font-size: 13.5px; font-weight: 600; color: var(--ink-3); padding: 7px 0; margin: 12px 0 10px; }
.timeline > .tl-time:first-child { margin-top: 0; }

.lesson {
  position: relative; display: flex; gap: 13px; align-items: stretch;
  background: var(--surface); border: 1px solid var(--sep-soft);
  border-radius: var(--r); padding: 15px 16px; cursor: pointer;
  transition: transform .12s, background .15s;
}
[data-theme="dark"] .lesson { background: var(--surface-2); border-color: transparent; }
.lesson:active { transform: scale(.985); }
.lesson.is-next { background: var(--accent-soft); border-color: transparent; }
.lesson-rule { width: 4px; border-radius: 4px; flex-shrink: 0; background: var(--accent); }
.lesson-main { flex: 1; min-width: 0; padding-right: 32px; }
.lesson-title { font-size: 16.5px; font-weight: 700; letter-spacing: -.2px; line-height: 1.3; margin-bottom: 6px; }
.lesson-desc { font-size: 14.5px; line-height: 1.5; color: var(--ink-3); }
.lesson.is-next .lesson-desc { color: var(--ink-2); }
.lesson-desc .sep { opacity: .5; margin: 0 6px; }
.lesson-who { display: inline-flex; align-items: center; gap: 7px; }
.lesson-who i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.lesson-menu {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-2); border: none; color: var(--ink-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: transform .12s;
}
.lesson.is-next .lesson-menu { background: rgba(255,255,255,.55); }
[data-theme="dark"] .lesson.is-next .lesson-menu { background: rgba(255,255,255,.12); }
.lesson-menu:active { transform: scale(.88); }
.lesson-menu svg { width: 16px; height: 16px; }

.clash-tag { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: var(--r-pill); background: var(--red-soft); color: var(--red); }
.clash-tag svg { width: 13px; height: 13px; }
.clash-tag.medium { background: var(--orange-soft); color: var(--orange); }
.clash-tag.low { background: var(--surface-3); color: var(--ink-2); }

/* ── Upcoming list (Home) ──────────────────────────────────────────────────*/
.up-list { display: flex; flex-direction: column; }
.up-row { display: flex; align-items: center; gap: 13px; padding: 14px 2px; border-bottom: 1px solid var(--sep-soft); cursor: pointer; transition: opacity .12s; }
.up-row:last-child { border-bottom: none; }
.up-row:active { opacity: .6; }
.up-when { width: 68px; flex-shrink: 0; }
.up-day { font-size: 12.5px; font-weight: 700; color: var(--ink-4); text-transform: uppercase; letter-spacing: .04em; }
.up-time { font-size: 15px; font-weight: 700; color: var(--ink); margin-top: 3px; }
.up-rule { width: 4px; align-self: stretch; border-radius: 4px; flex-shrink: 0; }
.up-body { flex: 1; min-width: 0; }
.up-title { font-size: 16px; font-weight: 600; letter-spacing: -.15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-sub { font-size: 14px; color: var(--ink-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-warn { color: var(--red); flex-shrink: 0; display: flex; }
.up-warn svg { width: 18px; height: 18px; }

/* ── Clash cards ───────────────────────────────────────────────────────────*/
.clash-card { background: var(--surface-2); border-radius: var(--r); padding: 15px 16px; margin-bottom: 10px; }
.clash-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 8px; }
.clash-chip { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 5px 11px; border-radius: var(--r-pill); white-space: nowrap; }
.clash-chip.high   { background: var(--red-soft);    color: var(--red); }
.clash-chip.medium { background: var(--orange-soft); color: var(--orange); }
.clash-window { font-size: 13.5px; font-weight: 600; color: var(--ink-3); margin-left: auto; white-space: nowrap; }
.clash-msg { font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; margin-bottom: 4px; }
.clash-lessons { margin-top: 4px; }
.cl-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--sep-soft); }
.cl-row:last-child { border-bottom: none; }
.cl-row .up-rule { align-self: stretch; min-height: 34px; }

.all-clear { display: flex; align-items: center; gap: 11px; background: var(--green-soft); color: var(--green); border-radius: var(--r); padding: 14px 16px; font-size: 15px; font-weight: 600; }
.all-clear svg { width: 19px; height: 19px; flex-shrink: 0; }

/* ── Clash severity summary ────────────────────────────────────────────────*/
.clash-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 13px; }
.cs { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600;
      padding: 9px 14px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); }
.cs::before { content: ''; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cs.high::before   { background: var(--red); }
.cs.medium::before { background: var(--orange); }
.cs.zero { opacity: .45; }
.clash-scroll { max-height: 60vh; overflow-y: auto; margin-top: 4px; }
.clash-day { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-4); margin: 16px 0 9px; }
.clash-summary + .clash-day { margin-top: 4px; }

/* ── Tutor load ────────────────────────────────────────────────────────────*/
.load-row { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--sep-soft); }
.load-row:last-child { border-bottom: none; }
.load-name { flex: 1; font-size: 15.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-bar { width: 88px; height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; flex-shrink: 0; }
.load-fill { display: block; height: 100%; border-radius: 4px; min-width: 3px; }
.load-count { font-size: 14.5px; font-weight: 700; color: var(--ink-2); min-width: 22px; text-align: right; }

/* ── Empty state ───────────────────────────────────────────────────────────*/
.empty { text-align: center; padding: 38px 20px; color: var(--ink-3); }
.empty svg { width: 40px; height: 40px; color: var(--ink-4); margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--ink-2); }
.empty-sub { font-size: 14.5px; margin-top: 5px; }

/* ── Forms ─────────────────────────────────────────────────────────────────*/
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 8px; }
.field input[type="text"] {
  width: 100%; padding: 14px 15px; border: 1px solid var(--sep);
  border-radius: var(--r-sm); font-family: var(--font); font-size: 16px; color: var(--ink);
  background: var(--surface-2); -webkit-appearance: none;
  transition: border-color .15s, background .15s;
}
.field input::placeholder { color: var(--ink-4); }
.field input:focus { outline: none; border-color: var(--accent); }
.field-hint { font-size: 13px; color: var(--ink-4); margin-top: 8px; line-height: 1.5; }

.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--c); position: relative; box-shadow: 0 0 0 2px var(--bg), 0 0 0 2px transparent; transition: box-shadow .15s, transform .12s; }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c); }
.swatch input:checked + span::after { content:''; position: absolute; inset: 0; margin: auto; width: 11px; height: 6px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg) translate(1px,-2px); }
.swatch span:active { transform: scale(.9); }

/* ── Flash ─────────────────────────────────────────────────────────────────*/
.flash { padding: 14px 16px; border-radius: var(--r-sm); margin-bottom: 12px; font-size: 15px; font-weight: 600; }
.flash.success { background: var(--accent-tint); color: var(--accent-on-soft); }
.flash.error { background: var(--red-soft); color: var(--red); }

/* ── Admin: source rows ────────────────────────────────────────────────────*/
.src-list { display: flex; flex-direction: column; }
.src { position: relative; display: flex; gap: 13px; align-items: flex-start; padding: 16px 2px; border-bottom: 1px solid var(--sep-soft); }
.src:last-child { border-bottom: none; }
.src-swatch { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.src-info { flex: 1; min-width: 0; padding-right: 38px; }
.src-name { font-size: 16.5px; font-weight: 700; letter-spacing: -.2px; margin-bottom: 4px; }
.src-meta { font-size: 14px; color: var(--ink-3); line-height: 1.5; }
.src-meta .sep { opacity: .5; margin: 0 6px; }
.src-pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pill); text-transform: uppercase; letter-spacing: .05em; margin-top: 8px; }
.sp-active { background: var(--green-soft); color: var(--green); }
.sp-paused { background: var(--surface-3); color: var(--ink-3); }
.src-more { position: absolute; top: 14px; right: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: none; color: var(--ink-3); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .12s; }
.src-more:active { transform: scale(.88); }
.src-more svg { width: 16px; height: 16px; }

/* ── Admin: sync activity ──────────────────────────────────────────────────*/
.log-list { display: flex; flex-direction: column; }
.log-item { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--sep-soft); }
.log-item:last-child { border-bottom: none; }
.log-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ld-ok { background: var(--green); } .ld-error { background: var(--red); } .ld-skipped { background: var(--ink-4); }
.log-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-sub { font-size: 13px; color: var(--ink-4); font-weight: 500; }
.log-time { font-size: 13px; color: var(--ink-4); white-space: nowrap; flex-shrink: 0; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-4); font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.78); } }

.subscribe { display: flex; align-items: center; gap: 13px; background: var(--surface-2); border-radius: var(--r); padding: 15px 16px; }
.subscribe > svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.subscribe-body { flex: 1; min-width: 0; }
.subscribe-title { font-size: 15px; font-weight: 700; }
.subscribe-sub { font-size: 13.5px; color: var(--ink-3); margin-top: 3px; }

/* ── Overlay + sheet — must sit above the floating nav ─────────────────────*/
.overlay { display: none; position: fixed; inset: 0; z-index: 900; background: rgba(6,10,20,.5); align-items: flex-end; justify-content: center; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.overlay.open { display: flex; }
@media (min-width: 640px) { .overlay { align-items: center; } }
.sheet {
  background: var(--bg); width: 100%; max-width: 520px;
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 0 22px;
  padding-bottom: calc(30px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg); max-height: 88vh; overflow-y: auto;
  animation: sheetUp .34s var(--ease);
}
@media (min-width: 640px) { .sheet { border-radius: var(--r-xl); width: min(500px,92vw); padding-bottom: 26px; animation: popIn .22s ease; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes popIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.sheet-pull { width: 40px; height: 4px; background: var(--surface-3); border-radius: 4px; margin: 12px auto 18px; }
@media (min-width: 640px) { .sheet-pull { display: none; } }
.sheet-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.sheet-title { font-size: 20px; font-weight: 700; letter-spacing: -.4px; line-height: 1.3; flex: 1; }
.sheet-x { width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--ink-3); font-size: 15px; font-weight: 700; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sheet-row { display: flex; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--sep-soft); }
.sheet-row:last-child { border-bottom: none; }
.sheet-ico { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--accent-tint); color: var(--accent-on-soft); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sheet-ico svg { width: 19px; height: 19px; }
.sheet-lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-4); margin-bottom: 4px; }
.sheet-val { font-size: 16px; line-height: 1.45; }
.sheet-tutor { display: inline-flex; align-items: center; gap: 8px; border-radius: var(--r-pill); padding: 10px 17px; font-size: 15px; font-weight: 700; margin-top: 18px; }

.act-list { display: flex; flex-direction: column; }
.act { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 4px; background: none; border: none; cursor: pointer; font-family: var(--font); font-size: 16.5px; font-weight: 600; color: var(--ink); text-align: left; border-bottom: 1px solid var(--sep-soft); transition: opacity .12s; }
.act:last-child { border-bottom: none; }
.act:active { opacity: .55; }
.act svg { width: 20px; height: 20px; color: var(--ink-3); flex-shrink: 0; }
.act.danger, .act.danger svg { color: var(--red); }

/* ── Free-slot results ─────────────────────────────────────────────────────*/
#f-results:not(:empty) { margin-top: 6px; }
.slot-day { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-4); margin: 18px 0 2px; }
.slot { display: flex; align-items: center; gap: 13px; padding: 14px 2px; border-bottom: 1px solid var(--sep-soft); cursor: pointer; transition: opacity .12s; }
.slot:active { opacity: .6; }
.slot-time { font-size: 16px; font-weight: 700; }
.slot-tutor { font-size: 14px; color: var(--ink-3); margin-top: 3px; }
.slot-len { margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--accent-on-soft); background: var(--accent-tint); padding: 5px 10px; border-radius: var(--r-pill); white-space: nowrap; }

/* ── Offline indicator ─────────────────────────────────────────────────────*/
.offline-pill {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 450;
  top: calc(env(safe-area-inset-top) + 10px);
  background: var(--ink); color: var(--bg);
  padding: 10px 17px; border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  box-shadow: var(--shadow-nav);
}

/* ── Floating pill nav ─────────────────────────────────────────────────────*/
.tabbar {
  position: fixed; left: 0; right: 0; z-index: 400;
  bottom: max(10px, env(safe-area-inset-bottom));
  display: flex; justify-content: center; pointer-events: none;
  transition: opacity .2s ease, transform .28s var(--ease);
}
/* Get out of the way entirely while a sheet is open. */
body.sheet-open .tabbar { opacity: 0; transform: translateY(26px); pointer-events: none; }
.tabbar-inner { pointer-events: auto; display: flex; align-items: center; gap: 3px; background: var(--nav-bg); padding: 7px; border-radius: var(--r-pill); box-shadow: var(--shadow-nav); }
.tab {
  height: 52px; min-width: 52px; padding: 0; border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  color: var(--nav-ink); border: none; background: transparent; cursor: pointer;
  transition: background .38s var(--ease), color .3s ease, padding .38s var(--ease);
}
.tab svg { width: 23px; height: 23px; flex-shrink: 0; }
.tab-label { font-size: 15px; font-weight: 600; white-space: nowrap; max-width: 0; opacity: 0; margin-left: 0; overflow: hidden; transition: max-width .38s var(--ease), opacity .26s ease, margin-left .38s var(--ease); }
.tab.active { background: var(--nav-active-bg); color: var(--nav-active-ink); padding: 0 19px; }
.tab.active .tab-label { max-width: 140px; opacity: 1; margin-left: 10px; }
.tab:not(.active):active { background: rgba(255,255,255,.09); }
@media (prefers-reduced-motion: reduce) { .tab, .tab-label, .tabbar { transition: none; } }

/* ── PIN pad ───────────────────────────────────────────────────────────────*/
.pin-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.pin-card { width: 100%; max-width: 340px; text-align: center; }
.pin-icon { width: 58px; height: 58px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-on-soft); display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.pin-icon svg { width: 27px; height: 27px; }
.pin-title { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.pin-sub { font-size: 15px; color: var(--ink-3); margin: 7px 0 26px; }
.pin-dots { display: flex; justify-content: center; gap: 15px; margin-bottom: 26px; }
.pin-dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--sep); transition: background .12s, border-color .12s; }
.pin-dot.filled { background: var(--accent); border-color: var(--accent); }
.pin-dot.error { border-color: var(--red); background: var(--red); }
.pin-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.pin-key { height: 62px; border-radius: var(--r); border: none; background: var(--surface-2); color: var(--ink); font-family: var(--font); font-size: 23px; font-weight: 600; cursor: pointer; transition: background .1s, transform .1s; }
.pin-key:active { transform: scale(.94); background: var(--surface-3); }
.pin-key.wide { font-size: 16px; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-8px)} 40%,80%{transform:translateX(8px)} }
.shake { animation: shake .4s; }

.hidden { display: none !important; }
