:root {
  --bg: #0f1216; --panel: #171b21; --panel2: #1e232b; --line: #2b313b; --text: #e6e9ee; --muted: #8c96a5;
  --accent: #3d8bfd; --accent2: #2c6fd6; --go: #2fa565; --warn: #e0a526; --bad: #e0524a; --ok: #3fbf7a;
  --radius: 8px; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
body { min-height: 100vh; display: flex; flex-direction: column; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent2); border-color: var(--accent2); }
button.go { background: var(--go); border-color: var(--go); font-weight: 600; padding: 7px 22px; }
button.danger { border-color: #6b2e2b; }
button.small { padding: 2px 8px; font-size: 12px; }
select, input { background: #0f1318; border: 1px solid var(--line); border-radius: 5px; padding: 4px 6px; }
input[type=number] { width: 90px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
a { color: #8ab6ff; }
.muted, .note, .hint { color: var(--muted); }
.note { font-size: 12px; margin-left: 8px; }
.hint { font-size: 12px; margin: 4px 0 8px; }

header.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 19px; margin: 0; letter-spacing: .3px; }
.ver { color: var(--muted); font-size: 12px; }
.engine { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #10233f; border: 1px solid #23406b; color: #b9d3ff; }
.engine.local { background: #0f2a1d; border-color: #1f5a3b; color: #b6f0cf; }
.engine.bad { background: #3a1513; border-color: #6b2e2b; color: #ffc9c4; }
.toplinks { margin-left: auto; }

.tabs { display: flex; gap: 4px; padding: 8px 16px 0; border-bottom: 1px solid var(--line); background: var(--panel); overflow-x: auto; }
.tabs button { border-radius: 8px 8px 0 0; border-bottom: none; background: transparent; color: var(--muted); padding: 8px 16px; }
.tabs button[aria-selected=true] { background: var(--bg); color: var(--text); border-color: var(--line); font-weight: 600; }
.banner { margin: 10px 16px 0; padding: 10px 14px; border-radius: var(--radius); background: #2a2210; border: 1px solid #5c4a17; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; padding: 14px 16px; min-height: 0; }
.files { display: flex; flex-direction: column; min-width: 0; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
.toolbar .sep { flex: 1; }
.drop { flex: 1; min-height: 260px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel); overflow: auto; position: relative; }
.drop.over { border-color: var(--accent); background: #13202f; }
.ftable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ftable th { position: sticky; top: 0; background: var(--panel2); text-align: left; font-weight: 600; color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--line); z-index: 1; }
.ftable td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ftable tr.running td { background: #12202f; }
.c-name { min-width: 160px; } .c-name .rel { color: var(--muted); font-size: 11px; display: block; word-break: break-all; }
.c-name .nm { word-break: break-all; }
.c-info { color: var(--muted); font-size: 12px; max-width: 260px; }
.c-size, .c-est, .c-res { white-space: nowrap; }
.c-act { white-space: nowrap; text-align: right; }
.st { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #222a35; white-space: nowrap; }
.st.done { background: #123524; color: #9be8bd; } .st.failed, .st.skipped { background: #3a1513; color: #ffb9b3; }
.st.flag { background: #3a2e10; color: #ffd98a; } .st.running { background: #10233f; color: #b9d3ff; } .st.cancelled { background: #2b2b2b; color: #bbb; }
.prog { height: 5px; background: #222a35; border-radius: 3px; margin-top: 5px; overflow: hidden; width: 120px; }
.prog > div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.phase { font-size: 11px; color: var(--muted); }
.warnicon { color: var(--warn); cursor: help; }
.probicon { color: var(--bad); cursor: help; }
.notes { font-size: 11px; color: var(--warn); max-width: 240px; white-space: normal; }
.notes.bad { color: #ff9f97; }
.better { color: var(--ok); } .worse { color: var(--warn); }
.empty { padding: 50px 20px; text-align: center; }
.empty p { margin: 6px 0; }
.summary { padding: 8px 2px; color: var(--muted); font-size: 13px; }

.settings { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; overflow: auto; max-height: calc(100vh - 190px); }
.presetrow { display: flex; gap: 8px; align-items: center; }
.presetrow select { max-width: 220px; }
.panel { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 10px; }
.panel h3 { font-size: 14px; margin: 2px 0 8px; }
.panel h4 { font-size: 12px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.row { margin: 7px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.row > label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row > label select { max-width: 230px; }
.row .note { flex-basis: 100%; margin: 0; }
.check { gap: 6px !important; }
.tags { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.tags label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 2px; }
.tags label.wide { grid-column: 1 / -1; }
.tags input, .tags select { width: 100%; }
.path { flex: 1; min-width: 140px; }
[hidden] { display: none !important; }

.runbar { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 16px; background: var(--panel); border-top: 1px solid var(--line); }
.runbar .spacer { flex: 1; }
.overall { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.overall .bar { width: 160px; height: 7px; background: #222a35; border-radius: 4px; overflow: hidden; }
#overallFill { height: 100%; width: 0; background: var(--go); transition: width .3s; }
#overallText { font-size: 13px; color: var(--muted); }
.rights { text-align: center; font-size: 11px; color: #5d6673; margin: 6px 0 10px; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; max-width: min(640px, 94vw); padding: 16px 18px; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog h3 { margin: 0 0 10px; }
dialog pre { white-space: pre-wrap; word-break: break-all; max-height: 50vh; overflow: auto; background: #0b0e12; padding: 10px; border-radius: 6px; font-size: 12px; }
dialog textarea { width: 100%; min-height: 160px; background: #0b0e12; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: 12px/1.4 Consolas, monospace; }
.dlgbtns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }

body.is-online .localonly { display: none !important; }
body.is-local .onlineonly { display: none !important; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .settings { max-height: none; }
  .c-info { display: none; }
}
@media (max-width: 620px) {
  .ftable th.c-est, .ftable td.c-est, .ftable th.c-size, .ftable td.c-size { display: none; }
  header.top { flex-wrap: wrap; gap: 8px; }
  .tabs button { padding: 8px 10px; }
  .overall .bar { width: 100px; }
}
