:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d2127; --muted: #69707a; --border: #dde1e6; --accent: #c0392b;
  --ok: #1e8e3e; --warn: #b26a00; --bad: #c62828; --input: #fff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15171a; --card: #1e2125; --text: #e6e8eb; --muted: #9aa1aa; --border: #33383e; --accent: #ef6f61;
    --ok: #4cc26b; --warn: #e0a030; --bad: #f06a6a; --input: #15171a; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding: .8rem 1rem; background: var(--card);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
h1 { margin: 0; font-size: 1.25rem; } h1 span { color: var(--accent); font-weight: 600; }
h2 { margin: 0 0 .6rem; font-size: 1.05rem; }
main { max-width: 1200px; margin: 0 auto; padding: 1rem; display: grid; gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: .6rem; padding: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row.between { justify-content: space-between; } .row.between h2 { margin: 0; }
.actions { margin-left: auto; display: flex; gap: .5rem; }
input, select, button { font: inherit; color: inherit; border: 1px solid var(--border); border-radius: .4rem; padding: .4rem .6rem; background: var(--input); }
input { min-width: 0; flex: 1 1 180px; }
#addCat { flex: 0 1 170px; } #filter { flex: 0 1 320px; }
button { background: var(--accent); color: #fff; border-color: transparent; cursor: pointer; white-space: nowrap; }
button.ghost, button.small { background: transparent; color: var(--text); border-color: var(--border); }
button.small { padding: .15rem .45rem; font-size: .85rem; }
button.danger { color: var(--bad); }
button:disabled { opacity: .55; cursor: progress; }
.muted { color: var(--muted); } .error { color: var(--bad); }
.status { font-size: .9rem; color: var(--muted); } .status b.ok { color: var(--ok); } .status b.off { color: var(--warn); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.stats div { background: var(--card); border: 1px solid var(--border); border-radius: .6rem; padding: .6rem .8rem; }
.stats b { display: block; font-size: 1.35rem; } .stats span { color: var(--muted); font-size: .85rem; }
.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
td.num, th.num { text-align: right; }
tr.cat td { background: var(--bg); font-weight: 700; text-transform: capitalize; }
tr.off td:not(:first-child) { opacity: .5; }
td .url { display: block; color: var(--muted); font-size: .78rem; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td [contenteditable] { outline: none; border-radius: .25rem; padding: 0 .15rem; }
td [contenteditable]:focus { box-shadow: 0 0 0 2px var(--accent); }
.badge { display: inline-block; padding: .05rem .45rem; border-radius: 1rem; font-size: .78rem; border: 1px solid currentColor; }
.badge.ok { color: var(--ok); } .badge.bad { color: var(--bad); cursor: help; }
.results { margin: 0; padding-left: 1.4rem; display: grid; gap: .4rem; }
.results a { color: var(--text); font-weight: 600; text-decoration: none; } .results a:hover { color: var(--accent); }
.results small { display: block; color: var(--muted); }
code { font-size: .9em; }
@media (max-width: 640px) { .actions { margin-left: 0; } td .url { max-width: 200px; } }
