/* ===== Thrive Dance Ministry — prototype styles ===== */
:root {
  /* Brand ramp built from the logo's #D92887 magenta */
  --grape-900: #45102f;  /* darkest — sidebar, headings */
  --grape-700: #a01863;  /* deep magenta */
  --grape-600: #D92887;  /* PRIMARY (logo color) */
  --grape-500: #ec5ba6;  /* hover/light */
  --grape-100: #fbe1ef;  /* tint — chips, focus glow */
  --grape-50:  #fdf3f9;  /* faint surface tint */

  --coral: #ff6b6b;
  --gold:  #f5a623;
  --teal:  #2bb3a3;
  --green: #2e9e5b;
  --red:   #d64545;

  --ink:    #2c1d27;
  --ink-2:  #6b5560;
  --ink-3:  #9b8893;
  --line:   #efe6ea;
  --bg:     #fbf9fa;
  --card:   #ffffff;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(69,16,47,.06), 0 8px 24px rgba(69,16,47,.07);
  --shadow-lg: 0 12px 40px rgba(69,16,47,.20);
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; color: var(--grape-900); letter-spacing: -0.01em; }
a { color: var(--grape-600); }

/* ===== Layout ===== */
#app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(185deg, var(--grape-900), var(--grape-700));
  color: #fff; padding: 22px 16px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto; overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.brand { padding: 4px 10px 14px; }
.brand .brand-logo {
  width: 100%; max-width: 160px; margin: 0 auto; display: block;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.22));
}

.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 13px; border: 0; background: transparent; color: var(--grape-100);
  border-radius: 10px; cursor: pointer; text-align: left; font-size: 14.5px; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-item .ico { width: 19px; text-align: center; font-size: 16px; }
