
:root {
  --bg: #ECEFEA; --surface: #FFFFFF; --surface-2: #F5F7F3; --ink: #141B18; --muted: #56615B; --line: #D3D9D1; --line-strong: #B9C1B7;
  --accent: #2741D3; --accent-ink: #FFFFFF; --accent-soft: #E2E6FB; --dot: #C7CEC4; --danger: #B3261E; --ok: #1B7A4B; --warn-bg: #FFF4D6; --warn-ink: #6B4B00;
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif; --f-body: "Archivo", "Helvetica Neue", Arial, sans-serif; --f-mono: "Fragment Mono", ui-monospace, Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(20,27,24,.12), 0 8px 24px -12px rgba(20,27,24,.35);
  --c-table: #1B7A4B; --c-doc: #2741D3; --c-image: #8A4FD8; --c-video: #C2410C; --c-audio: #B4235E; --c-subs: #0E7490;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0E1210; --surface: #161B18; --surface-2: #1C221F; --ink: #E4EAE6; --muted: #98A49D; --line: #2A322E; --line-strong: #3A443F;
  --accent: #8E9DFF; --accent-ink: #0E1210; --accent-soft: #232A4E; --dot: #29312D; --danger: #FF8A80; --ok: #6FD39E; --warn-bg: #3A3016; --warn-ink: #F5D98A; color-scheme: dark;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 10px 30px -12px rgba(0,0,0,.8);
  --c-table: #6FD39E; --c-doc: #8E9DFF; --c-image: #C4A0FF; --c-video: #FDA26B; --c-audio: #F48FB8; --c-subs: #67D3E8; } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.5; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.top { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 10px 20px; height: 57px; }
.mark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-display); font-stretch: 125%; font-weight: 800; font-size: 19px; letter-spacing: -0.01em; white-space: nowrap; color: var(--ink); text-decoration: none; }
.mark svg { width: 26px; height: 26px; flex: none; }
.tool-name { color: var(--muted); font-weight: 600; font-size: 14px; border-left: 1px solid var(--line-strong); padding-left: 14px; white-space: nowrap; }
.top .links { margin-left: auto; display: flex; gap: 16px; font-size: 13.5px; }
.top .links a { color: var(--muted); white-space: nowrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 7px 12px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; min-height: 34px; color: var(--ink); text-decoration: none; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--accent); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover:not(:disabled) { color: var(--ink); background: var(--surface-2); }
.btn.icon { padding: 6px; min-width: 34px; }
.btn.sm { min-height: 28px; padding: 4px 9px; font-size: 12.5px; }
.btn.pulse { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.fld { display: grid; gap: 5px; min-width: 0; }
.fld > label, .fld-label { font-size: 12.5px; font-weight: 600; }
.fld input[type=text], .fld input[type=number], .fld select, .inp { width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 8px; background: var(--surface); min-width: 0; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.chk { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; margin: 2px 0 0; }
.note { color: var(--muted); font-size: 12.5px; margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; flex-wrap: wrap; max-width: 100%; }
.seg label { padding: 5px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; border-left: 1px solid var(--line); white-space: nowrap; }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--ink); color: var(--bg); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg.full { display: flex; } .seg.full label { flex: 1; text-align: center; }
.unitin { display: flex; } .unitin input { border-radius: 7px 0 0 7px !important; flex: 1; } .unitin span { border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 7px 7px 0; padding: 6px 8px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); }

