:root {
  --bg: #f7f6f3; --panel: #fff; --text: #1f1f1d; --quiet: #6b6a66; --line: #e3e1db;
  --accent: #1a73e8; --accent-text: #fff; --ok: #1e7f4a; --warn: #9a6200; --bad: #b3261e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161615; --panel: #1f1f1e; --text: #ecebe7; --quiet: #a3a19b; --line: #34332f;
    --accent: #8ab4f8; --accent-text: #0b1b33; --ok: #7fd3a1; --warn: #f0c36b; --bad: #f2a29c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161615; --panel: #1f1f1e; --text: #ecebe7; --quiet: #a3a19b; --line: #34332f;
  --accent: #8ab4f8; --accent-text: #0b1b33; --ok: #7fd3a1; --warn: #f0c36b; --bad: #f2a29c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: 96px;
}
header, main { max-width: 820px; margin: 0 auto; padding: 0 16px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; }
h1 { font-size: 20px; margin: 0; }
#account { display: flex; gap: 10px; align-items: center; color: var(--quiet); font-size: 14px; }
.quiet { color: var(--quiet); }
section { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-top: 16px; }

button { font: inherit; cursor: pointer; }
.primary { background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; }
.primary:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; color: var(--accent); padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-inline-start: 22px; }
.row { display: flex; align-items: center; gap: 6px; padding: 3px 0; min-height: 30px; }
.twisty { width: 22px; height: 22px; border: 0; background: none; color: var(--quiet); padding: 0; flex: none; }
.twisty::before { content: "▸"; display: inline-block; transition: transform .15s; }
.twisty[aria-expanded="true"]::before { transform: rotate(90deg); }
.twisty.blank { visibility: hidden; }
input[type=checkbox] { width: 17px; height: 17px; margin: 0; flex: none; accent-color: var(--accent); }
.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name.folder { cursor: pointer; font-weight: 500; }
.name.folder::before { content: "📁 "; }
.meta { margin-inline-start: auto; color: var(--quiet); font-size: 13px; flex: none; padding-inline-start: 8px; }

footer {
  position: fixed; inset: auto 0 0 0; background: var(--panel); border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px; padding: 12px 16px;
}
footer label { display: flex; gap: 6px; align-items: center; color: var(--quiet); font-size: 14px; }
select { font: inherit; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
#count { font-weight: 600; }

.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: var(--accent); }
#bar-fill.running { width: 35%; animation: slide 1.2s ease-in-out infinite; }
#bar-fill.done { width: 100%; background: var(--ok); }
@keyframes slide { from { margin-inline-start: -35%; } to { margin-inline-start: 100%; } }
@media (prefers-reduced-motion: reduce) { #bar-fill.running { animation: none; width: 100%; opacity: .5; } }
.log { margin: 10px 0 0; padding-inline-start: 20px; font-size: 14px; max-height: 40vh; overflow: auto; }
.log .skip { color: var(--warn); }
.log .fail { color: var(--bad); }
.log a { color: var(--accent); }
[hidden] { display: none !important; }
