*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #f5f7fc;
  --glow-1: rgba(99, 102, 241, .16);
  --glow-2: rgba(14, 165, 233, .12);
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-2: #f1f5f9;
  --line: #e5eaf2;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-deep: #312e81;
  --brand-soft: #eef2ff;
  --brand-soft-2: #e0e7ff;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --ok-line: #a7f3d0;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 30px 70px -52px rgba(15, 23, 42, .55);
  --radius: 20px;
  --radius-sm: 12px;
  --track: #e8edf6;
}

[data-theme="dark"] {
  --bg: #0a0f1e;
  --glow-1: rgba(99, 102, 241, .2);
  --glow-2: rgba(14, 165, 233, .12);
  --surface: #111827;
  --surface-soft: #0f1626;
  --surface-2: #172033;
  --line: #1f2b40;
  --line-strong: #31415c;
  --text: #e8edf7;
  --text-soft: #c6d0e2;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --brand: #818cf8;
  --brand-2: #a78bfa;
  --brand-deep: #c7d2fe;
  --brand-soft: rgba(99, 102, 241, .16);
  --brand-soft-2: rgba(99, 102, 241, .26);
  --ok: #34d399;
  --ok-soft: rgba(16, 185, 129, .12);
  --ok-line: rgba(16, 185, 129, .3);
  --warn: #fbbf24;
  --warn-soft: rgba(245, 158, 11, .12);
  --danger: #f87171;
  --danger-soft: rgba(239, 68, 68, .12);
  --danger-line: rgba(239, 68, 68, .3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 30px 70px -48px rgba(0, 0, 0, .9);
  --track: #1e293b;
}

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1200px 620px at 8% -12%, var(--glow-1), transparent 62%),
    radial-gradient(900px 520px at 102% 2%, var(--glow-2), transparent 58%),
    var(--bg);
  background-attachment: fixed;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 22px; height: 22px; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 13px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 19px; font-weight: 800;
  box-shadow: 0 10px 22px -10px rgba(79, 70, 229, .7);
}
.brand-text h1 {
  margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -.02em;
}
.brand-text p {
  margin: 1px 0 0; font-size: 11px; color: var(--muted); letter-spacing: .02em;
}
.top-nav {
  display: flex; gap: 3px; padding: 3px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-soft);
}
.top-nav a {
  padding: 6px 12px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  transition: background-color .15s ease, color .15s ease;
}
.top-nav a:hover { color: var(--text); }
.top-nav a.active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
}
.user-avatar {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 12px; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta strong { font-size: 12px; font-weight: 700; }
.user-meta span { font-size: 10px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text-soft);
  font-size: 12.5px; font-weight: 600;
  transition: transform .12s ease, background-color .14s ease,
    border-color .14s ease, box-shadow .14s ease;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 26px -16px rgba(79, 70, 229, .9);
}
.btn-primary:hover:not(:disabled) {
  border-color: transparent;
  background: linear-gradient(135deg, #4338ca, #6d28d9);
}
.btn-ghost { background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--muted);
}
.btn-icon:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { color: var(--danger); border-color: var(--danger-line); background: var(--surface); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }

/* ------------------------------------------------------------------- shell */
.shell { max-width: 1280px; margin: 0 auto; padding: 28px 24px 44px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 7px; padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.page-kicker .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.page-title { margin: 0; font-size: 27px; font-weight: 800; letter-spacing: -.035em; }
.page-sub { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.update-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font-size: 11.5px; white-space: nowrap;
}
.update-pill .pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent);
}
.update-pill.stale .pulse {
  background: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 18%, transparent);
}

.range-tabs {
  display: inline-flex; gap: 3px; padding: 4px;
  border: 1px solid var(--line); border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.range-tabs button {
  border: 0; background: transparent; color: var(--muted);
  height: 30px; padding: 0 14px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600;
  transition: color .14s ease, background-color .14s ease;
}
.range-tabs button:hover:not(:disabled) { color: var(--text); }
.range-tabs button:disabled { opacity: .35; cursor: not-allowed; }
.range-tabs button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 18px -12px rgba(79, 70, 229, .9);
}

