/* Both the shop and the account pages use these same color roles. */
@media screen {
  :root, :root[data-theme="light"]:not([data-mini-theme]), :root[data-mini-theme="light"], .appearance-chip.light {
    color-scheme: light;
    --paper: #f5f5f5; --white: #fff; --nav: #fff; --input: #fff;
    --ink: #121212; --sub: #4d4d4d; --muted: #595959; --text-secondary: #424242;
    --line: #d8d8d6; --raised: #f0f0ee; --hover: #eaeae8;
    --accent: #3d5d70; --accent-fill: #3d5d70; --on-accent: #fff;
    --accent-light: #e8eef1; --accent-border: #7d99aa; --focus: #3d5d70;
    --warm: var(--ink); --chart: #767676; --brand-detail: var(--on-accent);
    --backdrop: #13131366; --toast-bg: #262626; --mobile-nav: var(--nav);
    --shadow: #0000000b; --af-shadow: 0 2px 8px var(--shadow);
    --green: #356046; --positive: #315a40; --green-light: #edf3ee;
    --danger: #97293a; --danger-bg: #fcecef; --danger-border: #dda4ad;
    --danger-fill: #a62a3d; --on-danger: #fff;
    --warning: #715010; --yellow: #fff2d1; --warning-border: #bd8f36;
  }
  :root[data-theme="dark"]:not([data-mini-theme]), :root[data-mini-theme="dark"], .appearance-chip.dark {
    color-scheme: dark;
    --paper: #0c0c0c; --white: #1a1a1a; --nav: #121212; --input: #171717;
    --ink: #f7f7f7; --sub: #c3c3c1; --muted: #aaa; --text-secondary: #d1d1ce;
    --line: #404040; --raised: #262626; --hover: #303030;
    --accent: #b2c9df; --accent-fill: #89a7c5; --on-accent: #101820;
    --accent-light: #253344; --accent-border: #66839f; --focus: #a8c1d9;
    --chart: #a5a5a5; --backdrop: #0009; --toast-bg: #303030; --toast-ink: var(--ink);
    --shadow: #0002; --green: #a0c2aa; --positive: #b1cbb8; --green-light: #243129;
  }
  :root[data-theme="blueprint"]:not([data-mini-theme]), :root[data-mini-theme="blueprint"], .appearance-chip.blueprint {
    color-scheme: light;
    --paper: #e3ecf2; --white: #fcfdfe; --nav: #dbe7ef; --input: #fff;
    --ink: #142c3c; --sub: #3e5466; --muted: #496174; --text-secondary: #344f63;
    --line: #aebfcb; --raised: #dbe7ee; --hover: #d7e5ee;
    --accent: #276272; --accent-fill: #276272; --on-accent: #fff;
    --accent-light: #d6e7e9; --accent-border: #759ea8; --focus: #276272;
    --chart: #3e6c88; --backdrop: #10243170; --toast-bg: #223e51;
    --shadow: #243d5012;
  }
  :root[data-theme="wine"]:not([data-mini-theme]), :root[data-mini-theme="wine"], .appearance-chip.wine {
    color-scheme: light;
    --paper: #f6f0ee; --white: #fffdfc; --nav: #fffbfa; --input: #fffdfc;
    --ink: #281820; --sub: #644e58; --muted: #705964; --text-secondary: #513744;
    --line: #dfcdd3; --raised: #f0e3e7; --hover: #f5e3eb;
    --accent: #714668; --accent-fill: #714668; --on-accent: #fff;
    --accent-light: #f0e2ed; --accent-border: #a382a0; --focus: #714668;
    --chart: #a45076;
    --backdrop: #25131f70; --toast-bg: #431c31;
    --shadow: #51223c10;
  }
  :root[data-theme="amber"]:not([data-mini-theme]), :root[data-mini-theme="amber"], .appearance-chip.amber {
    color-scheme: dark;
    --paper: #101217; --white: #191d24; --nav: #0d1016; --input: #12161d;
    --ink: #f5f0e8; --sub: #ccc3b6; --muted: #aaa194; --text-secondary: #e9decd;
    --line: #3c3c42; --raised: #242831; --hover: #2d3036;
    --accent: #e4ae8d; --accent-fill: #c99270; --on-accent: #20130e;
    --accent-light: #382c28; --accent-border: #a5765f; --focus: #e0a886;
    --chart: #d6a052; --backdrop: #05070bb3; --toast-bg: #312819; --toast-ink: var(--ink);
    --shadow: #0004; --green: #a9d4b9; --positive: #a9d4b9; --green-light: #22352a;
  }
  :root[data-theme="cobalt"]:not([data-mini-theme]), :root[data-mini-theme="cobalt"], .appearance-chip.cobalt {
    color-scheme: light;
    --paper: #e6eefb; --white: #fbfdff; --nav: #ecf3ff; --input: #fff;
    --ink: #132955; --sub: #405880; --muted: #4c6286; --text-secondary: #294a80;
    --line: #c0d1ee; --raised: #d9e6fa; --hover: #e3edff;
    --accent: #254e97; --accent-fill: #2859ac; --on-accent: #fff;
    --accent-light: #d9e7ff; --accent-border: #7294cb; --focus: #2859ac;
    --chart: #356dc6; --backdrop: #10265380; --toast-bg: #1a3977;
    --shadow: #16366d18;
  }

  /* Dark surfaces share semantic colors, including the dark chrome of light themes. */
  :root:is([data-theme="dark"]:not([data-mini-theme]), [data-mini-theme="dark"],
           [data-theme="amber"]:not([data-mini-theme]), [data-mini-theme="amber"]),
  :root:is([data-theme="blueprint"]:not([data-mini-theme]), [data-mini-theme="blueprint"]) .workspace > header,
  :root:is([data-theme="cobalt"]:not([data-mini-theme]), [data-mini-theme="cobalt"]) :is(.workspace > header, .sidebar, .bottom-nav) {
    --danger: #ffacb0; --danger-bg: #3c272a; --danger-border: #a7636d;
    --danger-fill: #dd787f; --on-danger: #261012;
    --warning: #f1cd77; --yellow: #3c3220; --warning-border: #a08243;
  }

  #nav button.active, .af-category.active,
  .af-category.active small, .af-add, .af-mobile-cart, .sale-mobile-cart,
  #product-drawer .pc-sale, #product-drawer .af-detail-tabs button.active {
    color: var(--on-accent);
  }
  #nav .nav-item.active .count {background:color-mix(in srgb,var(--ink) 12%,transparent);color:var(--ink)}
  #nav button.active,.button.primary,.af-category.active,.af-mobile-cart {box-shadow:none}
  :root:is([data-theme="blueprint"]:not([data-mini-theme]), [data-mini-theme="blueprint"]) .workspace > header {
    --nav: #223746; --white: #294656; --raised: #304b5c; --hover: #385465;
    --ink: #f2f6f8; --sub: #c4d5df; --muted: #c4d5df; --warm: var(--ink);
    --line: #5e788b; --positive: #c0e0c9; --accent: #b8d8db;
    --accent-fill: #a3c3c9; --on-accent: #102931; --focus: #a3c3c9;
    color: var(--ink);
  }
  :root:is([data-theme="cobalt"]:not([data-mini-theme]), [data-mini-theme="cobalt"]) :is(.workspace > header, .sidebar, .bottom-nav) {
    --nav: #102952; --mobile-nav: var(--nav); --white: #1c3c72; --raised: #1b3768; --hover: #22447e;
    --ink: #f1f6ff; --warm: var(--ink); --sub: #becfef; --muted: #b3c7eb;
    --line: #39598b; --accent: #b4d2ff; --accent-fill: #98b9ee; --on-accent: #10234a;
    --accent-light: #244783; --accent-border: #557ab8; --focus: #a8cbff;
    --positive: #a9ddbf;
    color: var(--ink);
  }
  :root:is([data-theme="blueprint"]:not([data-mini-theme]), [data-mini-theme="blueprint"]) :is(.table-wrap, .af-products-table) th,
  :root:is([data-theme="cobalt"]:not([data-mini-theme]), [data-mini-theme="cobalt"]) :is(.table-wrap, .af-products-table) th {letter-spacing:.025em}
}
/* Native radios keep keyboard navigation and expose the selected palette. */
.appearance-options {
  min-width:0;
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,9rem),1fr));
  gap:8px;
  margin:0;
  padding:0;
  border:0;
}
.appearance-options legend { margin-bottom:12px; font-weight:600; }
.appearance-choice {
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
  min-height:var(--ui-control-height,44px);
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:var(--ui-control-radius,10px);
  background:var(--white);
  color:var(--ink);
  font-size:var(--ui-text,14px);
  cursor:pointer;
}
.appearance-choice input {
  flex:none;
  width:1.1em;
  height:1.1em;
  margin:0;
  accent-color:var(--accent-fill);
}
.appearance-choice:has(:checked) {
  border-color:var(--accent);
  background:var(--accent-light);
  font-weight:650;
}
.appearance-choice:has(:focus-visible) { outline:2px solid var(--focus); outline-offset:2px; }
.appearance-choice:has(:focus-visible) input:focus-visible { outline:none; }
.appearance-chip {
  width:26px;
  height:18px;
  flex:none;
  border:1px solid var(--accent-border);
  border-radius:4px;
  background:linear-gradient(90deg,var(--paper) 0 36%,var(--ink) 36% 58%,var(--accent-fill) 58%);
}
.appearance-settings { margin:0 0 var(--ui-gap); }
.appearance-settings legend { font-size:var(--ui-section); }
.appearance-settings p { max-width:64ch; margin:12px 0 0; color:var(--sub); line-height:1.5; }
@media (hover:hover) and (pointer:fine) {
  .appearance-choice:not(:has(:checked)):hover { background:var(--hover); }
}

