/* Customer app night palette. Loaded after the page and navigation styles. */
html[data-theme="dark"] {
  color-scheme: dark;
  --night-bg: #0f0c1c;
  --night-panel: #191427;
  --night-raised: #221b34;
  --night-border: #38304e;
  --night-text: #f5f1ff;
  --night-muted: #ada4c2;
  --night-accent: #b49aff;
  --shell-surface: #191427;
  --shell-border: #38304e;
  --shell-text: #f5f1ff;
  --shell-muted: #ada4c2;
  --shell-soft: #2a213d;
  --shell-shadow: 0 22px 52px #05030f9c;
  background: var(--night-bg);
  color: var(--night-text);
}

html[data-theme="dark"] body.app-body,
html[data-theme="dark"] body.auth-body {
  background: radial-gradient(circle at 92% 0%, #251a44 0, transparent 38%), var(--night-bg);
  color: var(--night-text);
}

html[data-theme="dark"] .brand,
html[data-theme="dark"] .page-title,
html[data-theme="dark"] .card-heading h2,
html[data-theme="dark"] .side-card h3,
html[data-theme="dark"] .record-section-head h2,
html[data-theme="dark"] .receipt-head h1,
html[data-theme="dark"] .receipt-section h2,
html[data-theme="dark"] .lock-card h2,
html[data-theme="dark"] .auth-form-wrap h2,
html[data-theme="dark"] .sheet-header h2 {
  color: var(--night-text);
}

html[data-theme="dark"] .header-links,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .card-heading p,
html[data-theme="dark"] .site-footer,
html[data-theme="dark"] .secure-note,
html[data-theme="dark"] .field-hint,
html[data-theme="dark"] .auth-foot,
html[data-theme="dark"] .auth-fine,
html[data-theme="dark"] .auth-form-wrap > p,
html[data-theme="dark"] .auth-password > p,
html[data-theme="dark"] .auth-lock > p,
html[data-theme="dark"] .step-row p,
html[data-theme="dark"] .lock-card p,
html[data-theme="dark"] .lock-help {
  color: var(--night-muted);
}

html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .text-link,
html[data-theme="dark"] .back-link,
html[data-theme="dark"] .header-links a:hover,
html[data-theme="dark"] .text-link:hover {
  color: var(--night-accent);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .auth-form-wrap,
html[data-theme="dark"] .receipt-card,
html[data-theme="dark"] .record-list,
html[data-theme="dark"] .sheet,
html[data-theme="dark"] .lock-card {
  background: var(--night-panel);
  border-color: var(--night-border);
  color: var(--night-text);
  box-shadow: 0 18px 42px #0705115c;
}

html[data-theme="dark"] .support-card {
  background: #2e2054;
}

html[data-theme="dark"] .auth-panel {
  background: #130f20;
}

html[data-theme="dark"] .auth-visual {
  background: radial-gradient(circle at 76% 34%, #5a3abb 0, transparent 32%),
    linear-gradient(145deg, #1c1135, #4a299d);
}

html[data-theme="dark"] .auth-visual .brand,
html[data-theme="dark"] .hero .eyebrow,
html[data-theme="dark"] .payment-hero .eyebrow,
html[data-theme="dark"] .record-hero .eyebrow,
html[data-theme="dark"] .auth-visual .eyebrow {
  color: #e3d8ff;
}

html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .btn-outline,
html[data-theme="dark"] .sheet-close,
html[data-theme="dark"] .swap-button {
  background: var(--night-raised);
  border: 1px solid var(--night-border);
  color: #dfd4fb;
}

html[data-theme="dark"] .icon-button:hover,
html[data-theme="dark"] .btn-outline:hover,
html[data-theme="dark"] .sheet-close:hover,
html[data-theme="dark"] .swap-button:hover {
  background: #302348;
}

html[data-theme="dark"] .avatar,
html[data-theme="dark"] .pill,
html[data-theme="dark"] .step-no,
html[data-theme="dark"] .field-icon,
html[data-theme="dark"] .record-count,
html[data-theme="dark"] .record-icon,
html[data-theme="dark"] .rate-symbol,
html[data-theme="dark"] .lock-icon {
  background: #322450;
  color: #c9b6ff;
}

html[data-theme="dark"] .btn-primary {
  background: #754dff;
  color: #fff;
  box-shadow: 0 10px 24px #14092e8c;
}

html[data-theme="dark"] .btn-primary:hover:not(:disabled) {
  background: #8662ff;
  box-shadow: 0 13px 28px #14092eaa;
}

html[data-theme="dark"] .lock-card .btn-primary {
  background: #754dff;
  color: #fff;
}

html[data-theme="dark"] .btn-light {
  background: #302447;
  color: #d3c0ff;
}

html[data-theme="dark"] .form-label,
html[data-theme="dark"] .quote-card .form-label,
html[data-theme="dark"] .auth-form-wrap .form-label,
html[data-theme="dark"] .lock-card .form-label {
  color: #d1c8e4;
}

html[data-theme="dark"] .lock-card .eyebrow {
  color: var(--night-accent);
}

html[data-theme="dark"] .amount-panel,
html[data-theme="dark"] .quote-card .amount-panel,
html[data-theme="dark"] .input-field,
html[data-theme="dark"] .auth-form-wrap .input-field,
html[data-theme="dark"] .select-field,
html[data-theme="dark"] .textarea-field,
html[data-theme="dark"] .pin-input {
  background: #211a32;
  border-color: var(--night-border);
  color: var(--night-text);
}

html[data-theme="dark"] .amount-input,
html[data-theme="dark"] .quote-card .amount-input {
  color: var(--night-text);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder,
html[data-theme="dark"] .amount-input::placeholder {
  color: #817795;
  opacity: 1;
}

html[data-theme="dark"] input:read-only {
  color: #e4ddf1;
}

html[data-theme="dark"] .currency-select {
  background-color: #35264f;
  color: #e0d3ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 7 5 5 5-5' fill='none' stroke='%23d9c9ff' stroke-width='2'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .currency-select option,
html[data-theme="dark"] .select-field option {
  background: #211a32;
  color: var(--night-text);
}

html[data-theme="dark"] .amount-panel:focus-within,
html[data-theme="dark"] .select-field:focus,
html[data-theme="dark"] .input-field:focus,
html[data-theme="dark"] .textarea-field:focus,
html[data-theme="dark"] .pin-input:focus {
  border-color: #aa86ff;
  box-shadow: 0 0 0 4px #9c72ff38;
}

html[data-theme="dark"] .swap-divider::before,
html[data-theme="dark"] .swap-divider::after {
  background: var(--night-border);
}

html[data-theme="dark"] .quote-card .rate-bar {
  background: #281e3f;
  border-color: #493563;
}

html[data-theme="dark"] .quote-card .rate-bar .rate-copy span,
html[data-theme="dark"] .quote-card .rate-bar .rate-fee span {
  color: #b5a9ca;
}

html[data-theme="dark"] .quote-card .rate-bar strong {
  color: #e4d7ff;
}

html[data-theme="dark"] .rate-fee {
  border-color: #4b3a62;
}

html[data-theme="dark"] .account-option,
html[data-theme="dark"] .account-page .detail-card,
html[data-theme="dark"] .summary-item,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .record-empty,
html[data-theme="dark"] .upload-box {
  background: var(--night-raised);
  border-color: var(--night-border);
  color: var(--night-text);
}

html[data-theme="dark"] .account-option:has(input:checked) {
  background: #30244b;
  border-color: #ab89ff;
}

html[data-theme="dark"] .account-option small,
html[data-theme="dark"] .account-page .detail-card small,
html[data-theme="dark"] .summary-item span,
html[data-theme="dark"] .record-main small,
html[data-theme="dark"] .record-end small,
html[data-theme="dark"] .record-empty,
html[data-theme="dark"] .empty-state {
  color: var(--night-muted);
}

html[data-theme="dark"] .detail-card button {
  background: #432830;
  color: #ffb5b7;
}

html[data-theme="dark"] .payment-instructions,
html[data-theme="dark"] .inline-alert.info {
  background: #302346;
  color: #d5c8ee;
}

html[data-theme="dark"] .payment-instructions strong {
  color: #efe5ff;
}

html[data-theme="dark"] .payment-instructions article {
  border-color: #4a3a61;
}

html[data-theme="dark"] .inline-alert.error,
html[data-theme="dark"] .lock-card .inline-alert.error {
  background: #47252e;
  color: #ffc4c6;
}

html[data-theme="dark"] .inline-alert.success {
  background: #1a3a34;
  color: #9de6c6;
}

html[data-theme="dark"] .record-row {
  border-color: #332b45;
}

html[data-theme="dark"] .record-row:hover {
  background: #272038;
}

html[data-theme="dark"] .record-icon.complete,
html[data-theme="dark"] .receipt-status.complete {
  background: #1b3a30;
  color: #8ce5b5;
}

html[data-theme="dark"] .record-icon.cancelled,
html[data-theme="dark"] .receipt-status.cancelled {
  background: #43252e;
  color: #ffadb5;
}

html[data-theme="dark"] .status-pending { color: #ffd48d !important; }

html[data-theme="dark"] .status-complete { color: #8ce5b5 !important; }
html[data-theme="dark"] .status-cancelled { color: #ffadb5 !important; }
html[data-theme="dark"] .receipt-status { background: #49351e; color: #ffd48d; }

html[data-theme="dark"] .receipt-ref,
html[data-theme="dark"] .receipt-rows > div,
html[data-theme="dark"] .receipt-foot {
  border-color: #3a304d;
}

html[data-theme="dark"] .receipt-ref,
html[data-theme="dark"] .receipt-summary span,
html[data-theme="dark"] .receipt-summary small,
html[data-theme="dark"] .receipt-rows dt,
html[data-theme="dark"] .receipt-foot span {
  color: var(--night-muted);
}

html[data-theme="dark"] .receipt-ref strong,
html[data-theme="dark"] .receipt-summary strong,
html[data-theme="dark"] .receipt-rows dd,
html[data-theme="dark"] .receipt-foot strong {
  color: var(--night-text);
}

html[data-theme="dark"] .receipt-rows .receipt-total dt,
html[data-theme="dark"] .receipt-rows .receipt-total dd {
  color: #cdb7ff;
}

html[data-theme="dark"] .receipt-page .receipt-summary {
  background: linear-gradient(125deg, #2b2143, #33254e);
}

html[data-theme="dark"] .receipt-foot img {
  background: #fff;
  border-radius: 5px;
  padding: 3px;
}

html[data-theme="dark"] .sheet-close,
html[data-theme="dark"] .summary-item,
html[data-theme="dark"] .account-option,
html[data-theme="dark"] .upload-box {
  color: var(--night-text);
}

html[data-theme="dark"] .modal-backdrop,
html[data-theme="dark"] .lock-screen {
  background: #070510dc;
}

/* The shared app shell and profile surface are added independently. */
html[data-theme="dark"] .mobile-bottom-nav,
html[data-theme="dark"] .bottom-nav,
html[data-theme="dark"] .client-bottom-nav,
html[data-theme="dark"] .account-menu,
html[data-theme="dark"] .profile-menu-panel,
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .profile-panel,
html[data-theme="dark"] .profile-section,
html[data-theme="dark"] .profile-row {
  background: var(--night-panel);
  border-color: var(--night-border);
  color: var(--night-text);
}

html[data-theme="dark"] .mobile-bottom-nav a,
html[data-theme="dark"] .bottom-nav a,
html[data-theme="dark"] .client-bottom-nav a,
html[data-theme="dark"] .profile-menu a,
html[data-theme="dark"] .account-menu a,
html[data-theme="dark"] .account-menu button {
  color: var(--night-muted);
}

html[data-theme="dark"] .mobile-bottom-nav .active,
html[data-theme="dark"] .bottom-nav .active,
html[data-theme="dark"] .client-bottom-nav .active,
html[data-theme="dark"] .client-bottom-nav [aria-current="page"],
html[data-theme="dark"] .profile-menu a:hover,
html[data-theme="dark"] .account-menu a:hover,
html[data-theme="dark"] .account-menu button:hover {
  color: #d5c4ff;
}

html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .theme-option,
html[data-theme="dark"] .theme-options button,
html[data-theme="dark"] .header-theme-toggle,
html[data-theme="dark"] .profile-trigger,
html[data-theme="dark"] .profile-menu-action,
html[data-theme="dark"] .profile-action {
  background: var(--night-raised);
  border-color: var(--night-border);
  color: var(--night-text);
}

html[data-theme="dark"] .profile-menu-head,
html[data-theme="dark"] .profile-menu-actions,
html[data-theme="dark"] .profile-theme {
  border-color: var(--night-border);
}

html[data-theme="dark"] .profile-menu-avatar,
html[data-theme="dark"] .bottom-nav-icon {
  background: #342650;
  color: #d8c7ff;
}

html[data-theme="dark"] .profile-menu-avatar {
  background: #6a43e6;
  color: #fff;
}

html[data-theme="dark"] .profile-menu-action {
  background: transparent;
}

html[data-theme="dark"] .theme-options button {
  background: transparent;
  color: var(--night-muted);
}

html[data-theme="dark"] .theme-options button[aria-pressed="true"] {
  background: #3b2a59;
  color: #e2d5ff;
  box-shadow: 0 2px 8px #0905197a;
}

html[data-theme="dark"] .profile-menu-action:hover,
html[data-theme="dark"] .profile-menu-action:active,
html[data-theme="dark"] .header-theme-toggle:hover,
html[data-theme="dark"] .header-theme-toggle:active,
html[data-theme="dark"] .profile-trigger:active,
html[data-theme="dark"] .client-bottom-nav a:active,
html[data-theme="dark"] .theme-options button:hover {
  background: #332649;
}

html[data-theme="dark"] .profile-menu-head small,
html[data-theme="dark"] .profile-theme label,
html[data-theme="dark"] .profile-theme small {
  color: var(--night-muted);
}

html[data-theme="dark"] .profile-page {
  --profile-surface: var(--night-panel);
  --profile-edge: var(--night-border);
  --profile-ink: var(--night-text);
  --profile-muted: var(--night-muted);
  --profile-row: var(--night-raised);
  --profile-shadow: 0 18px 42px #0705115c;
}

html[data-theme="dark"] .profile-shortcut-icon {
  background: #342650;
  color: #d8c7ff;
}

@media (max-width: 700px) {
  html[data-theme="dark"] .app-header {
    background: transparent;
  }

  html[data-theme="dark"] .app-header.is-scrolled::before {
    background: color-mix(in srgb, #171328 94%, transparent);
    box-shadow: 0 1px 0 #39304b;
  }

  html[data-theme="dark"] .client-bottom-nav {
    background: color-mix(in srgb, #191427 94%, transparent);
    box-shadow: 0 13px 38px #05030fa3, 0 2px 8px #05030f7a;
  }

  html[data-theme="dark"] .client-bottom-nav a[aria-current="page"] .bottom-nav-icon {
    background: #754dff;
    color: #fff;
  }
}

@media (max-width: 850px) {
  html[data-theme="dark"] .auth-form-wrap {
    background: transparent;
    border: 0;
    box-shadow: none;
  }
}

@media print {
  html[data-theme="dark"] { color-scheme: light; }
  html[data-theme="dark"] body.receipt-page,
  html[data-theme="dark"] .receipt-card {
    background: #fff !important;
    color: #242039 !important;
    box-shadow: none !important;
  }
  html[data-theme="dark"] .receipt-card { border: 0 !important; }
  html[data-theme="dark"] .receipt-head h1,
  html[data-theme="dark"] .receipt-section h2,
  html[data-theme="dark"] .receipt-ref strong,
  html[data-theme="dark"] .receipt-summary strong,
  html[data-theme="dark"] .receipt-rows dd,
  html[data-theme="dark"] .receipt-foot strong {
    color: #242039 !important;
  }
  html[data-theme="dark"] .receipt-page .receipt-summary {
    background: #f5f2ff !important;
  }
  html[data-theme="dark"] .receipt-ref,
  html[data-theme="dark"] .receipt-summary span,
  html[data-theme="dark"] .receipt-summary small,
  html[data-theme="dark"] .receipt-rows dt,
  html[data-theme="dark"] .receipt-foot span {
    color: #666074 !important;
  }
  html[data-theme="dark"] .receipt-rows .receipt-total dt,
  html[data-theme="dark"] .receipt-rows .receipt-total dd {
    color: #3e268c !important;
  }
  html[data-theme="dark"] .receipt-ref,
  html[data-theme="dark"] .receipt-rows > div,
  html[data-theme="dark"] .receipt-foot {
    border-color: #ece9f3 !important;
  }
  html[data-theme="dark"] .receipt-status {
    background: #fff5e8 !important;
    color: #a26a12 !important;
  }
  html[data-theme="dark"] .receipt-status.complete {
    background: #e9f8ef !important;
    color: #178254 !important;
  }
  html[data-theme="dark"] .receipt-status.cancelled {
    background: #fff0f1 !important;
    color: #b34455 !important;
  }
}
