:root {
  color-scheme: light;
  --paper: #f5f3ee;
  --surface: #fffefa;
  --surface-2: #edeae2;
  --ink: #20221f;
  --muted: #6d7069;
  --line: #d9d5ca;
  --accent: #315c4c;
  --accent-soft: #dce9e2;
  --danger: #a33f35;
  --danger-soft: #f5ded9;
  --warning: #8a6118;
  --shadow: 0 18px 50px rgba(33, 37, 31, 0.08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

.shell { min-height: 100vh; display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.sidebar { border-right: 1px solid var(--line); padding: 24px 18px; background: rgba(255,255,255,.42); position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 26px; }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; background: var(--accent); color: white; display: grid; place-items: center; font-weight: 750; }
.brand-title { font-size: 17px; font-weight: 760; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.nav-button { width: 100%; display: flex; align-items: center; gap: 9px; border: 0; border-radius: 11px; padding: 11px 12px; color: var(--ink); background: transparent; text-align: left; }
.nav-button:hover, .nav-button.active { background: var(--accent-soft); color: #183d30; }
.sidebar-label { margin: 24px 10px 8px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.history { display: grid; gap: 4px; }
.history-item { position: relative; width: 100%; border: 0; border-radius: 10px; padding: 10px 11px; background: transparent; text-align: left; }
.history-item:hover, .history-item.active { background: var(--surface); box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.history-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 620; }
.history-meta { color: var(--muted); font-size: 11px; margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #999; }
.status-dot.completed { background: #3f8064; }
.status-dot.processing, .status-dot.queued { background: #c28c2b; }
.status-dot.error { background: var(--danger); }
.sidebar-foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }

.main { min-width: 0; }
.topbar { height: 72px; display: flex; align-items: center; gap: 12px; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(245,243,238,.86); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 5; }
.topbar-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.content { max-width: 1040px; margin: 0 auto; padding: 46px 34px 80px; }
.hero { margin-bottom: 28px; }
.eyebrow { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .09em; }
h1 { font-size: clamp(34px, 5vw, 62px); line-height: 1.02; letter-spacing: -.045em; margin: 10px 0 14px; max-width: 800px; }
.lead { color: var(--muted); font-size: 18px; line-height: 1.55; max-width: 740px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.composer { padding: 24px; }
.source-tabs, .tabs, .provider-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.source-tab, .tab, .provider-option { border: 1px solid transparent; border-radius: 10px; background: transparent; padding: 9px 12px; color: var(--muted); }
.source-tab.active, .tab.active, .provider-option.active { background: var(--accent-soft); color: #173f31; border-color: #bfd4c9; }
.field { display: grid; gap: 7px; margin-top: 18px; }
.field label, .field-label { font-size: 13px; font-weight: 650; }
.input { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #fff; padding: 12px 13px; color: var(--ink); outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dropzone { border: 1.5px dashed #b8b5ab; border-radius: 14px; padding: 34px 20px; text-align: center; color: var(--muted); background: #faf9f5; transition: .16s ease; }
.dropzone.active { border-color: var(--accent); background: var(--accent-soft); }
.dropzone strong { color: var(--ink); display: block; margin-bottom: 6px; }
.file-name { margin-top: 10px; color: var(--accent); font-weight: 650; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.check { display: flex; gap: 9px; align-items: flex-start; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 18px; }
.check input { margin-top: 2px; accent-color: var(--accent); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 22px; }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 10px 14px; font-weight: 650; }
.btn:hover { border-color: #aaa69a; }
.btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn.danger { color: var(--danger); border-color: #dfb6af; background: #fff9f8; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.45; }

.notice { padding: 12px 14px; border-radius: 11px; margin: 16px 0; background: var(--accent-soft); color: #244b3d; font-size: 13px; }
.notice.error { background: var(--danger-soft); color: #7a2b24; }
.notice.warning { background: #f5ead3; color: #654711; }
.progress-card { padding: 24px; margin-top: 22px; }
.progress-head { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.progress-title { font-size: 18px; font-weight: 720; }
.progress-value { color: var(--muted); font-size: 13px; }
.progress-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 16px 0 10px; }
.progress-bar { height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }

.result-head { margin-bottom: 24px; }
.result-head h1 { font-size: clamp(30px, 4vw, 48px); }
.result-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.pill { background: var(--surface-2); border-radius: 999px; padding: 6px 10px; }
.result-card { overflow: hidden; }
.result-toolbar { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.result-body { padding: clamp(20px, 4vw, 42px); line-height: 1.7; font-size: 16px; }
.markdown { max-width: 780px; }
.markdown h2 { margin: 1.8em 0 .55em; font-size: 25px; letter-spacing: -.025em; }
.markdown h3 { margin: 1.5em 0 .45em; font-size: 18px; }
.markdown ul, .markdown ol { padding-left: 24px; }
.markdown li { margin: 7px 0; }
.timecode { border: 0; background: var(--accent-soft); color: #1f5542; border-radius: 6px; padding: 2px 6px; font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; vertical-align: 1px; }
.transcript { display: grid; gap: 0; }
.segment { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 16px; padding: 13px 0; border-bottom: 1px solid #ece9e1; }
.segment:last-child { border-bottom: 0; }
.segment-text { line-height: 1.6; }
.export-menu { display: flex; gap: 7px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(430px, 100%); padding: 32px; }
.login-card h1 { font-size: 38px; }
.mobile-menu { display: none; }

@media (max-width: 820px) {
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; width: min(320px, 88vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); background: var(--paper); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 0 18px; }
  .content { padding: 32px 18px 60px; }
  .form-grid { grid-template-columns: 1fr; }
  .segment { grid-template-columns: 66px minmax(0, 1fr); gap: 10px; }
}