@media screen {
  .sale-package.selected {box-shadow:0 0 0 1px var(--accent-fill)}
  .sale-cart-backdrop:not([hidden]),#product-drawer::backdrop {background:var(--backdrop)}
  .pc-photo-dots .active i {background:var(--accent-fill);outline:1px solid var(--ink)}
  .factory-sheet .factory-designation {border-bottom-color:var(--focus)}
  .factory-sheet .factory-callout {border-color:var(--accent-border);background:var(--white);color:var(--ink)}
  .factory-sheet .factory-callout[aria-pressed=true],#factory-reader tr.selected,
  .technical-hotspot.selected {background:var(--accent-fill);color:var(--on-accent)}
  .factory-sheet .factory-designation[aria-pressed=true] {
    border-color:var(--focus);background:color-mix(in srgb,var(--focus) 18%,transparent);
  }
}

@media screen {
  [data-workspace-pane="settings"][data-view="appearance"] {
    display:grid;
    align-items:start;
    grid-template-columns:minmax(0,1fr);
    gap:var(--ui-gap);
  }
  .appearance-settings { min-width:0; margin-block:0; }
  .appearance-settings .checkbox { margin-top:var(--ui-gap); min-height:var(--ui-control-height); }
  .appearance-options { grid-template-columns:repeat(auto-fit,minmax(min(100%,8.25rem),1fr)); }
  .simple-mode .appearance-options { grid-template-columns:repeat(auto-fit,minmax(min(100%,10rem),1fr)); }
}
@media screen and (min-width:1100px) {
  [data-workspace-pane="settings"][data-view="appearance"] {
    grid-template-columns:minmax(0,2fr) minmax(15rem,1fr);
  }
}
