*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #0f766e;
  --green-soft: #e7f7f2;
  --amber: #b45309;
  --amber-soft: #fff7ed;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-soft: #64748b;
  --line: #dbe3ee;
  --line-strong: #cbd5e1;
  --page: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --shadow: 0 1.25rem 3rem rgba(15, 23, 42, 0.10);
  --zone-z1: #14b8a6;
  --zone-z1-bg: #e6fffb;
  --zone-z2: #2563eb;
  --zone-z2-bg: #eff6ff;
  --zone-z3: #d97706;
  --zone-z3-bg: #fffbeb;
  --zone-z4: #ea580c;
  --zone-z4-bg: #fff7ed;
  --zone-z5: #dc2626;
  --zone-z5-bg: #fef2f2;
  --radius: 0.5rem;
  --radius-sm: 0.375rem;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.siq-icon-btn img {
  display: block;
  height: 1.125rem;
  opacity: 0.78;
  width: 1.125rem;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 0.1875rem solid rgba(37, 99, 235, 0.35);
  outline-offset: 0.125rem;
}

.app-header {
  align-items: center;
  background: #1f2937;
  color: #fff;
  display: flex;
  gap: 1rem;
  min-height: 4.5rem;
  /* Respect the iOS status bar / dynamic island + notch. env() is 0 on
     desktop, so the web coach view is unchanged. */
  padding: calc(0.75rem + env(safe-area-inset-top)) calc(1.5rem + env(safe-area-inset-right)) 0.75rem calc(1.5rem + env(safe-area-inset-left));
}

.back-link {
  align-items: center;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.92);
  display: inline-flex;
  font-size: 0.8125rem;
  font-weight: 600;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
}

.brand {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.625rem;
  color: #fff;
  display: grid;
  flex: 0 0 auto;
  height: 2.375rem;
  place-items: center;
  width: 2.375rem;
}

.brand-mark svg {
  height: 1.375rem;
  width: 1.375rem;
}

.brand h1 {
  font-size: 1.0625rem;
  line-height: 1.2;
  margin: 0;
}

.brand p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.75rem;
  margin: 0.1rem 0 0;
}

.header-status {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.86);
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  margin-left: auto;
  padding: 0.35rem 0.625rem;
  text-transform: uppercase;
}

.shell {
  margin: 0 auto;
  max-width: 76rem;
  padding: 1.5rem 1rem calc(4rem + env(safe-area-inset-bottom));
}

.mode-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 0.25rem;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 1rem;
  padding: 0.25rem;
}

.mode-btn {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-size: 0.875rem;
  font-weight: 700;
  min-height: 2.75rem;
  padding: 0.625rem 0.75rem;
}

.mode-btn.active {
  background: var(--blue);
  color: #fff;
}

.mobile-role-switch {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: none;
  flex: 0 0 auto;
  gap: 0.125rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0.125rem;
}

.mobile-role-switch .mode-btn {
  color: var(--ink-muted);
  font-size: 0.7rem;
  min-height: 2.25rem;
  min-width: 3.25rem;
  padding: 0.3rem 0.45rem;
}

.mobile-role-switch .mode-btn.active {
  background: var(--blue);
  color: #fff;
}

.native-mobile .back-link {
  display: none;
}

.native-mobile .app-header {
  gap: 0.75rem;
  min-height: 3.75rem;
}

.native-mobile .brand {
  flex: 1 1 auto;
}

.native-mobile .brand p,
.native-mobile .header-status {
  display: none;
}

.native-mobile .mode-bar {
  display: none;
}

.native-mobile .mobile-role-switch {
  display: grid;
  margin-left: 0.25rem;
}

.notice {
  background: var(--amber-soft);
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  color: #7c2d12;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  padding: 0.875rem 1rem;
}

.crew-panel {
  margin-bottom: 1rem;
  padding: 1rem;
}

.crew-head {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.crew-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.file-btn {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.8125rem;
  font-weight: 800;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.625rem 0.8rem;
}

.crew-panel p {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  margin: 0.6rem 0 0;
}

.crew-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.crew-pill {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-muted);
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 700;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
}

.crew-pill strong {
  color: var(--ink);
  font-weight: 800;
}

.role-panel {
  display: none;
}

.role-panel.active {
  display: block;
}

.session-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

.session-panel,
.data-section,
.crew-panel,
.viewer-join,
.coach-main,
.coach-side,
.history-section,
.status-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.session-panel,
.viewer-join,
.coach-main,
.coach-side {
  box-shadow: var(--shadow);
}

.session-panel,
.viewer-join {
  padding: 1rem;
}

