:root {
  --navy: #13233F;
  --navy-2: #0D1A31;
  --navy-3: #1F3560;
  --gold: #B3935A;
  --gold-2: #9A7B45;
  --gold-soft: #EFE6D3;
  --bg: #F6F3EC;
  --paper: #FFFDF8;
  --ink: #1C2333;
  --muted: #6A6F7B;
  --rule: #E2DACB;
  --rule-2: #EDE7DB;
  --danger: #8A2E3B;
  --ok: #2F6B4F;
  --side-ink: #E9E4D8;
  --side-muted: #9AA3B5;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0F1828;
  --paper: #15213A;
  --ink: #E7E3DA;
  --muted: #9AA3B5;
  --rule: #26365A;
  --rule-2: #1E2C4A;
  --gold-soft: #2C2A22;
  --navy: #C9AE7A;
  --navy-3: #D8C18F;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: normal; color: var(--navy); margin: 0; }

.app { display: grid; grid-template-columns: 272px 1fr; height: 100vh; }

/* Barra lateral */
.sidebar { background: var(--navy-2); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 14px 12px; min-height: 0; border-right: 1px solid #000; }
.brand { display: flex; gap: 11px; align-items: center; padding: 2px 4px 18px; border-bottom: 1px solid rgba(179,147,90,.25); margin-bottom: 16px; }
.mono { width: 38px; height: 38px; flex: none; border: 1px solid var(--gold); color: var(--gold); display: grid; place-items: center; font-family: var(--serif); font-size: 15px; letter-spacing: .04em; }
.brand-name { font-family: var(--serif); font-size: 15px; line-height: 1.25; color: #F3EEE3; }
.brand-sub { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--side-muted); margin-top: 2px; }
.side-search { margin: 12px 0 14px; width: 100%; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 4px; padding: 7px 10px; color: var(--side-ink); }
.side-search::placeholder { color: var(--side-muted); }
.side-label { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--side-muted); padding: 0 6px 6px; }
.list { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.item { display: block; width: 100%; text-align: left; background: none; border: 0; border-left: 2px solid transparent; padding: 8px 10px; cursor: pointer; color: var(--side-ink); border-radius: 0 4px 4px 0; }
.item:hover { background: rgba(255,255,255,.04); }
.item.active { background: rgba(179,147,90,.12); border-left-color: var(--gold); }
.item-title { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: 11.5px; color: var(--side-muted); margin-top: 1px; }
.item-sub .st { color: var(--gold); }
.item-sub .st.err { color: #D88A94; }
.empty-list { color: var(--side-muted); font-size: 12.5px; padding: 6px 6px; }
.side-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 6px 0; border-top: 1px solid rgba(255,255,255,.07); margin-top: 8px; }
.side-foot .link { color: var(--side-ink); }
.ver { font-size: 11px; color: var(--side-muted); }

/* Conteúdo */
.main { overflow-y: auto; position: relative; }
.view { max-width: 980px; margin: 0 auto; padding: 40px 44px 80px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 30px; line-height: 1.2; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-2); margin-bottom: 6px; }
.lead { color: var(--muted); font-size: 15px; margin: 8px 0 0; max-width: 640px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0; }
.menu-btn { display: none; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule); background: var(--paper); padding: 8px 14px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--gold); }
.btn:disabled { opacity: .45; cursor: default; border-color: var(--rule); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn-primary { background: #13233F; border-color: #13233F; color: #F6F1E6; }
.btn-primary:hover { background: #1F3560; border-color: #1F3560; }
.btn-gold { background: transparent; border: 1px solid var(--gold); color: #EADFC8; justify-content: center; }
.btn-gold:hover { background: rgba(179,147,90,.14); }
.btn-ghost { background: none; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--danger); border-color: transparent; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--navy-3); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(179,147,90,.6); }

.drop { display: block; border: 1px dashed #BFAE8A; background: var(--paper); padding: 54px 24px; text-align: center; cursor: pointer; border-radius: 6px; transition: background .15s, border-color .15s; }
.drop:hover, .drop.over { background: var(--gold-soft); border-color: var(--gold); }
.drop-icon { color: var(--gold-2); margin-bottom: 10px; }
.drop-title { font-family: var(--serif); font-size: 21px; color: var(--navy); }
.drop-sub { color: var(--muted); margin-top: 6px; font-size: 13.5px; }
.u { text-decoration: underline; text-underline-offset: 3px; color: var(--navy-3); }

.setup { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 22px; }
.file-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--rule-2); }
.file-name { font-weight: 600; word-break: break-all; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.grid2 .field:first-child { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; color: var(--muted); }
.field input, .field select, .field textarea { border: 1px solid var(--rule); background: var(--paper); border-radius: 4px; padding: 8px 10px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid rgba(179,147,90,.35); border-color: var(--gold); }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 16px; }

.checks { margin-top: 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.chk { border-top: 1px solid var(--rule); padding-top: 10px; font-size: 12.5px; }
.chk b { display: block; font-weight: 600; font-size: 12px; letter-spacing: .04em; color: var(--navy); margin-bottom: 2px; }
.chk.warn b { color: var(--danger); }

/* Processamento */
.steps { list-style: none; padding: 0; margin: 0 0 22px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.steps li { border-top: 2px solid var(--rule); padding-top: 9px; color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.steps .n { width: 20px; height: 20px; border: 1px solid currentColor; border-radius: 50%; display: grid; place-items: center; font-size: 11px; flex: none; }
.steps li.on { border-color: var(--gold); color: var(--ink); }
.steps li.done { border-color: var(--navy); color: var(--navy); }
.steps li.done .n { background: var(--navy); color: var(--paper); border-color: var(--navy); }
.progress { height: 6px; background: var(--rule-2); border-radius: 3px; overflow: hidden; }
.bar { height: 100%; width: 0; background: var(--gold); transition: width .4s; }
.prog-row { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--muted); }
.notice { margin-top: 14px; padding: 10px 14px; border-left: 3px solid var(--gold); background: var(--gold-soft); font-size: 13px; }
.error-box { margin-top: 16px; padding: 14px 16px; border: 1px solid #D9B8BD; border-left: 3px solid var(--danger); background: var(--paper); }
.err-actions { display: flex; gap: 10px; margin-top: 12px; }
.job-actions { margin-top: 6px; }
.live { margin-top: 26px; border-top: 1px solid var(--rule); padding-top: 18px; font-family: var(--serif); font-size: 15px; max-height: 46vh; overflow-y: auto; }
.live p { margin: 0 0 10px; }
.live .ts { font-family: var(--sans); font-size: 12px; color: var(--gold-2); margin-right: 6px; }

/* Editor */
.view#viewEditor { max-width: 1040px; padding-top: 26px; }
.ed-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.ed-title-wrap { flex: 1; min-width: 0; }
.ed-title { width: 100%; font-family: var(--serif); font-size: 25px; color: var(--navy); border: 1px solid transparent; background: none; padding: 2px 6px; margin-left: -7px; border-radius: 4px; }
.ed-title:hover, .ed-title:focus { border-color: var(--rule); outline: none; background: var(--paper); }
.ed-actions { display: flex; gap: 8px; align-items: center; }
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--paper); border: 1px solid var(--rule); border-radius: 5px; box-shadow: 0 8px 24px rgba(13,26,49,.14); min-width: 250px; padding: 5px; z-index: 30; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; cursor: pointer; border-radius: 3px; }
.menu button:hover { background: var(--gold-soft); }
.menu hr { border: 0; border-top: 1px solid var(--rule-2); margin: 4px 0; }

.player { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; background: #13233F; color: #EDE6D6; padding: 8px 12px; border-radius: 5px; margin-bottom: 14px; }
.pbtn { background: none; border: 1px solid rgba(179,147,90,.55); color: #EDE6D6; width: 34px; height: 30px; border-radius: 4px; cursor: pointer; }
.pbtn.sm { width: auto; padding: 0 8px; font-size: 12px; }
.pbtn:hover { background: rgba(179,147,90,.18); }
.ptime { font-variant-numeric: tabular-nums; font-size: 12.5px; color: #CFC6B3; }
.seek { flex: 1; accent-color: var(--gold); min-width: 60px; }
.rate { background: transparent; border: 1px solid rgba(179,147,90,.4); color: #EDE6D6; border-radius: 4px; padding: 3px 4px; }
.rate option { color: #111; }
.follow { font-size: 12px; display: flex; gap: 4px; align-items: center; color: #CFC6B3; white-space: nowrap; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: 18px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.tab.active { color: var(--navy); border-bottom-color: var(--gold); }

.find { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; }
.find input { flex: 1; max-width: 340px; border: 1px solid var(--rule); background: var(--paper); border-radius: 4px; padding: 6px 10px; }
.review-note { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }

.doc { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 26px 34px; }
.u-row { display: grid; grid-template-columns: 78px 1fr; gap: 4px 14px; padding: 8px 0 8px 10px; border-left: 2px solid transparent; margin-left: -12px; position: relative; }
.u-row + .u-row.cont { padding-top: 0; }
.u-row.playing { background: linear-gradient(90deg, var(--gold-soft), transparent 70%); }
.u-row.hit { outline: 2px solid var(--gold); outline-offset: 2px; }
.u-ts { font-size: 12px; color: var(--gold-2); font-variant-numeric: tabular-nums; cursor: pointer; padding-top: 3px; background: none; border: 0; text-align: left; height: fit-content; }
.u-ts:hover { text-decoration: underline; }
.u-body { min-width: 0; }
.u-spk { font-weight: 600; font-size: 13.5px; cursor: pointer; background: none; border: 0; padding: 0; display: inline-flex; gap: 6px; align-items: center; }
.u-spk .dot { width: 8px; height: 8px; border-radius: 50%; }
.u-spk:hover .nm { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.u-text { font-family: var(--serif); font-size: 15.5px; line-height: 1.65; outline: none; padding: 1px 4px; margin-left: -4px; border-radius: 3px; white-space: pre-wrap; }
.u-text:focus { background: var(--gold-soft); }
.u-text.inaud { font-style: italic; color: var(--muted); font-family: var(--sans); font-size: 13.5px; }
.u-tools { position: absolute; right: 0; top: 6px; display: none; gap: 2px; background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 2px; }
.u-row:hover .u-tools, .u-row:focus-within .u-tools { display: flex; }
.u-tools button { background: none; border: 0; padding: 3px 7px; font-size: 11.5px; cursor: pointer; color: var(--muted); border-radius: 3px; }
.u-tools button:hover { background: var(--gold-soft); color: var(--ink); }
mark { background: #F1DFAE; color: inherit; padding: 0; }

.popover { position: fixed; z-index: 50; background: var(--paper); border: 1px solid var(--rule); border-radius: 5px; box-shadow: 0 10px 30px rgba(13,26,49,.18); padding: 6px; min-width: 260px; max-height: 60vh; overflow-y: auto; }
.popover .pt { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 4px 8px; }
.popover button { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px; cursor: pointer; border-radius: 3px; }
.popover button:hover { background: var(--gold-soft); }
.popover .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.popover label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; padding: 6px 8px; color: var(--muted); border-top: 1px solid var(--rule-2); margin-top: 4px; }

.spk-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.spk { display: grid; grid-template-columns: 14px 190px 1fr 1fr auto; gap: 12px; align-items: center; background: var(--paper); border: 1px solid var(--rule); border-radius: 5px; padding: 12px 14px; }
.spk .dot { width: 12px; height: 12px; border-radius: 50%; }
.spk-id { font-weight: 600; }
.spk-stats { font-size: 12px; color: var(--muted); }
.spk select, .spk input { border: 1px solid var(--rule); background: var(--paper); border-radius: 4px; padding: 7px 9px; width: 100%; }
.spk-btns { display: flex; gap: 6px; }
.badge { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-2); border: 1px solid var(--gold); padding: 0 5px; border-radius: 3px; margin-left: 6px; }

.summary { padding-left: 22px; margin: 0 0 14px; }
.summary li { margin-bottom: 10px; }
.summary textarea { width: 100%; min-height: 64px; border: 1px solid var(--rule); background: var(--paper); border-radius: 4px; padding: 8px 10px; font-family: var(--serif); font-size: 14.5px; line-height: 1.5; resize: vertical; }
.summary .goto { font-size: 12px; }

.card { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 20px 22px; margin-bottom: 14px; }
.card h3 { font-size: 18px; margin-bottom: 6px; }
.card p { margin: 6px 0; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #13233F; color: #F3EEE3; padding: 10px 18px; border-radius: 4px; border-left: 3px solid var(--gold); z-index: 100; box-shadow: 0 8px 20px rgba(0,0,0,.2); font-size: 13.5px; max-width: 90vw; }
.modal-back { position: fixed; inset: 0; background: rgba(13,26,49,.45); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal { background: var(--paper); border-radius: 6px; padding: 22px 24px; max-width: 460px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal h3 { font-size: 19px; margin-bottom: 8px; }
.modal .actions { justify-content: flex-end; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: block; position: fixed; top: 10px; left: 10px; z-index: 55; background: var(--navy-2); color: var(--gold); border: 0; width: 36px; height: 36px; border-radius: 4px; font-size: 18px; }
  .view { padding: 58px 16px 60px; }
  .view#viewEditor { padding-top: 58px; }
  .grid2, .checks { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .ed-head { flex-direction: column; }
  .doc { padding: 16px 14px; }
  .u-row { grid-template-columns: 1fr; }
  .spk { grid-template-columns: 14px 1fr; }
  .spk > :nth-child(n+3) { grid-column: 1 / -1; }
  .player { flex-wrap: wrap; }
  .follow { display: none; }
}

@media print {
  .sidebar, .player, .tabs, .find, .ed-actions, .u-tools, .menu-btn { display: none !important; }
}
