/* The patient visit page. Mobile-first at 375 px; brand colors as the marketing site (src/styles/globals.css). */
:root {
  --navy: #0b1d3a;
  --navy-light: #122548;
  --gold: #c9944a;
  --gold-text: #906a35;
  --cream: #faf8f5;
  --cream-dark: #f0ede8;
  --text: #1a1a2e;
  --muted: #4a4a6a;
  --danger: #a3272c;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--cream);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
#app { max-width: 960px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 0; font-weight: 600; color: var(--navy); }
.brand img { border-radius: 8px; }
.card { background: #fff; border-radius: 16px; padding: 20px 16px; box-shadow: 0 1px 3px rgb(11 29 58 / 0.08); }
h1 { font-size: 1.35rem; line-height: 1.3; margin: 0 0 12px; color: var(--navy); }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
a { color: var(--gold-text); }
.btn {
  display: inline-block; min-height: 48px; padding: 12px 20px; margin: 8px 8px 0 0;
  border: 0; border-radius: 999px; background: var(--navy); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.secondary { background: var(--cream-dark); color: var(--navy); }
.btn.danger { background: var(--danger); }
.btn.small { min-height: 40px; padding: 8px 16px; }
.toggle { display: flex; align-items: center; gap: 8px; margin: 12px 0; min-height: 44px; }
.toggle input { width: 22px; height: 22px; }
.preview { width: 100%; aspect-ratio: 4 / 3; background: var(--navy); border-radius: 12px; object-fit: cover; transform: scaleX(-1); }
.note { font-weight: 500; }

/* Visit */
body[data-state="visit"] .card { padding: 12px; }
.stage { position: relative; background: var(--navy); border-radius: 12px; overflow: hidden; aspect-ratio: 3 / 4; }
.stage .main { width: 100%; height: 100%; object-fit: cover; }
.stage.sharing .main { object-fit: contain; background: #000; }
.stage .small { position: absolute; top: 8px; left: 8px; width: 28%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; }
.self-wrap { position: absolute; right: 8px; bottom: 8px; width: 30%; aspect-ratio: 3 / 4; }
.self { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; transform: scaleX(-1); background: var(--navy-light); }
.tile-name { position: absolute; left: 6px; bottom: 4px; color: #fff; font-size: 0.75rem; text-shadow: 0 1px 2px #000; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.notice { background: var(--cream-dark); padding: 8px 12px; border-radius: 8px; margin-top: 12px; }

/* Chat */
.chat-panel { margin-top: 16px; border-top: 1px solid var(--cream-dark); padding-top: 12px; }
.chat-list { list-style: none; padding: 0; margin: 0 0 8px; max-height: 40vh; overflow-y: auto; }
.chat { padding: 8px 12px; border-radius: 12px; margin: 4px 0; max-width: 85%; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat.patient { background: var(--navy); color: #fff; margin-left: auto; }
.chat.physician { background: var(--cream-dark); }
.chat-input { display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { flex: 1; font: inherit; padding: 10px; border-radius: 10px; border: 1px solid #c8c4bc; resize: none; }
.chat-input .btn { margin: 0; }

dialog.devices { border: 0; border-radius: 16px; padding: 20px; width: min(92vw, 420px); }
.field { display: block; margin: 0 0 12px; }
.field select { display: block; width: 100%; min-height: 44px; margin-top: 4px; font: inherit; }

@media (min-width: 768px) {
  .card { padding: 28px; }
  h1 { font-size: 1.6rem; }
  .stage { aspect-ratio: 16 / 9; }
  .stage .small { width: 22%; aspect-ratio: 16 / 9; }
  .self-wrap { width: 22%; aspect-ratio: 16 / 9; }
  body[data-state="visit"] .card { display: grid; grid-template-columns: 1fr 300px; gap: 0 16px; }
  body[data-state="visit"] .stage, body[data-state="visit"] .notice, body[data-state="visit"] .controls { grid-column: 1; }
  body[data-state="visit"] .chat-panel { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; border-top: 0; padding-top: 0; }
}
