/* ==========================================================================
   OurChurchBus design system
   Palette drawn from the brand art: deep navy, school-bus yellow, sunrise orange, warm cream.
   ========================================================================== */

:root {
  --navy: #0E1F3F;
  --navy-2: #172C56;
  --navy-3: #22396b;
  --yellow: #FFB703;
  --yellow-2: #FFC933;
  --yellow-soft: #FFF1C7;
  --orange: #FB8500;
  --cream: #FFF8EC;
  --sky: #9CC5E8;

  --bg: #F6F1E7;
  --surface: #FFFFFF;
  --surface-2: #FBF8F2;
  --text: #1B2335;
  --text-2: #3d475c;
  --muted: #6B7488;
  --line: #E9E2D4;
  --line-2: #F1ECE2;

  --green: #1F9D6B;
  --green-soft: #DDF4EA;
  --red: #D64545;
  --red-soft: #FCE4E2;
  --blue: #3A73D5;
  --blue-soft: #E1EAFB;
  --purple: #7C5CE0;
  --purple-soft: #ECE6FD;
  --amber-soft: #FFF1CC;

  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(14, 31, 63, .06), 0 1px 1px rgba(14, 31, 63, .04);
  --shadow: 0 6px 20px -8px rgba(14, 31, 63, .18), 0 2px 6px rgba(14, 31, 63, .05);
  --shadow-lg: 0 24px 60px -18px rgba(14, 31, 63, .35);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --tap: 48px;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="contrast"]) {
    --bg: #0A1428; --surface: #111F3C; --surface-2: #0E1A33; --text: #EEF2FA; --text-2: #C9D2E3; --muted: #93A0B8;
    --line: #22355C; --line-2: #1A2B4D; --yellow-soft: #3a3110; --green-soft: #0f3527; --red-soft: #3d1a1d;
    --blue-soft: #16294f; --purple-soft: #2a2150; --amber-soft: #3a3110; --cream: #142445;
    --shadow: 0 6px 20px -8px rgba(0, 0, 0, .6); --shadow-sm: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1428; --surface: #111F3C; --surface-2: #0E1A33; --text: #EEF2FA; --text-2: #C9D2E3; --muted: #93A0B8;
  --line: #22355C; --line-2: #1A2B4D; --yellow-soft: #3a3110; --green-soft: #0f3527; --red-soft: #3d1a1d;
  --blue-soft: #16294f; --purple-soft: #2a2150; --amber-soft: #3a3110; --cream: #142445;
  --shadow: 0 6px 20px -8px rgba(0, 0, 0, .6); --shadow-sm: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}
:root[data-theme="contrast"] {
  --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #FFFFFF; --text: #000; --text-2: #000; --muted: #2b2b2b;
  --line: #000; --line-2: #444; --navy: #000A1F; --yellow: #FFC400; --green: #006B3F; --red: #B00000; --blue: #0040B0;
}
:root[data-text="large"] { font-size: 112.5%; }
:root[data-text="xlarge"] { font-size: 125%; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-text);
  font-size: 1rem; line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font); color: var(--text); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 800; }
h3 { font-size: 1.02rem; font-weight: 750; }
p { margin: 0 0 .8em; }
small, .small { font-size: .84rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .9em; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.22em; }

