/* Shared design system. UI only: selectors and visibility contracts are preserved. */
:root {
  --bg: #f4f6fa;
  --surface: #fff;
  --surface-soft: #f8fafc;
  --text: #17243b;
  --muted: #5f6f86;
  --border: #dfe5ee;
  --border-strong: #cbd5e1;
  --primary: #2559e7;
  --primary-hover: #1c49cb;
  --primary-soft: #edf2ff;
  --success: #087f5b;
  --success-soft: #eaf7f0;
  --danger: #b4233e;
  --danger-soft: #fff1f2;
  --warning: #8a5a10;
  --warning-soft: #fff8e8;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(21, 39, 69, .035);
  color: var(--text);
  background: var(--bg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Segoe UI', sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a { touch-action: manipulation; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: #34435b;
  text-decoration: none;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
button:hover:not(:disabled), .button:hover { background: var(--surface-soft); border-color: #aab9ce; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
button:disabled { opacity: .46; cursor: not-allowed; }
/* A temporary request lock keeps the current view visually stable. */
button:disabled[data-request-busy] { opacity: 1; cursor: progress; }
button, a, input, select, textarea { outline-offset: 3px; }
:focus-visible { outline: 3px solid #8aa8ff; }
a { color: var(--primary); }
input, select, textarea {
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
input, textarea { width: 100%; }
input::placeholder, textarea::placeholder { color: #758399; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
label { display: block; margin: 16px 0 7px; font-size: 13px; font-weight: 600; color: #3e4c62; }
h1 { margin: 0 0 12px; font-size: 24px; line-height: 1.35; font-weight: 700; letter-spacing: -.55px; }
h2 { margin: 0 0 18px; font-size: 18px; line-height: 1.4; font-weight: 650; letter-spacing: -.25px; }
h3 { font-size: 16px; line-height: 1.4; font-weight: 650; }
p { margin: 12px 0; line-height: 1.65; }
[hidden] { display: none !important; }
.muted, .notice { color: var(--muted); }
.muted { font-size: 13px; }
.notice { font-size: 12px; line-height: 1.7; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 650; letter-spacing: 1.5px; }
.pill { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 6px; color: #35517f; background: var(--primary-soft); font-size: 12px; font-weight: 500; line-height: 18px; }
.content .loss, .loss { color: var(--danger); }
.content .gain, .gain { color: var(--success); }

/* Compact branded header and account menu. */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 72px;
  padding: 16px 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand-nav, .brand, .account-head { display: flex; align-items: center; }
.brand-nav { gap: 16px; flex-wrap: wrap; }
.brand { gap: 9px; line-height: 1; color: var(--text); font-size: 25px; font-weight: 700; }
.brand-logo { display: block; width: 110px; height: 36px; object-fit: contain; }
.brand small { margin: 0; color: #64748b; font-size: 10px; font-weight: 600; letter-spacing: 1.5px; }
.account-head { gap: 12px; flex-wrap: wrap; }
header .account-dashboard { height: 32px; min-height: 32px; padding: 5px 11px; border: 1px solid #d6e1ff; border-radius: 18px; color: #234ea9; background: var(--primary-soft); font-size: 14px; line-height: 20px; }
header .account-dashboard:hover:not(:disabled) { color: var(--primary); background: #e2ebff; border-color: #b5caff; }
.language { position: relative; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; }
.globe { color: #43516a; font-size: 22px; font-style: normal; }
.language select { position: absolute; inset: 0; width: 100%; min-height: 0; padding: 0; opacity: 0; cursor: pointer; }
.language:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.account-menu { position: relative; display: inline-flex; }
.account-menu-options { position: absolute; z-index: 40; right: 0; top: calc(100% + 8px); min-width: 164px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 10px 28px rgba(21, 39, 69, .14); }
header .account-menu-item { display: flex; justify-content: flex-start; width: 100%; min-height: 38px; padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; font-size: 14px; text-align: left; }
header .account-menu-item:hover, header .account-menu-item:focus-visible { color: var(--primary); background: var(--primary-soft); }

/* Workspace summary, compact partner tree, and content navigation. */
.workspace { max-width: 1960px; margin: 0 auto; background: var(--bg); }
.network-overview.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0; padding: 16px 26px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.summary-item { display: flex; align-items: baseline; gap: 10px; padding: 0 20px; border-right: 1px solid var(--border); }
.summary-item:first-child { padding-left: 0; }
.summary-item:nth-child(4) { border-right: 0; }
.summary-label { color: var(--muted); font-size: 12px; }
.summary-value, .network-overview strong { color: var(--text); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-permission { grid-column: 1 / -1; margin-top: 10px; color: var(--muted); font-size: 12px; }
.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 160px); }
aside { min-width: 0; padding: 24px 14px; border-right: 1px solid var(--border); background: var(--surface); }
aside .section-label { margin: 10px 0; padding: 0 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
aside button { width: 100%; justify-content: flex-start; text-align: left; overflow-wrap: anywhere; }
.tree { margin: 0; padding: 0; border: 0; }
.tree h2 { margin: 0 0 6px; padding: 0 10px; font-size: 16px; }
.tree > .notice { margin-top: 0; padding: 0 10px; font-size: 12px; }
.tree-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.tree-tools button { width: auto; min-height: 30px; margin: 0; padding: 4px 8px; font-size: 12px; }
.network-tree, .network-tree ul { margin: 0; padding: 0; list-style: none; }
.network-tree ul { margin-left: 11px; padding-left: 7px; border-left: 1px solid #dce3ee; }
.tree-row { display: flex; align-items: flex-start; margin: 3px 0; }
.tree-toggle { width: 23px; min-height: 32px; flex: 0 0 23px; justify-content: center; padding: 8px 2px; border: 0; background: transparent; color: #66778e; font-size: 13px; }
.tree-leaf { width: 23px; flex: 0 0 23px; padding-top: 10px; text-align: center; color: #8a99ae; }
.tree-node, .network-tree[data-density=compact] .tree-node { display: block; flex: 1; min-width: 0; width: calc(100% - 23px); margin: 0; padding: 8px 9px; border: 1px solid transparent; border-left: 3px solid transparent; border-radius: 8px; background: transparent; white-space: normal; }
.tree-node:hover:not(:disabled) { border-color: transparent; background: #f4f7fc; }
.tree-node.selected, .network-tree[data-density=compact] .tree-node.selected { border-left-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.tree-title { display: flex; align-items: start; justify-content: space-between; gap: 7px; font-size: 14px; line-height: 1.4; }
.tree-title strong { min-width: 0; font-weight: 650; overflow-wrap: anywhere; }
.tree-title > span { flex: 0 0 auto; padding: 1px 5px; border-radius: 5px; background: #eff3f9; color: #455c7d; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tree-node.selected .tree-title > span { background: #dce7ff; color: #234ea9; }
.tree-role { display: block; margin: 3px 0; color: var(--muted); font-size: 12px; }
.tree-node small, .network-tree[data-density=compact] small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.network-tree summary { margin: 0 0 8px 8px; color: var(--muted); font-size: 12px; cursor: pointer; }
.tree-empty { margin-top: 20px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: 8px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.tree-empty button { min-height: 32px; padding: 5px 0; border: 0; color: var(--primary); background: transparent; text-decoration: underline; font-size: 12px; }
.density { display: flex; align-items: center; gap: 8px; width: 100%; margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.density select { min-height: 30px; padding: 4px 8px; font-size: 12px; }
.content { min-width: 0; width: 100%; max-width: 1680px; margin: 0 auto; padding: 24px 28px 32px; }
.partner-heading { margin: 0 0 18px; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; color: #8290a3; font-size: 12px; }
.breadcrumbs button { min-height: 24px; padding: 1px 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; white-space: normal; text-align: left; }
.breadcrumbs button:hover:not(:disabled) { color: var(--primary); background: transparent; }
.breadcrumbs [aria-current=page] { color: #344b70; font-weight: 650; }
.heading-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.heading-line h1 { margin: 0; font-size: 24px; }
.own-usdc-balance { margin-inline-start: auto; padding: 9px 14px; min-width: 160px; max-width: 100%; display: flex; flex-direction: column; gap: 2px; align-items: flex-end; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.own-usdc-label { color: var(--muted); font-size: 12px; line-height: 1.4; }
.own-usdc-value { color: var(--text); font-size: 21px; line-height: 1.35; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 640px) { .own-usdc-balance { flex-basis: 100%; min-width: 0; margin-inline-start: 0; flex-direction: row; align-items: center; justify-content: space-between; } .own-usdc-value { font-size: 19px; } }
.partner-heading .eyebrow { margin: 12px 0 8px; font-size: 12px; }
.selected-partner { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; margin-bottom: 20px; padding: 15px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 20px; padding: 5px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.tabs button { min-height: 40px; padding: 9px 14px; border: 0; border-radius: 7px; color: #53647d; background: transparent; font-size: 14px; font-weight: 550; white-space: normal; text-align: center; }
.tabs button.selected { color: var(--primary); background: var(--primary-soft); font-weight: 650; }
.tabs button:hover:not(:disabled) { color: var(--primary); background: #f3f6fd; border: 0; }
#partner-panel { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* Cards, query tools, scopes, and key figures. */
.panel, .page-section, .query-panel, .login-card { min-width: 0; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.page-section > :first-child, .query-panel > :first-child { margin-top: 0; }
.page-section > :last-child, .query-panel > :last-child { margin-bottom: 0; }
.content .panel.report-page { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.report-page { display: flex; flex-direction: column; gap: 20px; }
.report-notes { padding: 0 4px; }
.query-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.query-footer .scopes, .query-footer .notice { margin: 0; }
.report-summary .metric-grid { margin: 0 0 16px; }
.report-summary .metric { box-shadow: none; background: var(--surface-soft); }
.page-section > h3 { margin-top: 0; }
.query-panel { margin-bottom: 0; }
.quick-periods { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.quick-periods button { min-height: 32px; padding: 5px 11px; font-size: 12px; }
.query-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.query-row > .filters { flex: 0 1 auto; }
.query-row > .quick-periods { flex: 0 1 auto; align-self: flex-end; margin: 0; }
.query-row > .quick-periods button { min-height: 40px; padding: 9px 12px; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.filters label { display: grid; gap: 6px; margin: 0; font-size: 12px; }
.filters input { width: 165px; min-height: 40px; font-variant-numeric: tabular-nums; }
.query-panel > .notice { margin: 10px 0 0; }
.scopes, .tabs.scopes { display: flex; flex-wrap: wrap; gap: 5px; margin: 16px 0; padding: 4px; width: fit-content; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #f5f7fb; box-shadow: none; }
.scopes button, .tabs.scopes button { min-height: 34px; padding: 6px 11px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #566781; font-size: 13px; font-weight: 500; white-space: normal; }
.scopes button.selected, .tabs.scopes button.selected { border-color: #d9e2f7; background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(25, 48, 88, .06); font-weight: 600; }
.scopes #trade-sync { margin-left: auto; }
.query-panel .scopes:last-child { margin-bottom: 0; }
.table-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }
.table-heading h2 { margin: 0; }
.table-heading > span { color: var(--muted); font-size: 12px; }
.metric-grid, .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
.metric, .stat { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.metric span, .metric small, .stat span { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; }
.metric strong, .stat strong { display: block; margin: 10px 0 4px; color: var(--text); font-size: 28px; line-height: 1.25; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.subheading { margin: 28px 0 8px; }
.page-head { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.toolbar form { display: flex; flex: 1; gap: 8px; max-width: 560px; }
.toolbar form input { flex: 1; min-width: 0; }
.report-grid { display: grid; gap: 20px; }
.report-grid h3, .profile-panel h3 { margin: 22px 0 12px; font-size: 16px; }
.report-grid .scroll { margin-top: 12px; }
.daily-details summary { margin-top: 0; color: #34445e; font-size: 14px; font-weight: 650; cursor: pointer; }

/* Tabular data keeps horizontal scrolling local to the table. */
.scroll { max-width: 100%; margin-top: 16px; overflow-x: auto; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
table, .content table { width: 100%; min-width: 760px; border-collapse: collapse; background: var(--surface); font-size: 14px; font-variant-numeric: tabular-nums; }
th, td, .content table th, .content table td { padding: 14px 13px; border-bottom: 1px solid #e8edf4; text-align: left; vertical-align: middle; line-height: 1.5; }
th { color: #52627a; background: var(--surface-soft); font-size: 12px; font-weight: 650; white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody tr:hover td { background: #fafbff; }
.content td small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.content td .code { display: block; max-width: 235px; overflow-wrap: anywhere; }
td.wallet { max-width: 220px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.content .link { min-height: 24px; justify-content: flex-start; padding: 0; border: 0; color: var(--primary); background: transparent; font-size: 14px; font-weight: 600; white-space: normal; text-align: left; text-decoration: none; }
.content .link:hover:not(:disabled) { color: var(--primary-hover); text-decoration: underline; background: transparent; }
td button { min-height: 30px; margin: 2px; padding: 5px 9px; font-size: 12px; line-height: 18px; }
tfoot { color: #28456d; background: #f0f4fd; font-weight: 650; }
tfoot th, tfoot td { border-top: 1px solid #dce5f5; border-bottom: 0; background: #f0f4fd; font-size: 14px; }
.empty { padding: 42px 16px !important; color: #75849a; text-align: center !important; font-size: 14px; }
.pager { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.pager button { min-height: 34px; padding: 6px 12px; font-size: 12px; }
[data-report-table]:not([data-report-table=weekly-settlements]) th:not(:first-child), [data-report-table]:not([data-report-table=weekly-settlements]) td:not(:first-child) { text-align: right; }
.content .members-table { min-width: 1100px; }
.members-table th:nth-child(5), .members-table td:nth-child(5), .members-table th:nth-child(6), .members-table td:nth-child(6), .members-table th:nth-child(7), .members-table td:nth-child(7) { text-align: right; }
.content .rebates-table { min-width: 820px; }
.rebates-table th:nth-child(4), .rebates-table td:nth-child(4) { text-align: right; }
.content .profile-table { min-width: 560px; }
.profile-table th:not(:first-child), .profile-table td:not(:first-child) { text-align: right; }

/* Profile, account, referral, and rate settings. */
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px; }
dl { margin: 0; }
dt { margin-top: 18px; color: var(--muted); font-size: 12px; }
dd { margin: 6px 0; color: var(--text); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.profile-fields > div { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0; border-bottom: 1px solid #e8edf4; }
.profile-fields > div:first-child { padding-top: 0; }
.profile-fields dt, .profile-fields dd { margin: 0; }
.profile-fields dd { max-width: 75%; text-align: right; }
.account-details dt:first-child { margin-top: 0; }
.account-details dd { margin-bottom: 18px; }
.account-settings form { max-width: 520px; }
.settings-panel { margin: 0; padding: 20px 22px; border: 1px solid var(--border); background: var(--surface); }
.settings-panel h2 { margin-bottom: 6px; }
.settings-panel .notice { margin: 0 0 14px; }
.rate-form { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.rate-form label { margin: 0; }
.rate-form input { width: 110px; }
.profile-panel .rate-form { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.referral { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.referral-header { padding: 20px 26px; }
.referral-header .referral { margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
.referral-data { flex: 1; min-width: 0; }
.ref-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 4px 0; }
.ref-label { flex: 0 0 86px; color: var(--muted); font-size: 12px; }
.ref-value { flex: 1; min-width: 160px; font-size: 14px; overflow-wrap: anywhere; }
.ref-row button { flex-shrink: 0; min-height: 34px; padding: 6px 10px; font-size: 12px; }
.qr { display: grid; justify-items: center; gap: 10px; }
.qr img { width: 150px; height: 150px; }

/* Weekly status, financial warnings, and decision dialogs. */
.settlement-range { margin: 8px 0; color: #435773; font-size: 13px; font-variant-numeric: tabular-nums; }
.settlement-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.settlement-bulk { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 14px; border: 1px solid #dce5f4; border-radius: 9px; background: #f5f8fe; }
.settlement-bulk label, .settlement-checkbox { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; }
.settlement-panel input[type=checkbox], .settlement-dialog input[type=checkbox] { width: 18px; height: 18px; min-width: 18px; min-height: 18px; padding: 0; accent-color: var(--primary); }
.settlement-panel table { min-width: 1000px; }
.settlement-panel table th:nth-child(3), .settlement-panel table td:nth-child(3), .settlement-panel table th:nth-child(4), .settlement-panel table td:nth-child(4), .settlement-panel table th:nth-child(5), .settlement-panel table td:nth-child(5) { text-align: right; }
.settlement-amount { max-width: 235px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.settlement-state { display: inline-block; padding: 5px 10px; border: 1px solid #e2e7ee; border-radius: 6px; background: #f2f5f9; color: #53657e; font-size: 12px; line-height: 18px; font-weight: 550; white-space: nowrap; }
.state-held { border-color: #f2dfb4; background: var(--warning-soft); color: var(--warning); }
.state-approved { border-color: #cce8d9; background: var(--success-soft); color: #086747; }
.state-paid { border-color: var(--success); background: var(--success); color: #fff; }
.settlement-blockers { max-width: 460px; margin: 7px 0 0; padding-left: 17px; color: var(--warning); font-size: 12px; }
.settlement-blockers li { margin: 4px 0; line-height: 1.7; }
.settlement-warnings { border-color: #edddba; background: #fffdf7; }
.settlement-warnings .scroll { border-color: #e9dfca; }
.settlement-actions { min-width: 220px; max-width: 260px; }
.settlement-actions button { white-space: normal; }
dialog { width: calc(100% - 32px); max-width: 500px; max-height: 90vh; overflow: auto; padding: 26px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 24px 70px rgba(17, 33, 60, .22); }
dialog::backdrop { background: rgba(16, 30, 54, .44); }
dialog h2 { margin-bottom: 18px; }
.settlement-dialog { max-width: 550px; max-height: 88vh; }
.settlement-dialog-wide { max-width: 1000px; }
.settlement-dialog h3 { margin: 24px 0 10px; font-size: 16px; }
.settlement-dialog textarea { width: 100%; resize: vertical; }
.settlement-dialog .scroll { margin-top: 12px; }
.settlement-dialog table { font-size: 13px; }
.settlement-dialog table th, .settlement-dialog table td { padding: 12px; }
.settlement-dialog .settlement-review { min-width: 0; }
.settlement-dialog .settlement-review .code { max-width: 340px; overflow-wrap: anywhere; }
.settlement-dialog .settlement-checkbox { margin: 20px 0; }
.settlement-dialog [type=datetime-local] { width: 100%; }
.settlement-dialog .metric strong { font-size: 20px; }
.settlement-dialog .code { overflow-wrap: anywhere; }
.settlement-dialog .actions { position: sticky; bottom: -26px; margin: 10px 0 -12px; padding: 14px 0; background: var(--surface); }
.settlement-dialog .error { margin-top: 15px; }

/* Messages and authentication surfaces. */
.error { padding: 12px 14px; border: 1px solid #f4cbd1; border-radius: 8px; background: var(--danger-soft); color: #98283b; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.status { padding: 12px 14px; border: 1px solid #cfe7d9; border-radius: 8px; background: var(--success-soft); color: #166648; font-size: 13px; line-height: 1.6; }
.error:empty, .status:empty { display: none; }
.sync-line { margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--border); color: #6a7a92; font-size: 12px; line-height: 1.7; }
.login-wrap { display: grid; grid-template-columns: 1fr 440px; align-items: center; gap: 68px; max-width: 1040px; margin: 72px auto; padding: 0 24px; }
.login-intro h1 { max-width: 460px; font-size: 42px; line-height: 1.3; letter-spacing: -1.4px; }
.login-intro .muted { font-size: 15px; line-height: 1.8; }
.intro-line { height: 1px; margin: 28px 0; background: var(--border); }
.login-card { padding: 30px; box-shadow: 0 12px 36px rgba(21, 39, 69, .06); }
.login-card h2 { margin-bottom: 10px; font-size: 24px; }
.login-card form button { width: 100%; margin-top: 20px; }
.login-card .notice { margin-top: 18px; }
.activate { max-width: 760px; margin: 45px auto; padding: 24px; }
.step { display: flex; align-items: center; gap: 14px; }
.step span { padding: 7px 11px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 13px; }
footer { margin-top: 44px; padding-bottom: 24px; color: #76859b; text-align: center; font-size: 12px; }

/* Responsive layouts preserve every menu and action. */
@media (min-width: 1700px) {
  .content { padding: 28px 36px 36px; }
}
@media (max-width: 1200px) {
  .content { padding: 22px; }
  .tabs { gap: 2px; }
  .tabs button { padding: 9px 11px; }
}
@media (max-width: 1000px) {
  .shell { grid-template-columns: 250px minmax(0, 1fr); }
  .content { padding: 20px; }
  .profile-grid { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr 400px; gap: 30px; }
  .login-intro h1 { font-size: 34px; }
  .summary-item { gap: 7px; padding: 0 12px; }
  .summary-value, .network-overview strong { font-size: 20px; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  header { min-height: 64px; padding: 12px 16px; gap: 10px; }
  .brand-nav { gap: 10px; }
  .brand-logo { width: 100px; height: 33px; }
  .brand small { font-size: 9px; letter-spacing: 1px; }
  .account-head { gap: 6px; }
  header .account-dashboard { height: 30px; min-height: 30px; padding: 4px 9px; font-size: 12px; }
  .network-overview.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px 16px; }
  .summary-item { padding: 0; border: 0; }
  .summary-permission { margin-top: 0; }
  .shell { display: block; }
  aside { display: block; padding: 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .tree { display: block; width: 100%; max-height: 320px; overflow: auto; }
  .tree h2 { font-size: 15px; }
  .tree-tools { margin: 10px 0; }
  .content { padding: 18px 16px 28px; }
  .heading-line h1 { font-size: 22px; }
  .heading-line { gap: 8px; }
  .tabs { gap: 3px; padding: 4px; }
  .tabs button { min-height: 38px; padding: 8px 10px; font-size: 13px; }
  .panel, .page-section, .query-panel { padding: 18px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric, .stat { padding: 15px; }
  .metric strong, .stat strong { font-size: 25px; }
  .filters { gap: 10px; }
  .filters label { flex: 1; min-width: 170px; }
  .filters input { width: 100%; }
  .filters button { flex: 1; }
  input, select, textarea { font-size: 16px; }
  .scopes #trade-sync { margin-left: 0; }
  .toolbar form { flex-basis: 100%; max-width: none; }
  .profile-fields > div { display: block; padding: 14px 0; }
  .profile-fields dd { max-width: 100%; margin-top: 7px; text-align: left; }
  .ref-label { flex-basis: 100%; }
  .ref-value { min-width: 100%; }
  .referral { padding: 18px; }
  .referral-header { padding: 16px; }
  .qr { width: 100%; }
  .settlement-bulk { align-items: start; }
  .settlement-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settlement-metrics .metric { padding: 12px 10px; }
  .settlement-metrics .metric strong { font-size: 24px; }
  .settlement-metrics .metric span { font-size: 12px; }
  dialog, .settlement-dialog { padding: 20px; }
  .settlement-dialog .actions { bottom: -20px; }
  .settlement-dialog .settlement-review { min-width: 520px; }
  .login-wrap { display: block; margin: 30px auto; padding: 0 16px; }
  .login-intro { margin-bottom: 26px; }
  .login-intro h1 { max-width: none; font-size: 30px; }
  .login-intro .intro-line { margin: 18px 0; }
  .login-card { padding: 24px; }
  .activate { margin: 15px auto; padding: 16px; }
}
@media (max-width: 430px) {
  .brand-nav { gap: 8px; }
  .brand { gap: 5px; }
  .brand-logo { width: 91px; height: 30px; }
  .brand small { font-size: 8px; }
  .network-overview.stats { gap: 10px; }
  .summary-item { flex-wrap: wrap; gap: 2px 8px; }
  .account-menu-options { min-width: 155px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settlement-metrics { grid-template-columns: 1fr; }
  .pager { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  button, .button { transition: none; }
}

/* Product filters update report regions without replacing the shared view shell. */
.product-filter{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:16px 0}.product-filter>span{font-size:12px;font-weight:700;color:var(--muted,#64748b)}.product-filter .scopes{display:flex;gap:4px;flex-wrap:wrap}.product-filter button{white-space:nowrap}.option-diagnostics{margin-top:20px;padding-top:16px;border-top:1px solid #e2e8f0}.option-diagnostics h3{font-size:14px;margin:0 0 12px}.option-diagnostics .metric-grid{grid-template-columns:repeat(auto-fit,minmax(145px,1fr));gap:10px}.option-diagnostics .metric strong{font-size:21px}.overview-volume-filter{margin:0 0 16px}.product-legacy-notice{color:#64748b}@media(max-width:640px){.product-filter{align-items:flex-start;gap:8px}.product-filter>span{width:100%}.product-filter .scopes{width:100%}.product-filter .scopes button{flex:1}.option-diagnostics .metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}

.option-normalization-summary{display:flex;flex-wrap:wrap;gap:8px 20px;margin:10px 0;padding:10px 12px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px}.option-normalization-summary small{display:block;font-size:12px;color:#475569}.option-normalization-summary strong{font-variant-numeric:tabular-nums}.admin-run-summary .option-normalization-summary{display:block}.admin-run-summary .option-normalization-summary small+small{margin-top:5px}

[data-product-pnl]{text-align:right!important}[data-report-table="weekly-settlements"] th:nth-child(7),[data-report-table="weekly-settlements"] td:nth-child(7){text-align:right}.settlement-panel [data-report-table="weekly-settlements"]{min-width:1220px}
