*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ================================================================
   DARK THEME — Industrial Amber
   Colors: dark only. All other styling matches light.
   ================================================================ */
:root {
  --bg: #0b0e14; --panel-bg: #0f1219; --surface: #141820;
  --border: #1e2330; --text: #c4ccd6; --text-muted: #7a8494;
  --text-bright: #dde2e8; --accent: #d2991d; --accent-hover: #e8b830;
  --danger: #e0556a; --green: #3fb950;
  --font: 'Segoe UI', "Microsoft YaHei", sans-serif;
  --font-mono: 'Consolas', 'Source Code Pro', monospace;
}

body {
  font-family: var(--font); font-size: 13px; background: var(--bg);
  color: var(--text); overflow: hidden; height: 100vh;
  display: flex; flex-direction: column; user-select: none;
}

/* ---- Toolbar ---- */
#top-toolbar {
  height: 44px; background: #0a0d12;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 14px; flex-shrink: 0;
}
.app-logo { height: 26px; }
.app-title { font-weight: 600; font-size: 14px; color: var(--text-bright); letter-spacing: 0.5px; font-family: var(--font); }
.toolbar-spacer { flex: 1; }

/* ---- Buttons ---- */
.btn-primary {
  min-height: 32px; padding: 7px 18px; background: var(--accent); color: #0b0e14;
  border: 1px solid transparent; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 700;
  font-family: var(--font); transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(210,153,29,0.15);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 2px 8px rgba(210,153,29,0.25); transform: translateY(-1px); }
.btn-primary:disabled { background: #1a1e26; color: #3a3f4b; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-small {
  min-height: 30px; padding: 6px 13px; background: #111722; color: var(--text);
  border: 1px solid #2c3444; border-radius: 4px; cursor: pointer; font-size: 12px;
  font-weight: 600; font-family: var(--font); line-height: 1.2; transition: all 0.2s;
}
.btn-small:hover { background: rgba(210,153,29,0.04); border-color: var(--accent); color: var(--accent); }
.btn-small:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-danger { color: var(--danger); border-color: #3a1a20; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger-primary {
  min-height: 32px; padding: 7px 18px; background: var(--danger); color: #fff;
  border: 1px solid transparent; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 700;
  font-family: var(--font); transition: all 0.2s; box-shadow: 0 1px 3px rgba(224,85,106,0.16);
}
.btn-danger-primary:hover { filter: brightness(1.06); box-shadow: 0 2px 8px rgba(224,85,106,0.24); transform: translateY(-1px); }
.btn-add { color: var(--accent); font-weight: 700; }
.btn-pack-big {
  width: calc(100% - 24px); margin: 10px 12px; padding: 12px;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
  font-family: var(--font); border-radius: 6px;
}
.search-box { position: relative; }
.search-dropdown {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 99;
  background: #0f1219; border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 6px 6px; max-height: 200px; overflow-y: auto; list-style: none; margin: 0; padding: 0;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.search-dropdown.show { display: block; }
.search-dropdown li {
  padding: 7px 12px; cursor: pointer; font-size: 12px; color: var(--text);
  border-bottom: 1px solid rgba(30,35,48,0.5); font-family: var(--font);
}
.search-dropdown li:hover { background: rgba(210,153,29,0.06); color: var(--accent); }
.search-dropdown li.selected { background: rgba(210,153,29,0.1); color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--border); background: rgba(255,255,255,0.02); }