/* ---------- App shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.sidebar { display: none; }
.main { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }

.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .5rem;
  padding: calc(.6rem + var(--safe-t)) 1rem .6rem; min-height: 60px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-title { flex: 1; min-width: 0; font-family: var(--font); font-weight: 800; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-brand { display: flex; align-items: center; gap: .55rem; }
.topbar-brand img { width: 34px; height: 34px; border-radius: 9px; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  border: 0; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--line-2); text-decoration: none; }
.icon-btn .icon { width: 22px; height: 22px; }
.dot-badge {
  position: absolute; top: 5px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: .68rem; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.page { max-width: 1120px; margin: 0 auto; padding: .5rem 1rem 1rem; }
.page-narrow { max-width: 720px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: .6rem 0 1.1rem; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: .2rem 0 0; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Bottom tab bar (mobile) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + var(--safe-b)); background: var(--navy); box-shadow: 0 -6px 24px rgba(14,31,63,.18);
  border-radius: 20px 20px 0 0;
}
.bottom-nav a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 54px; border-radius: 14px; color: #A9B6D0; font-size: .7rem; font-weight: 700; letter-spacing: .01em;
}
.bottom-nav a:hover { text-decoration: none; color: #fff; }
.bottom-nav a .icon { width: 24px; height: 24px; }
.bottom-nav a.active { color: var(--navy); background: var(--yellow); }
.bottom-nav .dot-badge { top: 3px; right: calc(50% - 22px); box-shadow: 0 0 0 2px var(--navy); }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 264px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--navy); color: #fff; padding: 1.1rem .9rem;
  }
  .sidebar .brand { display: flex; align-items: center; gap: .7rem; padding: .3rem .5rem 1.2rem; color: #fff; }
  .sidebar .brand:hover { text-decoration: none; }
  .sidebar .brand img { width: 42px; height: 42px; border-radius: 12px; }
  .sidebar .brand b { font-family: var(--font); font-size: 1.12rem; display: block; line-height: 1.1; }
  .sidebar .brand span { color: #9fb0cf; font-size: .78rem; }
  .side-section { color: #7f90b3; font-size: .7rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; margin: 1rem .7rem .35rem; }
  .side-link {
    position: relative; display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: 12px;
    color: #C7D2E8; font-weight: 650; font-size: .95rem;
  }
  .side-link:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
  .side-link.active { background: var(--yellow); color: var(--navy); }
  .side-link .count { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: .72rem; padding: 0 .5rem; font-weight: 800; }
  .side-link.active .count { background: var(--navy); }
  .sidebar .side-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--navy-3); }
  .side-user { display: flex; align-items: center; gap: .65rem; padding: .5rem; border-radius: 12px; color: #fff; }
  .side-user:hover { background: var(--navy-2); text-decoration: none; }
  .side-user small { color: #9fb0cf; display: block; }
  .bottom-nav { display: none; }
  .main { padding-bottom: 2rem; }
  .topbar-brand { display: none; }
  .page { padding: 1rem 2rem 2rem; }
}

/* ---------- Cards & surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 1.1rem; margin-bottom: 1rem;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .8rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head { padding: 1rem 1.1rem 0; }
.card-link { display: block; color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
.card-link:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.card-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.card-navy h1, .card-navy h2, .card-navy h3 { color: #fff; }
.card-yellow { background: var(--yellow); border-color: var(--yellow); color: var(--navy); }
.card-cream { background: var(--cream); }

.grid { display: grid; gap: 1rem; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.grid-4 { display: grid; gap: .8rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-main { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
}
.stack > * + * { margin-top: .75rem; }
.row { display: flex; align-items: center; gap: .6rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* Hero */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 1.4rem 1.3rem 1.3rem; margin-bottom: 1rem;
  background: linear-gradient(100deg, rgba(14,31,63,.94) 0%, rgba(14,31,63,.78) 46%, rgba(14,31,63,0) 78%), var(--hero-img) center right / cover no-repeat, var(--navy);
  color: #fff; min-height: 190px; display: flex; flex-direction: column; justify-content: flex-end; box-shadow: var(--shadow);
}
.hero h1 { color: #fff; font-size: 1.55rem; margin-bottom: .25rem; max-width: 22ch; }
.hero p { color: #d6deee; margin: 0 0 .9rem; max-width: 40ch; }
.hero .eyebrow { color: var(--yellow); font-weight: 800; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .3rem; }
@media (min-width: 720px) { .hero { min-height: 230px; padding: 2rem; } .hero h1 { font-size: 2rem; } }

/* Stat tiles */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1rem; box-shadow: var(--shadow-sm); }
.stat .label { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-family: var(--font); font-weight: 800; font-size: 1.85rem; line-height: 1.1; margin-top: .2rem; color: var(--text); }
.stat .delta { font-size: .8rem; font-weight: 700; }
.stat .delta.up { color: var(--green); } .stat .delta.down { color: var(--red); }
.stat-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--yellow-soft); color: var(--navy); margin-bottom: .5rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: var(--tap); padding: .6rem 1.15rem;
  border-radius: 13px; border: 1.5px solid transparent; font: 700 .97rem/1.1 var(--font-text); cursor: pointer;
  background: var(--surface); color: var(--text); border-color: var(--line); text-decoration: none; white-space: nowrap;
  transition: background .12s ease, transform .06s ease, box-shadow .12s ease; -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--yellow); color: var(--navy); border-color: var(--yellow); box-shadow: 0 6px 16px -8px rgba(251,133,0,.7); }
