:root {
  --success: #4ade80; --warning: #fbbf24; --info: #818cf8;
  --pink: #f9a8d4; --pink-text: #fbcfe8; --error-text: #fecdd3;
  --subtle: rgba(255,255,255,.03);
}
:root[data-theme="light"] {
  --bg0: #f7f9fc; --bg1: #ffffff; --surface: #edf2f7; --surface-hover: #e0e8f0;
  --border: rgba(15,23,42,.13); --border-strong: rgba(15,23,42,.25);
  --text: #172335; --muted: #526175; --accent: #087568;
  --accent-dim: rgba(8,117,104,.12); --accent-text: #ffffff;
  --danger: #be2545; --danger-bg: rgba(190,37,69,.09);
  --shadow: 0 12px 30px rgba(15,23,42,.09);
  --success: #18703d; --warning: #865700; --info: #5145b0;
  --pink: #a02f6a; --pink-text: #95285f; --error-text: #a61e3d;
  --subtle: rgba(15,23,42,.04);
}
.theme-tools { display:flex; justify-content:flex-end; padding:.6rem 1rem; max-width:1240px; margin:0 auto; }
.theme-toggle { display:inline-flex; align-items:center; gap:.4rem; min-height:44px; padding:.45rem .75rem; border:1px solid var(--border-strong, #657670); border-radius:10px; background:var(--bg1, #fff); color:var(--text, #20342f); font:inherit; cursor:pointer; white-space:nowrap; }
.warehouse-home-button { text-decoration:none; }
.theme-toggle:focus-visible { outline:3px solid var(--accent, #16634c); outline-offset:3px; }
:root[data-theme="light"] a { color:var(--accent); }
:root[data-theme="light"] .btn-secondary:hover { background:var(--surface-hover); }
/* The standalone 3D workspace keeps its light scene/material colors; only UI chrome follows the theme. */
:root[data-theme="dark"] body[data-warehouse-write] { --ink:#eef1f6; --muted:#a2adbd; --line:#394354; --accent:#5eead4; background:#0c0e12; color:var(--ink); }
:root[data-theme="dark"] body[data-warehouse-write] :is(header,aside,dialog,button,input,select,#editor-controls,#box-editor,#box-tooltip,#explorer,#warehouse-guide,#warehouse-panel,#message,#status,#error,.toolbar,.hint,.boxlabel) { background:#12151c; color:var(--ink); border-color:var(--line); }
:root[data-theme="dark"] body[data-warehouse-write] button.active { background:#16634c; color:#fff; }
body[data-warehouse-write] .warehouse-header-actions { display:flex; align-items:center; gap:12px; margin-left:auto; order:2; }
body[data-warehouse-write] .theme-toggle { font-size:12px; padding:6px 8px; }
@media(max-width:780px) {
  body[data-warehouse-write] header { height:164px; align-content:flex-start; }
  body[data-warehouse-write] .warehouse-header-actions { order:0; }
  body[data-warehouse-write] header h1 { order:-1; }
  body[data-warehouse-write] header nav { order:1; }
  body[data-warehouse-write] #outbound-open { order:2; }
  body[data-warehouse-write] main { height:calc(100dvh - 164px); }
}
