:root {
    color-scheme: light;
    --ink: #172534;
    --muted: #617181;
    --navy: #17324d;
    --navy-2: #244b6d;
    --blue-soft: #edf5fb;
    --teal: #168276;
    --teal-soft: #e8f6f3;
    --sand: #f5f2eb;
    --surface: #ffffff;
    --line: #dbe3e8;
    --danger: #a8323b;
    --danger-soft: #fcebed;
    --success: #176c51;
    --success-soft: #e7f5ee;
    --shadow: 0 18px 50px rgba(23, 50, 77, .09);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #f7f8f7; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 85% 0, #e7f1f5 0, transparent 27rem), #f7f8f7; }
a { color: var(--navy-2); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #f0a43c; outline-offset: 3px; }
h1:focus-visible { outline: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.topbar { max-width: 1240px; width: calc(100% - 40px); margin: 0 auto; min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: white; background: var(--navy); border-radius: 13px; font-family: Georgia, serif; font-size: 1.4rem; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .72rem; }
.topbar nav { display: flex; gap: 8px; }
.topbar nav a { padding: 10px 14px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 650; font-size: .92rem; }
.topbar nav a:hover { background: rgba(255,255,255,.75); color: var(--ink); }
main { max-width: 1160px; width: calc(100% - 40px); margin: 0 auto; padding: 56px 0 80px; }
footer { border-top: 1px solid var(--line); min-height: 72px; padding: 20px max(20px, calc((100% - 1160px)/2)); display: flex; justify-content: space-between; gap: 20px; align-items: center; color: var(--muted); font-size: .86rem; }

.hero { display: grid; grid-template-columns: 1fr 300px; align-items: end; gap: 64px; margin-bottom: 44px; }
.eyebrow { color: var(--teal); margin: 0 0 10px; text-transform: uppercase; font-size: .74rem; font-weight: 800; letter-spacing: .13em; }
h1, h2 { letter-spacing: -.035em; color: var(--navy); }
h1 { max-width: 760px; margin: 0; font-size: clamp(2.35rem, 5vw, 4.4rem); line-height: 1.03; font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h2 { margin: 0 0 8px; font-size: 1.28rem; }
p { line-height: 1.62; }
.lead { max-width: 730px; color: var(--muted); font-size: 1.1rem; margin: 22px 0 0; }
.hero-note { padding: 20px; border-left: 2px solid var(--teal); display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; color: var(--muted); font-size: .86rem; }
.hero-note strong { color: var(--ink); }
.hero-note span:last-child { grid-column: 2; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); margin-top: 6px; box-shadow: 0 0 0 5px var(--teal-soft); }

.upload-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; align-items: start; }
.content-card, .process-card { border: 1px solid rgba(205,216,223,.9); border-radius: 20px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); }
.content-card { padding: clamp(24px, 5vw, 42px); }
.upload-card { overflow: hidden; }
.section-heading { display: flex; gap: 15px; align-items: flex-start; }
.section-heading p { margin: 0; color: var(--muted); font-size: .9rem; }
.step-number { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: white; font-weight: 800; font-size: .82rem; }
.settings-heading { margin-top: 40px; }
.drop-zone { position: relative; min-height: 230px; margin-top: 22px; border: 1.5px dashed #9fb4c3; border-radius: 16px; background: #f8fbfc; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; cursor: pointer; text-align: center; transition: .2s ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--teal); background: var(--teal-soft); transform: translateY(-1px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone > span:not(.button):not(.upload-icon) { color: var(--muted); font-size: .88rem; }
.upload-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--blue-soft); color: var(--navy); font-size: 1.5rem; font-weight: 300; margin-bottom: 4px; }
.button { min-height: 42px; padding: 10px 17px; border: 1px solid transparent; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; font-weight: 750; font-size: .9rem; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.button.primary { color: white; background: var(--navy); box-shadow: 0 8px 22px rgba(23,50,77,.17); }
.button.primary:hover { background: var(--navy-2); }
.button.secondary { color: var(--navy); background: white; border-color: #b9c8d2; }
.button.danger { color: var(--danger); background: white; border-color: #dfb5ba; }
.button.text-danger { color: var(--danger); background: transparent; }
.button.small { min-height: 36px; padding: 7px 12px; }
.button.wide { width: 100%; min-height: 52px; font-size: 1rem; }
.file-preview { margin-top: 14px; border: 1px solid var(--line); border-radius: 13px; padding: 13px; display: flex; align-items: center; gap: 12px; }
.file-preview[hidden] { display: none; }
.file-badge, .job-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; background: var(--blue-soft); color: var(--navy); }
.file-preview div:nth-child(2) { min-width: 0; flex: 1; }
.file-preview strong, .file-preview span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview span { margin-top: 3px; color: var(--muted); font-size: .78rem; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-size: 1.35rem; color: var(--muted); }
.icon-button:hover { background: var(--danger-soft); color: var(--danger); }

.form-grid { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.field label, .field legend { display: block; padding: 0; margin-bottom: 8px; color: var(--ink); font-weight: 750; font-size: .88rem; }
.field label span { color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select, .speaker-input input { width: 100%; border: 1px solid #bccbd4; border-radius: 10px; background: white; padding: 11px 12px; color: var(--ink); }
.field textarea { resize: vertical; }
.field > small { display: block; margin-top: 7px; color: var(--muted); line-height: 1.45; }
.full-width { grid-column: 1 / -1; }
.mode-field { border: 0; margin: 0; padding: 0; }
.choice-card { display: flex !important; align-items: flex-start; gap: 10px; padding: 10px; margin: 0 0 8px !important; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 500 !important; }
.choice-card:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.choice-card input { width: auto; margin-top: 4px; accent-color: var(--teal); }
.choice-card strong, .choice-card small { display: block; }
.choice-card small { margin-top: 2px; color: var(--muted); font-weight: 400; }
.check-row, .authority-check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check-row { margin: 28px 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.check-row input, .authority-check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--teal); flex: 0 0 auto; }
.check-row strong, .check-row small { display: block; }
.check-row small { color: var(--muted); margin-top: 3px; }
.privacy-callout { padding: 18px; border-radius: 13px; background: var(--sand); border-left: 3px solid #ba8e40; }
.privacy-callout p { color: #655f54; margin: 5px 0 0; font-size: .86rem; }
.authority-check { margin: 22px 0; font-size: .9rem; line-height: 1.5; }
.form-footnote { text-align: center; color: var(--muted); font-size: .76rem; margin: 12px 0 0; }
.upload-progress { margin: 20px 0; }
.upload-progress[hidden] { display: none; }
.upload-progress > div { display: flex; justify-content: space-between; margin-bottom: 7px; }
.upload-progress small { display: block; color: var(--muted); margin-top: 6px; }
progress { width: 100%; height: 8px; appearance: none; border: 0; border-radius: 99px; overflow: hidden; background: #e7ecef; }
progress::-webkit-progress-bar { background: #e7ecef; }
progress::-webkit-progress-value { background: var(--teal); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--teal); }

.process-card { position: sticky; top: 20px; padding: 28px; background: var(--navy); border-color: var(--navy); color: #dbe7ef; box-shadow: 0 24px 60px rgba(23,50,77,.18); }
.process-card h2 { color: white; font-family: Georgia, serif; font-weight: 500; font-size: 1.65rem; }
.process-card .eyebrow { color: #77d4c7; }
.process-list { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 0; }
.process-list li { position: relative; min-height: 40px; display: flex; align-items: flex-start; gap: 11px; font-size: .88rem; }
.process-list li:not(:last-child)::before { content: ''; position: absolute; left: 12px; top: 25px; height: 16px; border-left: 1px solid #52718b; }
.process-list li span { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #7891a5; border-radius: 50%; font-size: .7rem; flex: 0 0 auto; }
.aside-note { margin-top: 20px; padding: 17px; border-radius: 12px; background: rgba(255,255,255,.08); }
.aside-note p { margin: 5px 0 0; font-size: .83rem; color: #bfcfda; }

.page-header { margin-bottom: 28px; display: flex; justify-content: space-between; gap: 30px; align-items: flex-end; }
.page-header h1 { font-size: clamp(2.2rem, 4vw, 3.7rem); }
.page-header p:last-child { margin: 12px 0 0; color: var(--muted); }
.narrow { max-width: 720px; margin: 40px auto; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); font-size: 1.12rem; }
.job-list { display: grid; }
.job-row { padding: 15px 2px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto minmax(0,1fr) 160px auto; gap: 15px; align-items: center; color: var(--ink); text-decoration: none; }
.job-row:last-child { border-bottom: 0; }
.job-row:hover .job-main strong { color: var(--teal); }
.job-main { min-width: 0; }
.job-main strong, .job-main span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-main span { margin-top: 4px; color: var(--muted); font-size: .8rem; }
.job-progress-small span { display: block; margin-bottom: 4px; color: var(--muted); text-align: right; font-size: .75rem; }

.job-header h1, .result-header h1 { overflow-wrap: anywhere; }
.status-pill { padding: 8px 13px; border-radius: 99px; font-size: .82rem; font-weight: 800; }
.status-pill.success { color: var(--success); background: var(--success-soft); }
.status-pill.error { color: var(--danger); background: var(--danger-soft); }
.status-pill.active { color: #1c5c82; background: var(--blue-soft); }
.status-pill.neutral { color: var(--muted); background: #edf0f2; }
.progress-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.progress-overview > div { padding: 15px; border-radius: 12px; background: #f7f9fa; }
.progress-overview span, .progress-overview strong { display: block; }
.progress-overview span { color: var(--muted); font-size: .74rem; }
.progress-overview strong { margin-top: 6px; font-size: .95rem; }
.main-progress { height: 11px; margin: 22px 0 34px; }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stepper li { min-height: 82px; display: flex; align-items: flex-start; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); }
.stepper li > span { display: grid; place-items: center; width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%; background: #edf1f3; font-weight: 800; font-size: .74rem; }
.stepper strong, .stepper small { display: block; }
.stepper strong { color: var(--ink); font-size: .84rem; }
.stepper small { margin-top: 4px; line-height: 1.35; font-size: .72rem; }
.stepper li.done { border-color: #c4e4d8; background: #f6fbf9; }
.stepper li.done > span { background: var(--success); color: white; }
.stepper li.active { border-color: #77bdb3; background: var(--teal-soft); box-shadow: inset 0 0 0 1px #77bdb3; }
.stepper li.active > span { background: var(--teal); color: white; }
.alert { margin: 22px 0; padding: 15px 17px; border-radius: 12px; display: grid; gap: 3px; font-size: .88rem; line-height: 1.5; }
.alert[hidden] { display: none; }
.alert.error { color: #7c252d; background: var(--danger-soft); border: 1px solid #ecc9cd; }
.alert.success { color: var(--success); background: var(--success-soft); border: 1px solid #c2e4d6; }
.alert.info { color: #285b77; background: var(--blue-soft); border: 1px solid #cfe1ed; }
.button-row, .result-actions, .export-menu { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.button-row { margin-top: 24px; }
.refresh-note { color: var(--muted); text-align: center; font-size: .8rem; }

.result-header { align-items: center; }
.result-card { padding-top: 0; overflow: hidden; }
.tabs { display: flex; gap: 2px; margin: 0 calc(clamp(24px, 5vw, 42px) * -1); padding: 0 clamp(24px, 5vw, 42px); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { padding: 19px 15px 15px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; font-weight: 750; }
.tabs button.active { color: var(--navy); border-bottom-color: var(--teal); }
.tab-panel { padding-top: 30px; }
.speaker-editor { padding: 20px; margin-bottom: 28px; border-radius: 14px; background: var(--sand); }
.speaker-editor p { color: var(--muted); margin: 4px 0 16px; font-size: .85rem; }
.speaker-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.speaker-input { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.speaker-input label { grid-column: 1/-1; font-size: .76rem; font-weight: 750; }
.transcript-list { display: grid; }
.transcript-segment { padding: 19px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 70px 1fr; gap: 18px; }
.transcript-segment:last-child { border-bottom: 0; }
.transcript-segment time { color: var(--teal); font-variant-numeric: tabular-nums; font-weight: 800; font-size: .82rem; }
.transcript-segment strong { display: block; margin-bottom: 5px; color: var(--navy); font-size: .86rem; }
.transcript-segment p { margin: 0; line-height: 1.72; }
.result-section { max-width: 820px; padding: 8px 0 24px; }
.result-section + .result-section { padding-top: 24px; border-top: 1px solid var(--line); }
.preserve-lines { white-space: pre-wrap; line-height: 1.72; }
.metadata-list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.metadata-list div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.metadata-list dt { color: var(--muted); font-size: .76rem; }
.metadata-list dd { margin: 5px 0 0; overflow-wrap: anywhere; font-weight: 650; }
.result-actions { justify-content: space-between; margin-top: 18px; }
.privacy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.privacy-grid .content-card { box-shadow: 0 10px 32px rgba(23,50,77,.06); }
.privacy-grid p { color: var(--muted); }

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; gap: 24px; }
    .hero-note { max-width: 420px; }
    .upload-layout { grid-template-columns: 1fr; }
    .process-card { position: static; }
    .stepper { grid-template-columns: 1fr 1fr; }
    .progress-overview { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .topbar { width: calc(100% - 28px); min-height: 72px; padding: 12px 0; flex-wrap: wrap; gap: 8px; }
    .brand small { display: none; }
    .topbar nav { width: 100%; gap: 0; padding-top: 5px; border-top: 1px solid var(--line); }
    .topbar nav a { flex: 1; padding: 9px 8px; text-align: center; font-size: .78rem; }
    main { width: calc(100% - 28px); padding: 34px 0 56px; }
    footer { flex-direction: column; align-items: flex-start; }
    h1 { font-size: 2.5rem; }
    .content-card { padding: 22px 18px; border-radius: 16px; }
    .form-grid, .privacy-grid, .speaker-grid, .metadata-list { grid-template-columns: 1fr; }
    .mode-field, .full-width { grid-column: auto; }
    .drop-zone { min-height: 210px; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .job-row { grid-template-columns: auto minmax(0,1fr) auto; }
    .job-progress-small { display: none; }
    .progress-overview, .stepper { grid-template-columns: 1fr; }
    .tabs { margin: 0 -18px; padding: 0 10px; }
    .transcript-segment { grid-template-columns: 55px 1fr; gap: 10px; }
    .result-actions { align-items: stretch; flex-direction: column; }
    .result-actions .button { width: 100%; }
}

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