:root {
  --bg: #f5f5f8; --panel: #fff; --ink: #1d1d27; --muted: #6b6b7b; --line: #e4e4ec;
  --accent: #6c5ce7; --accent-soft: #efedff; --ok: #1e9e63; --warn: #c27c0e; --bad: #d64545;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: #fff; padding: 8px 14px; color: var(--ink); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: transparent; }
button.danger { color: var(--bad); border-color: #f1caca; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=color] { padding: 2px; height: 38px; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--ink); }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo-dot { width: 18px; height: 18px; border-radius: 6px; background: conic-gradient(from 200deg, #6c5ce7, #00c2a8, #ffb020, #6c5ce7); display: inline-block; }
main { max-width: 1180px; margin: 0 auto; padding: 24px; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); font-size: .88rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 10px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; text-decoration: none; color: inherit; display: flex; gap: 14px; transition: box-shadow .15s; }
.pcard:hover { box-shadow: 0 6px 22px rgba(30,30,60,.08); }
.pcard img { width: 72px; height: 72px; border-radius: 8px; background: #f0f0f4; }
.pcard h3 { margin: 0 0 4px; font-size: 1rem; }
.badge { display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.badge.off { background: #f1f1f4; color: var(--muted); }
.badge.warn { background: #fff4e0; color: var(--warn); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.side { position: sticky; top: 78px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .side { position: static; } .grid4 { grid-template-columns: repeat(2, 1fr); } }

.target { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; display: grid; grid-template-columns: 150px 1fr; gap: 16px; }
.target .thumb { width: 150px; height: 150px; border-radius: 10px; background: #f0f0f4 center/contain no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .8rem; text-align: center; border: 2px dashed var(--line); cursor: pointer; }
.target .thumb.has { border-style: solid; }
@media (max-width: 640px) { .target { grid-template-columns: 1fr; } }

.file-pill { display: flex; align-items: center; gap: 8px; font-size: .85rem; padding: 6px 10px; background: #f7f7fa; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.file-pill span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress { height: 8px; background: #eee; border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.qr { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.urlbox { display: flex; gap: 6px; margin-bottom: 10px; }
.urlbox input { font-size: .82rem; }
code.block { display: block; font-size: .75rem; background: #f6f6f9; padding: 10px; border-radius: 8px; word-break: break-all; white-space: pre-wrap; border: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin-bottom: 10px; }
.stats b { display: block; font-size: 1.4rem; }
.stats small { color: var(--muted); font-size: .72rem; }
.chart { width: 100%; height: 70px; }

.alert { padding: 10px 12px; border-radius: 10px; font-size: .88rem; margin-bottom: 12px; }
.alert.warn { background: #fff4e0; color: #7a4d05; }
.alert.ok { background: #e5f6ee; color: #0f5d39; }
.alert.info { background: var(--accent-soft); color: #3d3290; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1d1d27; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 50; font-size: .9rem; }
.toast.err { background: var(--bad); }

dialog { border: 0; border-radius: 16px; padding: 22px; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,20,40,.4); }
dialog h3 { margin-top: 0; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }
.type-pick { display: grid; gap: 10px; }
.type-opt { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; color: var(--ink); cursor: pointer; margin: 0; }
.type-opt input { grid-row: span 2; margin-top: 3px; }
.type-opt small { color: var(--muted); }
.type-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-card { background: #fff; padding: 28px; border-radius: 16px; border: 1px solid var(--line); width: 340px; }
.login-card .brand { margin-bottom: 20px; }
.login-card button { width: 100%; margin-top: 6px; padding: 10px; }
.err { color: var(--bad); font-size: .88rem; min-height: 1em; }
