/* THE EXCEPTION QUEUE AND OPERATIONS DASHBOARD (2026-10-23, public/exceptions/). The clinic page's look: DM Sans, the
   user's own palette and display mode (public/appTheme.js sets the tokens on <html>), the app header, cards with the
   app's radius and shadows, the app's button and badge classes. Every colour is a token; nothing here is a fixed hex
   except the neutral fallbacks the tokens replace at load. Risk is never colour alone: each badge says its level. */
@font-face { font-family:'DM Sans'; font-style:normal; font-weight:100 1000; font-display:swap; src:url('/fonts/dm-sans-latin-wght-normal.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'DM Sans'; font-style:normal; font-weight:100 1000; font-display:swap; src:url('/fonts/dm-sans-latin-ext-wght-normal.woff2') format('woff2'); unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family:'Fraunces'; font-style:normal; font-weight:500; font-display:swap; src:url('/fonts/fraunces-latin-500-normal.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  /* the app's fixed tokens (public/index.html :root); the palette tokens below are the Yarrow light defaults, replaced
     at load by the user's own palette and mode */
  --app-font: 'DM Sans', sans-serif; --app-header-h: 56px; --card-radius: 12px; --radius: 12px; --radius-sm: 8px;
  --warning: #f59e0b; --danger: #ef4444;
  --bg: #F7F7F3; --surface: #FFFFFF; --surface2: #EFF0EA; --surface3: #E8E9E2; --border: #E2E3DC;
  --accent: #4F6B47; --accent-rgb: 79, 107, 71; --accent-hover: #3F5A39; --accent-tint: #E8EEE3;
  --text: #1F2A44; --text2: #4D5056; --text3: #64676C; --logo-ink: #1F2A44; --success: #2F7D74; --success-rgb: 47, 125, 116; --success-ink: #2A7068;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.06); --shadow-md: 0 4px 16px rgba(15,23,42,0.08);
  --banner-grad: linear-gradient(90deg, #FFFFFF 0%, #F7F7F3 58%, rgba(122, 150, 112, 0.10) 100%);
  /* text that sits on a warning or danger tint: the status hue pulled toward the body text, so it stays readable */
  --warning-ink: color-mix(in srgb, var(--warning) 45%, var(--text));
  --danger-ink: color-mix(in srgb, var(--danger) 70%, var(--text));
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--app-font); background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; line-height: 1.6; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* the app header (public/index.html .app-header) */
.app-header { background-color: var(--bg); background-image: var(--banner-grad); border-bottom: 1px solid var(--border); padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--app-header-h); position: sticky; top: 0; z-index: 10; }
.logo { display: flex; align-items: center; gap: 9px; min-width: 0; text-decoration: none; border-radius: 10px; }
.logo:hover { opacity: .85; }
.nn-logo { width: 42px; height: 42px; flex: none; display: block; object-fit: contain; transition: filter .3s ease; }
.brand-name { font-family: 'Fraunces', Georgia, serif; font-weight: 500; font-size: 25px; letter-spacing: -0.5px; color: var(--logo-ink); line-height: 1; }
.ex-page-title { font-size: 15px; font-weight: 600; color: var(--text2); padding-left: 12px; margin-left: 3px; border-left: 1px solid var(--border); white-space: nowrap; }
.header-right { display: flex; align-items: center; gap: 10px; }

/* the app's buttons and badges (public/index.html .btn, .nn-badge) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); font-family: var(--app-font); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all .15s; text-decoration: none; line-height: 1.3; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
/* dark mode: the accents are light there, so the label on a filled button is the page's dark background, not white */
:root[data-mode="dark"] .btn-primary { color: var(--bg); }
:root[data-mode="dark"] .btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.nn-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; border: 1px solid var(--border); white-space: nowrap; color: var(--text2); background: var(--surface2); }
.nn-badge.is-critical { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger-ink); border-color: var(--danger); }
.nn-badge.is-high { background: color-mix(in srgb, var(--warning) 14%, var(--surface)); color: var(--warning-ink); border-color: var(--warning); }
.nn-badge.is-routine { background: var(--surface2); color: var(--text2); border-color: var(--border); }
.nn-badge.is-assigned { background: rgba(var(--accent-rgb), 0.10); color: var(--accent); border-color: var(--accent); }
.nn-badge.is-done { background: rgba(var(--success-rgb), 0.10); color: var(--success-ink); border-color: rgba(var(--success-rgb), 0.45); }
.ex-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* layout */
.ex-main { max-width: 980px; margin: 0 auto; padding: 18px 16px 64px; }
.ex-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; }
.ex-tab { border: 0; background: transparent; color: var(--text2); font: 600 13px var(--app-font); padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.ex-tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); box-shadow: var(--shadow-sm); }
.ex-card { padding: 16px 18px; margin-bottom: 12px; }
.ex-sech { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.ex-sech .ex-n { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text3); }
.ex-muted { color: var(--text2); }
.ex-small { font-size: 12px; color: var(--text3); }
.ex-msg:empty { display: none; }
.ex-msg { margin-bottom: 12px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--accent-tint); color: var(--text); font-size: 13px; }
.ex-msg.is-bad { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger-ink); font-weight: 600; }
.ex-notice { padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--warning); background: color-mix(in srgb, var(--warning) 10%, var(--surface)); color: var(--warning-ink); font-size: 13px; margin-bottom: 12px; }

