/* Colour tokens (Dark / Sun palettes) live in tokens.css so pages that do not
   use this stylesheet (admin/ops tools, /home) share the same themes. */
@import url("/tokens.css");

:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  color: var(--pv-text);
  background: var(--pv-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, var(--pv-bg-glow), transparent 30rem),
    linear-gradient(180deg, var(--pv-bg) 0%, var(--pv-bg-end) 100%);
  background-attachment: fixed;
  color: var(--pv-text);
  background-color: var(--pv-bg);
}

button,
a,
input,
select,
textarea {
  font: inherit;
}

a {
  color: var(--pv-primary);
}

input,
select,
textarea {
  min-width: 0;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 12px 13px;
  background: var(--pv-input);
  color: var(--pv-text);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--pv-primary);
  outline: 3px solid color-mix(in srgb, var(--pv-primary) 20%, transparent);
}

.shell {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(360px, 1.18fr);
  gap: clamp(14px, 2.4vw, 24px);
  min-height: 100vh;
  padding: clamp(16px, 3vw, 32px);
}

.workflow,
.device-surface,
.ops-dashboard {
  align-self: start;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  background: var(--pv-surface);
  box-shadow: var(--pv-shadow);
}

.workflow {
  position: sticky;
  top: 24px;
  padding: clamp(20px, 3vw, 30px);
}

.device-surface,
.ops-dashboard {
  padding: clamp(16px, 2.4vw, 24px);
}

.ops-dashboard {
  display: grid;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--pv-primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  color: var(--pv-text);
  font-size: clamp(2rem, 3.2vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: var(--pv-text);
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 4px;
  color: var(--pv-text);
  font-size: 1.04rem;
}

.summary {
  max-width: 560px;
  margin-bottom: 22px;
  color: var(--pv-text-dim);
  font-size: 1rem;
}

.stages {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  margin: 0 0 22px;
  list-style: none;
}

.stage {
  position: relative;
  display: grid;
  gap: 8px;
  justify-items: center;
  color: var(--pv-text-dim);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stage::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--pv-border);
  border-radius: 999px;
  background: var(--pv-surface);
  box-shadow: 0 0 0 4px var(--pv-surface);
  z-index: 1;
}

.stage::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--pv-border);
}

.stage:last-child::after {
  display: none;
}

.stage[data-state="active"] {
  color: var(--pv-primary);
}

.stage[data-state="active"]::before {
  border-color: var(--pv-primary);
  background: var(--pv-primary);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--pv-primary) 18%, transparent);
}

.stage[data-state="complete"],
.stage[data-state="completed"] {
  color: var(--pv-success);
}

.stage[data-state="complete"]::before,
.stage[data-state="completed"]::before {
  border-color: var(--pv-success);
  background: var(--pv-success);
}

.stage[data-state="complete"]::after,
.stage[data-state="completed"]::after {
  background: var(--pv-success);
}

/* "upcoming" is the default dim appearance; explicit rule keeps intent clear */
.stage[data-state="upcoming"] {
  color: var(--pv-text-dim);
}

/* Error state: active stage has a problem (e.g. BLE denied, service failure) */
.stage[data-state="error"] {
  color: var(--pv-danger);
}

.stage[data-state="error"]::before {
  border-color: var(--pv-danger);
  background: var(--pv-danger);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--pv-danger) 18%, transparent);
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.primary-action {
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--pv-primary);
  background: var(--pv-primary);
  color: var(--pv-on-primary);
  font-size: 1.03rem;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--pv-primary) 18%, transparent);
}

.audio-mode-field {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 14px;
  background: var(--pv-surface-alt);
}

.audio-mode-field legend {
  padding: 0 6px;
  color: var(--pv-text-dim);
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
}

.audio-mode-field label {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--pv-input);
  font-weight: 900;
}

.practice-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.practice-actions .secondary-action {
  grid-column: 1 / -1;
  width: 100%;
}

.segment-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.segment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--pv-surface-alt);
}

.segment-row[data-state="recording"] {
  border-color: var(--pv-danger);
  background: color-mix(in srgb, var(--pv-danger) 12%, transparent);
}

.segment-label,
.segment-status,
.segment-time {
  min-width: 0;
  font-weight: 900;
}

.segment-status {
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--pv-input);
  color: var(--pv-text);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.messages-shell {
  grid-template-columns: minmax(320px, 0.82fr) minmax(360px, 1.18fr);
}

.message-form {
  display: grid;
  gap: 10px;
}

.message-form label {
  color: var(--pv-text-dim);
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
}

.message-form input,
.message-form select,
.message-form textarea {
  width: 100%;
}

.messages-surface {
  display: grid;
  gap: 18px;
}

.thread-list {
  display: grid;
  gap: 8px;
}

.thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--pv-surface-alt);
  color: var(--pv-text);
  cursor: pointer;
  text-align: left;
}

.thread-row[data-selected="true"] {
  border-color: var(--pv-primary);
  background: color-mix(in srgb, var(--pv-primary) 12%, transparent);
}

.thread-subject {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 900;
}

.thread-meta,
.thread-participants,
.message-item time {
  color: var(--pv-text-dim);
  font-size: 0.88rem;
}

