/* Shared appearance tokens. Member composition is scoped; admin workflows retain their layout. */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; background: #101411; }
html[data-theme="light"] body[data-appearance="blackcard"] {
  --page: #f5f4ef; --surface: #fffefa; --ink: #252d27; --muted: #687167;
  --line: #e1e4db; --sidebar: #17201b; --positive: #356346;
  --accent-strong: color-mix(in srgb, var(--brand-accent, #8b6c30) 55%, #292f24) !important;
}
html[data-theme="dark"] body {
  --page: #101411; --surface: #191f1b; --ink: #edf0e8; --muted: #a9b2a8;
  --line: #303a32; --sidebar: #0c110e; --positive: #94c5a2;
  --accent: color-mix(in srgb, var(--brand-accent, #ad8d47) 48%, #f7ead2) !important;
  --accent-strong: color-mix(in srgb, var(--brand-accent, #ad8d47) 43%, #f7ead2) !important;
  --accent-soft: color-mix(in srgb, var(--brand-accent, #ad8d47) 14%, #191f1b) !important;
  --member-shadow: 0 10px 32px #00000012;
}
html[data-theme="dark"] body[data-appearance="cobalt"] { --page: #10151e; --surface: #191f2b; --line: #303b4f; --sidebar: #0d1320; --ink: #edf0f7; --muted: #aab5c8; }
html[data-theme="dark"] body[data-appearance="ivory"] { --page: #191316; --surface: #241c20; --line: #413039; --sidebar: #160f13; --ink: #f3eaf0; --muted: #c0acb8; }

/* A quiet, keyboard-accessible three-way preference, available on every page. */
.theme-control { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 30px; padding: 0 10px; min-height: 34px; background: var(--surface); color: var(--ink); }
.theme-control > svg { width: 15px; height: 15px; color: var(--accent-strong); }
.theme-control select { min-height: 32px; max-width: 84px; border: 0; background: transparent; color: inherit; font-size: 11px; cursor: pointer; padding: 0 3px; }
.theme-control:focus-within { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
.theme-control select:focus-visible { outline: none; }
.topbar-right { gap: 13px; }

/* More deliberate hierarchy, warmer surfaces and consistent horizontal rhythm. */
body[data-member-workspace="true"] main { max-width: 1390px; padding-top: 42px; }
body[data-member-workspace="true"] .page-heading { margin-bottom: 30px; }
body[data-member-workspace="true"] .page-heading h1 { font-size: clamp(30px, 2.6vw, 39px); letter-spacing: -1.1px; }
body[data-member-workspace="true"] .heading-subtitle { font-size: 13px; }
body[data-member-workspace="true"] .panel { border-radius: 18px; }
body[data-member-workspace="true"] .member-overview-top.has-deposit { gap: 22px; grid-template-columns: minmax(0, .96fr) minmax(0, 1.04fr); }
body[data-member-workspace="true"] .member-overview-top.has-deposit .member-overview-hero { padding: 38px; background: linear-gradient(135deg, #25352a, #152119 72%); border-color: #64725b40; }
body[data-member-workspace="true"] .member-overview-top.has-deposit .member-hero-copy { justify-content: flex-start; position: relative; z-index: 1; }
body[data-member-workspace="true"] .member-overview-top.has-deposit .member-hero-bottom { margin-top: auto; padding-top: 23px; }
body[data-member-workspace="true"] .member-overview-top.has-deposit .member-total { font-size: clamp(44px, 4.3vw, 64px); margin: 15px 0 10px; letter-spacing: -2.8px; }
body[data-member-workspace="true"] .member-overview-top.has-deposit .member-overview-hero::after { content: ''; position: absolute; width: 290px; height: 290px; top: -65px; right: -150px; border: 1px solid #d7c3911c; border-radius: 50%; box-shadow: 0 0 0 40px #d7c39104, 0 0 0 80px #d7c39103; pointer-events: none; }
body[data-member-workspace="true"] .member-deposit-panel { padding: 25px; }
body[data-member-workspace="true"] .member-deposit-heading { margin-bottom: 17px; }
body[data-member-workspace="true"] .member-deposit-heading h2 { font-size: 24px; }
body[data-member-workspace="true"] .member-deposit-selectors { margin-bottom: 19px; }
body[data-member-workspace="true"] .member-deposit-body { grid-template-columns: 164px minmax(0, 1fr); gap: 20px; }
body[data-member-workspace="true"] .member-deposit-code { border-color: #e2e4db; padding: 8px; box-shadow: none; }
body[data-member-workspace="true"] .member-deposit-note { font-size: 11px; line-height: 1.7; margin-top: 14px; }
body[data-member-workspace="true"] .member-deposit-balance { padding-top: 14px; margin-top: 20px; justify-content: space-between; }
body[data-member-workspace="true"] .member-deposit-balance strong { font-size: 25px; }
body[data-member-workspace="true"] .member-deposit-balance small { font-size: 10px; }
body[data-member-workspace="true"] .member-deposit-panel > .member-deposit-note { border-top: 1px solid var(--line); padding-top: 12px; }
body[data-member-workspace="true"] .member-overview-grid { gap: 22px; }
body[data-member-workspace="true"] .member-shortcut { padding: 19px 16px; }
body[data-member-workspace="true"] .member-shortcut small { font-size: 11px; }
body[data-member-workspace="true"] .member-shortcut strong { font-size: 13px; }
body[data-member-workspace="true"] .member-ledger-amount { letter-spacing: -1px; }
body[data-member-workspace="true"] .member-wallet-tabs a[aria-current="page"],
body[data-member-workspace="true"] .member-account-tabs a[aria-current="page"] { border-bottom-color: var(--accent-strong); }
body[data-member-workspace="true"] .payment-card { box-shadow: 0 14px 25px -17px #07120880; }

/* Replace legacy hard-coded light surfaces, including forms, dialogs and tables. */
html[data-theme="dark"] body .topbar { background: var(--page); }
html[data-theme="dark"] body :is(.text-input, .filter-select, .search-field, .amount-input, .support-compose textarea, .limit-box, .quote-row.total) { background: var(--page); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] body input::placeholder,
html[data-theme="dark"] body textarea::placeholder { color: #96a193; opacity: 1; }
html[data-theme="dark"] body :is(.button.secondary, .button.ghost) { background: var(--surface); color: var(--ink); border-color: #465349; }
html[data-theme="dark"] body .button.secondary:hover { background: #28332b; }
html[data-theme="dark"] body .button.primary { background: var(--accent); color: #171e18; border-color: transparent; }
html[data-theme="dark"] body .button.primary:hover { background: color-mix(in srgb, var(--accent) 85%, white); }
html[data-theme="dark"] body :is(.text-button, .text-link, .icon-action, .member-support-note, .member-card-link) { color: var(--accent-strong); }
html[data-theme="dark"] body :is(.input-label, .metric-label, .metric-note, .date-label, .activity-subtitle, .date-cell, .page-footer, .page-footer .brand-name, .breadcrumb .brand-name, .support-message-label, .support-message-meta, .action-copy small, .field-help, .table-caption, .detail-list dt, .limit-label) { color: var(--muted); }
html[data-theme="dark"] body :is(.sample-label, .metric-icon, .activity-icon, .funds-notice, .coming-soon, .action-circle.muted, .support-safety, .support-message) { color: var(--muted); background: var(--accent-soft); border-color: var(--line); }
html[data-theme="dark"] body :is(.activity-table th, .admin-table th) { background: var(--page); color: var(--muted); }
html[data-theme="dark"] body :is(.activity-table td, .activity-table th, dialog, .support-compose, .membership-form-section) { border-color: var(--line); }
html[data-theme="dark"] body :is(.info-banner, .support-notice, .support-pill) { background: #233027; color: #b7cdb9; border-color: #394d3d; }
html[data-theme="dark"] body .info-banner strong { color: #c5d8bd; }
html[data-theme="dark"] body :is(.badge, .card-status) { background: #253c2d; color: #b4d5b9; }
html[data-theme="dark"] body :is(.badge.pending, .sample-label) { background: #393324; color: #d7c68e; }
html[data-theme="dark"] body :is(.badge.failed, .form-error) { color: #efb3a9; }
html[data-theme="dark"] body .badge.failed { background: #432a26; }
html[data-theme="dark"] body .card-status.frozen { background: #24384a; color: #b8cce8; }
html[data-theme="dark"] body .environment-badge { background: var(--surface); color: var(--muted); border-color: var(--line); }
html[data-theme="dark"] body :is(.close-button, .danger-outline) { background: var(--surface); color: #edb8ad; border-color: #775249; }
html[data-theme="dark"] body dialog::backdrop { background: #060a08b5; }
html[data-theme="dark"] body .toast { background: #d8c89f; color: #18211b; border-color: #e6d7ae; }
html[data-theme="dark"] body .member-overview-top.has-deposit .member-overview-hero { background: linear-gradient(145deg, #26392d, #15251b 75%); border-color: #425546; box-shadow: 0 12px 28px -18px #0008; }
html[data-theme="dark"] body .member-deposit-code { background: #fff; border-color: #fff; }
html[data-theme="dark"] body .member-deposit-qr { background: #fff; }
html[data-theme="dark"] body[data-member-workspace="true"] .member-crypto-address { background: var(--page); }
html[data-theme="dark"] body[data-member-workspace="true"] .member-navigation-secondary a { color: #aeb9ad; }
html[data-theme="dark"] body[data-member-workspace="true"] .member-navigation-secondary a:hover { color: var(--ink); }
html[data-theme="dark"] body .skip-link { color: #172018; }

@media (max-width: 1150px) {
  body[data-member-workspace="true"] .member-overview-top.has-deposit { grid-template-columns: minmax(0, 1fr); }
  body[data-member-workspace="true"] .member-overview-top.has-deposit .member-overview-hero { min-height: 290px; }
  body[data-member-workspace="true"] .member-overview-top.has-deposit .member-hero-bottom { margin-top: 30px; }
}
@media (max-width: 760px) {
  body[data-member-workspace="true"] main { padding-top: 26px; }
  body[data-member-workspace="true"] .member-overview-top.has-deposit .member-overview-hero { min-height: 260px; padding: 27px; }
  body[data-member-workspace="true"] .member-overview-top.has-deposit .member-total { font-size: 48px; }
  body[data-member-workspace="true"] .member-deposit-panel { padding: 22px; }
  body[data-member-workspace="true"] .member-shortcut { padding: 16px 13px; }
  body[data-member-workspace="true"] .topbar-right { gap: 10px; }
  html[data-theme="dark"] body[data-member-workspace="true"] .navigation { background: #141c16; border-color: var(--line); }
  html[data-theme="dark"] body[data-member-workspace="true"] .navigation a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
}
@media (max-width: 600px) {
  .topbar-right .environment-badge { display: none; }
  .theme-control { gap: 5px; padding: 0 8px; }
  .theme-control select { font-size: 11px; max-width: 73px; }
}
@media (max-width: 480px) {
  body[data-member-workspace="true"] .member-deposit-body { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  body[data-member-workspace="true"] .member-deposit-code { width: 194px; }
  body[data-member-workspace="true"] .member-shortcuts { grid-template-columns: minmax(0, 1fr); }
  body[data-member-workspace="true"] .member-overview-top.has-deposit .member-overview-hero { padding: 25px; }
}
@media (prefers-reduced-motion: no-preference) {
  .theme-control, .panel, .navigation a { transition: border-color .15s, box-shadow .15s; }
}

/* Keep the account summary compact: everyday actions use the space below it. */
@media (min-width: 1151px) {
  body[data-member-workspace="true"] .member-overview-composition.has-deposit { display: grid; grid-template-columns: minmax(0, .96fr) minmax(0, 1.04fr); grid-template-areas: 'balance deposit' 'actions deposit' 'note note' 'card activity'; gap: 22px; align-items: stretch; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit > :is(.member-overview-top, .member-overview-grid) { display: contents; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit .member-overview-hero { grid-area: balance; min-height: 280px; padding: 30px 34px; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit #overview-deposit-root { grid-area: deposit; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit .member-next-steps { grid-area: actions; padding: 23px; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit .member-shortcuts { margin-top: 17px; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit .member-support-note { margin-top: 15px; padding-top: 13px; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit .member-balance-note { grid-area: note; margin: -4px 0 0; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit .member-card-preview { grid-area: card; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit > .activity-panel { grid-area: activity; margin: 0; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit .member-deposit-panel { display: flex; flex-direction: column; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit .member-deposit-body { flex: 1; }
  body[data-member-workspace="true"] .member-overview-composition.has-deposit .member-deposit-balance { margin-top: 22px; }
}

body[data-appearance="cobalt"][data-member-workspace="true"] .member-overview-top.has-deposit .member-overview-hero { background: linear-gradient(135deg, #253958, #16243d); border-color: #435872; }
body[data-appearance="ivory"][data-member-workspace="true"] .member-overview-top.has-deposit .member-overview-hero { background: linear-gradient(135deg, #49313f, #2d1d27); border-color: #705262; }

/* Front-page colours only; retain the established workspace layout and type. */
html[data-theme="dark"] body[data-appearance="blackcard"] {
  --page: #0b0e0d; --surface: #111512; --sidebar: #0b0e0d;
  --ink: #f1eee5; --muted: #a3a89e; --line: #ffffff19;
  --accent: #cfb17b !important; --accent-strong: #e2cda4 !important; --accent-soft: #cfb17b12 !important;
}
html[data-theme="light"] body[data-appearance="blackcard"] {
  --page: #f5f2ea; --surface: #fffdf7; --sidebar: #0b0e0d;
  --ink: #20251f; --muted: #63695f; --line: #ddd8cb;
  --accent: #cfb17b !important; --accent-strong: #786039 !important; --accent-soft: #eee6d5 !important;
}
body[data-appearance="blackcard"][data-member-workspace="true"] .member-overview-top.has-deposit .member-overview-hero {
  background: radial-gradient(ellipse at 110% 100%, #cfb17b15, transparent 65%), #101510;
  border-color: #cfb17b40;
}
body[data-appearance="blackcard"][data-member-workspace="true"] .member-total { color: #e2cda4; }
html[data-theme="dark"] body[data-appearance="blackcard"][data-member-workspace="true"] .navigation { background: #0b0e0d; }
