/* Layout shell shared by the app screens and the admin: fixed menu on the left (desktop), bottom bar
   (phone). Two modes: daily work (green) and setup/admin (slate blue). Plain CSS so it works on both
   without Tailwind. Selectors start with .sb-side / .sb-bottom so they beat the admin's `a:link` colours. */
:root { --sb-width: 15.5rem; }

.sb-side {
  --bg: #3A5C4B; --active: #4B7260; --hover: #46695A; --line: #547A68; --muted: #BFD3C7; --text: #E3EDE7;
  position: fixed; inset: 0 auto 0 0; width: var(--sb-width); z-index: 40; overflow: hidden;
  display: flex; flex-direction: column; padding: 22px 14px 14px; box-sizing: border-box;
  background: var(--bg); color: var(--text); font-family: "Hanken Grotesk", system-ui, sans-serif; font-size: 15px;
}
.sb-side.is-setup { --bg: #3B4A66; --active: #56668A; --hover: #4A5A7C; --line: #5C6B8E; --muted: #C3CCE0; --text: #EEF1F7; }
.sb-bottom.is-setup { --bg: #3B4A66; --active: #56668A; }

.sb-side a.sb-brand { font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; font-size: 24px; color: #fff; padding: 0 12px 6px; text-decoration: none; }
.sb-side .sb-mode {
  align-self: flex-start; margin: 0 12px 18px; padding: 3px 10px; border-radius: 999px;
  background: var(--active); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .05em;
}
.sb-side .sb-list { display: flex; flex-direction: column; gap: 4px; }
.sb-side a.sb-link {
  display: flex; align-items: center; gap: 12px; box-sizing: border-box; padding: 11px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 15px;
}
.sb-side a.sb-link.sb-big { padding: 12px; font-size: 16px; font-weight: 500; }
.sb-side a.sb-link:hover { background: var(--hover); color: #fff; text-decoration: none; }
.sb-side a.sb-link[aria-current="page"] { background: var(--active); color: #fff; font-weight: 700; }
.sb-side .sb-label { flex: 1; }
.sb-side .sb-badge {
  min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 999px;
  background: #fff; color: #1F6B48; font-size: 13px; font-weight: 700;
}
.sb-side a.sb-back {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; margin-bottom: 14px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.35); color: #fff; text-decoration: none; font-weight: 600;
}
.sb-side a.sb-back:hover { background: var(--hover); color: #fff; text-decoration: none; }
.sb-side a.sb-setup {
  margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px;
  background: rgba(255,255,255,.12); color: var(--text); text-decoration: none;
}
.sb-side a.sb-setup:hover { background: var(--hover); color: #fff; text-decoration: none; }
.sb-side a.sb-setup[aria-current="page"] { background: var(--active); color: #fff; font-weight: 700; }
.sb-side .sb-user { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }
.sb-side a.sb-setup + .sb-user { margin-top: 10px; }
.sb-side .sb-user > .sb-name { display: block; padding: 4px 12px; color: var(--muted); }
.sb-side .sb-user a, .sb-side .sb-user button, .sb-sheet a, .sb-sheet button {
  display: block; box-sizing: border-box; width: 100%; margin: 0; padding: 8px 12px; border-radius: 8px;
  background: none; border: 0; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.sb-side .sb-user a:hover, .sb-side .sb-user button:hover, .sb-sheet a:hover, .sb-sheet button:hover { background: var(--hover); color: #fff; }
.sb-user form { margin: 0; }
.sb-bottom { display: none; }

/* content area gets out of the menu's way */
body.sb-has-menu { margin-left: var(--sb-width); }

@media (max-width: 767px) {
  .sb-side { display: none; }
  body.sb-has-menu { margin-left: 0; padding-bottom: 64px; }
  .sb-bottom {
    --bg: #3A5C4B; --hover: #46695A; --text: #E3EDE7;
    position: fixed; inset: auto 0 0 0; z-index: 40; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: #fff; border-top: 1px solid #E5E9E2; font-family: "Hanken Grotesk", system-ui, sans-serif;
  }
  .sb-bottom > a, .sb-bottom .sb-more > summary {
    min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 13px;
    color: #4A554F; text-decoration: none; cursor: pointer; list-style: none;
  }
  .sb-bottom .sb-more > summary::-webkit-details-marker { display: none; }
  .sb-bottom > a[aria-current="page"], .sb-bottom .sb-more > summary.is-active { color: #1F6B48; font-weight: 700; }
  .sb-bottom.is-setup > a, .sb-bottom.is-setup .sb-more > summary { color: #2F3A55; }
  .sb-bottom.is-setup .sb-more > summary.is-active { color: #3B4A66; }
  .sb-badge-small { background: #2A8057; color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; font-weight: 700; }
  .sb-more { position: static; }
  .sb-sheet {
    position: fixed; inset: auto 0 56px 0; max-height: 70vh; overflow-y: auto; background: var(--bg);
    padding: 8px 12px 12px; border-radius: 14px 14px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.18);
  }
  .sb-sheet a[aria-current="page"] { background: var(--active, #4B7260); color: #fff; font-weight: 600; }
  .sb-sheet .sb-user { display: flex; gap: 8px; margin-top: 8px; }
}

/* The hidden attribute must win over utility classes such as flex/grid, or the show/hide toggles do nothing. */
[hidden] { display: none !important; }

/* One-tap (HTMX) buttons: show that something is happening while the request runs. */
.htmx-request { opacity: .55; pointer-events: none; transition: opacity .15s; }

/* Confirmation dialog (feedback.js): the app's own look instead of the browser's confirm() box. */
dialog.sb-confirm {
  border: 1px solid #E5E9E2; border-radius: 16px; padding: 0; width: min(420px, calc(100vw - 32px));
  background: #FFFFFF; color: #26332B; box-shadow: 0 18px 50px rgba(30, 45, 38, .28); font-family: inherit;
}
dialog.sb-confirm::backdrop { background: rgba(38, 51, 43, .45); }
dialog.sb-confirm form { padding: 24px 24px 20px; display: flex; flex-direction: column; gap: 10px; }
dialog.sb-confirm h2 { margin: 0; font-family: "Bricolage Grotesque", system-ui, sans-serif; font-size: 22px; font-weight: 700; line-height: 1.2; }
dialog.sb-confirm p { margin: 0; font-size: 15px; line-height: 1.5; color: #4A554F; }
.sb-confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.sb-confirm-actions button { min-height: 44px; padding: 0 20px; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer; }
.sb-confirm-cancel { border: 1px solid #C9CFC6; background: #FFFFFF; color: #26332B; }
.sb-confirm-ok { border: 1px solid #2A8057; background: #2A8057; color: #FFFFFF; }
.sb-confirm-ok.is-danger { border-color: #B33A2A; background: #B33A2A; }
.sb-confirm-actions button:focus-visible { outline: 3px solid rgba(42, 128, 87, .45); outline-offset: 2px; }

/* Safari: hide the built-in triangle on every <summary> (list-style: none is not enough there). */
summary::-webkit-details-marker { display: none; }

/* iPhone Safari zooms the whole page into any text box whose text is smaller than 16px: keep them at 16px there. */
@supports (-webkit-touch-callout: none) {
  input, select, textarea { font-size: 16px !important; }
}

/* Student card: the name is a field in the header, Active is a switch, notes are a tile. */
.sb-name-input {
  box-sizing: border-box; width: 100%; max-width: 460px; min-height: 52px; padding: 0 14px; border-radius: 12px;
  border: 1px solid #C9CFC6; background: #fff; color: #26332B;
  font-family: "Bricolage Grotesque", sans-serif; font-size: 28px; font-weight: 700;
}
.sb-name-input:focus, .sb-notes-tile textarea:focus { outline: 2px solid rgba(42, 128, 87, .45); outline-offset: 1px; border-color: #2A8057; }
.sb-name-input[readonly] { background: #F8F9F6; }
.sb-switch {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px 0 8px; border-radius: 999px;
  border: 1px solid #B9D9C6; background: #E3F0E8; color: #1F6B48; font-weight: 700; cursor: pointer;
}
.sb-switch:has(input:not(:checked)) { background: #ECEEEA; border-color: #D3D8D0; color: #3E4943; }
.sb-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sb-switch-track { position: relative; width: 40px; height: 24px; border-radius: 999px; background: #2A8057; display: block; transition: background .15s; }
.sb-switch-track::after { content: ""; position: absolute; top: 3px; left: 19px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.sb-switch input:not(:checked) + .sb-switch-track { background: #9AA39D; }
.sb-switch input:not(:checked) + .sb-switch-track::after { left: 3px; }
.sb-switch input:focus-visible + .sb-switch-track { outline: 3px solid rgba(42, 128, 87, .45); outline-offset: 2px; }
.sb-switch.is-readonly { cursor: default; opacity: .8; }
.sb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; align-items: stretch; }
.sb-notes-tile {
  border-radius: 16px; padding: 20px; background: #FFFBEF; border: 1px solid #EFE2B8;
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.sb-notes-tile textarea {
  box-sizing: border-box; width: 100%; resize: vertical; padding: 8px 10px; border-radius: 8px; border: 1px solid #E5D9AE;
  background: #fff; color: #26332B; line-height: 1.4; font: inherit;
}