.thread-detail {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--pv-border);
  padding-top: 18px;
}

.message-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.message-item {
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--pv-input);
}

.message-item p {
  margin: 6px 0;
  overflow-wrap: anywhere;
}

.reply-form {
  border-top: 1px solid var(--pv-border);
  padding-top: 18px;
}

.segment-row[data-state="recording"] .segment-status {
  background: color-mix(in srgb, var(--pv-danger) 20%, transparent);
  color: var(--pv-danger-text);
}

.segment-time {
  color: var(--pv-text-dim);
  font-variant-numeric: tabular-nums;
}

.ble-panel {
  display: grid;
  gap: 14px;
  margin: 0 0 20px;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 16px;
  background: var(--pv-surface-alt);
}

.ble-panel[data-state="fallback"],
.ble-panel[data-state="error"] {
  border-color: color-mix(in srgb, var(--pv-accent) 60%, transparent);
  background: color-mix(in srgb, var(--pv-accent) 12%, transparent);
}

.ble-panel[data-state="available"],
.ble-panel[data-state="connected"] {
  border-color: color-mix(in srgb, var(--pv-success) 60%, transparent);
  background: color-mix(in srgb, var(--pv-success) 12%, transparent);
}

.ble-status-line {
  display: flex;
  gap: 14px;
  align-items: start;
  justify-content: space-between;
}

.ble-title {
  margin: 0 0 6px;
  font-size: 1.06rem;
}

.ble-detail,
.ble-fallback-note {
  margin: 0;
  color: var(--pv-text-dim);
  font-size: 0.96rem;
}

.ble-badge {
  min-width: 98px;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--pv-input);
  color: var(--pv-text);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.ble-badge[data-state="available"],
.ble-badge[data-state="connected"] {
  background: color-mix(in srgb, var(--pv-success) 18%, transparent);
  color: var(--pv-success-text);
}

.ble-badge[data-state="fallback"],
.ble-badge[data-state="error"],
.ble-badge[data-state="working"] {
  background: color-mix(in srgb, var(--pv-accent) 18%, transparent);
  color: var(--pv-accent-text);
}

.ble-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ble-action {
  width: 100%;
  min-height: 58px;
}

.viewer-body {
  min-height: 100vh;
  background: #10181d;
  color: #f3f7f8;
}

.viewer-shell {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr;
  gap: clamp(14px, 2vw, 24px);
  padding: clamp(14px, 2.2vw, 32px);
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.viewer-header h1 {
  color: #ffffff;
  font-size: clamp(1.8rem, 2.8rem, 2.8rem);
}

.viewer-status {
  min-width: 132px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 6px;
  background: rgb(255 255 255 / 8%);
  color: #ffffff;
  font-weight: 700;
  padding: 10px 14px;
  text-align: center;
}

.viewer-status-group {
  display: grid;
  gap: 8px;
  justify-items: end;
  min-width: 0;
}

.viewer-screen {
  max-width: 280px;
  overflow: hidden;
  color: #a9bbc4;
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-status[data-status="playing"] {
  border-color: color-mix(in srgb, var(--pv-success) 60%, transparent);
  background: color-mix(in srgb, var(--pv-success) 18%, transparent);
}

.viewer-status[data-status="degraded"] {
  border-color: color-mix(in srgb, var(--pv-accent) 72%, transparent);
  background: color-mix(in srgb, var(--pv-accent) 18%, transparent);
}

.viewer-status[data-status="error"] {
  border-color: color-mix(in srgb, var(--pv-danger) 70%, transparent);
  background: color-mix(in srgb, var(--pv-danger) 18%, transparent);
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 16px;
  align-content: start;
}

.camera-tile {
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 8px;
  background: #17242b;
  box-shadow: 0 20px 55px rgb(0 0 0 / 22%);
}

.camera-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #22343d;
}

.camera-tile canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #22343d;
}

.camera-offline {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgb(16 24 29 / 78%);
  color: #ffffff;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  font-weight: 900;
}

.camera-tile[data-camera-state="offline"] {
  border-color: color-mix(in srgb, var(--pv-accent) 58%, transparent);
}

.camera-tile[data-camera-state="offline"] canvas {
  filter: grayscale(1) brightness(0.58);
}

.camera-tile[data-camera-state="offline"] .camera-offline {
  display: grid;
}

.camera-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 16px;
}

.camera-meta h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1rem;
  letter-spacing: 0;
}

.camera-meta p {
  margin: 4px 0 0;
  color: #a9bbc4;
  font-size: 0.88rem;
}

.camera-meta dl {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 10px;
  margin: 0;
}

.camera-meta dt {
  color: #a9bbc4;
  font-size: 0.72rem;
}

.camera-meta dd {
  margin: 2px 0 0;
  color: #ffffff;
  font-weight: 700;
}