/* the summary at the top of the queue */
.ex-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; }
.ex-summary h1 { font-size: 18px; font-weight: 700; line-height: 1.3; }
.ex-summary p { font-size: 13px; color: var(--text2); margin-top: 2px; }
.ex-counts { display: flex; flex-wrap: wrap; gap: 6px; }

/* one exception */
.ex-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ex-item { padding: 14px 16px; }
.ex-item.is-critical { box-shadow: inset 3px 0 0 var(--danger), var(--shadow-sm); }
.ex-item.is-high { box-shadow: inset 3px 0 0 var(--warning), var(--shadow-sm); }
.ex-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ex-kind { font-size: 12px; color: var(--text3); }
.ex-age { margin-left: auto; font-size: 12px; color: var(--text3); white-space: nowrap; }
.ex-title { font-size: 14px; font-weight: 700; color: var(--text); margin-top: 6px; line-height: 1.35; }
.ex-patient { font-weight: 500; color: var(--text2); }
.ex-reason { font-size: 13px; color: var(--text2); margin-top: 2px; }
.ex-next { font-size: 13px; color: var(--text); margin-top: 6px; }
.ex-next b { font-weight: 600; }
.ex-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.ex-panel { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface2); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ex-panel label { font-size: 12px; color: var(--text2); font-weight: 600; }
.ex-panel input, .ex-panel select { font: 13px var(--app-font); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px; min-height: 32px; }
.ex-empty { text-align: center; padding: 34px 18px; }
.ex-empty h2 { font-size: 16px; font-weight: 700; }
.ex-empty p { color: var(--text2); margin: 4px 0 14px; font-size: 13px; }
details.ex-snoozed > summary { cursor: pointer; list-style: none; }
details.ex-snoozed > summary::-webkit-details-marker { display: none; }
details.ex-snoozed > summary::before { content: '\25B8'; display: inline-block; margin-right: 6px; transition: transform .15s; }
details.ex-snoozed[open] > summary::before { transform: rotate(90deg); }

/* the dashboard */
.ex-range { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.ex-range h1 { font-size: 18px; font-weight: 700; }
.ex-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.ex-tile { padding: 14px 16px; }
.ex-tile-k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); }
.ex-tile-v { font-size: 26px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 4px; }
.ex-tile-v small { font-size: 13px; font-weight: 500; color: var(--text2); }
.ex-tile-s { font-size: 12px; color: var(--text2); margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ex-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ex-chart-h { font-size: 14px; font-weight: 700; }
.ex-chart-sub { font-size: 12px; color: var(--text2); margin: 2px 0 8px; }
.ex-chart { position: relative; }
.ex-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.ex-chart .bar { fill: var(--accent); }
.ex-chart .bar.is-over { fill: var(--warning); }
.ex-chart .hit { fill: transparent; cursor: default; }
.ex-chart .hit:hover + .bar, .ex-chart .bar.is-hover { opacity: .8; }
.ex-chart .grid { stroke: var(--border); stroke-width: 1; }
.ex-chart .base { stroke: var(--text3); stroke-width: 1; }
.ex-chart .target { stroke: var(--text2); stroke-width: 1.5; stroke-dasharray: 4 3; }
.ex-chart .axis { fill: var(--text3); font: 12px var(--app-font); }
.ex-chart .tlabel { fill: var(--text2); font: 600 12px var(--app-font); }
.ex-tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-md); border-radius: var(--radius-sm); padding: 6px 9px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -100%); z-index: 2; }
.ex-tip b { font-variant-numeric: tabular-nums; }
details.ex-table { margin-top: 8px; font-size: 12px; }
details.ex-table summary { cursor: pointer; color: var(--accent); font-weight: 600; }
table.ex-t { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
table.ex-t th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.ex-t td, table.ex-t tbody th { padding: 7px 8px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); color: var(--text); text-align: left; font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: 0; }
table.ex-t tbody tr:last-child td, table.ex-t tbody tr:last-child th { border-bottom: 0; }
table.ex-t .num { text-align: right; font-variant-numeric: tabular-nums; }
table.ex-t th.num { text-align: right; }
.ex-scroll { overflow-x: auto; }

@media (max-width: 760px) {
  .ex-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ex-grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .app-header { padding: 0 12px; }
  .brand-name { font-size: 21px; }
  .nn-logo { width: 34px; height: 34px; }
  .ex-page-title { font-size: 14px; padding-left: 9px; }
  .ex-main { padding: 14px 12px 56px; }
  .ex-tile-v { font-size: 22px; }
  .ex-age { margin-left: 0; width: 100%; }
}
