:root {
  --bg: #f5f6f8; --panel: #ffffff; --text: #1b1f27; --muted: #667085; --line: #e3e6ec;
  --accent: #2563eb; --accent-text: #ffffff; --ok: #12805c; --warn: #b45309; --bad: #c0262d;
  --ok-bg: #e6f6ef; --warn-bg: #fef3e2; --bad-bg: #fdeaea; --code-bg: #f0f2f6; --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218; --panel: #171b23; --text: #e8eaef; --muted: #98a2b3; --line: #2a303c;
    --accent: #5b8def; --accent-text: #0b1020; --ok: #4cc9a0; --warn: #f5b04d; --bad: #ff7b80;
    --ok-bg: #12332a; --warn-bg: #3a2c12; --bad-bg: #3a1a1c; --code-bg: #1e2430;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; }
code { background: var(--code-bg); padding: .1em .4em; border-radius: 5px; word-break: break-all; }

.topbar { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .in { max-width: 1120px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-height: 52px; }
.brand { font-weight: 700; margin-right: 12px; color: var(--text); }
.nav a { color: var(--muted); padding: 8px 10px; border-radius: 8px; display: inline-block; }
.nav a:hover { background: var(--code-bg); text-decoration: none; color: var(--text); }
.nav a.on { color: var(--text); background: var(--code-bg); font-weight: 600; }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: .9em; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat .l { color: var(--muted); font-size: .85rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
.tw { overflow-x: auto; }
.num { text-align: right; white-space: nowrap; }

.btn, button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 7px 13px; border-radius: 8px; display: inline-block; }
.btn:hover, button:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.btn.danger, button.danger { color: var(--bad); border-color: var(--bad); }
.btn.sm, button.sm { padding: 3px 9px; font-size: .85rem; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: .9rem; }
input[type=text], input[type=password], input[type=number], input[type=file], select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 10px 0 0; }
.check input { width: auto; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 3px; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--code-bg); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.flash.err { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }

.bar { height: 8px; border-radius: 999px; background: var(--code-bg); overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.hot > span { background: var(--bad); }

.thumbs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.thumb { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.thumb .im { aspect-ratio: 4/3; background: var(--code-bg) center/cover no-repeat; display: block; }
.thumb .m { padding: 8px; font-size: .82rem; }
.thumb .m b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.keybox { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 20px 0; text-align: center; }
pre { background: var(--code-bg); padding: 12px; border-radius: 8px; overflow-x: auto; margin: 8px 0; }
@media (max-width: 640px) { .who { display: none; } .brand { width: 100%; } }

/* ---- v2 ---- */
[hidden] { display: none !important; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=text], .toolbar select { width: auto; min-width: 180px; }
.bulkbar { position: sticky; bottom: 10px; z-index: 4; background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; margin-top: 12px; display: flex; gap: 10px; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.cols2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin-bottom: 18px; }
.cols2 .card { margin-bottom: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart .cl { fill: var(--muted); font-size: 11px; } .chart .cv { fill: var(--text); font-size: 11px; } .chart .cb { fill: var(--accent); }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; transition: .15s; }
.dropzone.over { border-color: var(--accent); background: var(--code-bg); }
.up { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr 110px; gap: 10px; align-items: center; padding: 5px 0; font-size: .88rem; }
.up .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up.okk .s { color: var(--ok); } .up.bad .s { color: var(--bad); }
.thumb { position: relative; } .thumb.sel { outline: 2px solid var(--accent); }
.thumb .pick { position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; z-index: 2; }
.thumb .dim { color: var(--muted); font-size: .78rem; }
.lb { position: fixed; inset: 0; background: rgba(0,0,0,.82); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.lbin { max-width: 94vw; max-height: 94vh; text-align: center; color: #fff; }
.lbin img { max-width: 94vw; max-height: 80vh; background: #222; border-radius: 6px; }
.lbcap { margin: 8px 0; word-break: break-all; }
.set { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
.set > .hd { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; }
.set > .bd { padding: 10px 12px; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 8px 8px; }
.vr.okk { color: var(--ok); } .vr.bad { color: var(--bad); font-weight: 600; }
.pager { margin-top: 12px; }
.snip { position: relative; } .snip .btn, .snip button { position: absolute; top: 8px; right: 8px; }
.snip pre { padding-right: 90px; white-space: pre-wrap; word-break: break-all; }
.dl { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.dl .card { margin: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tabs a.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
