/* Zybit Chairside Design System - "Clinic Glass" (production build).
   The one stylesheet every server-rendered surface consumes, served at
   /assets/chairside.css (same-origin: no CDN ever touches a PHI page).
   Canonical spec: docs/design/DESIGN-LANGUAGE.md. Fonts are self-hosted
   variable WOFF2s under /assets/fonts/ for the same reason. */

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-var-latin.woff2") format("woff2");
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/fonts/hanken-grotesk-var-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --ink: #1b2432;
  --muted: #7a8494;
  --faint: #a6aebc;
  --hair: rgba(27, 36, 50, 0.07);
  --accent: #345fd6;
  --accent-soft: #7a9aec;
  --amber: #b0812b;
  --amber-ink: #856012;
  --clay: #be5a45;
  --clay-ink: #a6472f;
  --card: rgba(255, 255, 255, 0.55);
  --card-brd: rgba(255, 255, 255, 0.9);
  --card-hi: rgba(255, 255, 255, 0.42);
  --shadow-card: 0 24px 46px -22px rgba(40, 60, 120, 0.4);
  --shadow-btn: 0 12px 24px -14px rgba(40, 60, 120, 0.4);
  --blur: blur(30px) saturate(135%);
}

html,
body {
  height: 100%;
  width: 100%;
}
body {
  font-family: "Hanken Grotesk", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: #e7eaf1;
}

/* Frost fallback: a browser/monitor that cannot blur gets a milkier solid card
   so text stays on a calm, legible surface (the design's non-negotiable). */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --card: rgba(255, 255, 255, 0.9);
    --card-hi: rgba(255, 255, 255, 0.82);
  }
}

