/* ClassBook — styles (landing + app) */

:root {
  --ink: #1c1a2e;
  --muted: #6f6b85;
  --line: #e4e2f0;
  --bg: #f5f5fa;
  --card: #ffffff;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #15803d;
  --sidebar: #171233;
  --sidebar-ink: #c9c4e8;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(28, 26, 46, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.full { width: 100%; }
.r { text-align: right; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.strong { font-weight: 700; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: .55rem 1rem;
  border-radius: 9px;
  font-size: .95rem;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}
.btn:hover { border-color: #c9c4e8; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-soft { color: var(--danger); border-color: #fecaca; }
.btn-danger-soft:hover { background: #fef2f2; border-color: #fca5a5; }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; border-radius: 7px; }
.btn-lg { padding: .8rem 1.6rem; font-size: 1.05rem; border-radius: 11px; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.file-btn { cursor: pointer; }
.hidden-file { display: none; }

.icon-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 1rem; padding: .3rem .45rem; border-radius: 7px; color: var(--muted);
}
.icon-btn:hover { background: #efedfa; }
.icon-btn.danger:hover { color: var(--danger); }

.badge {
  font-size: .72rem; font-weight: 600; padding: .12rem .5rem;
  border-radius: 999px; vertical-align: middle; white-space: nowrap;
}
.badge-ok { background: #dcfce7; color: var(--ok); border: 1px solid #bbf7d0; }
.badge-warn { background: #fef3c7; color: var(--warn); border: 1px solid #fde68a; }
.badge-bad { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.badge-info { background: #e0e7ff; color: var(--primary-dark); border: 1px solid #c7d2fe; }
.badge-muted { background: #f1f0f7; color: var(--muted); border: 1px solid var(--line); }
.badge-admin { background: var(--primary); color: #fff; }
.badge-staff { background: #e0e7ff; color: var(--primary-dark); border: 1px solid #c7d2fe; }
.badge-featured { background: var(--primary); color: #fff; }

kbd {
  background: #efedfa; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 .35rem; font-size: .78rem; font-family: inherit;
}

/* ---------- landing ---------- */
.landing { background: #fff; }
.landing-wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

.landing-nav {
  position: sticky; top: 0; background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); z-index: 10;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.nav-inner nav { display: flex; align-items: center; gap: 1.4rem; }
.nav-inner nav a { color: var(--ink); }
.logo { font-weight: 800; font-size: 1.25rem; }

.hero {
  text-align: center; padding: 4.5rem 0 3.5rem;
  background: linear-gradient(180deg, #eef0ff 0%, #ffffff 100%);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.12; margin: 0 0 1rem; }
.hero-sub { font-size: 1.15rem; color: var(--muted); max-width: 620px; margin: 0 auto 2rem; }
.hero-cta { display: flex; gap: 1rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.pin-note { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: .55rem 1rem; border-radius: 9px; }
.hero-stats {
  display: flex; gap: 2.5rem; justify-content: center; flex-wrap: wrap; margin-top: 3rem;
}
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.4rem; color: var(--primary); }
.hero-stats span { color: var(--muted); font-size: .85rem; }

.section { padding: 3.5rem 0; }
.section.alt { background: var(--bg); }
.section h2 { text-align: center; font-size: 1.9rem; margin: 0 0 2.2rem; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.25rem; }
.feature-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.feature-icon { font-size: 1.8rem; }
.feature-card h3 { margin: .6rem 0 .4rem; }
.feature-card p { color: var(--muted); margin: 0; line-height: 1.55; }

.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.25rem; align-items: stretch; }
.price-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.75rem; text-align: center; box-shadow: var(--shadow); position: relative;
}
.price-card.featured { border: 2px solid var(--primary); }
.price-card .badge-featured { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); }
.price-card .price { font-size: 2.2rem; font-weight: 800; margin: .5rem 0 1rem; }
.price-card .price span { font-size: .9rem; color: var(--muted); font-weight: 400; }
.price-card ul { list-style: none; padding: 0; margin: 0 0 1.5rem; color: var(--muted); line-height: 1.9; }

.landing-footer { border-top: 1px solid var(--line); padding: 1.5rem 0; }
.landing-footer .landing-wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- login ---------- */
.login-screen {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #171233, #4f46e5);
  padding: 1rem;
}
.login-card {
  background: #fff; border-radius: 18px; padding: 2.2rem; width: 100%; max-width: 360px;
  text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.login-logo { font-size: 2.6rem; }
.login-card h1 { margin: .3rem 0 .2rem; }
.login-card input {
  width: 100%; padding: .8rem; font-size: 1.3rem; text-align: center;
  letter-spacing: .35em; border: 1px solid var(--line); border-radius: 10px; margin: 1rem 0 .4rem;
}
.error-text { color: var(--danger); min-height: 1.2em; margin: .2rem 0 .6rem; font-size: .9rem; }
.login-card .muted.small { margin-top: 1rem; }
#setup-screen .login-card input { font-size: 1rem; letter-spacing: normal; text-align: left; margin: .45rem 0 0; }

/* ---------- demo banner ---------- */
.demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  background: #fff7e0; color: #7a5b00; border: 1px solid #ecd27a; border-radius: 10px;
  padding: .55rem .9rem; margin: .75rem 1rem 0; font-size: .9rem;
}
.demo-banner-x {
  border: none; background: none; color: inherit; cursor: pointer;
  font-size: 1rem; line-height: 1; padding: .25rem; flex: none;
}

/* ---------- app shell ---------- */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: 230px; flex: none; background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; padding: 1.1rem .8rem;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.sidebar-brand { padding: .2rem .6rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .logo { color: #fff; display: block; }
.shop-name { font-size: .85rem; color: #9a94c4; display: block; }
.cashier-name { font-size: .82rem; color: #bdb7f5; display: block; margin-top: .15rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: .25rem; margin-top: 1rem; flex: 1; }
.nav-item {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  color: var(--sidebar-ink); padding: .6rem .7rem; border-radius: 9px; cursor: pointer;
  font-size: .95rem; font-family: inherit;
}
a.nav-item:hover { text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: var(--primary); color: #fff; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: .6rem; display: flex; flex-direction: column; gap: .25rem; }

.main { flex: 1; min-width: 0; padding: 0 1.5rem 2.5rem; }
.topbar {
  display: flex; align-items: center; gap: .6rem; padding: 1rem 0;
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.topbar h2 { margin: 0; font-size: 1.35rem; }
.menu-btn { display: none; font-size: 1.3rem; }

/* bottom nav (phones only, shown via media query) */
.bottom-nav { display: none; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem;
}
.card h3 { margin-top: 0; }

/* dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .3rem;
  min-width: 0;
}
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-value { font-size: 1.6rem; font-weight: 800; overflow-wrap: anywhere; }
.stat-sub { color: var(--muted); font-size: .8rem; }
.stat-card.warn .stat-value { color: var(--warn); }
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  padding: .65rem 0; border-bottom: 1px solid var(--line);
}
.recent-list li:last-child { border-bottom: none; }
.hist-amt { text-align: right; flex: none; }

/* charts */
.chart-box { margin-top: .8rem; overflow-x: auto; }
.chart-svg { width: 100%; height: auto; min-width: 0; display: block; }
.chart-value { font-size: 12px; fill: var(--ink); font-weight: 600; }
.chart-tick { font-size: 11px; fill: var(--muted); }
.chart-name { font-size: 12.5px; fill: var(--ink); }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.chart-grid .card { margin-bottom: 1.25rem; }
#view-payments .chart-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* toolbar / tables */
.toolbar { display: flex; gap: .8rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar h3 { margin: 0; }
.toolbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.search-input {
  flex: 1; min-width: 220px; padding: .65rem .9rem; border: 1px solid var(--line);
  border-radius: 10px; font-size: 1rem; background: #fff; font-family: inherit;
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: .93rem; }
.table-narrow { min-width: 0; }
.table th, .table td { padding: .6rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }
.row-actions { white-space: nowrap; }
.row-actions .btn { margin-right: .3rem; }

/* report rows */
.zrow { display: flex; justify-content: space-between; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--line); align-items: center; }
.zrow:last-child { border-bottom: none; }

/* ---------- calendar ---------- */
.mode-toggle { display: inline-flex; gap: .3rem; }
.cal-mode-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; }
.week-day {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; overflow: hidden;
}
.week-day.is-today { border: 2px solid var(--primary); }
.week-day-head {
  display: flex; align-items: center; gap: .4rem; padding: .55rem .6rem;
  border-bottom: 1px solid var(--line); background: #fafaff; flex-wrap: wrap;
}
.week-dow { font-weight: 700; font-size: .82rem; text-transform: uppercase; color: var(--muted); }
.week-dom { font-weight: 800; font-size: 1.05rem; }
.today-tag {
  background: var(--primary); color: #fff; font-size: .68rem; font-weight: 700;
  padding: .1rem .45rem; border-radius: 999px;
}
.week-day-body { padding: .5rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.week-empty { text-align: center; padding: .4rem 0; }

.session-chip {
  display: flex; flex-direction: column; gap: .05rem; text-align: left;
  background: #f4f3ff; border: 1px solid #ddd9fb; border-radius: 9px;
  padding: .45rem .5rem; cursor: pointer; font-family: inherit; min-width: 0; width: 100%;
}
.session-chip:hover { border-color: var(--primary); }
.session-chip .chip-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip-time { font-size: .78rem; font-weight: 700; color: var(--primary-dark); }
.chip-name { font-weight: 700; font-size: .85rem; overflow-wrap: anywhere; }
.chip-sub { font-size: .75rem; }
.session-chip.status-completed { background: #f0fdf4; border-color: #bbf7d0; }
.session-chip.status-cancelled { opacity: .55; text-decoration: line-through; }
.session-chip.status-noshow { background: #fef2f2; border-color: #fecaca; }

.list-day { margin-bottom: 1.1rem; }
.list-day h4 { margin: 0 0 .5rem; display: flex; align-items: center; gap: .5rem; }
.list-day-items { display: flex; flex-direction: column; gap: .5rem; }
.list-session {
  display: flex; align-items: center; gap: .8rem; text-align: left; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .7rem .9rem; cursor: pointer; font-family: inherit; box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.list-session:hover { border-color: var(--primary); }
.ls-time { font-weight: 700; color: var(--primary-dark); white-space: nowrap; }
.ls-main { flex: 1; display: flex; flex-direction: column; min-width: 140px; }
.list-session.status-cancelled { opacity: .6; }

/* ---------- booking ---------- */
.booking-card { max-width: 860px; }
.day-preview {
  background: #f4f3ff; border: 1px solid #ddd9fb; border-radius: 9px;
  padding: .6rem .8rem; font-size: .88rem; margin: .4rem 0 1rem;
}
.error-box {
  background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d;
  border-radius: 9px; padding: .7rem .9rem; font-size: .92rem; margin: 0 0 1rem;
}
.check-row { display: flex; align-items: center; gap: .5rem; font-size: .95rem; color: var(--ink); cursor: pointer; }
.check-row input { width: 18px; height: 18px; }
.field-label .check-row input { width: 18px; flex: none; padding: 0; }
.weeks-input {
  width: 64px; padding: .35rem .45rem; border: 1px solid var(--line); border-radius: 7px;
  font-size: .95rem; font-family: inherit;
}

/* ---------- people (teachers) ---------- */
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.person-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .7rem; min-width: 0;
}
.person-head { display: flex; align-items: center; gap: .6rem; }
.person-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.person-title strong { overflow-wrap: anywhere; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.rate-badge {
  background: #eef0ff; color: var(--primary-dark); border: 1px solid #c7d2fe;
  font-weight: 700; font-size: .85rem; padding: .25rem .6rem; border-radius: 999px; white-space: nowrap;
}
.person-meta { line-height: 1.6; }

.swatch-row { display: flex; gap: .45rem; flex-wrap: wrap; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; padding: 0;
}
.swatch.active { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }

/* ---------- reminders ---------- */
.reminder-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.reminder-head { display: flex; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.reminder-text {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: .7rem .8rem;
  font-family: inherit; font-size: .95rem; background: #fafaff; margin-bottom: .7rem; resize: vertical;
}

/* ---------- totals grid (modals) ---------- */
.totals-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: .8rem 0 1rem;
}
.totals-grid > div {
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
  padding: .6rem .8rem; display: flex; flex-direction: column; gap: .15rem;
}
.totals-grid span { color: var(--muted); font-size: .8rem; }
.totals-grid strong { font-size: 1.1rem; }

/* ---------- forms ---------- */
.field-label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--muted); margin-bottom: .8rem; min-width: 0; }
.field-label input, .field-label select, .field-label textarea {
  padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 9px;
  font-size: 1rem; color: var(--ink); background: #fff; font-family: inherit; min-width: 0; width: 100%;
}
.field-inline { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--muted); }
.field-inline input {
  padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 9px;
  font-size: 1rem; color: var(--ink); background: #fff; font-family: inherit;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .7rem; }
.form-row > * { min-width: 0; }
.settings-form { max-width: 560px; }
.danger-card { border-color: #fecaca; }
.input-with-btn { display: flex; gap: .5rem; align-items: stretch; }
.input-with-btn input {
  flex: 1; min-width: 0; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 9px;
  font-size: 1rem; color: var(--ink); background: #fff; font-family: inherit;
}
.add-user-form { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }

/* payment method chips */
.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .8rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; background: #eef0ff;
  border: 1px solid #c7d2fe; color: var(--primary-dark); border-radius: 999px;
  padding: .3rem .4rem .3rem .75rem; font-size: .9rem; font-weight: 600;
}
.chip-x {
  border: none; background: transparent; color: var(--primary-dark); cursor: pointer;
  font-size: .8rem; padding: .15rem .35rem; border-radius: 999px; line-height: 1;
}
.chip-x:hover { background: #dbeafe; color: var(--danger); }

/* modals: scrollable body + always-visible actions */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(23, 18, 51, .55);
  display: flex; align-items: center; justify-content: center; padding: .75rem; z-index: 50;
}
.modal {
  background: #fff; border-radius: 16px; width: min(480px, 100%);
  max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-wide { width: min(640px, 100%); }
.modal > h3 { margin: 0; padding: 1.2rem 1.4rem .4rem; }
.modal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: .6rem 1.4rem 1rem; }
.modal-body h4 { margin: 1rem 0 .5rem; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap;
  padding: .85rem 1.4rem 1.1rem; border-top: 1px solid var(--line); background: #fff; flex: none;
}

/* ---------- packages / waitlist / availability ---------- */
.package-row {
  display: flex; justify-content: space-between; gap: .8rem; align-items: center;
  padding: .6rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.package-row:last-child { border-bottom: none; }
.package-remaining { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.workday-row { display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.avail-warn { color: var(--warn); font-weight: 600; }

/* toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: .7rem 1.2rem; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */

/* large desktop: a touch more breathing room */
@media (min-width: 1440px) {
  .main { padding: 0 2rem 2.5rem; }
}

/* tablet landscape / small laptop */
@media (max-width: 1100px) {
  .sidebar { width: 205px; }
}

/* tablet portrait: charts stack, week grid scrolls horizontally */
@media (max-width: 960px) {
  .chart-grid { grid-template-columns: 1fr; }
  #view-payments .chart-grid { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: repeat(7, minmax(120px, 1fr)); overflow-x: auto; padding-bottom: .4rem; }
}

/* small tablet / large phone: sidebar becomes a drawer */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%);
    transition: transform .25s; box-shadow: 0 0 40px rgba(0,0,0,.3); width: min(260px, 84vw);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: block; }
  .main { padding: 0 1rem 2rem; }
  .nav-item { min-height: 44px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .field-label input, .field-label select, .field-label textarea,
  .field-inline input, .input-with-btn input, .search-input { min-height: 44px; font-size: 16px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .modal > h3 { padding: 1rem 1.1rem .3rem; }
  .modal-body { padding: .5rem 1.1rem .9rem; }
  .modal-actions { padding: .8rem 1.1rem 1rem; }
  .modal-actions .btn { flex: 1; }
}

/* phones: bottom nav, single-column everything, no horizontal overflow */
@media (max-width: 480px) {
  .main { padding: 0 .8rem 96px; }
  .topbar { padding: .7rem 0; }
  .topbar h2 { font-size: 1.15rem; }
  .card { padding: 1rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .stat-value { font-size: 1.25rem; }
  .form-row { grid-template-columns: 1fr; }
  .toolbar-actions { width: 100%; }
  .search-input { min-width: 0; width: 100%; }
  .totals-grid { grid-template-columns: 1fr; }
  .person-grid { grid-template-columns: 1fr; }
  .toast { bottom: 86px; }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--sidebar); padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 18px rgba(0,0,0,.25);
  }
  .bottom-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem;
    background: transparent; border: none; color: var(--sidebar-ink);
    font-size: .68rem; font-family: inherit; padding: .4rem .1rem; border-radius: 9px;
    min-height: 52px; cursor: pointer;
  }
  .bottom-nav-item span { font-size: 1.15rem; line-height: 1; }
  .bottom-nav-item.active { background: var(--primary); color: #fff; }
}

/* very small phones */
@media (max-width: 360px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ---------- printable progress report ---------- */
.print-area { display: none; }

@media print {
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; color: #111; font-size: 12.5px; line-height: 1.5; }
  .print-area h1 { font-size: 20px; margin: 0; }
  .print-area h2 { font-size: 14px; margin: 16px 0 6px; border-bottom: 1px solid #999; padding-bottom: 3px; }
  .pr-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #111; padding-bottom: 8px; }
  .pr-head p { margin: 2px 0; }
  .pr-head-right { text-align: right; }
  .pr-table { width: 100%; border-collapse: collapse; margin: 4px 0 8px; }
  .pr-table th, .pr-table td { border: 1px solid #bbb; padding: 4px 6px; text-align: left; vertical-align: top; }
  .pr-table th { background: #f0f0f0; }
  .pr-muted { color: #555; font-size: 11px; }
  .pr-foot { margin-top: 18px; color: #555; font-size: 11px; border-top: 1px solid #999; padding-top: 6px; }
}