/* --------------------------------------------------------------------- kpi */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.kpi-card {
  position: relative; overflow: hidden;
  padding: 17px 18px 15px;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.kpi-card::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  opacity: .8;
}
.kpi-card.tone-ok::after { background: linear-gradient(90deg, #059669, #34d399); }
.kpi-card.tone-sky::after { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.kpi-card.tone-amber::after { background: linear-gradient(90deg, #d97706, #fbbf24); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .03em; }
.kpi-icon {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.kpi-card.tone-ok .kpi-icon { background: var(--ok-soft); color: var(--ok); }
.kpi-card.tone-sky .kpi-icon { background: color-mix(in srgb, #0ea5e9 12%, transparent); color: #0284c7; }
.kpi-card.tone-amber .kpi-icon { background: var(--warn-soft); color: var(--warn); }
.kpi-value {
  margin-top: 9px; font-size: 29px; font-weight: 800;
  letter-spacing: -.04em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-value.green { color: var(--ok); }
.kpi-value small { font-size: 14px; font-weight: 700; color: var(--muted); margin-left: 3px; }
.kpi-hint { margin-top: 5px; font-size: 11px; color: var(--muted-2); }

/* ------------------------------------------------------------------- cards */
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 326px;
  gap: 18px; align-items: start;
}
.main-col { display: grid; gap: 18px; min-width: 0; }
.side-stack { display: grid; gap: 18px; align-content: start; min-width: 0; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 0; }
.card-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head-icon {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--brand-soft); color: var(--brand);
}
.card-title { min-width: 0; }
.card-title h2, .card-title h3 {
  margin: 0; font-size: 14.5px; font-weight: 800; letter-spacing: -.015em;
}
.card-title p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }
.card-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.count-chip {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px;
  border-radius: 999px; background: var(--surface-2);
  color: var(--muted); font-size: 11px; font-weight: 700;
}
.member-search { position: relative; display: flex; align-items: center; width: 210px; }
.member-search > .icon {
  position: absolute; left: 10px; width: 14px; height: 14px;
  color: var(--muted-2); pointer-events: none;
}
.member-search input {
  width: 100%; height: 32px; padding: 0 30px 0 31px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-soft); color: var(--text);
  font-size: 12px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.member-search input::placeholder { color: var(--muted-2); }
.member-search input:focus {
  border-color: var(--brand); background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent);
}
.member-search input::-webkit-search-cancel-button { display: none; }
.member-search-clear {
  position: absolute; right: 4px;
  width: 24px; height: 24px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--muted);
}
.member-search-clear .icon { width: 12px; height: 12px; }
.member-search-clear:hover { background: var(--surface-2); color: var(--text); }

/* ------------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 10px 14px; text-align: left; white-space: nowrap;
  font-size: 10.5px; font-weight: 800; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  vertical-align: middle; color: var(--text-soft);
}
.data-table tbody tr { transition: background-color .13s ease; }
.data-table tbody tr:hover { background: var(--surface-soft); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table th.num { text-align: right; }
.data-table .strong-num {
  text-align: right; font-weight: 800; color: var(--text);
  font-size: 13.5px; font-variant-numeric: tabular-nums;
}
.data-table tfoot td {
  padding: 11px 14px;
  background: var(--surface-soft);
  border-top: 1px solid var(--line); border-bottom: 0;
  font-weight: 700; color: var(--text);
}
.data-table tfoot .num, .data-table tfoot .strong-num { font-weight: 800; }
.cell-sub { display: block; margin-top: 1px; font-size: 10.5px; color: var(--muted-2); }

.member-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.member-avatar {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center; border-radius: 10px;
  background: linear-gradient(140deg, var(--brand-soft), var(--brand-soft-2));
  color: var(--brand); font-size: 13px; font-weight: 800;
}
.member-main { min-width: 0; line-height: 1.25; }
.member-name { display: block; font-weight: 700; color: var(--text); }
.member-id {
  display: block; max-width: 170px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  font-size: 10.5px; color: var(--muted-2);
}
.tag-account {
  display: inline-flex; align-items: center;
  max-width: 150px; padding: 3px 8px;
  border-radius: 7px; background: var(--brand-soft); color: var(--brand);
  font-size: 10.5px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-cell { min-width: 170px; max-width: 300px; }
.link-name { display: block; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-cell { max-width: 220px; }
.note-text {
  display: block; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-size: 12px;
}
.note-text.empty { color: var(--muted-2); }

.progress-wrap { display: flex; align-items: center; gap: 9px; min-width: 146px; }
.progress-track {
  width: 92px; height: 8px; flex: none;
  border-radius: 999px; background: var(--track); overflow: hidden;
}
.progress-track span {
  display: block; height: 100%; width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width .35s ease;
}
.progress-track span.green { background: linear-gradient(90deg, #059669, #34d399); }
.progress-label {
  min-width: 54px; font-size: 11.5px; font-weight: 800;
  color: var(--text-soft); font-variant-numeric: tabular-nums;
}
.progress-label.green { color: var(--ok); }
.progress-empty .progress-track { display: none; }
.progress-empty .progress-label { color: var(--muted-2); font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.on { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: var(--danger-soft); color: var(--danger); }
.badge.neutral { background: var(--surface-2); color: var(--muted); }

.share-cell { min-width: 120px; }
.share-text { font-size: 11.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

.table-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}
.table-foot-info { font-size: 11.5px; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 5px; }
.pager button {
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text-soft);
  font-size: 12px; font-weight: 600;
}
.pager button:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-2); }
.pager button.active {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager .pager-gap { color: var(--muted-2); padding: 0 2px; }

/* ---------------------------------------------------------------- accounts */
.account-list { display: flex; flex-direction: column; }
.account-item { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.account-item:last-child { border-bottom: 0; }
.account-line { display: flex; align-items: center; gap: 8px; }
.account-line strong { font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-line .num { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.account-sub { margin-top: 2px; font-size: 10.5px; color: var(--muted-2); }
.account-bar {
  height: 5px; margin-top: 8px; border-radius: 999px;
  background: var(--track); overflow: hidden;
}
.account-bar span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.sync-panel { padding: 16px 18px; display: grid; gap: 12px; }
.sync-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.sync-row span { color: var(--muted); }
.sync-row strong { font-weight: 700; text-align: right; }
.sync-note {
  margin: 0 18px 16px; padding: 10px 12px;
  border-radius: 10px; background: var(--surface-soft);
  font-size: 10.5px; line-height: 1.6; color: var(--muted);
}

/* ------------------------------------------------------------- empty/state */
.empty-state { padding: 46px 24px; text-align: center; }
.empty-orb {
  width: 54px; height: 54px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 18px; background: var(--brand-soft);
  position: relative;
}
.empty-orb::before, .empty-orb::after {
  content: ""; position: absolute; border-radius: 8px; background: var(--brand);
  opacity: .25;
}
.empty-orb::before { width: 18px; height: 18px; transform: translate(-6px, -4px); }
.empty-orb::after { width: 12px; height: 12px; transform: translate(9px, 8px); }
.empty-state h3 { margin: 0 0 5px; font-size: 14px; font-weight: 800; }
.empty-state p { margin: 0; font-size: 12px; color: var(--muted); }
.loading-state { padding: 52px 24px; text-align: center; color: var(--muted); font-size: 12.5px; }
.spinner {
  width: 18px; height: 18px; margin: 0 auto 10px;
  border: 2px solid var(--brand-soft-2); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ footer */
.page-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-top: 26px; padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted-2); font-size: 11px;
}

/* --------------------------------------------------------------- mobile cards */
.member-cards { display: none; }
.link-cards { display: none; }
.m-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.m-card:last-child { border-bottom: 0; }
.m-card-head { display: flex; align-items: center; gap: 9px; }
.m-card-head .member-main { flex: 1; }
.m-card .member-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-card-total { flex: none; font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.m-card-total small { font-size: 10px; color: var(--muted-2); font-weight: 600; margin-left: 3px; }
.m-card-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.m-metrics {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  gap: 16px; align-items: center;
  margin-top: 11px;
}
.m-metric > span { display: block; margin-bottom: 3px; font-size: 10px; color: var(--muted-2); }
.m-metric > strong { font-size: 15px; font-weight: 800; }
.m-metric-progress .progress-wrap { min-width: 0; width: 100%; gap: 8px; }
.m-metric-progress .progress-track { width: auto; flex: 1; }
.m-note {
  margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line);
  font-size: 11px; color: var(--muted);
}

.link-m-card { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.link-m-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.link-m-head strong {
  font-size: 13px; font-weight: 700; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-m-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px; margin-top: 10px;
}
.link-m-stats span { display: block; font-size: 10px; color: var(--muted-2); }
.link-m-stats strong {
  display: block; margin-top: 2px; font-size: 16px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.link-m-total {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; border-top: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 11.5px; color: var(--muted);
}
.link-m-total strong { font-size: 13px; color: var(--text); }

/* ---------------------------------------------------------------- login page */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(420px, .94fr);
}
.login-brand {
  position: relative; overflow: hidden;
  padding: clamp(34px, 5vw, 64px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  color: #eef2ff;
  background:
    radial-gradient(700px 420px at 82% 8%, rgba(139, 92, 246, .45), transparent 62%),
    radial-gradient(640px 420px at 4% 94%, rgba(14, 165, 233, .3), transparent 60%),
    linear-gradient(150deg, #0b1226 0%, #1e1b4b 48%, #3b0764 100%);
}
.login-brand::before {
  content: ""; position: absolute; width: 460px; height: 460px;
  right: -160px; top: -140px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .14);
}
.login-brand::after {
  content: ""; position: absolute; width: 680px; height: 680px;
  left: -300px; bottom: -420px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .1);
}
.login-brand .brand { position: relative; z-index: 1; }
.login-brand .brand-mark {
  background: rgba(255, 255, 255, .14);
  box-shadow: none; backdrop-filter: blur(10px);
}
.login-brand .brand-text h1 { color: #fff; }
.login-brand .brand-text p { color: rgba(224, 231, 255, .7); }
.login-hero { position: relative; z-index: 1; max-width: 520px; }
.login-kicker {
  display: inline-flex; align-items: center; gap: 7px;
  margin-bottom: 18px; padding: 5px 11px;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: rgba(224, 231, 255, .85);
}
.login-hero h1 {
  margin: 0; font-size: clamp(34px, 4.2vw, 54px);
  line-height: 1.1; font-weight: 800; letter-spacing: -.045em;
  color: #fff;
}
.login-hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #a5b4fc, #c4b5fd 55%, #67e8f9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-hero p {
  margin: 18px 0 0; max-width: 430px;
  font-size: 13.5px; line-height: 1.75; color: rgba(224, 231, 255, .72);
}
.login-points {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; max-width: 560px;
}
.login-point {
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px;
  background: rgba(255, 255, 255, .055);
  backdrop-filter: blur(8px);
}
.login-point strong { display: block; font-size: 12px; color: #fff; }
.login-point span { display: block; margin-top: 3px; font-size: 10.5px; line-height: 1.5; color: rgba(224, 231, 255, .6); }
.login-panel {
  position: relative;
  display: grid; place-items: center;
  padding: 40px clamp(22px, 5vw, 64px);
  background: var(--surface);
}
.login-theme { position: absolute; top: 22px; right: 22px; }
.login-card { width: min(380px, 100%); }
.login-card-head { margin-bottom: 26px; }
.login-card-head .eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .1em;
  color: var(--brand);
}
.login-card-head h2 { margin: 10px 0 6px; font-size: 25px; font-weight: 800; letter-spacing: -.035em; }
.login-card-head p { margin: 0; font-size: 12.5px; color: var(--muted); }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 7px; font-size: 11.5px; font-weight: 700; color: var(--text-soft); }
.input-wrap { position: relative; }
.input-wrap > .icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); width: 16px; height: 16px;
}
.input {
  width: 100%; height: 44px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface-soft); color: var(--text);
  outline: none; font-size: 13.5px;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.input::placeholder { color: var(--muted-2); }
.input:focus {
  border-color: var(--brand); background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 13%, transparent);
}
.input-wrap .input { padding-left: 39px; }
.input-wrap.has-toggle .input { padding-right: 52px; }
.input-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 30px; padding: 0 8px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 700;
}
.input-toggle:hover { background: var(--surface-2); color: var(--text); }
.login-submit { width: 100%; height: 44px; margin-top: 6px; border-radius: 11px; font-size: 13.5px; }
.login-error {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0 0 14px; padding: 10px 12px;
  border: 1px solid var(--danger-line); border-radius: 10px;
  background: var(--danger-soft); color: var(--danger);
  font-size: 12px; line-height: 1.5;
}
.login-hint {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11px; line-height: 1.7; color: var(--muted-2);
}
.login-foot {
  position: absolute; bottom: 20px; right: 24px;
  font-size: 10.5px; color: var(--muted-2);
}

/* --------------------------------------------------------------------- admin */
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr);
  gap: 18px; align-items: start;
}
.user-table .user-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.user-cell strong { display: block; font-size: 12.5px; font-weight: 700; color: var(--text); }
.user-cell span { display: block; font-size: 10.5px; color: var(--muted-2); }
.table-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.scope-cell { display: flex; flex-direction: column; gap: 1px; max-width: 160px; }
.scope-top { display: flex; align-items: center; gap: 7px; }
.scope-cell strong { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.scope-cell span {
  font-size: 10px; color: var(--muted-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-btn {
  height: 20px; padding: 0 6px; flex: none;
  border: 0; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 10px; font-weight: 700; white-space: nowrap;
}
.link-btn:hover { background: var(--brand-soft-2); }
.delete-btn { color: var(--danger); background: transparent; border-color: transparent; }
.delete-btn:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger-line); }

.user-table td { white-space: nowrap; }
.user-table .scope-cell { white-space: normal; }
.scope-toggle { display: flex; gap: 8px; margin-bottom: 9px; }
.scope-option {
  flex: 1; height: 36px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-soft); color: var(--muted);
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.scope-option input { margin: 0; accent-color: var(--brand); }
.scope-option.checked {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand);
}
.scope-list {
  display: grid; gap: 4px;
  max-height: 190px; overflow-y: auto;
  padding: 7px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-soft);
}
.scope-list.empty {
  display: block; padding: 12px;
  font-size: 11.5px; color: var(--muted); text-align: center;
}
.scope-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 7px;
  color: var(--text-soft); font-size: 12px; cursor: pointer;
}
.scope-item:hover { background: var(--surface-2); }
.scope-item input { margin: 0; accent-color: var(--brand); }
.scope-item.disabled { opacity: .45; cursor: not-allowed; }
.scope-item .scope-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.scope-item .scope-total {
  font-size: 10.5px; color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.badge-admin { background: var(--brand-soft); color: var(--brand); }
.badge-client { background: var(--surface-2); color: var(--muted); }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.status-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.status-dot.off::before { background: var(--muted-2); }
.sync-hero { padding: 18px; }
.mobile-scroll-hint { display: none; }
.sync-hero-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.sync-hero-value { margin-top: 4px; font-size: 32px; font-weight: 800; letter-spacing: -.04em; }
.sync-hero-value small { font-size: 13px; color: var(--muted); font-weight: 700; margin-left: 4px; }
.sync-hero-value.empty small { display: none; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 13px; }
.mini-stat { padding: 10px 12px; border-radius: 11px; background: var(--surface-soft); border: 1px solid var(--line); }
.mini-stat span { display: block; font-size: 10px; color: var(--muted-2); }
.mini-stat strong { display: block; margin-top: 1px; font-size: 17px; font-weight: 800; }
.history-list { display: flex; flex-direction: column; }
.history-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-bottom: 1px solid var(--line);
  font-size: 11.5px;
}
.history-row:last-child { border-bottom: 0; }
.history-row .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
.history-row span { color: var(--muted); }
.history-row strong { margin-left: auto; font-weight: 700; }
.admin-note {
  margin: 0 18px 16px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-soft); color: var(--muted);
  font-size: 10.5px; line-height: 1.65;
}