@media (max-width: 640px) {
  .checks {
    grid-template-columns: 1fr;
  }

  .viewer-shell {
    padding: 14px;
  }

  .viewer-header,
  .camera-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .viewer-status-group {
    justify-items: stretch;
  }

  .viewer-screen {
    max-width: 100%;
  }

  .viewer-status {
    text-align: left;
  }

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

@media (min-width: 1100px) {
  .camera-grid:has(.camera-tile:only-child) {
    grid-template-columns: minmax(0, 1fr);
  }
}
.secondary-action {
  min-width: 116px;
  padding: 0 18px;
  border: 1px solid var(--pv-border);
  background: transparent;
  color: var(--pv-primary);
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: wait;
  opacity: 0.62;
}

.error {
  margin: 18px 0 0;
  border-left: 5px solid var(--pv-danger);
  padding: 12px 14px;
  background: color-mix(in srgb, var(--pv-danger) 12%, transparent);
  color: var(--pv-danger-text);
  font-weight: 700;
}

.surface-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.service-route {
  color: var(--pv-text-dim);
  font-size: 0.82rem;
  font-weight: 800;
}

.ops-refresh {
  min-height: 44px;
}

.ops-status {
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--pv-surface-alt);
  color: var(--pv-text);
  font-weight: 900;
}

.ops-status[data-status="ok"] {
  border-color: color-mix(in srgb, var(--pv-success) 60%, transparent);
  background: color-mix(in srgb, var(--pv-success) 12%, transparent);
  color: var(--pv-success-text);
}

.ops-status[data-status="degraded"],
.ops-status[data-status="loading"] {
  border-color: color-mix(in srgb, var(--pv-accent) 60%, transparent);
  background: color-mix(in srgb, var(--pv-accent) 12%, transparent);
  color: var(--pv-accent-text);
}

.ops-status[data-status="down"],
.ops-status[data-status="error"] {
  border-color: color-mix(in srgb, var(--pv-danger) 60%, transparent);
  background: color-mix(in srgb, var(--pv-danger) 12%, transparent);
  color: var(--pv-danger-text);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.metric-tile {
  min-height: 92px;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--pv-surface-alt);
}

.metric-tile dt {
  color: var(--pv-text-dim);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-tile dd {
  margin: 8px 0 0;
  color: var(--pv-text);
  font-size: 1.45rem;
  font-weight: 900;
}

.ops-lists {
  display: grid;
  gap: 14px;
}

.ops-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 8px 0 0;
  list-style: none;
}

.ops-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 10px;
  background: var(--pv-surface-alt);
}

.ops-row-badge {
  border-radius: 999px;
  padding: 6px 8px;
  background: var(--pv-input);
  color: var(--pv-text);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.ops-row[data-status="active"] .ops-row-badge,
.ops-row[data-status="completed"] .ops-row-badge {
  background: color-mix(in srgb, var(--pv-success) 18%, transparent);
  color: var(--pv-success-text);
}

.ops-row[data-status="running"] .ops-row-badge {
  background: color-mix(in srgb, var(--pv-primary) 18%, transparent);
  color: var(--pv-primary-text);
}

.ops-row[data-status="degraded"] .ops-row-badge,
.ops-row[data-status="warn"] .ops-row-badge {
  background: color-mix(in srgb, var(--pv-accent) 18%, transparent);
  color: var(--pv-accent-text);
}

.ops-row[data-status="failed"] .ops-row-badge,
.ops-row[data-status="error"] .ops-row-badge {
  background: color-mix(in srgb, var(--pv-danger) 18%, transparent);
  color: var(--pv-danger-text);
}

.ops-row-body {
  display: grid;
  min-width: 0;
}

.ops-row-body strong,
.ops-row-body span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-row-body span,
.ops-empty {
  color: var(--pv-text-dim);
  font-size: 0.86rem;
}

.ops-empty {
  min-height: 44px;
  border: 1px dashed var(--pv-border);
  border-radius: 8px;
  padding: 12px;
}

.device-list {
  display: grid;
  gap: 12px;
}

.device-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 92px;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 14px;
  background: var(--pv-surface-alt);
}

.device-row[data-selected="true"] {
  border-color: var(--pv-primary);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pv-primary) 45%, transparent);
}

.device-body {
  min-width: 0;
}

.device-body p,
.empty-state {
  margin-bottom: 0;
  color: var(--pv-text-dim);
}

.empty-state {
  border: 1px dashed var(--pv-border);
  border-radius: 8px;
  padding: 16px;
  background: color-mix(in srgb, var(--pv-input) 70%, transparent);
}

