:root {
  --bg: #f7f5fb;
  --surface: #ffffff;
  --surface-soft: #fbfaff;
  --border: #e6e1f0;
  --text: #241d33;
  --muted: #746b87;
  --accent: #7b4bd6;
  --accent-soft: #f0eaff;
  --red: #d93f64;
  --red-soft: #ffedf1;
  --amber: #b7791f;
  --amber-soft: #fff6e5;
  --green: #2f855a;
  --green-soft: #eafaf1;
  --shadow: 0 2px 10px rgba(58, 35, 105, 0.06);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; line-height: 1.6; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 78px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, #8e5ce6, #c05bd0); color: white; font-weight: 700; font-size: 20px; }
.brand h1 { font-size: 17px; margin: 0; letter-spacing: .5px; }
.brand-sub { margin: 0; color: var(--muted); font-size: 12px; }
.top-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c7c0d6; }
.dot.ok { background: var(--green); }
.dot.fail { background: var(--red); }

.tabs { display: flex; gap: 4px; margin-top: 18px; border-bottom: 1px solid var(--border); }
.tab { appearance: none; border: 0; background: transparent; color: var(--muted); padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; font-size: 14px; }
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

main { padding-bottom: 40px; }
.panel { display: none; padding-top: 22px; }
.panel.active { display: block; }
.section-title { font-size: 16px; margin: 0 0 4px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 14px; }

.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); padding: 6px 14px; border-radius: 18px; cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.toolbar-right { display: flex; gap: 8px; align-items: center; }
input, select { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type="search"] { width: 200px; }

.btn { border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 8px; padding: 9px 16px; cursor: pointer; font-size: 13px; font-family: inherit; }
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: var(--surface); color: var(--accent); }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-pill { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; font-size: 12px; color: var(--muted); }
.stat-pill strong { color: var(--text); font-size: 15px; margin-left: 6px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); position: relative; transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(58, 35, 105, .1); }
.card.ended { opacity: .68; }
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.type-gift { background: var(--red-soft); color: var(--red); }
.tag.type-draw { background: #eaf2ff; color: #2b6cb0; }
.tag.type-rush { background: var(--amber-soft); color: var(--amber); }
.tag.type-limit { background: #fff0e6; color: #b35c00; }
.tag.status { background: #f1eef7; color: var(--muted); font-weight: 400; }
.tag.status-new { background: var(--red-soft); color: var(--red); }
.tag.status-ended { background: #eeeef1; color: #999; }
.tag.status-ending { background: var(--amber-soft); color: var(--amber); }
.card h3 { font-size: 14px; margin: 0 0 8px; line-height: 1.5; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card .time { font-size: 12px; color: var(--accent); margin-bottom: 6px; }
.card .desc { font-size: 12px; color: var(--muted); min-height: 36px; margin-bottom: 10px; }
.card .first-seen { font-size: 11px; color: #9b93ab; border-top: 1px dashed var(--border); padding-top: 8px; }
.empty { background: var(--surface); border: 1px dashed var(--border); border-radius: 12px; padding: 40px; text-align: center; color: var(--muted); grid-column: 1 / -1; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.card-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card-box.wide { max-width: 100%; }
.card-box h3 { margin: 0 0 6px; font-size: 15px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.status-line { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.status-line.ok { color: var(--green); }
.status-line.err { color: var(--red); }
.card-box input[type="password"], .card-box input[type="text"], .card-box input[type="number"] { width: 100%; max-width: 420px; }
.webhook-row { display: flex; gap: 8px; margin-bottom: 8px; }
.webhook-row input { flex: 1; }
.webhook-row select { width: 120px; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 20px; margin-top: 14px; }
.config-grid label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.config-grid label.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.output { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 12px; white-space: pre-wrap; word-break: break-all; max-height: 240px; overflow: auto; color: var(--muted); }

.report-block { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 14px; }
.report-block h3 { margin: 0 0 10px; font-size: 15px; }
.report-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.report-item { border-left: 3px solid var(--accent); background: var(--surface-soft); padding: 10px 12px; border-radius: 6px; font-size: 12px; }
.report-item.ended { border-left-color: #b9b2c8; }
.report-item a { color: var(--accent); text-decoration: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat-card .label { font-size: 12px; color: var(--muted); }
.stat-card .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; background: var(--surface-soft); }
tr:last-child td { border-bottom: 0; }
.ok-text { color: var(--green); }
.fail-text { color: var(--red); }
.footer { color: #a29ab2; font-size: 12px; padding-top: 8px; padding-bottom: 24px; }

@media (max-width: 640px) {
  .topbar-inner { flex-direction: column; align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
  input[type="search"] { width: 100%; }
  .toolbar-right { width: 100%; }
}
