:root {
  color-scheme: light;
  --ink: #142238;
  --muted: #64748b;
  --line: #d8e1ec;
  --surface: #ffffff;
  --canvas: #f3f6fa;
  --primary: #1666cc;
  --primary-dark: #0d4fa6;
  --success: #177149;
  --danger: #b42318;
  --soft-blue: #eaf3ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(22, 102, 204, .09), transparent 34rem),
    var(--canvas);
}

button, input, textarea { font: inherit; }

.shell { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 70px; }

header { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 28px; }

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: white;
  background: var(--primary);
  box-shadow: 0 8px 22px rgba(22, 102, 204, .25);
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(1.8rem, 4vw, 2.55rem); line-height: 1.05; }
h2 { margin-bottom: 0; font-size: 1.3rem; }
.eyebrow, .step { margin-bottom: 5px; color: var(--primary); font-weight: 750; letter-spacing: .04em; text-transform: uppercase; font-size: .76rem; }
.intro { margin-bottom: 0; color: var(--muted); }

.panel {
  margin-bottom: 20px;
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(27, 48, 75, .07);
}

.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 24px; }
.status-pill { padding: 6px 11px; border-radius: 999px; color: var(--muted); background: #edf1f6; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.status-pill.ready { color: var(--success); background: #e7f7ef; }

label { display: block; color: #334155; font-size: .9rem; font-weight: 700; }
label + label, .two-columns + label { margin-top: 18px; }
.hint { color: var(--muted); font-weight: 450; }

input[type="text"], input:not([type]), textarea, select {
  width: 100%;
  margin-top: 7px;
  padding: 11px 13px;
  border: 1px solid #bdcad9;
  border-radius: 11px;
  color: var(--ink);
  background: #fbfdff;
  resize: vertical;
}
select { resize: none; }

input:focus, textarea:focus, select:focus, button:focus-visible { outline: 3px solid rgba(22, 102, 204, .22); outline-offset: 2px; border-color: var(--primary); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }

.mode-switch { display: inline-flex; gap: 4px; margin-bottom: 22px; padding: 4px; border-radius: 12px; background: #edf1f6; }
button { border: 0; border-radius: 11px; padding: 11px 17px; cursor: pointer; font-weight: 720; }
button:disabled { cursor: not-allowed; opacity: .45; }
.mode { color: var(--muted); background: transparent; }
.mode.active { color: var(--ink); background: white; box-shadow: 0 2px 7px rgba(20, 34, 56, .1); }
.primary { color: white; background: var(--primary); }
.primary:hover:not(:disabled) { background: var(--primary-dark); }
.secondary { color: var(--ink); background: #e6edf5; }
.danger { color: white; background: var(--danger); }

.recorder { display: flex; gap: 14px; align-items: center; min-height: 76px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fbfdff; }
.recorder p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.record-indicator { width: 16px; height: 16px; flex: 0 0 16px; border: 3px solid #cbd5e1; border-radius: 50%; }
.record-indicator.live { border-color: #ffb7b0; background: #d92d20; box-shadow: 0 0 0 7px #fee4e2; animation: pulse 1.6s infinite; }
.record-indicator.paused { border-color: #facc15; background: #ca8a04; box-shadow: none; animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 11px rgba(254, 228, 226, .25); } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.timer-block { display: grid; justify-items: end; gap: 2px; text-align: right; }
.timer-label { color: var(--muted); font-size: .69rem; font-weight: 760; letter-spacing: .04em; text-transform: uppercase; }
.timer { font-variant-numeric: tabular-nums; font-size: 1.35rem; font-weight: 780; }

.drop-zone { display: grid; gap: 7px; place-items: center; margin-bottom: 16px; padding: 30px; border: 2px dashed #b8c8da; border-radius: 16px; text-align: center; background: #f8fbff; cursor: pointer; }
.drop-zone span { color: var(--muted); font-size: .86rem; font-weight: 450; }
.drop-zone input { max-width: 100%; margin-top: 8px; }
.consent { display: flex; gap: 9px; align-items: flex-start; margin-top: 22px; font-weight: 520; }
.consent input { margin-top: 2px; }

.progress-wrap { margin-top: 20px; }
.progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: #e6edf5; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width .2s ease; }
.progress-wrap.active-processing .progress-bar { background: repeating-linear-gradient(110deg, var(--primary) 0 18px, #4d94e8 18px 36px); background-size: 200% 100%; animation: processing-stripes 1.2s linear infinite; }
.progress-wrap p { margin: 8px 0 0; color: var(--muted); font-size: .88rem; }
.processing-heartbeat::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: #22a06b; box-shadow: 0 0 0 0 rgba(34, 160, 107, .5); animation: heartbeat-pulse 1.6s ease-out infinite; }
@keyframes processing-stripes { to { background-position: 72px 0; } }
@keyframes heartbeat-pulse { 70% { box-shadow: 0 0 0 8px rgba(34, 160, 107, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 160, 107, 0); } }
.notice { margin-top: 18px; padding: 13px 15px; border-radius: 12px; color: #174a35; background: #e8f7ef; }
.notice-info { color: #17466f; background: var(--soft-blue); }
.notice-error, .notice.error { color: #852017; background: #feeceb; }
.hidden { display: none !important; }
.transcript-text { margin: 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; color: var(--ink); font: inherit; line-height: 1.6; white-space: pre-wrap; }
.transcript-segments { display: grid; gap: 12px; }
.transcript-segment { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.transcript-segment-speaker { margin: 0 0 6px; color: var(--primary); font-size: .82rem; font-weight: 780; letter-spacing: .02em; }
.transcript-segment-text { margin: 0; color: var(--ink); line-height: 1.6; }
.transcript-tool, .retranscribe-box { margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.transcript-tool { background: var(--soft-blue); border-color: #c8ddf5; }
.transcript-tool h3, .retranscribe-box h3 { margin: 0 0 6px; }
.transcript-tool p, .retranscribe-box p { margin: 0 0 12px; color: var(--muted); line-height: 1.5; }
.transcript-tool .actions { margin-top: 0; }
.transcript-tool .processing-heartbeat { margin: 14px 0 0; color: #17466f; font-size: .88rem; }
.transcript-view-label { margin: 4px 0 10px; color: var(--muted); font-size: .86rem; font-weight: 700; }
.transcript-metrics { margin-bottom: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metric { min-width: 0; padding: 11px 12px; border-radius: 10px; background: white; }
.metric-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.metric-value { display: block; overflow-wrap: anywhere; color: var(--ink); font-size: .98rem; font-weight: 760; }
.metric-note { margin: 11px 2px 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.speaker-identification, .report-box, .delivery-box { margin-bottom: 18px; padding: 20px; border: 1px solid #c8ddf5; border-radius: 14px; background: var(--soft-blue); }
.speaker-identification h3, .report-box h3 { margin: 0 0 6px; }
.speaker-identification > div > p, .report-box > p { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }
.speaker-profile-list { display: grid; gap: 12px; }
.speaker-profile { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.speaker-profile h4 { margin: 0 0 10px; }
.speaker-examples { display: grid; gap: 7px; margin: 0 0 12px; padding: 0; list-style: none; }
.speaker-examples li { padding: 9px 11px; border-left: 3px solid #9ec5f3; color: #40536d; background: #f8fafc; font-size: .86rem; line-height: 1.45; }
.speaker-profile label { font-size: .82rem; }
.report-box { margin-top: 20px; background: #fff; border-color: var(--line); }
.report-box .step { margin-bottom: 5px; }
.report-box .processing-heartbeat { margin: 14px 0 0; color: #17466f; font-size: .88rem; }
.report-text { margin: 16px 0 0; padding: 20px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #f8fafc; font: inherit; line-height: 1.6; white-space: pre-wrap; }
.delivery-box { margin-top: 20px; border-color: #9ed5ba; background: #effaf4; }
.delivery-box h3 { margin: 0 0 6px; }
.delivery-box > p { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }
.delivery-box .processing-heartbeat { color: #174a35; font-size: .88rem; }

@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 920px); padding-top: 22px; }
  .two-columns { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
  .mode-switch { width: 100%; }
  .mode { flex: 1; padding-inline: 8px; }
  .actions button, #upload-file { width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
}