.empty-state-teaching {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.empty-state-icon {
  font-size: 2rem;
  line-height: 1;
}

.empty-state-title {
  margin: 0;
  color: var(--pv-text);
  font-size: 1rem;
  font-weight: 900;
}

.empty-state-body {
  max-width: 34rem;
  margin: 0;
  color: var(--pv-text-dim);
  line-height: 1.45;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.device-status {
  min-width: 112px;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--pv-input);
  color: var(--pv-text);
  text-align: center;
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
}

.device-status[data-connection="paired"] {
  background: color-mix(in srgb, var(--pv-success) 18%, transparent);
  color: var(--pv-success-text);
}

.device-status[data-connection="error"] {
  background: color-mix(in srgb, var(--pv-danger) 18%, transparent);
  color: var(--pv-danger-text);
}

.qa-links {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-self: end;
}

.qa-links a {
  color: var(--pv-primary);
  font-weight: 800;
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .workflow {
    position: static;
  }
}

@media (max-width: 560px) {
  .surface-heading,
  .ble-status-line,
  .device-row {
    align-items: stretch;
  }

  .surface-heading,
  .ble-status-line {
    flex-direction: column;
  }

  .ble-actions {
    grid-template-columns: 1fr;
  }

  .device-row {
    grid-template-columns: 1fr;
  }

  .device-status,
  .secondary-action {
    width: 100%;
  }

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

  .ops-row {
    grid-template-columns: 1fr;
  }
}

/* FEAT-21 · Report Portal (CLT-3) */
.report-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.report-id-label { font-weight: 600; font-size: 0.85rem; }
.report-id-input { flex: 1 1 16rem; padding: 0.6rem 0.75rem; border: 1px solid var(--pv-border); border-radius: 8px; font: inherit; }
.report-detail { display: flex; flex-direction: column; gap: 1.25rem; }
.report-header { display: flex; align-items: center; gap: 0.75rem; }
.report-name { margin: 0; }
.report-meta { color: var(--pv-text-dim); font-size: 0.85rem; margin: 0; }
.report-badge { font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px; letter-spacing: 0.04em; }
.report-badge-ready { background: color-mix(in srgb, var(--pv-success) 18%, transparent); color: var(--pv-success-text); }
.report-badge-partial { background: color-mix(in srgb, var(--pv-accent) 18%, transparent); color: var(--pv-accent-text); }
.report-section { border-top: 1px solid var(--pv-border); padding-top: 0.85rem; }
.report-section-title { margin: 0 0 0.5rem; font-size: 0.95rem; }
.report-summary { margin: 0; line-height: 1.5; }
.report-list { margin: 0; padding-left: 1.2rem; line-height: 1.5; }
.report-swimmer { margin: 0.5rem 0 0.25rem; font-size: 0.9rem; }
.report-pending { color: var(--pv-accent-text); margin: 0.15rem 0; font-size: 0.85rem; }
.recipient-scope { display: flex; flex-direction: column; gap: 0.4rem; margin: 0; }
.recipient-scope-label { color: var(--pv-text-dim); font-size: 0.85rem; }
.recipient-scope-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.recipient-scope-chip { background: color-mix(in srgb, var(--pv-success) 14%, transparent); border: 1px solid var(--pv-border); border-radius: 999px; color: var(--pv-success-text); font-size: 0.78rem; font-weight: 700; padding: 0.2rem 0.55rem; }
.report-media-uploading { color: var(--pv-primary-text); font-size: 0.85rem; margin: 0 0 0.5rem; font-style: italic; }
.report-media-warning { color: var(--pv-accent-text); font-size: 0.85rem; margin: 0 0 0.5rem; }
.report-media-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0.4rem 0; }
.report-media-label { font-weight: 600; font-size: 0.85rem; }
.report-audio { width: 100%; max-width: 28rem; }
.report-video { width: 100%; max-width: 40rem; background: #000; border-radius: 6px; }
.report-media-error { color: var(--pv-danger); font-size: 0.8rem; }
.report-transcript { display: flex; flex-direction: column; gap: 0.25rem; }
.report-cue { display: flex; gap: 0.6rem; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 0.35rem 0.5rem; cursor: pointer; font: inherit; }
.report-cue:hover { background: var(--pv-surface-alt); }
.report-cue[data-active="true"] { background: color-mix(in srgb, var(--pv-primary) 14%, transparent); border-color: var(--pv-primary); }
.report-cue-time { color: var(--pv-success-text); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.8rem; }
.report-cue-text { flex: 1; }
.report-media-link { color: var(--pv-success-text); font-weight: 600; }
/* Issue #604 — chronological interleave of clips + transcript cues. */
.report-timeline { display: flex; flex-direction: column; gap: 0.4rem; border-left: 2px solid var(--pv-border); padding-left: 0.75rem; }
.report-timeline-clip { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.3rem 0; }
.report-timeline-time { color: var(--pv-success-text); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.report-fragments { display: flex; flex-direction: column; gap: 0.35rem; }
.report-fragment { display: grid; grid-template-columns: minmax(5.5rem, auto) 1fr; gap: 0.7rem; align-items: center; font-size: 0.86rem; }
.report-fragment-time { color: var(--pv-success-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.report-fragment-label { color: var(--pv-text); overflow-wrap: anywhere; }
.report-snapshots { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.5rem; }
.report-snapshot { border: 1px solid var(--pv-border); border-radius: 8px; padding: 0.55rem; display: flex; flex-direction: column; gap: 0.25rem; background: var(--pv-surface-alt); }
.report-snapshot-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--pv-surface-alt); }
.report-snapshot-placeholder { width: 100%; aspect-ratio: 16 / 9; border-radius: 6px; background: linear-gradient(135deg, var(--pv-surface-alt), var(--pv-border)); border: 1px dashed var(--pv-border); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; padding: 0.5rem; }
.report-snapshot-placeholder-badge { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--pv-success-text); background: var(--pv-surface); border-radius: 999px; padding: 0.1rem 0.5rem; border: 1px solid var(--pv-border); }
.report-snapshot-placeholder-keyword { font-weight: 700; color: var(--pv-text); font-size: 0.85rem; text-align: center; overflow-wrap: anywhere; }
.report-snapshot-placeholder-note { color: var(--pv-text-dim); font-size: 0.72rem; text-align: center; }
.report-snapshot-keyword { font-weight: 700; color: var(--pv-text); }
.report-snapshot-time { color: var(--pv-success-text); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.report-snapshot-key { color: var(--pv-text-dim); font-size: 0.78rem; overflow-wrap: anywhere; }

/* FEAT-28 · MVF session workflow (CLT-1) */
.stop-action { background: var(--pv-danger); color: var(--pv-on-danger); border: none; border-radius: 10px; padding: 0.75rem 1.5rem; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; }
.stop-action:hover { background: var(--pv-danger-strong); }
.stop-action:disabled { opacity: 0.55; cursor: not-allowed; }
.report-open-link { display: inline-block; text-decoration: none; text-align: center; }
.recording-indicator { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.rec-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--pv-danger); animation: recpulse 1.2s ease-in-out infinite; flex-shrink: 0; }
@keyframes recpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.elapsed-display { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.15rem; color: var(--pv-danger); }
.rec-label { font-size: 0.85rem; color: var(--pv-text-dim); }
.mic-banner { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.75rem; border-radius: 8px; background: color-mix(in srgb, var(--pv-accent) 14%, transparent); border: 1px solid var(--pv-accent); font-size: 0.875rem; color: var(--pv-accent-text); }
.mic-banner[hidden] { display: none; }
#session-panel { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
#record-section, #provision-section, #report-section { display: flex; flex-direction: column; gap: 0.75rem; }

/* FEAT-22 · Report Portal share panel */
.review-panel { margin-top: 1.5rem; border-top: 1px solid var(--pv-border); padding-top: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.review-panel[hidden] { display: none; }
.review-panel-title { margin: 0 0 0.4rem; font-size: 1rem; }
.review-status { margin: 0; color: var(--pv-text-dim); font-size: 0.88rem; }
.share-panel { margin-top: 1.5rem; border-top: 1px solid var(--pv-border); padding-top: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.share-panel[hidden] { display: none; }
.share-panel-title { margin: 0 0 0.4rem; font-size: 1rem; }
.share-mode { display: flex; flex-direction: column; gap: 0.5rem; }
.share-mode-title { margin: 0; font-size: 0.9rem; color: var(--pv-text); }
.share-url-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.share-url-input { flex: 1 1 14rem; padding: 0.5rem 0.6rem; border: 1px solid var(--pv-border); border-radius: 8px; font: inherit; font-size: 0.85rem; background: var(--pv-input); color: var(--pv-text); }
.copy-feedback { color: var(--pv-success-text); font-weight: 600; font-size: 0.85rem; margin: 0; }
.section-share-form { border-top: 1px solid var(--pv-border); padding-top: 0.85rem; display: flex; flex-direction: column; gap: 0.75rem; }
.section-share-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.65rem; }
.section-share-fields label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; font-weight: 700; color: var(--pv-text-dim); }
.section-share-fields input, .section-share-fields select { padding: 0.5rem 0.6rem; border: 1px solid var(--pv-border); border-radius: 8px; font: inherit; color: var(--pv-text); background: var(--pv-input); min-width: 0; }
.section-share-sections { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.section-share-sections legend { padding: 0; font-size: 0.8rem; font-weight: 700; color: var(--pv-text-dim); }
.section-share-options { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.section-share-option { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--pv-border); border-radius: 8px; padding: 0.35rem 0.5rem; font-size: 0.82rem; background: var(--pv-surface-alt); }
.section-share-link { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.45rem; }
.section-share-recipient { font-weight: 700; font-size: 0.85rem; }
.section-share-section-list { color: var(--pv-text-dim); font-size: 0.8rem; }

/* FEAT-22 · Shared-view banner (anonymous access) */
.shared-view-banner { background: color-mix(in srgb, var(--pv-primary) 12%, transparent); border: 1px solid var(--pv-border); border-radius: 8px; padding: 0.6rem 0.9rem; font-size: 0.88rem; color: var(--pv-primary-text); font-weight: 600; margin-bottom: 0.75rem; }

.report-shell {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1280px;
  margin-inline: auto;
}

.report-shell .workflow {
  position: static;
}

.report-shell .workflow,
.report-shell .device-surface {
  width: 100%;
}

.report-shell .workflow {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.report-shell .report-form {
  max-width: 52rem;
}

.report-shell .review-panel,
.report-shell .share-panel {
  max-width: 52rem;
}

.report-shell .device-surface {
  padding: clamp(20px, 3vw, 30px);
}

/* Report browse list (reports.html) */
.reports-toolbar {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}
.reports-field {
  display: grid;
  gap: 6px;
  color: var(--pv-text-dim);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}
.reports-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.report-filter-chip {
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 8px 11px;
  background: var(--pv-input);
  color: var(--pv-text);
  cursor: pointer;
}
.report-filter-chip.is-active {
  border-color: var(--pv-primary);
  background: color-mix(in srgb, var(--pv-primary) 16%, transparent);
  color: var(--pv-text);
}
.report-day-group {
  display: grid;
  gap: 10px;
}
.report-day-group + .report-day-group {
  margin-top: 22px;
}
.report-day-heading {
  margin: 0;
  color: var(--pv-text-dim);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}
.report-day-rows {
  display: grid;
  gap: 10px;
}
.report-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: var(--pv-surface-alt);
}
.report-status-tile {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--pv-input);
  color: var(--pv-text);
  font-size: 0.82rem;
  font-weight: 900;
}
.report-row-ready .report-status-tile { color: var(--pv-success-text); }
.report-row-preparing .report-status-tile { color: var(--pv-accent-text); }
.report-row-attention .report-status-tile { color: var(--pv-danger-text); }
.report-row-main {
  min-width: 0;
}
.report-practice-title {
  margin: 0 0 4px;
  font-size: 1rem;
  line-height: 1.25;
}
.report-practice-meta,
.report-status-detail {
  margin: 0;
  color: var(--pv-text-dim);
  font-size: 0.86rem;
}
.report-status-detail {
  margin-top: 2px;
}
.report-state {
  justify-self: start;
  font-size: 0.8rem;
  padding: 0.25rem 0.55rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--pv-text) 10%, transparent);
  white-space: nowrap;
}
.report-state-ready { background: color-mix(in srgb, var(--pv-success) 18%, transparent); color: var(--pv-success-text); }
.report-state-preparing { background: color-mix(in srgb, var(--pv-accent) 18%, transparent); color: var(--pv-accent-text); }
.report-state-attention { background: color-mix(in srgb, var(--pv-danger) 18%, transparent); color: var(--pv-danger-text); }
.report-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.compact-action {
  min-height: 36px;
  padding: 8px 11px;
  white-space: nowrap;
}
.report-list-empty {
  margin: 0;
  color: var(--pv-text-dim);
}

