:root {
  --vinho: #5A1E2C;
  --malva: #B9808B;
  --malva-clara: #E6C6CB;
  --linho: #F1EAE7;
  --grafite: #231A1C;
  --oliva: #6B6B4C;

  --bg: #F1EAE7;
  --surface: #FFFFFF;
  --surface-2: #F8F3F1;
  --line: #E4D8D5;
  --text: #231A1C;
  --muted: #7A6A6D;
  --accent: #5A1E2C;
  --accent-ink: #FFFFFF;
  --accent-soft: #F3E3E6;
  --hl: #E6C6CB;
  --ok: #4E6B3D;
  --err: #A2322E;
  --shadow: 0 1px 2px rgba(35, 26, 28, .05), 0 8px 24px rgba(35, 26, 28, .06);
  --radius: 16px;
  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #181214; --surface: #221A1D; --surface-2: #2A2124; --line: #3A2E32;
    --text: #F1EAE7; --muted: #B3A3A6; --accent: #D49AA6; --accent-ink: #231A1C;
    --accent-soft: #3A242B; --hl: #5A2E39; --ok: #9DBB86; --err: #F08A84;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #181214; --surface: #221A1D; --surface-2: #2A2124; --line: #3A2E32;
  --text: #F1EAE7; --muted: #B3A3A6; --accent: #D49AA6; --accent-ink: #231A1C;
  --accent-soft: #3A242B; --hl: #5A2E39; --ok: #9DBB86; --err: #F08A84; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.err { color: var(--err); }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; color: var(--text); transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { border-color: var(--malva); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; color: var(--text); }
.icon-btn:hover { background: var(--surface-2); }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border-radius: 24px; padding: 32px 24px; box-shadow: var(--shadow); display: grid; gap: 14px; text-align: center; }
.login-card input { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 17px; text-align: center; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 300px 1fr; grid-template-rows: 60px 1fr; height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 0 16px; padding-top: env(safe-area-inset-top); background: var(--surface); border-bottom: 1px solid var(--line); z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 600; font-size: 21px; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand.big { font-size: 28px; justify-content: center; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--vinho); color: var(--linho); font-family: var(--serif); font-size: 18px; }
.big .brand-mark { width: 42px; height: 42px; font-size: 24px; border-radius: 12px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.sidebar { border-right: 1px solid var(--line); background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.search { width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 15px; }
.hist { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; padding: 0 8px 24px; }
.hist-item { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; text-decoration: none; color: var(--text); }
.hist-item:hover { background: var(--surface-2); }
.hist-item.active { background: var(--accent-soft); }
.hist-thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2) center/cover; display: grid; place-items: center; color: var(--malva); overflow: hidden; }
.hist-title { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hist-meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.hist-empty { color: var(--muted); font-size: 14px; padding: 12px 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--malva); display: inline-block; }
.dot.live { background: var(--accent); animation: pulse 1.2s infinite; }
.dot.err { background: var(--err); }
@keyframes pulse { 50% { opacity: .3; } }

.main { overflow-y: auto; padding: 32px 40px 80px; scroll-padding-top: 80px; }
.wrap { max-width: 860px; margin: 0 auto; }
.scrim { display: none; }

/* ---------- nova ---------- */
.hero { text-align: center; margin: 4vh 0 28px; }
.hero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(30px, 5vw, 44px); line-height: 1.1; margin: 0 0 10px; letter-spacing: -.02em; }
.hero h1 em { font-style: normal; color: var(--malva); }
.hero p { margin: 0; color: var(--muted); }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.seg button { border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.url-row { display: flex; gap: 8px; }
.url-row input { flex: 1; min-width: 0; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 16px; }
.url-row input:focus, .search:focus, .chat-form textarea:focus { outline: 2px solid var(--malva); outline-offset: -1px; }
.platforms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.drop { display: grid; place-items: center; gap: 8px; text-align: center; border: 2px dashed var(--line); border-radius: 14px; padding: 36px 16px; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--malva); background: var(--accent-soft); }
.drop svg { width: 36px; height: 36px; color: var(--malva); }
.drop strong { font-size: 17px; }
.opts { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.opts summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
.opts summary::-webkit-details-marker { display: none; }
.opts summary svg { width: 16px; height: 16px; transition: transform .2s; }
.opts[open] summary svg { transform: rotate(90deg); }
.opts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.field label, .field .lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.field small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.4; }
.check { display: flex; gap: 10px; align-items: flex-start; grid-column: 1 / -1; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 2px; }
.go { margin-top: 18px; }
.go .btn { padding: 14px; font-size: 16px; }
.up-progress { margin-top: 16px; }
.tips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.tip { font-size: 13px; color: var(--muted); padding: 14px; border-radius: 14px; border: 1px solid var(--line); }
.tip b { display: block; color: var(--text); margin-bottom: 2px; font-size: 14px; }

