/* Pharoah SurgicalSight — micro-display HUD styles.
   High contrast, large type, no colour-only signalling.
   Tuned for a small bright monocular display + dark OR. */

:root {
  --bg: #000;
  --fg: #ffffff;
  --dim: #9aa0a6;
  --ok: #19e36a;      /* green  — also marked with ✓ + "OK"   */
  --warn: #ffd21f;    /* yellow — also marked with ▲ + "WATCH" */
  --crit: #ff4d4d;    /* red    — also marked with ■ + "ALERT" */
  --line: #1e1e1e;
  --accent: #19e36a;
  font-size: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hud {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  max-width: 760px;
  margin: 0 auto;
}

/* Top bar */
.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
}
.patient { font-weight: 700; letter-spacing: 0.04em; color: var(--fg); }
.bar-right { display: flex; align-items: center; gap: 1rem; }
.surgeon { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; color: var(--accent); }
.link { display: flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; }
.link .link-glyph { font-size: 0.7rem; }
.link.live { color: var(--ok); }
.link.mock { color: var(--warn); }
.sync { color: var(--warn); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; }

/* Shift auth gate */
.auth {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: #000;
}
.auth.hidden { display: none; }
.auth-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 2rem; }
.auth-brand { font-weight: 800; letter-spacing: 0.12em; font-size: 1.1rem; }
.auth-brand span { color: var(--accent); }
.auth-qr { border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.5rem; line-height: 0; }
.auth-prompt { font-size: 1.05rem; font-weight: 700; }
.auth-prompt.error { color: var(--crit); }
.auth-btn {
  background: var(--accent); color: #000; border: 0; border-radius: 0.5rem;
  font-weight: 800; font-size: 0.95rem; letter-spacing: 0.04em;
  padding: 0.7rem 1.4rem; cursor: pointer;
}
.auth-btn:hover { filter: brightness(1.08); }
.auth-note { font-size: 0.72rem; color: var(--dim); max-width: 22rem; }
.auth-cta {
  margin-top: 0.4rem; padding-top: 0.9rem; border-top: 1px solid var(--line);
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.03em;
  color: var(--accent); text-decoration: none;
}
.auth-cta:hover { text-decoration: underline; }
.mode {
  display: flex; align-items: center; gap: 0.4rem;
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em;
  color: var(--dim);
}
.mode-dot {
  width: 0.7rem; height: 0.7rem; border-radius: 50%;
  background: var(--line); border: 2px solid var(--dim);
}
.mode.listening .mode-dot { background: var(--accent); border-color: var(--accent); animation: pulse 1.1s infinite; }
.mode.listening { color: var(--accent); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Vitals */
.vitals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.vital {
  background: #070707;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.6rem 0.7rem;
}
.vital-top { display: flex; justify-content: space-between; align-items: baseline; }
.vital-name { font-weight: 700; letter-spacing: 0.05em; }
.vital-unit { font-size: 0.7rem; color: var(--dim); }
.vital-val { font-size: 2.4rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.vital-status { display: flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; }
.vital-status .glyph { font-size: 0.8rem; }

/* status states — colour + glyph + text, never colour alone */
.vital.ok   { border-left-color: var(--ok);   }
.vital.warn { border-left-color: var(--warn); }
.vital.crit { border-left-color: var(--crit); animation: critpulse 0.9s infinite; }
.vital.ok   .vital-status { color: var(--ok);   }
.vital.warn .vital-status { color: var(--warn); }
.vital.crit .vital-status { color: var(--crit); }
@keyframes critpulse { 0%,100% { border-left-color: var(--crit); } 50% { border-left-color: #7a1010; } }

/* Checklist */
.checklist {
  flex: 1;
  background: #070707;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
}
.cl-head { display: flex; justify-content: space-between; font-size: 0.75rem; letter-spacing: 0.08em; color: var(--dim); font-weight: 700; }
.cl-phase { color: var(--accent); }
.cl-step { flex: 1; display: flex; align-items: center; font-size: 1.5rem; font-weight: 700; line-height: 1.3; padding: 0.6rem 0; }
.cl-step.done { color: var(--ok); }
.cl-confirm { font-size: 0.85rem; color: var(--dim); }
.cl-confirm.complete { color: var(--ok); font-weight: 700; }

/* Imaging viewer (PRD §2.4) — overlays the checklist area when open */
.imaging {
  display: none;
  position: absolute;
  left: 1rem; right: 1rem;
  top: 8.6rem; bottom: 2.6rem;
  max-width: 728px;
  margin: 0 auto;
  background: #000;
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  flex-direction: column;
  overflow: hidden;
}
.imaging.visible { display: flex; }
.img-head, .img-foot {
  display: flex; justify-content: space-between;
  padding: 0.45rem 0.7rem;
  font-size: 0.72rem; letter-spacing: 0.06em; font-weight: 700;
  color: var(--accent); background: #060606;
}
.img-foot { color: var(--dim); font-weight: 400; }
.img-stage {
  flex: 1; overflow: hidden; display: flex;
  align-items: center; justify-content: center;
  background: #000; touch-action: none;
}
.img-stage img {
  width: auto; height: 100%; max-height: 100%;
  user-select: none; cursor: grab;
  transform-origin: center center;
  transition: transform 0.06s linear;
}
.img-stage img:active { cursor: grabbing; }

/* Captured documentation (PRD §2.5) */
.captures {
  display: none;
  gap: 0.5rem;
  padding: 0.2rem 0;
  overflow-x: auto;
}
.captures.has-items { display: flex; }
.cap-thumb {
  margin: 0; flex: 0 0 auto;
  border: 1px solid var(--accent); border-radius: 0.35rem; overflow: hidden;
  background: #060606;
}
.cap-thumb img { display: block; width: 132px; height: 74px; object-fit: cover; }
.cap-thumb figcaption {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--accent); text-align: center; padding: 0.15rem 0;
}

/* Capture flash */
.cap-flash {
  position: fixed; inset: 0; z-index: 40;
  background: #fff; opacity: 0; pointer-events: none;
}
.cap-flash.on { opacity: 0.85; transition: opacity 0.04s; }

/* Footer hints (dev only) */
.hints { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.7rem; color: var(--dim); border-top: 1px solid var(--line); padding-top: 0.5rem; }