@media (max-width: 760px) {
  .report-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .report-status-tile {
    width: 38px;
    height: 38px;
  }
  .report-state,
  .report-row-actions {
    grid-column: 2;
  }
  .report-row-actions {
    justify-content: flex-start;
  }
}

.trends-controls {
  display: grid;
  gap: 12px;
}

.trends-field {
  display: grid;
  gap: 6px;
  color: var(--pv-text-dim);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

.trends-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 10px;
  margin: 0;
}

.trends-summary > div,
.trends-summary div {
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--pv-surface-alt);
}

.trends-summary dt {
  color: var(--pv-text-dim);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.trends-summary dd {
  margin: 6px 0 0;
  color: var(--pv-text);
  font-size: 1.2rem;
  font-weight: 900;
}

.trends-chart {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  background: var(--pv-input);
}

.trends-points {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 12px 0 0;
  list-style: none;
}

.trends-points li {
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--pv-surface-alt);
  color: var(--pv-text);
}

/* FEAT-85 · CLT-5 web practice-review surface (SWR-CLT5-01..04). Cue buttons
   reuse the CLT-3 transcript cue look so the family is visually consistent;
   the empty-state copy is its own variant so SR-F84 "no media" reads as a
   clear product state, not an error. */
.practice-review-cue {
  display: flex;
  gap: 0.6rem;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  font: inherit;
}
.practice-review-cue:hover { background: color-mix(in srgb, var(--pv-primary) 10%, transparent); }
.practice-review-cue[data-active="true"] { background: color-mix(in srgb, var(--pv-primary) 12%, transparent); border-color: var(--pv-primary); }
.practice-review-empty {
  color: var(--pv-text-dim);
  font-size: 0.95rem;
  background: color-mix(in srgb, var(--pv-input) 70%, transparent);
  border: 1px dashed var(--pv-border);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  margin: 0.5rem 0;
}
.practice-review-empty-transcript {
  color: var(--pv-accent-text);
  font-size: 0.85rem;
  margin: 0.25rem 0;
}