.section-head,
.coach-topline {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.coach-topline-actions {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.section-head.compact {
  align-items: center;
  padding: 1rem 1rem 0;
}

.section-kicker {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 0.2rem;
  text-transform: uppercase;
}

h2,
h3 {
  letter-spacing: 0;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.25;
  margin: 0;
}

h3 {
  font-size: 0.875rem;
  line-height: 1.3;
  margin: 0;
}

.session-state {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.35rem 0.55rem;
  text-transform: uppercase;
}

.session-state.live,
.status-dot.live {
  background: var(--green-soft);
  border-color: #99f6e4;
  color: var(--green);
}

.session-state.warn {
  background: var(--amber-soft);
  border-color: #fed7aa;
  color: var(--amber);
}

.field-label {
  color: var(--ink-muted);
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  margin: 1rem 0 0.4rem;
}

.control-row,
.join-controls {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.boat-size-row {
  align-items: end;
  display: grid;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.boat-size-row .field-label {
  margin: 0;
}

.seat-count-control {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 0.2rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0.2rem;
}

.seat-count-control button {
  background: transparent;
  border: 0;
  border-radius: 0.3rem;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 800;
  min-height: 2.5rem;
  padding: 0.4rem 0.5rem;
}

.seat-count-control button.active {
  background: var(--blue);
  color: #fff;
}

.text-input {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 1rem;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  width: 100%;
}

.code-input {
  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary-btn,
.action-btn,
.icon-btn {
  align-items: center;
  border-radius: var(--radius-sm);
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 2.75rem;
}

.primary-btn {
  background: var(--blue);
  border: 1px solid var(--blue);
  color: #fff;
  padding: 0.625rem 1rem;
}

.primary-btn:hover {
  background: var(--blue-dark);
}

.primary-btn.danger {
  background: var(--red);
  border-color: var(--red);
}

.primary-btn.danger:hover {
  background: var(--red);
  filter: brightness(0.9);
}

.action-btn {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 0.8125rem;
  padding: 0.625rem 0.8rem;
}

.action-btn.active,
.action-btn.strong {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.action-btn.danger {
  color: var(--red);
}

.action-btn.danger:hover {
  background: var(--red-soft);
}

.action-btn:disabled {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--ink-soft);
  cursor: not-allowed;
  opacity: 0.6;
}

.icon-btn {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--blue);
  flex: 0 0 auto;
  height: 2.75rem;
  padding: 0;
  width: 2.75rem;
}

.icon-btn svg {
  height: 1.1rem;
  width: 1.1rem;
}

.pair-box {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: auto 1fr auto;
  margin-top: 1rem;
  padding: 0.75rem;
}

.pair-box span {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-weight: 700;
}

.pair-box strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  line-height: 1;
  text-align: right;
}

.metric-strip {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 6.75rem;
  padding: 0.875rem;
}

.metric-card span,
.seat-card .seat-meta,
.coach-seat .seat-meta {
  color: var(--ink-soft);
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  font-family: var(--mono);
  font-size: 1.875rem;
  line-height: 1.1;
  margin-top: 0.4rem;
}

.metric-card em {
  color: var(--ink-soft);
  display: block;
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 700;
  margin-top: 0.1rem;
}

.analytics-strip {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1rem 0;
}

.analytics-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 5.25rem;
  padding: 0.7rem;
}

.analytics-card span {
  color: var(--ink-soft);
  display: block;
  font-size: 0.6875rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.analytics-card strong {
  color: var(--ink);
  display: block;
  font-family: var(--mono);
  font-size: 1.35rem;
  line-height: 1.05;
  margin-top: 0.35rem;
}

.analytics-card em {
  color: var(--ink-soft);
  display: block;
  font-size: 0.6875rem;
  font-style: normal;
  font-weight: 700;
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coach-analytics {
  margin-top: 0;
}

.tool-band {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1rem 0;
}

.data-section {
  overflow: hidden;
}

.seat-grid,
.coach-seat-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 1rem;
}

body[data-seat-count="1"] .seat-grid,
body[data-seat-count="1"] .coach-seat-grid {
  grid-template-columns: minmax(0, 1fr);
}

body[data-seat-count="2"] .seat-grid,
body[data-seat-count="2"] .coach-seat-grid,
body[data-seat-count="4"] .seat-grid,
body[data-seat-count="4"] .coach-seat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.seat-card,
.coach-seat {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 9.5rem;
  padding: 0.85rem;
}

.seat-card.live,
.coach-seat.live {
  background: var(--green-soft);
  border-color: #99f6e4;
}

.seat-card.stale,
.coach-seat.stale {
  background: var(--amber-soft);
  border-color: #fed7aa;
}

.seat-card.disconnected,
.coach-seat.disconnected {
  background: var(--red-soft);
  border-color: #fecaca;
}

.seat-top {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}

.seat-name {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
}

.status-dot {
  background: #e2e8f0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 800;
  padding: 0.25rem 0.4rem;
  text-transform: uppercase;
}

.status-dot.warn {
  background: var(--amber-soft);
  border-color: #fed7aa;
  color: var(--amber);
}

.status-dot.off {
  background: var(--red-soft);
  border-color: #fecaca;
  color: var(--red);
}

.seat-hr {
  align-items: baseline;
  display: flex;
  gap: 0.3rem;
  margin-top: 0.65rem;
}

.seat-hr strong {
  font-family: var(--mono);
  font-size: 2rem;
  line-height: 1;
}

.seat-hr span {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 800;
}

.seat-card p,
.coach-seat p,
.status-panel p {
  color: var(--ink-muted);
  font-size: 0.78rem;
  margin: 0.45rem 0 0;
  overflow-wrap: anywhere;
}

.seat-actions {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: 1fr 1fr;
  margin-top: 0.75rem;
}

.seat-actions button {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
  min-height: 2.5rem;
  padding: 0.45rem 0.5rem;
}

.status-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  margin-top: 1rem;
}

.status-panel {
  padding: 0.875rem;
}

.viewer-join {
  align-items: center;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 1rem;
}

.coach-dashboard {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

.coach-main,
.coach-side {
  padding: 1rem;
}

.coach-topline {
  align-items: center;
  margin-bottom: 1rem;
}

.coach-topline span {
  color: var(--ink-soft);
  display: block;
  font-size: 0.8125rem;
  font-weight: 800;
}

.coach-topline strong {
  display: block;
  font-size: 1.1rem;
  margin-top: 0.1rem;
}

.coach-strip {
  margin-bottom: 1rem;
}

.coach-seat-grid {
  padding: 0;
}

.coach-side dl {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0 0;
}

.coach-side dl div {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding-top: 0.75rem;
}

.coach-side dt {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.coach-side dd {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 800;
  margin: 0;
  text-align: right;
}

.history-section {
  margin-top: 1rem;
  padding: 1rem;
}

.history-head {
  align-items: flex-start;
  cursor: pointer;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  list-style: none;
}

.history-head::-webkit-details-marker {
  display: none;
}

.history-toggle-label {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  flex: 0 0 auto;
  font-size: 0.8125rem;
  font-weight: 800;
  min-width: 4rem;
  padding: 0.55rem 0.75rem;
  text-align: center;
}

.history-section .when-open {
  display: none;
}

.history-section[open] .when-open {
  display: inline;
}

.history-section[open] .when-closed {
  display: none;
}

.history-content {
  margin-top: 1rem;
}

.history-head p {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  margin: 0.25rem 0 0;
}

.history-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.zone-controls {
  align-items: end;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(6rem, 8rem)) minmax(0, 1fr);
  margin-top: 1rem;
  padding-top: 1rem;
}

.zone-controls label {
  display: grid;
  gap: 0.35rem;
}

.zone-controls label span {
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.compact-input {
  min-height: 2.5rem;
  padding-block: 0.45rem;
}

.native-mobile input,
.native-mobile textarea,
.native-mobile select {
  font-size: 1rem;
}

.zone-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.zone-chip,
.zone-badge {
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  display: inline-flex;
  font-family: var(--mono);
  font-weight: 800;
  text-transform: uppercase;
}

.zone-chip {
  font-size: 0.6875rem;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.35rem 0.5rem;
}

.zone-badge {
  font-size: 0.625rem;
  margin-top: 0.45rem;
  padding: 0.2rem 0.4rem;
}

.zone-chip::before {
  background: currentColor;
  border-radius: 999px;
  content: "";
  display: block;
  height: 0.5rem;
  width: 0.5rem;
}

.zone-z1 {
  color: var(--zone-z1);
}

.zone-z2 {
  color: var(--zone-z2);
}

.zone-z3 {
  color: var(--zone-z3);
}

.zone-z4 {
  color: var(--zone-z4);
}

.zone-z5 {
  color: var(--zone-z5);
}

.seat-card.live.zone-bg-z1,
.coach-seat.live.zone-bg-z1 {
  background: var(--zone-z1-bg);
  border-color: color-mix(in srgb, var(--zone-z1) 45%, white);
}

.seat-card.live.zone-bg-z2,
.coach-seat.live.zone-bg-z2 {
  background: var(--zone-z2-bg);
  border-color: color-mix(in srgb, var(--zone-z2) 45%, white);
}

.seat-card.live.zone-bg-z3,
.coach-seat.live.zone-bg-z3 {
  background: var(--zone-z3-bg);
  border-color: color-mix(in srgb, var(--zone-z3) 45%, white);
}

.seat-card.live.zone-bg-z4,
.coach-seat.live.zone-bg-z4 {
  background: var(--zone-z4-bg);
  border-color: color-mix(in srgb, var(--zone-z4) 45%, white);
}

.seat-card.live.zone-bg-z5,
.coach-seat.live.zone-bg-z5 {
  background: var(--zone-z5-bg);
  border-color: color-mix(in srgb, var(--zone-z5) 45%, white);
}

.history-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.history-empty {
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink-muted);
  font-size: 0.875rem;
  padding: 1rem;
}

.history-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 0.85rem;
  padding: 0.875rem;
}

.history-card-top {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.history-card h3 {
  font-size: 1rem;
  margin: 0;
}

.history-card time {
  color: var(--ink-muted);
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.1rem;
}

.history-source {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
}

.history-metrics {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.history-metrics div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 4.5rem;
  padding: 0.625rem;
}

.history-metrics span {
  color: var(--ink-soft);
  display: block;
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
}

.history-metrics strong {
  display: block;
  font-family: var(--mono);
  font-size: 1.35rem;
  line-height: 1.1;
  margin-top: 0.25rem;
}

.zone-bar {
  background: #e2e8f0;
  border-radius: 999px;
  display: flex;
  height: 0.75rem;
  overflow: hidden;
}

.zone-bar span {
  min-width: 0.125rem;
}

.zone-bar .z1 {
  background: var(--zone-z1);
}

.zone-bar .z2 {
  background: var(--zone-z2);
}

.zone-bar .z3 {
  background: var(--zone-z3);
}

.zone-bar .z4 {
  background: var(--zone-z4);
}

.zone-bar .z5 {
  background: var(--zone-z5);
}

.rate-spark {
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 0.125rem;
  height: 3.5rem;
  padding: 0.35rem;
}

.rate-spark span {
  background: var(--blue);
  border-radius: 999px 999px 0 0;
  flex: 1 1 0;
  min-height: 0.25rem;
}

.sr-only {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

@media (min-width: 48rem) {
  .shell {
    padding: 2rem 1.5rem 4rem;
  }

  .session-grid {
    grid-template-columns: minmax(22rem, 0.9fr) 1.1fr;
  }

  .metric-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .analytics-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .tool-band {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .seat-grid,
  .coach-seat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .viewer-join {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.65fr) auto;
  }

  .coach-dashboard {
    grid-template-columns: minmax(0, 1fr) 18rem;
  }

  .history-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 48rem) {
  body[data-seat-count="1"] .seat-grid,
  body[data-seat-count="1"] .coach-seat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-seat-count="2"] .seat-grid,
  body[data-seat-count="2"] .coach-seat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-seat-count="4"] .seat-grid,
  body[data-seat-count="4"] .coach-seat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 40rem) {
  .app-header {
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.4rem;
    padding: calc(0.75rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right)) 0.75rem calc(1rem + env(safe-area-inset-left));
  }

  .siq-logo,
  .header-status {
    display: none;
  }

  .mobile-role-switch {
    display: grid;
    margin-left: 0;
  }

  .mode-bar {
    display: none;
  }

  .brand {
    flex: 1 1 12rem;
  }

  .section-head {
    display: block;
  }

  .section-head .session-state {
    display: inline-block;
    margin-top: 0.6rem;
  }

  .pair-box {
    grid-template-columns: 1fr auto;
  }

  .pair-box span {
    grid-column: 1 / -1;
  }

  .pair-box strong {
    text-align: left;
  }

  .crew-head {
    align-items: stretch;
    display: grid;
  }

  .crew-actions {
    justify-content: stretch;
  }

  .crew-actions .file-btn {
    flex: 1 1 12rem;
  }

  .control-row,
  .join-controls {
    grid-template-columns: 1fr;
  }

  .seat-grid,
  .coach-seat-grid {
    grid-template-columns: 1fr;
  }

  .history-head,
  .history-card-top {
    display: block;
  }

  .history-actions {
    justify-content: stretch;
    margin-top: 0.75rem;
  }

  .history-actions .action-btn {
    flex: 1 1 9rem;
  }

  .zone-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .zone-legend {
    grid-column: 1 / -1;
  }
}

@media (max-width: 72rem), (max-height: 40rem) {
  body[data-role="coach"] {
    height: 100dvh;
    overflow: hidden;
  }

  body[data-role="coach"] .app-header {
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    min-height: calc(3.25rem + env(safe-area-inset-top));
    padding: calc(0.45rem + env(safe-area-inset-top)) calc(0.6rem + env(safe-area-inset-right)) 0.45rem calc(0.6rem + env(safe-area-inset-left));
  }

  body[data-role="coach"] .back-link {
    display: none;
  }

  body[data-role="coach"] .brand {
    flex: 1 1 auto;
    gap: 0.5rem;
  }

  body[data-role="coach"] .brand-mark {
    border-radius: var(--radius-sm);
    height: 2rem;
    width: 2rem;
  }

  body[data-role="coach"] .brand h1 {
    font-size: 0.95rem;
  }

  body[data-role="coach"] .brand p {
    display: none;
  }

  body[data-role="coach"] .header-status {
    font-size: 0.58rem;
    margin-left: auto;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: auto;
  }

  body[data-role="coach"] .shell {
    display: grid;
    gap: 0.4rem;
    grid-template-rows: minmax(0, 1fr);
    height: calc(100dvh - 3.25rem - env(safe-area-inset-top));
    overflow: hidden;
    padding: 0.5rem;
  }

  body[data-role="coach"] .mode-bar,
  body[data-role="coach"] .crew-panel,
  body[data-role="coach"] .coach-side,
  body[data-role="coach"] .history-section {
    display: none;
  }

  body[data-role="coach"] #coachPanel.active {
    display: grid;
    gap: 0.4rem;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
  }

  body[data-role="coach"].coach-connected #coachPanel.active {
    display: block;
  }

  body[data-role="coach"] .viewer-join {
    box-shadow: none;
    gap: 0.4rem;
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
    padding: 0.45rem;
  }

  body[data-role="coach"].coach-idle .viewer-join {
    background: var(--surface);
    border-color: #bfdbfe;
  }

  body[data-role="coach"].coach-connected .viewer-join {
    display: none;
  }

  body[data-role="coach"] .viewer-join > div:first-child,
  body[data-role="coach"] .viewer-join .session-state {
    display: none;
  }

  body[data-role="coach"] .join-controls {
    display: grid;
    gap: 0.35rem;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  body[data-role="coach"] .join-controls .text-input,
  body[data-role="coach"] .join-controls .primary-btn {
    font-size: 0.8rem;
    min-height: 2.25rem;
    padding-block: 0.4rem;
  }

  body[data-role="coach"] .join-controls .primary-btn {
    padding-inline: 1rem;
  }

  body[data-role="coach"] .coach-dashboard {
    display: block;
    height: 100%;
    min-height: 0;
  }

  body[data-role="coach"] .coach-main {
    box-shadow: none;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    height: 100%;
    overflow: hidden;
    padding: 0.55rem;
  }

  body[data-role="coach"].coach-idle .coach-main {
    align-items: center;
    grid-template-rows: minmax(0, 1fr);
    justify-items: center;
  }

  body[data-role="coach"] .coach-topline {
    align-items: start;
    margin-bottom: 0.4rem;
  }

  body[data-role="coach"].coach-idle .coach-topline {
    background: var(--surface-soft);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    display: grid;
    gap: 0.35rem;
    justify-items: center;
    margin: 0;
    max-width: 36rem;
    padding: 1.25rem;
    text-align: center;
    width: 100%;
  }

  body[data-role="coach"] .coach-topline span {
    font-size: 0.66rem;
  }

  body[data-role="coach"].coach-idle .coach-topline span {
    color: var(--blue);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  body[data-role="coach"] .coach-topline strong {
    font-size: 0.9rem;
    line-height: 1.15;
  }

  body[data-role="coach"].coach-idle .coach-topline strong {
    font-size: 1.2rem;
  }

  body[data-role="coach"] .coach-topline .action-btn {
    display: none;
  }

  body[data-role="coach"].coach-idle .coach-strip,
  body[data-role="coach"].coach-idle .coach-analytics,
  body[data-role="coach"].coach-idle .coach-seat-grid {
    display: none;
  }

  body[data-role="coach"] .coach-strip {
    gap: 0.35rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 0.35rem;
  }

  body[data-role="coach"] .coach-strip .metric-card {
    min-height: 3.8rem;
    padding: 0.45rem;
  }

  body[data-role="coach"] .coach-strip .metric-card span {
    font-size: 0.56rem;
  }

  body[data-role="coach"] .coach-strip .metric-card strong {
    font-size: 1.25rem;
    margin-top: 0.25rem;
  }

  body[data-role="coach"] .coach-strip .metric-card em {
    font-size: 0.58rem;
  }

  body[data-role="coach"] .coach-analytics {
    gap: 0.3rem;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 0 0 0.4rem;
  }

  body[data-role="coach"] .coach-analytics .analytics-card {
    min-height: 2.85rem;
    padding: 0.34rem;
  }

  body[data-role="coach"] .coach-analytics .analytics-card span {
    font-size: 0.46rem;
  }

  body[data-role="coach"] .coach-analytics .analytics-card strong {
    font-size: 0.72rem;
    margin-top: 0.18rem;
  }

  body[data-role="coach"] .coach-analytics .analytics-card em {
    display: none;
  }

  body[data-role="coach"] .coach-seat-grid {
    gap: 0.35rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    min-height: 0;
    overflow: hidden;
    padding: 0;
  }

  body[data-role="coach"][data-seat-count="1"] .coach-seat-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  body[data-role="coach"][data-seat-count="2"] .coach-seat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
  }

  body[data-role="coach"][data-seat-count="4"] .coach-seat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  body[data-role="coach"] .coach-seat {
    align-content: center;
    display: grid;
    gap: 0.3rem;
    grid-template-rows: auto auto auto;
    justify-items: start;
    min-height: 0;
    padding: 0.5rem 0.7rem;
  }

  body[data-role="coach"] .coach-seat .status-dot,
  body[data-role="coach"] .coach-seat .seat-meta,
  body[data-role="coach"] .coach-seat p,
  body[data-role="coach"] .coach-seat .zone-badge {
    display: none;
  }

  body[data-role="coach"] .coach-seat .seat-name {
    display: block;
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-role="coach"] .coach-seat .seat-hr {
    margin-top: 0.25rem;
  }

  body[data-role="coach"] .coach-seat .seat-hr strong {
    font-size: 1.32rem;
  }

  body[data-role="coach"] .coach-seat .seat-hr span {
    font-size: 0.58rem;
  }

  body[data-role="coach"] .coach-seat .seat-hr {
    align-self: center;
  }
}

