:root {
  --ink: #18202a;
  --muted: #687481;
  --line: #dfe5e8;
  --surface: #ffffff;
  --canvas: #f5f7f7;
  --accent: #176b5b;
  --accent-hover: #105548;
  --accent-soft: #e8f3f0;
  --danger: #aa3d39;
  --danger-soft: #f9eceb;
  --shadow: 0 18px 45px rgba(22, 32, 40, .07);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 90% 0, #e6f0ed 0, transparent 28rem), var(--canvas); }
a { color: inherit; }
button, input, textarea { font: inherit; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1080px) / 2)); border-bottom: 1px solid rgba(223,229,232,.8); background: rgba(245,247,247,.84); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 10; }
.brand { display: inline-flex; gap: 11px; align-items: center; font-weight: 750; letter-spacing: -.02em; text-decoration: none; font-size: 19px; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: white; font-size: 15px; }
.nav { display: flex; align-items: center; gap: 24px; }
.nav a, .link-button { color: var(--muted); font-size: 14px; font-weight: 650; text-decoration: none; }
.nav a:hover, .link-button:hover { color: var(--ink); }
.nav form { margin: 0; }
.link-button { border: 0; background: none; padding: 0; cursor: pointer; }

.shell { max-width: 1080px; margin: 0 auto; padding: 64px 24px 80px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(38px, 6vw, 64px); line-height: .98; letter-spacing: -.055em; }
h2 { margin-bottom: 10px; font-size: 26px; letter-spacing: -.035em; }
h3 { margin-bottom: 8px; }
.eyebrow { margin-bottom: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 800; }
.lead { max-width: 680px; color: var(--muted); font-size: 18px; line-height: 1.55; }
.muted { color: var(--muted); line-height: 1.55; }
.hero { padding: 28px 0 38px; }
.page-title { margin-bottom: 32px; }

