/* PAP-Assist — shared look ("Frosted clinic"): colour tokens for light and dark, glass surfaces, the header, menus,
   dialogs and motion. Every page links this first; a page's own <style> adds only what is particular to it.
   Fonts are served from /fonts (SIL Open Font License 1.1): Bricolage Grotesque, Instrument Sans, JetBrains Mono. */

@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage-grotesque.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }

/* ── tokens: light by default, dark by system preference unless the viewer chose light, or when they chose dark ── */
:root {
  color-scheme: light;
  --bg: #eef2f5; --ink: #122030; --muted: #4a5a6b; --line: rgba(18,32,48,.12);
  --card: rgba(255,255,255,.66); --card-strong: rgba(255,255,255,.82); --menu: rgba(250,252,253,.94); --chip: rgba(255,255,255,.72); --inset: rgba(18,32,48,.045);
  --accent: #09695e; --accent-ink: #fff; --accent-soft: rgba(15,143,128,.12); --accent-line: rgba(15,143,128,.38);
  --avatar: #3e5bd8; --avatar-ink: #fff;
  --ok: #1d6b43; --bad: #a23b14; --bad-bg: #fbe9e2; --draft: #a23b14;
  --warn-bg: rgba(255,236,190,.75); --warn-ink: #6b4e00; --code-bg: rgba(15,143,128,.08); --bar: #0f8f80;
  --dispense: #16222e; --dispense-ink: #f1f5f8; --dispense-muted: #b7c4d0; --dispense-label: #7fe0d2;
  --glow-1: rgba(56,178,172,.30); --glow-2: rgba(99,122,255,.20);
  --shadow: 0 10px 30px rgba(18,32,48,.08); --shadow-lift: 0 24px 60px rgba(18,32,48,.12), inset 0 1px 0 rgba(255,255,255,.8);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --font-body: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease-out: cubic-bezier(.2,.8,.2,1);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #0a0f15; --ink: #e8eef4; --muted: #a9b6c5; --line: rgba(255,255,255,.12);
  --card: rgba(255,255,255,.055); --card-strong: rgba(255,255,255,.08); --menu: rgba(22,30,40,.94); --chip: rgba(255,255,255,.06); --inset: rgba(0,0,0,.25);
  --accent: #6fdccb; --accent-ink: #04221e; --accent-soft: rgba(95,212,196,.14); --accent-line: rgba(95,212,196,.45);
  --avatar: #9fb8ff; --avatar-ink: #0a1430;
  --ok: #6fd1a0; --bad: #ff9a70; --bad-bg: rgba(255,154,112,.12); --draft: #ff9a70;
  --warn-bg: rgba(241,217,138,.12); --warn-ink: #f1d98a; --code-bg: rgba(95,212,196,.10); --bar: #5fd4c4;
  --dispense: rgba(95,212,196,.12); --dispense-ink: #e8eef4; --dispense-muted: #b7c4d0; --dispense-label: #7fe0d2;
  --glow-1: rgba(56,178,172,.32); --glow-2: rgba(99,122,255,.28);
  --shadow: 0 10px 30px rgba(0,0,0,.35); --shadow-lift: 0 24px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
} }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f15; --ink: #e8eef4; --muted: #a9b6c5; --line: rgba(255,255,255,.12);
  --card: rgba(255,255,255,.055); --card-strong: rgba(255,255,255,.08); --menu: rgba(22,30,40,.94); --chip: rgba(255,255,255,.06); --inset: rgba(0,0,0,.25);
  --accent: #6fdccb; --accent-ink: #04221e; --accent-soft: rgba(95,212,196,.14); --accent-line: rgba(95,212,196,.45);
  --avatar: #9fb8ff; --avatar-ink: #0a1430;
  --ok: #6fd1a0; --bad: #ff9a70; --bad-bg: rgba(255,154,112,.12); --draft: #ff9a70;
  --warn-bg: rgba(241,217,138,.12); --warn-ink: #f1d98a; --code-bg: rgba(95,212,196,.10); --bar: #5fd4c4;
  --dispense: rgba(95,212,196,.12); --dispense-ink: #e8eef4; --dispense-muted: #b7c4d0; --dispense-label: #7fe0d2;
  --glow-1: rgba(56,178,172,.32); --glow-2: rgba(99,122,255,.28);
  --shadow: 0 10px 30px rgba(0,0,0,.35); --shadow-lift: 0 24px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