@media (max-height: 40rem) {
  body[data-role="coach"] .app-header {
    display: none;
  }

  body[data-role="coach"] .shell {
    height: 100dvh;
    padding: 0.35rem;
  }

  body[data-role="coach"] .coach-main {
    padding: 0.4rem;
  }

  body[data-role="coach"] .coach-topline {
    margin-bottom: 0.25rem;
  }

  body[data-role="coach"] .coach-topline span {
    font-size: 0.6rem;
  }

  body[data-role="coach"] .coach-topline strong {
    font-size: 0.78rem;
  }

  body[data-role="coach"] .coach-strip {
    gap: 0.3rem;
    margin-bottom: 0.25rem;
  }

  body[data-role="coach"] .coach-strip .metric-card {
    min-height: 3.2rem;
    padding: 0.35rem;
  }

  body[data-role="coach"] .coach-strip .metric-card span {
    font-size: 0.5rem;
  }

  body[data-role="coach"] .coach-strip .metric-card strong {
    font-size: 1.05rem;
    margin-top: 0.18rem;
  }

  body[data-role="coach"] .coach-strip .metric-card em {
    font-size: 0.5rem;
  }

  body[data-role="coach"] .coach-analytics {
    gap: 0.25rem;
    margin-bottom: 0.25rem;
  }

  body[data-role="coach"] .coach-analytics .analytics-card {
    min-height: 2.25rem;
    padding: 0.25rem;
  }

  body[data-role="coach"] .coach-analytics .analytics-card span {
    font-size: 0.4rem;
  }

  body[data-role="coach"] .coach-analytics .analytics-card strong {
    font-size: 0.62rem;
    margin-top: 0.12rem;
  }

  body[data-role="coach"] .coach-seat-grid {
    gap: 0.3rem;
  }

  body[data-role="coach"] .coach-seat {
    padding: 0.34rem;
  }

  body[data-role="coach"] .coach-seat .seat-name {
    font-size: 0.64rem;
  }

  body[data-role="coach"] .coach-seat .seat-hr strong {
    font-size: 1.08rem;
  }

  body[data-role="coach"] .coach-seat .seat-hr span {
    font-size: 0.5rem;
  }

}

