:root {
  color-scheme: dark;
  --bg: #101010;
  --panel: #171717;
  --panel-raised: #1d1d1d;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #eeeae3;
  --muted: #a49f96;
  --faint: #6f6b65;
  --gold: #d0ad69;
  --gold-soft: rgba(208, 173, 105, 0.12);
  --green: #a6c39a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, textarea, input { font: inherit; }
button { color: inherit; }

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: max(34px, env(safe-area-inset-top)) 0 max(64px, env(safe-area-inset-bottom));
}

.page-header { display: grid; grid-template-columns: 160px 1fr; gap: 32px; align-items: start; margin-bottom: 38px; }
.back-link { color: var(--muted); text-decoration: none; font-size: 14px; padding-top: 4px; }
.back-link:hover { color: var(--text); }
.back-link span { margin-left: 5px; }
.eyebrow, .section-kicker { color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; margin: 0 0 8px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 44px); font-weight: 560; letter-spacing: 0; line-height: 1.1; }
h2 { margin-bottom: 0; font-size: 18px; font-weight: 580; letter-spacing: 0; }
.lede { margin: 0; color: var(--muted); font-size: 14px; }

.workspace-grid { display: grid; grid-template-columns: minmax(300px, 0.84fr) minmax(420px, 1.16fr); gap: 18px; align-items: stretch; }
.input-column { display: flex; flex-direction: column; gap: 18px; }
.output-column { min-width: 0; }
.panel { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 22px; }
.section-heading, .result-heading, .report-box-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.compact-heading { align-items: center; }
.privacy-mark, .muted-label, .confidence-note { color: var(--faint); font-size: 11px; white-space: nowrap; }
.privacy-mark { color: var(--green); border: 1px solid rgba(166, 195, 154, 0.28); padding: 4px 7px; border-radius: 4px; }

.drop-zone { display: flex; min-height: 190px; margin-top: 22px; padding: 24px; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 1px dashed var(--line-strong); border-radius: 6px; color: var(--muted); text-align: center; cursor: pointer; transition: border-color 160ms, background 160ms; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--gold); background: var(--gold-soft); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-icon, .empty-mark { color: var(--gold); font-size: 28px; line-height: 1; }
.drop-zone strong { color: var(--text); font-size: 14px; font-weight: 560; }
.drop-zone span:last-child { max-width: 260px; font-size: 12px; color: var(--faint); }
.recorder { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #141414; }
.recorder-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.recorder-copy strong { color: var(--text); font-size: 13px; font-weight: 560; }
.recorder-copy span { color: var(--faint); font-size: 11px; }
.recorder-copy span[data-tone="error"] { color: #d88d80; }
.recorder-copy span[data-tone="success"] { color: var(--green); }
.recorder-copy span[data-tone="working"] { color: var(--gold); }
.recorder-controls { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.recording-time { min-width: 44px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; text-align: right; }
.record-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 5px; background: transparent; color: var(--text); cursor: pointer; font-size: 11px; }
.record-button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.record-button:disabled { opacity: 0.55; cursor: wait; }
.record-dot { width: 9px; height: 9px; border-radius: 50%; background: #c8796f; box-shadow: 0 0 0 3px rgba(200, 121, 111, 0.12); }
.stop-square { width: 9px; height: 9px; border-radius: 2px; background: #d88d80; }
.stop-record-button { border-color: rgba(216, 141, 128, 0.36); color: #d9a197; }
.input-divider { display: flex; align-items: center; gap: 11px; margin: 17px 0 0; color: var(--faint); font-size: 10px; }
.input-divider::before, .input-divider::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.audio-preview { display: block; width: 100%; height: 38px; margin-top: 12px; accent-color: var(--gold); }
.audio-preview[hidden] { display: none; }
.file-summary { display: flex; align-items: center; gap: 11px; margin-top: 16px; padding: 11px; border: 1px solid var(--line); background: var(--panel-raised); border-radius: 5px; }
.file-symbol { color: var(--gold); font-size: 22px; }
.file-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.file-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 560; }
.file-copy span { color: var(--faint); font-size: 11px; }
.text-button { flex: none; padding: 4px 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.text-button:hover { color: var(--text); }
.status-line { min-height: 20px; margin: 14px 0 0; color: var(--faint); font-size: 12px; }
.status-line[data-tone="error"] { color: #d88d80; }
.status-line[data-tone="working"] { color: var(--gold); }

.transcript-panel textarea, #reportOutput { display: block; width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 5px; outline: none; background: #121212; color: var(--text); padding: 12px; font-size: 13px; line-height: 1.7; }
.transcript-panel textarea { min-height: 128px; margin-top: 18px; }
textarea:focus { border-color: rgba(208, 173, 105, 0.7); }
.field-note { margin: 9px 0 0; color: var(--faint); font-size: 11px; }
.primary-button { width: 100%; min-height: 47px; border: 1px solid var(--gold); border-radius: 5px; background: var(--gold); color: #17130c; cursor: pointer; font-weight: 650; font-size: 14px; }
.primary-button:hover:not(:disabled) { background: #e1c27f; }
.primary-button:disabled { border-color: var(--line); background: #242321; color: var(--faint); cursor: not-allowed; }
.primary-button span { margin-right: 4px; }

.result-panel { min-height: 100%; }
.empty-result { min-height: 600px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 34px; }
.empty-result h2 { margin-top: 18px; margin-bottom: 9px; }
.empty-result p { max-width: 280px; margin: 0; color: var(--faint); font-size: 13px; }
.result-content { min-width: 0; }
.result-heading { margin-bottom: 22px; }
.result-heading h2 { font-size: 20px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.metric { min-width: 0; padding: 13px; border: 1px solid var(--line); background: var(--panel-raised); border-radius: 5px; }
.metric-label { display: block; color: var(--faint); font-size: 11px; margin-bottom: 5px; }
.metric-value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 18px; font-weight: 580; }
.metric-detail { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.report-box { border-top: 1px solid var(--line); padding-top: 18px; }
.report-box-header { align-items: center; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.report-actions { display: flex; gap: 6px; }
.icon-text-button { border: 1px solid var(--line-strong); border-radius: 4px; background: transparent; color: var(--text); padding: 6px 9px; cursor: pointer; font-size: 11px; }
.icon-text-button:hover { border-color: var(--gold); color: var(--gold); }
.icon-text-button.secondary { color: var(--muted); }
#reportOutput { min-height: 360px; resize: vertical; }

@media (max-width: 820px) {
  .page-shell { width: min(100% - 28px, 620px); padding-top: 24px; }
  .page-header { display: block; margin-bottom: 26px; }
  .back-link { display: inline-block; margin-bottom: 28px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .empty-result { min-height: 260px; }
}

@media (max-width: 460px) {
  .page-shell { width: calc(100% - 22px); }
  .panel { padding: 17px; }
  .section-heading, .result-heading { display: block; }
  .privacy-mark, .confidence-note { display: inline-block; margin-top: 10px; }
  .recorder { align-items: flex-start; flex-direction: column; }
  .recorder-controls { width: 100%; justify-content: flex-end; }
  .recording-time { margin-right: auto; text-align: left; }
  .report-box-header { align-items: flex-start; flex-direction: column; }
  #reportOutput { min-height: 420px; }
}
