:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --line: #e4e1da;
  --text: #1b1a17;
  --muted: #6d6a62;
  --accent: #1f5eff;
  --accent-ink: #ffffff;
  --accent-soft: #e8eeff;
  --ok: #178a4c;
  --ok-soft: #e3f4ea;
  --warn: #b26a00;
  --err: #c9352b;
  --err-soft: #fbe9e7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 18, 12, .05), 0 8px 24px rgba(20, 18, 12, .06);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --surface: #1c1c1a;
    --surface-2: #232321;
    --line: #33322f;
    --text: #efede8;
    --muted: #9c9990;
    --accent: #6f93ff;
    --accent-ink: #0d1020;
    --accent-soft: #1f2744;
    --ok: #4cc485;
    --ok-soft: #173325;
    --warn: #e0a040;
    --err: #ff7a6e;
    --err-soft: #3a1e1b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.wrap.wide { max-width: 1040px; }

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand .mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.brand h1 { font-size: 22px; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 14px; white-space: pre-line; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}
.card h2 { font-size: 16px; margin: 0 0 16px; }
.card h2 small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }

.grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } .card { padding: 18px; } }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
label .hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=date], textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 10px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  transition: filter .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.big { padding: 13px 20px; font-size: 15px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--err); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.preview {
  margin-top: 16px; padding: 12px 14px; border-radius: 10px;
  background: var(--accent-soft); font-size: 13px;
}
.preview .k { color: var(--muted); display: block; margin-bottom: 2px; }
.preview .v { font-family: var(--mono); font-size: 14px; word-break: break-all; }

.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.hidden { display: none !important; }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 36px 16px; text-align: center;
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .ic { color: var(--accent); margin-bottom: 8px; }
.drop h3 { margin: 0 0 4px; font-size: 17px; }
.drop p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }

.folderbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.folderbar .name { font-family: var(--mono); font-size: 14px; word-break: break-all; }
.folderbar .lbl { font-size: 12px; color: var(--muted); }

.stats { margin-top: 20px; }
.stats .line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.stats .line b { color: var(--text); }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .3s; }
.bar.done > i { background: var(--ok); }

.list { margin-top: 16px; border-top: 1px solid var(--line); max-height: 60vh; overflow: auto; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.item .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.item .bar { grid-column: 1 / -1; height: 4px; }
.item.done .s { color: var(--ok); }
.item.skipped .s { color: var(--ok); }
.item.error .s { color: var(--err); }
.item .e { grid-column: 1 / -1; color: var(--err); font-size: 12px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; }
.tbl td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl .mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.tblwrap { overflow-x: auto; }

.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 14px; margin-bottom: 10px; }
.crumbs button { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.crumbs button:hover { background: var(--accent-soft); }
.crumbs span { color: var(--muted); }
.dirs { border: 1px solid var(--line); border-radius: 10px; max-height: 280px; overflow: auto; }
.dirs button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  font: inherit; text-align: left; color: var(--text);
  background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 10px 12px; cursor: pointer;
}
.dirs button:last-child { border-bottom: 0; }
.dirs button:hover { background: var(--surface-2); }
.dirs .empty { padding: 14px; color: var(--muted); font-size: 13px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.err { background: var(--err-soft); color: var(--err); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; margin: 0; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }

footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 24px; }
