:root {
  --primary: #007BFF;
  --primary-dark: #0056b3;
  --primary-soft: #e7f1ff;
  --success: #28a745;
  --success-dark: #1e7e34;
  --success-soft: #e6f6ea;
  --warning: #f0ad00;
  --warning-soft: #fff6db;
  --danger: #dc3545;
  --danger-soft: #fdecee;
  --dark: #212529;
  --gray: #6c757d;
  --light: #f8f9fa;
  --border: #dee2e6;
  --white: #fff;
  --radius: 12px;
  --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
  --hover-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--dark); background: var(--light); line-height: 1.55; font-size: 16px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
.muted { color: var(--gray); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 480px; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none !important;
  background: var(--white); color: var(--dark); border-color: var(--border); transition: background .15s, box-shadow .15s, transform .1s;
}
.btn:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: var(--white); border-color: var(--success); }
.btn-success:hover { background: var(--success-dark); }
.btn-danger { background: var(--white); color: var(--danger); border-color: #f1b0b7; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-light { background: rgba(255, 255, 255, .15); color: var(--white); border-color: rgba(255, 255, 255, .4); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--primary); font: inherit; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

/* ---------- top bar ---------- */
.topbar { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding-top: 10px; padding-bottom: 14px; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--dark); display: inline-flex; align-items: center; gap: 8px; text-decoration: none !important; }
.brand b { color: var(--primary); font-weight: 800; }
.topnav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topnav a { color: var(--dark); font-weight: 500; font-size: .95rem; }
.topnav a.btn-primary, .topnav a.btn-primary:hover, .topnav a.btn-primary:focus { color: var(--white); }
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .landing-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--white); border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; padding: 12px 16px; gap: 10px; }
  .landing-nav.open { display: flex; }
  .menu-toggle { display: inline-flex; }
}
.school-chip { display: flex; flex-direction: column; line-height: 1.2; }
.school-chip strong { font-size: .95rem; }
.school-chip small { color: var(--gray); margin-top: 3px; }
.user-menu { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.user-menu .btn, .user-menu .app-link { white-space: nowrap; }
@media (max-width: 640px) { .user-menu .who { display: none; } }
@media (display-mode: standalone) { .app-link { display: none; } }

/* ---------- cards / panels ---------- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--card-shadow); }
:where(.card) :is(h2, h3) { margin-top: 0; } /* low specificity so .mt-1/.mt-2 still work on headings inside cards */
.card + .card { margin-top: 16px; }
.grid > .card + .card, .trip-list > .card + .card, .roles > .card + .card, .steps > .card + .card { margin-top: 0; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-header h2, .card-header h3 { margin: 0; }
.page { padding: 28px 0 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 1.75rem; }
.id-badge { display: inline-flex; gap: 6px; align-items: center; background: var(--primary-soft); color: var(--primary-dark); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: .9rem; }
.stat { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .num { font-size: 1.8rem; font-weight: 800; }
.stat .label { color: var(--gray); font-size: .9rem; }
.empty { text-align: center; padding: 36px 16px; color: var(--gray); }
.empty .icon { font-size: 2.2rem; display: block; margin-bottom: 6px; }

/* ---------- tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 0 4px; box-shadow: inset 0 -2px 0 var(--border); margin-bottom: 20px; }
.tab {
  background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 10px 16px; font: inherit; font-weight: 600; color: var(--gray); cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--dark); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { background: var(--light); border: 1px solid var(--border); color: var(--gray); border-radius: 999px; padding: 0 7px; font-size: .75rem; margin-left: 4px; }
.tab.active .count { background: var(--primary-soft); border-color: transparent; color: var(--primary-dark); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tabs.sub { box-shadow: inset 0 -1px 0 var(--border); margin-bottom: 16px; }
.tabs.sub .tab { padding: 8px 12px; font-size: .9rem; }
/* Phones: tabs wrap as buttons (never a scrolling strip). */
@media (max-width: 600px) {
  .tabs, .tabs.sub { gap: 6px; box-shadow: none; }
  .tab, .tabs.sub .tab { border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; font-size: .88rem; background: var(--white); }
  .tab.active { background: var(--primary-soft); border-color: var(--primary); }
}

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label, .label { font-weight: 600; font-size: .9rem; }
.field .hint { color: var(--gray); font-size: .82rem; }
input:not([type]), input[type=text], input[type=url], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=search], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #ced4da; border-radius: 8px; font: inherit; background: var(--white); color: var(--dark);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 123, 255, .15); }
textarea { min-height: 96px; resize: vertical; }
input[type=file] { font: inherit; max-width: 100%; }
.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.form-error { background: var(--danger-soft); color: #842029; border: 1px solid #f5c2c7; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.inline-form { display: inline; }
.input-status { font-size: .82rem; }
.input-status.ok { color: var(--success-dark); }
.input-status.bad { color: var(--danger); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px 4px; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0 6px; }
.choice-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; margin-bottom: 12px; }

/* ---------- flash ---------- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.flash.success { background: var(--success-soft); border-color: #b7e4c2; color: #14532d; }
.flash.error { background: var(--danger-soft); border-color: #f5c2c7; color: #842029; }
.flash .close { margin-left: auto; background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: inherit; line-height: 1; }
.copy-row { display: flex; gap: 8px; margin-top: 8px; }
.copy-row input { font-size: .85rem; }
.toast-wrap { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 50; width: min(560px, calc(100% - 32px)); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--white); }
table.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: var(--light); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--gray); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fbfcfe; }
.table .actions { white-space: nowrap; text-align: right; }
.table-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.table-tools input[type=search] { width: 260px; max-width: 100%; flex: 0 1 260px; }
details.row-edit summary { list-style: none; cursor: pointer; color: var(--primary); font-weight: 600; font-size: .88rem; display: inline; }
details.row-edit summary::-webkit-details-marker { display: none; }
details.row-edit[open] { display: block; }
.edit-box { margin-top: 10px; padding: 14px; background: var(--light); border: 1px solid var(--border); border-radius: 10px; text-align: left; white-space: normal; min-width: 280px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge.green { background: var(--success-soft); color: var(--success-dark); }
.badge.gray { background: #eef0f2; color: var(--gray); }
.badge.yellow { background: var(--warning-soft); color: #8a6100; }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.blue { background: var(--primary-soft); color: var(--primary-dark); }
.progress { height: 8px; background: #eef0f2; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--success); border-radius: 999px; transition: width .3s; }

/* ---------- trip cards ---------- */
.trip-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.trip-card { display: block; position: relative; color: inherit; text-decoration: none !important; transition: box-shadow .15s, transform .15s; }
.trip-card-link { color: inherit; text-decoration: none !important; }
.trip-card-link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; } /* the whole card opens the trip */
.trip-card-link:focus-visible::after { outline: 3px solid var(--primary); }
.trip-card-actions { margin-top: 10px; position: relative; z-index: 2; } /* sits above the card link */
.trip-card:hover { box-shadow: var(--hover-shadow); transform: translateY(-2px); }
.trip-card .date { color: var(--primary); font-weight: 700; font-size: .9rem; }
.trip-card h3 { margin: 4px 0; font-size: 1.15rem; }
.trip-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--gray); font-size: .88rem; margin: 10px 0; }
.code-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 2rem; font-weight: 800; letter-spacing: .12em; background: var(--primary-soft); color: var(--primary-dark); border-radius: 12px; padding: 10px 18px; display: inline-block; }

