* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --brand: #f5b301; --brand-d: #e0a200; --ink: #1f2430; --muted: #6b7280;
  --line: #e9ebef; --bg: #f3f4f6; --side: #16181f; --side-2: #262936; --side-ink: #c7cbd6;
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
}
html, body { height: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: #2563eb; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #111318, #2b3040); padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 24px 60px rgba(0,0,0,.4); }
.login-card h1 { font-size: 20px; display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 20px; font-size: 13px; }
.captcha-row { display: flex; gap: 10px; }
.captcha-row input { flex: 1; }
.captcha-img { width: 120px; height: 44px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fafafa; display: grid; place-items: center; overflow: hidden; }
.captcha-img svg { width: 100%; height: 100%; }

/* Form */
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 5px; line-height: 1.45; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid #d9dce3; border-radius: 8px; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid rgba(245,179,1,.35); border-color: var(--brand); }
.field input[readonly] { background: #f6f7f9; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row > .shrink { flex: 0 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin-bottom: 10px; white-space: pre-line; }
.color-input { display: flex; gap: 8px; }
.color-input input[type=color] { width: 46px; padding: 2px; height: 40px; flex: 0 0 46px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border: none; border-radius: 8px; background: var(--brand); color: #1b1b1b; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--brand-d); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; justify-content: center; padding: 12px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #d9dce3; font-weight: 500; }
.btn.ghost:hover { background: #f6f7f9; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger:hover { background: #b91c1c; }
.btn.danger-ghost { background: #fff; color: var(--bad); border: 1px solid #f3c2c2; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.xs { padding: 4px 9px; font-size: 12px; font-weight: 500; }
.linkbtn { background: none; border: none; color: #2563eb; cursor: pointer; padding: 0; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 220px; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px 6px; color: #fff; font-weight: 700; font-size: 15px; }
.logo .dot { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); display: grid; place-items: center; color: #16181f; font-size: 13px; }
.logo-sub { padding: 0 18px 14px 54px; font-size: 11px; color: #8a90a2; letter-spacing: .04em; text-transform: uppercase; }
.nav { flex: 1; padding: 6px 0; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 14px; margin: 2px 10px; color: var(--side-ink); text-decoration: none; border-radius: 8px; }
.nav a i { width: 18px; text-align: center; }
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.active { background: var(--brand); color: #16181f; font-weight: 600; }
.side-foot { padding: 14px 18px; border-top: 1px solid #262936; font-size: 12px; }
.side-foot .who { color: #fff; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.side-foot button { background: none; border: none; color: var(--side-ink); cursor: pointer; padding: 4px 0; display: block; font-size: 13px; }
.side-foot button:hover { color: #fff; }
.main { flex: 1; min-width: 0; padding: 24px 28px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; flex: 1; display: flex; align-items: center; gap: 10px; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--ink); }

/* Card / table */
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3 .grow { flex: 1; }
.card p.desc { color: var(--muted); margin: -6px 0 14px; font-size: 13px; line-height: 1.5; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fafbfc; }
.tbl-wrap { overflow-x: auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.bname { display: flex; align-items: center; gap: 11px; }
.bicon { width: 36px; height: 36px; border-radius: 9px; flex: 0 0 36px; display: grid; place-items: center; color: #fff; font-weight: 700; overflow: hidden; background: #888; }
.bicon img { width: 100%; height: 100%; object-fit: cover; }
.bicon.lg { width: 56px; height: 56px; flex-basis: 56px; border-radius: 13px; font-size: 22px; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef0f3; color: #4b5563; white-space: nowrap; }
.chip.ok { background: #dcfce7; color: #166534; }
.chip.warn { background: #fef3c7; color: #92400e; }
.chip.bad { background: #fee2e2; color: #991b1b; }
.chip.info { background: #dbeafe; color: #1e40af; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search] { padding: 9px 12px; border: 1px solid #d9dce3; border-radius: 8px; min-width: 240px; background: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-size: 22px; margin-top: 4px; }
.stat span { color: var(--muted); font-size: 12px; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-color: var(--brand); font-weight: 600; }
.tabs a .n { background: var(--bad); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; }

/* Checklist */
.checklist { list-style: none; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.checklist li:last-child { border-bottom: none; }
.checklist .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; flex: 0 0 24px; }
.checklist .ic.ok { background: #dcfce7; color: var(--ok); }
.checklist .ic.no { background: #fee2e2; color: var(--bad); }
.checklist .t { flex: 1; }
.checklist .t small { display: block; color: var(--muted); }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 9px 14px; }
.kv dt { color: var(--muted); }
.kv dd { word-break: break-all; }

.snip { position: relative; background: #0f1117; color: #e5e7eb; border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; word-break: break-all; margin-bottom: 10px; }
.snip button { position: absolute; top: 8px; right: 8px; }

.drop { border: 2px dashed #d0d4dc; border-radius: 10px; padding: 20px; text-align: center; color: var(--muted); cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: #fffbeb; color: var(--ink); }
.drop i { font-size: 22px; display: block; margin-bottom: 6px; }
.fileinfo { background: #f6f7f9; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.notice { border-radius: 8px; padding: 11px 13px; margin-bottom: 14px; font-size: 13px; line-height: 1.5; display: flex; gap: 10px; }
.notice.warn { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; }
.notice.bad { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; }
.notice.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; }
.notice.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }

.progress { height: 7px; background: #eef0f3; border-radius: 5px; overflow: hidden; min-width: 90px; }
.progress div { height: 100%; background: var(--brand); transition: width .4s; }

.danger-zone { border-color: #fecaca; }
.danger-zone .item { display: flex; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.danger-zone .item:last-child { border-bottom: none; }
.danger-zone .item > div { flex: 1; }
.danger-zone .item b { display: block; margin-bottom: 3px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,17,23,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 460px; padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.3); max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 17px; margin-bottom: 12px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal p { line-height: 1.55; margin-bottom: 10px; color: #374151; }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#toast div { background: #16181f; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 13px; max-width: 90vw; }
#toast div.bad { background: var(--bad); }

.health-group { margin-bottom: 4px; }
.lvl { width: 22px; text-align: center; }
.lvl.ok { color: var(--ok); } .lvl.warn { color: var(--warn); } .lvl.bad { color: var(--bad); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
details.json summary { cursor: pointer; color: var(--muted); font-size: 12px; }
details.json pre { background: #f6f7f9; padding: 8px; border-radius: 6px; margin-top: 6px; white-space: pre-wrap; word-break: break-all; max-width: 520px; }

.menu-btn { display: none; }
@media (max-width: 860px) {
  .side { position: fixed; left: -240px; z-index: 40; transition: left .2s; }
  .side.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px 14px 60px; }
  .grid2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .hide-sm { display: none; }
}