.card { background: var(--surface); border: 1px solid rgba(223,229,232,.9); border-radius: 22px; box-shadow: var(--shadow); }
.upload-card { padding: 20px; }
.dropzone { min-height: 220px; border: 1.5px dashed #abc0ba; border-radius: 16px; background: #f8fbfa; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-align: center; transition: .18s ease; }
.dropzone:hover, .dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone strong { font-size: 18px; }
.dropzone span:last-child { color: var(--muted); font-size: 14px; }
.drop-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: white; background: var(--accent); font-size: 24px; margin-bottom: 4px; }
.upload-options { display: grid; grid-template-columns: 1.2fr 1.4fr auto; gap: 18px; align-items: end; margin-top: 20px; }
.compact-field, .stack label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 700; }
input[type="text"], input[type="password"], input[type="number"], .stack input:not([type="hidden"]) { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid #ccd5d9; border-radius: 11px; color: var(--ink); background: white; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23,107,91,.12); }
.check-row { display: flex; gap: 11px; align-items: center; min-height: 46px; cursor: pointer; }
.check-row input { accent-color: var(--accent); width: 18px; height: 18px; }
.check-row span { display: flex; flex-direction: column; gap: 3px; }
.check-row small { color: var(--muted); font-weight: 400; }

.button { min-height: 46px; border-radius: 11px; padding: 11px 18px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; font-weight: 750; text-decoration: none; cursor: pointer; transition: .16s ease; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-hover); }
.button.secondary { background: white; border-color: var(--line); color: var(--ink); }
.button.secondary:hover { border-color: #b6c0c5; }
.button.danger { color: var(--danger); background: transparent; border-color: #e6c3c1; }
.button:disabled { opacity: .56; cursor: wait; }
.wide { width: 100%; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }

.upload-progress { margin: 20px 4px 2px; }
.upload-progress p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.progress-track { height: 8px; overflow: hidden; background: #e7ecec; border-radius: 99px; }
.progress-track.large { height: 12px; }
.progress-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #176b5b, #45a68f); transition: width .35s ease; }

.section-head { margin-top: 64px; display: flex; justify-content: space-between; align-items: end; }
.job-list { overflow: hidden; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); }
.job-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 24px; gap: 18px; align-items: center; padding: 20px 22px; text-decoration: none; border-bottom: 1px solid var(--line); }
.job-row:last-child { border-bottom: 0; }
.job-row:hover { background: #fafcfc; }
.job-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.job-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-main small { color: var(--muted); }
.job-arrow { color: var(--muted); font-size: 20px; }
.status { display: inline-flex; align-items: center; min-height: 29px; padding: 5px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-completed { color: #176b5b; background: #e4f3ef; }
.status-failed { color: var(--danger); background: var(--danger-soft); }
.status-running, .status-uploading { color: #6d550c; background: #faf0c9; }
.status-queued { color: #46556a; background: #e9edf2; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.back { display: inline-block; margin-bottom: 32px; color: var(--muted); text-decoration: none; font-weight: 650; }
.job-header { display: flex; justify-content: space-between; gap: 24px; align-items: start; margin-bottom: 34px; }
.job-header h1 { max-width: 820px; overflow-wrap: anywhere; font-size: clamp(34px, 5vw, 54px); }
.progress-card { padding: 28px; }
.progress-copy { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.progress-number { color: var(--accent); font-size: 30px; letter-spacing: -.04em; }
.progress-card .muted { margin: 14px 0 0; }
.result-card { margin-top: 18px; padding: 28px; display: flex; justify-content: space-between; align-items: center; gap: 28px; }
.result-card p { margin-bottom: 0; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.detail-card { padding: 22px; display: flex; flex-direction: column; gap: 6px; box-shadow: none; }
.detail-card span { color: var(--muted); font-size: 13px; }
.notice { border-radius: 13px; padding: 14px 16px; margin: 18px 0; line-height: 1.5; }
.notice p { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice.error { color: #7c2c29; background: var(--danger-soft); border: 1px solid #efcfcd; }
.notice.success { color: #145c4e; background: var(--accent-soft); border: 1px solid #cce2dc; }
.is-hidden { display: none !important; }
.delete-form { margin-top: 34px; }

.transcript-workspace { margin-top: 64px; scroll-margin-top: 90px; }
.transcript-heading { margin-top: 0; }
.transcript-heading .muted { max-width: 700px; margin-bottom: 0; }
.audio-card { position: sticky; top: 84px; z-index: 7; padding: 18px 20px; display: grid; grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr); align-items: center; gap: 24px; box-shadow: 0 12px 34px rgba(22, 32, 40, .11); }
.audio-card audio { width: 100%; height: 42px; }
.audio-copy { display: flex; flex-direction: column; gap: 5px; }
.audio-copy span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.audio-missing { display: block; position: static; box-shadow: none; }
.speaker-editor { margin-top: 18px; padding: 24px; box-shadow: none; }
.editor-section-title p { color: var(--muted); margin: 0; font-size: 14px; }
.speaker-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-top: 18px; }
.speaker-fields label { display: flex; flex-direction: column; gap: 7px; }
.speaker-fields label span { color: var(--muted); font-size: 12px; font-weight: 750; }
.speaker-fields input { min-height: 44px; padding: 10px 12px; border: 1px solid #ccd5d9; border-radius: 10px; }
.editor-toolbar { position: sticky; top: 174px; z-index: 6; margin: 18px 0; padding: 12px; display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: 14px; align-items: center; border-radius: 15px; box-shadow: 0 10px 30px rgba(22, 32, 40, .1); }
.transcript-search input { width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid #ccd5d9; border-radius: 10px; }
.editor-toolbar .muted { margin: 0; font-size: 13px; }
.transcript-list { display: grid; gap: 10px; }
.transcript-segment { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding: 16px; border-radius: 15px; box-shadow: none; transition: border-color .18s ease, background .18s ease; }
.transcript-segment.is-playing { border-color: #62a995; background: #f7fbfa; }
.transcript-segment.is-filtered { display: none; }
.timecode { align-self: start; justify-self: start; min-height: 34px; padding: 7px 9px; border: 0; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-size: 12px; font-weight: 800; cursor: pointer; font-variant-numeric: tabular-nums; }
.timecode:hover { background: #d8ece7; }
.timecode.static { cursor: default; display: inline-flex; }
.segment-body { min-width: 0; }
.speaker-label { display: block; margin: 2px 0 8px; color: var(--accent); font-size: 13px; }
.transcript-segment textarea { display: block; width: 100%; min-height: 58px; resize: vertical; overflow: hidden; padding: 0; border: 0; border-radius: 6px; color: var(--ink); background: transparent; line-height: 1.55; outline: none; }
.transcript-segment textarea:focus { padding: 8px 10px; margin: -8px -10px; background: white; box-shadow: 0 0 0 2px rgba(23,107,91,.16); }
.editor-footer { display: flex; justify-content: flex-end; margin-top: 18px; }

.login-wrap { min-height: calc(100vh - 210px); display: grid; place-items: center; }
.login-card { width: min(100%, 440px); padding: 34px; }
.login-card h1 { font-size: 42px; }
.stack { display: grid; gap: 18px; margin-top: 24px; }
.settings-card { max-width: 560px; padding: 30px; }

@media (max-width: 760px) {
  .topbar { padding: 0 18px; }
  .nav { gap: 14px; }
  .nav a:first-child { display: none; }
  .shell { padding: 38px 18px 60px; }
  .upload-options { grid-template-columns: 1fr; align-items: stretch; }
  .job-row { grid-template-columns: minmax(0, 1fr) auto; }
  .job-arrow { display: none; }
  .result-card, .job-header { flex-direction: column; }
  .details-grid { grid-template-columns: 1fr; }
  .result-card .button-row, .result-card .button { width: 100%; }
  .audio-card { position: static; grid-template-columns: 1fr; gap: 12px; }
  .editor-toolbar { top: 84px; grid-template-columns: 1fr auto; }
  .editor-toolbar .muted { display: none; }
  .transcript-segment { grid-template-columns: 1fr; gap: 8px; }
  .timecode { margin-bottom: 2px; }
}