/* Portrait phones: 4 narrow columns become tall skinny strips, so use a
   2 x 4 grid with bigger HR instead. */
@media (max-width: 34rem) {
  body[data-role="coach"].coach-connected .coach-seat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }

  body[data-role="coach"].coach-connected[data-seat-count="1"] .coach-seat-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  body[data-role="coach"].coach-connected[data-seat-count="2"] .coach-seat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
  }

  body[data-role="coach"].coach-connected[data-seat-count="4"] .coach-seat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  body[data-role="coach"].coach-connected .coach-seat .seat-name {
    font-size: 0.95rem;
  }

  body[data-role="coach"].coach-connected .coach-seat .seat-hr strong {
    font-size: 2.4rem;
  }

  body[data-role="coach"].coach-connected .coach-seat .seat-hr span {
    font-size: 0.75rem;
  }
}

@media (max-width: 23rem) {
  body[data-role="coach"].coach-connected .coach-strip .metric-card strong,
  body[data-role="coach"].coach-connected .coach-seat .seat-hr strong {
    font-size: 1.1rem;
  }
}

/* Desktop coach "scoreboard". The fill-the-viewport layout above only kicks in
   on small/short screens (max-width: 72rem), so a normal monitor fell back to
   the compact card layout and wasted the lower half. Once a boat is connected,
   fill the whole screen with big, glanceable HR. Idle/join state is untouched. */
