/* Workstation shell and components shared by every tab. Each tab adds its own <id>/<id>.css. */
/* Themes (ui/core/theme.js sets data-theme on <html>): every colour of the screens comes from
   these tokens. Photos, the camera and the 3D view keep their own dark surround in both themes
   (--photo-bg), so a photo looks the same either way. */
:root, :root[data-theme="dark"] {
  --bg: #0d1218; --panel: #141b24; --line: #253141; --ink: #e3e9f0; --muted: #8d9aab;
  --accent: #59b4d4; --caliper: #f2a531; --ok: #4cc47b; --warn: #e9b44c; --bad: #e5735f;
  --field: #0f151c; --surface-2: #1c2633; --on-accent: #04121a; --on-bad: #fff;
  --accent-soft: rgba(89, 180, 212, .08); --synth-bg: #3b2f12; --bar-ref: #7d8ea3;
  --scrim: rgba(5, 8, 12, .85); --shadow: rgba(0, 0, 0, .45); --busy: rgba(13, 18, 24, .72);
  --photo-bg: #0b0f14; --paper: #eceff3;
  --mono: "JetBrains Mono", Consolas, ui-monospace, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5f8; --panel: #ffffff; --line: #d3dae3; --ink: #16202b; --muted: #556275;
  --accent: #1a7399; --caliper: #a85f00; --ok: #1b7f45; --warn: #8a5d00; --bad: #b8392a;
  --field: #ffffff; --surface-2: #e5eaf0; --on-accent: #ffffff; --on-bad: #fff;
  --accent-soft: rgba(26, 115, 153, .1); --synth-bg: #fbecc8; --bar-ref: #6f7f93;
  --scrim: rgba(20, 28, 38, .55); --shadow: rgba(20, 28, 38, .18); --busy: rgba(243, 245, 248, .78);
  --photo-bg: #0b0f14; --paper: #eceff3;
  color-scheme: light;
}
/* The patient screen (ui/patient): a bright, calm clinic room on a big screen. Porcelain ground, white panels,
   the clinic's teal for guidance, a warm amber only for "you" in comparisons. The same in both themes. */
:root {
  --stage-bg: #eef3f5; --stage-panel: #ffffff; --stage-line: #d6e1e5; --stage-ink: #122631; --stage-dim: #566a74;
  --stage-accent: #0b6f7a; --stage-tint: #e2f0f1; --stage-you: #c27c12; --stage-you-tint: #fbf0dc;
  --stage-good: #23784f; --stage-good-tint: #e3f3ea; --stage-media: #e9eef1; --stage-shadow: rgba(18, 38, 49, .08);
}
* { box-sizing: border-box; }
.stack-label { position: fixed; left: 10px; bottom: 10px; z-index: 1000; pointer-events: none; background: var(--bad); color: var(--on-bad); font-weight: 700; padding: 5px 12px; border-radius: 99px; font-size: 13px; box-shadow: 0 2px 8px var(--shadow); opacity: .92; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 "Segoe UI", system-ui, sans-serif; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; border-radius: 5px; padding: 7px 12px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--caliper); outline-offset: 2px; }
input, select { background: var(--field); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; width: 100%; }
input[type=checkbox] { width: auto; }
input[aria-invalid] { border-color: var(--bad); outline: 1px solid var(--bad); }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.msg { min-height: 1.2em; color: var(--warn); font-size: 13px; }
h4 { margin: 8px 0 0; font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.auth { display: grid; place-items: center; min-height: 100%; padding: 16px; }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: grid; gap: 14px; }
.auth-card h1 { margin: 0; font-size: 24px; }
.auth-card form { display: grid; gap: 12px; }
.tabs { display: flex; gap: 6px; }
.tab.on { border-color: var(--accent); color: var(--accent); }

.ws { display: grid; grid-template-rows: auto auto 1fr; height: 100%; }
.top { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); font: 12px/1.3 var(--mono); color: var(--muted); }
.top b { color: var(--ink); }
.grow { flex: 1; }
.pill { padding: 4px 8px; border-radius: 4px; border: 1px solid var(--line); }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.bad { color: var(--bad); border-color: var(--bad); }
.synth { font: 600 11px/1 var(--mono); padding: 4px 7px; border-radius: 3px; background: var(--synth-bg); color: var(--warn); }

.side, .panel { padding: 12px 14px; display: grid; gap: 10px; align-content: start; overflow: auto; }
.side { border-right: 1px solid var(--line); }
.panel { border-left: 1px solid var(--line); background: var(--panel); }
.row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.view { display: grid; gap: 6px; min-width: 0; }
.vlabel { display: flex; justify-content: space-between; gap: 8px; font: 12px/1.4 var(--mono); color: var(--muted); }
.vlabel b { color: var(--ink); }
.vlabel label { display: inline-flex; gap: 4px; align-items: center; }
canvas { width: 100%; height: auto; aspect-ratio: 5 / 4; background: var(--photo-bg); border-radius: 4px; display: block; }
.thumb { flex: 0 0 auto; width: 80px; height: 64px; padding: 0; border-radius: 3px; overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.on { outline: 2px solid var(--accent); }
.thumb span { position: absolute; left: 3px; bottom: 2px; font: 10px/1 var(--mono); color: #fff; text-shadow: 0 0 3px #000; }
.thumb i { position: absolute; right: 3px; top: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.thumb i.done { background: var(--ok); }

/* patient lookup / registration */
.find input { flex: 1; min-width: 0; }
.stack { display: grid; gap: 8px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.results:empty { display: none; }
button.result { width: 100%; text-align: left; font-size: 13px; }
.card { border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: grid; gap: 8px; }
.pc-title { margin: 0; font-size: 15px; color: var(--ink); }

/* tab bar, and the active module filling the rest of the screen */
.modtabs { display: inline-flex; gap: 4px; }
.modtabs button { padding: 4px 10px; font: 600 12px/1.3 var(--mono); }
.modtabs button[aria-selected="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.modules { display: grid; min-height: 0; }
.module { min-height: 0; }
.theme-toggle { padding: 4px 10px; font: 600 12px/1.3 var(--mono); white-space: nowrap; }
.auth .theme-toggle { position: fixed; top: 12px; right: 14px; }

/* change password (header button) */
.chpw-dlg { border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; width: min(420px, calc(100vw - 32px));
  background: var(--panel); color: var(--ink); }
.user-name { background: none; border: 0; padding: 2px 4px; color: inherit; font: inherit; cursor: pointer; border-radius: 6px; }
.user-name:hover { background: var(--line); }
.chpw-dlg::backdrop { background: var(--scrim); }
.chpw-dlg h2 { margin: 0 0 12px; font-size: 18px; }
.chpw-dlg label { display: grid; gap: 4px; margin-bottom: 10px; }
.chpw-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* a person at several clinics: the clinic chooser (sign-in and Switch clinic) */
.pick-list { display: grid; gap: 8px; margin: 8px 0; }
.pick-list .pick { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; }
.pick-list .pick:hover, .pick-list .pick:focus-visible { border-color: var(--accent); }
.pending-note { margin: 8px 12px; padding: 8px 12px; border: 1px solid var(--accent); border-radius: 8px; background: var(--panel); color: var(--ink); }
.pending-note[hidden] { display: none; }