/* FEAT-88 · SWR-CLT3-09 / SR-F79 — athlete next-practice prep card. */
.next-practice-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0;
}
.next-practice-team {
  font-size: 0.85rem;
  color: var(--pv-text-dim);
  margin: 0;
}
.next-practice-heading {
  font-size: 1.2rem;
  margin: 0;
}
.next-practice-empty {
  color: var(--pv-text-dim);
  font-weight: 400;
}
.next-practice-when,
.next-practice-duration,
.next-practice-advice-headline,
.next-practice-prior-heading {
  margin: 0;
}
.next-practice-advice-headline {
  font-weight: 600;
}
.next-practice-items {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}
.next-practice-items li {
  margin: 0.15rem 0;
}
.next-practice-prior {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}
.next-practice-prior-link {
  color: var(--pv-primary);
}
.next-practice-prior-when {
  color: var(--pv-text-dim);
  font-size: 0.8rem;
}

/* FEAT-123 · /profile shared app-shell layout */
.skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 200;
  border-radius: 0 0 8px 0;
  padding: 10px 16px;
  background: #022D4D;
  color: #ffffff;
  font-weight: 800;
}

.skip:focus {
  left: 0;
}

:focus-visible {
  outline: 3px solid var(--pv-primary);
  outline-offset: 2px;
}

.profile-shell {
  grid-template-columns: minmax(280px, 0.72fr) minmax(420px, 1.28fr);
}

