/* Stealth OLED-Dark Mobile-First iPhone UI */
:root {
  --bg: #0b0d12;
  --surface: #131722;
  --surface-2: #1a2030;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2f8;
  --text-dim: #9aa5b8;
  --text-muted: #6c778b;

  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.16);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.15);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.16);
  --purple: #a78bfa;
  --purple-soft: rgba(167, 139, 250, 0.16);
  --cyan: #22d3ee;

  --radius: 14px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100%;
  overscroll-behavior-y: none;
}

.app-shell {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: calc(18px + var(--safe-bottom));
  transition: opacity 0.25s ease, filter 0.25s ease;
}

/* Stealth Dim mode for sitting quietly on a conference table */
body.stealth-dim .app-shell {
  filter: brightness(0.58) contrast(0.95);
}

.hidden {
  display: none !important;
}

/* Header */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-dim);
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.icon-btn:active {
  transform: scale(0.96);
  background: var(--surface-2);
}

.icon-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 2px var(--surface);
}

.alert-banner {
  margin: 4px 16px 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
  font-size: 12.5px;
}

/* Control Deck */
.control-deck {
  margin: 6px 14px 10px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: calc(4px + var(--safe-top));
  z-index: 20;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.pill-idle {
  background: var(--surface-2);
  color: var(--text-dim);
}

.pill-live {
  background: var(--green-soft);
  color: #4ade80;
}

.pill-live .dot {
  animation: pulse 1.4s infinite ease-in-out;
}

.pill-recovering {
  background: var(--amber-soft);
  color: #fbbf24;
}

.pill-error {
  background: var(--red-soft);
  color: #f87171;
}

.pill-ear {
  background: var(--purple-soft);
  color: #c4b5fd;
}

.pill-busy {
  background: var(--accent-soft);
  color: #93c5fd;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.82); }
}

.wave-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
}

.wave-bars i {
  display: block;
  width: 2px;
  background: currentColor;
  border-radius: 2px;
  animation: wave 0.8s infinite ease-in-out;
}

.wave-bars i:nth-child(1) { height: 5px; animation-delay: 0s; }
.wave-bars i:nth-child(2) { height: 11px; animation-delay: 0.2s; }
.wave-bars i:nth-child(3) { height: 7px; animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

.spinner {
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.countdown-text {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Live Audio Level Meter */
.meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.level-meter {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  height: 14px;
  align-items: end;
}

.meter-seg {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  transition: height 70ms ease, background-color 90ms ease;
}

.meter-seg.lit {
  background: var(--green);
}

.meter-seg.lit.high {
  background: var(--amber);
}

.cycle-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  overflow: hidden;
}

.cycle-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width 0.25s linear;
}

/* Primary Buttons & Interval Dropdown */
.primary-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary.recording {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
}

.btn-primary.full-width {
  width: 100%;
}

.interval-picker {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  min-width: 112px;
}

.picker-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1px;
}

.interval-picker select {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  padding: 0;
}

.interval-picker select option {
  background: #131722;
  color: #eef2f8;
}

/* Quick Strip */
.quick-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.chip-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.chip-btn.chip-active {
  background: var(--accent-soft);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}

.chip-btn.chip-muted {
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

/* Toast */
.toast {
  margin: 0 14px 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
}

.toast.toast-error {
  background: var(--red-soft);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fecaca;
}

.toast.toast-success {
  background: var(--green-soft);
  border-color: rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

/* Feed Toolbar */
.feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 14px 8px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 6px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.tab-count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.feed-actions {
  display: flex;
  gap: 6px;
}

.mini-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.mini-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.mini-btn.mini-danger:not(:disabled) {
  color: #fca5a5;
}

/* Notes Feed */
.notes-feed {
  flex: 1;
  padding: 0 14px 20px;
}

.empty-state {
  margin-top: 4px;
}

.empty-card {
  padding: 18px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.empty-card h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.empty-lead {
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--text-dim);
}

.setup-steps {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.setup-steps li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-dim);
}

.setup-steps strong {
  color: var(--text);
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.empty-cta-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-secondary {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

/* Summary Cards */
.cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-card {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  animation: fadeIn 0.22s ease;
}

.summary-card.has-disagreement {
  border-color: rgba(245, 158, 11, 0.38);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.card-title-block {
  min-width: 0;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.time-badge {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.lang-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(34, 211, 238, 0.14);
  color: #67e8f9;
  text-transform: uppercase;
}

.demo-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--purple-soft);
  color: #c4b5fd;
  text-transform: uppercase;
}

.card-topic {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
}

.replay-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 9px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.replay-btn:active {
  transform: scale(0.96);
}

.ear-quote {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(167, 139, 250, 0.08);
  border-left: 3px solid var(--purple);
  font-size: 13px;
  color: #d8d4fe;
}

.disagreement-box {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 13px;
  color: #fde68a;
}

.disagreement-box strong {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
  color: #fbbf24;
}

.bullet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bullet-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14.5px;
  line-height: 1.45;
}

.bullet-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 8px;
  flex-shrink: 0;
}

.bullet-item.tag-disagreement .bullet-dot { background: var(--amber); }
.bullet-item.tag-decision .bullet-dot { background: var(--green); }
.bullet-item.tag-action .bullet-dot { background: var(--cyan); }
.bullet-item.tag-question .bullet-dot { background: var(--purple); }

.bullet-content {
  flex: 1;
  min-width: 0;
}

.speaker-pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: #cbd5e1;
  margin-right: 5px;
  vertical-align: 1px;
}

.tag-pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 5px;
  margin-right: 5px;
  vertical-align: 1px;
}

.tag-pill.tag-disagreement { background: var(--amber-soft); color: #fbbf24; }
.tag-pill.tag-decision { background: var(--green-soft); color: #4ade80; }
.tag-pill.tag-action { background: rgba(34, 211, 238, 0.16); color: #67e8f9; }
.tag-pill.tag-question { background: var(--purple-soft); color: #c4b5fd; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  width: 100%;
  max-width: 640px;
  max-height: 90dvh;
  background: var(--surface);
  border-top: 1px solid var(--border-strong);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }
  .modal-sheet {
    border: 1px solid var(--border-strong);
    border-radius: 18px;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 17px;
}

.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.modal-footer-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.field-group input[type="password"],
.field-group input[type="text"],
.field-group textarea,
.field-group select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  border-color: var(--accent);
}

.input-row {
  display: flex;
  gap: 6px;
}

.input-row input {
  flex: 1;
}

.field-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.field-hint a {
  color: #60a5fa;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.label-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mono-val {
  font-size: 12.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-dim);
  cursor: pointer;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.diag-details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--bg);
}

.diag-details summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.diag-log {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
  max-height: 150px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.recap-content {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}

.recap-content h2 {
  font-size: 15px;
  color: #93c5fd;
  margin: 14px 0 6px;
}

.recap-content h2:first-child {
  margin-top: 0;
}