@media (min-width: 72.01rem) and (min-height: 40.01rem) {
  body[data-role="coach"].coach-connected {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
  }

  body[data-role="coach"].coach-connected .app-header {
    flex: 0 0 auto;
  }

  body[data-role="coach"].coach-connected .mode-bar,
  body[data-role="coach"].coach-connected .crew-panel,
  body[data-role="coach"].coach-connected .history-section,
  body[data-role="coach"].coach-connected .viewer-join {
    display: none;
  }

  body[data-role="coach"].coach-connected .shell {
    display: grid;
    flex: 1 1 auto;
    grid-template-rows: minmax(0, 1fr);
    max-width: none;
    min-height: 0;
    overflow: hidden;
    padding: 1rem 1.25rem 1.25rem;
  }

  body[data-role="coach"].coach-connected #coachPanel.active {
    display: block;
    height: 100%;
    min-height: 0;
  }

  body[data-role="coach"].coach-connected .coach-dashboard {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    position: relative;
  }

  body[data-role="coach"].coach-connected .coach-main {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  /* Session health is secondary: hidden by default so the seat grid keeps the
     full width (HR never clips), revealed on demand via the topline toggle. */
  body[data-role="coach"].coach-connected #toggleHealthBtn {
    display: inline-flex;
    position: relative;
    z-index: 7;
  }

  body[data-role="coach"].coach-connected .coach-side {
    display: none;
  }

  body[data-role="coach"].coach-connected.coach-show-health .coach-side {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    display: block;
    margin: 0;
    max-height: calc(100% - 3.75rem);
    overflow: auto;
    padding: 1rem 1.1rem;
    position: absolute;
    right: 0;
    top: 3.75rem;
    width: 17rem;
    z-index: 6;
  }

  body[data-role="coach"].coach-connected .coach-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 0.85rem;
  }

  body[data-role="coach"].coach-connected .coach-strip .metric-card {
    min-height: 0;
    padding: 0.85rem 1rem;
  }

  body[data-role="coach"].coach-connected .coach-strip .metric-card strong {
    font-size: 2.6rem;
  }

  body[data-role="coach"].coach-connected .coach-analytics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 0.85rem;
  }

  body[data-role="coach"].coach-connected .coach-analytics .analytics-card strong {
    font-size: 1.5rem;
  }

  body[data-role="coach"].coach-connected .coach-seat-grid {
    gap: 0.85rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    height: 100%;
    min-height: 0;
    padding: 0;
  }

  body[data-role="coach"].coach-connected[data-seat-count="1"] .coach-seat-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  body[data-role="coach"].coach-connected[data-seat-count="2"] .coach-seat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
  }

  body[data-role="coach"].coach-connected[data-seat-count="4"] .coach-seat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
  }

  body[data-role="coach"].coach-connected .coach-seat {
    align-content: center;
    display: grid;
    gap: 0.5rem;
    grid-template-rows: auto auto auto;
    justify-items: start;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    padding: 1rem 1.4rem;
  }

  body[data-role="coach"].coach-connected .coach-seat p,
  body[data-role="coach"].coach-connected .coach-seat .seat-meta {
    display: none;
  }

  body[data-role="coach"].coach-connected .coach-seat .seat-name {
    font-size: 1.25rem;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-role="coach"].coach-connected .coach-seat .zone-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-role="coach"].coach-connected .coach-seat .seat-hr {
    margin-top: 0;
  }

  body[data-role="coach"].coach-connected .coach-seat .seat-hr strong {
    font-size: clamp(2.75rem, 7vh, 5.5rem);
    line-height: 1;
  }

  body[data-role="coach"].coach-connected .coach-seat .seat-hr span {
    font-size: 1.05rem;
  }

  body[data-role="coach"].coach-connected .coach-seat .zone-badge {
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   Glance-first refinements: hero split, tabular digits,
   fat touch targets. (Layout unchanged elsewhere.)
   ============================================================ */

.metric-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  min-height: auto;
  text-align: center;
}