/* ---------- ground (dimensional light gradient + film grain) ---------- */
.bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 90% at 12% 4%, #fcfdfe 0%, rgba(252, 253, 254, 0) 46%),
    radial-gradient(120% 100% at 92% 96%, rgba(118, 148, 224, 0.44) 0%, rgba(118, 148, 224, 0) 60%),
    radial-gradient(92% 82% at 86% 12%, rgba(206, 196, 236, 0.42) 0%, rgba(206, 196, 236, 0) 55%),
    radial-gradient(82% 72% at 2% 94%, rgba(240, 224, 214, 0.34) 0%, rgba(240, 224, 214, 0) 55%),
    linear-gradient(158deg, #eff3f9 0%, #e7ecf5 58%, #dfe7f3 100%);
}
.bg.login {
  background:
    radial-gradient(120% 90% at 10% 2%, #fdfeff 0%, rgba(253, 254, 255, 0) 44%),
    radial-gradient(130% 110% at 96% 98%, rgba(96, 132, 224, 0.58) 0%, rgba(96, 132, 224, 0) 60%),
    radial-gradient(96% 84% at 88% 8%, rgba(200, 190, 236, 0.55) 0%, rgba(200, 190, 236, 0) 55%),
    radial-gradient(84% 74% at 0% 96%, rgba(242, 222, 210, 0.42) 0%, rgba(242, 222, 210, 0) 55%),
    linear-gradient(158deg, #e9effa 0%, #dae4f5 56%, #cbd9f1 100%);
}
.grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- shell (full-bleed, own size-container) ---------- */
.tab {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  container-type: size;
  container-name: tab;
}
.content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(14px, 5cqh, 26px) clamp(13px, 4.5cqw, 24px) 0;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.wordmark {
  font-size: clamp(12px, 3.4cqw, 14px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #4a5568;
}
.clock {
  font-size: clamp(11px, 3.2cqw, 13px);
  font-weight: 500;
  color: var(--muted);
}

/* ---------- header ---------- */
.head {
  margin-top: clamp(14px, 4.2cqh, 30px);
  flex-shrink: 0;
}
.eyebrow {
  font-size: clamp(9.5px, 2.6cqw, 11px);
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-transform: uppercase;
}
.name {
  font-family: "Fraunces", serif;
  font-weight: 400;
  font-size: clamp(23px, 9cqw, 39px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: clamp(5px, 1.6cqh, 10px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- live status (single source of truth) ---------- */
.live {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.6cqw, 12px);
  margin-top: clamp(12px, 3cqh, 20px);
  flex-shrink: 0;
}
.wave {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 22px;
  flex-shrink: 0;
}
.wave span {
  width: 2.5px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-soft), #2f55c8);
  animation: wave 1.1s ease-in-out infinite;
}
@keyframes wave {
  0%,
  100% {
    transform: scaleY(0.7);
  }
  50% {
    transform: scaleY(1);
  }
}
.live-label {
  font-size: clamp(12.5px, 3.5cqw, 14px);
  font-weight: 600;
  color: var(--accent);
}
.live-hint {
  font-size: clamp(12.5px, 3.5cqw, 14px);
  font-weight: 400;
  color: var(--muted);
}
.tab[data-session="paused"] .wave span,
.tab[data-session="ready"] .wave span,
.tab[data-session="ended"] .wave span {
  animation: none;
  opacity: 0.5;
}
.tab[data-session="reconnecting"] .wave span {
  background: linear-gradient(180deg, #d9b25a, var(--amber));
}
.tab[data-session="reconnecting"] .live-label {
  color: var(--amber-ink);
}
.tab[data-session="paused"] .live-label,
.tab[data-session="ready"] .live-label,
.tab[data-session="ended"] .live-label {
  color: var(--muted);
}

/* ---------- visit label ---------- */
.visit-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: clamp(14px, 3.6cqh, 30px);
  padding: 0 2px clamp(8px, 1.6cqh, 13px);
  flex-shrink: 0;
}
.visit-row .l {
  font-size: clamp(10px, 2.8cqw, 11.5px);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.visit-row .c {
  font-size: clamp(11px, 2.9cqw, 12.5px);
  font-weight: 500;
  color: var(--muted);
}

/* ---------- log (flexible scroll region, newest at top) ---------- */
.scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.log {
  border-radius: clamp(16px, 4cqw, 24px);
  background: var(--card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--card-brd);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    var(--shadow-card);
  overflow: hidden;
}

/* ---------- entry (data-state drives glyph + action) ---------- */
.entry {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3cqw, 14px);
  padding: clamp(11px, 3cqh, 16px) clamp(12px, 3.6cqw, 16px);
  animation: rise 0.3s cubic-bezier(0.2, 1, 0.3, 1);
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.entry + .entry {
  border-top: 1px solid var(--hair);
}
.glyph {
  width: clamp(18px, 5cqw, 22px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.glyph svg {
  width: clamp(15px, 4.4cqw, 19px);
  height: clamp(15px, 4.4cqw, 19px);
}
.entry .body {
  flex: 1 1 auto;
  min-width: 0;
}
.entry .title {
  font-size: clamp(14px, 4cqw, 16px);
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry .meta {
  font-size: clamp(11.5px, 3.1cqw, 12.5px);
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}
.entry[data-state="inferred"] .meta {
  color: #93692a;
}
.entry[data-state="didnt-save"] .meta {
  color: var(--clay-ink);
}
.entry[data-state="undone"] .title {
  text-decoration: line-through;
  color: var(--faint);
}
.entry[data-state="undone"] .meta {
  color: var(--faint);
}
.entry[data-state="merged"] .title {
  color: var(--muted);
}

/* ---------- actions (Undo / Retry / Restore) - NEVER Confirm ---------- */
.act {
  flex-shrink: 0;
  min-width: clamp(44px, 20cqw, 78px);
  min-height: 44px;
  padding: 0 clamp(10px, 3cqw, 14px);
  border-radius: clamp(9px, 2.6cqw, 11px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: clamp(12px, 3.3cqw, 13px);
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  background: var(--card-hi);
  border: 1px solid rgba(27, 36, 50, 0.1);
  color: #59637a;
}
.act.retry {
  border-color: rgba(190, 90, 69, 0.55);
  color: var(--clay-ink);
}
.act.restore {
  border-color: rgba(52, 95, 214, 0.5);
  color: var(--accent);
}
.act .ai {
  display: none;
}
.tag {
  flex-shrink: 0;
  font-size: clamp(11px, 3cqw, 12.5px);
  font-weight: 500;
  color: var(--faint);
}

/* ---------- controls bar ---------- */
.controls {
  display: flex;
  align-items: center;
  gap: clamp(7px, 2.4cqw, 10px);
  padding: clamp(12px, 3cqh, 16px) 0 clamp(16px, 4cqh, 22px);
  flex-shrink: 0;
}
.btn {
  height: clamp(44px, 12cqh, 52px);
  border-radius: clamp(13px, 3.4cqw, 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: clamp(13px, 3.6cqw, 15px);
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  background: var(--card);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  border: 1px solid var(--card-brd);
  box-shadow: var(--shadow-btn);
  color: var(--ink);
}
.btn svg {
  flex-shrink: 0;
}
.btn.icon {
  width: clamp(44px, 12cqh, 52px);
  flex-shrink: 0;
}
.btn.pause,
.btn.resume,
.btn.start {
  flex: 1 1 auto;
}
.btn.end {
  width: clamp(52px, 30cqw, 120px);
  flex-shrink: 0;
  color: var(--clay-ink);
  background: var(--card-hi);
  border: 1px solid rgba(190, 90, 69, 0.5);
}
.btn .lbl {
  overflow: hidden;
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

/* ---------- picker: search + patient rows ---------- */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: clamp(44px, 12cqh, 50px);
  padding: 0 clamp(12px, 4cqw, 16px);
  border-radius: clamp(12px, 3.2cqw, 14px);
  background: var(--card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--card-brd);
  box-shadow: var(--shadow-btn);
  color: var(--muted);
  font-size: clamp(14px, 3.8cqw, 15.5px);
  font-weight: 500;
}
.search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  outline: none;
}
.search button {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.row {
  display: flex;
  align-items: center;
  gap: clamp(11px, 3cqw, 13px);
  padding: clamp(11px, 3cqh, 13px) clamp(12px, 3.6cqw, 15px);
  text-decoration: none;
  color: inherit;
}
.row + .row {
  border-top: 1px solid var(--hair);
}
.avatar {
  width: clamp(34px, 10cqw, 40px);
  height: clamp(34px, 10cqw, 40px);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(13px, 3.8cqw, 15px);
  font-weight: 600;
  background: rgba(52, 95, 214, 0.1);
  color: #2e56c2;
}
.row.active .avatar {
  background: var(--accent);
  color: #fff;
}
.row .name-sm {
  font-size: clamp(15px, 4.2cqw, 17px);
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
}
.row .sub {
  font-size: clamp(12px, 3.2cqw, 13.5px);
  font-weight: 500;
  color: var(--muted);
  margin-top: 1px;
}
.livetag {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--card-brd);
  flex-shrink: 0;
}
.livetag .d {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.livetag span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
}
.chev {
  flex-shrink: 0;
}
.groupcard {
  border-radius: 20px;
  background: var(--card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--card-brd);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.sec {
  font-size: clamp(10px, 2.8cqw, 11.5px);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: clamp(14px, 3cqh, 18px) 4px 8px;
  text-transform: uppercase;
}

/* ---------- login / centered glass ---------- */
.center {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.glasscard {
  width: 100%;
  max-width: 360px;
  border-radius: 28px;
  padding: 34px 30px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.4));
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  backdrop-filter: blur(40px) saturate(140%);
  border: 1px solid var(--card-brd);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 40px 80px -36px rgba(30, 50, 110, 0.5);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: center;
}
.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(52, 95, 214, 0.16);
}
.brand .wm {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #3d4a63;
}
.login-title {
  font-family: "Fraunces", serif;
  font-weight: 400;
  font-size: 34px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-align: center;
  margin-top: 16px;
}
.login-sub {
  font-size: 14.5px;
  font-weight: 400;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 26px;
}
.field {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  background: var(--card-hi);
  border: 1px solid var(--card-brd);
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}
.field input,
.field select {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  outline: none;
}
.field input::placeholder {
  color: var(--muted);
}
.primary {
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  background: var(--ink);
  color: #fff;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 14px 30px -14px rgba(27, 36, 50, 0.55);
}
.primary[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  background: rgba(190, 138, 46, 0.14);
  border: 1px solid rgba(190, 138, 46, 0.34);
  color: #7c5c14;
}
.foot {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.foot a {
  color: var(--accent);
  text-decoration: none;
}

/* ---------- page-type screens (dashboard, setup, flags, od, confirm) ---------- */
.page {
  position: relative;
  z-index: 2;
  height: 100%;
  overflow-y: auto;
  padding: clamp(16px, 5cqh, 26px) clamp(14px, 4.5cqw, 24px) clamp(22px, 5cqh, 30px);
}
.page .head {
  margin-top: clamp(10px, 3cqh, 18px);
}
.pagewrap {
  max-width: 640px;
  margin: 0 auto;
}
.signout {
  position: absolute;
  top: clamp(16px, 5cqh, 22px);
  right: clamp(14px, 4.5cqw, 24px);
  z-index: 3;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--card-hi);
  border: 1px solid var(--card-brd);
  border-radius: 11px;
  padding: 8px 13px;
  cursor: pointer;
}
.sechead {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: clamp(18px, 4cqh, 24px) 4px clamp(8px, 1.6cqh, 11px);
}
.sechead .t {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}
.sechead .n {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
}
.group {
  border-radius: 22px;
  background: var(--card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--card-brd);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.empty {
  padding: 22px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.navlinks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 22px;
}
.navlink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  border-top: 1px solid var(--hair);
  text-decoration: none;
}
.navlink .a {
  color: var(--faint);
}
.banner {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}
.banner.info {
  background: rgba(52, 95, 214, 0.1);
  border: 1px solid rgba(52, 95, 214, 0.25);
  color: #2e56c2;
}
.banner.warn {
  background: rgba(190, 138, 46, 0.14);
  border: 1px solid rgba(190, 138, 46, 0.34);
  color: #7c5c14;
}

/* schedule row (dashboard / od) */
.sched {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  text-decoration: none;
  color: inherit;
}
.sched + .sched {
  border-top: 1px solid var(--hair);
}
.sched .time {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  width: 52px;
  flex-shrink: 0;
}
.sched .op {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(52, 95, 214, 0.09);
  border-radius: 7px;
  padding: 3px 8px;
  flex-shrink: 0;
}
.sched .who {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* setup step card */
.step {
  border-radius: 22px;
  background: var(--card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--card-brd);
  box-shadow: var(--shadow-card);
  padding: 20px 20px;
  margin-top: 14px;
}
.step-h {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stepnum {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
}
.step.done .stepnum {
  background: rgba(52, 95, 214, 0.14);
  color: var(--accent);
}
.step-t {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.step-b {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 11px;
}
.step .primary {
  margin-top: 15px;
  height: 46px;
  font-size: 14.5px;
}
.step .field {
  margin-top: 12px;
}
.done-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 12px;
}
.step video {
  width: 100%;
  border-radius: 14px;
  margin-top: 12px;
}
.docbody {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card-hi);
  border: 1px solid var(--card-brd);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-wrap;
}
.keybox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card-hi);
  border: 1px solid var(--card-brd);
  font-family: ui-monospace, monospace;
  font-size: 13.5px;
  color: var(--ink);
  word-break: break-all;
}
.minor {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.meter {
  height: 10px;
  border-radius: 6px;
  margin-top: 12px;
  background: var(--card-hi);
  border: 1px solid var(--card-brd);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  transition: width 0.12s linear;
}
.status-line {
  font-size: 13.5px;
  font-weight: 500;
  margin-top: 10px;
  color: var(--muted);
}
.status-line.ok {
  color: var(--accent);
  font-weight: 600;
}
.status-line.warn {
  color: var(--amber-ink);
  font-weight: 600;
}
.status-line.err {
  color: var(--clay-ink);
  font-weight: 600;
}

/* flags */
.flagrow {
  padding: 14px 16px;
}
.flagrow + .flagrow {
  border-top: 1px solid var(--hair);
}
.flag-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.flag-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  word-break: break-all;
}
.flag-val {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.flag-val.on {
  color: var(--accent);
}
.flag-val.off {
  color: var(--faint);
}
.flag-val.set {
  color: var(--ink);
}
.flag-life {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 5px;
}
.flag-desc {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--muted);
  margin-top: 5px;
}

/* ---------- responsiveness (adapts to the tab's OWN size) ---------- */
@container tab (max-width: 360px) {
  .live-hint {
    display: none;
  }
}
@container tab (max-width: 306px) {
  .act {
    min-width: 44px;
    padding: 0;
    width: clamp(38px, 9cqh, 44px);
  }
  .act .lbl {
    display: none;
  }
  .act .ai {
    display: flex;
  }
  .btn.end .lbl {
    display: none;
  }
  .btn.end {
    width: clamp(44px, 12cqh, 52px);
  }
}
@container tab (max-height: 470px) {
  .live {
    margin-top: 10px;
  }
  .visit-row {
    margin-top: 12px;
  }
  .wave {
    height: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wave span {
    animation: none;
  }
  .entry {
    animation: none;
  }
}
