:root {
  --bg: #f2f1eb;
  --surface: #ffffff;
  --text: #17211b;
  --muted: #68716b;
  --line: #d9ddd9;
  --brand: #1f6548;
  --brand-dark: #164a35;
  --danger: #b53b3b;
  --warning: #fff8df;
  --shadow: 0 12px 35px rgba(28, 43, 35, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
.topbar { max-width: 1100px; margin: 0 auto; padding: 42px 22px 24px; display: flex; justify-content: space-between; align-items: start; gap: 20px; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -0.04em; }
h2, h3 { margin-top: 0; }
.subtitle { max-width: 680px; color: var(--muted); font-size: 1.06rem; line-height: 1.55; }
.eyebrow { color: var(--brand); font-size: .75rem; font-weight: 800; letter-spacing: .16em; margin: 0 0 8px; }
main { max-width: 1100px; margin: 0 auto; padding: 0 22px 60px; }
.card { background: var(--surface); border: 1px solid rgba(23,33,27,.07); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 18px; }
.recorder-card { max-width: 760px; margin-left: auto; margin-right: auto; }
.field { display: block; margin: 18px 0; }
.field span { display: block; font-weight: 700; margin-bottom: 8px; }
small { color: var(--muted); font-weight: 500; }
input[type="text"], textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font: inherit; color: inherit; background: #fbfcfa; }
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 3px solid rgba(31,101,72,.14); border-color: var(--brand); }
.consent { display: flex; gap: 10px; align-items: start; margin: 18px 0; color: var(--muted); line-height: 1.4; }
.consent input { margin-top: 3px; transform: scale(1.15); }
.recording-panel { background: #f4f8f5; border-radius: 16px; padding: 18px; }
.recording-status { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
#timer { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.recording-dot { width: 12px; height: 12px; border-radius: 50%; background: #a9b1ac; }
.recording-dot.active { background: #d63f3f; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(214,63,63,.15); } }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.button { border: 0; border-radius: 12px; padding: 12px 16px; font: inherit; font-weight: 750; cursor: pointer; transition: transform .15s, opacity .15s, background .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--brand); color: #fff; }
.primary:hover:not(:disabled), .analyse:hover:not(:disabled) { background: var(--brand-dark); }
.secondary { background: #e8ece9; color: var(--text); }
.danger { background: #f8dddd; color: #8b2424; }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.ghost:hover:not(:disabled) { background: #f3f4f1; }
.small { padding: 8px 12px; font-size: .85rem; margin-top: 12px; }
.restored-notice { background: #eef6ee; color: #2e5c34; border: 1px solid #cfe6cf; border-radius: 12px; padding: 10px 14px; font-size: .88rem; margin-bottom: 14px; }
.history-card h2 { margin-bottom: 14px; }
.history-card h2 small { color: var(--muted); font-weight: 500; font-size: .82rem; }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.history-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.history-audio { display: block; width: 100%; margin-top: 8px; height: 32px; }
.history-item-main { min-width: 0; }
.history-item-title { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item-meta { color: var(--muted); font-size: .82rem; }
.history-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.history-item-actions .button { padding: 8px 12px; font-size: .85rem; }
.internal-recorder-card, .internal-card { border: 2px dashed #c9a13b; background: #fdf7e8; }
.internal-recorder-card h3, .internal-card h3 { color: #7a5c12; }
.internal-recorder-card h3 small, .internal-card h3 small { color: #a17a1f; font-weight: 500; font-size: .78rem; }
.internal-card .result-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 12px; }
.internal-card h4 { margin: 0 0 6px; font-size: .92rem; }
.analyse { width: 100%; margin-top: 18px; background: var(--brand); color: #fff; font-size: 1.05rem; padding: 15px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 20px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.upload-box { display: block; border: 2px dashed #b7c2ba; border-radius: 16px; padding: 24px; text-align: center; cursor: pointer; background: #fbfcfa; }
.upload-box span { display: block; color: var(--muted); margin-top: 7px; font-size: .92rem; }
.upload-box input { margin-top: 14px; max-width: 100%; }
.audio-preview { margin-top: 16px; padding: 14px; background: #f4f8f5; border-radius: 12px; }
audio { width: 100%; }
.microcopy { color: var(--muted); font-size: .82rem; line-height: 1.45; }
.hidden { display: none !important; }
.loader { width: 42px; height: 42px; border-radius: 50%; border: 4px solid #dbe6df; border-top-color: var(--brand); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-card { border-color: #e7b5b5; background: #fff7f7; }
.results-header { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin: 36px 0 18px; }
.results-header h2 { font-size: 2rem; margin-bottom: 5px; }
.results-header p { margin: 0; color: var(--muted); }
.compact { justify-content: flex-end; }
.summary-card { border-left: 5px solid var(--brand); }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.result-grid .card { margin: 0; }
.card h3 { font-size: 1.02rem; }
ul { padding-left: 20px; margin-bottom: 0; }
li { margin: 7px 0; line-height: 1.45; }
.empty { color: var(--muted); font-style: italic; }
.warning-card { background: var(--warning); }
.preformatted { white-space: pre-wrap; line-height: 1.58; }
.transcript-card summary { cursor: pointer; font-weight: 800; }
.transcript-card .preformatted { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; }
footer { text-align: center; padding: 26px; color: var(--muted); font-size: .84rem; }
@media (max-width: 720px) {
  .topbar, .results-header { flex-direction: column; }
  .topbar { padding-top: 26px; }
  .result-grid { grid-template-columns: 1fr; }
  .button-row, .button-row .button { width: 100%; }
  .card { padding: 19px; border-radius: 16px; }
  .compact { width: 100%; }
}
