:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --line: #2c3845;
  --text: #e7eef6;
  --muted: #8aa0b5;
  --accent: #3d8bfd;
  --danger: #e35d6a;
  --ok: #3ecf8e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1b2a3d 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
.layout { display: flex; min-height: 100vh; }
.side {
  width: 220px;
  background: rgba(15, 20, 25, .92);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .04em;
  margin-bottom: 18px;
  padding: 0 8px;
}
.nav a {
  display: block;
  color: var(--muted);
  padding: 9px 10px;
  border-radius: 8px;
  margin-bottom: 2px;
}
.nav a:hover { background: #243040; color: var(--text); }
.nav a.on { background: #243a5a; color: #fff; }
.nav-group {
  margin: 14px 8px 6px;
  font-size: 12px;
  color: #6d8298;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.main { flex: 1; padding: 28px 32px 48px; max-width: 1280px; }
h1 { margin: 0 0 8px; font-size: 24px; }
.sub { color: var(--muted); margin-bottom: 22px; font-size: 14px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.stat {
  background: #121820;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.stat b { display: block; font-size: 22px; margin-top: 6px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  background: #121820;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-width: 16px;
  height: auto;
  padding: 0;
  margin: 0;
  flex: none;
}
textarea { min-height: 320px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; line-height: 1.45; }
.field { flex: 1; min-width: 180px; }
.btn {
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: #2a3544; }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.mono { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #243040;
  color: var(--muted);
  font-size: 12px;
}
.checks label { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; color: var(--text); }
.checks input { width: auto; }
.pick-list { display: flex; flex-direction: column; gap: 8px; max-width: 520px; }
.pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #121820;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}
.pick-row:hover { border-color: #3d8bfd88; }
.pick-row.on {
  border-color: var(--accent);
  background: #1a2a40;
}
.pick-row.off {
  opacity: .55;
  cursor: not-allowed;
}
.pick-row input { pointer-events: none; }
.pick-row .pick-title { font-weight: 600; min-width: 88px; }
.pick-row .pick-tip { color: var(--muted); font-size: 12px; margin-left: auto; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.mini-card {
  position: relative;
  min-height: 72px;
  padding: 14px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #121820;
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.mini-card:hover { border-color: #3d8bfd88; }
.mini-card .mc-name {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  word-break: break-all;
  line-height: 1.35;
}
.mini-card .mc-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}
.mini-card .mc-mark {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}
.mini-card.on {
  border-color: var(--accent);
  background: #16263a;
  box-shadow: inset 0 0 0 1px #3d8bfd66;
}
.mini-card.on .mc-mark { display: block; }
.mini-card .mc-del {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #2a1820;
  color: #f07178;
  font-size: 16px;
  line-height: 18px;
  padding: 0;
  cursor: pointer;
  z-index: 2;
  opacity: .75;
}
.mini-card .mc-del:hover {
  opacity: 1;
  border-color: #f07178;
  background: #3a1c24;
}
.mini-card.off {
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(.3);
}
.mini-card.off:hover { border-color: var(--line); }
.dlg-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 16px;
}
.dlg-mask.hidden { display: none; }
.dlg {
  width: min(420px, 100%);
  background: #1c2530;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.dlg-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.dlg-body { color: var(--muted); font-size: 14px; line-height: 1.55; white-space: pre-wrap; margin-bottom: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dlg.wide { width: min(720px, 100%); }
.dlg-body .card-grid { margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid label, .dlg-body label { margin-bottom: 4px; }
.dlg-body .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dlg-body .form-grid .span2 { grid-column: 1 / -1; }
.dlg-body input, .dlg-body select, .dlg-body textarea { margin-bottom: 0; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.sec-tabs { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 4px; }
.sec-tab {
  border: 1px solid var(--line);
  background: #1a2330;
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.sec-tab:hover:not(:disabled) { border-color: #3d8bfd88; color: var(--text); }
.sec-tab.on {
  border-color: var(--accent);
  color: #fff;
  background: #1e3a5f;
}
.sec-tab:disabled { opacity: .45; cursor: not-allowed; }
.hint-line { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.table-wrap { overflow: auto; }
table.list td .btn { padding: 6px 10px; font-size: 12px; }
table.list td.addr { max-width: 360px; word-break: break-all; }
.empty-tip { color: var(--muted); padding: 18px 8px; }
.form-card .field { margin-bottom: 12px; }
.form-card .field.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kv { color: var(--muted); font-size: 12px; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--danger); }
@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .side { width: 100%; height: auto; position: relative; }
  .dlg-body .form-grid, .form-card .field.row2 { grid-template-columns: 1fr; }
}