/* ── page ── */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); font: 16px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; position: relative; }
/* two soft glows behind the glass: they give it something to blur. Still, not animated, so older clinic PCs and remote
   desktops draw them once instead of repainting the whole page every frame */
body::before, body::after { content: ""; position: fixed; z-index: -1; border-radius: 50%; pointer-events: none; filter: blur(100px); opacity: .75; }
body::before { width: 720px; height: 720px; left: -220px; top: -300px; background: var(--glow-1); }
body::after { width: 640px; height: 640px; right: -200px; bottom: -300px; background: var(--glow-2); }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 10px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dispense .visually-hidden { -webkit-user-select: none; user-select: none; } /* copied answers carry the number once, from the big figure */
.display { font-family: var(--font-display); letter-spacing: -.03em; }
.mono, code, kbd { font-family: var(--font-mono); }

/* ── glass surfaces ── */
.card, .glass { background: var(--card); border: 1px solid var(--line); border-radius: 20px; backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%); box-shadow: var(--shadow-lift); }
.card:has(> table) { overflow-x: auto; } /* wide tables scroll inside their card on phones, not the whole page */

/* ── controls ── */
button { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--chip); color: var(--ink); font-weight: 600; cursor: pointer; transition: transform .15s var(--ease-out), background .2s, box-shadow .2s; }
.btn:hover { background: var(--card-strong); }
.btn:active { transform: scale(.97); }
.btn.primary, button.primary { background: var(--accent); color: var(--accent-ink); border: 0; box-shadow: 0 8px 22px var(--accent-soft); }
button.primary { min-height: 40px; padding: 0 18px; border-radius: 12px; font-weight: 600; cursor: pointer; }
.btn.primary:hover, button.primary:hover { filter: brightness(1.05); }
.btn.primary:focus-visible, button.primary:focus-visible, .chip:focus-visible, .chips button:focus-visible { box-shadow: var(--focus); }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--chip); color: var(--ink); font-size: .9rem; cursor: pointer; transition: border-color .2s, transform .15s var(--ease-out); }
.chip:hover { border-color: var(--accent-line); }
.chip:active { transform: scale(.97); }

/* ── the header ── */
.shell { position: sticky; top: 12px; z-index: 40; max-width: 1200px; margin: 12px auto 0; padding: 0 16px; }
.shell .shell-bar { display: flex; align-items: center; justify-content: flex-start; flex-wrap: nowrap; margin: 0; gap: 18px; padding: 8px 10px 8px 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; white-space: nowrap; }
.badge { font-size: .75rem; font-weight: 600; letter-spacing: .12em; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--accent-line); color: var(--accent); }
.nav { display: flex; gap: 2px; margin-left: 12px; }
.nav a, .nav button, .nav-admin > button { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px; color: var(--muted); text-decoration: none; background: none; border: 0; font-size: .95rem; cursor: pointer; transition: color .2s, background .2s; }
.nav a:hover, .nav button:hover, .nav-admin > button:hover { color: var(--ink); }
/* the Admin menu sits beside the links, not inside their row, so it can drop down at every width without being clipped */
.nav-admin { margin-left: -16px; }
.admin-in-user { display: none; } /* phones only: there the Admin links live in the account menu */
.nav a[aria-current="page"], .nav button.current, .nav-admin > button.current { color: var(--ink); background: var(--chip); font-weight: 600; }
.shell-spacer { flex: 1; }
.shell .icon-btn { padding: 0; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--chip); color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.shell .user-chip { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--chip); color: var(--ink); cursor: pointer; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--avatar); color: var(--avatar-ink); display: grid; place-items: center; font-weight: 700; font-size: .9rem; flex: none; }
.user-chip .who { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-chip .who b { font-size: .9rem; } .user-chip .who small { font-size: .875rem; color: var(--muted); }
.menu-wrap { position: relative; }

/* ── menus and dialogs: glass, scaling in from where they open ── */
.menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; min-width: 220px; width: max-content; max-width: min(340px, calc(100vw - 32px)); padding: 6px;
  border-radius: 14px; background: var(--menu); border: 1px solid var(--line); backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: var(--shadow-lift); transform-origin: top right; animation: pop .16s var(--ease-out); }
