:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1f2329;
  --muted: #646a73;
  --faint: #8f959e;
  --line: #e5e6eb;
  --line-strong: #c9cdd4;
  --brand: #1456f0;
  --brand-soft: #e8f0ff;
  --ok: #0f9d58;
  --ok-soft: #e8f5ec;
  --warn: #b26a00;
  --warn-soft: #fff4e0;
  --info: #0369c9;
  --info-soft: #e8f2ff;
  --bad: #d93026;
  --bad-soft: #ffeded;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { font-size: 16px; font-weight: 600; }
.tag { font-size: 11px; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 10px; margin-left: 6px; }
.acct-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acct-bar select { width: auto; min-width: 160px; }
.hint { font-size: 12px; color: var(--faint); }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tab { border: 0; background: none; padding: 9px 16px; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit; }
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }

.panel { display: none; }
.panel.active { display: block; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field .hint { display: block; margin-top: 4px; }

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
textarea { resize: vertical; min-height: 72px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { opacity: .9; color: #fff; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.danger { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.btn.done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn:disabled { opacity: .6; cursor: default; }

.badge { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.st-pending { background: var(--warn-soft); color: var(--warn); }
.st-doing { background: var(--info-soft); color: var(--info); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.st-rejected { background: var(--bad-soft); color: var(--bad); }

.repair-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.repair-title { font-weight: 500; }
.repair-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.repair-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fixer-item { padding: 2px 0; }
.reject-box { display: none; gap: 8px; padding: 0 0 12px; flex-wrap: wrap; }
.reject-box.open { display: flex; }
.reject-box input { flex: 1; min-width: 180px; }

.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-bar select { width: auto; min-width: 120px; }
.filter-bar .btn { margin-left: auto; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 600; margin-top: 2px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.bar-label { width: 82px; font-size: 12px; color: var(--muted); flex: none; }
.bar-track { flex: 1; height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 6px; }
.bar-count { width: 26px; text-align: right; font-size: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
th { text-align: left; color: var(--muted); font-weight: 400; padding: 8px 6px; border-bottom: 1px solid var(--line); }
td { padding: 9px 6px; border-bottom: 1px solid var(--line); word-break: break-all; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--faint); padding: 16px 0; font-size: 13px; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { background: var(--surface); border-radius: 12px; padding: 20px 22px; width: min(520px, 100%); max-height: 80vh; overflow: auto; }
.detail-line { margin: 9px 0; font-size: 13px; }
.detail-key { color: var(--muted); display: inline-block; width: 76px; }
.detail-reason { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 6px; margin-top: 8px; font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: #1f2329; color: #fff; padding: 9px 18px; border-radius: 6px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
.toast.show { opacity: 1; }

.dash-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  border-radius: 14px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  color: #fff;
}
.dash-hero::before { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.06); right: 90px; top: -130px; }
.dash-hero::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.04); right: -40px; bottom: -100px; }
.dash-hero-main, .dash-hero-side { position: relative; z-index: 1; }
.dash-eyebrow { font-size: 11px; letter-spacing: 2px; color: #93c5fd; margin-bottom: 4px; }
.dash-hero-title { font-size: 22px; font-weight: 600; margin: 0 0 4px; color: #fff; }
.dash-hero-sub { font-size: 12px; color: #bfdbfe; margin: 0 0 18px; }
.dash-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-filter-label { font-size: 12px; color: #bfdbfe; }
.dash-filter select { width: auto; min-width: 120px; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; }
.dash-filter select option { color: #1f2329; }
.dash-filter-hint { font-size: 12px; color: #93c5fd; }
.dash-reset { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff; padding: 7px 14px; border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 13px; }
.dash-reset:hover { background: rgba(255,255,255,.2); }

.rate-ring {
  width: 118px; height: 118px; flex: none; border-radius: 50%;
  background: conic-gradient(#34d399 0deg, #34d399 var(--pct, 0deg), rgba(255,255,255,.16) var(--pct, 0deg));
  display: flex; align-items: center; justify-content: center;
}
.rate-ring-inner { width: 92px; height: 92px; border-radius: 50%; background: #172554; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rate-num { font-size: 24px; font-weight: 600; color: #fff; line-height: 1.2; }
.rate-label { font-size: 11px; color: #93c5fd; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 15px 16px; position: relative; overflow: hidden; }
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.stat-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--soft); display: flex; align-items: center; justify-content: center; color: var(--accent); }
.stat-icon svg { width: 17px; height: 17px; }
.stat-tag { font-size: 11px; color: var(--muted); background: var(--bg); padding: 2px 7px; border-radius: 8px; }
.stat-num { font-size: 26px; font-weight: 600; line-height: 1.1; color: var(--text); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.chart-grid .panel-card { margin-bottom: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.panel-head span { font-size: 11px; color: var(--faint); }

.bars .bar-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.bars .bar-label { width: 70px; font-size: 12px; color: var(--muted); flex: none; }
.bars .bar-track { flex: 1; height: 9px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.bars .bar-fill { height: 100%; border-radius: 6px; background: var(--bar-color, var(--brand)); }
.bars .bar-count { width: 24px; text-align: right; font-size: 12px; font-weight: 500; color: var(--text); }

.rank-row { display: flex; align-items: center; gap: 12px; margin: 9px 0; }
.rank-no { width: 22px; height: 22px; flex: none; border-radius: 6px; background: var(--bg); color: var(--muted); font-size: 11px; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.rank-no.top1 { background: #fef3c7; color: #b45309; }
.rank-no.top2 { background: #e2e8f0; color: #475569; }
.rank-no.top3 { background: #ffedd5; color: #c2410c; }
.rank-name { width: 84px; flex: none; font-size: 12px; color: var(--text); }
.rank-track { flex: 1; height: 9px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.rank-fill { height: 100%; border-radius: 6px; background: var(--brand); }
.rank-count { width: 24px; text-align: right; font-size: 12px; font-weight: 500; }

.table-card { padding-bottom: 8px; }
.table-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn.export { background: var(--ok-soft); border-color: transparent; color: var(--ok); font-size: 12px; padding: 5px 12px; }
.table-card th { background: var(--bg); padding: 9px 10px; font-size: 12px; }
.table-card td { padding: 10px; border-bottom: 1px solid var(--line); }
.table-card tbody tr:hover td { background: #f8fafc; }
.type-tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--soft); color: var(--accent); }

@media (max-width: 760px) {
  .chart-grid { grid-template-columns: 1fr; }
  .dash-hero { flex-direction: column; align-items: flex-start; }
  .dash-hero-side { align-self: center; }
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .container { padding: 16px; }
  .tab { padding: 8px 10px; font-size: 13px; }
  .bars .bar-label { width: 66px; }
  .rank-name { width: 70px; }
}

.user-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
  border-radius: 12px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  color: #fff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, .16);
}
.user-hero::before { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.06); left: -50px; bottom: -110px; }
.user-hero-main, .user-hero-art { position: relative; z-index: 1; }
.user-hero-main { min-width: 0; }
.user-hero-title { font-size: 24px; font-weight: 600; margin: 0 0 5px; color: #fff; line-height: 1.25; overflow-wrap: anywhere; }
.user-hero-sub { font-size: 13px; color: #e0e7ff; margin: 0; line-height: 1.5; }
.user-hero-art { width: 96px; flex: none; opacity: .95; }
.user-hero-art svg { width: 100%; height: auto; display: block; }

.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; margin-bottom: 16px; }
.form-hint { font-size: 12px; color: var(--faint); margin: 2px 0 0; }

.input-wrap { position: relative; }
.input-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); pointer-events: none; }
.input-wrap input { padding-left: 34px; }

.type-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); padding: 6px 14px; border-radius: 18px; cursor: pointer; font-family: inherit; font-size: 13px; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.btn-lg { padding: 10px 22px; font-size: 14px; }

.record-list { display: flex; flex-direction: column; gap: 10px; }
.record-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 8px; background: var(--surface); }
.record-item.rec-pending { border-left-color: #d97706; }
.record-item.rec-doing { border-left-color: #0284c7; }
.record-item.rec-done { border-left-color: #059669; }
.record-item.rec-rejected { border-left-color: #e11d48; }
.record-title { font-weight: 500; font-size: 13px; }
.record-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.record-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .user-hero-art { display: none; }
  .form-card { padding: 18px 16px; }
}

.settings-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.settings-grid .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0; }
.settings-grid label { font-size: 12px; font-weight: 500; color: var(--muted); }
.brand-preview { margin-top: 16px; padding: 18px 22px; border-radius: 10px; background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%); color: #fff; }
.brand-preview-label { font-size: 10px; letter-spacing: 2px; color: #c7d2fe; margin-bottom: 8px; }
.brand-preview-title { color: #fff; line-height: 1.3; word-break: break-all; }
.settings-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