.profile-summary .summary {
  margin-bottom: 24px;
}

.profile-summary.workflow {
  top: 76px;
}

.profile-facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.read-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.45fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--pv-surface-alt);
}

.read-row dt {
  color: var(--pv-text-dim);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.read-row dd {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0;
  color: var(--pv-text);
  font-weight: 800;
}

.read-row a {
  color: var(--pv-primary);
  font-size: 0.86rem;
  font-weight: 900;
}

.profile-surface {
  display: grid;
  gap: 18px;
}

.profile-panel {
  border: 1px solid var(--pv-border);
  border-radius: 8px;
  padding: clamp(16px, 2vw, 22px);
  background: var(--pv-surface-alt);
}

.profile-panel h3 {
  margin-bottom: 14px;
}

.profile-help {
  margin-bottom: 14px;
  color: var(--pv-text-dim);
}

.profile-form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--pv-text-dim);
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
}

.field input:focus,
.field select:focus {
  border-color: var(--pv-primary);
  outline: 3px solid color-mix(in srgb, var(--pv-primary) 20%, transparent);
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  background: color-mix(in srgb, var(--pv-primary) 18%, transparent);
  color: var(--pv-primary-text);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.badge-ok {
  background: color-mix(in srgb, var(--pv-success) 18%, transparent);
  color: var(--pv-success-text);
}

.badge-warn {
  background: color-mix(in srgb, var(--pv-accent) 18%, transparent);
  color: var(--pv-accent-text);
}

.pref-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--pv-border);
  padding: 12px 0;
}

.pref-row:first-of-type {
  padding-top: 0;
}

.pref-row:last-of-type {
  margin-bottom: 16px;
  border-bottom: 0;
}

.pref-label {
  min-width: 0;
  color: var(--pv-text);
  font-weight: 900;
}

.pref-label span {
  display: block;
  margin-top: 2px;
  color: var(--pv-text-dim);
  font-size: 0.88rem;
  font-weight: 500;
}

.toggle {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
}

.toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--pv-input);
  cursor: pointer;
  transition: background 0.15s;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--pv-text);
  box-shadow: var(--pv-shadow-sm);
  pointer-events: none;
  transition: transform 0.15s;
}

.toggle input:checked + .toggle-track {
  background: var(--pv-primary-dim);
}

.toggle input:checked ~ .toggle-thumb {
  transform: translateX(20px);
}

.status {
  display: none;
  margin-top: 12px;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 800;
}

.status.show {
  display: block;
}

.status.err {
  border: 1px solid color-mix(in srgb, var(--pv-danger) 60%, transparent);
  background: color-mix(in srgb, var(--pv-danger) 12%, transparent);
  color: var(--pv-danger-text);
}

.status.ok {
  border: 1px solid color-mix(in srgb, var(--pv-success) 60%, transparent);
  background: color-mix(in srgb, var(--pv-success) 12%, transparent);
  color: var(--pv-success-text);
}

.profile-shell .secondary-action {
  width: fit-content;
  min-height: 46px;
}

/* FEAT-143 (#655) — destructive "Delete my account" action. */
.profile-shell .danger-action {
  background: var(--pv-danger);
  border-color: var(--pv-danger);
  color: var(--pv-on-danger);
}

.profile-shell .danger-action:hover:not(:disabled) {
  background: var(--pv-danger-strong);
  border-color: var(--pv-danger-strong);
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .profile-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .read-row {
    grid-template-columns: 1fr;
  }

  .profile-shell .secondary-action {
    width: 100%;
  }
}

/* ── FEAT-110 · SR-F90 · SWR-CLT1-10, SWR-CLT5-05 · EPIC-22
   Authenticated app shell navbar — role-aware, injected by navbar.js
   ──────────────────────────────────────────────────────────────────── */
.app-navbar {
  display: flex;
  align-items: center;
  gap: 0;
  height: 52px;
  padding: 0 clamp(16px, 3vw, 32px);
  background: var(--pv-nav-bg);
  color: var(--pv-nav-text);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--pv-nav-border);
  box-shadow: var(--pv-shadow-sm);
}

