/* ============================================================
   Alembic — refreshed UI (visual only; same classes & variables)
   Typography: Inter (professional)
   ============================================================ */
:root{
  --bg:#eef2fb;
  --surface:#ffffff;
  --surface-1:#f1f5fb;      /* subtle inner tint / hover */
  --surface-2:#e6ecf7;      /* deeper tint */
  --ink:#0f172a;
  --text-primary:#0f172a;   /* alias used inline */
  --muted:#5b6b86;
  --text-secondary:#5b6b86; /* alias used inline */
  --line:#e3e9f2;
  --border:#e3e9f2;         /* alias used inline */
  --violet:#2563eb;         /* primary (bolder brand blue) — name kept for compatibility */
  --violet-2:#1d4fd8;
  --text-accent:#2563eb;    /* alias used inline */
  --cyan:#0e7490;
  --mint:#059669;
  --coral:#dc2626;
  --amber:#b45309;
  --accent:#10b981;         /* emerald accent (echoes the Alembic green arrow) */
  --grad:linear-gradient(125deg,#2563eb 0%,#4f46e5 100%);
  --grad-accent:linear-gradient(125deg,#059669 0%,#10b981 100%);
  --shadow:0 10px 30px rgba(37,55,110,.10);
  --shadow-sm:0 1px 3px rgba(30,41,59,.07);
  --shadow-hover:0 14px 34px rgba(37,99,235,.18);
  --r:18px;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;font-family:"Inter",system-ui,-apple-system,"Segoe UI",sans-serif;
  background:var(--bg);color:var(--ink);line-height:1.55;
  min-height:100vh;-webkit-font-smoothing:antialiased;
}
h1,h2,h3,.brand-text{font-family:"Inter",system-ui,sans-serif;font-weight:600;letter-spacing:-.01em;color:var(--ink)}
a{text-decoration:none;color:inherit}
::selection{background:rgba(37,87,167,.16)}

/* ---------- Topbar ---------- */
.topbar{position:sticky;top:0;z-index:50;background:rgba(255,255,255,.85);
  backdrop-filter:saturate(180%) blur(14px);border-bottom:1px solid var(--line);
  box-shadow:0 1px 0 rgba(37,42,92,.02),0 6px 20px rgba(37,42,92,.03)}
.topbar-inner{max-width:1180px;margin:0 auto;padding:.6rem 1.2rem;
  display:flex;align-items:center;gap:1rem}
.brand{display:flex;align-items:center;gap:.55rem;font-size:1.35rem;flex:0 0 auto}
.brand img{transition:transform .2s}
.brand:hover img{transform:scale(1.03)}
.brand-mark{display:grid;place-items:center;width:38px;height:38px;border-radius:11px;
  background:var(--grad);color:#fff;font-family:"Inter";font-weight:700;font-size:1.2rem;
  box-shadow:0 6px 16px rgba(37,87,167,.4)}
.brand-text{background:var(--grad);-webkit-background-clip:text;background-clip:text;color:transparent}
.nav-links{display:flex;align-items:center;flex-wrap:wrap;gap:.15rem;margin-left:.4rem}
.nav-links>a,.nav-group-label{padding:.5rem .8rem;border-radius:10px;color:var(--muted);
  font-weight:500;font-size:.92rem;transition:.16s;cursor:pointer;white-space:nowrap}
.nav-links>a:hover,.nav-group-label:hover{color:var(--violet);background:rgba(37,87,167,.09)}
.nav-group{position:relative}
/* Invisible bridge across the 6px gap. Without it the cursor leaves the label,
   lands on nothing, and the menu shuts before you reach it — which is why the
   menu used to demand a precise click. */
.nav-group::after{content:"";position:absolute;left:0;right:0;top:100%;height:10px;display:none}
.nav-group:hover::after,.nav-group:focus-within::after{display:block}
.nav-dropdown{position:absolute;top:calc(100% + 6px);left:0;min-width:206px;background:#fff;max-height:calc(100vh - 90px);overflow-y:auto;
  column-count:1;column-gap:.4rem;
  border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);
  padding:.4rem;display:none;animation:pop .14s ease;z-index:60}
.nav-dropdown.nav-dropdown-wide{column-count:2;min-width:420px}
@keyframes pop{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
/* Opens on hover, and on keyboard focus so it's reachable without a mouse. */
.nav-group:hover .nav-dropdown,.nav-group:focus-within .nav-dropdown{display:block}
/* Touch has no hover — JS adds .open on tap. */
.nav-group.open .nav-dropdown{display:block}
.nav-dropdown a{display:block;padding:.5rem .7rem;border-radius:9px;color:var(--ink);font-size:.9rem;transition:.12s;break-inside:avoid}
.nav-dropdown a:hover{background:var(--surface-1);color:var(--violet);padding-left:.95rem}
.nav-account{margin-left:auto;position:relative;flex:0 0 auto}
.account-btn{display:flex;align-items:center;gap:.5rem;padding:.28rem .7rem .28rem .32rem;border-radius:999px;
  background:var(--surface-1);border:1px solid var(--line);color:var(--ink);font-weight:500;font-size:.9rem;cursor:pointer;transition:.16s}
.account-btn:hover{background:#fff;box-shadow:var(--shadow-sm)}
.avatar{display:grid;place-items:center;width:31px;height:31px;border-radius:50%;flex:0 0 auto;
  background:var(--grad);color:#fff;font-family:"Inter";font-weight:600;font-size:.78rem;
  box-shadow:0 4px 12px rgba(37,87,167,.35)}
.account-name{color:var(--muted)}
.account-dropdown{position:absolute;top:calc(100% + 8px);right:0;min-width:222px;background:#fff;
  border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);padding:.4rem;display:none;z-index:60;animation:pop .14s ease}
.nav-account.open .account-dropdown{display:block}
/* Hover-open only on real hover devices — on touch, sticky :hover kept the menu
   open so a second tap couldn't close it. Touch now uses the .open toggle only. */
@media (hover:hover){ .nav-account:hover .account-dropdown{display:block} }
.account-head{padding:.6rem .75rem;border-bottom:1px solid var(--line);margin-bottom:.3rem}
.account-head-name{font-weight:600;color:var(--ink)}
.account-head-role{font-size:.8rem;color:var(--muted)}
.account-dropdown a{display:flex;align-items:center;gap:.55rem;padding:.55rem .75rem;border-radius:10px;color:var(--ink);font-size:.9rem;transition:.12s}
.account-dropdown a:hover{background:var(--surface-1);color:var(--violet)}
.account-dropdown a.danger{color:var(--coral)}
.account-dropdown a.danger:hover{background:rgba(192,57,43,.1);color:var(--coral)}
.nav-toggle{display:none;background:none;border:none;font-size:1.5rem;color:var(--violet);cursor:pointer}

/* ---------- Page ---------- */
.page{max-width:1180px;margin:0 auto;padding:1.7rem 1.2rem 3.5rem;animation:rise .25s ease}
@keyframes rise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.page-head h1{font-size:1.75rem;margin:.1rem 0 1.2rem}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  box-shadow:var(--shadow-sm);padding:1.35rem 1.5rem;margin-bottom:1.3rem;transition:box-shadow .2s}
.card:hover{box-shadow:var(--shadow)}
.card h2{font-size:1.15rem;margin:0 0 1rem;display:flex;align-items:center;gap:.5rem}
.section-row{display:grid;grid-template-columns:minmax(0,340px) minmax(0,1fr);gap:1.3rem;align-items:start}
.section-row>*{min-width:0}
@media(max-width:820px){.section-row{grid-template-columns:1fr}}

/* ---------- Forms ---------- */
label{display:block;font-size:.8rem;font-weight:600;color:#475569;margin:0 0 .4rem;letter-spacing:.005em}
.field{margin-bottom:.95rem;min-width:0}
input[type=text],input[type=password],input[type=number],input[type=date],input[type=month],select,textarea{
  width:100%;min-width:0;padding:.62rem .8rem;border:1px solid #cbd5e1;border-radius:9px;
  font-family:inherit;font-size:.94rem;background:#fff;color:var(--ink);transition:.16s}
input::placeholder,textarea::placeholder{color:#94a3b8}
input:hover,select:hover,textarea:hover{border-color:#94a3b8}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--violet);
  box-shadow:0 0 0 3px rgba(37,87,167,.14)}
.row2{display:grid;grid-template-columns:repeat(auto-fit,minmax(148px,1fr));gap:.8rem}
.row2>*{min-width:0}
.check{display:flex;align-items:center;gap:.5rem;font-size:.9rem;color:var(--ink)}
.check input{width:18px;height:18px;accent-color:var(--violet)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.45rem;border:none;cursor:pointer;
  font-family:inherit;font-weight:600;font-size:.92rem;padding:.6rem 1.25rem;border-radius:9px;
  background:var(--violet);color:#fff;box-shadow:0 1px 2px rgba(30,41,59,.12);transition:.16s;line-height:1.2}
.btn:hover{background:var(--violet-2);box-shadow:0 2px 8px rgba(37,87,167,.24)}
.btn:active{transform:translateY(0)}
.btn-ghost{background:#fff;color:var(--violet);border:1px solid #cbd5e1;box-shadow:none}
.btn-ghost:hover{border-color:var(--violet);background:rgba(37,87,167,.05);box-shadow:none}
.btn-sm{padding:.4rem .8rem;font-size:.82rem;border-radius:8px;box-shadow:none}
.btn-sm:hover{box-shadow:none}

/* ---------- Tables ---------- */
.tbl{width:100%;border-collapse:separate;border-spacing:0}
.tbl th{text-align:left;font-size:.72rem;text-transform:uppercase;letter-spacing:.6px;
  color:var(--muted);font-weight:600;padding:.6rem .75rem;border-bottom:1.5px solid var(--line);white-space:nowrap}
.tbl td{padding:.72rem .75rem;border-bottom:1px solid var(--line);font-size:.92rem;vertical-align:middle}
.tbl tbody tr{transition:background .12s}
.tbl tbody tr:hover td{background:var(--surface-1)}
.tbl tbody tr:last-child td{border-bottom:none}
.tbl tfoot th{border-bottom:none;border-top:1.5px solid var(--line);text-transform:none;font-size:.86rem;color:var(--ink)}
.muted{color:var(--muted);font-size:.85rem}

/* ---------- Status pills ---------- */
.pill{display:inline-block;padding:.24rem .72rem;border-radius:999px;font-size:.74rem;
  font-weight:600;letter-spacing:.2px}
.pill-on{background:rgba(19,184,134,.15);color:#0c9b68}
.pill-off{background:rgba(120,128,160,.15);color:#6b7191}
.pill-common{background:rgba(37,87,167,.15);color:#2557a7}
.pill-absent{background:rgba(192,57,43,.15);color:#b91c1c}

/* ---------- Flash ---------- */
.flash{padding:.8rem 1.15rem;border-radius:13px;margin-bottom:1.1rem;font-weight:500;font-size:.92rem;
  display:flex;align-items:center;gap:.5rem;animation:rise .25s ease}
.flash-ok{background:rgba(19,184,134,.12);color:#0c8f61;border:1px solid rgba(19,184,134,.28)}
.flash-error{background:rgba(192,57,43,.12);color:#c0392b;border:1px solid rgba(192,57,43,.28)}
/* Icons so a save reads instantly as a tick, an error as a warning. */
.flash-ok::before{content:"✓";display:inline-flex;align-items:center;justify-content:center;width:1.4rem;height:1.4rem;border-radius:50%;background:#0c8f61;color:#fff;font-size:.85rem;font-weight:800;flex:0 0 auto}
.flash-error::before{content:"!";display:inline-flex;align-items:center;justify-content:center;width:1.4rem;height:1.4rem;border-radius:50%;background:#c0392b;color:#fff;font-size:.95rem;font-weight:800;flex:0 0 auto}
/* A success flash is lifted to a floating toast (see footer.php) so it's seen even after
   saving at the BOTTOM of a long page (attendance, marks, timetable). Auto-hides. */
.flash-ok.is-toast{position:fixed;top:72px;left:50%;transform:translateX(-50%);z-index:1150;margin:0;
  min-width:min(320px,92vw);max-width:92vw;padding:.95rem 1.35rem;font-size:1rem;font-weight:600;
  background:#ecfdf5;border:1px solid #6ee7b7;color:#0c8f61;border-radius:13px;
  box-shadow:0 12px 34px rgba(12,143,97,.30);cursor:pointer;transition:opacity .4s ease, transform .4s ease}
.flash-ok.is-toast.fade{opacity:0;transform:translate(-50%,-14px)}

/* ---------- Dashboard tiles ---------- */
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:1.1rem}
.tile{background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:1.3rem;
  box-shadow:var(--shadow-sm);transition:.2s;position:relative;overflow:hidden;display:block}
.tile:hover{transform:translateY(-2px);box-shadow:var(--shadow-hover);border-color:#cbd5e1}
.tile::before{content:"";position:absolute;inset:0 0 auto 0;height:3px;background:var(--violet);opacity:0;transition:.2s}
.tile:hover::before{opacity:1}
.tile-ico{width:44px;height:44px;border-radius:10px;display:grid;place-items:center;
  font-size:1.4rem;color:var(--violet);background:rgba(37,87,167,.09);margin:.2rem 0 .85rem}
.tile h3{font-size:1.05rem;margin:0 0 .25rem}
.tile p{margin:0;color:var(--muted);font-size:.85rem}

/* ---------- Login ---------- */
.auth-wrap{min-height:100vh;display:grid;place-items:center;padding:1.2rem}
.auth-card{width:100%;max-width:410px;background:#fff;border-radius:24px;padding:2.4rem 2.1rem;
  box-shadow:var(--shadow);border:1px solid var(--line)}
.auth-brand{display:flex;align-items:center;gap:.6rem;justify-content:center;margin-bottom:.4rem}
.auth-brand .brand-mark{width:46px;height:46px;font-size:1.5rem}
.auth-sub{text-align:center;color:var(--muted);font-size:.88rem;margin:0 0 1.7rem}
.auth-card .btn{width:100%;justify-content:center;margin-top:.5rem;padding:.7rem}

.site-foot{text-align:center;color:var(--muted);font-size:.8rem;padding:1.6rem}
.toolbar{display:flex;gap:.6rem;align-items:center;flex-wrap:wrap;margin-bottom:1rem}
.toolbar input[type=text]{max-width:280px}
.spacer{flex:1}

@media(max-width:760px){
  /* Account (avatar) sits at the FAR right so its right:0 dropdown opens flush to
     the screen edge instead of off the left. Toggle comes just before it. */
  .nav-toggle{display:block;order:2;margin-left:auto}
  .nav-account{order:3;margin-left:.4rem}
  .account-name{display:none}
  .nav-links{display:none;flex-direction:column;align-items:stretch;width:100%;order:4;gap:.2rem;margin:.5rem 0 0}
  .nav-links.open{display:flex}
  .nav-links>a,.nav-group-label{padding:.7rem .8rem}
  .nav-dropdown{position:static;display:block;box-shadow:none;border:none;padding-left:1rem;animation:none;column-count:1 !important;max-height:none}
  .nav-group:hover .nav-dropdown{display:block}
  .page-head h1{font-size:1.5rem}
  .card{padding:1.15rem 1.15rem}
}

/* ---- Print-friendly reports (report card, any report) ---- */
.no-print{}
@media print {
  .topbar, .nav-links, .nav-toggle, .site-foot, .no-print, .toolbar { display: none !important; }
  body { background: #fff !important; }
  main.page { margin: 0 !important; padding: 0 !important; max-width: 100% !important; }
  .card { box-shadow: none !important; border: 1px solid #bbb !important; break-inside: avoid; margin: 0 0 10px !important; }
  .report-card h2, .report-card h3 { color: #000 !important; }
  .pill { border: 1px solid #999; }
}

/* ---- Mobile: stack toolbar forms full-width with big touch targets ---- */
@media (max-width: 600px) {
  .toolbar { flex-direction: column; align-items: stretch; gap: .55rem; }
  .toolbar > select, .toolbar > input, .toolbar > .field, .toolbar > button, .toolbar > a.btn,
  .toolbar .field select, .toolbar .field input {
    width: 100% !important; max-width: 100% !important; min-width: 0 !important; box-sizing: border-box;
  }
  .toolbar > select, .toolbar > input,
  .toolbar .field select, .toolbar .field input { height: 46px; font-size: 1rem; }
  .toolbar .spacer { display: none; }
}

/* ---------- Simple multi-select filter row (Coordinators/Leaders/Schools) ---------- */
.hfm-multi{display:flex;gap:.9rem;align-items:flex-end;flex-wrap:wrap;margin-bottom:.7rem}
/* People-filter cascade flattens into its parent filter row so the shared
   "Apply filter" button (order:100) can sit after every report's own fields. */
.rsf-cascade{display:contents}
.hfm-multi-col{flex:1 1 0;min-width:160px;display:flex;flex-direction:column;gap:.3rem}
.hfm-multi-col label{font-size:.8rem;font-weight:600;color:var(--muted)}
.hfm-multi-col select{width:100%;border:1px solid var(--line);border-radius:10px;padding:.45rem 2.2rem .45rem .7rem;font-size:.88rem;appearance:none;-webkit-appearance:none;-moz-appearance:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:#fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%235b6b86' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right .6rem center}
.hfm-multi-col select option{padding:.3rem .4rem}
.hfm-multi-clear{align-self:flex-end;padding-bottom:.5rem}
/* ---------- List pagination ---------- */
.pager{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.5rem;margin-top:.9rem}
.pager-info{font-size:.82rem;color:var(--muted)}
.pager-btns{display:flex;gap:.3rem;flex-wrap:wrap;align-items:center}
.pager-gap{color:var(--muted);padding:0 .2rem}
/* Action-button cells never overflow — buttons wrap instead of forcing a scroll */
.tbl td.acts{display:flex;gap:.4rem;flex-wrap:wrap;white-space:nowrap}
.hfm-multi-clear a{font-size:.85rem;color:var(--muted);text-decoration:none}
.hfm-multi-clear a:hover{color:var(--violet);text-decoration:underline}
@media(max-width:700px){.hfm-multi-col{flex:1 1 100%}}

/* ---------- Phone layout ----------
   Below 820px the top bar can't hold a horizontal menu, so it collapses behind a
   button and every group stacks. Entry forms go single-column with full-width
   fields and thumb-sized controls. */
.nav-toggle{display:none;background:none;border:1px solid var(--line);border-radius:10px;
  padding:.4rem .6rem;font-size:1.2rem;line-height:1;color:var(--ink);cursor:pointer}
@media(max-width:820px){
  .nav-toggle{display:inline-flex;align-items:center}
  .nav-links{display:none;width:100%;flex-direction:column;align-items:stretch;gap:.1rem;margin:.5rem 0 0}
  .nav-links.open{display:flex}
  .nav-links>a,.nav-group-label{padding:.7rem .8rem;font-size:1rem}
  /* Stacked, not floating — a phone has no room for an overlay menu. */
  .nav-group{position:static}
  .nav-dropdown{position:static;display:none;box-shadow:none;border:none;
    border-left:2px solid var(--line);border-radius:0;margin:0 0 .3rem .8rem;padding:.1rem 0 .1rem .4rem;
    column-count:1!important;min-width:0!important;max-height:none;animation:none}
  .nav-group.open .nav-dropdown{display:block}
  .nav-group:hover .nav-dropdown{display:none}   /* hover is meaningless here */
  .nav-group.open:hover .nav-dropdown{display:block}
  .nav-dropdown a{padding:.65rem .7rem;font-size:.95rem}
  .nav-account{margin-left:0}
}

/* ---------- Entry forms on a phone ---------- */
@media(max-width:640px){
  .field input,.field select,.field textarea,
  .toolbar input,.toolbar select,
  .hfm-multi-col select,.hfm-multi-col input{width:100%;min-height:44px;font-size:16px}
  .toolbar{flex-direction:column;align-items:stretch;gap:.5rem}
  .toolbar .btn,.toolbar button{width:100%;min-height:44px}
  /* Column flex needs align-items:stretch, else the base align-items:flex-end
     leaves each field hugging its content and shoved to the right on a phone. */
  .hfm-multi{flex-direction:column;gap:.6rem;align-items:stretch}
  .hfm-multi-col{flex:1 1 auto;min-width:0;width:100%}
  .btn{min-height:44px;padding:.6rem 1rem}
  .card{padding:.9rem}
  /* Wide tables can't shrink honestly — let them scroll rather than crush. */
  .tbl-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
}

/* Catch-all for phones: a few screens (approvals, role access, grade bands) build
   their forms without the shared .field/.toolbar classes, so they'd miss the rules
   above. Target the controls themselves rather than editing each page. */
@media(max-width:640px){
  .card form input[type=text], .card form input[type=date], .card form input[type=month],
  .card form input[type=number], .card form input[type=password], .card form select,
  .card form textarea{
    width:100%; min-height:44px; font-size:16px;   /* 16px stops iOS zooming on focus */
  }
  .card form button, .card form .btn{min-height:44px}
  .card table{display:block; overflow-x:auto; -webkit-overflow-scrolling:touch}
}

/* ============================================================
   v2 — Bolder modern redesign (2026-07-18)
   Layered on top: keeps every existing class, refreshes the look,
   and makes teacher/trainer entry forms big, clean and thumb-easy.
   App-style bottom tab bar for phones lives here too.
   ============================================================ */

/* ----- Typography & base ----- */
body{font-size:15.5px;color:var(--ink)}
h1,h2,h3{letter-spacing:-.02em}
.page-head h1{font-size:1.9rem;font-weight:700;margin:.1rem 0 1.25rem}
@media(max-width:820px){ .page-head h1{font-size:1.5rem;margin:.2rem 0 1rem} }

/* ----- Cards: softer, deeper, roomier ----- */
.card{border-radius:20px;border:1px solid var(--line);box-shadow:0 2px 10px rgba(37,55,110,.05);
  padding:1.5rem 1.6rem;margin-bottom:1.15rem}
.card:hover{box-shadow:0 10px 30px rgba(37,55,110,.09)}
.card h2{font-size:1.15rem;font-weight:700;margin:0 0 1.1rem;color:var(--ink)}

/* ----- Form controls: larger, rounder, clearer ----- */
label{font-size:.82rem;font-weight:600;color:#3f4d63;margin:0 0 .45rem}
input[type=text],input[type=password],input[type=number],input[type=date],input[type=month],
input[type=time],input[type=email],input[type=tel],select,textarea{
  border:1.5px solid #d3dbe8;border-radius:13px;padding:.72rem .9rem;font-size:.97rem;
  background:#fff;color:var(--ink);transition:border-color .16s, box-shadow .16s}
input:hover,select:hover,textarea:hover{border-color:#a9b6cc}
input:focus,select:focus,textarea:focus{border-color:var(--violet);
  box-shadow:0 0 0 4px rgba(37,99,235,.16)}
select{appearance:none;-webkit-appearance:none;background-image:
  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235b6b86' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat:no-repeat;background-position:right .7rem center;padding-right:2.4rem}
/* Disabled controls (e.g. the Standard/Standard-Club either-or, once one is chosen)
   must READ as locked: greyed fill, muted text, faded arrow, not-allowed cursor. */
select:disabled,input:disabled,textarea:disabled{
  background-color:#e3e8f0;color:#7c8aa0;border-color:#cbd4e1;
  cursor:not-allowed;opacity:1;-webkit-text-fill-color:#7c8aa0}
select:disabled{background-image:
  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238893a4' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat:no-repeat;background-position:right .7rem center}
.hfm-multi-col select:disabled{background-image:
  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238893a4' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat:no-repeat;background-position:right .6rem center}
.check input{width:20px;height:20px;accent-color:var(--violet)}
.check{padding:.15rem 0}

/* ----- Buttons: bold, gradient primary ----- */
.btn{border-radius:13px;font-weight:700;font-size:.95rem;padding:.7rem 1.4rem;
  background:var(--grad);box-shadow:0 4px 14px rgba(37,99,235,.28);letter-spacing:.01em}
.btn:hover{background:var(--grad);filter:brightness(1.05);box-shadow:0 6px 20px rgba(37,99,235,.34)}
.btn:active{transform:translateY(1px)}
.btn-ghost{background:#fff;color:var(--violet);border:1.5px solid #cdd7e6;box-shadow:none}
.btn-ghost:hover{background:rgba(37,99,235,.06);border-color:var(--violet);filter:none;box-shadow:none}
.btn-sm{padding:.45rem .9rem;font-size:.84rem;border-radius:10px;box-shadow:none}

/* ----- Pills & tables: crisper ----- */
.pill{padding:.28rem .8rem;font-weight:700;font-size:.72rem}
.tbl th{font-size:.68rem;letter-spacing:.7px}
.tbl td{font-size:.93rem;padding:.8rem .75rem}

/* ----- Toolbar segmented toggle (timetable Regular/Sheri) ----- */
.tt-toggle{border-radius:14px;border:1.5px solid var(--line);background:#fff;padding:3px}
.tt-toggle label{border-radius:11px;font-weight:600}
.tt-toggle label:has(input:checked){background:var(--grad);color:#fff}

/* ----- Topbar: slimmer, cleaner on phones ----- */
@media(max-width:820px){
  /* flex-wrap lets the full-width .nav-links (order:4) drop to its OWN row below
     the logo/toggle/account instead of being crammed onto the same line — that
     crammed layout was what pushed the opened menu off the right edge. */
  .topbar-inner{padding:.55rem .9rem;gap:.6rem;flex-wrap:wrap}
  .brand img{height:30px !important}
  .nav-toggle{font-size:1.6rem;padding:.15rem .35rem}
  /* Open menu becomes a clean full-width sheet with big rows */
  .nav-links{background:#fff;border:1px solid var(--line);border-radius:16px;
    box-shadow:var(--shadow);padding:.5rem;margin-top:.6rem;
    max-width:100%;box-sizing:border-box;overflow-x:hidden}
  .nav-links>a,.nav-group-label{font-size:1rem;padding:.85rem 1rem;border-radius:12px}
  .nav-links>a:active,.nav-group-label:active{background:rgba(37,99,235,.08)}
  /* Never let the account/logout panel exceed the screen width on a phone. */
  .account-dropdown{right:0;left:auto;max-width:calc(100vw - 1.4rem)}
}

/* ============================================================
   App-style BOTTOM TAB BAR (phones only)
   ============================================================ */
.bottom-nav{display:none}
.bottom-nav-spacer{display:none}
@media(max-width:820px){
  .bottom-nav{
    display:flex;position:fixed;left:0;right:0;bottom:0;z-index:80;
    background:rgba(255,255,255,.96);backdrop-filter:saturate(180%) blur(12px);
    border-top:1px solid var(--line);box-shadow:0 -6px 24px rgba(37,55,110,.10);
    padding:.35rem .25rem calc(.35rem + env(safe-area-inset-bottom,0px));
  }
  .bottom-nav a{
    flex:1 1 0;display:flex;flex-direction:column;align-items:center;justify-content:center;
    gap:.15rem;padding:.35rem .1rem;color:var(--muted);font-size:.68rem;font-weight:600;
    border-radius:14px;min-height:52px;transition:color .15s,background .15s}
  .bottom-nav a i{font-size:1.5rem;line-height:1}
  .bottom-nav a.active{color:var(--violet)}
  .bottom-nav a.active i{transform:translateY(-1px)}
  .bottom-nav a:active{background:rgba(37,99,235,.08)}
  .bottom-nav a .bn-badge{position:absolute;top:.15rem;transform:translateX(1.1rem);
    min-width:16px;height:16px;line-height:16px;padding:0 4px;border-radius:8px;
    background:#e5484d;color:#fff;font-size:10px;font-weight:700;text-align:center}
  .bottom-nav a{position:relative}
  /* room so the fixed bar never hides the last field / save button */
  body{padding-bottom:calc(64px + env(safe-area-inset-bottom,0px))}
  .site-foot{margin-bottom:calc(60px + env(safe-area-inset-bottom,0px))}
}

/* ----- Extra mobile polish for ENTRY FORMS (the priority) ----- */
@media(max-width:640px){
  input[type=text],input[type=password],input[type=number],input[type=date],input[type=month],
  input[type=time],input[type=email],input[type=tel],select,textarea{
    min-height:52px;font-size:16px;border-radius:14px}
  textarea{min-height:96px}
  label{font-size:.9rem;margin-bottom:.35rem}
  .btn{width:100%;min-height:52px;font-size:1.02rem;border-radius:14px}
  .btn-sm{width:auto;min-height:40px}                 /* keep small inline actions small */
  .card{padding:1.15rem 1.05rem;border-radius:18px}
  .card h2{font-size:1.08rem}
  .toolbar{gap:.6rem}
}

/* ----- v3 2026-07: wide report tables scroll on tablets & large phones,
        two-up rows collapse to one column on phones (no functionality change) ----- */
@media(max-width:820px){
  /* any table inside a card scrolls sideways instead of stretching the page */
  .card table{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
  .tbl-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
  /* form-beside-list and any two-up report grid collapse to a single column.
     !important also neutralises inline grid-template-columns used on a few reports. */
  .section-row{grid-template-columns:1fr !important}
}
@media(max-width:560px){
  .row2{grid-template-columns:1fr !important}          /* field pairs stack on phones */
  .hfm-multi-col{min-width:0}
}
