:root {
  color-scheme: light;
  --theme-surface: #fffdf7;
  --theme-control: #fff;
  --theme-raised: #eee9de;
  --theme-button-ink: #151510;
  --theme-price: #81580a;
  --theme-danger: #a33333;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--theme-surface);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle .icon { width: 20px; height: 20px; }
.theme-toggle:hover { background: var(--theme-raised); }
.theme-toggle:focus-visible { outline: 3px solid #efb33c; outline-offset: 3px; }
.theme-sun { display: none; }
html[data-theme="dark"] .theme-sun { display: inline-flex; }
html[data-theme="dark"] .theme-moon { display: none; }
.site-header .theme-toggle, .detail-theme-toggle {
  color: #fff;
  background: rgba(17,16,13,.65);
  border-color: rgba(255,255,255,.34);
  backdrop-filter: blur(14px);
}
.site-header .theme-toggle:hover, .detail-theme-toggle:hover { background: #2f3028; }
.detail-theme-toggle { position: absolute; z-index: 2; top: 1rem; inset-inline-start: 1rem; }

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f1e8;
  --ink-soft: #e9e4d9;
  --paper: #151612;
  --paper-deep: #2b2d25;
  --card: #20211c;
  --cream: #2b2d25;
  --muted: #b6b5a8;
  --line: #393b32;
  --green: #a9bc8a;
  --accent: #efb33c;
  --amber: #efb33c;
  --amber-bright: #ffca50;
  --theme-surface: #20211c;
  --theme-control: #292b24;
  --theme-raised: #32352c;
  --theme-price: #ffce6b;
  --theme-danger: #ffac9a;
}
html[data-theme="dark"] body { background: var(--paper); color: var(--ink); }
html[data-theme="dark"] :is(.category-block,.product-detail,.cart-drawer,.cart-footer,.checkout-dialog,.filter-dialog,.sort-dialog,.filter-dialog-footer,.product-link-error,.no-results,.developer-toolbar,.editor-dialog,.editor-header,.editor-footer) {
  background: var(--theme-surface);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] .product-card { background: var(--theme-control); border-color: var(--line); }
html[data-theme="dark"] .product-card:hover { box-shadow: 0 1rem 2.4rem #0004; }
html[data-theme="dark"] .product-placeholder { background: var(--theme-control); color: var(--muted); }
html[data-theme="dark"] .category { color: var(--muted); }
html[data-theme="dark"] .category:hover { background: var(--theme-control); color: var(--ink); }
html[data-theme="dark"] :is(.category.active,.filter-badge,.filter-choice[aria-pressed=true],.editor-button.primary,.language-tabs button[aria-pressed=true],.admin-view-tabs button[aria-pressed=true]) {
  background: var(--amber-bright);
  color: var(--theme-button-ink);
  border-color: var(--amber-bright);
}
html[data-theme="dark"] :is(.button-primary,.filter-show,.cart-count) { color: var(--theme-button-ink); background: var(--amber-bright); }
html[data-theme="dark"] .button-primary:hover, html[data-theme="dark"] .editor-button.primary:hover { background: #ffd976; }
html[data-theme="dark"] .button-dark { background: var(--theme-control); color: var(--ink); border: 1px solid var(--line); }
html[data-theme="dark"] :is(.product-card strong,.product-hint b,.cart-item-copy>span,.detail-price-row strong,.editor-cover-label) { color: var(--theme-price); }
html[data-theme="dark"] .discount-label { background: #44351a; color: #ffda87; }
html[data-theme="dark"] :is(.size-select,.language-picker option,.collection-tool-button,.filter-choice,.filter-price-fields label>div,.checkout-fields input,.checkout-fields select,.checkout-fields textarea,.share-link-panel input,.editor-field input,.editor-field textarea,.editor-field select,.editor-search,.field input,.field textarea,.hours-row input[type=time],.operations-filter select,.order-state select) {
  color: var(--ink);
  background-color: var(--theme-control);
  border-color: var(--line);
}
html[data-theme="dark"] :is(input,textarea)::placeholder { color: var(--muted); opacity: 1; }
html[data-theme="dark"] .filter-choices .filter-choice[aria-pressed=true] { background: var(--amber-bright); color: var(--theme-button-ink); border-color: var(--amber-bright); }
html[data-theme="dark"] .size-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b6b5a8' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
html[data-theme="dark"] :is(.collection-tool-button:hover,.filter-choice:hover,.collection-tool-button.has-filters,.filter-price-fields label>div:focus-within) { border-color: var(--amber); }
html[data-theme="dark"] .collection-tool-button:hover { background: var(--theme-raised); }
html[data-theme="dark"] :is(.active-filter,.editor-preview,.editor-photo,.editor-list-row,.analytics-metric,.order-card summary) { background: var(--theme-control); border-color: var(--line); }
html[data-theme="dark"] :is(.filter-reset,.detail-thumbnail) { border-color: var(--line); }
html[data-theme="dark"] .filter-sale-toggle input { background: var(--theme-raised); border-color: #6f7362; }
html[data-theme="dark"] .filter-sale-toggle input:checked { background: var(--amber-bright); border-color: var(--amber-bright); }
html[data-theme="dark"] .filter-sale-toggle input:checked::after { background: var(--theme-button-ink); }
html[data-theme="dark"] .sort-options label:has(input:checked) { background: var(--theme-raised); border-color: var(--line); }
html[data-theme="dark"] :is(.sort-options input,.closed-toggle input,.editor-checkbox input) { accent-color: var(--amber-bright); }
html[data-theme="dark"] .detail-photos { background: var(--paper-deep); }
html[data-theme="dark"] .detail-thumbnail { background: var(--theme-surface); }
html[data-theme="dark"] .detail-thumbnail[aria-pressed=true] { background: #44351a; border-color: var(--amber-bright); }
html[data-theme="dark"] .detail-photo-open { background: rgba(32,33,28,.96); color: var(--ink); }
html[data-theme="dark"] .quantity button { background: var(--theme-control); }
html[data-theme="dark"] :is(.quantity button:hover,.circle-button:hover,.editor-button:hover,.editor-photo-action:hover) { background: var(--theme-raised); border-color: var(--line); }
html[data-theme="dark"] :is(.cart-remove:hover,.editor-error,.editor-confirm) { color: var(--theme-danger); background: #3b2420; border-color: #725044; }
html[data-theme="dark"] .editor-notice { color: #ffda87; background: #3c321d; border-color: #685433; }
html[data-theme="dark"] .editor-language-tabs button[aria-selected=true] { background: #44351a; border-color: var(--amber); }
html[data-theme="dark"] .developer-identity>span { background: var(--paper); }
html[data-theme="dark"] :is(.checkout-error,.filter-price-error,.filter-price-fields input[aria-invalid=true],.editor-button.danger,.editor-photo-action.remove,.operations-status[data-state=error],.save-bar p[data-state=error]) { color: var(--theme-danger); }
html[data-theme="dark"] :is(.operations-status[data-state=success],.save-bar p[data-state=success]) { color: #8dd8b1; }
html[data-theme="dark"] .visit-section { background: #10110e; }
html[data-theme="dark"] .visit-card { background: var(--theme-surface); }
html[data-theme="dark"] .mobile-actions button { background: var(--theme-control); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .mobile-actions a:first-child { color: var(--theme-button-ink); }
html[data-theme="dark"] .eyebrow { color: var(--green); }
html[data-theme="dark"] .visit-intro .eyebrow { color: var(--amber-bright); }
html[data-theme="dark"] .order-state-badge[data-state=new] { background: #44351a; color: #ffda87; }
html[data-theme="dark"] .order-state-badge[data-state=completed] { background: #203d2e; color: #8dd8b1; }
html[data-theme="dark"] :is(.filter-dialog,.sort-dialog,.checkout-dialog,.product-detail)::backdrop { background: #000a; }

@media (max-width:1150px) {
  .site-header { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: .75rem; }
  .site-header .site-search { grid-column: 1 / -1; width: 100%; }
}
@media (max-width:820px) {
  .site-header .header-tools { gap: .5rem; margin-inline-start: 0; }
  .site-header nav { display: none; }
  .site-header .brand-logo { width: min(100%,clamp(120px,38vw,190px)); }
  html[dir="rtl"] .site-header .header-tools { margin-right: 0; }
  .admin-header { flex-wrap: wrap; }
  .admin-header .header-actions { gap: .65rem; flex-wrap: wrap; }
}
@media (max-width:380px) {
  .site-header .brand-logo { width: min(100%,112px); height: 38px; }
  .site-header .language-picker select { max-width: 6.2rem; }
  .site-header .header-tools { gap: .4rem; }
  .admin-header .header-actions { width: 100%; justify-content: space-between; }
}
@media (forced-colors:active) {
  html[data-theme="dark"] .size-select { appearance: auto; background-image: none; }
  .theme-toggle { border: 1px solid ButtonText; }
}