.btn-primary:hover { background: var(--yellow-2); }
.btn-dark { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-dark:hover { background: var(--navy-2); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #c13a3a; }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--line-2); }
.btn-sm { min-height: 38px; padding: .4rem .8rem; font-size: .88rem; border-radius: 10px; }
.btn-lg { min-height: 58px; font-size: 1.08rem; padding: .8rem 1.4rem; border-radius: 16px; }
.btn-block { display: flex; width: 100%; }
.btn .icon { width: 1.15em; height: 1.15em; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
.inline-form { display: inline; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1rem; }
.field > label, .label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .35rem; color: var(--text-2); }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: .3rem; }
.field .error { color: var(--red); font-size: .84rem; margin-top: .3rem; font-weight: 600; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date],
input[type=time], input[type=search], input[type=url], input[type=color], select, textarea {
  width: 100%; min-height: var(--tap); padding: .65rem .85rem; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text); font: 500 1rem/1.3 var(--font-text); appearance: none; -webkit-appearance: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input[type=color] { padding: .25rem; width: 64px; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7488' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 18px; padding-right: 2.4rem;
}
select[multiple] { background-image: none; min-height: 120px; padding: .4rem; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 4px rgba(255,183,3,.35); }
input::placeholder, textarea::placeholder { color: #a3a9b6; }
.form-row { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } .form-row.three { grid-template-columns: 1fr 1fr 1fr; } }
.check { display: flex; align-items: flex-start; gap: .6rem; padding: .4rem 0; cursor: pointer; font-weight: 600; }
.check input { width: 22px; height: 22px; margin: .05rem 0 0; accent-color: var(--navy); flex: none; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .2rem .8rem; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }
.form-sticky { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 5; background: var(--bg); padding: .6rem 0; }
@media (min-width: 960px) { .form-sticky { bottom: 0; } }

/* Switch */
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cdd3de; border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--yellow); }