/* -------------------------------------------------------------------- modal */
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 20px;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 13, 28, .55); backdrop-filter: blur(3px);
}
.modal-card {
  position: relative; width: min(420px, 100%);
  max-height: calc(100vh - 40px); overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); box-shadow: 0 40px 90px -30px rgba(8, 13, 28, .5);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-head { margin-bottom: 18px; padding-right: 28px; }
.modal-kicker { font-size: 10px; font-weight: 800; letter-spacing: .12em; color: var(--brand); text-transform: uppercase; }
.modal-head h3 { margin: 6px 0 4px; font-size: 19px; font-weight: 800; letter-spacing: -.03em; }
.modal-head p { margin: 0; font-size: 11.5px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.form-hint { margin-top: 6px; font-size: 10.5px; color: var(--muted-2); }
.form-error { margin: 0 0 12px; color: var(--danger); font-size: 11.5px; }

/* -------------------------------------------------------------------- toast */
.toast-stack {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 220px; max-width: 360px;
  padding: 11px 14px;
  border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 11px; background: var(--surface);
  box-shadow: 0 20px 45px -24px rgba(15, 23, 42, .5);
  animation: toastIn .2s ease;
  pointer-events: auto;
}
.toast strong { font-size: 12px; font-weight: 800; }
.toast span { font-size: 11px; color: var(--muted); line-height: 1.5; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1120px) {
  .main-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: 340px; padding: 34px 28px 30px; }
  .login-hero h1 { font-size: clamp(30px, 6vw, 42px); }
  .login-points { max-width: none; }
  .login-panel { min-height: 540px; }
}
@media (max-width: 820px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-stack { grid-template-columns: 1fr; }
  .top-nav { display: none; }
  .topbar-inner { padding: 12px 18px; }
  .shell { padding: 22px 18px 36px; }
  .page-title { font-size: 23px; }
}
@media (max-width: 720px) {
  .data-table.member-table { display: none; }
  .member-cards { display: block; }
  .link-table-wrap { display: none; }
  .link-cards { display: block; }
  .member-card .card-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 9px 12px;
    align-items: center;
    flex-wrap: nowrap;
  }
  .member-card .card-head-icon { grid-column: 1; grid-row: 1; }
  .member-card .card-title { grid-column: 2; grid-row: 1; min-width: 0; }
  .member-card .card-actions {
    grid-column: 1 / -1; grid-row: 2;
    width: 100%; margin-left: 0;
    justify-content: flex-start;
  }
  .member-card .member-search { flex: 1; width: auto; min-width: 0; }
  .mobile-scroll-hint {
    display: block; padding: 9px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface-soft);
    font-size: 10.5px; color: var(--muted-2); text-align: center;
  }
  .kpi-value { font-size: 25px; }
  .brand-text p { display: none; }
  .brand-text h1 { white-space: nowrap; }
  .user-meta { display: none; }
  .user-chip { padding: 3px; border: 0; background: transparent; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .page-actions { width: 100%; justify-content: space-between; }
  .range-tabs { width: 100%; }
  .range-tabs button { flex: 1; padding: 0 8px; }
  .table-foot { justify-content: center; }
  .table-foot-info { width: 100%; text-align: center; }
  .login-points { grid-template-columns: 1fr; }
  .login-point { display: none; }
  .login-brand { min-height: 280px; }
  .login-hero p { margin-top: 12px; font-size: 12.5px; }
  .login-panel { min-height: 500px; padding: 34px 22px; }
  .login-theme { top: 14px; right: 14px; }
}
@media (max-width: 560px) {
  .topbar .brand-text { display: none; }
  .topbar-inner { gap: 10px; }
  .top-actions { gap: 6px; }
  .update-pill { padding: 0 9px; font-size: 10.5px; }
}
@media (max-width: 480px) {
  .kpi-grid { gap: 10px; }
  .kpi-card { padding: 14px; border-radius: 15px; }
  .kpi-icon { width: 28px; height: 28px; }
  .kpi-value { font-size: 22px; }
  .card-head { padding: 15px 16px; }
  .data-table th, .data-table td { padding: 10px 12px; }
  .member-id { max-width: 120px; }
  .toast-stack { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }
}