/* ---- Layout ---- */
#main-layout { display: flex; flex: 1; overflow: hidden; }
#left-panel {
  width: 340px; min-width: 280px; max-width: 420px; flex-shrink: 0;
  background: var(--panel-bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
  max-height: 100%;
  transition: width 0.2s, min-width 0.2s, padding 0.2s;
}
#left-panel.collapsed { flex: 0 0 0 !important; width: 0; min-width: 0; max-width: 0; border-right: none; overflow: hidden; padding: 0; margin: 0; visibility: hidden; }
#panel-inner { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* ---- Tabs ---- */
.tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.tab {
  flex: 1; padding: 10px 4px; background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 12px; font-weight: 500;
  border-bottom: 2px solid transparent; font-family: var(--font);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-content { flex-shrink: 0; }
.tab-content.hidden { display: none; }
.table-toolbar { padding: 4px 8px; }
.table-wrap { max-height: 180px; overflow-y: auto; margin: 0 6px; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 11px; font-family: var(--font); }
thead { position: sticky; top: 0; z-index: 1; }
th {
  background: #0f1219; padding: 5px 4px; text-align: left;
  color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border);
  white-space: nowrap; font-size: 10px;
}
td {
  padding: 4px 4px; border-bottom: 1px solid rgba(30,35,48,0.4);
  white-space: normal; overflow: visible; text-overflow: clip;
  max-width: 150px; overflow-wrap: anywhere; word-break: break-word;
}
td:last-child { min-width: 72px; }
tr.row-item { cursor: pointer; }
tr.row-item:hover { background: rgba(210,153,29,0.03); }
td .btn-small { min-height: 24px; padding: 3px 8px; font-size: 11px; opacity: .9; }
tr.row-item:hover td .btn-small { opacity: 1; }
.data-panel { border-top: 1px solid var(--border); margin-top: 6px; flex-shrink: 0; }

/* ---- Wizard Steps ---- */
.wizard-step {
  display: flex; gap: 10px; padding: 12px 10px;
  border-bottom: 1px solid rgba(30,35,48,0.3);
}
.wizard-step:hover { background: rgba(210,153,29,0.02); }
.step-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #0b0e14;
  font-size: 12px; font-weight: 700; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; margin-top: 1px;
  font-family: var(--font); box-shadow: 0 2px 6px rgba(210,153,29,0.2);
}
.step-body { flex: 1; min-width: 0; }
.step-hint { font-size: 10px; color: var(--text-muted); padding: 3px 0 0 4px; font-family: var(--font); }

/* ---- Config ---- */
.section-title {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  letter-spacing: 1px; padding: 12px 10px 6px; flex-shrink: 0;
  font-family: var(--font);
}
.config-area { padding: 0 8px; flex-shrink: 0; }
.config-row { display: flex; align-items: center; margin-bottom: 6px; gap: 6px; min-width: 0; }
.config-row label {
  width: 56px; font-size: 11px; color: var(--text-muted); flex-shrink: 0;
  text-align: right; font-family: var(--font);
}
.config-row select, .config-row input {
  flex: 1; min-width: 60px; padding: 6px 8px; background: #0b0e14;
  border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-size: 12px;
  font-family: var(--font); transition: border-color 0.2s;
}
.config-row select:focus, .config-row input:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px rgba(210,153,29,0.08);
}
.config-row input[readonly] { background: #0a0d12; color: var(--text-muted); }
.validation-msg {
  padding: 6px 10px; margin: 4px 0; background: rgba(224,85,106,0.05);
  border-left: 3px solid var(--danger); border-radius: 0 4px 4px 0; color: var(--danger); font-size: 10px; font-family: var(--font);
}
.validation-msg.hidden { display: none; }
.unit-inline { font-size: 9px; color: var(--text-muted); flex-shrink: 0; font-family: var(--font); }

/* ---- Result ---- */
#result-area {
  margin: 8px 12px; padding: 16px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; min-height: 50px; flex-shrink: 0;
}
.result-placeholder { color: var(--text-muted); font-size: 12px; text-align: center; padding: 18px; font-family: var(--font); }

