:root {
  --primary: #6552d7;
  --primary-dark: #4f3bb8;
  --primary-soft: #eeeaff;
  --accent: #f3b84b;
  --mint: #49a982;
  --mint-soft: #dcf6eb;
  --danger: #c9475d;
  --danger-soft: #fff0f3;
  --ink: #29263d;
  --muted: #6f6a80;
  --line: #e8e3f3;
  --surface: #ffffff;
  --canvas: #fbf8f1;
  --shadow-sm: 0 4px 12px rgba(65, 48, 115, .08);
  --shadow-md: 0 12px 32px rgba(65, 48, 115, .13);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --sidebar-width: 260px;
  font-family: "Nunito Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% 10%, rgba(255, 224, 138, .28), transparent 28%), var(--canvas); }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
svg { stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; fill: none; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 2000; transform: translateY(-160%); padding: 10px 14px; border-radius: 10px; color: #fff; background: var(--primary-dark); }
.skip-link:focus { transform: translateY(0); }
.eyebrow { margin: 0 0 5px; color: var(--primary); font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: .16em; }
.login-shell { display: grid; min-height: 100dvh; place-items: center; padding: 32px 16px; }
.login-card { width: min(100%, 440px); padding: 42px; border: 1px solid rgba(104, 83, 216, .12); border-radius: 32px; background: rgba(255,255,255,.94); box-shadow: var(--shadow-md); text-align: center; }
.brand-orbit { position: relative; display: grid; width: 104px; height: 104px; margin: 0 auto 16px; place-items: center; border-radius: 50%; background: var(--primary-soft); }
.brand-star { width: 70px; height: 70px; color: var(--primary); filter: drop-shadow(0 7px 9px rgba(83,60,185,.2)); }
.orbit-dot { position: absolute; display: block; border-radius: 50%; }
.dot-a { width: 12px; height: 12px; top: 6px; right: 5px; background: #ffcf61; }
.dot-b { width: 8px; height: 8px; bottom: 15px; left: 0; background: #79d6b3; }
.dot-c { width: 6px; height: 6px; top: 24px; left: 4px; background: #f191a4; }
.login-card h1 { margin: 0; font-size: clamp(28px, 6vw, 36px); letter-spacing: -.04em; }
.login-copy { max-width: 340px; margin: 10px auto 28px; color: var(--muted); line-height: 1.7; }
form { text-align: left; }
label { display: block; margin: 16px 0 8px; font-size: 14px; font-weight: 700; }
.field-wrap { position: relative; display: flex; align-items: center; min-height: 52px; border: 1.5px solid var(--line); border-radius: 15px; background: #fbfaff; transition: border-color .2s, box-shadow .2s; }
.field-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(101,82,215,.13); }
.field-wrap > svg { flex: 0 0 20px; width: 20px; height: 20px; margin-left: 16px; color: var(--primary); }
.field-wrap input { width: 100%; min-width: 0; height: 50px; padding: 0 14px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; }
.icon-button { display: inline-grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--primary-soft); color: var(--primary); }
.icon-button:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid rgba(101,82,215,.32); outline-offset: 2px; }
.icon-button svg { width: 21px; height: 21px; }
.password-toggle { margin-right: 4px; }
.form-error { min-height: 21px; margin: 8px 0 0; color: var(--danger); font-size: 13px; }
.primary-button, .secondary-button, .danger-button { min-height: 48px; border-radius: 14px; border: 0; font-weight: 800; transition: transform .15s, box-shadow .2s, background .2s; }
.primary-button { width: 100%; margin-top: 10px; color: #fff; background: linear-gradient(135deg, #7863e8, #5b46cc); box-shadow: 0 9px 20px rgba(91,70,204,.25); }
.primary-button:hover { box-shadow: 0 12px 24px rgba(91,70,204,.32); }
.primary-button:active, .secondary-button:active, .danger-button:active { transform: scale(.98); }
button:disabled { cursor: not-allowed; opacity: .55; box-shadow: none !important; }
.privacy-note { display: flex; gap: 9px; align-items: flex-start; margin-top: 22px; padding: 12px 14px; border-radius: 14px; color: #396c5a; background: var(--mint-soft); text-align: left; font-size: 12px; line-height: 1.55; }
.privacy-note svg { width: 20px; height: 20px; flex: 0 0 20px; }
.app-shell { min-height: 100dvh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 100; display: flex; width: var(--sidebar-width); flex-direction: column; padding: 24px 16px; border-right: 1px solid rgba(88,65,170,.09); background: rgba(255,255,255,.92); backdrop-filter: blur(16px); }
.side-brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 26px; }
.side-brand svg { width: 44px; height: 44px; flex: 0 0 44px; padding: 7px; border-radius: 14px; color: var(--primary); background: var(--primary-soft); }
.side-brand strong, .side-brand span, .admin-chip strong, .admin-chip span { display: block; }
.side-brand strong { font-size: 17px; }
.side-brand span, .admin-chip span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.sidebar nav { display: grid; gap: 8px; }
.nav-item { display: flex; width: 100%; min-height: 48px; align-items: center; gap: 12px; padding: 0 14px; border: 0; border-radius: 14px; color: var(--muted); background: transparent; font-weight: 700; text-align: left; transition: background .2s, color .2s; }
.nav-item:hover { background: #f7f4ff; color: var(--primary); }
.nav-item.active { color: var(--primary-dark); background: var(--primary-soft); box-shadow: inset 0 0 0 1px rgba(101,82,215,.08); }
.nav-item svg { width: 21px; height: 21px; }
.nav-badge { min-width: 24px; margin-left: auto; padding: 2px 7px; border-radius: 999px; color: var(--primary-dark); background: #fff; font-size: 11px; text-align: center; }
.side-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.admin-chip { display: flex; gap: 10px; align-items: center; padding: 8px; }
.admin-avatar { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 13px; color: var(--primary-dark); background: #ffe9ad; font-weight: 900; }
.logout-button { display: flex; width: 100%; min-height: 44px; align-items: center; gap: 10px; margin-top: 8px; padding: 0 12px; border: 0; border-radius: 12px; color: var(--danger); background: transparent; font-weight: 700; }
.logout-button:hover { background: var(--danger-soft); }
.logout-button svg { width: 20px; height: 20px; }
.main-content { min-height: 100dvh; margin-left: var(--sidebar-width); padding: 28px clamp(20px, 4vw, 52px) 52px; }
.topbar { display: flex; min-height: 64px; align-items: center; gap: 14px; margin-bottom: 28px; }
.topbar h1 { margin: 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.04em; }
.menu-button { display: none; }
.sync-state { display: flex; align-items: center; gap: 8px; margin-left: auto; padding: 9px 13px; border: 1px solid #caeadf; border-radius: 999px; color: #34755f; background: #effbf6; font-size: 13px; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #46a47f; box-shadow: 0 0 0 4px rgba(70,164,127,.13); }
.page-view { max-width: 1400px; margin: 0 auto; }
.welcome-card { position: relative; display: flex; min-height: 180px; align-items: center; overflow: hidden; padding: clamp(26px, 4vw, 42px); border-radius: var(--radius-lg); color: #fff; background: linear-gradient(125deg, #6650d4, #8f79ed); box-shadow: var(--shadow-md); }
.welcome-card::before { content: ""; position: absolute; width: 260px; height: 260px; top: -150px; right: 170px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; }
.welcome-card > div { position: relative; z-index: 1; max-width: 620px; }
.soft-label { display: inline-block; margin-bottom: 12px; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.16); font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.welcome-card h2 { margin: 0; font-size: clamp(25px, 4vw, 38px); letter-spacing: -.04em; }
.welcome-card p { margin: 10px 0 0; color: rgba(255,255,255,.82); line-height: 1.7; }
.welcome-illustration { width: 180px; height: 120px; margin-left: auto; flex: 0 0 180px; stroke: none; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.metric-card { min-height: 145px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-top { display: flex; justify-content: space-between; align-items: center; }
.metric-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 14px; color: var(--primary); background: var(--primary-soft); }
.metric-icon.mint { color: #34755f; background: var(--mint-soft); }
.metric-icon.gold { color: #9a650f; background: #fff0c7; }
.metric-icon.rose { color: #a73b50; background: #ffe5eb; }
.metric-icon svg { width: 22px; height: 22px; }
.metric-value { margin: 18px 0 2px; font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.metric-label { color: var(--muted); font-size: 13px; }
.dashboard-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; margin-top: 20px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 24px; }
.panel-heading h2 { margin: 0; font-size: 20px; }
.distribution-chart { padding: 0 24px 26px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 44px; gap: 14px; align-items: center; margin-top: 18px; }
.bar-row:first-child { margin-top: 0; }
.bar-label { font-size: 14px; font-weight: 700; }
.bar-track { height: 12px; overflow: hidden; border-radius: 999px; background: #f2eff8; }
.bar-fill { height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, #7863e8, #a18ff1); }
.bar-fill.mint { background: linear-gradient(90deg, #46a47f, #79d6b3); }
.bar-value { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.privacy-panel { display: flex; gap: 18px; align-items: flex-start; padding: 26px; background: linear-gradient(145deg, #effbf6, #fff); }
.privacy-icon { display: grid; width: 52px; height: 52px; flex: 0 0 52px; place-items: center; border-radius: 17px; color: #34755f; background: var(--mint-soft); }
.privacy-icon svg { width: 27px; height: 27px; }
.privacy-panel h2 { margin: 0 0 10px; font-size: 20px; }
.privacy-panel p:last-child { margin: 0; color: var(--muted); line-height: 1.7; }
.toolbar { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 14px; margin-bottom: 18px; }
.search-field { display: flex; width: min(100%, 420px); min-height: 46px; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfaff; }
.search-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(101,82,215,.11); }
.search-field svg { width: 20px; height: 20px; color: var(--muted); }
.search-field input { width: 100%; height: 44px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; }
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: #f1eef6; }
.segmented button { min-height: 38px; padding: 0 16px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-weight: 700; }
.segmented button.active { color: var(--primary-dark); background: #fff; box-shadow: 0 3px 9px rgba(65,48,115,.1); }
.count-pill { padding: 6px 10px; border-radius: 999px; color: var(--primary-dark); background: var(--primary-soft); font-size: 12px; font-weight: 800; }
.table-scroll { overflow-x: auto; padding: 0 16px 18px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th { padding: 13px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: left; }
td { padding: 15px 12px; border-bottom: 1px solid #f0edf6; font-size: 14px; vertical-align: middle; }
tbody tr:hover { background: #fcfbff; }
.account-cell { display: flex; gap: 11px; align-items: center; }
.account-avatar { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border-radius: 13px; color: var(--primary-dark); background: var(--primary-soft); font-weight: 900; }
.account-avatar.child { color: #8e5c10; background: #fff0c7; }
.account-cell strong, .account-cell span { display: block; }
.account-cell span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.role-pill, .state-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.role-pill.parent { color: var(--primary-dark); background: var(--primary-soft); }
.role-pill.child { color: #8e5c10; background: #fff0c7; }
.state-pill.enabled { color: #34755f; background: var(--mint-soft); }
.state-pill.disabled { color: #9a394c; background: var(--danger-soft); }
.mini-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.binding-stack { display: grid; gap: 4px; }
.binding-stack button { width: fit-content; padding: 0; border: 0; color: var(--primary); background: transparent; font-size: 12px; font-weight: 700; }
.muted-cell { color: var(--muted); }
.align-right { text-align: right; }
.row-action { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; font-size: 12px; font-weight: 800; }
.row-action:hover { color: var(--primary); border-color: #c9c0f5; background: #faf8ff; }
.row-action.danger { color: var(--danger); }
.account-cards { display: none; padding: 0 14px 18px; }
.account-card { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.account-card + .account-card { margin-top: 12px; }
.card-top, .card-meta, .card-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-meta { margin: 14px 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.card-actions .row-action { flex: 1; }
.empty-state { padding: 62px 20px; text-align: center; }
.empty-state svg { width: 56px; height: 56px; color: #c8bef5; fill: #f0ecff; }
.empty-state h3 { margin: 12px 0 5px; }
.empty-state p { margin: 0; color: var(--muted); }
.drawer-scrim, .dialog-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(27,22,45,.52); backdrop-filter: blur(5px); }
.dialog-scrim { z-index: 1000; display: grid; place-items: center; padding: 18px; }
.confirm-dialog { width: min(100%, 410px); padding: 28px; border-radius: 24px; background: #fff; box-shadow: var(--shadow-md); text-align: center; }
.dialog-icon { display: grid; width: 54px; height: 54px; margin: 0 auto 14px; place-items: center; border-radius: 17px; color: var(--danger); background: var(--danger-soft); }
.dialog-icon svg { width: 27px; height: 27px; }
.confirm-dialog h2 { margin: 0; }
.confirm-dialog p { margin: 10px 0 24px; color: var(--muted); line-height: 1.65; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.secondary-button { color: var(--ink); border: 1px solid var(--line); background: #fff; }
.danger-button { color: #fff; background: var(--danger); box-shadow: 0 8px 18px rgba(201,71,93,.2); }
.toast { position: fixed; z-index: 1500; left: 50%; bottom: 28px; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 13px; color: #fff; background: #29263d; box-shadow: var(--shadow-md); opacity: 0; transform: translate(-50%, 18px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(-105%); box-shadow: var(--shadow-md); transition: transform .24s ease-out; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 20px 18px 42px; }
  .menu-button { display: inline-grid; }
  .welcome-illustration { width: 135px; flex-basis: 135px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; }
  .segmented { align-self: flex-start; }
  .table-scroll { display: none; }
  .account-cards { display: block; }
}
@media (max-width: 620px) {
  .login-card { padding: 30px 20px; border-radius: 26px; }
  .topbar { align-items: flex-start; }
  .sync-state { padding: 8px; }
  .sync-state span:last-child { display: none; }
  .welcome-card { min-height: 200px; align-items: flex-start; }
  .welcome-card p { padding-right: 30px; }
  .welcome-illustration { position: absolute; right: -24px; bottom: -8px; width: 130px; opacity: .75; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .metric-card { min-height: 130px; padding: 17px; }
  .metric-value { font-size: 26px; }
  .panel-heading { padding: 18px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding: 0 8px; }
  .bar-row { grid-template-columns: 72px 1fr 35px; gap: 9px; }
}
@media (max-width: 390px) {
  .main-content { padding-inline: 12px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 116px; }
  .welcome-card { padding: 24px 20px; }
  .dialog-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
