:root {
  color-scheme: light;
  --ink: #132231;
  --muted: #5d6b78;
  --navy: #102a43;
  --navy-2: #20496a;
  --teal: #178b7d;
  --teal-soft: #e4f4f1;
  --red: #c43c45;
  --red-dark: #9e2933;
  --amber: #9a6400;
  --amber-soft: #fff2cf;
  --line: #d9e1e7;
  --surface: #ffffff;
  --page: #f4f7f9;
  --shadow: 0 16px 42px rgba(16, 42, 67, 0.1);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--page); }

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% -10%, rgba(71, 181, 166, .16), transparent 34rem),
    linear-gradient(180deg, #f8fafb 0, var(--page) 34rem);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 2px 22px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.9rem, 7vw, 2.7rem); letter-spacing: -.045em; }
h2 { margin-bottom: 18px; font-size: clamp(1.45rem, 5vw, 2rem); letter-spacing: -.03em; }
h3 { margin-bottom: 8px; font-size: 1.05rem; }

.eyebrow {
  margin-bottom: 5px;
  color: var(--teal);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.panel {
  margin-bottom: 16px;
  padding: clamp(20px, 5vw, 34px);
  border: 1px solid rgba(16, 42, 67, .08);
  border-radius: 24px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
}

.settings-panel { border-top: 4px solid var(--teal); }
.section-heading { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }

label {
  display: block;
  margin: 0 0 16px;
  color: #31475a;
  font-size: .86rem;
  font-weight: 750;
}

input, textarea, select {
  width: 100%;
  min-height: 48px;
  margin-top: 7px;
  padding: 12px 13px;
  color: var(--ink);
  border: 1px solid #c8d3dc;
  border-radius: 12px;
  background: #fbfcfd;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(23, 139, 125, .13);
}

.two-column { display: grid; grid-template-columns: 1fr 1.3fr; gap: 14px; }

.placement-guide {
  margin: 6px 0 17px;
  padding: 15px 16px;
  border-left: 4px solid var(--teal);
  background: var(--teal-soft);
  border-radius: 4px 12px 12px 4px;
}
.placement-guide p { margin: 5px 0 0; color: #36535a; line-height: 1.45; }

.consent-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8fafb;
  color: var(--ink);
  line-height: 1.4;
}
.consent-row input { width: 22px; min-height: 22px; margin: 0; flex: 0 0 22px; accent-color: var(--teal); }
.approval-row { margin-top: 24px; }

.button-row { display: flex; gap: 11px; align-items: center; flex-wrap: wrap; }
button {
  min-height: 48px;
  padding: 11px 17px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .12s, opacity .12s, background .12s;
}
button:active { transform: scale(.98); }
button:disabled { cursor: not-allowed; opacity: .45; }
.primary { color: white; background: var(--navy); }
.primary:hover:not(:disabled) { background: var(--navy-2); }
.secondary { color: var(--navy); background: #eaf0f4; }
.danger-ghost { color: var(--red-dark); background: #fdebed; }
.icon-button { width: 50px; padding: 0; color: var(--navy); background: white; box-shadow: 0 7px 22px rgba(16,42,67,.12); font-size: 1.25rem; }
.record-button { display: inline-flex; align-items: center; gap: 10px; color: white; background: var(--red); }
.record-button:hover:not(:disabled) { background: var(--red-dark); }
.record-dot { width: 13px; height: 13px; border-radius: 50%; background: white; box-shadow: 0 0 0 4px rgba(255,255,255,.2); }
.stop-button { width: 100%; min-height: 58px; color: white; background: var(--red); font-size: 1.03rem; }

.help { margin: 12px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.status-line { margin: 14px 0; padding: 11px 13px; color: var(--muted); background: #f2f5f7; border-radius: 10px; font-size: .9rem; }
.status-line.good { color: #0c675d; background: var(--teal-soft); }
.status-line.warning { color: #7b5100; background: var(--amber-soft); }
.status-line.error { color: var(--red-dark); background: #fdebed; }

.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 9px; border-radius: 99px; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.badge.neutral { color: #4f6170; background: #edf1f4; }
.badge.good { color: #0b695f; background: var(--teal-soft); }
.badge.warning { color: #7b5100; background: var(--amber-soft); }
.badge.error { color: var(--red-dark); background: #fdebed; }

.timer { margin: 30px 0 22px; font-size: clamp(3rem, 14vw, 5.5rem); font-weight: 800; letter-spacing: -.055em; text-align: center; font-variant-numeric: tabular-nums; }
.level-shell { height: 18px; overflow: hidden; border-radius: 99px; background: #e6ecef; }
.level-bar { width: 2%; height: 100%; background: linear-gradient(90deg, var(--teal), #72c77b 68%, #f0b34b 85%, var(--red)); border-radius: inherit; transition: width .08s linear; }
.keep-open { margin: 22px 0; color: var(--muted); line-height: 1.5; text-align: center; }
.recording-actions { max-width: 430px; margin: 0 auto; }

.progress-track { height: 10px; margin: 24px 0 15px; overflow: hidden; border-radius: 99px; background: #e7edf1; }
.progress-bar { width: 3%; height: 100%; border-radius: inherit; background: var(--teal); transition: width .3s ease; }
.processing-status { color: var(--muted); font-weight: 700; }
.segment-list { display: grid; gap: 8px; margin: 18px 0; }
.segment-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: .87rem; }

.tabs { display: flex; gap: 6px; padding: 5px; background: #edf2f5; border-radius: 13px; }
.tab { min-height: 42px; flex: 1; color: var(--muted); background: transparent; }
.tab.active { color: var(--navy); background: white; box-shadow: 0 3px 10px rgba(16,42,67,.08); }
.tab-panel { padding-top: 22px; }
.notes-section { margin-bottom: 24px; }
.notes-section h3 { padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.notes-section ul { margin: 0; padding-left: 20px; }
.notes-section li { margin: 0 0 11px; line-height: 1.5; }
.evidence { display: block; margin-top: 3px; color: var(--muted); font-size: .78rem; }
.transcript-cue { padding: 10px 0; border-bottom: 1px solid #edf1f3; line-height: 1.5; }
.timestamp { display: inline-block; min-width: 74px; color: var(--teal); font-size: .8rem; font-weight: 800; }
.warnings { margin: 0 0 16px; padding: 13px 15px; color: #714b00; background: var(--amber-soft); border-radius: 12px; line-height: 1.45; }

.share-parts { display: grid; gap: 15px; margin: 20px 0; }
.share-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.share-card-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: #edf3f6; }
.share-card pre { max-height: 360px; margin: 0; padding: 15px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.copy-part { min-height: 38px; padding: 7px 11px; color: white; background: var(--navy); font-size: .8rem; }

.recovery { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); left: 18px; z-index: 20; max-width: 520px; margin: auto; padding: 14px 16px; color: white; background: #172a3a; border-radius: 13px; box-shadow: var(--shadow); text-align: center; font-weight: 750; }
footer { padding: 14px 12px 0; color: #71808d; font-size: .76rem; text-align: center; }

[hidden] { display: none !important; }

@media (max-width: 580px) {
  .app-shell { padding-right: 12px; padding-left: 12px; }
  .panel { border-radius: 20px; }
  .two-column { grid-template-columns: 1fr; gap: 0; }
  .stacked-mobile { flex-direction: column-reverse; align-items: stretch; }
  .stacked-mobile button { width: 100%; }
  .section-heading { align-items: center; }
}

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