.menu.left { right: auto; left: 0; transform-origin: top left; }
.menu .head { font-size: .875rem; color: var(--muted); padding: 6px 10px 4px; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border-radius: 9px; background: none; border: 0; color: var(--ink); text-decoration: none; text-align: left; font-size: .92rem; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--inset); }
.menu a:focus-visible, .menu button:focus-visible { background: var(--inset); box-shadow: var(--focus); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu .seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; }
.menu .seg button { justify-content: center; min-height: 34px; font-size: .875rem; border: 1px solid transparent; }
.menu .seg button[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); font-weight: 600; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }
dialog { color: var(--ink); background: var(--menu); border: 1px solid var(--line); border-radius: 20px; backdrop-filter: blur(28px) saturate(150%); -webkit-backdrop-filter: blur(28px) saturate(150%); box-shadow: var(--shadow-lift); }
dialog[open] { animation: pop .2s var(--ease-out); }
dialog::backdrop { background: rgba(6,10,14,.45); backdrop-filter: blur(3px); }

/* ── motion for new content ── */
.enter { animation: enter .32s var(--ease-out) both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── narrow screens: the header folds its navigation into a row that scrolls ── */
/* between phone and wide layouts the name beside the avatar would push the chip out of the bar */
@media (max-width: 1000px) { .shell .user-chip .who { display: none; } .shell .nav { margin-left: 4px; } .shell .nav a, .shell .nav button, .shell .nav-admin > button { padding: 0 9px; } }
@media (max-width: 820px) {
  /* on a phone: brand, theme and account on one row, the sections on a second that scrolls sideways; the header
     scrolls away with the page rather than covering the question */
  .shell { position: relative; top: 0; margin-top: 8px; padding: 0 10px; }
  .shell .shell-bar { flex-wrap: wrap; gap: 8px; padding: 8px; }
  .brand-name { font-size: 1.02rem; } .brand-mark { width: 30px; height: 30px; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .nav a, .nav button { white-space: nowrap; flex: none; }
  .user-chip .who, .user-chip > svg { display: none; } .shell .user-chip { padding: 4px; min-height: 40px; }
  /* on phones the Admin links move into the account menu, so the header stays two rows and nothing scrolls sideways */
  .nav-admin { display: none; } .admin-in-user { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Resources tab */
.resbar { display:flex; gap:12px; flex-wrap:wrap; align-items:flex-start; margin-bottom:12px }
.resbar .grow { flex:1 1 260px }
.resbar .field { display:flex; flex-direction:column; gap:4px }
.countypick { display:flex; gap:8px }
.countypick input { width:14em; min-height:48px; font:inherit; color:inherit; background:var(--card-strong); border:1px solid var(--line); border-radius:14px; padding:0 14px }
.resbar input[type=search] { font:inherit; margin-bottom:0 }
.resbar input[type=search] { width:100% }
.tiles { display:grid; grid-template-columns:repeat(auto-fill, minmax(180px, 1fr)); gap:10px; margin-bottom:16px }
.tile { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:14px 16px; border-radius:12px; background:var(--card); border:1px solid var(--line); color:inherit; text-decoration:none; min-height:56px }
.tile:hover, .tile:focus-visible { border-color:var(--accent) }
/* Start here: one row per service, name and summary on the left, the action at the right edge; two columns from 760px,
   an odd last row spanning both. The summary is clamped to three lines (the full text is in its tooltip) */
.reshead { font-size:1.15rem; margin:22px 0 10px }
.starthere { display:grid; grid-template-columns:1fr; gap:10px; margin-bottom:8px }
@media (min-width: 760px) { .starthere { grid-template-columns:1fr 1fr } .starthere > .shrow:last-child:nth-child(odd) { grid-column:1 / -1 } }
.shrow { display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px; padding:14px 16px; border-radius:16px; background:var(--card); border:1px solid var(--line);
  backdrop-filter:blur(24px) saturate(150%); -webkit-backdrop-filter:blur(24px) saturate(150%) }
.shtext { flex:1 1 240px; min-width:0; display:flex; flex-direction:column; gap:2px }
.shtext .muted { font-size:.94rem; line-height:1.4; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3; line-clamp:3; overflow:hidden }
.shrow .btn { flex:none; min-height:40px; padding:0 16px; border-radius:12px; white-space:nowrap; text-decoration:none; color:var(--accent) }
.shrow .btn:hover { border-color:var(--accent-line) }
/* Needs: a fixed number of columns, so the grid fills evenly and lines up with Start here */
.tiles.needs { grid-template-columns:repeat(4, 1fr) }
@media (max-width: 900px) { .tiles.needs { grid-template-columns:repeat(3, 1fr) } }
.tiles.needs .tile { min-height:60px; border-radius:16px; backdrop-filter:blur(24px) saturate(150%); -webkit-backdrop-filter:blur(24px) saturate(150%) }
.tiles.needs .count { flex:none; min-width:2.2em; padding:1px 8px; border-radius:999px; background:var(--inset); color:var(--muted); font-size:.85rem; text-align:center; font-variant-numeric:tabular-nums }
.rcard h3 { margin:0 0 6px; font-size:1.05rem }
.rcard .svc { font-weight:400; color:var(--muted) }
.badges { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:6px }
.rbadge { font-size:.875rem; padding:2px 10px; border-radius:999px; border:1px solid var(--line) }
.rbadge.st-closed { border-color:var(--draft); color:var(--draft) }
.rbadge.st-unknown, .rbadge.st-waitlist, .rbadge.st-seasonal { border-style:dashed }
.rcard { margin:10px 0 }
.ractions { display:flex; flex-wrap:wrap; gap:8px; margin:8px 0 }
ul.plain { list-style:none; padding:0; margin:6px 0 }
.guidance { margin:4px 0 }
.resbar .flabel { font-weight:600; font-size:.95rem }
.chip[aria-pressed="true"] { background:var(--accent-soft); border-color:var(--accent-line) }
@media (max-width: 600px) { .tiles, .tiles.needs { grid-template-columns:1fr 1fr } .countypick input { width:100% } .resbar .field { flex:1 1 100% } }
@media (max-width: 480px) { .tiles.needs { grid-template-columns:1fr; gap:8px } .tiles.needs .tile { min-height:52px; padding:12px 16px } } /* a list on phones: two narrow columns wrapped names to four lines */
.resbar small { font-size:.875rem }

/* Updates */
.newdot { display:inline-block; width:8px; height:8px; margin-left:5px; border-radius:50%; background:var(--accent); vertical-align:super; }
.update, #updList > .card { margin:0 0 14px; padding:18px 22px; } /* same inner space as the other sections' cards */
.update h2 { margin:0 0 8px; font-size:1.2rem; }
.update .update-date { margin:0 0 4px; font-size:.875rem; }
.update-body p { margin:0 0 10px; }
.update-body ul { margin:0 0 10px; padding-left:20px; }
.update-body li { margin:4px 0; }
/* where the header has no room for Updates (small phones; beside the Admin menu at 821–900px), it sits in the name menu,
   with the "New" dot on the avatar */
.updates-in-user, .chipdot { display: none; }
.avatar { position: relative; }
.chipdot { position: absolute; top: -2px; right: -2px; margin: 0; border: 2px solid var(--bg); box-sizing: content-box; }
@media (max-width: 430px), (min-width: 821px) and (max-width: 900px) {
  .shell .nav-updates { display: none; }
  .updates-in-user, .chipdot { display: block; }
}

/* Estimated AWP under the quantity */
.estimate { display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 10px; margin:10px 0 4px; padding:10px 14px; border-radius:12px; background:var(--inset); }
.estimate .lbl { font-size:.875rem; font-weight:600; letter-spacing:.04em; color:var(--muted); }
.estimate b { font-size:1.15rem; font-variant-numeric:tabular-nums; }
.estimate .muted, .estimate-none { font-size:.875rem; }

/* shown by shell.js when the API answers 401: the session ended */
.signed-out-bar { position: sticky; top: 0; z-index: 50; padding: 10px 16px; text-align: center; background: var(--warn-bg); color: var(--warn-ink); border-bottom: 1px solid var(--line); font-weight: 600; backdrop-filter: blur(8px); }
.signed-out-bar a { color: inherit; text-decoration: underline; margin-left: .4em; }
