:root {
  color-scheme: light;
  --midnight: #07131f;
  --deep-field: #0b1b2c;
  --sidebar-text: #eaf1f6;
  --sidebar-muted: #91a7b8;
  --paper: #f3f7f9;
  --surface: #ffffff;
  --surface-muted: #edf3f6;
  --ink: #102235;
  --ink-muted: #566d7f;
  --line: #d8e2e8;
  --line-strong: #bdccd5;
  --signal: #076f79;
  --signal-bright: #0ba7b7;
  --blue: #1168a8;
  --violet: #6d59ad;
  --success: #12745f;
  --warning: #9c5b14;
  --danger: #a63843;
  --danger-surface: #fff3f4;
  --font: "Avenir Next", Avenir, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --sidebar-width: 252px;
  --radius: 14px;
  --control-radius: 10px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--font); font-size: 15px; line-height: 1.5; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 10px; left: 10px; padding: 9px 13px; color: var(--midnight); background: var(--sidebar-text); border-radius: 8px; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid rgba(11, 167, 183, .32); outline-offset: 2px; }

.account-shell { min-height: 100vh; }
.account-sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; display: flex; width: var(--sidebar-width); flex-direction: column; padding: 22px 16px 18px; color: var(--sidebar-text); background: var(--midnight); border-right: 1px solid rgba(196, 226, 239, .1); }
.sidebar-brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; color: var(--midnight); background: #70f4ff; border-radius: 9px; font-weight: 850; }
.sidebar-brand > span:last-child { display: grid; }
.sidebar-brand strong { font-size: 18px; line-height: 1.1; }
.sidebar-brand small { margin-top: 3px; color: var(--sidebar-muted); font-size: 11px; }
.sidebar-user { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 10px; margin: 28px 2px 17px; padding: 14px 0; border-block: 1px solid rgba(196, 226, 239, .11); }
.user-avatar { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(112, 244, 255, .24); border-radius: 50%; color: #aef8ff; background: #0d2535; font-weight: 750; }
.sidebar-user > span:last-child { display: grid; min-width: 0; }
.sidebar-user strong, .sidebar-user small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: 13px; }
.sidebar-user small { margin-top: 2px; color: var(--sidebar-muted); font-size: 11px; }

