:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: #18243b;
  background: #f4f7fb;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
:focus-visible { outline: 3px solid #70a5ff; outline-offset: 2px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.15rem); line-height: 1.25; letter-spacing: -.03em; margin-bottom: .35rem; }
h2 { font-size: 1.14rem; line-height: 1.3; margin-bottom: 0; }
p { color: #65718a; }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.sidebar { background: #101e36; color: #d9e4f8; padding: 27px 18px; display: flex; flex-direction: column; gap: 34px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; font-size: 1.05rem; font-weight: 750; line-height: 1.2; }
.brand small { display: block; margin-top: 5px; color: #8ea3c5; font-size: .72rem; font-weight: 500; letter-spacing: .02em; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: white; background: linear-gradient(135deg,#3f80ed,#725be9); font-size: 1.05rem; box-shadow: 0 7px 18px #0a153466; }
.nav-list { display: grid; gap: 5px; }
.nav-group { display: grid; gap: 5px; min-width: 0; }
.nav-list a { padding: 10px 13px; border-radius: 10px; color: #b8c7e0; font-weight: 550; }
.nav-list a:hover, .nav-list a[aria-current="page"] { color: #fff; background: #ffffff1b; }
.nav-label { margin: 23px 13px 4px; color: #7489aa; font-size: .75rem; letter-spacing: .08em; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid #ffffff24; padding: 18px 13px 0; display: grid; gap: 10px; }
.account-name { font-weight: 650; word-break: break-all; }
.text-button { border: 0; background: none; padding: 0; color: #8fb6ff; text-align: left; }
.text-button:hover { text-decoration: underline; }
.main-column { min-width: 0; }
.topbar { height: 56px; padding: 0 32px; border-bottom: 1px solid #e3e9f2; background: #fff; display: flex; justify-content: flex-end; align-items: center; color: #75839b; }
.mobile-brand { display: none; }
.topbar-account { font-weight: 550; }
.content { width: min(1160px, 100%); margin: 0 auto; padding: 34px 34px 70px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 0 0 25px; }
.page-heading p { margin: 6px 0 0; }
.eyebrow { display: block; margin-bottom: 8px; color: #3767ba; font-size: .75rem; font-weight: 750; letter-spacing: .1em; }
.button { border: 1px solid transparent; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 15px; font-weight: 650; white-space: nowrap; transition: background .15s, border-color .15s; }
.button-primary { color: #fff; background: #315fd0; box-shadow: 0 4px 12px #315fd026; }
.button-primary:hover { background: #244daf; }
.button-secondary { color: #3156a4; background: #fff; border-color: #d8e1ef; }
.button-secondary:hover { background: #f7faff; }
.button-light { color: #214a9d; background: #fff; }
.button-light:hover { background: #eaf2ff; }
.full-width { width: 100%; }
.notice { display: flex; align-items: center; gap: 12px; padding: 11px 15px; margin-bottom: 18px; border-radius: 9px; border: 1px solid #d4e2f8; background: #eaf3ff; color: #31527e; }
.notice strong { white-space: nowrap; }
.notice-pending { background: #fff8e9; border-color: #f3dfab; color: #8a621e; }
.notice-error { background: #fff1ef; border-color: #f2c9c4; color: #a54135; }
.notice-success { background: #effaf3; border-color: #c8e9d2; color: #2b7650; }
.balance-band { background: linear-gradient(115deg,#2456bd,#4c77da); color: #fff; border-radius: 16px; padding: 27px 30px; display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; box-shadow: 0 14px 32px #2854a32b; }
.balance-band p, .balance-label { color: #dce9ff; }
.balance-band p { margin: 4px 0 0; font-size: .88rem; }
.balance-value { font-size: 2.55rem; line-height: 1.2; font-weight: 800; letter-spacing: -.04em; margin: 5px 0; }
.balance-value span { font-size: 1.3rem; margin-right: 4px; }
.data-section, .form-section, .product-row, .detail-item, .admin-summary > div { background: #fff; border: 1px solid #e3e9f2; border-radius: 13px; box-shadow: 0 3px 18px #1b325608; }
.data-section, .form-section { margin-bottom: 20px; padding: 23px; }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.section-header p { margin: 5px 0 0; }
.section-header .eyebrow { margin-bottom: 5px; }
.text-link, .row-link, .back-link { color: #315fc6; font-weight: 650; }
.text-link:hover, .row-link:hover, .back-link:hover { text-decoration: underline; }
.back-link { display: inline-block; margin-bottom: 10px; font-size: .87rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th, td { padding: 11px 12px; border-bottom: 1px solid #edf1f6; }
th { color: #6a7890; font-size: .79rem; font-weight: 650; background: #f8fafd; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
.align-right { text-align: right; }
.amount { font-weight: 700; }
.empty-state { min-height: 110px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; color: #7a879d; }
.empty-state strong { color: #42526c; }
.status { display: inline-block; border-radius: 999px; padding: 4px 10px; background: #edf2f8; color: #536783; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.status-assigned, .status-creating, .status-review { background: #fff2db; color: #9a6a1d; }
.status-received, .status-active { background: #e8f8ee; color: #24744d; }
.status-failed, .status-cancelled, .status-disabled { background: #fbeceb; color: #9b4b48; }
.heading-balance { background: #fff; border: 1px solid #e3e9f2; border-radius: 10px; padding: 9px 13px; color: #65718a; }
.heading-balance strong { color: #224fba; margin-left: 7px; }
.product-list { display: grid; gap: 12px; }
.product-row { padding: 20px 22px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.product-title { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.product-row p { margin-bottom: 7px; }
.country-tag { border: 1px solid #d8e5f6; border-radius: 6px; padding: 2px 7px; background: #f3f7fd; color: #4b6b9d; font-size: .75rem; font-weight: 700; }
.availability { color: #257854; font-size: .8rem; font-weight: 650; }
.availability.unavailable { color: #9d6870; }
.product-action { display: flex; align-items: center; gap: 17px; }
.product-action strong { font-size: 1.3rem; color: #1d4dab; }
.product-action form { margin: 0; }
.detail-grid, .admin-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.detail-item { padding: 18px 20px; min-width: 0; }
.detail-item span { display: block; margin-bottom: 8px; color: #748099; font-size: .83rem; }
.detail-item strong { overflow-wrap: anywhere; font-size: 1.05rem; }
.number-display { color: #235abb; font-size: 1.23rem !important; }
.sms-content { padding: 18px; border: 1px solid #dbe7f9; border-radius: 9px; background: #f7faff; font-size: 1.15rem; overflow-wrap: anywhere; }
.order-actions { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.redeem-form label, .field label, .form-stack label { display: block; margin-bottom: 7px; font-weight: 650; color: #3d4b63; }
input { min-height: 40px; padding: 9px 11px; border: 1px solid #cdd8e8; border-radius: 8px; background: #fff; color: #17233a; outline: none; }
input:focus { border-color: #5686dc; box-shadow: 0 0 0 3px #5686dc24; }
input:disabled { background: #f0f3f7; }
.input-action { display: flex; gap: 10px; }
.input-action input { flex: 1; min-width: 0; }
.field-error, .form-errors { display: block; margin-top: 6px; color: #b0443b; font-size: .86rem; }
.form-errors { margin-bottom: 14px; }
.form-errors ul { margin: 5px 0; }
.admin-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.admin-summary > div { padding: 20px; display: grid; gap: 5px; }
.admin-summary span { color: #748099; font-size: .82rem; }
.admin-summary strong { font-size: 1.9rem; color: #204ca6; }
.admin-summary a { color: #3569c8; font-size: .8rem; }
.code-create-form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.code-create-form .field { flex: 1 1 140px; }
.code-create-form input { width: 100%; }
.code-list { display: grid; gap: 8px; }
.code-line { display: flex; align-items: center; gap: 12px; padding: 8px 11px; border: 1px solid #e5ebf3; border-radius: 7px; overflow-x: auto; }
.code-line span { color: #7a879d; }
.code-line code { font-size: .9rem; letter-spacing: .025em; }
.code-export { display: block; width: 100%; min-height: 125px; margin-top: 8px; padding: 12px; border: 1px solid #d5dfed; border-radius: 8px; resize: vertical; color: #1c3357; background: #f8fafd; font: .9rem/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 35px 20px; }
.auth-brand { color: #1b2b47; margin-bottom: 26px; }
.auth-brand small { color: #7c8aa1; }
.auth-panel { width: min(420px, 100%); padding: 32px; border: 1px solid #e0e8f3; border-radius: 16px; background: #fff; box-shadow: 0 15px 45px #27446917; }
.section-heading { margin-bottom: 25px; }
.section-heading p { margin: 7px 0 0; }
.form-stack { display: grid; gap: 8px; }
.form-stack input { width: 100%; margin-bottom: 7px; }
.form-stack .button { margin-top: 8px; }
.auth-switch { margin: 21px 0 0; text-align: center; font-size: .88rem; }
.auth-switch a { color: #315fc6; font-weight: 650; }
@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { padding: 13px 18px; gap: 12px; }
  .sidebar > .brand, .sidebar-bottom { display: none; }
  .nav-list { display: grid; gap: 4px; white-space: nowrap; }
  .nav-group { display: flex; gap: 4px; overflow-x: auto; }
  .nav-list a { padding: 8px 11px; }
  .nav-label { display: none; }
  .topbar { height: 45px; padding: 0 20px; justify-content: space-between; }
  .mobile-brand { display: block; font-weight: 750; color: #234779; }
  .content { padding: 25px 18px 50px; }
}
@media (max-width: 580px) {
  .page-heading, .balance-band, .product-row { align-items: flex-start; flex-direction: column; }
  .balance-band { padding: 24px; }
  .data-section, .form-section { padding: 18px; }
  .detail-grid, .admin-summary { grid-template-columns: 1fr; }
  .product-action { width: 100%; justify-content: space-between; }
  .input-action { flex-direction: column; }
  .input-action .button { width: 100%; }
  .auth-panel { padding: 25px; }
}

/* Shared management workspace. */
[hidden] { display: none !important; }
.muted { color: #66758d; font-size: .85rem; }
.button-quiet { color: #51637f; background: #f3f6fa; }
.button-quiet:hover { background: #e8eef6; }
.button-danger-quiet { color: #a33e3b; background: #fff3f2; }
.button-danger-quiet:hover { background: #fbe4e2; }
.nav-list a { min-height: 44px; }
.dashboard-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 20px; }
.period-switch { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid #dce4f0; background: #eaf0f8; border-radius: 11px; }
.period-switch a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 17px; color: #51657f; border-radius: 7px; font-size: .9rem; font-weight: 650; white-space: nowrap; }
.period-switch a:hover { background: #f7faff; }
.period-switch a[aria-current="page"] { color: #244fa9; background: #fff; box-shadow: 0 2px 6px #1b3b7012; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi-card { display: flex; min-width: 0; flex-direction: column; gap: 8px; padding: 21px 20px; background: #fff; border: 1px solid #dfe7f2; border-radius: 13px; box-shadow: 0 3px 18px #1b325608; }
.kpi-label { color: #5a6d88; font-size: .86rem; font-weight: 650; }
.kpi-value { display: block; color: #183c7e; font-size: clamp(1.6rem, 2.3vw, 2.05rem); line-height: 1.3; font-weight: 780; letter-spacing: -.035em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: .58em; font-weight: 600; letter-spacing: 0; padding: 0 3px; }
.kpi-note { margin-top: auto; color: #6a7890; font-size: .75rem; line-height: 1.6; }
.kpi-text { font-size: 1.55rem; letter-spacing: 0; color: #986316; }
.kpi-accent { background: #265ac3; border-color: #265ac3; }
.kpi-accent .kpi-label, .kpi-accent .kpi-note { color: #e0ebff; }
.kpi-accent .kpi-value { color: #fff; }
.value-positive { color: #24744d; }
.value-negative { color: #ae4039; }
.activity-kpis { margin-bottom: 24px; }
.activity-kpis .kpi-card { padding-top: 17px; padding-bottom: 17px; }
.activity-kpis .kpi-value { font-size: 1.65rem; }
.dashboard-columns, .settings-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.dashboard-columns > *, .settings-columns > * { min-width: 0; }
.stat-pairs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 28px; margin: 0; }
.stat-pairs dt { color: #65758e; font-size: .84rem; margin-bottom: 5px; }
.stat-pairs dd { margin: 0; color: #213c65; font-size: 1.35rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-pairs dd small { font-size: .65em; font-weight: 500; }
.summary-callout { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; padding: 10px 13px; margin-top: 18px; background: #fff8e9; border-radius: 8px; color: #8b611e; font-size: .85rem; }
.summary-callout:hover { background: #fff0cb; }
.summary-callout strong { display: flex; align-items: center; gap: 12px; }
.balance-stats { margin-bottom: 22px; }
.balance-stats dd { font-size: 1.8rem; }
.section-note { margin: 0; color: #66758d; font-size: .85rem; line-height: 1.75; }
.trend-count { display: flex; align-items: center; gap: 12px; min-width: 150px; }
.trend-track { display: block; height: 9px; width: 150px; border-radius: 8px; background: #edf2fa; overflow: hidden; }
.trend-track > span { display: block; height: 100%; min-width: 0; background: #4a7de0; border-radius: 8px; }
.trend-count strong { min-width: 24px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.cell-subtitle { display: block; margin-top: 4px; color: #6b7990; font-size: .78rem; font-weight: 400; }
.cell-description { max-width: 260px; min-width: 160px; white-space: normal; overflow-wrap: anywhere; }
.data-definition { color: #526580; padding: 18px 20px; background: #eaf0f8; border: 1px solid #dde6f2; border-radius: 10px; }
.data-definition strong { font-size: .86rem; }
.data-definition p { margin: 5px 0 0; font-size: .8rem; color: #5e718d; line-height: 1.8; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid #e6ecf5; }
.filter-bar .field { flex: 0 1 170px; min-width: 0; }
.filter-bar .filter-search { flex: 1 1 240px; }
.filter-bar label { font-size: .83rem; }
.filter-bar input, .filter-bar select { width: 100%; }
.filter-actions { display: flex; gap: 8px; }
select, textarea { min-height: 44px; border: 1px solid #cdd8e8; border-radius: 8px; padding: 9px 11px; background: #fff; color: #17233a; }
select { padding-right: 30px; }
textarea { resize: vertical; }
select:focus, textarea:focus { border-color: #5686dc; outline: 3px solid #5686dc24; outline-offset: 0; }
input:not([type="checkbox"]):not([type="hidden"]) { min-height: 44px; }
.manage-table th, .manage-table td { padding-top: 14px; padding-bottom: 14px; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.table-actions form { margin: 0; }
.table-actions .button { font-size: .8rem; padding: 8px 12px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; margin-top: 10px; border-top: 1px solid #e6ecf5; }
.pagination > div { display: flex; gap: 8px; }
.pagination-summary, .list-total { color: #687991; font-size: .8rem; }
.list-total { margin: 18px 0 0; }
.settings-panel { max-width: 850px; padding: 28px; }
.settings-intro { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid #e6ecf5; }
.settings-form .field input:not([type="checkbox"]), .settings-form .field select, .settings-form .field textarea { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 23px 24px; }
.form-grid > .field { min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-help { color: #65758d; font-size: .8rem; margin: 6px 0 0; line-height: 1.7; }
.field label.checkbox-label { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; }
.checkbox-label input { width: 19px; height: 19px; min-height: 19px; margin: 0; accent-color: #315fd0; }
.required-mark { color: #b5473e; }
.field-invalid input, .field-invalid select, .field-invalid textarea { border-color: #c5594e; }
.field-error { overflow-wrap: anywhere; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; padding-top: 21px; border-top: 1px solid #e6ecf5; }
.settings-explainer { background: #f9fbff; }
.formula-list { display: grid; gap: 17px; margin: 22px 0; }
.formula-list dt { font-weight: 650; font-size: .85rem; color: #3a5071; }
.formula-list dd { margin: 5px 0 0; color: #65758e; font-size: .83rem; }
.settings-explainer p { font-size: .84rem; margin-bottom: 8px; }
.message-details { min-width: 90px; max-width: 240px; }
.message-details summary { display: inline-flex; min-height: 44px; align-items: center; color: #315fc6; font-size: .83rem; font-weight: 650; cursor: pointer; }
.message-details summary:hover { text-decoration: underline; }
.message-details p { margin: 3px 0 0; padding: 10px; border-radius: 7px; background: #f1f6fe; color: #374f72; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .82rem; }
@media (min-width: 821px) {
  .sidebar { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; }
}
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-columns, .settings-columns { gap: 16px; }
  .dashboard-columns .section-header { flex-wrap: wrap; }
}
@media (max-width: 580px) {
  .dashboard-toolbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .period-switch { display: flex; width: 100%; gap: 2px; }
  .period-switch a { flex: 1; padding: 8px 7px; }
  .kpi-grid { gap: 10px; }
  .kpi-card { padding: 16px 13px; gap: 7px; }
  .kpi-label { font-size: .78rem; }
  .kpi-value, .activity-kpis .kpi-value { font-size: 1.6rem; }
  .kpi-note { font-size: .72rem; }
  .kpi-text { font-size: 1.3rem; }
  .dashboard-columns, .settings-columns, .form-grid { grid-template-columns: 1fr; }
  .dashboard-columns { gap: 0; }
  .settings-columns { gap: 0; }
  .filter-bar .field, .filter-bar .filter-search { flex: 1 1 100%; }
  .filter-actions { width: 100%; }
  .filter-actions .button { flex: 1; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .section-header { flex-wrap: wrap; }
  .form-actions .button { flex: 1; }
  .form-grid { gap: 20px; }
  .data-definition { padding: 16px; }
  .content { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
