/* Dubly console. Builds on dubly.css tokens. */
body.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; background: var(--bg); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* Sidebar */
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px; background: var(--bg-2); border-right: 1px solid var(--line); }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 24px; color: var(--ink); }
.side-brand span { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--muted); transition: background-color var(--t-fast) ease, color var(--t-fast) ease; }
@media (hover: hover) and (pointer: fine) { .side-nav a:hover { background: rgba(243,237,226,.05); color: var(--ink); } }
.side-nav a[aria-current='page'] { background: rgba(243,237,226,.08); color: var(--ink); }
.side-nav a[aria-current='page']::before { content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; display: grid; place-items: center; font-weight: 600; }
.side-foot { margin-top: auto; display: grid; gap: 16px; padding: 0 6px; }
.side-org { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(243,237,226,.04); border: 1px solid var(--line); font-size: 13px; }
.side-org .muted { font-size: 12px; }
.org-dot { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: #2D4B45; color: #E6F1EE; font-size: 12px; font-weight: 600; }
.side-db { padding-left: 6px; color: var(--muted); }

/* Main */
.main { padding: 18px clamp(16px, 3vw, 40px) 40px; min-width: 0; }
.demo-banner { display: inline-block; font-size: 11px; letter-spacing: .04em; color: var(--accent); padding: 5px 10px; border-radius: 6px; border: 1px solid rgba(242,169,59,.35); background: var(--accent-soft); }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 18px 0 26px; flex-wrap: wrap; }
.top-kicker { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.top-title { font-family: var(--font-display); font-weight: 700; font-size: 48px; line-height: 1; margin-top: 6px; }
.top-actions { display: flex; gap: 8px; }
.view[data-enter] { animation: viewIn 320ms var(--ease-out); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-lede { color: var(--muted); max-width: 64ch; margin-bottom: 20px; }
.demo-note { margin-top: 40px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.box-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.box-h { font-size: 15px; font-weight: 600; }
.box-head .small { margin-top: 4px; }
.empty { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.p-ok { background: rgba(156,203,138,.14); color: var(--green); }
.p-rev { background: var(--accent-soft); color: var(--accent); }
.p-run { background: var(--blue-soft); color: var(--blue); }
.p-run::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* Projects */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.sum { padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 2px; }
.sum p { font-size: 12.5px; color: var(--muted); }
.sum b { font-family: var(--font-display); font-weight: 700; font-size: 38px; line-height: 1.05; }
.sum span { font-size: 12px; color: var(--muted); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filters button { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); transition: background-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-press) var(--ease-out); }
.filters button:active { transform: scale(.97); }
.filters button[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .filters button[aria-pressed='false']:hover { background: rgba(243,237,226,.06); } }
.plist { border-radius: 16px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.prow { display: grid; grid-template-columns: 96px minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 14px 18px; border-top: 1px solid var(--line); }
.prow:first-child { border-top: 0; }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: radial-gradient(120% 90% at 30% 20%, #3A2C1C, #15110D 70%); }
.thumb::before { content: ''; position: absolute; left: 22%; bottom: -12%; width: 30%; aspect-ratio: 1; border-radius: 50% 50% 0 0; background: #2B2622; box-shadow: 0 -26px 0 -6px #4A392D; }
.thumb::after { content: ''; position: absolute; right: 10%; top: 18%; width: 34%; height: 44%; border-radius: 3px; background: #1E2A26; }
.thumb span { position: absolute; right: 4px; bottom: 3px; font-size: 10px; padding: 1px 4px; border-radius: 3px; background: rgba(0,0,0,.7); color: #fff; z-index: 1; }
.p-title { font-weight: 500; font-size: 15px; }
.p-course { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.p-langs { display: flex; flex-wrap: wrap; gap: 4px; }
.lchip { font-size: 12.5px; padding: 2px 8px; border-radius: 6px; background: rgba(243,237,226,.06); border: 1px solid var(--line); color: var(--ink-2); line-height: 1.5; }
.p-status { display: flex; align-items: center; gap: 8px; }
.pbar { position: relative; width: 60px; height: 5px; border-radius: 3px; background: rgba(243,237,226,.1); overflow: hidden; }
.pbar i { position: absolute; inset: 0; background: var(--blue); transform-origin: left; transform: scaleX(var(--p)); }
.p-act { justify-self: end; }

/* Script editor */
.ed { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 20px; align-items: start; }
.ed-left { position: sticky; top: 18px; display: grid; gap: 14px; }
.mplayer { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.mframe { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; isolation: isolate; }
.mframe .board { right: 5%; top: 9%; width: 48%; height: 56%; }
.mframe .presenter { left: 8%; height: 86%; }
.mframe .subs { bottom: 6%; }
.mframe .board-h { white-space: nowrap; font-size: clamp(8px, .8vw, 12px); }
.mframe .sub-line { font-size: clamp(13px, 1.25vw, 17px); }
.sub-line[data-draft]::after { content: 'draft'; margin-left: 8px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); vertical-align: 2px; }
.mdeck { display: flex; align-items: center; gap: 12px; padding: 12px 4px 4px; flex-wrap: wrap; }
.m-langs { margin-left: auto; display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.m-langs button { padding: 4px 10px; border-radius: 7px; font-size: 13px; color: var(--ink-2); transition: background-color var(--t-fast) ease, color var(--t-fast) ease; }
.m-langs button[aria-checked='true'] { background: var(--accent); color: var(--accent-ink); }
@media (hover: hover) and (pointer: fine) { .m-langs button[aria-checked='false']:hover { background: rgba(243,237,226,.06); } }
.mtrack { position: relative; margin: 10px 4px 4px; cursor: pointer; }
.mtrack .wave { height: 44px; }
.m-note { padding: 8px 4px 2px; font-size: 11.5px; color: var(--muted); }
.progress-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.lang-progress { margin-top: 10px; display: grid; gap: 10px; }
.lang-progress li { display: grid; grid-template-columns: 70px 64px 1fr auto; align-items: center; gap: 12px; font-size: 14px; }
.lp-en { font-size: 12.5px; color: var(--muted); }
.lp-bar { position: relative; height: 6px; border-radius: 3px; background: rgba(243,237,226,.08); overflow: hidden; }
.lp-bar i { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transition: transform 400ms var(--ease-out); }
.lp-done { color: var(--green); }

.ed-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ltabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.ltabs button { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 8px; font-size: 15px; color: var(--ink-2); transition: background-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-press) var(--ease-out); }
.ltabs button:active { transform: scale(.97); }
.ltabs button[aria-selected='true'] { background: var(--ink); color: var(--bg); }
.lt-n { font-size: 11px; opacity: .75; }
.lt-n.done { color: var(--green); opacity: 1; }
.ltabs button[aria-selected='true'] .lt-n.done { color: #2F6B1F; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.ed-sub { margin: 14px 0 10px; font-size: 11.5px; color: var(--muted); }
.lines { display: grid; gap: 10px; }
.line { padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease; }
.line[data-active] { border-color: rgba(243,237,226,.28); }
.line[data-playing] { box-shadow: inset 3px 0 0 var(--accent); }
.line[data-long] { border-color: rgba(240,138,110,.45); }
.line[data-ok] { background: #17150F; }
.l-meta { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.l-seek { min-width: 30px; height: 24px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--ink); font-family: var(--font-mono); font-size: 11.5px; }
@media (hover: hover) and (pointer: fine) { .l-seek:hover { border-color: var(--accent); color: var(--accent); } }
.l-spk { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-family: var(--font-ui); font-size: 12px; }
.l-spk i { width: 8px; height: 8px; border-radius: 2px; }
.l-src { margin: 10px 0 8px; font-size: 14.5px; color: var(--ink-2); }
.l-ta { width: 100%; resize: vertical; min-height: 46px; field-sizing: content; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); font-size: 15.5px; line-height: 1.6; transition: border-color var(--t-fast) ease; }
.l-ta:focus { outline: none; border-color: var(--accent); }
.line .meter { margin-top: 10px; }
.l-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.l-state { flex: 1 1 200px; }
.lstate { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.lstate.ok { color: var(--green); }
.lstate.ok::before { content: ''; width: 10px; height: 6px; margin: 0 2px 3px 1px; border-left: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(-45deg); }
.lstate.warn { color: var(--red); }

/* Voices */
.spk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.spk { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: grid; gap: 16px; align-content: start; }
.spk-head { display: flex; gap: 12px; align-items: center; }
.spk-head h3 { font-size: 17px; }
.spk-av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 14px; background: color-mix(in srgb, var(--c) 20%, transparent); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
.seg-toggle { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.seg-toggle button { flex: 1; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; color: var(--ink-2); transition: background-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-press) var(--ease-out); }
.seg-toggle button:active { transform: scale(.97); }
.seg-toggle button[aria-checked='true'] { background: var(--ink); color: var(--bg); }
.seg-toggle button[aria-disabled='true'] { color: var(--muted); cursor: not-allowed; text-decoration: line-through; text-decoration-color: rgba(166,156,140,.5); }
.consent-box { display: grid; gap: 4px; padding: 12px 14px; border-radius: 10px; font-size: 13px; border: 1px solid var(--line); }
.consent-box b { font-weight: 600; font-size: 13.5px; }
.consent-box span { color: var(--muted); }
.consent-box .btn { justify-self: start; margin-top: 6px; }
.consent-box.ok { border-color: rgba(156,203,138,.35); background: rgba(156,203,138,.06); }
.consent-box.ok b { color: var(--green); }
.consent-box.wait { border-color: rgba(143,193,212,.35); background: var(--blue-soft); }
.consent-box.wait b { color: var(--blue); }
.consent-box.none b { color: var(--ink); }
.vrows { display: grid; }
.vrows li { display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.vr-l { font-size: 15px; }
.vr-match { font-size: 13.5px; color: var(--accent); }
.vr-sel { width: 100%; min-width: 0; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); font-size: 13.5px; }
.mini-wave { display: inline-flex; align-items: center; gap: 2px; height: 12px; }
.mini-wave i { width: 2px; height: 5px; border-radius: 1px; background: currentColor; }
.vr-prev[data-playing] .mini-wave i { animation: eq 600ms ease-in-out infinite; transform-origin: center; }
.vr-prev[data-playing] .mini-wave i:nth-child(2) { animation-delay: -.2s; } .vr-prev[data-playing] .mini-wave i:nth-child(3) { animation-delay: -.4s; } .vr-prev[data-playing] .mini-wave i:nth-child(4) { animation-delay: -.1s; } .vr-prev[data-playing] .mini-wave i:nth-child(5) { animation-delay: -.3s; }
@keyframes eq { 50% { transform: scaleY(2.4); } }
.vr-prev[data-playing] { border-color: var(--accent); color: var(--accent); }

/* Exports */
.xlist { display: grid; }
.xrow { display: flex; align-items: center; gap: 12px 18px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.xrow:first-child { border-top: 0; }
.x-l { display: flex; align-items: center; gap: 14px; flex: 1 1 260px; min-width: 0; }
.x-l p:first-child { font-weight: 500; }
.x-native { width: 70px; font-size: 18px; flex: none; }
.x-ok { color: var(--green); }
.x-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.x-btns .btn[data-busy] { color: var(--muted); }
.x-go { flex-basis: 100%; padding-left: 84px; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.consent-foot { margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line-2); font-size: 12.5px; color: var(--muted); }

/* Responsive */
@media (max-width: 1180px) {
  .ed { grid-template-columns: 1fr; }
  .ed-left { position: static; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
  .prow { grid-template-columns: 80px minmax(0, 1.6fr) minmax(0, 1fr) auto; }
  .prow .p-langs { display: none; }
}
@media (max-width: 980px) {
  body.app { grid-template-columns: minmax(0, 1fr); padding-bottom: 76px; }
  .side { position: fixed; z-index: 60; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: rgba(19,16,13,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .side-brand, .side-foot { display: none; }
  .side-nav { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  .side-nav a { flex-direction: column; gap: 4px; padding: 8px 4px; font-size: 11.5px; }
  .side-nav a[aria-current='page']::before { display: none; }
  .side-nav a[aria-current='page'] { color: var(--accent); }
  .side-badge { position: absolute; top: 2px; right: calc(50% - 24px); min-width: 18px; height: 16px; font-size: 10px; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .ed-left { grid-template-columns: 1fr; }
  .spk-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .top-title { font-size: 40px; }
  .prow { grid-template-columns: 72px minmax(0, 1fr); gap: 8px 12px; padding: 14px; }
  .prow .thumb { grid-row: span 2; align-self: start; }
  .p-status { grid-column: 2; }
  .p-act { grid-column: 2; justify-self: start; }
  .sum b { font-size: 32px; }
  .m-langs { margin-left: 0; width: 100%; }
  .m-langs button { flex: 1; }
  .lang-progress li { grid-template-columns: 62px 1fr auto; }
  .lp-en { display: none; }
  .ltabs { width: 100%; }
  .ltabs button { flex: 1; justify-content: center; padding: 6px 6px; }
  .vrows li { grid-template-columns: 56px 1fr; }
  .vr-prev { grid-column: 2; justify-self: start; }
  .x-go { padding-left: 0; }
  .x-native { width: 60px; }
  .toasts { left: 12px; right: 12px; bottom: 84px; }
  .toast { max-width: none; min-width: 0; }
}