.navbar-brand {
  flex: 0 0 auto;
  margin-right: 24px;
  color: var(--pv-nav-text);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.navbar-brand:hover {
  color: var(--pv-nav-text-dim);
}

.navbar-links {
  display: flex;
  flex: 1 1 auto;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
  overflow-x: auto;
}

.navbar-link {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--pv-nav-text-dim);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.navbar-link:hover {
  background: var(--pv-nav-hover);
  color: var(--pv-nav-text);
}

.navbar-link-active {
  background: var(--pv-nav-active);
  color: var(--pv-nav-text);
  font-weight: 600;
}

.navbar-account {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 16px;
}

.navbar-username {
  font-size: 0.85rem;
  color: var(--pv-nav-text-dim);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar-signout {
  padding: 5px 12px;
  border: 1px solid var(--pv-nav-border);
  border-radius: 6px;
  background: transparent;
  color: var(--pv-nav-text-dim);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.navbar-signout:hover {
  background: var(--pv-nav-hover);
  border-color: var(--pv-nav-text-dim);
  color: var(--pv-nav-text);
}

/* Issue #530 · W5 — Advanced/open-by-ID disclosure panel */
.advanced {
  margin-top: 0.75rem;
  border: 1px solid var(--pv-border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  background: var(--pv-surface-alt);
}

.advanced summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--pv-text-dim);
  user-select: none;
}

.advanced-body {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   Visual polish layer (themes + refinement). Purely presentational: no
   layout-affecting display changes to elements scripts toggle.
   ══════════════════════════════════════════════════════════════════════════ */

/* Typography */
h1 { letter-spacing: -0.025em; line-height: 1.08; }
h2 { letter-spacing: -0.015em; }
h3 { letter-spacing: -0.005em; }
.eyebrow { letter-spacing: 0.08em; font-size: 0.74rem; }
.summary { line-height: 1.6; }

/* Cards: softer radius, consistent elevation */
.workflow,
.device-surface,
.ops-dashboard,
.profile-panel {
  border-radius: var(--pv-radius);
}

.workflow,
.device-surface,
.ops-dashboard {
  border-color: var(--pv-border);
}

/* Inputs */
input,
select,
textarea {
  border-radius: var(--pv-radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--pv-border-strong);
}
input::placeholder,
textarea::placeholder {
  color: var(--pv-text-dim);
  opacity: 0.85;
}

/* Buttons */
.primary-action,
.secondary-action {
  border-radius: var(--pv-radius-sm);
  transition: transform 0.12s, filter 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.primary-action:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.secondary-action:hover:not(:disabled) {
  border-color: var(--pv-primary);
  background: color-mix(in srgb, var(--pv-primary) 10%, transparent);
}
.primary-action:active:not(:disabled),
.secondary-action:active:not(:disabled) {
  transform: translateY(0);
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--pv-primary) 55%, transparent);
  outline-offset: 2px;
}

/* Lists & rows: hover affordance */
.report-row,
.thread-row {
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.report-row:hover,
.thread-row:hover {
  border-color: var(--pv-border-strong);
}

/* Report view: give the long report a calmer rhythm */
.report-section {
  border-top-color: var(--pv-border);
  padding-top: 1rem;
  margin-top: 0.25rem;
}
.report-section > h3 {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pv-text-dim);
}

/* Profile shell */
.profile-panel {
  box-shadow: var(--pv-shadow-sm);
}

/* Navbar polish */
.app-navbar {
  backdrop-filter: saturate(140%) blur(6px);
}
.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.navbar-brand::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 30% 30%, #FFFFFF 0 18%, transparent 19%),
    linear-gradient(135deg, #19C3FA, #0E7CA8);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 25%);
}

/* Theme toggle (navbar) */
.theme-toggle {
  padding: 5px 10px;
  border: 1px solid var(--pv-nav-border);
  border-radius: 999px;
  background: var(--pv-nav-hover);
  color: var(--pv-nav-text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.theme-toggle:hover {
  background: var(--pv-nav-active);
}

/* Theme picker (Profile → Appearance) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 0;
  border: 0;
  padding: 0;
}
.theme-option {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  border: 2px solid var(--pv-border);
  border-radius: var(--pv-radius-sm);
  padding: 12px;
  background: var(--pv-surface-alt);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.theme-option:hover {
  border-color: var(--pv-border-strong);
}
.theme-option:has(input:checked) {
  border-color: var(--pv-primary);
  background: color-mix(in srgb, var(--pv-primary) 10%, var(--pv-surface-alt));
}
.theme-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.theme-option:has(input:focus-visible) {
  outline: 3px solid color-mix(in srgb, var(--pv-primary) 55%, transparent);
  outline-offset: 2px;
}
.theme-swatch {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--pv-border-strong);
}
.theme-swatch-sun { background: linear-gradient(135deg, #FFFFFF 50%, #00579E 50%); }
.theme-swatch-dark { background: linear-gradient(135deg, #0A1826 50%, #19C3FA 50%); }
.theme-swatch-system { background: linear-gradient(90deg, #FFFFFF 50%, #0A1826 50%); }
.theme-option-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.theme-option-text strong {
  color: var(--pv-text);
  font-size: 0.95rem;
}
.theme-option-text span {
  color: var(--pv-text-dim);
  font-size: 0.8rem;
  line-height: 1.35;
}

/* Sun: sunlight readability — heavier weights and stronger edges. */
:root[data-theme="sun"] body { font-weight: 450; }
:root[data-theme="sun"] .workflow,
:root[data-theme="sun"] .device-surface,
:root[data-theme="sun"] .ops-dashboard,
:root[data-theme="sun"] .profile-panel {
  border-color: var(--pv-border);
}
:root[data-theme="sun"] .eyebrow { color: var(--pv-primary-dim); }

/* Small screens */
@media (max-width: 640px) {
  .app-navbar {
    padding: 0 12px;
  }
  .navbar-brand {
    margin-right: 10px;
    font-size: 0;
  }
  .navbar-username {
    display: none;
  }
  .theme-toggle {
    padding: 5px 9px;
  }
  .theme-toggle-label {
    display: none;
  }
  h1 {
    font-size: clamp(1.7rem, 8vw, 2.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