/* Start screen */
.start { max-width: 1120px; margin: 0 auto; padding: 44px 24px 64px; }
.start h1 { font-family: var(--f-display); font-stretch: 112%; font-weight: 800; font-size: clamp(32px, 5vw, 50px); line-height: 1.04; letter-spacing: -0.025em; max-width: 17ch; }
.start .lede { color: var(--muted); font-size: 18px; max-width: 42em; margin: 14px 0 26px; }
.drop { display: grid; place-items: center; text-align: center; gap: 10px; border: 2px dashed var(--line-strong); border-radius: 16px; padding: 44px 20px; background: var(--surface);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 18px 18px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.drop:hover, body.dragging .drop { border-color: var(--accent); background-color: var(--accent-soft); }
.drop strong { font-size: 19px; }
.drop .btn { pointer-events: none; }
.privacy-line { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 13.5px; margin-top: 14px; text-align: center; flex-wrap: wrap; }
.privacy-line svg { color: var(--ok); }
.tiles-h { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 40px 0 14px; font-weight: 700; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.group { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px 16px 16px; }
.group h3 { display: flex; align-items: center; gap: 9px; font-size: 15px; margin-bottom: 4px; }
.group h3 .dot { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); color: var(--fc, var(--accent)); }
.group p { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: var(--fc, var(--accent)); color: var(--fc, var(--accent)); }
.formats { margin-top: 34px; color: var(--muted); font-size: 13px; }
.formats b { color: var(--ink); }

/* Workspace */
.work { display: flex; flex-direction: column; height: calc(100dvh - 57px); }
.bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.bar .sum { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.bar .sum b { color: var(--ink); }
.bar .grp { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.folder-note { font-size: 12px; color: var(--ok); font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr) 330px; }

.list { border-right: 1px solid var(--line); background: var(--bg); overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.item { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; background: transparent; text-align: left; width: 100%; }
.item:hover { background: var(--surface); }
.item.cur { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.item .ft { grid-row: span 2; width: 38px; height: 38px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-family: var(--f-mono); font-size: 10px; font-weight: 700; color: var(--fc, var(--muted)); text-transform: uppercase; letter-spacing: .02em; border: 1px solid var(--line); overflow: hidden; }
.item .nm { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .st { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; grid-column: 2; }
.item .st .ok { color: var(--ok); font-weight: 600; } .item .st .err { color: var(--danger); } .item .st .arrow { font-family: var(--f-mono); }
.item .acts { grid-row: span 2; display: flex; gap: 2px; align-items: center; }
.item .x, .item .dl { width: 28px; height: 28px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
.item .x { opacity: 0; } .item:hover .x, .item.cur .x, .item:focus-within .x { opacity: 1; }
@media (hover: none) { .item .x { opacity: 1; } }
.item .x:hover, .item .dl:hover { background: var(--surface-2); color: var(--ink); }
.item .dl { color: var(--accent); }
.item .x svg, .item .dl svg { width: 16px; height: 16px; }
.item .pbar { grid-column: 2 / -1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; margin-top: 3px; }
.item .pbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.addmore { border: 2px dashed var(--line-strong); border-radius: 10px; padding: 12px; text-align: center; color: var(--muted); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.addmore:hover { border-color: var(--accent); color: var(--accent); }

.stage { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.stagehead { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; min-height: 49px; }
.stagehead .t { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.stagehead .seg { flex: none; }
.preview { flex: 1; min-height: 0; overflow: auto; padding: 18px; background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); background-size: 18px 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); max-width: 100%; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13px; margin: 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pv-table { overflow: auto; max-height: 100%; }
.pv-table table { border-collapse: collapse; font-size: 12.5px; background: var(--surface); }
.pv-table th, .pv-table td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.pv-table th { background: var(--surface-2); position: sticky; top: 0; font-weight: 700; }
.pv-table td.n { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--f-mono); font-size: 12px; }
.pv-table .rn { color: var(--muted); font-family: var(--f-mono); font-size: 11px; background: var(--surface-2); }
.pv-text { font-family: var(--f-mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; max-height: none; tab-size: 4; }
.pv-frame { width: 100%; height: 100%; min-height: 420px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: block; }
.pv-media { max-width: 100%; max-height: 100%; display: block; margin: 0 auto; border-radius: 10px; background: #000; }
.pv-img { max-width: 100%; display: block; margin: 0 auto; box-shadow: var(--shadow); background: #fff; }
.pv-stack { display: flex; flex-direction: column; gap: 14px; height: 100%; }
.pv-stack > .grow { flex: 1; min-height: 0; }
.pv-empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 20px; }
.pv-empty .big { font-size: 15px; color: var(--ink); font-weight: 700; margin-bottom: 6px; }
.warnbox { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 8px 11px; font-size: 12.5px; }
.warnbox ul { margin: 4px 0 0; padding-left: 18px; }
.errbox { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.okbox { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); border-radius: 8px; padding: 8px 11px; font-size: 12.5px; }
.tipbox { background: var(--accent-soft); border-radius: 8px; padding: 9px 12px; font-size: 12.5px; }

.settings { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 6px 0 40px; }
.settings .lead { font-size: 12.5px; color: var(--muted); padding: 8px 16px 6px; margin: 0; }
.sec { border-bottom: 1px solid var(--line); }
.sec > .sh { display: flex; gap: 9px; align-items: center; padding: 13px 16px 8px; font-weight: 700; font-size: 14px; }
.sec > .sh .dot { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); color: var(--fc, var(--accent)); }
.sec > .sh .cnt { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.sec .body { padding: 2px 16px 16px; display: grid; gap: 12px; }
.sec details { border-top: 1px dashed var(--line); padding-top: 10px; }
.sec details summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
.sec details summary::-webkit-details-marker { display: none; }
.sec details summary::before { content: "+"; font-weight: 400; font-size: 16px; line-height: 1; width: 12px; }
.sec details[open] summary::before { content: "–"; }
.sec details .inner { display: grid; gap: 12px; padding-top: 10px; }
.big-to select { font-weight: 700; font-size: 14px; padding: 8px 10px !important; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); max-width: calc(100vw - 32px); }
.busy { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; background: rgba(14, 18, 16, .35); }
.busy > div { background: var(--surface); border-radius: 12px; padding: 18px 22px; display: flex; gap: 12px; align-items: center; box-shadow: 0 20px 60px -20px rgba(0,0,0,.5); min-width: 240px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { position: absolute; z-index: 95; max-width: 260px; background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.4; font-weight: 500; padding: 7px 10px; border-radius: 7px; box-shadow: 0 8px 22px -8px rgba(20,27,24,.45); pointer-events: none; animation: hint-in .12s ease-out; }
.hint::after { content: ""; position: absolute; left: var(--ax, 50%); bottom: -5px; width: 10px; height: 10px; margin-left: -5px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.hint.below::after { bottom: auto; top: -5px; }
@keyframes hint-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hint, .spinner { animation: none; } .item .pbar i { transition: none; } }

@media (max-width: 1180px) { .ws { grid-template-columns: 250px minmax(0, 1fr) 300px; } }
@media (max-width: 900px) {
  .top { padding: 10px 14px; } .tool-name { display: none; }
  .work { height: auto; min-height: calc(100dvh - 57px); }
  .ws { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; }
  .list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 300px; }
  .stage { min-height: 50dvh; }
  .settings { border-left: 0; border-top: 1px solid var(--line); }
  .bar { padding: 6px 10px; } .bar .sum { flex-basis: 100%; order: 3; }
  .start { padding: 26px 16px 50px; }
}

@media (max-width: 440px) { .top { gap: 10px; padding-left: 12px; padding-right: 12px; } .top .mark { font-size: 16px; gap: 8px; } .top .links .all { display: none; } .top .mark svg { width: 24px; height: 24px; } .top .links { gap: 10px; font-size: 13px; } }

a.mark { color: inherit; text-decoration: none; }
