/* Shared appearance controls. The original light palette stays in phase1.css. */
html{color-scheme:light}
html[data-theme="dark"]{color-scheme:dark}
.theme-toggle{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;min-width:44px;min-height:44px;flex:0 0 44px;padding:0;border:1px solid var(--line);border-radius:12px;background:var(--sage);color:var(--green);cursor:pointer;line-height:1;touch-action:manipulation}
.theme-toggle[hidden]{display:none}
.theme-toggle svg{width:22px;height:22px;pointer-events:none}
.theme-toggle:hover{border-color:var(--teal)}
.theme-toggle:focus-visible{outline:3px solid var(--teal);outline-offset:3px}
.theme-icon-sun{display:none}
.theme-icon-moon{display:block}
html[data-theme="dark"] .theme-icon-sun{display:block}
html[data-theme="dark"] .theme-icon-moon{display:none}
.customer-nav{gap:18px}
.customer-nav>.theme-toggle{margin-left:0}
.admin-top-actions{display:flex;align-items:center;gap:12px;min-width:0;max-width:100%;margin-left:auto}
.admin-top-actions>a{min-width:0;max-width:210px;overflow-wrap:anywhere}

html[data-theme="dark"]{
 --ink:#e1ede7;--muted:#a6bcb3;--green:#8ddcba;--teal:#72d9c4;
 --line:#33483f;--sage:#203b32;--lime:#b9e997;--paper:#0e1815;--amber:#3f3320;
 --theme-surface:#16251f;--theme-raised:#1c3028;--theme-input:#12221c;
 --theme-positive:#bce9ae;--theme-positive-bg:#1e3d2b;
 --theme-warning:#f7d78e;--theme-warning-bg:#3a2d19;
 --theme-negative:#ffc1af;--theme-negative-bg:#402821;
 background:var(--paper)
}
html[data-theme="dark"] body,
html[data-theme="dark"] .admin-site{background:var(--paper);color:var(--ink)}
html[data-theme="dark"] a{color:var(--teal)}
html[data-theme="dark"] .brand,
html[data-theme="dark"] .desktop-nav a,
html[data-theme="dark"] .service-tile,
html[data-theme="dark"] .recent-order,
html[data-theme="dark"] .provider-card,
html[data-theme="dark"] .recent-item,
html[data-theme="dark"] .recent-link{color:var(--ink)}
html[data-theme="dark"] .brand-mark{background:var(--lime);color:#193f37}
html[data-theme="dark"] .customer-top{background:rgba(14,24,21,.97);border-color:var(--line)}
html[data-theme="dark"] .top,
html[data-theme="dark"] .admin-top,
html[data-theme="dark"] .bottom-nav{background:var(--theme-surface);border-color:var(--line)}
html[data-theme="dark"] .bottom-nav a{color:var(--muted)}
html[data-theme="dark"] .bottom-nav a.active,
html[data-theme="dark"] .bottom-nav .admin-shortcut{color:var(--green)}
html[data-theme="dark"] .nav-account svg{background:var(--sage);color:var(--green)}
html[data-theme="dark"] .card,
html[data-theme="dark"] .product,
html[data-theme="dark"] .service-tile,
html[data-theme="dark"] .provider-card,
html[data-theme="dark"] .recent-order{background:var(--theme-surface);border-color:var(--line);box-shadow:none}
html[data-theme="dark"] .service-tile:hover{border-color:var(--teal)}
html[data-theme="dark"] .provider-card.active{background:var(--sage);border-color:var(--teal);box-shadow:0 0 0 1px var(--teal)}
html[data-theme="dark"] .service-icon{background:#273b2b;color:#c7e2af}
html[data-theme="dark"] .service-tile.data .service-icon{background:#372e47;color:#d6bfef}
html[data-theme="dark"] .service-tile.card .service-icon{background:#3f381f;color:#f2dc99}
html[data-theme="dark"] .service-tile.game .service-icon{background:#432e28;color:#f0c3ab}
html[data-theme="dark"] .service-tile .tile-arrow{color:var(--muted)}
html[data-theme="dark"] .country-chip{background:var(--sage);color:#c7e2af}
html[data-theme="dark"] .wallet-panel{background:#153d32;color:#effaf3}
html[data-theme="dark"] .wallet-panel .btn{background:var(--lime);color:#193f37}
html[data-theme="dark"] .wallet-label,
html[data-theme="dark"] .wallet-panel p{opacity:1;color:#c7dfd2}
html[data-theme="dark"] .empty-state{background:#12231c;border-color:#476450;color:var(--muted)}
html[data-theme="dark"] .btn{background:var(--green);color:#10291f}
html[data-theme="dark"] .btn.secondary{background:var(--sage);color:#b5e4ce}
html[data-theme="dark"] .btn.danger{background:#a9453e;color:#fff4ee}
html[data-theme="dark"] .btn:disabled{opacity:.55}
html[data-theme="dark"] .step{background:var(--sage);color:var(--ink)}
html[data-theme="dark"] .step.active,
html[data-theme="dark"] .category-tabs a.active{background:var(--green);border-color:var(--green);color:#10291f}
html[data-theme="dark"] .category-tabs a{background:var(--theme-surface);border-color:var(--line);color:var(--ink)}
html[data-theme="dark"] .provider-mark{background:var(--sage);color:var(--green)}
html[data-theme="dark"] input:where(:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"])),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{background:var(--theme-input);color:var(--ink);border-color:#476052}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{color:#91a99d;opacity:1}
html[data-theme="dark"] input:disabled,
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled{background:#1e2b25;color:var(--muted);opacity:1}
html[data-theme="dark"] input[type="checkbox"],
html[data-theme="dark"] input[type="radio"]{accent-color:var(--green)}
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] textarea:-webkit-autofill,
html[data-theme="dark"] select:-webkit-autofill{-webkit-text-fill-color:var(--ink);-webkit-box-shadow:0 0 0 1000px var(--theme-input) inset;caret-color:var(--ink)}
html[data-theme="dark"] :is(button,a,input,select,textarea,summary):focus-visible{outline:3px solid #9ae3bc;outline-offset:3px}
html[data-theme="dark"] .choice,
html[data-theme="dark"] .table th,
html[data-theme="dark"] .table td,
html[data-theme="dark"] .recent-item,
html[data-theme="dark"] .item-line,
html[data-theme="dark"] .sep{border-color:var(--line)}
html[data-theme="dark"] .table th{background:#20372c;color:#c3d9cd}
html[data-theme="dark"] .items-box,
html[data-theme="dark"] .items-total,
html[data-theme="dark"] .announcement-preview,
html[data-theme="dark"] .language-content-preview,
html[data-theme="dark"] .secret-box,
html[data-theme="dark"] .fixed-template-token{background:var(--theme-input);border-color:var(--line);color:var(--ink)}
html[data-theme="dark"] .item-line-head{background:#20372c;color:var(--muted)}
html[data-theme="dark"] .copy-phone,
html[data-theme="dark"] .copy-value,
html[data-theme="dark"] .amount-preset,
html[data-theme="dark"] .editor-toolbar button{background:var(--theme-raised);color:var(--green);border-color:#476052}
html[data-theme="dark"] .copy-phone:hover,
html[data-theme="dark"] .copy-value:hover,
html[data-theme="dark"] .copy-value.copied,
html[data-theme="dark"] .amount-preset:hover,
html[data-theme="dark"] .amount-preset:focus,
html[data-theme="dark"] .editor-toolbar button:hover{background:#294638;color:var(--green);border-color:var(--teal)}
html[data-theme="dark"] .copy-phone.copied{background:var(--theme-positive-bg);color:var(--theme-positive);border-color:#4f7a51}
html[data-theme="dark"] .copy-value.inline-copy{background:transparent;color:var(--teal)}
html[data-theme="dark"] .copy-value.inline-copy:hover{background:var(--sage)}
html[data-theme="dark"] .copy-toast{background:#cee8d9;color:#10271e;box-shadow:0 10px 28px #0005}
html[data-theme="dark"] .muted,
html[data-theme="dark"] .footer,
html[data-theme="dark"] .customer-footer,
html[data-theme="dark"] .footer-line-contact a,
html[data-theme="dark"] .provider-card small,
html[data-theme="dark"] .recent-item small,
html[data-theme="dark"] .recent-link small,
html[data-theme="dark"] .copy-phone small,
html[data-theme="dark"] .empty-list,
html[data-theme="dark"] .history-limit-form label,
html[data-theme="dark"] .items-total span{color:var(--muted)}
html[data-theme="dark"] .price,
html[data-theme="dark"] .pay-amount,
html[data-theme="dark"] .invoice-total,
html[data-theme="dark"] .recent-payment,
html[data-theme="dark"] .items-total strong,
html[data-theme="dark"] .ledger-plus{color:var(--green)}
html[data-theme="dark"] .ledger-minus,
html[data-theme="dark"] .price-warning-inline{color:var(--theme-negative)}
html[data-theme="dark"] .badge{background:var(--sage);color:#c6dfd0}
html[data-theme="dark"] .badge.processing,
html[data-theme="dark"] .badge.pending,
html[data-theme="dark"] .badge.scheduled,
html[data-theme="dark"] .invoice-countdown,
html[data-theme="dark"] .translation-missing,
html[data-theme="dark"] .alert.warning{background:var(--theme-warning-bg);color:var(--theme-warning);border-color:#6d582f}
html[data-theme="dark"] .badge.success,
html[data-theme="dark"] .badge.active,
html[data-theme="dark"] .badge.paid,
html[data-theme="dark"] .alert.success,
html[data-theme="dark"] .deposit-success-box,
html[data-theme="dark"] .deposit-success-toast{background:var(--theme-positive-bg);color:var(--theme-positive);border-color:#4f7a51}
html[data-theme="dark"] .translation-ok{color:var(--theme-positive)}
html[data-theme="dark"] .badge.failed,
html[data-theme="dark"] .badge.blocked,
html[data-theme="dark"] .alert.error,
html[data-theme="dark"] .price-warning,
html[data-theme="dark"] .item-line button,
html[data-theme="dark"] .invoice-countdown.expired{background:var(--theme-negative-bg);color:var(--theme-negative);border-color:#684336}
html[data-theme="dark"] .badge.paused,
html[data-theme="dark"] .badge.cancelled{background:#2d3733;color:#c2cfc8}
html[data-theme="dark"] .alert.info,
html[data-theme="dark"] .site-announcement{background:#1c382f;color:#bce2ce;border-color:var(--line)}
html[data-theme="dark"] .language-error{background:var(--theme-negative-bg);color:var(--theme-negative)}
html[data-theme="dark"] code,
html[data-theme="dark"] pre{background:#20372c;color:#d4ede3;border-radius:6px}
html[data-theme="dark"] pre{padding:10px}
html[data-theme="dark"] .payment-box>div,
html[data-theme="dark"] .bank-account-card,
html[data-theme="dark"] .bank-info>div,
html[data-theme="dark"] .bank-detail-row{background:var(--theme-surface);border-color:var(--line);color:var(--ink)}
html[data-theme="dark"] .payment-box span,
html[data-theme="dark"] .bank-account-card span,
html[data-theme="dark"] .bank-detail-row span{color:var(--muted)}
html[data-theme="dark"] .bank-detail-table{border-color:var(--line)}
html[data-theme="dark"] .bank-detail-row .bank-account-no{color:var(--green)}
html[data-theme="dark"] .payment-highlight{background:var(--theme-negative-bg)!important;border-color:#684336!important}
html[data-theme="dark"] .payment-highlight strong,
html[data-theme="dark"] .bank-detail-row .transfer-code,
html[data-theme="dark"] .bank-detail-row .payment-amount{color:var(--theme-negative)}
html[data-theme="dark"] .transfer-highlight{background:#1d343d!important;border-color:#5aafc0!important}
html[data-theme="dark"] .transfer-highlight span,
html[data-theme="dark"] .transfer-highlight strong{color:#a5e2ef}
html[data-theme="dark"] .transfer-note{color:#d6bfef}
/* Keep the original QR image and its light scanning surface unaltered. */
html[data-theme="dark"] .vietqr-box,
html[data-theme="dark"] .twofa-qr,
html[data-theme="dark"] .vietqr-template-card .vietqr-box{background:#fff;border-color:var(--line);color:#193f37}
html[data-theme="dark"] .vietqr-brand{color:#172033}
html[data-theme="dark"] .vietqr-brand span{color:#c5193a}
html[data-theme="dark"] .vietqr-bank-name{color:#0b5cff}
html[data-theme="dark"] .admin-sidebar{background:#10251e;color:#dfebdf}
html[data-theme="dark"] .admin-sidebar .brand{color:#effaf3}
html[data-theme="dark"] .admin-caption{color:#a1bfae}
html[data-theme="dark"] .admin-menu-group[open] summary{background:#254735;color:var(--lime)}
html[data-theme="dark"] .admin-menu-group a{color:#c4d8cc;border-color:#446755}
html[data-theme="dark"] .admin-menu-group a.active{color:var(--lime);border-color:var(--lime)}
html[data-theme="dark"] .admin-back{color:#bfd7c8}
html[data-theme="dark"] .sidebar-scrim{background:#0009}
html[data-theme="dark"] .skip-link{background:var(--green);color:#10291f}

@media(max-width:1280px) and (min-width:761px){
 .customer-nav{flex-wrap:wrap;padding-top:10px;padding-bottom:10px;gap:12px}
 .customer-nav>.desktop-nav{order:5;flex-basis:100%;justify-content:center;flex-wrap:wrap}
}
@media(max-width:760px){
 .customer-nav{gap:8px}
 .customer-nav .language-picker select{max-width:108px}
 .admin-top-actions{max-width:calc(100% - 90px);gap:10px}
 .admin-top-actions>a{max-width:min(210px,calc(100vw - 200px))}
}
@media(max-width:420px){
 html{scroll-padding-top:136px}
 .customer-nav{display:grid;grid-template-columns:minmax(0,1fr) 44px 34px;gap:6px 8px;padding-top:10px;padding-bottom:10px}
 .customer-nav>.brand{grid-column:1;grid-row:1;min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere;line-height:1.3}
 .customer-nav>.brand .brand-mark{flex-shrink:0}
 .customer-nav>.theme-toggle{grid-column:2;grid-row:1}
 .customer-nav>.nav-account{grid-column:3;grid-row:1;min-width:0}
 .customer-nav>.language-picker{grid-column:1/-1;grid-row:2;justify-self:end;margin-left:0;max-width:100%}
 .customer-nav>.desktop-nav{display:none}
 .customer-nav .language-picker select{max-width:145px}
}
@media(prefers-reduced-motion:reduce){.theme-toggle{transition:none}}