.nav-item .nav-badge {
  margin-left: auto; background: #e0313f; color: #fff; font-size: 11px; font-weight: 700;
  line-height: 1; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px rgba(0,0,0,.12);
}
/* Role switcher */
.role-switch { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); border-radius: 11px; padding: 10px 11px; margin-bottom: 12px; }
.role-switch label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--grape-100); opacity: .85; margin-bottom: 5px; font-weight: 700; }
.role-switch select { width: 100%; padding: 7px 9px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.18); color: #fff; font-weight: 600; font-size: 13px; }
.role-switch select option { color: #2c1d27; }

/* Class chat */
.chat-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; height: 64vh; overflow: hidden; }
.chat-thread { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: 72%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-meta { font-size: 11px; color: var(--ink-3); margin-bottom: 3px; padding: 0 4px; }
.chat-bubble { display: inline-block; text-align: left; padding: 9px 13px; border-radius: 14px; background: var(--grape-50); border: 1px solid var(--line); font-size: 14px; white-space: pre-wrap; }
.chat-msg.mine .chat-bubble { background: var(--grape-600); color: #fff; border-color: var(--grape-600); }
.chat-input { display: flex; gap: 9px; padding: 12px; border-top: 1px solid var(--line); background: var(--card); }
.chat-input input { flex: 1; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.chat-input input:focus { border-color: var(--grape-500); box-shadow: 0 0 0 3px var(--grape-100); }

.nav-spacer { flex: 1; }
.nav-foot { font-size: 11px; color: var(--grape-100); opacity: .6; padding: 8px; }
.nav-account { padding: 9px 10px; margin-top: 4px; border-top: 1px solid rgba(255,255,255,.14); text-align: center; }
.na-email { font-size: 11.5px; color: var(--grape-100); opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.na-status { font-size: 11px; color: var(--grape-100); opacity: .85; min-height: 14px; margin-bottom: 6px; }
.na-logout { display: block; margin: 0 auto; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.12); color: #fff; border-radius: 999px; padding: 5px 20px; cursor: pointer; font-weight: 700; font-size: 12px; }
.na-logout:hover { background: rgba(255,255,255,.24); }

.main { padding: 28px 34px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 25px; }
.page-head .sub { color: var(--ink-2); font-size: 14px; margin-top: 3px; }
.head-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
  font-weight: 600; font-size: 14px; transition: transform .05s, box-shadow .12s, background .12s;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grape-600); border-color: var(--grape-600); color: #fff; }
.btn.primary:hover { background: var(--grape-700); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #f1c9c9; }
.btn.danger:hover { background: #fceded; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 7px 9px; }

/* ===== Cards & grids ===== */
.cards { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card h3 { font-size: 15px; margin-bottom: 12px; }

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat .num { font-size: 30px; font-weight: 800; color: var(--grape-700); line-height: 1; }
.stat .lbl { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.stat .ico { font-size: 22px; }
.stat-row { display: flex; align-items: center; justify-content: space-between; }

/* ===== Tables ===== */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; background: var(--grape-50); }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--grape-50); }
.t-name { font-weight: 600; color: var(--grape-900); }
.t-sub { color: var(--ink-3); font-size: 12.5px; }

/* ===== Badges & pills ===== */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.grape { background: var(--grape-100); color: var(--grape-700); }
.badge.teal  { background: #d9f3ef; color: #14756a; }
.badge.gold  { background: #fdf0d6; color: #8a5d05; }
.badge.coral { background: #ffe2e2; color: #b53636; }
.badge.green { background: #dcf2e4; color: #1f7a42; }
.badge.red   { background: #fbe0e0; color: #b02a2a; }
.badge.gray  { background: #eceaef; color: var(--ink-2); }
.med-flag { background: #fff0e6; color: #b8480c; border: 1px solid #ffd9bf; }

.costume-note { background: var(--grape-50); border: 1px solid var(--line); border-left: 3px solid var(--grape-500); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; color: var(--ink); margin-bottom: 12px; white-space: pre-wrap; }
.fit-block { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.fit-size:focus { outline: none; border-color: var(--grape-500); box-shadow: 0 0 0 3px var(--grape-100); }
.chip { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; background:var(--grape-50); border:1px solid var(--line); border-radius:999px; font-size:12.5px; font-weight:600; color:var(--grape-700); }
.chip .x { cursor:pointer; opacity:.6; font-weight:700; }
.chip .x:hover { opacity:1; }

/* ===== Forms ===== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--grape-500); box-shadow: 0 0 0 3px var(--grape-100); }
.field textarea { resize: vertical; min-height: 64px; }
/* fine print — was .field-only, so hints outside a field rendered at body size */
.hint, .field .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px 4px; margin: 0 0 16px; }
legend { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--grape-600); padding: 0 6px; }

/* ===== Modal ===== */
/* Height uses dvh (dynamic viewport) so the box tracks the *visible* area as the
   mobile browser's toolbar shows/hides; vh is kept as a fallback for old browsers. */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh; background: rgba(46,19,56,.45); display: grid; place-items: center; z-index: 100; padding: 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); backdrop-filter: blur(2px); }
.modal { background: var(--card); border-radius: 18px; width: 100%; max-width: 720px; max-height: 90vh; max-height: 90dvh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal-head { position: sticky; top: 0; background: var(--card); padding: 20px 24px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; z-index: 2; }
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 20px 24px; }
.modal-foot { position: sticky; bottom: 0; background: var(--card); padding: 14px 24px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal .close { border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--ink-3); line-height: 1; }
.modal .close:hover { color: var(--ink); }

/* ===== Misc ===== */
.hidden { display: none !important; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search { flex: 1; min-width: 200px; position: relative; }
.search input { width: 100%; padding: 10px 12px 10px 34px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.search::before { content: "🔍"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .5; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty .big { font-size: 38px; margin-bottom: 10px; }
.muted { color: var(--ink-3); }
/* a name that opens its record — button, not an anchor, since it goes nowhere */
.name-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600;
  color: var(--grape-900); text-align: left; cursor: pointer; }
.name-link:hover { color: var(--grape-600); text-decoration: underline; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; margin: 26px 0 12px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; }
.recital-kv { grid-template-columns: 180px 1fr; }
.recital-kv dd { white-space: pre-wrap; }
.alert-strip { background: #fff0e6; border: 1px solid #ffd9bf; color: #8a3d0c; border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13.5px; display:flex; gap:9px; align-items:flex-start; }
.alert-strip code, code { background: rgba(0,0,0,.07); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; font-family: "Consolas", "Courier New", monospace; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--grape-900); color: #fff; padding: 12px 20px; border-radius: 11px; box-shadow: var(--shadow-lg); z-index: 200; font-weight: 600; font-size: 14px; }
.seg { display: inline-flex; background: var(--grape-50); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.sub-toggle { margin-bottom: 16px; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.seg button.active { background: #fff; color: var(--grape-700); box-shadow: var(--shadow); }

/* Weekly schedule grid */
.sched-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.sched { width: 100%; border-collapse: collapse; min-width: 720px; }
table.sched thead th { background: var(--grape-50); color: var(--grape-700); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 13px; border-bottom: 2px solid var(--line); text-align: center; font-weight: 800; }
table.sched td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; padding: 7px; min-width: 160px; }
table.sched tr:last-child td { border-bottom: 0; }
table.sched .time-col { width: 92px; min-width: 92px; text-align: right; font-weight: 700; color: var(--ink-2); font-size: 12.5px; background: var(--grape-50); white-space: nowrap; padding: 10px 12px; border-right: 2px solid var(--line); }
.sched-block { position: relative; border-radius: 10px; padding: 9px 11px; margin-bottom: 6px; cursor: pointer; line-height: 1.25; transition: transform .06s, box-shadow .12s, filter .12s; }
.sched-block:last-child { margin-bottom: 0; }
.sched-block:hover { transform: translateY(-1px); box-shadow: var(--shadow); filter: brightness(1.04); }
.sb-style { font-weight: 700; font-size: 13px; }
.sb-grade { font-size: 12px; opacity: .92; }
.sb-time { font-size: 11px; opacity: .9; margin-top: 3px; font-weight: 600; }
.sb-loc { font-size: 10px; opacity: .9; text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; font-weight: 700; }
.sb-count { position: absolute; top: 7px; right: 8px; background: rgba(255,255,255,.4); font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 7px; }
.sched-day { margin-bottom: 18px; }
.sched-day h3 { font-size: 16px; color: var(--grape-700); border-bottom: 2px solid var(--grape-100); padding-bottom: 6px; margin-bottom: 10px; }
.sched-notes { margin-top: 16px; color: var(--ink-2); font-size: 12.5px; }
.sched-notes p { margin: 3px 0; }

/* Attendance: session list + marking panel */
.att-layout { display: grid; grid-template-columns: 234px 1fr; gap: 18px; align-items: start; }
.sess-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 72vh; overflow: auto; padding: 6px; }
.sess-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; border: 0; background: transparent; padding: 9px 11px; border-radius: 9px; cursor: pointer; text-align: left; font-size: 13.5px; transition: background .1s; }
.sess-row:hover { background: var(--grape-50); }
.sess-row.active { background: var(--grape-100); }
.sess-row.active .sess-date { color: var(--grape-700); font-weight: 700; }
.sess-row.closed { opacity: .55; }
.sess-date { font-weight: 600; color: var(--ink); }
.mark-panel { min-width: 0; }
@media (max-width: 920px) { .att-layout { grid-template-columns: 1fr; } .sess-list { max-height: 220px; } }

.att-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 12px; cursor: pointer; font-weight: 600; font-size: 13px; }
.att-btn.present.on { background: var(--green); color: #fff; border-color: var(--green); }
.att-btn.late.on { background: var(--gold); color: #fff; border-color: var(--gold); }
.att-btn.absent.on { background: var(--red); color: #fff; border-color: var(--red); }
.photo-ph { aspect-ratio: 1 / 1; background: var(--grape-50); border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; font-size: 28px; opacity: .5; }

/* Media gallery */
.media-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.media-thumb-wrap { position: relative; aspect-ratio: 1 / 1; background: var(--grape-50); cursor: pointer; display: block; }
.media-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb-wrap:hover .media-thumb { opacity: .9; }
.media-play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.6); pointer-events: none; }
.media-meta { padding: 9px 11px; display: flex; flex-direction: column; gap: 6px; }
.media-title { font-weight: 600; font-size: 13.5px; color: var(--grape-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Team Access controls */
.ac-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.ac-field select, .ac-field input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink); background: #fff; }
.ac-field .ac-teacher { width: 150px; }

/* Per-teacher payroll sheet */
table.payroll th, table.payroll td { text-align: center; white-space: nowrap; padding: 9px 12px; }
table.payroll thead th { background: var(--grape-50); color: var(--grape-700); font-size: 12px; }
table.payroll .pr-row { text-align: left; font-weight: 600; background: var(--grape-50); position: sticky; left: 0; z-index: 1; }
table.payroll .pr-sec td { background: #faf7fb; }
table.payroll .pr-total td { font-weight: 700; border-top: 2px solid var(--line); background: var(--grape-50); }

.att-row { display: flex; gap: 8px; margin-top: 10px; }
.att-row .att-btn { flex: 1; text-align: center; padding: 9px 6px; }

/* Desktop/mobile visibility helpers + mobile list cards */
.only-mobile { display: none; }
.m-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); cursor: pointer; }
.m-card:active { background: var(--grape-50); }
.m-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.m-flags { display: flex; gap: 5px; flex: 0 0 auto; }
.m-meta { color: var(--ink-2); font-size: 13px; margin-top: 9px; }

/* ===== Mobile top bar + drawer (hidden on desktop) ===== */
.topbar { display: none; }
.nav-backdrop { display: none; }
.hamburger { border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 20px; line-height: 1; padding: 7px 11px; border-radius: 9px; cursor: pointer; }
.topbar-logo { width: 30px; height: 30px; border-radius: 7px; background: #fff; padding: 2px; object-fit: contain; }
.topbar-title { font-weight: 800; font-size: 15px; }

@media (max-width: 920px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ===== Phone / narrow: drawer nav, scrollable tables, stacked forms ===== */
@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .main { padding: 16px 14px 56px; overflow-x: hidden; }

  .topbar { display: flex; align-items: center; gap: 12px; height: 56px; flex: 0 0 56px; position: sticky; top: 0; z-index: 50;
    background: linear-gradient(90deg, var(--grape-900), var(--grape-700)); color: #fff; padding: 0 14px; }

  .sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: 272px; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .nav-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(46,19,56,.5); z-index: 55; }

  .page-head { flex-wrap: wrap; }
  .page-head h1 { font-size: 22px; }

  .only-desktop { display: none; }
  .only-mobile { display: block; }

  /* wide tables scroll inside their container instead of squishing */
  .card, .table-wrap, .modal-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 460px; }
  table.sched { min-width: 620px; }

  .att-btn { padding: 7px 10px; }     /* bigger touch targets */
  .modal-overlay { padding: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .modal { max-height: 94vh; max-height: 94dvh; }
}

@media (max-width: 600px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 116px 1fr; }
  .recital-kv { grid-template-columns: 130px 1fr; }
}
