/* Reset, typography and the app frame (header, content column, bottom navigation). */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
html.lg { font-size: 17.5px; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font-family: var(--body); line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: var(--brand); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--mari); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* boot + fatal screens */
.boot { min-height: 100dvh; display: grid; place-content: center; gap: .8rem; text-align: center; color: var(--ink-2); padding: 2rem; }
.boot .spin { margin: 0 auto; }

/* app frame */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .7rem;
  padding: calc(.6rem + env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) .7rem max(1rem, env(safe-area-inset-left, 0px));
  background: var(--bg);
}
.top-t { flex: 1; min-width: 0; }
.top-t small { display: block; color: var(--ink-2); font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top h1 { font-size: 1.45rem; }
.main {
  flex: 1; width: 100%; max-width: 46rem; margin: 0 auto;
  padding: .3rem max(1rem, env(safe-area-inset-right, 0px)) calc(6.5rem + env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 1rem;
}
.main.auth { padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px)); }
.bnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: .2rem;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: .4rem max(.4rem, env(safe-area-inset-right, 0px)) calc(.5rem + env(safe-area-inset-bottom, 0px)) max(.4rem, env(safe-area-inset-left, 0px));
}
.bnav a {
  flex: 1; max-width: 7.5rem; min-width: 0; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  font-size: .75rem; font-weight: 600; color: var(--ink-2); padding: .2rem 0; text-align: center;
}
.bnav .pb { padding: .25rem 1.1rem; border-radius: 999px; display: grid; place-items: center; }
.bnav a[aria-current="page"] { color: var(--brand); }
.bnav a[aria-current="page"] .pb { background: var(--brand-soft); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Computers (the web dashboard): admins get a sidebar with every section and wider pages. */
.side { display: none; }
@media (min-width: 1024px) {
  .app:has(.side) { padding-left: 15.5rem; }
  .app:has(.side) .bnav { display: none; }
  .app:has(.side) .main { max-width: 64rem; padding-bottom: 3rem; }
  .app:has(.side) .top { max-width: 64rem; width: 100%; margin: 0 auto; }
  .side {
    display: flex; flex-direction: column; gap: .1rem;
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 25; width: 15.5rem; overflow-y: auto;
    padding: 1.1rem .75rem 1.5rem; background: var(--surface); border-right: 1px solid var(--line);
  }
  .side-school { font-family: var(--display); font-weight: 700; font-size: 1.05rem; color: var(--ink); padding: 0 .6rem .6rem; line-height: 1.25; }
  .side-h { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); padding: .9rem .6rem .3rem; }
  .side a {
    display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 10px;
    color: var(--ink-2); font-weight: 600; font-size: .92rem; text-decoration: none;
  }
  .side a svg { width: 1.15rem; height: 1.15rem; flex: none; }
  .side a:hover { background: var(--surface-2); color: var(--ink); }
  .side a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
}
