/* Colour choices in Settings. The swatches remain visible in both themes. */
.theme-palette-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:14px}
.theme-palette-card{display:grid;gap:7px;min-width:0;padding:12px;text-align:left;border:1px solid var(--line);border-radius:12px;background:var(--panel2);color:var(--text);font:inherit;cursor:pointer;transition:transform .18s,border-color .18s,box-shadow .18s}
.theme-palette-card:hover{transform:translateY(-2px);border-color:var(--gold)}
.theme-palette-card[aria-pressed=true]{border-color:var(--gold);box-shadow:0 0 0 2px var(--gold)}
.theme-palette-card strong{font-size:12px}.theme-palette-card small{font-size:10px;color:var(--muted);line-height:1.4}
.theme-palette-swatches{display:flex;gap:5px}.theme-palette-swatch{display:block;width:23px;height:23px;border-radius:8px;background:var(--swatch);border:1px solid #7775;box-shadow:inset 0 1px #fff6}
.theme-settings{margin-bottom:20px}
@media(max-width:550px){.theme-palette-grid{grid-template-columns:1fr 1fr}}
@media(prefers-reduced-motion:reduce){.theme-palette-card{transition:none}}

/* Palette variables are defined on the root so fixed overlays and popovers inherit them too. */
html[data-theme=light]{color-scheme:light;--bg:#f1f5ef;--panel:#ffffff;--panel2:#e8f0e8;--line:#cbd8cc;--muted:#53665a;--text:#1d2d23;--gold:#80540b;--green:#2d7049;--red:#a73530;--light-accent:#376b51;--light-accent-soft:#dcebdc;--light-accent-fg:#fff;--light-warm:#f7ead4;--light-focus:#376b51;--light-shadow:#3652441c}
html[data-theme=light][data-light-palette=blue]{--bg:#f1f6f9;--panel:#fff;--panel2:#e7f0f5;--line:#cbdbe4;--muted:#536b7a;--text:#1b303c;--gold:#79531b;--green:#236179;--red:#a73530;--light-accent:#315f80;--light-accent-soft:#deebf3;--light-accent-fg:#fff;--light-warm:#f5ead8;--light-focus:#315f80;--light-shadow:#304c601c}
html[data-theme=light][data-light-palette=lavender]{--bg:#f6f4fa;--panel:#fff;--panel2:#eeeaf4;--line:#d9d1e1;--muted:#685c70;--text:#30263b;--gold:#795326;--green:#655180;--red:#a73545;--light-accent:#69527e;--light-accent-soft:#ece5f4;--light-accent-fg:#fff;--light-warm:#f7ede0;--light-focus:#69527e;--light-shadow:#5b446b1c}
html[data-theme=light][data-light-palette=terracotta]{--bg:#fbf4ef;--panel:#fff;--panel2:#f5e9df;--line:#e4d1c4;--muted:#765e50;--text:#382920;--gold:#824e20;--green:#9a4b34;--red:#a73530;--light-accent:#a15137;--light-accent-soft:#f6e3d9;--light-accent-fg:#fff;--light-warm:#fbecd8;--light-focus:#a15137;--light-shadow:#8c5a401c}
html[data-theme=light][data-light-palette=red]{--bg:#fcf4f3;--panel:#fff;--panel2:#fbe9e8;--line:#e9c9c9;--muted:#6e5052;--text:#382325;--gold:#80501b;--green:#276647;--red:#a12732;--light-accent:#a92932;--light-accent-soft:#fbe5e5;--light-accent-fg:#fff;--light-warm:#fff0e7;--light-focus:#9f222d;--light-shadow:#7c20201c}

html[data-theme=light] body{background:var(--bg);color:var(--text)}
html[data-theme=light] :is(.sidebar,.panel,.summary-card,.product-card,.modal,.caller-alert){background:var(--panel);border-color:var(--line);color:var(--text);box-shadow:0 10px 30px var(--light-shadow)}
html[data-theme=light] :is(.sidebar,.topbar,.modal-head,.modal-actions,.data-table td,.data-table th){border-color:var(--line)}
html[data-theme=light] :is(.nav,.topdate,.text-btn,.field label,.cart-empty strong,.total-row,.ticket-customer,.status-bar-row label,.summary-card small){color:var(--muted)}
html[data-theme=light] .nav:hover{background:var(--panel2);color:var(--text)}
html[data-theme=light] .nav.active{background:var(--light-accent);color:var(--light-accent-fg);box-shadow:0 4px 12px var(--light-shadow)}
html[data-theme=light] .nav .count{background:var(--panel2);color:var(--text)}
html[data-theme=light] .nav.active .count{background:#ffffff35;color:#fff}
html[data-theme=light] :is(.local-card,.searchbox,.key,.tabs,.pos-product-view,.pos-category-row .pos-category-tabs,.customer-select,.board-column,.cash-count-summary,.cash-count-cell,.print-intake-summary,.roll-controls,.roll-cutting,.invoice-summary-grid section,.product-margin-box,.repair-financials>div,.part-row,.device-picker,.pattern-dialog,.voice-dialog,.expanded-product-results:not(:empty),#cart .customer-choice-list,.technician-picker-menu,.garment-context-menu,.quick-clothing-card){background:var(--panel2);border-color:var(--line);color:var(--text)}
html[data-theme=light] :is(.key,.badge){background:var(--light-accent-soft);color:var(--light-accent)}
html[data-theme=light] .badge.gold{background:var(--light-warm);color:var(--gold)}
html[data-theme=light] .badge.red{background:#fbe4e1;color:#9b302d}
html[data-theme=light] .badge.blue{background:#e0f0f6;color:#275c77}
/* Keep invoice badges and repair status chips explicitly coloured. */
html[data-theme=light] .badge.invoice-status-unpaid{background:#fbe0dc;color:#962d27;border-color:#e6a6a0}
html[data-theme=light] .badge.invoice-status-partial{background:#fff0d4;color:#855010;border-color:#eac68b}
html[data-theme=light] .badge.invoice-status-paid{background:#d9f2de;color:#236639;border-color:#98cdaa}
html[data-theme=light] .badge.invoice-status-refunded{background:#e9edee;color:#46565e;border-color:#bbc9cd}

html[data-theme=light] :is(#app,#modal-root) .btn{color:var(--text);background:linear-gradient(180deg,#fff,var(--panel2));border-color:var(--line);box-shadow:inset 0 1px #fff,0 2px 8px var(--light-shadow)}
html[data-theme=light] :is(#app,#modal-root) .btn:hover:not(:disabled){background:var(--light-accent-soft);border-color:var(--light-accent);color:var(--text)}
html[data-theme=light] :is(#app,#modal-root) .btn.primary,html[data-theme=light] :is(#app,#modal-root) .btn.primary:hover:not(:disabled){background:var(--light-accent);border-color:var(--light-accent);color:var(--light-accent-fg)}
html[data-theme=light] :is(#app,#modal-root) .btn.danger{background:#fae8e5;border-color:#dda8a2;color:#942e29}
html[data-theme=light] :is(#app,#modal-root) .btn.danger:hover:not(:disabled){background:#f5d4d0}
html[data-theme=light] :is(.icon-btn:hover,.pos-stock-button:hover,.pos-product-menu-trigger:hover,.technician-picker-button:hover:not(:disabled)){background:var(--light-accent-soft);color:var(--text);border-color:var(--light-accent)}
html[data-theme=light] :is(.tabs button.active,.pos-category-tabs .pos-category-button.active,.discount-toggle button[aria-pressed=true],.pos-product-view button[aria-pressed=true]){background:var(--light-accent);color:var(--light-accent-fg)}
html[data-theme=light] .pos-category-tabs .pos-category-button{color:var(--muted)}
html[data-theme=light] .pos-category-tabs .pos-category-button:hover:not(.active){background:var(--light-accent-soft);color:var(--text)}
html[data-theme=light] :is(.pos-stock-button,.pos-product-menu-trigger,.pos-product-view #pos-product-view-toggle,.cart-clear-button,.technician-picker-button,.print-priority-toggle,.print-intake-priority){background:var(--panel);border-color:var(--line);color:var(--text)}
html[data-theme=light] .product-card:hover:not(:disabled){background:var(--panel2);border-color:var(--light-accent)}
html[data-theme=light] .product-card .product-bottom strong{color:var(--text)}
html[data-theme=light] .product-card .stock-tag{background:var(--light-accent-soft);border-color:var(--line);color:var(--light-accent)}
html[data-theme=light] .product-select:disabled .stock-tag{color:var(--gold)}
html[data-theme=light] :is(.add-circle,.quantity button){background:var(--panel2);border-color:var(--line);color:var(--text)}
html[data-theme=light] .total-row.final{color:var(--text)}
html[data-theme=light] .data-table th{background:var(--panel2)}
html[data-theme=light] .data-table tbody tr:hover{background:var(--panel2)}
html[data-theme=light] .item-cell .mini-product:not(:has(img)){background:var(--panel2)}
html[data-theme=light] .ticket:not(:has(.priority-toggle[aria-checked=true])):not(:has(.print-priority-toggle[aria-checked=true])){background:var(--panel);border-color:var(--line);color:var(--text)}
html[data-theme=light] .ticket-bottom{border-color:var(--line)}
html[data-theme=light] .chart{background:repeating-linear-gradient(to top,transparent,transparent 42px,#00000009 43px,#00000009 44px)}
html[data-theme=light] .chart-fill{background:var(--light-accent-soft)}
html[data-theme=light] .chart-col .tooltip{background:var(--light-accent);color:#fff}
html[data-theme=light] .bar-track,html[data-theme=light] .progress-line{background:var(--panel2)}

/* The native control remains available to keyboards and assistive technology. */
html[data-theme=light] :is(#app,#modal-root) :is(select:not(.ticket-status):not([class*=print-status-]),input:not([type=checkbox],[type=radio],[type=range],[type=file],[type=hidden],[type=color],[type=button],[type=submit],[type=reset]),textarea){color-scheme:light;color:var(--text);background-color:var(--panel);border-color:var(--line)}
html[data-theme=light] :is(#app,#modal-root) select:not(.ticket-status):not([class*=print-status-]){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23485e50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")}
html[data-theme=light] :is(#app,#modal-root) select option,html[data-theme=light] :is(#app,#modal-root) select optgroup{background:var(--panel);color:var(--text)}
html[data-theme=light] :is(#app,#modal-root) :is(input,textarea)::placeholder{color:var(--muted);opacity:.85}
html[data-theme=light] :is(#app,#modal-root) :is(select,input,textarea):focus-visible{outline-color:var(--light-focus);border-color:var(--light-focus);box-shadow:0 0 0 3px var(--light-shadow)}
html[data-theme=light] :is(#app,#modal-root) .searchbox input{background:transparent;border:0;box-shadow:none}
html[data-theme=light] :is(#app,#modal-root) .searchbox:focus-within{border-color:var(--light-focus);box-shadow:0 0 0 2px var(--light-shadow)}
html[data-theme=light] .switch{background:#b7c7ba}html[data-theme=light] .switch.on{background:var(--light-accent)}html[data-theme=light] .switch:after{background:#fff}

html[data-theme=light] .modal-backdrop{background:#27392d70}
html[data-theme=light] :is(.payment-option,.payment-choice,.search-result,.wizard-card,.wizard-category,.wizard-brand,.device-card,.garment-basics,.garment-designer,.garment-size-editor,.garment-multi-prices,.clothing-prices-editor,.garment-type,.garment-side-tabs button,.garment-palette-item,.garment-stage,.repair-workspace-form,.repair-chat,.repair-chat-header,.print-detail-panel,.print-detail-modal .clothing-diagrams,#edit-print-order .notice,#edit-print-order .edit-order-intro,.print-chat-message,.clothing-diagram-side,.print-detail-modal .clothing-diagram-side,.print-detail-modal .clothing-diagram-legend li){background:var(--panel2);border-color:var(--line);color:var(--text)}
html[data-theme=light] :is(.wizard-card:hover,.wizard-card:has(input:checked),.wizard-category:hover,.wizard-brand:hover,.garment-type:hover,.garment-palette-item:hover:not(:disabled),.technician-picker-option:hover,.technician-picker-option:focus-visible,#cart .customer-choice-option:hover,#cart .customer-choice-option:focus-visible){background:var(--light-accent-soft);border-color:var(--light-accent);color:var(--text)}
html[data-theme=light] :is(.wizard-combined-device .wizard-brand[aria-pressed=true],.technician-picker-option[aria-selected=true],#cart .customer-choice-option[aria-selected=true],.garment-type[aria-pressed=true],.print-choice[aria-pressed=true]){background:var(--light-accent-soft);border-color:var(--light-accent);color:var(--light-accent)}
html[data-theme=light] :is(.repair-steps button,.repair-steps button.done,.wizard-category strong,.wizard-brand strong){color:var(--text)}
html[data-theme=light] .repair-steps button.active{background:var(--light-accent);color:#fff}
html[data-theme=light] :is(.print-intake-footer,.repair-workspace-form .modal-actions,.print-detail-actions,#edit-print-order .modal-actions){background:var(--panel);border-color:var(--line)}
html[data-theme=light] :is(.notice,.cashier-training-tip){background:var(--light-warm);border-color:#ddc9a5;color:#67491f}
html[data-theme=light] :is(.print-detail-panel span,.print-detail-panel small,.print-detail-panel label,.print-detail-modal .clothing-diagrams>p,.print-detail-modal .clothing-diagram-side figcaption,.print-detail-modal .clothing-diagram-legend small,.print-detail-modal .print-line-breakdown,.print-detail-modal .print-line-breakdown span,.print-chat-heading span,.print-chat-empty,.print-chat-meta time,.print-chat-form label,#edit-print-order label:not(.consent-row),#edit-print-order .edit-order-intro small,#edit-print-order .edit-print-line>p,.repair-chat-placeholder,.repair-chat-compose label,.repair-chat-message time){color:var(--muted)}
html[data-theme=light] :is(.print-detail-panel strong,.print-detail-modal .print-line-breakdown strong,.print-chat-message p,.print-chat-meta strong,#edit-print-order h3,#edit-print-order .edit-order-intro strong,#edit-print-order .edit-print-line>strong,.repair-chat-message,.repair-chat-message strong){color:var(--text)}
html[data-theme=light] :is(.print-chat-message.is-own,.repair-chat-message.is-mine){background:var(--light-warm);border-color:var(--line);color:var(--text)}
html[data-theme=light] #edit-print-order :is(input:not([type=checkbox]),select,textarea){background:var(--panel);border-color:var(--line);color:var(--text);color-scheme:light}
html[data-theme=light] #edit-print-order .edit-order-info{background:var(--light-accent-soft);color:var(--text)}
html[data-theme=light] .receipt-preview-stage{background:#edf0ec}
/* Receipt paper intentionally retains its own white background and dark text. */

html[data-theme=light] .trend-calendar{background:var(--panel);border-color:var(--line);color:var(--text);box-shadow:0 14px 35px #24382d3b}
html[data-theme=light] :is(.trend-calendar-head strong,.trend-calendar-day){color:var(--text)}
html[data-theme=light] :is(.trend-calendar-nav,.trend-calendar-time,.trend-calendar-actions button){background:var(--panel2);border-color:var(--line);color:var(--text);color-scheme:light}
html[data-theme=light] :is(.trend-calendar-day:hover:not(:disabled),.trend-calendar-nav:hover,.trend-calendar-actions button:hover:not(:disabled)){background:var(--light-accent-soft)}
html[data-theme=light] :is(.trend-calendar-day.is-selected,.trend-calendar-actions .trend-calendar-apply){background:var(--light-accent);border-color:var(--light-accent);color:#fff}
html[data-theme=light] :is(.trend-calendar-weekdays,.trend-calendar-day:disabled){color:var(--muted)}
html[data-theme=light] .nav-scroll-wrap::after{background:linear-gradient(to bottom,transparent,var(--panel) 80%);color:var(--light-accent)}
html[data-theme=light] .pos-category-wrap::before{background:linear-gradient(to left,transparent,var(--panel2) 80%);color:var(--light-accent)}
html[data-theme=light] .pos-category-wrap::after{background:linear-gradient(to right,transparent,var(--panel2) 80%);color:var(--light-accent)}
html[data-theme=light] :is(.technician-picker-option,#cart .customer-choice-option){color:var(--text)}
html[data-theme=light] #cart .customer-choice-trigger{color:var(--text)}
html[data-theme=light] #cart .customer-choice-enhanced>svg,html[data-theme=light] #cart .customer-choice-enhanced>[data-action=pos-customer]{color:var(--light-accent)}
html[data-theme=light] #cart .customer-choice-arrow{border-color:var(--muted)}
html[data-theme=light] #cart .customer-choice-option[aria-selected=true]::after{color:var(--light-accent)}
html[data-theme=light] .font-picker-panel>label,html[data-theme=light] .font-picker-preview span{color:var(--muted)}
html[data-theme=light] .font-picker-mark{color:var(--light-accent)}
html[data-theme=light] .technician-picker-option[aria-selected=true]::after{color:var(--light-accent)}
html[data-theme=light] .technician-picker-arrow{border-color:var(--muted)}
html[data-theme=light] :is(.repair-workspace-form .intake-new-customer[open],.wizard-parts-panel,.font-picker-preview,.garment-format-thumb,.garment-context-menu,.clothing-diagrams,.clothing-diagram-side){background:var(--panel2);border-color:var(--line);color:var(--text)}
html[data-theme=light] :is(.repair-workspace-form .ticket-extra>summary,.repair-workspace-form .intake-new-customer summary,.wizard-category-arrow,.print-detail-modal .clothing-diagram-legend b,#edit-print-order .edit-order-id){color:var(--light-accent)}
html[data-theme=light] :is(.clothing-diagrams>p,.clothing-diagram-group>strong,.clothing-diagram-side figcaption,.clothing-diagram-legend,.clothing-diagram-legend b,.clothing-diagram-legend small){color:var(--muted)}
html[data-theme=light] :is(.wizard-combined-device h3,.wizard-repair-layout h3){color:var(--text)}
html[data-theme=light] :is(.auth-story,.auth-preview,.auth-mini-card,.role-cards article){background:var(--panel);border-color:var(--line);color:var(--text);box-shadow:0 10px 30px var(--light-shadow)}
html[data-theme=light] :is(.auth-intro>p,.auth-subtitle,.auth-preview-head>span,.auth-preview-grid>div>small,.auth-mini-card span,.auth-preview-foot,.auth-story footer){color:var(--muted)}
html[data-theme=light] :is(.auth-intro .eyebrow,.auth-step){color:var(--light-accent)}
html[data-theme=light] :is(.wizard-category-art,.wizard-category:hover .wizard-category-art){color:var(--light-accent);background:var(--light-accent-soft)}
html[data-theme=light] .wizard-parts-prompt{color:var(--muted);border-color:var(--line)}
html[data-theme=light] :is(.priority-toggle,.priority-toggle input:checked~.priority-state .priority-high){color:var(--text)}
html[data-theme=light] :is(.ticket:has(.priority-quick-toggle input:checked),.ticket.print-ticket:has(.print-priority-toggle[aria-checked=true])){animation-name:light-urgent-flash;color:var(--text)}
html[data-theme=light] :is(.data-table tbody tr:has(.priority-quick-toggle input:checked),.data-table tbody tr[data-print-context]:has(.print-priority-toggle[aria-checked=true])){animation-name:light-urgent-flash}
@keyframes light-urgent-flash{0%,100%{background:#fff1d8;box-shadow:0 0 0 0 #d89d4460}50%{background:#f7d69b;box-shadow:0 0 15px 3px #d89d4460}}
@media(prefers-reduced-motion:reduce){html[data-theme=light] :is(.ticket:has(.priority-quick-toggle input:checked),.ticket.print-ticket:has(.print-priority-toggle[aria-checked=true]),.data-table tbody tr:has(.priority-quick-toggle input:checked),.data-table tbody tr[data-print-context]:has(.print-priority-toggle[aria-checked=true])){animation:none;background:#fff1d8;color:var(--text)}}

/* Light surfaces need their own foregrounds: many workflows originally used
   fixed pale text designed for the dark theme. Keep status and receipt colour
   pairs independent from these scoped surface overrides. */
html[data-theme=light] :is(.modal .error,.negative,.trend-calendar-warning:not(:empty)){color:#a12732}
html[data-theme=light] :is(.positive,.stat-trend){color:#276647}
html[data-theme=light] :is(summary,.clothing-prices-editor>summary,.intake-reference-column .intake-new-customer summary,.print-chat-status,.print-detail-expand summary:before,.calendar-day small,.cashier-training-tip strong){color:var(--light-accent)}
html[data-theme=light] :is(.garment-basics h4,.garment-designer-tools>strong,.garment-size-editor>strong,.garment-size-editor #garment-size-total,.garment-multi-prices>strong,.garment-size-price-row>strong,#edit-print-order .consent-row){color:var(--text)}
html[data-theme=light] :is(.garment-basics small,.garment-designer-tools p,.garment-size-editor>p,.garment-multi-prices>p,.garment-size-price-row small,#print-form .garment-size-row label,#print-form .garment-size-price-row label,.garment-price,.garment-palette-item .garment-dimension,.garment-stage-caption,.clothing-prices-editor p,.clothing-prices-editor label,.wizard-part small,.voice-dialog-content p,.auth-form-wrap .field label,.intake-reference-column .field label,.cash-count-cell small,.caller-alert header small,.caller-alert p,.caller-device-list small){color:var(--muted)}
html[data-theme=light] :is(.garment-type[aria-pressed=true],.garment-side-tabs button[aria-pressed=true]){background:var(--light-accent-soft);border-color:var(--light-accent);color:var(--text)}
html[data-theme=light] .garment-side-tabs .side-count,html[data-theme=light] .garment-side-tabs button[aria-pressed=true] .side-count{color:var(--muted)}
html[data-theme=light] .pos-category-tabs .pos-category-button.active{background:var(--light-accent);color:var(--light-accent-fg)}
html[data-theme=light] .expanded-search-result{color:var(--text)}
html[data-theme=light] .expanded-search-result:is(:hover,:focus-visible){background:var(--light-accent-soft);color:var(--text)}
html[data-theme=light] .expanded-search-result small{color:var(--muted)}
html[data-theme=light] .expanded-search-result-plus{border-color:var(--line);color:var(--light-accent)}
html[data-theme=light] :is(.print-priority-toggle.is-high,.print-intake-priority:has(input:checked)){background:#fff0d5;border-color:#ba7a20;color:#6d430d}
html[data-theme=light] .repair-steps :is(span,button){border-color:var(--line);color:var(--muted)}
html[data-theme=light] .repair-steps :is(.done,button.done){color:var(--light-accent)}
html[data-theme=light] .repair-steps :is(.active,button.active){background:var(--light-accent);border-color:var(--light-accent);color:var(--light-accent-fg)}
html[data-theme=light] .repair-steps button.done:hover{background:var(--light-accent-soft);border-color:var(--light-accent)}
html[data-theme=light] .paid-ticket{background:#e5f4e8;border-color:#9ecfac;color:#276647}
html[data-theme=light] .shift-open{border-color:#84b995;color:#276647}
html[data-theme=light] .shift-closed{border-color:#dbaf6d;color:#79501a}
html[data-theme=light] .caller-customer{background:var(--panel2);border-color:var(--line);color:var(--text)}
html[data-theme=light] .caller-customer span,html[data-theme=light] .caller-dismiss{color:var(--light-accent)}