.metric-card strong {
  font-variant-numeric: tabular-nums;
}

.metric-card.hero {
  grid-column: 1 / -1;
  padding: 1rem 0.875rem 1.125rem;
}

.metric-card.hero strong {
  font-size: 3.4rem;
  letter-spacing: -0.02em;
}

.action-btn,
.primary-btn {
  min-height: 3rem;
}

.seat-card .seat-hr strong {
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Dark theme — rides the suite's moon toggle (data-theme="dark").
   suite.js defaults to the phone's system appearance when the
   user hasn't chosen explicitly. html[...] outranks the per-app
   inline style block so this full palette wins.
   Same zone-color language: deep zone fills, light text.
   ============================================================ */

html[data-theme="dark"] {
  color-scheme: dark;
  --blue: #378add;
  --blue-dark: #4f9ae4;
  --green: #1d9e75;
  --green-soft: #0a2e24;
  --amber: #ef9f27;
  --amber-soft: #2e2008;
  --red: #e24b4a;
  --red-soft: #341010;
  --ink: #f2f4f6;
  --ink-muted: #b9c2cc;
  --ink-soft: #8a93a0;
  --line: #262c35;
  --line-strong: #333b47;
  --page: #0e1114;
  --surface: #161a20;
  --surface-soft: #1b2129;
  --shadow: 0 0 0 rgba(0, 0, 0, 0);
  --zone-z1: #5dcaa5;
  --zone-z1-bg: #085041;
  --zone-z2: #85b7eb;
  --zone-z2-bg: #0c447c;
  --zone-z3: #fac775;
  --zone-z3-bg: #633806;
  --zone-z4: #f0997b;
  --zone-z4-bg: #712b13;
  --zone-z5: #f09595;
  --zone-z5-bg: #501313;
}

html[data-theme="dark"] .seat-card.live.zone-bg-z1, html[data-theme="dark"] .coach-seat.live.zone-bg-z1,
html[data-theme="dark"] .seat-card.live.zone-bg-z2, html[data-theme="dark"] .coach-seat.live.zone-bg-z2,
html[data-theme="dark"] .seat-card.live.zone-bg-z3, html[data-theme="dark"] .coach-seat.live.zone-bg-z3,
html[data-theme="dark"] .seat-card.live.zone-bg-z4, html[data-theme="dark"] .coach-seat.live.zone-bg-z4,
html[data-theme="dark"] .seat-card.live.zone-bg-z5, html[data-theme="dark"] .coach-seat.live.zone-bg-z5 {
  border-color: transparent;
}

html[data-theme="dark"] .seat-card.live .seat-hr strong,
html[data-theme="dark"] .coach-seat.live .seat-hr strong {
  color: #ffffff;
}

/* ============================================================
   Compact seat tiles — 3 across, name + bpm as the story.
   ============================================================ */

.seat-grid,
.coach-seat-grid {
  gap: 0.5rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0.75rem;
}

.seat-card,
.coach-seat {
  min-height: 0;
  padding: 0.6rem 0.65rem;
}

.seat-card p,
.seat-card .zone-badge,
.coach-seat .zone-badge {
  display: none;
}

.seat-card .seat-meta,
.coach-seat .seat-meta {
  font-size: 0.65rem;
  margin-top: 0.15rem;
}

.seat-name {
  font-size: 0.8rem;
}

.status-dot {
  font-size: 0.55rem;
  padding: 0.15rem 0.3rem;
}

.seat-hr {
  margin-top: 0.35rem;
}

.seat-hr strong {
  font-size: 1.7rem;
}

.seat-actions {
  gap: 0.3rem;
}

.seat-actions button {
  font-size: 0.7rem;
  min-height: 2.1rem;
  padding: 0.3rem 0.4rem;
}

/* ============================================================
   Density pass — less air, more data on one screen.
   ============================================================ */

.shell {
  padding: 0.75rem 0.75rem calc(2.5rem + env(safe-area-inset-bottom));
}

.session-grid {
  gap: 0.6rem;
}

.session-panel,
.viewer-join {
  padding: 0.75rem;
}

.crew-panel {
  margin-bottom: 0.6rem;
  padding: 0.75rem;
}

.mode-bar {
  margin-bottom: 0.6rem;
}

.section-head h2 {
  font-size: 1.05rem;
  margin: 0.1rem 0 0;
}

.metric-strip {
  gap: 0.5rem;
}

.metric-card {
  padding: 0.6rem 0.5rem;
}

.metric-card.hero {
  padding: 0.7rem 0.6rem 0.85rem;
}

.section-head.compact {
  padding: 0.75rem 0.75rem 0;
}

.seat-grid,
.coach-seat-grid {
  padding: 0.6rem;
}

.tool-band {
  gap: 0.5rem;
}

/* --- Seat drag-to-swap affordances --- */

.seat-card {
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.seat-card.dragging {
  opacity: 0.55;
  outline: 2px dashed var(--blue);
  outline-offset: 2px;
}

.seat-card.drop-target {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
