:root {
  font: 400 15px/1.55 "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  color: #222033;
  background: #f6f5f8;
  color-scheme: light;
  --ink: #222033;
  --muted: #656173;
  --line: #e9e6ee;
  --line-input: #afabb9;
  --surface: #fff;
  --violet: #603ca0;
  --violet-dark: #442872;
  --violet-light: #f0eaf9;
  --green: #22664d;
  --green-light: #e5f3eb;
  --amber: #89510d;
  --amber-light: #fdf0dd;
  --red: #9b324c;
  --red-light: #fcebf0;
  --radius: 16px;
  --shadow: 0 6px 22px rgba(37, 26, 54, .045);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
svg { display: block; width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.symbol-bank { position: absolute; width: 0; height: 0; overflow: hidden; }
:is(a, button, input, select, [tabindex]):focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 5; top: 8px; left: 8px; padding: 10px 15px; border-radius: 8px; background: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.visually-hidden { position: absolute; clip: rect(0, 0, 0, 0); overflow: hidden; width: 1px; height: 1px; padding: 0; margin: -1px; white-space: nowrap; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand > div { display: grid; gap: 0; }
.brand strong { font-size: 1.12rem; font-weight: 750; letter-spacing: -.018em; line-height: 1.3; }
.brand > div > span { color: var(--muted); font-size: .79rem; }
.brand-mark { display: grid; width: 39px; height: 39px; flex: none; place-items: center; color: white; border-radius: 12px; background: var(--violet); }
.brand-mark svg { width: 25px; height: 25px; }
.sidebar { position: relative; z-index: 1; padding: 15px 14px 0; background: var(--surface); border-bottom: 1px solid var(--line); }
.sidebar nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 12px 0 5px; }
.sidebar nav a { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 44px; padding: 6px 2px; border-radius: 8px; color: var(--muted); text-align: center; font-size: .82rem; transition: background-color 150ms ease, color 150ms ease; }
.sidebar nav a svg { display: none; }
.sidebar nav a:hover { color: var(--violet-dark); background: #f8f5fb; }
.sidebar nav a[aria-current="page"] { color: var(--violet-dark); font-weight: 700; background: var(--violet-light); }
.sidebar-foot { display: none; }
.avatar { display: grid; width: 38px; height: 38px; flex: none; place-items: center; border-radius: 50%; color: var(--violet-dark); background: var(--violet-light); font-size: .88rem; font-weight: 700; }
.workspace { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 52px; padding: 4px 10px 4px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-actions, .breadcrumb { display: flex; align-items: center; gap: 7px; font-size: .82rem; }
.breadcrumb { flex-wrap: wrap; color: var(--muted); }
.breadcrumb svg { width: 12px; height: 12px; }
.breadcrumb span:last-child { color: var(--ink); font-weight: 600; }
.environment { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; color: var(--amber); background: var(--amber-light); font-size: .74rem; font-weight: 650; }
.environment::before, .badge::before { width: 6px; height: 6px; background: currentColor; border-radius: 50%; content: ""; flex: none; }
.environment.live { color: var(--green); background: var(--green-light); }
.environment.disabled { color: var(--muted); background: #f1eff4; }

.main-pane { width: 100%; max-width: 1500px; margin-inline: auto; padding: 23px 16px 40px; }
.page-intro { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; margin-bottom: 21px; }
.page-intro h1 { margin-bottom: 4px; font-size: clamp(1.65rem, 4.5vw, 2rem); line-height: 1.28; font-weight: 750; letter-spacing: -.036em; }
.page-intro p, .panel-subtitle { color: var(--muted); }
.page-intro p { font-size: .93rem; }
.update-group { display: flex; align-items: center; gap: 12px; max-width: 100%; }
.update-group > span { color: var(--muted); font-size: .8rem; }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 13px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink); font-weight: 650; font-size: .88rem; text-align: center; transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease; }
.icon-button { width: 44px; padding: 0; color: var(--muted); flex: none; }
:is(.icon-button, .button-link):hover:not(:disabled) { color: var(--violet-dark); background: var(--violet-light); }
.button-secondary { border-color: var(--line-input); background: var(--surface); }
.button-secondary:hover:not(:disabled) { color: var(--violet-dark); border-color: var(--violet); background: #fbf8ff; }
.button-primary { color: #fff; background: var(--violet); }
.button-primary:hover:not(:disabled) { background: var(--violet-dark); }
.button-link { color: var(--violet-dark); }
.button svg { width: 17px; height: 17px; }

.notice { margin: -2px 0 16px; padding: 9px 13px; border-radius: 9px; color: var(--green); background: var(--green-light); }
.notice.error, .form-error { color: var(--red); }
.notice.error { background: var(--red-light); }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 16px; }
.metric, .panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric { padding: 13px 12px 15px; }
.metric-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: .81rem; font-weight: 650; }
.metric-icon { display: none; place-items: center; border-radius: 9px; width: 33px; height: 33px; flex: none; color: var(--violet-dark); background: var(--violet-light); }
.metric-icon svg { width: 18px; height: 18px; }
.metric-icon.green { color: var(--green); background: var(--green-light); }
.metric-icon.amber { color: var(--amber); background: var(--amber-light); }
.metric strong { display: block; color: var(--ink); font-weight: 750; font-size: clamp(1.22rem, 3.6vw, 1.8rem); line-height: 1.2; word-break: break-word; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.dashboard-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.panel { overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px; }
.panel-header h2 { font-size: 1.06rem; font-weight: 700; letter-spacing: -.015em; }
.panel-subtitle { margin-top: 2px; font-size: .81rem; }
.chart-card { padding-bottom: 15px; }
.chart-key { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .77rem; white-space: nowrap; }
.chart-key::before { width: 9px; height: 9px; border-radius: 3px; background: #7957b4; content: ""; }
.chart { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 7px; padding: 14px 12px 0 12px; }
.chart-scale { position: relative; height: 126px; min-width: 25px; color: var(--muted); font-size: .67rem; font-variant-numeric: tabular-nums; text-align: right; }
.chart-scale span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; }
.chart-scale span:first-child { top: 0; }
.chart-scale span:nth-child(2) { top: 50%; }
.chart-scale span:last-child { top: 100%; }
.chart-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; position: relative; min-width: 0; margin: 0; padding: 0; list-style: none; }
.chart-bars::before { position: absolute; top: 0; left: 0; right: 0; height: 127px; pointer-events: none; content: ""; background: linear-gradient(var(--line), var(--line)) center center / 100% 1px no-repeat; border-block: 1px solid var(--line); }
.chart-bars li { min-width: 0; position: relative; text-align: center; }
.bar-slot { display: flex; align-items: center; justify-content: center; height: 126px; }
.bar-fill { display: block; width: 126px; flex: none; height: clamp(12px, 2.3vw, 32px); border: 0; appearance: none; transform: rotate(-90deg); background: transparent; }
.bar-fill::-webkit-progress-bar { background: transparent; }
.bar-fill::-webkit-progress-value { background: #8762c4; border-radius: 0 5px 5px 0; }
.bar-fill::-moz-progress-bar { background: #8762c4; border-radius: 0 5px 5px 0; }
.bar-fill.zero::-webkit-progress-value { background: #d8c8ee; }
.bar-fill.zero::-moz-progress-bar { background: #d8c8ee; }
.chart-date { display: block; margin-top: 7px; font-size: .67rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.quick-panel .panel-header { padding-bottom: 12px; }
.quick-status { margin: 0 16px 9px; padding: 14px; border-radius: 12px; background: #f7f2fc; }
.quick-status strong { display: block; font-size: 1.55rem; line-height: 1.3; font-variant-numeric: tabular-nums; color: var(--violet-dark); }
.quick-status span { color: var(--muted); font-size: .82rem; }
.quick-panel > .button { margin: 0 9px 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 9px; align-items: end; padding: 13px 16px 16px; border-bottom: 1px solid var(--line); }
.filters label { display: grid; gap: 4px; color: var(--muted); font-size: .79rem; font-weight: 650; }
.filters .query-field { flex: 1 1 160px; }
.filters .status-field { flex: 1 1 110px; }
.filters input, .filters select, .login-panel input { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; color: var(--ink); border: 1px solid var(--line-input); border-radius: 8px; background: #fff; font-size: .87rem; }
.filters input::placeholder { color: var(--muted); }
.table-wrap { min-width: 0; }
.table-wrap table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table-wrap :is(td, th) { text-align: left; overflow-wrap: anywhere; }
.table-wrap th { padding: 10px 15px; color: var(--muted); background: #faf9fc; font-size: .8rem; font-weight: 650; }
.table-wrap td { padding: 11px 15px; border-top: 1px solid var(--line); font-size: .88rem; }
.table-wrap td:first-child, .table-wrap th:first-child { padding-left: 16px; }
.table-wrap tr:focus-within td, .table-wrap tr:hover td { background: #fcfaff; }
.table-wrap code { color: var(--ink); font: .8rem/1.45 ui-monospace, "Cascadia Code", Consolas, monospace; }
.table-wrap .amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.table-wrap .secondary-text { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.table-wrap .row-action { width: auto; padding-inline: 8px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; color: #575061; background: #efedf2; border-radius: 6px; font-size: .74rem; line-height: 1.4; font-weight: 650; }
.badge.paid, .badge.delivered, .badge.active { color: var(--green); background: var(--green-light); }
.badge.pending { color: var(--amber); background: var(--amber-light); }
.badge.refunded, .badge.failed { color: var(--red); background: var(--red-light); }
.badge.permanent { color: var(--violet-dark); background: var(--violet-light); }
.badge.none::before { display: none; }
.pagination { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; min-height: 61px; padding: 7px 16px; color: var(--muted); font-size: .83rem; border-top: 1px solid var(--line); }
.pagination .buttons { display: flex; align-items: center; gap: 4px; }
.pagination button { min-height: 44px; }
.empty-state { display: grid; justify-items: center; padding: 30px 14px; color: var(--muted); text-align: center; }
.empty-state svg { box-sizing: content-box; margin-bottom: 8px; padding: 9px; color: var(--violet-dark); background: var(--violet-light); border-radius: 10px; }
.empty-state strong { color: var(--ink); margin-bottom: 2px; }
.empty-state p { max-width: 390px; font-size: .86rem; }
.empty-state .button { margin-top: 10px; }
.skeleton { min-height: 165px; }
.cards { display: grid; gap: 12px; }
.product-card { padding: 16px; }
.product-card .product-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.product-card .product-title { display: flex; align-items: center; gap: 10px; }
.product-card .metric-icon { display: grid; width: 38px; height: 38px; }
.product-card h2 { font-size: 1.08rem; }
.product-card .price { display: block; margin: 16px 0 2px; font-size: 1.65rem; font-weight: 750; letter-spacing: -.025em; }
.product-card p { color: var(--muted); overflow-wrap: anywhere; }
.product-card code { font-size: .8rem; }

.login-layout, .startup { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-layout { background: radial-gradient(ellipse at 16% 7%, #eee5f9 0, transparent 47%), radial-gradient(ellipse at 88% 95%, #f0e8fa 0, transparent 42%), #f7f5f9; }
.login-panel { width: min(100%, 423px); padding: clamp(23px, 7vw, 37px); border: 1px solid var(--line); border-top: 4px solid var(--violet); border-radius: 18px; background: var(--surface); box-shadow: 0 22px 80px #32243b15; }
.login-brand { margin-bottom: 30px; }
.login-panel h1 { font-size: 1.62rem; letter-spacing: -.02em; }
.login-panel > p { margin-top: 4px; color: var(--muted); font-size: .92rem; }
.login-panel form { display: grid; margin-top: 24px; gap: 7px; }
.login-panel form label { font-size: .88rem; font-weight: 650; }
.login-panel .form-error { min-height: 1.2em; font-size: .84rem; }
.login-panel form button { justify-content: space-between; min-height: 46px; }
.startup { align-content: center; gap: 11px; text-align: center; color: var(--muted); }
.spinner { width: 23px; height: 23px; border: 2px solid #ddd1ec; border-top-color: var(--violet); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 660px) {
  .table-wrap :is(table, tbody) { display: block; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .table-wrap tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 9px 12px; border-top: 1px solid var(--line); }
  .table-wrap tr:nth-child(even) { background: #fcfbfd; }
  .table-wrap td, .table-wrap td:first-child { display: block; border: 0; padding: 4px; }
  .table-wrap td[data-label]::before { display: block; content: attr(data-label); color: var(--muted); font-size: .75rem; padding-bottom: 2px; }
  .table-wrap td:first-child, .table-wrap .actions-cell { grid-column: 1 / -1; }
  .table-wrap .actions-cell:empty { display: none; }
  .table-wrap .row-action { justify-content: flex-start; padding-left: 0; }
}
@media (min-width: 510px) {
  .metric-icon { display: grid; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart { padding-inline: 19px; column-gap: 12px; }
  .chart-date, .chart-scale { font-size: .74rem; }
}
@media (min-width: 760px) {
  .shell { display: grid; grid-template-columns: 192px minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; display: flex; flex-direction: column; min-height: 100vh; height: 100dvh; padding: 23px 14px 13px; border-right: 1px solid var(--line); border-bottom: 0; }
  .sidebar .brand { margin: 0 5px 23px; }
  .sidebar nav { display: flex; flex-direction: column; margin: 0; }
  .sidebar nav a { justify-content: flex-start; gap: 10px; padding: 8px 11px; font-size: .88rem; }
  .sidebar nav a svg { display: block; width: 18px; height: 18px; }
  .sidebar-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
  .account-text { flex: 1 1 auto; font-size: .84rem; font-weight: 650; }
  .mobile-logout { display: none; }
  .topbar { min-height: 60px; padding: 8px 25px; }
  .main-pane { padding: 28px 24px 48px; }
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
  .metric { padding: 12px; }
  .metric-head { gap: 5px; }
  .metric-icon { width: 27px; height: 27px; }
  .metric-icon svg { width: 15px; height: 15px; }
  .filters .query-field { flex: 0 1 275px; }
  .filters .status-field { flex: 0 1 136px; }
  .orders-table th:nth-child(1) { width: 25%; }
  .orders-table th:nth-child(2) { width: 16%; }
  .orders-table th:nth-child(3) { width: 10%; }
  .orders-table th:nth-child(4) { width: 13%; }
  .orders-table th:nth-child(5) { width: 12%; }
  .orders-table th:nth-child(6) { width: 13%; }
}
@media (min-width: 1000px) {
  .shell { grid-template-columns: 224px minmax(0, 1fr); }
  .sidebar { padding: 25px 18px 16px; }
  .sidebar .brand { margin: 0 7px 29px; }
  .topbar { padding-inline: 33px; }
  .main-pane { padding-inline: clamp(28px, 3vw, 44px); }
  .page-intro { margin-bottom: 25px; }
  .metrics { gap: 15px; }
  .metric { padding: 17px 16px 19px; }
  .metric-head { gap: 9px; }
  .metric-icon { width: 33px; height: 33px; }
  .metric-icon svg { width: 18px; height: 18px; }
  .dashboard-grid { grid-template-columns: minmax(0, 2.1fr) minmax(220px, 1fr); }
  .panel-header { padding: 17px 19px; }
  .quick-status { margin-inline: 19px; }
  .cards { gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