.sidebar-nav { display: grid; gap: 4px; }
.sidebar-nav button { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 11px; min-height: 44px; padding: 0 11px; color: var(--sidebar-muted); background: transparent; border: 0; border-radius: 9px; text-align: left; font-weight: 620; }
.sidebar-nav button:hover { color: var(--sidebar-text); background: rgba(234, 241, 246, .06); }
.sidebar-nav button.active { color: #c3fbff; background: rgba(112, 244, 255, .1); }
.sidebar-nav svg, .icon-button svg, .search-field svg, .session-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.nav-count { min-width: 22px; padding: 1px 6px; color: var(--midnight); background: #70f4ff; border-radius: 10px; font-size: 10px; text-align: center; }
.sidebar-wallet { margin-top: auto; padding: 15px 12px; color: var(--sidebar-text); background: #0b2030; border: 1px solid rgba(112, 244, 255, .15); border-radius: 12px; }
.sidebar-wallet small { display: block; color: var(--sidebar-muted); font-size: 11px; }
.sidebar-wallet strong { display: block; margin: 4px 0 11px; font-size: 25px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.sidebar-wallet button { width: 100%; min-height: 36px; color: #b9f9ff; background: transparent; border: 1px solid rgba(112, 244, 255, .28); border-radius: 8px; font-weight: 700; }
.sidebar-wallet button:hover { color: var(--midnight); background: #70f4ff; }
.sidebar-footer { display: flex; flex-wrap: wrap; gap: 5px 11px; margin: 13px 4px 0; }
.sidebar-footer a, .sidebar-footer button { padding: 2px 0; color: var(--sidebar-muted); background: none; border: 0; font-size: 11px; text-decoration: none; }
.sidebar-footer a:hover, .sidebar-footer button:hover { color: var(--sidebar-text); }

.mobile-header, .mobile-nav { display: none; }
.account-content { width: calc(100% - var(--sidebar-width)); min-height: 100vh; margin-left: var(--sidebar-width); }
.content-toolbar { position: sticky; z-index: 25; top: 0; display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 24px; padding: 0 clamp(28px, 4vw, 64px); background: rgba(243, 247, 249, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.content-toolbar > div:first-child { display: grid; }
.content-toolbar small { color: var(--ink-muted); font-size: 11px; }
.content-toolbar strong { font-size: 16px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.sync-time { color: var(--ink-muted); font-size: 12px; }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; color: var(--ink-muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--control-radius); }
.icon-button:hover { color: var(--signal); border-color: var(--line-strong); }
.icon-button.loading svg { animation: rotate .7s linear infinite; }
.balance-button { min-height: 40px; padding: 0 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--control-radius); font-variant-numeric: tabular-nums; }
.balance-button b { margin-left: 8px; color: var(--signal); }

.account-view { max-width: 1376px; margin: 0 auto; padding: 42px clamp(28px, 4vw, 64px) 80px; }
.account-status { position: fixed; z-index: 90; top: 82px; right: 28px; max-width: min(420px, calc(100vw - 32px)); padding: 12px 15px; color: #eaffff; background: #0a4650; border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 34, 53, .18); }
.account-status.error { color: #fff3f4; background: #8b2e39; }
.account-status.success { color: #effff9; background: #12644f; }

.view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 30px; }
.view-heading p { margin: 0 0 5px; color: var(--signal); font-size: 13px; font-weight: 720; }
.view-heading h1 { margin: 0; font-size: 36px; line-height: 1.16; letter-spacing: -.025em; }
.view-heading > div > span { display: block; max-width: 70ch; margin-top: 8px; color: var(--ink-muted); }
.overview-heading h1 { font-size: 32px; }
.overview-heading h1 span { color: var(--ink); }
.range-control { display: inline-flex; flex: 0 0 auto; padding: 3px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 10px; }
.range-control button { min-width: 58px; min-height: 34px; padding: 0 10px; color: var(--ink-muted); background: transparent; border: 0; border-radius: 7px; font-size: 13px; }
.range-control button.active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 8px rgba(16, 34, 53, .08); font-weight: 700; }

.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-strip > div { min-width: 0; padding: 21px 22px; border-left: 1px solid var(--line); }
.metric-strip > div:first-child { border-left: 0; }
.metric-strip dt { color: var(--ink-muted); font-size: 12px; font-weight: 650; }
.metric-strip dd { margin: 6px 0 2px; font-size: 29px; font-weight: 760; font-variant-numeric: tabular-nums; letter-spacing: -.025em; white-space: nowrap; }
.metric-strip .metric-context { display: block; margin: 0; overflow: hidden; color: var(--ink-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .7fr); gap: 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.trend-panel { min-width: 0; padding: 24px; }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.panel-heading h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.panel-heading p { margin: 4px 0 0; color: var(--ink-muted); font-size: 13px; }
.panel-heading > span { flex: 0 0 auto; color: var(--ink-muted); font-size: 12px; }
.account-trend { min-height: 0; margin-top: 15px; }
.account-trend.large { min-height: 0; }
.trend-svg { display: block; width: 100%; height: auto; overflow: visible; }
.trend-svg .grid { stroke: #e3eaee; stroke-width: 1; }
.trend-svg .area { fill: url(#trend-area); }
.trend-svg .line { fill: none; stroke: var(--signal); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.trend-svg .request-line { fill: none; stroke: var(--violet); stroke-width: 1.5; stroke-dasharray: 4 5; opacity: .8; }
.trend-svg .point { fill: var(--surface); stroke: var(--signal); stroke-width: 2; }
.trend-svg .label { fill: var(--ink-muted); font: 10px var(--font); }
.trend-svg .value { fill: var(--ink); font: 11px var(--font); font-weight: 700; }
.trend-svg .hit { fill: transparent; stroke: none; }
.trend-tooltip { position: absolute; z-index: 4; min-width: 138px; padding: 8px 10px; color: var(--sidebar-text); background: var(--deep-field); border-radius: 8px; font-size: 11px; pointer-events: none; transform: translate(-50%, calc(-100% - 8px)); }
.trend-tooltip strong { display: block; margin-bottom: 3px; }
.impact-panel { position: relative; overflow: hidden; padding: 26px; color: var(--sidebar-text); background: var(--deep-field); border-radius: var(--radius); }
.impact-panel::after { position: absolute; right: -75px; bottom: -84px; width: 190px; height: 190px; border: 1px solid rgba(112, 244, 255, .24); border-radius: 50%; content: ""; box-shadow: -24px -18px 0 rgba(135, 108, 255, .08); }
.impact-panel > * { position: relative; z-index: 1; }
.impact-panel > small { color: #70f4ff; font-weight: 700; }
.impact-panel h2 { max-width: 13ch; margin: 34px 0 13px; font-size: 27px; line-height: 1.18; letter-spacing: -.02em; }
.impact-panel > p { max-width: 32ch; margin: 0; color: #a6bbca; line-height: 1.65; }
.impact-panel dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 48px 0 0; }
.impact-panel dl div { padding-top: 12px; border-top: 1px solid rgba(196, 226, 239, .16); }
.impact-panel dt { color: #8ea6b7; font-size: 11px; }
.impact-panel dd { margin: 5px 0 0; font-size: 15px; font-weight: 700; }
.recent-panel { margin-top: 24px; padding: 22px 24px 8px; }
.text-button { min-height: 34px; padding: 0 5px; color: var(--signal); background: transparent; border: 0; font-weight: 700; }

.responsive-table { width: 100%; margin-top: 16px; overflow-x: auto; }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td { padding: 13px 10px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--ink-muted); background: #fbfcfd; font-size: 11px; font-weight: 700; white-space: nowrap; }
td { font-size: 13px; }
.credit-positive { color: var(--success); font-weight: 700; }
.credit-negative { color: var(--danger); font-weight: 700; }
td strong { font-size: 13px; }
td small { display: block; max-width: 44ch; margin-top: 2px; overflow: hidden; color: var(--ink-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
code { color: var(--blue); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; overflow-wrap: anywhere; }
.status-badge { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; border-radius: 12px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-badge.completed { color: var(--success); background: #e7f5f0; }
.status-badge.failed { color: var(--danger); background: var(--danger-surface); }
.status-badge.processing { color: var(--warning); background: #fff5e7; }
.empty-state { padding: 46px 20px; text-align: center; }
.empty-state strong { display: block; font-size: 16px; }
.empty-state p { max-width: 54ch; margin: 7px auto 14px; color: var(--ink-muted); }
.empty-state a, .empty-state button { color: var(--signal); background: transparent; border: 0; font-weight: 700; }
.empty-state.compact { padding: 28px 20px; }

.analytics-panel { padding: 24px; }
.chart-legend { display: flex; gap: 18px; margin-top: 12px; color: var(--ink-muted); font-size: 11px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 18px; height: 2px; background: var(--signal); }
.chart-legend span:last-child i { height: 1px; background: var(--violet); }
.activity-section { margin-top: 34px; }
.usage-heatmap { display: grid; grid-template-columns: repeat(var(--heat-columns, 30), minmax(9px, 1fr)); gap: 5px; margin-top: 16px; }
.heat-cell { aspect-ratio: 1; min-width: 0; background: #e4ecef; border: 0; border-radius: 3px; }
.heat-cell[data-level="1"] { background: #bfe1e2; }
.heat-cell[data-level="2"] { background: #72b9bd; }
.heat-cell[data-level="3"] { background: #258e97; }
.heat-cell[data-level="4"] { background: #075d67; }
.method-note { display: grid; grid-template-columns: minmax(180px, .35fr) minmax(0, 1fr); gap: 36px; margin-top: 38px; padding: 24px 0; border-block: 1px solid var(--line); }
.method-note strong { font-size: 16px; }
.method-note p { max-width: 75ch; margin: 0; color: var(--ink-muted); }

.filter-bar { display: grid; grid-template-columns: minmax(210px, 1fr) repeat(3, minmax(112px, 150px)) repeat(2, minmax(128px, 145px)) auto; gap: 10px; margin-bottom: 16px; }
.filter-bar input, .filter-bar select, .settings-form input, .settings-form select, .payment-product select, .panel-heading select { width: 100%; min-height: 42px; padding: 0 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--control-radius); }
.module-error { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; margin: 0 0 16px; padding: 10px 12px 10px 16px; color: #8d2e2e; background: #fff6f4; border: 1px solid #efc3bb; border-radius: var(--control-radius); font-size: 13px; }
.module-error[hidden] { display: none; }
.module-error button { min-height: 32px; padding: 0 12px; flex: 0 0 auto; color: #7c2828; background: #fff; border: 1px solid #dfa79d; border-radius: 7px; font-weight: 700; }
.search-field { position: relative; }
.search-field svg { position: absolute; top: 11px; left: 12px; width: 18px; color: var(--ink-muted); }
.search-field input { padding-left: 39px; }
.secondary-button, .primary-button, .danger-button { min-height: 42px; padding: 0 16px; border-radius: var(--control-radius); font-weight: 720; }
.secondary-button { color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); }
.primary-button { color: #fff; background: var(--signal); border: 1px solid var(--signal); }
.primary-button:hover { background: #066b76; border-color: #066b76; }
.danger-button { color: var(--danger); background: var(--surface); border: 1px solid #d9aab0; }
.danger-button:hover { background: var(--danger-surface); }
button:disabled { cursor: not-allowed; opacity: .52; }
.request-table-panel { overflow: hidden; }
.request-table-panel .responsive-table { margin-top: 0; }
.request-table th:first-child, .request-table td:first-child { padding-left: 18px; }
.request-table th:last-child, .request-table td:last-child { padding-right: 18px; }
.request-table tr[data-request-row] { cursor: pointer; }
.request-table tr[data-request-row]:hover td { background: #f7fafb; }
.request-expand { display: grid; width: 32px; height: 32px; place-items: center; color: var(--ink-muted); background: transparent; border: 0; border-radius: 7px; }
.request-expand::before { content: "+"; font-size: 18px; }
.request-expand[aria-expanded="true"]::before { content: "−"; }
.request-mobile-meta { display: none; }
.request-detail td { padding: 0 18px 16px; background: #f7fafb; }
.request-detail dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 24px; margin: 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.request-detail dt { color: var(--ink-muted); font-size: 10px; }
.request-detail dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 0 18px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 12px; }
.pagination > div { display: flex; align-items: center; gap: 10px; }
.pagination button { min-height: 34px; padding: 0 11px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }

.wallet-hero { display: flex; min-height: 230px; align-items: flex-end; justify-content: space-between; gap: 30px; padding: 34px 38px; color: var(--sidebar-text); background: var(--deep-field); border-radius: var(--radius); }
.wallet-hero p { margin: 0; color: #9eb6c5; }
.wallet-hero h1 { margin: 7px 0 4px; font-size: 58px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.wallet-hero span { color: #9eb6c5; }
.wallet-hero .primary-button { color: var(--midnight); background: #70f4ff; border-color: #70f4ff; }
.wallet-bucket-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.wallet-bucket-grid[hidden] { display: none; }
.wallet-bucket-card { min-width: 0; padding: 22px 24px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 28px rgba(13, 34, 48, .05); }
.wallet-bucket-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.wallet-bucket-card > header > div { display: flex; min-width: 0; align-items: center; gap: 11px; }
.wallet-bucket-card header p { margin: 0; color: var(--ink); font-size: 15px; font-weight: 760; }
.wallet-bucket-card header small { display: block; margin-top: 2px; color: var(--ink-muted); font-size: 11px; line-height: 1.4; }
.bucket-mark { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; color: #076a74; background: #e3f6f5; border-radius: 10px; font-size: 14px; font-weight: 800; }
.permanent-bucket .bucket-mark { color: #5548ad; background: #efedff; font-size: 19px; }
.bucket-status { display: inline-flex; min-height: 25px; flex: 0 0 auto; align-items: center; padding: 0 9px; color: #076a74; background: #e3f6f5; border-radius: 999px; font-size: 10px; font-weight: 760; }
.bucket-status.permanent { color: #5548ad; background: #efedff; }
.bucket-status.disabled { color: var(--ink-muted); background: #edf1f3; }
.bucket-balance { display: flex; align-items: baseline; gap: 9px; margin-top: 23px; }
.bucket-balance strong { color: var(--ink); font-size: 38px; line-height: 1; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.bucket-balance > span { color: var(--ink-muted); font-size: 11px; }
.bucket-balance b { color: var(--ink); }
.bucket-progress { height: 7px; margin: 18px 0 15px; overflow: hidden; background: #e8eff1; border-radius: 999px; }
.bucket-progress span { display: block; width: 0; height: 100%; background: #16a6a3; border-radius: inherit; transition: width .35s ease; }
.daily-disabled .bucket-progress span { background: #9aa9b1; }
.permanent-divider { height: 7px; margin: 18px 0 15px; background: #eceaf8; border-radius: 999px; }
.bucket-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.bucket-facts div { min-width: 0; padding-top: 10px; border-top: 1px solid var(--line); }
.bucket-facts dt { color: var(--ink-muted); font-size: 10px; }
.bucket-facts dd { margin: 3px 0 0; color: var(--ink); font-size: 14px; font-weight: 720; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bucket-reset { display: flex; min-height: 19px; align-items: center; gap: 6px; margin: 15px 0 0; color: var(--ink-muted); font-size: 10px; line-height: 1.45; }
.bucket-reset time { color: var(--ink); font-weight: 650; }
.bucket-reset small { margin-left: auto; color: var(--ink-muted); font-size: 9px; }
.bucket-reset.permanent-note { display: block; }
.wallet-ledger-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
#wallet-bucket-section[hidden] + .wallet-ledger-summary { border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.wallet-ledger-summary div { padding: 18px 24px; border-left: 1px solid var(--line); }
.wallet-ledger-summary div:first-child { border-left: 0; }
.wallet-ledger-summary dt { color: var(--ink-muted); font-size: 11px; }
.wallet-ledger-summary dd { margin: 4px 0 0; font-size: 19px; font-weight: 730; font-variant-numeric: tabular-nums; }
.purchase-section { margin-bottom: 28px; padding: 24px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.payment-products { display: grid; grid-template-columns: repeat(2, 1fr); margin-top: 18px; border-block: 1px solid var(--line); }
.payment-products > .empty-state { grid-column: 1 / -1; }
.payment-product { padding: 22px; border-left: 1px solid var(--line); }
.payment-product:first-child { border-left: 0; }
.payment-product h3 { margin: 0; font-size: 20px; }
.payment-product .product-value { margin: 8px 0 18px; color: var(--ink-muted); }
.payment-product .product-value strong { color: var(--ink); font-size: 23px; }
.payment-product .purchase-controls { display: flex; gap: 8px; }
.ledger-panel { overflow: hidden; }
.ledger-panel > .panel-heading { padding: 22px 24px 0; }
.ledger-panel > .panel-heading select { width: auto; min-width: 120px; }
.credit-source { color: var(--ink-muted); font-weight: 500; }
.orders-section { margin-top: 38px; }
.order-list { margin-top: 14px; background: var(--surface); border-block: 1px solid var(--line); }
.order-pagination { background: var(--surface); border-bottom: 1px solid var(--line); }
.order-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 24px; min-height: 70px; padding: 12px 16px; border-top: 1px solid var(--line); }
.order-item:first-child { border-top: 0; }
.order-item small { display: block; margin-top: 3px; color: var(--ink-muted); }
.order-item > span { color: var(--ink-muted); }

.settings-layout { display: grid; grid-template-columns: 176px minmax(0, 760px); align-items: start; gap: 48px; }
.settings-index { position: sticky; top: 96px; display: grid; border-top: 1px solid var(--line); }
.settings-index a { padding: 12px 2px; color: var(--ink-muted); border-bottom: 1px solid var(--line); text-decoration: none; }
.settings-index a:hover { color: var(--signal); }
.settings-content { min-width: 0; }
.settings-section { scroll-margin-top: 90px; padding: 0 0 38px; margin-bottom: 38px; border-bottom: 1px solid var(--line); }
.settings-section > header { margin-bottom: 20px; }
.settings-section h2 { margin: 0; font-size: 21px; }
.settings-section header p { max-width: 68ch; margin: 5px 0 0; color: var(--ink-muted); }
.settings-form { display: grid; gap: 9px; max-width: 560px; }
.settings-form > label:not(.checkbox-row) { margin-top: 6px; font-size: 12px; font-weight: 700; }
.settings-form > small { color: var(--ink-muted); }
.profile-preferences { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 9px 12px; margin-top: 8px; }
.profile-preferences label { font-size: 12px; font-weight: 700; }
.settings-subheading { margin: 24px 0 10px; color: var(--ink); font-size: 14px; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 9px; margin-top: 7px; color: var(--ink-muted); }
.checkbox-row input { width: 17px; height: 17px; min-height: 0; margin: 2px 0 0; accent-color: var(--signal); }
.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.form-actions a { color: var(--signal); font-size: 13px; text-decoration: none; }
.form-status { min-height: 21px; margin: 3px 0 0; color: var(--success); }
.form-status.error { color: var(--danger); }
.session-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; max-width: 620px; margin-bottom: 16px; padding: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.session-icon { display: grid; width: 40px; height: 40px; place-items: center; color: var(--signal); background: #e8f4f5; border-radius: 10px; }
.session-row > span:nth-child(2) { display: grid; }
.session-row small { margin-top: 2px; color: var(--ink-muted); }
.session-row em { color: var(--success); font-size: 11px; font-style: normal; font-weight: 700; }
.user-session-list { display: grid; gap: 10px; max-width: 680px; margin-bottom: 16px; }
.user-session-list .session-row { max-width: none; margin: 0; }
.session-row > span:nth-child(2) { min-width: 0; }
.session-row strong, .session-row small { overflow-wrap: anywhere; }
.session-row .session-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.session-row .session-meta span { color: var(--ink-muted); font-size: 11px; }
.session-row .session-controls { display: flex; align-items: center; gap: 8px; }
.session-row .session-controls button { min-height: 36px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); cursor: pointer; }
.session-row .session-controls button:hover { border-color: var(--signal); color: var(--signal); }
.session-row .session-controls button:disabled { cursor: wait; opacity: .55; }
.session-loading { padding: 18px; color: var(--ink-muted); border: 1px dashed var(--line-strong); border-radius: 12px; }
.session-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.account-facts { margin: 0; border-top: 1px solid var(--line); }
.account-facts div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.account-facts dt { color: var(--ink-muted); }
.account-facts dd { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; }
.account-facts button { padding: 3px 6px; color: var(--signal); background: transparent; border: 0; font-size: 11px; }

@keyframes rotate { to { transform: rotate(360deg); } }

@media (max-width: 1080px) {
  :root { --sidebar-width: 220px; }
  .sidebar-user { grid-template-columns: 34px minmax(0, 1fr); }
  .user-avatar { width: 34px; height: 34px; }
  .overview-grid { grid-template-columns: 1fr; }
  .impact-panel { min-height: 270px; }
  .impact-panel h2 { margin-top: 22px; }
  .impact-panel dl { max-width: 420px; margin-top: 32px; }
  .filter-bar { grid-template-columns: minmax(220px, 1fr) 140px 140px; }
  .filter-bar .secondary-button { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 820px) {
  .account-sidebar { display: none; }
  .mobile-header { position: sticky; z-index: 35; top: 0; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; min-height: 60px; padding: 0 16px; color: var(--sidebar-text); background: var(--midnight); }
  .mobile-header .sidebar-brand { gap: 8px; }
  .mobile-header .brand-mark { width: 30px; height: 30px; }
  .mobile-header > span { color: #aac0cf; font-size: 12px; }
  .mobile-header .icon-button { width: 36px; height: 36px; color: #b9d2df; background: transparent; border-color: rgba(196, 226, 239, .17); }
  .account-content { width: 100%; margin-left: 0; }
  .content-toolbar { display: none; }
  .account-view { padding: 28px 20px 92px; }
  .view-heading { align-items: flex-start; flex-direction: column; gap: 18px; }
  .view-heading h1, .overview-heading h1 { font-size: 30px; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-strip > div:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; }
  .metric-strip > div:nth-child(4) { border-top: 1px solid var(--line); }
  .settings-layout { grid-template-columns: 1fr; gap: 28px; }
  .settings-index { position: static; display: flex; gap: 16px; overflow-x: auto; border-top: 0; border-bottom: 1px solid var(--line); }
  .settings-index a { flex: 0 0 auto; border-bottom: 0; }
  .mobile-nav { position: fixed; z-index: 45; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); min-height: 62px; padding-bottom: env(safe-area-inset-bottom); background: rgba(7, 19, 31, .96); border-top: 1px solid rgba(196, 226, 239, .14); backdrop-filter: blur(14px); }
  .mobile-nav button { color: #8fa6b6; background: transparent; border: 0; font-size: 11px; }
  .mobile-nav button.active { color: #70f4ff; }
  .account-status { top: 72px; right: 16px; left: 16px; max-width: none; }
}

@media (max-width: 620px) {
  .account-view { padding-inline: 15px; }
  .range-control { width: 100%; }
  .range-control button { flex: 1; }
  .metric-strip { grid-template-columns: 1fr; }
  .metric-strip > div { padding: 17px 18px; border-top: 1px solid var(--line); border-left: 0; }
  .metric-strip > div:first-child { border-top: 0; }
  .metric-strip dd { font-size: 26px; }
  .metric-strip .metric-context { white-space: normal; }
  .trend-panel, .analytics-panel, .recent-panel { padding: 18px 14px 6px; }
  .account-trend { overflow: hidden; }
  .impact-panel { padding: 22px; }
  .panel-heading { align-items: flex-start; }
  .usage-heatmap { grid-template-columns: repeat(var(--heat-columns-mobile, 15), minmax(8px, 1fr)); }
  .method-note { grid-template-columns: 1fr; gap: 8px; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .filter-bar .secondary-button { width: 100%; grid-column: 1 / -1; }
  .request-detail dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-table-panel .responsive-table { overflow: visible; }
  .request-table { min-width: 0; }
  .request-table thead { display: none; }
  .request-table tbody, .request-table tr { display: block; }
  .request-table tr[data-request-row] { position: relative; padding: 15px 54px 15px 16px; border-bottom: 1px solid var(--line); }
  .request-table tr[data-request-row] td { display: none; padding: 0; border: 0; }
  .request-table tr[data-request-row] td:first-child,
  .request-table tr[data-request-row] td:nth-child(2),
  .request-table tr[data-request-row] td:last-child { display: block; }
  .request-table tr[data-request-row] td:nth-child(2) { margin-top: 8px; }
  .request-table tr[data-request-row] td:nth-child(8) { position: absolute; top: 15px; right: 12px; }
  .request-table tr[data-request-row] .request-mobile-meta { display: block; margin-top: 5px; color: var(--ink-muted); font-size: 11px; }
  .request-table tr[data-request-row] td:first-child small { max-width: 100%; }
  .request-detail { border-bottom: 1px solid var(--line); }
  .request-detail td { display: block; padding: 0 12px 14px; border: 0; }
  .request-detail dl { padding: 14px; }
  .recent-request-table { min-width: 0; table-layout: fixed; }
  .recent-request-table th:nth-child(n+3):nth-child(-n+5),
  .recent-request-table td:nth-child(n+3):nth-child(-n+5) { display: none; }
  .recent-request-table th:first-child { width: 52%; }
  .recent-request-table th:nth-child(2) { width: 24%; }
  .recent-request-table th:last-child { width: 24%; }
  .recent-request-table td, .recent-request-table th { padding-inline: 6px; }
  .recent-request-table td:first-child, .recent-request-table th:first-child { padding-left: 0; }
  .recent-request-table td:last-child, .recent-request-table th:last-child { padding-right: 0; }
  .pagination { align-items: flex-start; flex-direction: column; padding-block: 12px; }
  .wallet-hero { min-height: 260px; align-items: stretch; flex-direction: column; padding: 26px 22px; }
  .wallet-hero h1 { font-size: 48px; }
  .wallet-hero .primary-button { margin-top: auto; }
  .wallet-bucket-grid { grid-template-columns: 1fr; }
  .wallet-ledger-summary { grid-template-columns: 1fr; }
  .wallet-ledger-summary div { border-top: 1px solid var(--line); border-left: 0; }
  .wallet-ledger-summary div:first-child { border-top: 0; }
  .payment-products { grid-template-columns: 1fr; }
  .payment-product { border-top: 1px solid var(--line); border-left: 0; }
  .payment-product:first-child { border-top: 0; }
  .order-item { grid-template-columns: 1fr; gap: 4px; padding-block: 15px; }
  .field-row { grid-template-columns: 1fr; }
  .field-row button { width: 100%; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .primary-button { width: 100%; }
  .account-facts div { grid-template-columns: 1fr; gap: 4px; }
  .account-facts dd { justify-content: flex-start; text-align: left; }
  .sync-time { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