/* Segmented control / tabs */
.tabs { display: flex; gap: .3rem; padding: .3rem; background: var(--line-2); border-radius: 14px; overflow-x: auto; scrollbar-width: none; margin-bottom: 1rem; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button {
  flex: 1 0 auto; text-align: center; padding: .55rem .9rem; border-radius: 11px; font-weight: 700; font-size: .9rem; color: var(--muted);
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
}
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.searchbar { position: relative; margin-bottom: .9rem; }
.searchbar .icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchbar input { padding-left: 2.6rem; border-radius: 14px; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters select, .filters input { width: auto; min-width: 140px; flex: 1; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: .85rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line-2); color: inherit; min-height: 64px;
}
.list-item:first-child { border-top: 0; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .title { font-weight: 700; color: var(--text); }
.list-item .meta { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
.list-item .chev { color: #b9bfcc; }
.list-item .end { margin-left: auto; text-align: right; flex: none; }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--yellow-soft); color: var(--navy); font-weight: 800; font-family: var(--font); font-size: .95rem;
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: .78rem; }
.avatar-lg { width: 88px; height: 88px; font-size: 1.7rem; }
.avatar-xl { width: 116px; height: 116px; font-size: 2.2rem; }
.avatar.navy { background: var(--navy); color: var(--yellow); }

/* Pills & chips */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .6rem; border-radius: 99px; font-size: .74rem; font-weight: 800; letter-spacing: .02em; background: var(--line-2); color: var(--text-2); white-space: nowrap; }
.pill-active, .pill-completed, .pill-present, .pill-submitted, .pill-sent, .pill-on, .pill-done, .pill-ok { background: var(--green-soft); color: var(--green); }
.pill-prospect, .pill-open, .pill-pending, .pill-normal, .pill-changed, .pill-time-change { background: var(--blue-soft); color: var(--blue); }
.pill-assigned, .pill-special, .pill-high, .pill-invited, .pill-combined, .pill-replaced { background: var(--amber-soft); color: #9a6200; }
.pill-inactive, .pill-closed, .pill-low, .pill-disabled, .pill-off, .pill-ended { background: var(--line-2); color: var(--muted); }
.pill-moved, .pill-removed, .pill-absent, .pill-failed, .pill-cancelled, .pill-overdue, .pill-blocked { background: var(--red-soft); color: var(--red); }
.route-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .14rem .6rem .14rem .45rem; border-radius: 99px; font-size: .76rem; font-weight: 800; background: color-mix(in srgb, var(--chip) 18%, var(--surface)); color: var(--text); }
.route-chip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--chip); }
.alert-flag { display: inline-flex; align-items: center; gap: .3rem; color: var(--red); font-weight: 800; font-size: .78rem; }
.tag-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: .72rem; font-weight: 800; }

/* Notices */
.notice { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 14px; margin-bottom: 1rem; background: var(--blue-soft); color: var(--text); font-size: .94rem; }
.notice .icon { color: var(--blue); margin-top: .1rem; }
.notice-warn { background: var(--amber-soft); } .notice-warn .icon { color: #b47300; }
.notice-danger { background: var(--red-soft); } .notice-danger .icon { color: var(--red); }
.notice-success { background: var(--green-soft); } .notice-success .icon { color: var(--green); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 800; padding: .65rem .8rem; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.table td { padding: .7rem .8rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Empty states with brand art */
.empty { text-align: center; padding: 2rem 1rem 2.2rem; color: var(--muted); }
.empty img { width: 168px; height: 168px; margin: 0 auto .8rem; border-radius: 28px; object-fit: cover; }
.empty h3 { color: var(--text); margin-bottom: .3rem; }
.empty p { max-width: 36ch; margin: 0 auto 1rem; }

/* Flash toasts */
.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); top: calc(12px + var(--safe-t)); width: min(94vw, 460px); display: grid; gap: .5rem; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: .65rem; align-items: center; padding: .8rem 1rem; border-radius: 14px; background: var(--navy); color: #fff;
  box-shadow: var(--shadow-lg); font-weight: 600; animation: toast-in .25s ease;
}
.toast .icon { color: var(--yellow); }
.toast.error { background: var(--red); } .toast.error .icon { color: #fff; }
.toast.success .icon { color: #6ee7b7; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Connection indicator */
.net-status { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 12px); display: none; align-items: center; gap: .45rem; padding: .45rem .9rem; border-radius: 99px; background: var(--navy); color: #fff; font-size: .82rem; font-weight: 700; box-shadow: var(--shadow); }
.net-status.show { display: inline-flex; }
@media (min-width: 960px) { .net-status { bottom: 18px; } }

/* Bottom sheet / modal */
.sheet-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(10,20,40,.45); display: none; align-items: flex-end; justify-content: center; }
.sheet-backdrop.open { display: flex; animation: fade .15s ease; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 24px 24px 0 0; padding: .6rem 1.2rem calc(1.2rem + var(--safe-b)); box-shadow: var(--shadow-lg); animation: sheet-up .22s ease; }
.sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto .9rem; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.sheet-head h2 { margin: 0; }
@media (min-width: 720px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 22px; } .sheet::before { display: none; } .sheet { padding-top: 1.2rem; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Dropdown menu */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: .35rem; display: none; }
.menu.open { display: block; }
.menu a, .menu button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem .75rem; border-radius: 10px; color: var(--text); background: none; border: 0; font: 600 .93rem var(--font-text); cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--line-2); text-decoration: none; }
.menu .danger { color: var(--red); }