.result-table { font-family: var(--font); font-size: 12px; }
.led { display: inline-block; padding: 2px 8px; background: rgba(210,153,29,0.1); color: var(--accent); font-weight: 700; font-size: 14px; font-family: var(--font-mono); }
.led.green { background: rgba(63,185,80,0.08); color: var(--green); }
.led.red { background: rgba(224,85,106,0.1); color: var(--danger); }
.led-unit { font-size: 12px; color: var(--text-muted); margin-left: 2px; font-family: var(--font); }
.dot-row { display: flex; align-items: baseline; margin: 4px 0; font-size: 11px; color: var(--text-muted); }
.dot-row .dot-fill { flex: 1; border-bottom: 1px dotted #1e2330; margin: 0 10px 4px; min-width: 20px; }
.big-num { text-align: center; font-size: 30px; font-weight: 700; color: var(--text-bright); font-family: var(--font-mono); line-height: 1.1; }
.big-unit { font-size: 13px; color: var(--text-muted); font-weight: 400; }
.sub-row { text-align: center; font-size: 11px; color: var(--text); margin: 4px 0; }
.sub-row .hl { color: var(--accent); font-weight: 700; }
.sub-row .hl.alt { color: #e0a050; }
.weight-bar { text-align: center; margin: 6px 0; }
.weight-bar .limit-hint { font-size: 12px; color: var(--text-muted); }
.section-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 2px; margin: 4px 0; font-family: var(--font); text-align: center; }
.result-table .divider { border: none; border-top: 1px dashed #1e2330; margin: 10px 0; }
.result-table .divider-solid { border: none; border-top: 1px solid #2d333b; margin: 10px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-item { text-align: center; padding: 8px; background: rgba(210,153,29,0.04); border: 1px solid rgba(210,153,29,0.08); border-radius: 4px; }
.grid-item .gval { font-size: 22px; font-weight: 700; color: var(--accent); font-family: var(--font-mono); line-height: 1.2; }
.grid-item .glbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.grid-item .gsub { font-size: 10px; color: var(--text); font-family: var(--font); margin-top: 2px; }
.grid-item.dim { background: rgba(85,93,107,0.06); border-color: rgba(85,93,107,0.08); }
.grid-item.dim .gval { color: var(--text-muted); }

.error-card {
  padding: 10px 12px; background: rgba(224,85,106,0.04);
  border: 1px solid rgba(224,85,106,0.2); border-left: 2px solid var(--danger);
  color: var(--danger); font-size: 11px; line-height: 1.5; font-family: var(--font);
}
.error-card .error-level { font-weight: 700; margin-bottom: 3px; }
.error-card .error-hint { color: var(--text-muted); margin-top: 4px; font-size: 10px; }
.result-actions { display: flex; gap: 6px; padding: 6px 10px; flex-shrink: 0; }
.result-actions.hidden { display: none; }

/* ---- Canvas ---- */
#canvas-container {
  flex: 1; position: relative; overflow: hidden; min-width: 0;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(210,153,29,0.02) 0%, transparent 60%),
    linear-gradient(180deg, #0f1219 0%, #0b0e14 100%);
  touch-action: none; -webkit-user-select: none;
}
#canvas-container canvas {
  display: block; position: absolute; top: 0; left: 0;
}
#canvas-container:fullscreen { background: #0b0e14; padding: 16px; }

/* ---- Light Panel ---- */
.light-panel {
  position: absolute; top: 12px; right: 12px; z-index: 100; min-width: 200px;
  background: rgba(15,18,25,0.94); border: 1px solid rgba(210,153,29,0.12);
  border-radius: 8px; padding: 0; overflow: hidden; font-size: 9px;
  backdrop-filter: blur(8px); box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.light-panel .lp-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 12px; color: var(--accent); font-weight: 600;
  font-size: 11px; font-family: var(--font);
  border-bottom: 1px solid rgba(210,153,29,0.08); user-select: none;
}
.light-panel .lp-toggle {
  min-width: 26px; min-height: 24px; background: rgba(255,255,255,0.02); border: 1px solid transparent; border-radius: 4px; color: var(--text);
  cursor: pointer; font-size: 18px; padding: 0 6px; font-family: var(--font);
}
.light-panel .lp-toggle:hover { color: var(--accent); border-color: var(--accent); }
.light-panel .lp-body { padding: 4px 12px 10px; }
.light-panel .lp-section {
  color: var(--accent); font-size: 9px; font-weight: 600;
  margin: 8px 0 3px; padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.03); font-family: var(--font);
}
.light-panel .lp-row { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.light-panel .lp-row label { width: 48px; color: var(--text-muted); font-size: 10px; flex-shrink: 0; font-family: var(--font); }
.light-panel .lp-row input[type=range] { flex: 1; height: 14px; accent-color: var(--accent); background: rgba(255,255,255,0.03); border-radius: 7px; }
.light-panel .lp-row input[type=color] { width: 24px; height: 20px; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; padding: 0; background: none; }
.light-panel .lp-val, .light-panel .lp-hex { width: 52px; text-align: right; color: var(--text); font-size: 9px; flex-shrink: 0; font-family: var(--font-mono); }
.lp-vis-row { display: flex; gap: 10px; }
.lp-vis-left, .lp-vis-right { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.vis-check { display: flex; align-items: center; gap: 4px; cursor: pointer; font-size: 11px; color: var(--text); font-family: var(--font); }
.vis-check input { accent-color: var(--accent); width: 12px; height: 12px; }
.lp-color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; }
.lp-color-grid .lp-row label { width: 40px; font-size: 9px; }
.light-panel .lp-btns { display: flex; gap: 6px; margin-top: 8px; padding-top: 7px; border-top: 1px solid rgba(255,255,255,0.03); }
.light-panel .lp-btns button { flex: 1; font-size: 11px; padding: 5px 8px; }
.light-panel.collapsed .lp-body { display: none; }

/* ---- View Toggle ---- */
.view-toggle.floating {
  position: absolute; top: 12px; left: 12px; z-index: 50;
  display: flex; flex-direction: column; gap: 6px; background: rgba(15,18,25,0.94);
  padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3); font-size: 13px;
}
.view-toggle.floating .btn-primary { background: var(--accent); color: #0b0e14; font-weight: 700; padding: 6px 18px; font-size: 13px; }
.view-toggle.floating .btn-small { padding: 6px 18px; font-size: 13px; }
.tail-label { color: var(--text-muted); font-size: 9px; font-family: var(--font); }
.view-toggle.floating select {
  background: #0b0e14; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text); font-size: 12px; padding: 4px 8px; font-family: var(--font);
}

/* ---- Dialogs ---- */
.dialog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.dialog-overlay.hidden { display: none; }
.hidden { display: none !important; }
.dialog-box {
  background: var(--panel-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 18px; min-width: 400px; max-width: 500px;
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.dialog-confirm { min-width: 260px; text-align: center; }
.dialog-box h3 {
  margin-bottom: 14px; color: var(--accent); font-size: 13px;
  font-family: var(--font); font-weight: 600;
}
.dialog-row { display: flex; align-items: center; margin-bottom: 10px; gap: 8px; }
.dialog-row label { width: 60px; text-align: right; color: var(--text-muted); font-size: 11px; flex-shrink: 0; font-family: var(--font); }
.dialog-row input, .dialog-row select, .dialog-row textarea { flex: 1; padding: 6px 8px; background: #0b0e14; border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-size: 12px; font-family: var(--font); }
.dialog-row input::placeholder, .dialog-row textarea::placeholder { color: var(--text-muted); font-size: 10px; opacity: 0.5; }
.dialog-row input:focus, .dialog-row select:focus, .dialog-row textarea:focus { border-color: var(--accent); outline: none; }
.dialog-row input[type="checkbox"] { flex: 0; width: auto; margin-left: 6px; accent-color: var(--accent); }
.btn-toggle-cable {
  width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 4px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  font-size: 12px; font-family: var(--font); transition: all 0.15s;
}
.btn-toggle-cable:hover { border-color: var(--accent); color: var(--accent); }
.btn-toggle-cable.active { background: var(--accent); color: #0b0e14; border-color: var(--accent); font-weight: 700; }
body.light .btn-toggle-cable.active { color: #fff; }
.cable-tag { display: inline-block; padding: 0 4px; background: rgba(210,153,29,0.12); color: var(--accent); font-size: 9px; border-radius: 2px; margin-left: 4px; font-family: var(--font); vertical-align: middle; }
body.light .cable-tag { background: rgba(59,89,152,0.08); color: #3b5998; }
.dialog-row .unit { font-size: 10px; color: var(--text-muted); width: 20px; flex-shrink: 0; font-family: var(--font); }
.dialog-hint { font-size: 10px; color: var(--accent); margin: -3px 0 3px 68px; font-family: var(--font); }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: #3a3f4b; }

/* ---- 3D Label ---- */
.label-3d {
  position: absolute; top: 0; left: 0;
  background: rgba(11,14,20,0.92); color: var(--accent); padding: 3px 8px;
  font-size: 10px; pointer-events: none; white-space: nowrap;
  border: 1px solid rgba(210,153,29,0.2); border-radius: 4px; z-index: 20; font-family: var(--font);
}
.toolbar-sep { color: var(--border); font-size: 13px; margin: 0 2px; }


/* ================================================================
   LIGHT THEME — Studio Paper
   ================================================================ */
body.light {
  --bg: #faf8f5; --panel-bg: #ffffff; --surface: #f5f2ed;
  --border: #e0dbd2; --text: #3a3630; --text-muted: #8a8278;
  --text-bright: #1a1815; --accent: #3b5998; --accent-hover: #4a6db5;
  --danger: #c0392b; --green: #27ae60;
  font-family: 'Segoe UI', "Microsoft YaHei", sans-serif;
}
body.light { font-size: 13px; }

body.light #top-toolbar {
  height: 44px; background: #fff; border-bottom: 1px solid #e8e3da;
  padding: 0 16px; gap: 14px; box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
body.light .app-title { color: #2a2620; }
body.light .btn-primary {
  background: #3b5998; color: #fff;
  box-shadow: 0 1px 3px rgba(59,89,152,0.15);
}
body.light .btn-primary:hover { background: #4a6db5; box-shadow: 0 2px 8px rgba(59,89,152,0.25); }
body.light .btn-primary:disabled { background: #e8e3da; color: #b5afa5; box-shadow: none; }
body.light .btn-small {
  background: #fff; border: 1px solid #e0dbd2; color: #5c5650;
}
body.light .btn-small:hover { background: #f5f2ed; border-color: #3b5998; color: #3b5998; }
body.light .btn-danger { color: #c0392b; border-color: #e8c8c4; }
body.light .btn-danger:hover { background: #c0392b; color: #fff; border-color: #c0392b; }
body.light .btn-danger-primary { background: #c0392b; color: #fff; box-shadow: 0 1px 3px rgba(192,57,43,0.14); }
body.light .btn-danger-primary:hover { box-shadow: 0 2px 8px rgba(192,57,43,0.22); }
body.light .btn-add { color: #3b5998; }
body.light .btn-ghost { color: #8a8278; }
body.light .btn-ghost:hover { color: #3a3630; border-color: #e0dbd2; background: #faf8f5; }
body.light #left-panel { border-right: 1px solid #e8e3da; box-shadow: 2px 0 12px rgba(0,0,0,0.03); }
body.light .tab.active { color: #3b5998; border-bottom-color: #3b5998; }
body.light table { font-size: 11px; }
body.light th { background: #f5f2ed; color: #3b5998; }
body.light td { border-bottom-color: rgba(0,0,0,0.04); }
body.light tr.row-item:hover { background: rgba(59,89,152,0.03); }
body.light .step-num {
  background: #3b5998; color: #fff;
  box-shadow: 0 2px 6px rgba(59,89,152,0.2);
}
body.light .wizard-step { border-bottom: 1px solid #f0ebe0; }
body.light .wizard-step:hover { background: rgba(59,89,152,0.02); }
body.light .section-title { color: #3b5998; }
body.light .config-row label { color: #5c5650; }
body.light .config-row select, body.light .config-row input { background: #fff; border: 1px solid #e0dbd2; }
body.light .config-row select:focus, body.light .config-row input:focus { border-color: #3b5998; box-shadow: 0 0 0 3px rgba(59,89,152,0.08); }
body.light .config-row input[readonly] { background: #f5f2ed; }
body.light .validation-msg { background: rgba(192,57,43,0.03); border-left-color: #c0392b; }
body.light .search-box input { background: #fff; border-color: #e0dbd2; }
body.light .search-dropdown { background: #fff; border-color: #e0dbd2; box-shadow: 0 6px 20px rgba(0,0,0,0.06); }
body.light .search-dropdown li { border-bottom-color: rgba(0,0,0,0.03); color: #2a2e35; }
body.light .search-dropdown li:hover { background: rgba(59,89,152,0.05); }
body.light .search-dropdown li.selected { background: rgba(59,89,152,0.1); color: #3b5998; }

body.light #result-area { background: #fff; border: 1px solid #e8e3da; }
body.light .led { background: rgba(59,89,152,0.08); color: #3b5998; }
body.light .led.green { background: rgba(39,174,96,0.06); color: #27ae60; }
body.light .led.red { background: rgba(220,38,38,0.08); color: #dc2626; }
body.light .dot-row .dot-fill { border-bottom-color: #e0dbd2; }
body.light .big-num { color: #1a1815; }
body.light .sub-row .hl { color: #3b5998; }
body.light .sub-row .hl.alt { color: #b8860b; }
body.light .grid-item { background: rgba(59,89,152,0.03); border-color: rgba(59,89,152,0.08); }
body.light .grid-item .gval { color: #3b5998; }
body.light .grid-item.dim { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.04); }
body.light .grid-item.dim .gval { color: #8a8278; }
body.light .result-table .divider { border-top-color: #e8e3da; }
body.light .result-table .divider-solid { border-top-color: #d5cfc5; }

body.light #canvas-container {
  background: radial-gradient(ellipse at 50% 50%, rgba(59,89,152,0.02) 0%, transparent 60%), linear-gradient(180deg, #faf8f5 0%, #f0ebe0 100%);
}
body.light .light-panel {
  background: rgba(255,255,255,0.95); border: 1px solid #e0dbd2;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
body.light .light-panel .lp-header { color: #3b5998; border-bottom-color: #e8e3da; }
body.light .light-panel .lp-toggle { color: #8a8278; font-size: 18px; padding: 2px 6px; }
body.light .light-panel .lp-toggle:hover { color: #3b5998; }
body.light .light-panel .lp-section { color: #3b5998; border-top-color: rgba(0,0,0,0.04); }
body.light .light-panel .lp-row label { color: #8a8278; }
body.light .light-panel .lp-row input[type=range] { accent-color: #3b5998; background: rgba(0,0,0,0.04); }
body.light .light-panel .lp-row input[type=color] { border-color: #e0dbd2; }
body.light .light-panel .lp-val, body.light .light-panel .lp-hex { color: #3a3630; }
body.light .vis-check { color: #5c5650; }
body.light .vis-check input { accent-color: #3b5998; }
body.light .light-panel .lp-btns { border-top-color: rgba(0,0,0,0.04); }
body.light .view-toggle.floating {
  background: rgba(255,255,255,0.95); border: 1px solid #e0dbd2;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}
body.light .view-toggle.floating .btn-primary { background: #3b5998; color: #fff; }
body.light .view-toggle.floating select { background: #fff; border: 1px solid #e0dbd2; font-size: 12px; }
body.light .dialog-overlay { background: rgba(0,0,0,0.2); }
body.light .dialog-box { background: #fff; border: 1px solid #e8e3da; box-shadow: 0 12px 40px rgba(0,0,0,0.08); }
body.light .dialog-box h3 { color: #2a2620; }
body.light .dialog-row label { color: #5c5650; }
body.light .dialog-row input, body.light .dialog-row select { background: #fff; border: 1px solid #e0dbd2; }
body.light .dialog-row input:focus, body.light .dialog-row select:focus { border-color: #3b5998; }
body.light .dialog-hint { color: #3b5998; }
body.light .dialog-buttons { border-top-color: #f5f2ed; }
body.light ::-webkit-scrollbar-thumb { background: #d5cfc5; }
body.light .label-3d { background: rgba(255,255,255,0.94); color: #2a2620; border: 1px solid rgba(59,89,152,0.15); }
body.light input, body.light select { background: #fff; border-color: #e0dbd2; color: #3a3630; }
body.light input:focus, body.light select:focus { border-color: #3b5998; outline: none; }
body.light input[readonly] { background: #f5f2ed; color: #8a8278; }
body.light #btn-data-editor { background: #fff; color: #5c5650; }
body.light .result-actions button { background: #fff; }
body.light #inp-target { background: #fff; }
body.light .toolbar-sep { color: #e8e3da; }

/* ===== Toast Notifications ===== */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 99999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  padding: 10px 20px; border-radius: 6px; font-size: 13px;
  font-family: var(--font); color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35); pointer-events: auto;
  animation: toast-in 0.3s ease; max-width: 400px; word-break: break-word;
}
.toast.error { background: #e0556a; }
.toast.success { background: #3fb950; }
.toast.info { background: #4d9eff; }
@keyframes toast-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