/* ---------- tarefa ---------- */
.job-head { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin-bottom: 20px; }
.job-thumb { width: 120px; aspect-ratio: 16/9; border-radius: 12px; background: var(--surface-2) center/cover; display: grid; place-items: center; color: var(--malva); }
.job-thumb svg { width: 32px; height: 32px; }
.job-title { font-family: var(--serif); font-weight: 500; font-size: clamp(22px, 3.2vw, 30px); line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; word-break: break-word; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.meta a { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.progress-card { display: grid; gap: 16px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.step { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.step i { height: 4px; border-radius: 4px; background: var(--line); display: block; overflow: hidden; }
.step.done i { background: var(--malva); }
.step.now { color: var(--text); font-weight: 600; }
.step.now i::after { content: ""; display: block; height: 100%; width: var(--p, 30%); background: var(--accent); border-radius: 4px; transition: width .4s; }
.bar { height: 10px; border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--malva), var(--accent)); border-radius: 10px; transition: width .4s; }
.big-status { font-size: 18px; font-weight: 600; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.big-status span { color: var(--muted); font-weight: 500; font-size: 15px; }
.note { font-size: 13px; color: var(--muted); background: var(--surface-2); padding: 12px 14px; border-radius: 12px; }
.error-card { border-left: 4px solid var(--err); }

/* player */
#player-slot { position: sticky; top: 8px; z-index: 3; }
.player { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 14px; margin: 0 0 16px; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.play svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.player input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); white-space: nowrap; }
.speed { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 4px 8px; font-size: 13px; font-weight: 700; cursor: pointer; flex: none; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.tabs button.on { color: var(--text); border-color: var(--accent); }

/* resumo */
.tldr { font-family: var(--serif); font-size: clamp(20px, 2.8vw, 25px); line-height: 1.35; font-weight: 500; margin: 0 0 18px; padding-left: 16px; border-left: 3px solid var(--malva); }
.sec { margin: 26px 0 0; }
.sec h3 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.points { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.points li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; background: var(--surface); padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow); }
.points li b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.chapters { display: grid; gap: 0; position: relative; }
.chapter { display: grid; grid-template-columns: 70px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; cursor: pointer; width: 100%; }
.chapter:hover .ts { background: var(--accent); color: var(--accent-ink); }
.chapter strong { display: block; font-size: 15px; }
.chapter span { font-size: 14px; color: var(--muted); }
.ts { display: inline-block; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); border: 0; cursor: pointer; height: fit-content; text-align: center; transition: background .15s, color .15s; }
.quote { margin: 0 0 10px; padding: 14px 16px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); font-style: italic; }
.quote .ts { font-style: normal; margin-left: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 13px; padding: 4px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.key-steps { margin: 10px 0 16px; padding-left: 20px; }
.key-steps li { margin-bottom: 4px; }
.key-row { display: flex; gap: 8px; flex-wrap: wrap; }
.key-row input { flex: 1; min-width: 200px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }

/* transcrição */
.tr-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.tr-tools .search { flex: 1; min-width: 180px; }
.follow { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.follow input { accent-color: var(--accent); }
.transcript { display: grid; gap: 2px; }
.seg-line { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 8px 10px; border-radius: 10px; scroll-margin: 140px; }
.seg-line:hover { background: var(--surface); }
.seg-line.now { background: var(--accent-soft); }
.seg-line p { margin: 0; }
mark { background: var(--hl); color: inherit; border-radius: 3px; padding: 0 1px; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 12px 16px; border-radius: 16px; line-height: 1.5; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.model { align-self: flex-start; background: var(--surface); box-shadow: var(--shadow); border-bottom-left-radius: 4px; }
.msg.model ul, .msg.model ol { margin: 6px 0; padding-left: 20px; }
.msg.model p { margin: 0 0 8px; }
.msg.model p:last-child { margin: 0; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest button { border: 1px solid var(--line); background: var(--surface); padding: 8px 12px; border-radius: 99px; font-size: 14px; cursor: pointer; text-align: left; }
.suggest button:hover { border-color: var(--malva); }
.chat-form { display: flex; gap: 8px; position: sticky; bottom: -80px; padding: 12px 0 0; background: var(--bg); }
.chat-form textarea { flex: 1; resize: none; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); min-height: 48px; max-height: 140px; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--malva); animation: pulse 1s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }

/* menu */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; min-width: 240px; z-index: 10; display: grid; }
.menu button, .menu a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 9px; background: none; border: 0; cursor: pointer; text-align: left; text-decoration: none; color: var(--text); font-size: 14px; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .danger { color: var(--err); }

/* modal e toast */
.modal { border: 0; border-radius: 20px; padding: 0; width: min(460px, calc(100% - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal::backdrop { background: rgba(35, 26, 28, .45); }
.modal-in { padding: 24px; display: grid; gap: 14px; }
.modal-in h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 24px; }
.qr { width: 220px; height: 220px; margin: 0 auto; background: #fff; border-radius: 16px; padding: 12px; }
.qr svg { width: 100%; height: 100%; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--grafite); color: var(--linho); padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.only-mobile { display: none; }

/* ---------- celular ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .topbar { min-height: 56px; padding-left: 8px; padding-right: 8px; }
  .only-mobile { display: inline-grid; }
  .hide-mobile { display: none !important; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); z-index: 20; transform: translateX(-102%); transition: transform .25s ease; padding-top: calc(16px + env(safe-area-inset-top)); box-shadow: var(--shadow); }
  .app.drawer .sidebar { transform: none; }
  .app.drawer .scrim { display: block; position: fixed; inset: 0; background: rgba(35,26,28,.4); z-index: 15; }
  .main { padding: 20px 16px calc(90px + env(safe-area-inset-bottom)); }
  .hero { margin: 8px 0 20px; }
  .card { padding: 18px 16px; }
  .opts-grid { grid-template-columns: 1fr; }
  .tips { grid-template-columns: 1fr; }
  .url-row { flex-direction: column; }
  .job-head { grid-template-columns: 1fr; }
  .job-thumb { width: 100%; max-height: 190px; }
  .job-thumb.empty { display: none; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .player { padding: 8px 10px; gap: 8px; }
  .time .dur { display: none; }
  .seg-line { grid-template-columns: 1fr; gap: 2px; padding: 8px; }
  .seg-line .ts { justify-self: start; }
  .chapter { grid-template-columns: 62px 1fr; }
  .msg { max-width: 94%; }
  .chat-form { bottom: calc(-90px - env(safe-area-inset-bottom)); padding-bottom: 8px; }
  .tabs button { flex: 1; justify-content: center; padding: 12px 8px; }
  .menu { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); min-width: 0; }
}