/* approval switch */
.approve { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; user-select: none; }
.approve input { appearance: none; width: 24px; height: 24px; border: 2px solid #adb5bd; border-radius: 6px; display: grid; place-items: center; cursor: pointer; margin: 0; background: var(--white); }
.approve input:checked { background: var(--success); border-color: var(--success); }
.approve input:checked::after { content: "✓"; color: var(--white); font-weight: 900; font-size: 15px; line-height: 1; }
.approve input:disabled { opacity: .45; cursor: not-allowed; }
.approve .lbl { font-size: .85rem; color: var(--gray); }
.approve input:checked + .lbl { color: var(--success-dark); }
tr.is-approved td { background: #f6fcf8; }

/* ---------- parent / signing ---------- */
.parent-shell { max-width: 760px; margin: 0 auto; padding: 24px 16px 60px; }
.doc-frame { width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--border); border-radius: 10px; background: #525659; }
.sig-pad-wrap { border: 2px dashed #adb5bd; border-radius: 10px; background: var(--white); position: relative; touch-action: none; }
.sig-pad-wrap canvas { display: block; width: 100%; height: 180px; cursor: crosshair; touch-action: none; }
.sig-pad-wrap .sig-hint { position: absolute; left: 0; right: 0; bottom: 34px; text-align: center; color: #adb5bd; pointer-events: none; border-top: 1px solid #dee2e6; margin: 0 24px; padding-top: 4px; font-size: .85rem; }
.child-card .doc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 1.6rem; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .9rem; margin-top: 14px; }
.demo-note { background: var(--warning-soft); border: 1px solid #f3dd9b; color: #6b4e00; border-radius: 10px; padding: 10px 14px; font-size: .9rem; margin-bottom: 18px; }

/* ---------- landing ---------- */
.hero { background: linear-gradient(135deg, #0062cc 0%, #007BFF 55%, #33a1ff 100%); color: var(--white); padding: 72px 0 80px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.hero .container { position: relative; z-index: 1; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
@media (max-width: 900px) { .hero .container { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); font-weight: 800; margin-bottom: 16px; letter-spacing: -.02em; }
.hero .lead { font-size: 1.15rem; opacity: .95; max-width: 560px; }
.eyebrow { display: inline-block; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); padding: 5px 14px; border-radius: 999px; font-weight: 600; font-size: .88rem; margin-bottom: 18px; }
.hero .btn-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 12px; margin-top: 26px; max-width: 560px; }
.hero .btn-row .btn, .demo-row .btn { width: 100%; justify-content: center; text-align: center; white-space: normal; }
.hero .btn-row .btn { padding: 13px 8px; font-size: .95rem; }
/* the hero's text column is centered: label, headline, intro, buttons */
.hero .container > div:first-child { text-align: center; }
.hero .container > div:first-child .lead, .hero .btn-row, .demo-row { margin-left: auto; margin-right: auto; }
.hero .btn-white { background: var(--white); color: var(--primary-dark); border-color: var(--white); }
.demo-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 8px; margin-top: 14px; max-width: 560px; }
.demo-label { margin: 18px 0 0; font-weight: 700; font-size: .95rem; opacity: .95; }
@media (max-width: 520px) { .hero .btn-row { grid-template-columns: 1fr; grid-auto-rows: auto; } }
.hero-mock { background: var(--white); color: var(--dark); border-radius: 16px; box-shadow: 0 30px 60px rgba(0, 0, 0, .25); padding: 18px; }
.hero-mock .mock-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mock-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--border); font-size: .92rem; }
.mock-row .tick { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 13px; font-weight: 900; }
.mock-row .tick.on { background: var(--success); color: var(--white); }
.mock-row .tick.off { border: 2px solid #adb5bd; }
.stats-strip { background: var(--white); border-bottom: 1px solid var(--border); }
.stats-strip .container { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; padding: 22px 16px; gap: 10px; }
@media (max-width: 700px) { .stats-strip .container { grid-template-columns: repeat(2, 1fr); } }
.stats-strip strong { display: block; font-size: 1.5rem; color: var(--primary); }
.stats-strip span { color: var(--gray); font-size: .9rem; }
.section { padding: 72px 0; }
.section.alt { background: var(--white); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 40px; }
.section-head .kicker { color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .82rem; }
.section-head h2 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); margin-top: 6px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 900px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
.step-num { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: var(--white); display: grid; place-items: center; font-weight: 800; margin-bottom: 12px; }
.feature .icon { font-size: 1.8rem; margin-bottom: 8px; display: block; }
.feature h3 { font-size: 1.1rem; }
.feature p { color: var(--gray); margin: 0; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
@media (max-width: 860px) { .roles { grid-template-columns: 1fr; } }
.roles ul { padding-left: 18px; margin: 0; color: var(--gray); }
.roles li { margin-bottom: 6px; }
.faq { max-width: 820px; margin: 0 auto; }
.faq details { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 0 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: "▾"; color: var(--gray); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(180deg); }
.faq details p { color: #495057; }
.signup-card { max-width: 820px; margin: 0 auto; }
.footer { background: var(--dark); color: #adb5bd; padding: 40px 0; font-size: .9rem; }
.footer a { color: #dee2e6; }
.footer .container { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer .brand { color: var(--white); }

.print-only { display: none; }
@media print {
  .print-only { display: block; }
  .topbar, .tabs, .no-print, .footer { display: none !important; }
  body { background: var(--white); }
  .tab-panel { display: block !important; }
  .card { box-shadow: none; }
}

/* ---------- Trip Day ---------- */
.day-bar .container { min-height: 54px; }
.day-title { flex: 1; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; overflow-wrap: anywhere; }
.conn-pill { font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.conn-pill.live { background: var(--success-soft); color: var(--success-dark); }
.conn-pill.connecting { background: var(--warning-soft); color: #8a6100; }
.conn-pill.offline { background: var(--danger-soft); color: var(--danger); }
.day-shell { max-width: 760px; margin: 0 auto; padding: 12px 12px 60px; }
.checkpoint-bar { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; scrollbar-width: thin; }
.cp { flex: 0 0 auto; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  text-align: left; border: 2px solid var(--border); background: var(--white); border-radius: 12px; padding: 8px 12px; cursor: pointer; font: inherit; min-width: 132px; }
.cp-step { grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; background: var(--light); border: 1px solid var(--border); display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.cp-label { font-weight: 700; font-size: .85rem; }
.cp-count { font-size: .8rem; color: var(--gray); font-weight: 600; }
.cp.active { border-color: var(--primary); background: var(--primary-soft); }
.cp.active .cp-step { background: var(--primary); color: var(--white); border-color: var(--primary); }
.cp.complete .cp-count { color: var(--success-dark); }
.cp.complete .cp-step { background: var(--success); color: var(--white); border-color: var(--success); }
.day-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.day-tools input[type=search] { flex: 1 1 180px; }
.seg[hidden] { display: none; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--white); }
.seg button { border: 0; background: none; padding: 8px 12px; font: inherit; font-weight: 600; font-size: .88rem; color: var(--gray); cursor: pointer; }
.seg button.active { background: var(--primary); color: var(--white); }
.day-summary { border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; }
.day-summary.missing { background: var(--warning-soft); border: 1px solid #f3dd9b; }
.day-summary.complete { background: var(--success-soft); border: 1px solid #b7e4c2; }
.sum-title { font-weight: 800; font-size: 1.15rem; }
.sum-sub { font-size: .88rem; color: var(--gray); }
.day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.day-row { display: flex; background: var(--white); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.day-row.checked { border-color: #b7e4c2; background: #f6fcf8; }
.day-row.excluded { opacity: .55; }
.day-main { flex: 1; display: flex; align-items: center; gap: 14px; padding: 14px; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; min-height: 64px; color: inherit; }
.day-main:active { background: var(--primary-soft); }
.tick { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 2px solid #adb5bd; display: grid; place-items: center; font-weight: 900; font-size: 1.2rem; color: var(--white); }
.day-row.checked .tick { background: var(--success); border-color: var(--success); }
.day-text { display: flex; flex-direction: column; min-width: 0; }
.day-name { font-weight: 700; font-size: 1.05rem; }
.day-meta { font-size: .82rem; color: var(--gray); }
.day-more { border: 0; border-left: 1px solid var(--border); background: none; width: 52px; font-size: 1.3rem; color: var(--gray); cursor: pointer; }
.day-empty { text-align: center; color: var(--gray); padding: 30px 10px; background: var(--white); border: 1px dashed var(--border); border-radius: 12px; }
.log-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: .9rem; }
.log-list li { display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { background: var(--white); width: 100%; max-width: 520px; border-radius: 16px 16px 0 0; padding: 20px 16px 28px; }
.sheet-card .btn { min-height: 48px; }

/* ---------- install page ---------- */
.install-steps { padding-left: 22px; line-height: 1.7; }
.kbd { display: inline-block; border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; background: var(--light); font-weight: 700; }

/* ---------- parent trip status ---------- */
.update-list { list-style: none; margin: 10px 0 0; padding: 0; }
.update-list li { padding: 10px 12px; border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: 0 8px 8px 0; margin-bottom: 8px; }
.update-list li.fresh { animation: flash-in 2.5s ease-out; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 6px 0; position: relative; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 12px; top: 30px; bottom: -6px; width: 2px; background: var(--border); }
.timeline li.done:not(:last-child)::after { background: var(--success); }
.timeline .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #adb5bd; background: var(--white); display: grid; place-items: center; font-size: .8rem; font-weight: 900; color: var(--white); z-index: 1; }
.timeline li.done .dot { background: var(--success); border-color: var(--success); }
.timeline li.done .tl-label { font-weight: 600; }
.timeline li.fresh { animation: flash-in 2.5s ease-out; border-radius: 8px; }
.status-attendance { background: var(--warning-soft); color: #6b4e00; border-radius: 8px; padding: 6px 10px; margin-bottom: 6px; font-weight: 600; }
@keyframes flash-in { from { background: #fff3b0; } to { background: transparent; } }
.update-list li.fresh { animation-name: flash-update; }
@keyframes flash-update { from { background: #fff3b0; } to { background: var(--primary-soft); } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--white); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.chip:hover { border-color: var(--primary); background: var(--primary-soft); }

/* ---------- trip status buttons ---------- */
.status-buttons { display: grid; gap: 8px; }
.status-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; width: 100%;
  border: 2px solid var(--border); background: var(--light); border-radius: 12px; padding: 10px 14px; font: inherit; cursor: not-allowed; color: var(--gray); }
.status-btn .status-msg { font-weight: 700; font-size: 1rem; }
.status-btn .status-note { font-size: .82rem; }
.status-btn.ready { border-color: var(--success); background: var(--success-soft); color: var(--dark); cursor: pointer; }
.status-btn.ready .status-note { color: var(--success-dark); font-weight: 600; }
.status-btn.ready:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.status-btn.sent { border-style: dashed; background: var(--white); }
.status-btn.sent .status-note { color: var(--primary-dark); font-weight: 600; }
.update-list li.is-status { border-left-color: var(--success); background: var(--success-soft); font-weight: 600; }

/* ---------- school lookup on sign-up ---------- */
.school-lookup { position: relative; }
.school-matches { position: absolute; top: 72px; left: 0; right: 0; z-index: 30; background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--hover-shadow); max-height: 320px; overflow-y: auto; }
.school-match { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 10px 14px; border: 0;
  border-bottom: 1px solid var(--border); background: none; font: inherit; cursor: pointer; color: var(--dark); }
.school-match:last-child { border-bottom: 0; }
.school-match small { color: var(--gray); }
.school-match:hover, .school-match.active { background: var(--primary-soft); }
.school-match-note { padding: 12px 14px; color: var(--gray); font-size: .9rem; }
.school-choice { justify-content: space-between; text-align: left; padding: 14px 16px; }
.place-lookup { position: relative; }
.place-lookup .school-matches { top: 72px; max-height: 360px; }
.places-toggle { padding-left: 0; margin-top: 4px; }
.places-panel { margin-top: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--light); }
.school-matches.inline { position: static; box-shadow: none; margin-top: 8px; max-height: 340px; }
.school-matches.inline:empty { display: none; }

/* ---------- form builder ---------- */
.builder-field { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--light); }
#formBody { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; line-height: 1.5; }
.trip-code-input { letter-spacing: .2em; text-transform: uppercase; font-size: 1.4rem; text-align: center; }
.qr-box { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr-box img { width: 180px; height: 180px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 8px; }

/* ---------- printable parent flyer ---------- */
.flyer { max-width: 760px; margin: 0 auto; padding: 16px; }
.flyer-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.flyer-page { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 40px 32px; text-align: center; }
.flyer-school { color: var(--gray); font-weight: 600; }
.flyer-page h1 { font-size: 2.2rem; margin: 6px 0 10px; }
.flyer-meta { color: var(--dark); font-size: 1.05rem; line-height: 1.7; }
.flyer-page h2 { font-size: 1.4rem; margin: 26px 0 14px; }
.flyer-qr { width: 300px; height: 300px; max-width: 80vw; max-height: 80vw; }
.flyer-step { font-size: 1.1rem; margin: 14px 0 6px; }
.flyer-or { color: var(--gray); margin: 4px 0; }
.flyer-code { letter-spacing: .15em; font-size: 1.2rem; color: var(--dark); }
.flyer-deadline { display: inline-block; margin-top: 18px; background: var(--warning-soft); border-radius: 999px; padding: 6px 16px; font-weight: 700; }
@media print {
  .flyer { max-width: none; padding: 0; }
  .flyer-page { border: 0; padding: 24px 0; }
}
.status-btn.locked, .status-btn.sent { cursor: pointer; }
.status-help { margin-top: 10px; border: 1px solid #f3dd9b; background: var(--warning-soft); border-radius: 12px; padding: 12px 14px; }
.status-missing { margin: 0 0 8px; padding-left: 20px; columns: 2; font-size: .9rem; }

/* ---------- trip code scanner ---------- */
body.scanning { overflow: hidden; }
.scan-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; padding: 16px; }
.scan-frame { position: relative; width: min(90vw, 420px); aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: #000; }
.scan-frame video { width: 100%; height: 100%; object-fit: cover; }
.scan-target { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); }
.scan-status { color: #fff; text-align: center; max-width: 420px; margin: 0; }
.flyer-code-qr { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 18px; color: var(--gray); font-size: .9rem; text-align: left; }
.flyer-code-qr img { width: 90px; height: 90px; }

/* Parent page: "Find your child" prompt and plain text buttons */
.find-child { border: 2px solid var(--primary, #007aff); }
.btn-link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; font: inherit; color: inherit; }

/* In-page PDF viewer (forms and signed copies) */
.pdf-view { border: 1px solid var(--border); border-radius: 10px; background: #525659; padding: 8px; max-height: 75vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pdf-pages canvas { display: block; width: 100%; height: auto; background: #fff; margin: 0 auto 8px; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.pdf-pages canvas:last-child { margin-bottom: 0; }
.pdf-status { color: #fff; padding: 4px 4px 8px; }
.pdf-status.pdf-error { color: #ffd8a8; }

/* Quick-add question chips */
.question-picks summary { cursor: pointer; padding: 4px 0; }
.question-picks .chip { font-size: .8rem; padding: 5px 10px; }
.question-picks .chip.is-added { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--gray); cursor: default; }
.builder-field.fresh { animation: flash-in 2.5s ease-out; }

/* ---------- sort and group (public/js/lists.js) ---------- */
.list-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0 0 10px; font-size: .88rem; color: var(--gray); }
.list-tools label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.list-tools select { width: auto; max-width: 220px; padding: 6px 10px; font-size: .88rem; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--dark); }
.table th.sortable::after { content: attr(data-arrow); margin-left: 4px; color: var(--primary); }
.group-collapsed { display: none !important; }
.group-head td { background: var(--primary-soft); padding: 0 !important; }
.trip-list > .group-head { grid-column: 1 / -1; margin-top: 4px; }
.group-toggle { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; font: inherit; font-weight: 700; color: var(--dark); text-align: left; padding: 10px 12px; cursor: pointer; }
.trip-list > .group-head .group-toggle { padding: 6px 2px; border-bottom: 2px solid var(--border); }
.group-toggle .count { background: var(--white); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; font-size: .78rem; color: var(--gray); font-weight: 600; }
.group-toggle .chev { transition: transform .15s; color: var(--primary); }
.group-toggle[aria-expanded="false"] .chev { transform: rotate(-90deg); }

/* Tables never scroll up and down inside the page. */
.table-wrap { overflow-y: hidden; }

/* ---------- phones ---------- */
@media (max-width: 600px) {
  /* Text boxes at 16px so iPhones don't zoom in when one is tapped. */
  input:not([type]), input[type=text], input[type=url], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=search], input[type=number], select, textarea { font-size: 16px !important; }
  /* Comfortable tap targets. */
  .btn, .btn-sm { min-height: 42px; padding-top: 8px; padding-bottom: 8px; }
  .link-btn { padding: 8px 0; min-height: 40px; }
  .chip { min-height: 38px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; flex: 0 0 auto; }
  input[type=file] { padding: 8px 0; }
  details.row-edit summary { display: inline-block; padding: 9px 0; }
  details > summary:not(.btn) { padding-top: 9px; padding-bottom: 9px; }
  .topnav a { display: inline-block; padding: 10px 6px; }
  .table-tools input[type=search] { flex: 1 1 100%; width: 100%; }
  .list-tools { font-size: .85rem; }
  .list-tools select { max-width: 60vw; min-height: 42px; }
  /* Number boxes (e.g. on a trip) two to a row instead of one. */
  .grid-4:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .num { font-size: 1.5rem; }

  /* Tables become a stack of cards: one card per row, each value labelled with its heading. */
  .table-wrap:has(> table.stack) { overflow: visible; border: 0; background: none; }
  table.table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tbody tr:not(.group-head) { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; margin-bottom: 10px; }
  table.stack tbody tr.is-approved { border-left: 4px solid var(--success, #28a745); }
  table.stack td { border: 0 !important; padding: 6px 0 !important; text-align: right; overflow-wrap: anywhere; white-space: normal !important; }
  table.stack td::after { content: ""; display: block; clear: both; }
  table.stack td::before { content: attr(data-label); float: left; max-width: 45%; margin-right: 12px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--gray); text-align: left; padding-top: 2px; }
  table.stack td[data-label=""]::before, table.stack td:not([data-label])::before { display: none; }
  table.stack td:first-child { font-size: 1.02rem; }
  table.stack td.actions { text-align: left; }
  table.stack td input[type=text], table.stack td input[type=number], table.stack td select { margin-top: 4px; }
  table.stack td:empty { display: none; }
  table.stack tr:hover td { background: none; }
  table.stack .group-head { margin: 14px 0 8px; }
  table.stack .group-head td { display: block; border-radius: 8px; }
  table.stack .group-head td::before { display: none; }
  table.stack details.row-edit[open] { width: 100%; }
}
.list-tools [hidden] { display: none !important; }
@media (max-width: 600px) { table.stack td::before { font-family: var(--font); } }
/* Nested groups: each level a little lighter. */
.group-levels { display: inline-flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.group-head.level-1 td { background: #f1f6fe; }
.group-head.level-2 td { background: #f8fafd; }
.group-head.level-1 .group-toggle, .group-head.level-2 .group-toggle { font-weight: 600; }
.trip-list > .group-head.level-1 .group-toggle { border-bottom-width: 1px; }
/* Group by dropdown (checkboxes, numbered in the order ticked) */
.group-menu { position: relative; display: inline-block; }
.group-menu-btn { max-width: 100%; white-space: normal; text-align: left; }
.group-menu-btn.is-on { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }
.group-menu-panel { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 240px; max-width: min(320px, 90vw); background: var(--white); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--hover-shadow); padding: 8px; }
.group-menu-hint { padding: 2px 6px 6px; }
.group-menu-panel { max-height: min(70vh, 520px); overflow-y: auto; }
.group-section + .group-section { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.group-section-title { padding: 2px 6px; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray); }
.group-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: var(--white); font-size: .72rem; font-weight: 700; }
.list-tools .group-option { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--dark); }
.group-option:hover { background: var(--light); }
.group-order { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.group-order:not(:empty) { background: var(--primary); color: var(--white); }
.group-clear { display: block; padding: 6px; }
/* Sort by dropdown: a direction button next to each ticked column */
.group-row { display: flex; align-items: center; gap: 6px; }
.group-row .group-option { flex: 1; }
.list-tools .sort-dir { flex: 0 0 auto; min-height: 32px; padding: 4px 10px; font-size: .78rem; white-space: nowrap; }
.list-tools .list-clear { color: var(--gray); }
.list-tools .list-clear:hover { color: var(--danger); }

/* Student search: type-ahead dropdown and Grade / Teacher filters */
.suggest-wrap { position: relative; flex: 0 1 260px; min-width: 0; }
.suggest-wrap input[type=search] { width: 100%; }
.suggest-list { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; min-width: 240px; margin: 0; padding: 4px; list-style: none; background: var(--white); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--hover-shadow); max-height: 320px; overflow-y: auto; }
.suggest-list li { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 6px; cursor: pointer; line-height: 1.3; }
.suggest-list li:hover, .suggest-list li.active { background: var(--primary-soft); }
select.refine { width: auto; flex: 0 1 auto; max-width: 200px; padding: 8px 10px; }
.refine-count:empty { display: none; }
.day-tools select.refine { flex: 0 1 auto; }
tr.row-found td, .row-found { animation: row-found 2.4s ease-out; }
@keyframes row-found { 0%, 40% { background: #fff3bf; } 100% { background: transparent; } }
@media (max-width: 600px) {
  .suggest-wrap { flex: 1 1 100%; }
  select.refine { flex: 1 1 45%; max-width: none; min-height: 42px; }
  table.stack tr.row-found { animation: row-found 2.4s ease-out; }
}

/* Dashboard: today's field trip, first thing on the page */
.today-trips { display: grid; gap: 12px; margin-bottom: 20px; }
.today-trip { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center; justify-content: space-between; border: 2px solid var(--success, #28a745); background: linear-gradient(135deg, #f1fbf4, var(--white)); }
.today-label { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--success-dark, #1e7e34); margin-bottom: 4px; }
.today-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 600px) { .today-actions, .today-actions .btn { width: 100%; } .today-actions .btn { justify-content: center; } }
/* Trip Day: group headings in the student list */
.day-group .group-toggle { background: var(--primary-soft); border-radius: 10px; }
.day-group.level-1 .group-toggle { background: #f1f6fe; }
.day-group.level-2 .group-toggle { background: #f8fafd; font-weight: 600; }
.day-list .day-group + .day-group { margin-top: 0; }

/* ---------- status icons (instead of words) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon-badge { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-size: 15px; font-weight: 900; line-height: 1; text-decoration: none !important; vertical-align: middle; }
.icon-badge.ok { background: var(--success-soft); color: var(--success-dark); }
.icon-badge.ok:hover { background: var(--success); color: var(--white); }
.icon-badge.wait { background: var(--warning-soft); font-size: 14px; }
.when-open { display: none; }
.row-toggle { display: none; }
#tripTable th[title] { max-width: 120px; white-space: normal; line-height: 1.2; }

/* ---------- phones: compact one-line cards that open for details ---------- */
@media (max-width: 600px) {
  table.stack.compact tbody tr:not(.group-head) { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; padding: 2px 4px 2px 10px; margin-bottom: 6px; cursor: pointer; }
  table.stack.compact td { display: none; }
  table.stack.compact td.cell-primary { display: block; width: auto; flex: 0 0 auto; padding: 6px 0 !important; text-align: left; }
  table.stack.compact td.cell-primary::before { display: none; }
  table.stack.compact td.cell-name { flex: 1 1 0; min-width: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap !important; }
  table.stack.compact tr:not(.open) td.cell-name .small, table.stack.compact tr:not(.open) td.cell-name br { display: none; }
  table.stack.compact td.cell-primary .badge { font-size: .72rem; padding: 2px 7px; }
  table.stack.compact td.row-toggle { display: block; width: auto; flex: 0 0 auto; padding: 0 !important; }
  .row-toggle-btn { width: 36px; height: 40px; border: 0; background: none; color: var(--primary); font-size: 1rem; cursor: pointer; transition: transform .15s; }
  tr.open .row-toggle-btn { transform: rotate(180deg); }
  /* Opened: the other details below, one per line with their headings. */
  table.stack.compact tr.open { padding-bottom: 8px; }
  table.stack.compact tr.open td:not(.cell-primary):not(.row-toggle) { display: block; flex: 1 1 100%; order: 10; padding: 5px 0 !important; border-top: 1px solid var(--border) !important; }
  table.stack.compact tr.open td:not(.cell-primary):not(.row-toggle):empty { display: none; }
  table.stack.compact tr.open td.cell-name { white-space: normal !important; }
  table.stack.compact tr.open .when-open { display: block; text-align: left; }
  table.stack.compact tr.open td.cell-primary:not(.cell-name) { display: flex; align-items: center; gap: 8px; flex: 1 1 100%; order: 5; border-top: 1px solid var(--border); }
  table.stack.compact tr.open td.cell-primary:not(.cell-name)::before { display: block; float: none; margin: 0; min-width: 40%; }
  .approve input { width: 28px; height: 28px; }
}
@media (max-width: 600px) {
  /* More room for names in compact cards. */
  .card { padding: 14px; }
  table.stack.compact tbody tr:not(.group-head) { column-gap: 6px; padding: 0 0 0 8px; margin-bottom: 5px; }
  table.stack.compact tbody tr.is-approved { background: #f6fcf8; }
  table.stack.compact tbody tr.is-approved td { background: none; }
  table.stack.compact td.cell-name { white-space: normal !important; line-height: 1.2; font-size: .95rem; overflow-wrap: anywhere; }
  table.stack.compact td.cell-primary .icon-badge { width: 24px; height: 24px; font-size: 13px; border-radius: 6px; }
  table.stack.compact td.cell-primary + td.cell-primary:not(.cell-name) { margin-left: -2px; }
  table.stack.compact .approve input { width: 26px; height: 26px; }
  .row-toggle-btn { width: 30px; }
  table.stack.compact tr.open td.cell-primary:not(.cell-name)::before { min-width: 0; flex: 0 0 38%; }
  table.stack.compact tr.open td.cell-primary:not(.cell-name) .when-open { flex: 1; }
}
/* Desktop: one line per student so more fit on the screen. */
@media (min-width: 601px) {
  #tripTable td, #studentTable td, #staffTable td, #adminStudents td { padding-top: 7px; padding-bottom: 7px; }
  #tripTable td > div.small, #tripTable td > div.muted, #studentTable td > div.small { display: inline; margin-left: 6px; }
}

/* Inline row editing (students) */
.inline-input { padding: 6px 8px !important; font-size: .9rem; min-width: 0; }
.inline-input.short { max-width: 70px; }
.inline-pair { display: flex; gap: 6px; }
.inline-pair.stacked { flex-direction: column; }
.inline-pair .inline-input { flex: 1 1 0; }
.inline-actions { display: flex; gap: 6px; justify-content: flex-end; }
.inline-error { color: var(--danger); margin-top: 4px; text-align: right; }
.inline-error:empty { display: none; }
tr.editing td { background: #fffdf2 !important; vertical-align: top; }
#studentTable tr.editing td:first-child { min-width: 150px; }
#studentTable tr.editing .inline-pair:not(.stacked) { flex-wrap: wrap; }
#studentTable tr.editing .inline-pair:not(.stacked) .inline-input { flex: 1 1 100px; }
@media (max-width: 600px) {
  table.stack.compact tr.editing td:not(.row-toggle) { display: block !important; flex: 1 1 100%; order: 10; text-align: left; padding: 6px 0 !important; }
  table.stack.compact tr.editing td.cell-name { order: 1; }
  table.stack.compact tr.editing td::before { display: block !important; float: none; margin-bottom: 4px; }
  table.stack.compact tr.editing td[data-label=""]::before { display: none !important; }
  table.stack.compact tr.editing .inline-input { width: 100%; max-width: none; font-size: 16px !important; }
  table.stack.compact tr.editing .inline-actions { justify-content: stretch; }
  table.stack.compact tr.editing .inline-actions .btn { flex: 1; }
  table.stack.compact tr.editing .inline-error { text-align: left; }
}
#studentTable tr.editing select.inline-input { min-width: 120px; max-width: 160px; }
#studentTable tr.editing input[name=guardian_phone], #studentTable tr.editing input[name=guardian2_phone] { min-width: 120px; }
#studentTable tr.editing td { white-space: normal; padding-left: 6px; padding-right: 6px; }
#studentTable tr.editing input[name=student_number] { width: 80px; }
@media (min-width: 601px) { #studentTable tr.editing .inline-actions { flex-direction: column; } }
@media (max-width: 600px) { table.stack.compact tr.editing td.row-toggle { display: none !important; } }
.school-match-more { display: block; width: 100%; text-align: left; background: var(--light); border: 0; border-top: 1px solid var(--border); padding: 10px 12px; font: inherit; font-size: .88rem; font-weight: 600; color: var(--primary); cursor: pointer; }
.school-match-more:hover { background: var(--primary-soft); }
/* Fields filled in by picking a school flash briefly. */
.autofilled { animation: autofilled 1.8s ease-out; }
@keyframes autofilled { 0%, 35% { background: #fff3bf; border-color: #f0c36d; } 100% { background: var(--white); } }

/* Homepage pricing */
.hero-price { margin-top: 18px; font-weight: 700; font-size: 1.05rem; }
.pricing { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; max-width: 820px; margin: 0 auto; }
.price-addon { grid-column: 1 / -1; }
.price-addon .price-tag { font-size: 1.8rem; }
@media (max-width: 700px) { .pricing { grid-template-columns: 1fr; } }
.price-card h3 { margin-top: 4px; }
.price-card ul { padding-left: 20px; margin: 0 0 16px; }
.price-card.featured { border: 2px solid var(--primary); }
.price-tag { font-size: 2.2rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.price-tag span { font-size: 1rem; font-weight: 600; color: var(--gray); }

/* Trip photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin-top: 12px; }
.photo-item { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.photo-item.fresh .photo-thumb { animation: flash-in 2.5s ease-out; box-shadow: 0 0 0 3px var(--primary); }
.photo-thumb { padding: 0; border: 0; background: #e9ecef; border-radius: 10px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; display: block; width: 100%; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-drag: none; -webkit-touch-callout: none; user-select: none; }
.photo-item figcaption { color: var(--gray); line-height: 1.25; }
.photo-warning { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: #7a1c1c; border: 1px solid #f1b0b0; }
.photo-lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .92); display: grid; place-items: center; padding: 16px; }
.photo-lightbox.hidden { display: none; }
.photo-lightbox img { max-width: 100%; max-height: 82vh; border-radius: 6px; -webkit-touch-callout: none; user-select: none; -webkit-user-drag: none; }
.photo-lightbox .pl-caption { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: #fff; padding: 0 60px; font-size: .95rem; }
.photo-lightbox button { position: absolute; background: rgba(255, 255, 255, .15); color: #fff; border: 0; border-radius: 999px; width: 44px; height: 44px; font-size: 1.4rem; cursor: pointer; }
.photo-lightbox .pl-close { top: 12px; right: 12px; }
.photo-lightbox .pl-prev { left: 8px; top: 50%; }
.photo-lightbox .pl-next { right: 8px; top: 50%; }
body.photo-open { overflow: hidden; }

/* Family code letters */
.code-letters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 820px; margin: 0 auto; }
.code-letter { border: 2px dashed #9aa5b1; border-radius: 12px; padding: 18px; background: #fff; break-inside: avoid; page-break-inside: avoid; }
.code-letter h2 { margin: 2px 0 8px; }
.code-big { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 2rem; font-weight: 800; letter-spacing: .08em; padding: 8px 0; margin-bottom: 8px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; }
@media (max-width: 600px) { .code-letters { grid-template-columns: 1fr; } }
@media print { .code-letters { gap: 10px; max-width: none; } .code-letter { border-color: #444; } }
/* Parent sign-in */
.find-child form.inline-form { display: inline; margin-left: 8px; }

/* Trip Day tabs */
.day-tabs { margin-top: 12px; }
.tab .count.done { background: var(--success-soft); border-color: transparent; color: var(--success-dark); }

/* Trip Day tabs: one row, icon above the label */
.day-tabs { display: grid !important; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.day-tabs .tab { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; padding: 8px 4px !important; border-radius: 12px !important; line-height: 1.15; text-align: center; white-space: normal; margin: 0; }
.day-tabs .tab .ti { font-size: 1.25rem; }
.day-tabs .tab .tl { font-size: .78rem; font-weight: 700; }
.day-tabs .tab .count { margin: 2px 0 0; font-size: .68rem; padding: 0 6px; }
.day-tabs .tab.active { background: var(--primary-soft); border-color: var(--primary); }
@media (min-width: 700px) { .day-tabs { max-width: 560px; } }

#photoCaption { width: 100%; }
#photoForm .btn { min-height: 44px; }

/* Photos waiting to be posted */
.photo-queue { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pq-item { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: #e9ecef; border: 2px solid var(--primary); }
.pq-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pq-item.is-posting img { opacity: .5; }
.pq-item.is-failed { border-color: var(--danger); }
.pq-wait { display: grid; place-items: center; height: 100%; color: var(--gray); font-size: 1.4rem; }
.pq-remove { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; border-radius: 999px; border: 0; background: rgba(0, 0, 0, .65); color: #fff; font-size: .8rem; line-height: 1; cursor: pointer; padding: 0; }
.pq-badge { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.5rem; }

/* Parent page: a tab per child, with Forms / Trip Updates / Photos under each */
.kid-tabs { margin-top: 4px; }
.kid-sub { margin-top: 14px; }
.child-card > .tab-panel { padding-top: 2px; }
.kid-sub { display: grid !important; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.kid-sub .tab { text-align: center; padding: 8px 4px !important; font-size: .8rem !important; line-height: 1.2; white-space: normal; border-radius: 12px !important; }
.kid-tabs { flex-wrap: wrap; }

/* Who can see a trip photo: chooser on Trip Day */
.aud-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--white); }
.aud-pick { margin-top: 8px; }
.aud-groups { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; align-items: center; }
.aud-list { max-height: min(340px, 55vh); overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; margin-top: 6px; }
.aud-kid { display: flex; gap: 6px; align-items: baseline; padding: 4px 0; }
.aud-kid input:disabled + span { color: var(--muted); }
.photo-aud { color: var(--muted); margin-top: 2px; }
.aud-dialog { border: 0; border-radius: 12px; padding: 16px; width: min(480px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.aud-dialog::backdrop { background: rgba(0,0,0,.45); }

/* Teacher sign-up: school search */
.school-results { border: 1px solid var(--border); border-radius: 8px; margin-top: 6px; background: var(--white); overflow: hidden; }
.school-match { display: block; width: 100%; text-align: left; padding: 10px 12px; background: none; border: 0; border-bottom: 1px solid var(--border); font: inherit; cursor: pointer; }
.school-match:last-child { border-bottom: 0; }
.school-match:hover, .school-match:focus { background: var(--primary-soft); }
.school-chosen { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--primary-soft); }

/* Teacher sign-up: printed invite slips and sign-up card */
.invite-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
.invite-slip { border: 1px dashed #999; padding: 18px 14px; text-align: center; break-inside: avoid; page-break-inside: avoid; background: var(--white); }
.invite-school { font-weight: 600; color: var(--gray); margin-bottom: 6px; }
.invite-qr svg { width: 170px; height: 170px; }
.invite-name { font-size: 1.15rem; margin-top: 4px; }
.signup-card { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.signup-card img.signup-qr { width: 140px; height: 140px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }

/* Trip Day photos: group by, select several */
.photo-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.photo-tools select { width: auto; padding: 6px 28px 6px 10px; }
.photo-selectbar { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.photo-group { margin-top: 14px; }
.photo-group-title { margin: 0 0 6px; font-size: 1rem; }
.photo-card.selecting .photo-item { cursor: pointer; position: relative; }
.photo-card.selecting .photo-item[data-deletable="1"]::after { content: ''; position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.photo-card.selecting .photo-item.is-picked::after { content: '✓'; background: var(--primary); color: #fff; text-align: center; line-height: 20px; font-weight: 700; }
.photo-card.selecting .photo-item.is-picked .photo-thumb { outline: 3px solid var(--primary); outline-offset: -3px; }
.photo-card.selecting .photo-item:not([data-deletable="1"]) { opacity: .5; }
.day-jump-note { background: var(--primary-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }

/* Photo tags (labels) */
.tag-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--white); }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-soft); border: 1px solid var(--border); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: .85rem; }
.tag-x { border: 0; background: none; cursor: pointer; font: inherit; color: var(--gray); padding: 0 4px; }
.tag-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.photo-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.photo-label { background: var(--primary-soft); border-radius: 999px; padding: 1px 8px; font-size: .75rem; color: var(--dark); }

/* Collapsible photo groups + form highlights */
.photo-group-head { display: flex; align-items: center; gap: 4px; width: 100%; text-align: left; background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.photo-group-head:hover { background: var(--primary-soft); }
.photo-group.is-collapsed .photo-group-head { opacity: .85; }
.photo-group .photo-grid { margin-top: 8px; }
.pg-caret { width: 1em; display: inline-block; }
.photo-group-bar { display: inline-flex; gap: 6px; }
.needs-attention { outline: 3px solid #d93025; outline-offset: 3px; border-radius: 8px; background: #fdecea; animation: ftp-shake .45s; }
@keyframes ftp-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.status-warn { color: #b3261e; font-weight: 600; }

/* Saved forms (form library) */
.saved-forms { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.saved-forms li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }

/* "Forms to fill in" alert on parent tabs */
.tab-alert { font-size: .95em; }

/* Trip page: guardian cell with an edit link */
.guardian-cell .g2 { margin-top: 4px; padding-top: 4px; border-top: 1px dotted var(--border); }
.guardian-cell [data-edit-guardians] { margin-top: 4px; display: inline-block; }
.linked-box { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.linked-kid { align-items: flex-start; margin: 4px 0; }

/* Chaperone photos waiting for approval, approved marks, chaperone page */
.pending-box { border: 2px dashed #e0a800; background: #fffbea; border-radius: 12px; padding: 12px; margin-top: 12px; }
.pending-actions { margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pending-dot { background: #fff3cd; color: #7a5b00; }
.photo-approved { color: #1a7f37; margin-top: 2px; }
.review-img { width: 100%; max-height: 260px; object-fit: contain; background: #111; border-radius: 8px; }
.chap-student { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.chap-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.chap-photo { font-size: .8rem; }
.chap-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }

/* ---------- phone polish ---------- */
.photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; }
.photo-actions .link-btn { padding: 6px 0; }
.pending-actions .btn { white-space: nowrap; }
@media (max-width: 480px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .card { padding: 18px 16px; }
  h1 { overflow-wrap: anywhere; }
  .topbar .container { flex-wrap: wrap; row-gap: 6px; }
}

/* Never let one wide child (a file picker, a long word) stretch a card past the screen. */
.grid > *, .stack > *, .card, .field { min-width: 0; }
input[type=file]:not(.sr-only) { max-width: 100%; }
@media (max-width: 480px) { input[type=file]:not(.sr-only) { width: 100%; font-size: .9rem; } }

/* Trip Day: keep tapped or focused controls clear of the sticky progress bar when the page scrolls to them. */
.day-tabs ~ .tab-panel button, .day-tabs ~ .tab-panel input, .day-tabs ~ .tab-panel textarea, .day-tabs ~ .tab-panel label, .day-tabs ~ .tab-panel .card { scroll-margin-top: 170px; }

/* Chaperone photos waiting for approval: roomy cards so the tags and buttons never crowd each other. */
.pending-box .photo-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; align-items: start; }
.pending-item { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 10px; gap: 8px; min-width: 0; }
.pending-item .photo-thumb { aspect-ratio: 4 / 3; }
.pending-item figcaption { font-size: .85rem; overflow-wrap: anywhere; }
.pending-item .photo-labels { margin-top: 0; gap: 6px; }
.pending-actions { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.pending-actions .btn { flex: 1 1 auto; justify-content: center; white-space: nowrap; }
.pending-actions .link-btn { flex: 0 0 auto; padding: 8px 4px; }
@media (max-width: 480px) {
  .pending-box .photo-grid { grid-template-columns: minmax(0, 1fr); }
  .pending-item .photo-thumb { aspect-ratio: 4 / 3; }
}

/* Review & send dialog: give each part room, and keep the buttons in view on small screens. */
.review-dialog { padding: 18px; max-height: 92vh; overflow-y: auto; }
.review-dialog > * + * { margin-top: 14px; }
.review-dialog .review-img { max-height: 220px; }
.review-dialog input[type=text] { margin-top: 0 !important; }
.review-dialog .tag-box, .review-dialog .aud-box { margin-top: 14px; }
.review-dialog > .row { position: sticky; bottom: -18px; background: var(--white); padding: 12px 0 2px; border-top: 1px solid var(--border); }
.review-dialog .tag-chips { gap: 8px; margin-bottom: 8px; }
.review-dialog .tag-quick { margin-top: 10px; gap: 8px; }
.review-dialog .aud-box .check { margin: 6px 0; }

/* ---------- Trip Day Photos: calmer, fewer words ---------- */
.photo-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.photo-help summary { cursor: pointer; list-style: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--gray); border: 1px solid var(--border); font-size: .9rem; }
.photo-help summary::-webkit-details-marker { display: none; }
.photo-help[open] { flex-basis: 100%; }
.photo-help[open] > div { margin-top: 6px; }
.photo-send { margin-top: 12px; display: grid; gap: 10px; }
.photo-send > * { margin: 0 !important; }
.photo-more > summary { cursor: pointer; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); font-size: .9rem; color: var(--dark); }
.photo-more[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; background: var(--primary-soft); }
.photo-more > .tag-box, .photo-more > .aud-box { border-radius: 0; border-top: 0; }
.photo-more > .aud-box { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; border-top: 1px solid var(--border); }
.photo-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.photo-tools .photo-zip { margin-left: auto; }
.photo-item { position: relative; }
.photo-item figcaption { display: flex; flex-direction: column; gap: 1px; }
.cap-text { color: var(--dark); overflow-wrap: anywhere; }
.cap-meta { color: var(--gray); font-size: .78rem; }
.photo-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.photo-badges .photo-aud, .photo-badges .photo-approved { border-radius: 999px; padding: 1px 8px; font-size: .75rem; }
.photo-badges .photo-aud { background: #fff3cd; color: #7a5b00; margin: 0; }
.photo-badges .photo-approved { background: #dff5e3; color: #1a7f37; margin: 0; }
.photo-menu { position: absolute; top: 6px; right: 6px; z-index: 3; }
.photo-menu > summary { list-style: none; cursor: pointer; width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.94); box-shadow: 0 1px 4px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; line-height: 1; color: var(--dark); }
.photo-menu > summary::-webkit-details-marker { display: none; }
.photo-menu-pop { position: absolute; right: 0; top: 38px; min-width: 180px; background: var(--white); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.22); padding: 4px; display: flex; flex-direction: column; }
.photo-menu-pop .link-btn { text-align: left; padding: 10px 10px; font-size: .92rem; border-radius: 6px; white-space: nowrap; }
.photo-menu-pop .link-btn:hover { background: var(--primary-soft); }
.photo-card.selecting .photo-menu { display: none; }
.photo-warning { margin-top: 8px; }
.photo-send .check { align-items: center; }
/* The ⋯ menu opens inside its own photo card, so it never runs off the edge of the screen. */
.photo-menu { position: static; }
.photo-menu > summary { position: absolute; top: 6px; right: 6px; z-index: 3; }
.photo-menu-pop { position: absolute; z-index: 4; top: 44px; left: 8px; right: 8px; min-width: 0; }

/* ---------- Allergies & medical alerts ---------- */
.med-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 12px; margin: 8px 0; font-size: .95rem; }
.med-strip.has-alerts { background: #fdecea; border: 2px solid #d93025; color: #7a1410; }
.med-strip.ok { background: #e8f5e9; border: 1px solid #b7dfba; color: #1a5e20; }
.med-strip.warn { background: #fff3cd; border: 1px solid #f0d675; color: #6b4e00; }
.med-strip .med-open { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: 4px 0; text-align: left; }
.med-strip .med-tap { text-decoration: underline; margin-left: 4px; font-size: .85rem; }
.med-strip .med-sub { flex-basis: 100%; font-size: .85rem; }
.med-dialog { max-height: 90vh; overflow-y: auto; }
.med-card { border: 1px solid #f0b4af; background: #fff8f7; border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.med-name { font-weight: 800; margin-bottom: 4px; }
.med-item { margin: 2px 0; }
.med-item.minor { color: #6b4e00; }
.med-contacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.med-unanswered { margin-top: 12px; padding: 8px 10px; background: #fff3cd; border-radius: 8px; }
.day-med { border: 0; background: #fdecea; color: #d93025; border-radius: 8px; width: 40px; align-self: stretch; font-size: 1.1rem; cursor: pointer; }
.day-med-text { display: block; color: #b3261e; font-size: .8rem; font-weight: 600; }
.med-line { color: #b3261e; font-size: .8rem; font-weight: 600; margin-top: 2px; }
.med-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.med-banner.alerts { background: #fdecea; border: 1px solid #f0b4af; color: #7a1410; }
.med-banner.warn { background: #fff3cd; border: 1px solid #f0d675; color: #6b4e00; }
.chap-med { margin: 4px 0 8px; padding: 8px 10px; background: #fdecea; border-radius: 8px; color: #7a1410; font-size: .9rem; }
.chap-med.none { background: #e8f5e9; color: #1a5e20; }
.chap-med.unknown { background: #fff3cd; color: #6b4e00; }
.chap-student-wrap { padding: 8px 0; border-bottom: 1px solid var(--border); }
.em-page { max-width: 980px; margin: 0 auto; padding: 16px; }
.em-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.em-head h1 { margin: 4px 0; font-size: 1.6rem; }
.em-note { background: #fff3cd; border: 1px solid #f0d675; border-radius: 8px; padding: 8px 12px; margin: 12px 0; }
.em-group { font-size: 1.1rem; margin: 18px 0 6px; }
.em-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: 8px; }
.em-table th, .em-table td { border: 1px solid #bbb; padding: 6px 8px; vertical-align: top; text-align: left; }
.em-table th { background: #eee; }
.em-table tr.has-alert td:first-child { border-left: 5px solid #d93025; }
.em-alert { color: #7a1410; margin: 1px 0; }
.em-minor { color: #6b4e00; margin: 1px 0; }
.em-unknown { color: #b3261e; font-weight: 700; }
@media (max-width: 600px) { .em-table { font-size: .8rem; } .em-table th, .em-table td { padding: 4px 5px; } }
@media print { .em-page { max-width: none; padding: 0; } .em-table tr { break-inside: avoid; } }

/* Dashboard header buttons: New trip + Saved forms side by side, wrapping nicely on phones. */
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 600px) { .head-actions .btn { flex: 1 1 auto; justify-content: center; } }

/* Medical answers filled in from an earlier form */
.prefill-note { background: var(--primary-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: .92rem; }
.prefilled { border-left: 3px solid var(--primary); padding-left: 10px; margin-left: -2px; }

/* One-click demo page */
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.demo-grid .btn { justify-content: flex-start; text-align: left; flex-wrap: wrap; }
.demo-list { display: grid; gap: 8px; }
.demo-who { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; height: auto; padding: 10px 14px; white-space: normal; }
.demo-who span { font-weight: 400; }

/* Chaperone view: parent contact tucked into a collapsed section under each student */
.chap-contacts { margin-top: 6px; }
.chap-contacts > summary { cursor: pointer; display: inline-block; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); font-size: .9rem; color: var(--dark); list-style: none; }
.chap-contacts > summary::-webkit-details-marker { display: none; }
.chap-contacts[open] > summary { background: var(--primary-soft); }
.chap-contacts .med-contacts { margin-top: 8px; }

/* Notifications card and banner */
.push-card[data-state="install"] { border: 2px solid #f0c040; background: #fffbea; }
.push-card[data-state="ready"] { border: 2px solid var(--primary); background: var(--primary-soft); }
.push-card[data-state="on"] { padding-top: 12px; padding-bottom: 12px; }
.push-card h3 { font-size: 1.05rem; }
.push-warn { margin: 0 0 8px; }
.push-install { margin: 8px 0; }
.push-install > summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.push-what { margin: 6px 0 10px; padding-left: 18px; }
.push-note { margin: 8px 0 0; color: var(--dark); }
.push-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--primary-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.push-banner span { flex: 1 1 220px; }

/* Fees tab */
.chip.active { background: var(--primary-soft); border-color: var(--primary); font-weight: 600; }
.fee-details summary { cursor: pointer; color: var(--primary); }
.fee-log { margin: 6px 0 10px; padding-left: 18px; }
.fee-log li { margin: 2px 0; }
.fee-form .field { margin: 0; }
@media print { .fee-details { display: none; } [data-fee-row] { break-inside: avoid; } }
.fee-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.fee-list > li { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.map-link { font-weight: 600; }
.tl-map { grid-column: 2 / -1; }

/* Estimated return time */
.eta-banner { background: var(--primary-soft); border: 1px solid var(--primary); border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-weight: 600; }
.eta-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-top: 12px; }
.tl-eta { grid-column: 2 / -1; color: var(--primary); font-weight: 600; }
.eta-notice { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60; background: var(--white); border: 2px solid var(--primary); border-radius: 12px; padding: 12px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.2); max-width: 560px; margin: 0 auto; }
.eta-notice.hidden { display: none; }
.eta-info { flex: 0 0 auto; }
.eta-info summary { cursor: pointer; list-style: none; color: var(--primary); font-size: 1.05rem; line-height: 1; padding: 2px 6px; }
.eta-info summary::-webkit-details-marker { display: none; }
.eta-info[open] { flex-basis: 100%; }
.eta-info p { margin: 4px 0 0; }

/* "You're on the bus" banner: bright and sticky so it can't be missed */
.bus-banner { position: sticky; top: 0; z-index: 100; background: #ff5a00; color: #fff; padding: 10px 14px; text-align: center; font-size: 1rem; line-height: 1.35; box-shadow: 0 2px 10px rgba(0,0,0,.35); animation: bus-pulse 2.4s ease-in-out infinite; }
.bus-banner.hidden { display: none; }
.bus-banner a { color: #fff; text-decoration: underline; font-weight: 700; white-space: nowrap; }
.bus-banner a.hidden { display: none; }
.has-bus-banner .topbar { top: var(--bus-h, 0px); }
@keyframes bus-pulse { 0%, 100% { background: #ff5a00; } 50% { background: #e04a00; } }
@media (prefers-reduced-motion: reduce) { .bus-banner { animation: none; } }

/* Parent language picker and right-to-left (Arabic, Urdu) */
.lang-picker { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.lang-picker select { width: auto; min-width: 0; padding: 6px 10px; font-size: .9rem; border-radius: 8px; }
.topbar .container { gap: 8px; }
[dir="rtl"] body { text-align: start; }
[dir="rtl"] .timeline li:not(:last-child)::after { left: auto; right: 12px; }
[dir="rtl"] .timeline .dot { margin-inline-end: 0; }
[dir="rtl"] input[type="tel"], [dir="rtl"] input[inputmode="tel"], [dir="rtl"] .mono, [dir="rtl"] .trip-code-input { direction: ltr; text-align: left; }
[dir="rtl"] .badge, [dir="rtl"] .btn { unicode-bidi: plaintext; }
[dir="rtl"] .eta-banner, [dir="rtl"] .update-list li { text-align: start; }
html[lang="ar"] body, html[lang="ur"] body { font-family: system-ui, -apple-system, "Segoe UI", "Noto Naskh Arabic", "Noto Sans Arabic", "Noto Nastaliq Urdu", Tahoma, Arial, sans-serif; line-height: 1.7; }

/* Translated reading copy of a form */
.translated-form { border-inline-start: 4px solid var(--primary); }
.translated-body { max-width: 70ch; }
.translated-body h4 { margin: 14px 0 4px; }
.translated-body ul { padding-inline-start: 22px; margin: 4px 0 10px; }
.translated-body li { margin: 3px 0; }
.translated-body p { margin: 0 0 10px; }

/* ---- Homepage hero carousel (real screenshots from the demo school) ---- */
.hero-carousel { background: var(--white); color: var(--dark); border-radius: 16px; box-shadow: 0 30px 60px rgba(0, 0, 0, .25); padding: 12px 12px 10px; width: 100%; max-width: 560px; margin: 0 auto; outline-offset: 4px; }
.hc-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; border-radius: 10px; }
.hc-track::-webkit-scrollbar { display: none; }
.hc-slide { flex: 0 0 100%; scroll-snap-align: start; margin: 0; }
.hc-desktop, .hc-phone { aspect-ratio: 8 / 5; border-radius: 10px; overflow: hidden; background: #eef3f8; display: flex; justify-content: center; align-items: flex-start; }
.hc-desktop img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }
.hc-phone { background: linear-gradient(135deg, #dbeafe, #eef2ff); align-items: center; }
.hc-phone img { height: 94%; width: auto; border: 6px solid #1f2937; border-radius: 22px; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); display: block; object-fit: cover; object-position: top; }
.hc-slide figcaption { padding: 10px 6px 2px; font-weight: 600; font-size: .95rem; text-align: center; min-height: 3em; }
.hc-controls { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 6px; }
.hc-prev, .hc-next { border: 1px solid #cfd8e3; background: #fff; border-radius: 999px; width: 40px; height: 40px; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--primary); }
.hc-prev:hover, .hc-next:hover { background: #f1f6ff; }
.hc-dots { display: flex; gap: 8px; align-items: center; }
.hc-dot { width: 12px; height: 12px; padding: 0; border-radius: 50%; border: 0; background: #c5d0dd; cursor: pointer; }
.hc-dot[aria-current="true"] { background: var(--primary); transform: scale(1.25); }
.hc-prev:focus-visible, .hc-next:focus-visible, .hc-dot:focus-visible { outline: 3px solid #99ccff; outline-offset: 2px; }
@media (max-width: 900px) { .hero-carousel { max-width: 520px; margin-top: 12px; } }
.hero .container > * { min-width: 0; }
.hero-carousel { min-width: 0; box-sizing: border-box; }

/* ---------- parent trip page: bottom tab bar, child switcher and ☰ menu (views/parent-trip.ejs, /js/parent-nav.js) ---------- */
.parent-shell.has-bottom-nav { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; flex-wrap: nowrap; justify-content: center; gap: 2px; margin: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); }
.bottom-nav .tab { position: relative; flex: 1 1 0; max-width: 150px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0; padding: 6px 2px; border: 0; border-radius: 12px; background: none; color: var(--gray); font-size: .74rem; font-weight: 600; line-height: 1.15; white-space: nowrap; }
.bottom-nav .tab .ico { font-size: 1.35rem; line-height: 1.1; }
.bottom-nav .tab .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: .69rem; letter-spacing: -.01em; }
.bottom-nav .tab.active { color: var(--primary-dark); background: var(--primary-soft); border: 0; }
.bottom-nav .nav-badge { position: absolute; top: 2px; inset-inline-end: calc(50% - 24px); font-size: .75rem; }
.bottom-nav .nav-count { position: absolute; top: 2px; inset-inline-end: calc(50% - 30px); min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: #fff; font-size: .68rem; line-height: 18px; text-align: center; }
.tabs.kid-switch { flex-wrap: nowrap; overflow-x: auto; gap: 6px; box-shadow: none; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.kid-switch.single { display: none; }
.kid-switch .tab { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; background: var(--white); }
.kid-switch .tab.active { background: var(--primary-soft); border-color: var(--primary); }
.section-label { font-size: 1.05rem; margin: 18px 4px 8px; }
.menu-back { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .45); display: flex; justify-content: flex-end; }
.menu-back.hidden { display: none; }
.menu-panel { width: min(420px, 100%); height: 100%; overflow-y: auto; background: var(--light); padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: -8px 0 24px rgba(0, 0, 0, .15); }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }
.menu-panel .push-card, .menu-panel .menu-card { margin-bottom: 12px; }
body.menu-open { overflow: hidden; }
@media print { .bottom-nav, .menu-back, .kid-switch { display: none !important; } }

/* ---------- calendar (/calendar, venue calendar) ---------- */
.cal-head { margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--border); gap: 1px; }
.cal-dow { background: #f1f3f5; text-align: center; font-size: 12px; font-weight: 600; padding: 6px 0; color: var(--gray); }
.cal-day { background: #fff; min-height: 96px; padding: 4px 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.out { background: #fafbfc; }
.cal-day.out .cal-num span:first-child { color: #adb5bd; }
.cal-day.today .cal-num span:first-child { background: var(--primary, #007BFF); color: #fff; border-radius: 999px; padding: 0 7px; }
.cal-day.clash { background: #fff8e1; }
.cal-num { font-size: 13px; font-weight: 600; }
.cal-add { opacity: 0; font-weight: 700; text-decoration: none; padding: 0 6px; border-radius: 6px; }
.cal-day:hover .cal-add, .cal-add:focus { opacity: 1; background: #e7f1ff; }
.cal-ev { display: block; font-size: 12px; line-height: 1.3; padding: 2px 5px; border-radius: 5px; text-decoration: none; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.cal-trip { background: #e7f1ff; }
.cal-ev.cal-due { background: #f3f0ff; }
.cal-ev.cal-pending { background: #fff3cd; }
.cal-ev.cal-approved { background: #e6f4ea; }
.cal-ev.cal-suggested { background: #e7f1ff; }
.cal-more { font-size: 11px; }
.cal-sum { display: block; font-size: 12px; font-weight: 700; line-height: 1.3; padding: 2px 5px; border-radius: 5px; text-decoration: none; background: #eef2f7; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-sum.cal-over { background: #fde2e1; color: #a61b1b; }
.cal-sum.cal-closed { background: #f1f3f5; color: var(--gray); font-weight: 600; }
.cal-sum.cal-open { background: #e6f4ea; color: #1e6b34; }
.cal-sum.cal-limited { background: #fff3cd; color: #6b4e00; }
/* bus company: compact request rows that open, fleet pickers */
.tabs-sub { margin-bottom: 10px; }
.tabs-sub .tab { font-size: 14px; padding: 8px 12px; }
.req-list { display: flex; flex-direction: column; gap: 6px; }
.req-row { background: var(--white); border: 1px solid var(--border); border-radius: 10px; }
.req-row > summary { display: grid; grid-template-columns: 104px minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 9px 12px; cursor: pointer; list-style: none; }
.req-row > summary::-webkit-details-marker { display: none; }
.req-row > summary b, .req-row > summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-row > summary small { color: var(--gray); font-size: 12px; }
.req-row[open] > summary { border-bottom: 1px solid var(--border); background: #f8f9fa; border-radius: 10px 10px 0 0; }
.req-body { padding: 10px 14px 12px; }
.req-buses { font-size: 13px; white-space: nowrap; }
.cap-chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #f1f3f5; white-space: nowrap; }
.cap-chip.ok { background: #e6f4ea; color: #1e6b34; }
.cap-chip.short { background: #fde2e1; color: #a61b1b; }
.assign-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: #fbfcfd; }
.assign-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 6px 10px; align-items: center; margin-bottom: 6px; }
.assign-row[hidden] { display: none; }
.assign-info { font-size: 13px; color: var(--gray); }
.cap-live { margin: 6px 0; font-weight: 600; }
.cap-live.ok { color: #1e6b34; }
.cap-live.short { color: #a61b1b; }
/* stacked red alerts: a heading, then one row per item */
.alert-stack { border: 1px solid #f1b0b7; background: var(--danger-soft, #fdecee); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.alert-head { padding: 9px 14px; font-weight: 700; color: #a61b1b; border-bottom: 1px solid #f1b0b7; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-top: 1px solid rgba(241, 176, 183, .55); color: #6b1a1a; }
.alert-head + .alert-item { border-top: 0; }
.alert-date { flex: 0 0 auto; min-width: 54px; font-weight: 700; color: #a61b1b; }
.alert-text { flex: 1 1 auto; min-width: 0; }
.alert-text small { display: block; color: #8a2a2a; font-size: 13px; }
.alert-item .btn { flex: 0 0 auto; background: var(--white); }
.alert-sm .alert-item { padding: 5px 10px; font-size: 14px; }
.service-form { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 6px 0; }
.reassign-note a { font-weight: 600; }
.list-row { border-top: 1px solid var(--border); padding: 7px 0; }
@media (max-width: 700px) {
  .req-row > summary { grid-template-columns: 70px minmax(0, 1fr) auto; }
  .req-row > summary .req-cap, .req-row > summary .badge { grid-column: 2 / -1; justify-self: start; }
  .req-row > summary .badge { grid-column: auto; }
  .assign-row { grid-template-columns: minmax(0, 1fr); gap: 4px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
  .assign-info:empty { display: none; }
}
.near-note { font-size: 12px; color: var(--gray); padding: 6px 10px; border-top: 1px solid var(--border); }
.near-note .btn-link { font-size: 12px; }
.offered { padding: 8px 10px; border-radius: 8px; background: #e7f1ff; border: 1px solid #cfe2ff; }
.offer-dates { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 0; }
.offer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; }
.offer-grid label { display: flex; gap: 6px; align-items: baseline; }
.fleet-meter { display: flex; flex-wrap: wrap; gap: 8px; }
.fleet-meter > div { flex: 1 1 120px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; background: var(--white); }
.fleet-meter b { display: block; font-size: 26px; line-height: 1.1; }
.fleet-meter .over b { color: #c92a2a; }
.cal-list { margin: 0; padding-left: 18px; }
.cal-list li { margin-bottom: 6px; }
@media (max-width: 700px) {
  .cal-day { min-height: 54px; padding: 3px; }
  .cal-ev { font-size: 0; padding: 0; background: none !important; display: inline; }
  .cal-ev::before { content: '●'; font-size: 11px; color: var(--primary, #007BFF); }
  .cal-ev.cal-due::before { color: #7950f2; }
  .cal-more, .cal-add { display: none; }
  .cal-sum { font-size: 10px; padding: 1px 2px; white-space: normal; }
  .cal-dow { font-size: 11px; }
}

/* ---------- live chat (venue <-> school) ---------- */
.chat-list { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px; background: #f8f9fa; border-radius: 10px; border: 1px solid var(--border); }
.chat-msg { max-width: 82%; padding: 7px 10px; border-radius: 12px; background: #fff; border: 1px solid var(--border); align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; background: #e7f1ff; border-color: #cfe2ff; }
.chat-msg.waiting { opacity: .75; border-style: dashed; }
.chat-who { font-size: 11px; color: var(--gray); margin-bottom: 2px; }
.chat-body { white-space: pre-wrap; word-break: break-word; }
.chat-state { font-size: 11px; color: var(--gray); text-align: right; }
.chat-state:empty { display: none; }
.chat-form { display: flex; gap: 8px; margin-top: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; min-height: 44px; max-height: 140px; resize: vertical; }
.chat-threads a { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: inherit; border: 1px solid transparent; }
.chat-threads a.active { background: #e7f1ff; border-color: #cfe2ff; }
.online-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; border: 1px solid var(--border); background: #fff; }
.online-bar.on { background: #e6f4ea; border-color: #b7dfc2; }

/* ---------- phones: bottom tab bars (public/js/bottom-tabs.js) and the ☰ top-bar menu ---------- */
.appbar-menu-btn { display: none; }
.phone-bar[hidden] { display: none !important; }
.menu-link { width: 100%; text-align: start; font: inherit; cursor: pointer; color: inherit; text-decoration: none; }
.menu-link.active { border-color: var(--primary); background: var(--primary-soft); }
.menu-link .count:empty { display: none; }
@media (max-width: 760px) {
  body.phone-bar-on .tabs[data-phone-bar] { display: none; }
  body.phone-bar-on main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .appbar-links { display: none !important; }
  .appbar-menu-btn { display: inline-flex; }
}
@media print { .phone-bar, .appbar-menu-btn { display: none !important; } }

/* ---------- trip page: slim title line above the tabs, Summary tab ---------- */
.trip-slim { gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.trip-slim h1 { font-size: 1.45rem; margin: 0; line-height: 1.2; }
.trip-slim-title { min-width: 0; }
.stat-link { display: block; text-decoration: none; color: inherit; }
.stat-link:hover { border-color: var(--primary); }
.glance { margin: 0; padding-left: 0; list-style: none; }
.glance li { padding: 6px 0; border-top: 1px solid var(--border); }
.glance li:first-child { border-top: 0; }
@media (max-width: 760px) { .trip-slim h1 { font-size: 1.2rem; } .trip-slim .btn { padding: 6px 10px; } }

/* ---------- keep your place after saving (public/js/app.js) ---------- */
/* same-page saves swap smoothly instead of flashing white (browsers that support cross-page view transitions) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 120ms; }
html.kept-place main .flash { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 90; width: min(560px, calc(100% - 32px)); box-shadow: 0 8px 24px rgba(0, 0, 0, .15); margin: 0; transition: opacity .4s; }
html.kept-place main .flash.fade-out { opacity: 0; pointer-events: none; }

/* ---------- dashboard: needs your attention ---------- */
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { border-top: 1px solid var(--border); }
.attention-list li:first-child { border-top: 0; }
.attention-list a { display: block; padding: 8px 4px 8px 10px; color: inherit; text-decoration: none; border-left: 4px solid transparent; }
.attention-list a:hover { background: #f8f9fa; }
.attention-list .tone-bad a { border-left-color: #dc3545; }
.attention-list .tone-soon a { border-left-color: #f0ad4e; }
.attention-list .tone-info a { border-left-color: #28a745; }

/* ---------- trip roster: bulk actions ---------- */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; margin: 8px 0; border-radius: 10px; background: #e7f1ff; border: 1px solid #cfe2ff; position: sticky; top: 0; z-index: 5; }
.bulk-bar[hidden] { display: none; }
.bulk-pay { display: inline-flex; gap: 4px; align-items: center; }
.bulk-col { width: 34px; text-align: center; }
.btn-danger-outline { color: #b02a37; border-color: #f1aeb5; }
@media (max-width: 760px) { body.phone-bar-on .bulk-bar { top: auto; bottom: calc(76px + env(safe-area-inset-bottom)); position: sticky; } }

/* ---------- dashboard: setup checklist ---------- */
.setup-steps { margin: 0; padding-left: 0; list-style: none; }
.setup-steps li { padding: 5px 0; }
.setup-steps li.done { color: var(--gray); }
.quick-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.quick-pick .chip.active { background: var(--primary-soft); border-color: var(--primary); }

/* ---------- trip buses ---------- */
.bus-card.over { border-color: #f1aeb5; }
.bus-sheet { break-inside: avoid; page-break-after: always; margin-bottom: 24px; }
.bus-sheet:last-child { page-break-after: auto; }
.bus-names { columns: 2; padding-left: 22px; }
.bus-names li { margin-bottom: 4px; break-inside: avoid; }
.bus-names .box { display: inline-block; width: 12px; height: 12px; border: 1px solid #333; margin-right: 4px; vertical-align: middle; }

/* Pages with a fixed bottom bar: scrolling to a button or field keeps it clear of the bar (keyboard focus, links to #anchors) */
html:has(.parent-shell.has-bottom-nav), html:has(body.phone-bar-on) { scroll-padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
/* Expand all / Collapse all above a run of accordions */
.accordion-tools { display: flex; justify-content: flex-end; margin: 0 0 8px; }
@media print { .accordion-tools { display: none; } }

/* nav hover: text turns the brand color, the sign-in button darkens and lifts slightly */
.topnav a:not(.btn) { transition: color .15s ease; }
.topnav a:not(.btn):hover { color: var(--primary); }
.topnav a.btn { transition: background .15s ease, transform .15s ease; }
.topnav a.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* ---------- Feature Requests ---------- */
.fr-wide { max-width: 860px; }
.fr-hero { padding: 18px 0 8px; } .fr-hero h1 { margin: 0 0 2px; }
.fr-form { margin-top: 12px; }
.fr-menus { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 6px; padding: 8px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.fr-tab { display: inline-block; border: 1px solid var(--border); background: var(--white); color: var(--dark); border-radius: 8px; padding: 7px 13px; font: inherit; font-size: .93rem; }
.fr-tab:hover { border-color: var(--primary); }
.fr-tab.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.fr-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; align-items: center; }
.fr-filters input[type=search] { min-width: 160px; }
.fr-item { display: flex; gap: 14px; align-items: flex-start; margin-top: 10px; }
.fr-vote { margin: 0; flex: none; }
.fr-votebtn { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 54px; height: 58px; border: 1px solid var(--border); border-radius: 10px; background: var(--white); cursor: pointer; font: inherit; color: var(--dark); }
.fr-votebtn span { font-size: .8rem; line-height: 1; } .fr-votebtn b { font-size: 1.1rem; }
.fr-votebtn:hover:not(:disabled) { border-color: var(--primary); }
.fr-votebtn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.fr-votebtn:disabled { opacity: .7; cursor: default; }
.fr-body { min-width: 0; flex: 1 1 auto; }
.fr-details { white-space: pre-wrap; margin: 6px 0; }
.fr-note { padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--primary-soft); }
.fr-pill { font-size: .72rem; padding: 1px 8px; border-radius: 999px; margin-left: 6px; background: #e2e8f0; color: #334155; font-weight: 600; }
.fr-status { font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; vertical-align: middle; background: #e2e8f0; color: #334155; }
.fr-status.s-planned { background: #fef3c7; color: #92400e; } .fr-status.s-done { background: #dcfce7; color: #166534; } .fr-status.s-declined { background: #fee2e2; color: #991b1b; }

.site-copyright { text-align: center; color: var(--gray, #6c757d); font-size: .8rem; margin: 0; padding: 24px 12px 90px; }
@media print { .site-copyright { display: none; } }