/* Key/value details */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; font-size: .95rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* Quick action tiles */
.actions-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: .55rem; margin: 1rem 0; }
.action-tile { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .8rem .4rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 700; font-size: .8rem; text-align: center; }
.action-tile:hover { text-decoration: none; border-color: var(--yellow); }
.action-tile .icon { width: 24px; height: 24px; color: var(--navy); }
:root[data-theme="dark"] .action-tile .icon { color: var(--yellow); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 1rem 2.6rem; }
.timeline li::before { content: ""; position: absolute; left: 9px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--yellow); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.timeline .who { font-weight: 700; font-size: .88rem; }
.timeline .when { color: var(--muted); font-size: .8rem; }
.timeline .body { white-space: pre-wrap; margin-top: .15rem; }

/* ---------- Roll call ---------- */
.rc-header { position: sticky; top: calc(60px + var(--safe-t)); z-index: 20; background: var(--navy); color: #fff; border-radius: 18px; padding: .8rem 1rem; margin-bottom: .8rem; box-shadow: var(--shadow); }
.rc-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; text-align: center; }
.rc-counts b { display: block; font-family: var(--font); font-size: 1.7rem; line-height: 1; color: var(--yellow); }
.rc-counts span { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: #b9c5dd; font-weight: 800; }
.rc-sync { display: flex; align-items: center; justify-content: center; gap: .35rem; font-size: .75rem; color: #b9c5dd; margin-top: .45rem; font-weight: 700; }
.rc-sync .dot { width: 8px; height: 8px; border-radius: 50%; background: #6ee7b7; }
.rc-sync.syncing .dot { background: var(--yellow); animation: pulse 1s infinite; }
.rc-sync.offline .dot { background: #f87171; }
@keyframes pulse { 50% { opacity: .3; } }
.rc-stop { font-size: .74rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 1rem .3rem .4rem; display: flex; align-items: center; gap: .4rem; }
.rc-row { display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; margin-bottom: .5rem; transition: border-color .12s, background .12s; }
.rc-row.present { border-color: var(--green); background: color-mix(in srgb, var(--green-soft) 60%, var(--surface)); }
.rc-row.absent { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); background: color-mix(in srgb, var(--red-soft) 50%, var(--surface)); }
.rc-row.will-ride { box-shadow: inset 4px 0 0 var(--yellow); }
.rc-row .who { flex: 1; min-width: 0; }
.rc-row .name { font-weight: 800; font-size: 1.02rem; line-height: 1.2; }
.rc-row .sub { color: var(--muted); font-size: .8rem; }
.rc-toggle { display: flex; gap: .35rem; flex: none; }
.rc-toggle button { width: 58px; height: 52px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .06s; }
.rc-toggle button:active { transform: scale(.94); }
.rc-toggle button .icon { width: 26px; height: 26px; }
.rc-toggle .p.on { background: var(--green); border-color: var(--green); color: #fff; }
.rc-toggle .a.on { background: var(--red); border-color: var(--red); color: #fff; }
.rc-submit { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); z-index: 15; margin-top: 1rem; }
@media (min-width: 960px) { .rc-submit { bottom: 14px; } }
.rc-locked { display: flex; align-items: center; gap: .5rem; justify-content: center; padding: .7rem; border-radius: 14px; background: var(--green-soft); color: var(--green); font-weight: 800; }

/* ---------- Calendar ---------- */
.cal { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.cal th { font-size: .72rem; color: var(--muted); font-weight: 800; text-transform: uppercase; padding: .3rem 0; }
.cal td { vertical-align: top; height: 84px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: .3rem; font-size: .75rem; }
.cal td.other { opacity: .45; }
.cal td.today { border-color: var(--yellow); box-shadow: inset 0 0 0 1.5px var(--yellow); }
.cal .d { font-weight: 800; font-size: .8rem; color: var(--text-2); }
.cal .ev { display: block; margin-top: .2rem; padding: .1rem .3rem; border-radius: 6px; font-weight: 700; font-size: .68rem; color: #fff; background: var(--ev, var(--navy)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev:hover { text-decoration: none; filter: brightness(1.1); }
.cal .ev.cancelled { background: var(--red); text-decoration: line-through; }
.cal .ev.changed { background: var(--blue); }
@media (max-width: 640px) { .cal td { height: 58px; padding: .2rem; } .cal .ev { font-size: 0; height: 7px; padding: 0; } }
.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.date-badge { width: 54px; flex: none; text-align: center; border-radius: 12px; background: var(--cream); border: 1px solid var(--line); padding: .3rem 0; }
.date-badge .m { font-size: .66rem; font-weight: 800; color: var(--orange); text-transform: uppercase; letter-spacing: .08em; }
.date-badge .dd { font-family: var(--font); font-weight: 800; font-size: 1.3rem; line-height: 1; }

/* ---------- Bars / charts ---------- */
.bars { display: grid; gap: .5rem; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 140px) 1fr 52px; gap: .6rem; align-items: center; font-size: .88rem; }
.bar-track { height: 12px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--orange), var(--yellow)); }
.chart-svg { width: 100%; height: auto; overflow: visible; }
.chart-svg .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font-text); }

/* ---------- Auth screens ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; background: var(--cream); }
.auth-art { height: 38vh; min-height: 220px; background: url("../img/login.webp") center 70% / cover no-repeat, #f4c27a; position: relative; }
.auth-art::after { content: ""; position: absolute; inset: auto 0 0 0; height: 60px; background: linear-gradient(to bottom, rgba(255,248,236,0), var(--cream)); }
.auth-card { position: relative; width: min(100%, 440px); margin: -48px auto 0; padding: 0 1rem 2rem; }
.auth-card .card { padding: 1.5rem 1.3rem; border-radius: 24px; box-shadow: var(--shadow-lg); border: 0; }
.auth-logo { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.1rem; }
.auth-logo img { width: 52px; height: 52px; border-radius: 14px; box-shadow: var(--shadow); }
.auth-logo b { font-family: var(--font); font-size: 1.3rem; display: block; color: var(--navy); line-height: 1.1; }
.auth-logo span { color: var(--muted); font-size: .85rem; }
:root[data-theme="dark"] .auth-logo b { color: var(--yellow); }
@media (min-width: 960px) {
  .auth { grid-template-rows: none; grid-template-columns: 1.25fr 1fr; }
  .auth-art { height: auto; min-height: 100vh; background-position: center; }
  .auth-art::after { inset: 0 0 0 auto; width: 80px; height: auto; background: linear-gradient(to right, rgba(255,248,236,0), var(--cream)); }
  .auth-card { margin: auto; align-self: center; }
}

/* Onboarding steps */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 1rem; }
.steps li { counter-increment: s; position: relative; padding: .2rem 0 .9rem 2.6rem; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--yellow); color: var(--navy); font-weight: 800; display: grid; place-items: center; }

/* Maintenance / errors */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; text-align: center; background: var(--cream); }
.center-screen img { width: 220px; margin: 0 auto 1rem; border-radius: 32px; }

/* Utilities */
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; } .text-right { text-align: right; }
.fw-800 { font-weight: 800; } .c-green { color: var(--green); } .c-red { color: var(--red); } .c-orange { color: var(--orange); }
.divider-label { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; margin: 1.3rem 0 .6rem; }
.divider-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; }
.thumbs a { display: block; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.file-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border-radius: 10px; background: var(--line-2); color: var(--text); font-weight: 600; font-size: .86rem; }

@media print {
  .sidebar, .bottom-nav, .topbar, .no-print, .toasts, .net-status { display: none !important; }
  body { background: #fff; color: #000; }
  .shell { display: block; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .page { max-width: none; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
