/* Solar Lab Settings, based on approved Claude Design 8c-D1/D2 and 8d-M3. */
body.lab-events.ev-settings-open { overflow: hidden; }
body.lab-events .ev-settings-modal {
  position: fixed; inset: 0; z-index: 1200; display: flex;
  align-items: center; justify-content: center; font-family: var(--sl-font-ui, Inter, sans-serif);
}
body.lab-events .ev-settings-modal[hidden],
body.lab-events .ev-settings-panel[hidden] { display: none !important; }
body.lab-events .ev-settings-backdrop { position: absolute; inset: 0; background: rgb(17 18 26 / 55%); }
body.lab-events .ev-settings-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  width: min(840px, calc(100vw - 48px)); height: min(600px, calc(100dvh - 48px));
  max-width: none; max-height: none; border: 1px solid var(--sl-border-soft, #e6e4da);
  border-radius: 12px; background: var(--sl-surface, #fff); color: var(--sl-ink, #1a1a22);
  box-shadow: var(--sl-shadow-dialog, 0 30px 80px rgb(0 0 0 / 18%));
}
body.lab-events .ev-settings-header {
  display: flex; align-items: center; flex: none; min-height: 60px; box-sizing: border-box;
  padding: 0 22px; border-bottom: 1px solid var(--sl-border-soft, #e6e4da);
}
body.lab-events .ev-settings-header h2 {
  flex: 1; margin: 0; font: 600 22px/1.2 var(--sl-font-display, Fraunces, Georgia, serif);
  color: var(--sl-ink, #1a1a22);
}
body.lab-events .ev-settings-close,
body.lab-events .ev-settings-back {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid transparent; border-radius: 6px; background: transparent;
  color: var(--sl-muted, #5a6170); cursor: pointer; font: 400 25px/1 var(--sl-font-ui, Inter, sans-serif);
}
body.lab-events .ev-settings-back { display: none; }
body.lab-events .ev-settings-close:hover,
body.lab-events .ev-settings-back:hover { background: var(--sl-surface-muted, #f3f1ea); color: var(--sl-ink, #1a1a22); }
body.lab-events .ev-settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); flex: 1; min-height: 0; }
body.lab-events .ev-settings-nav {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 12px;
  border-right: 1px solid var(--sl-border-soft, #e6e4da);
  background: var(--sl-surface-soft, #fbfaf5);
}
body.lab-events .ev-settings-nav [role="tab"] {
  display: flex; align-items: center; gap: 8px; flex: none; width: 100%; min-height: 34px;
  box-sizing: border-box; padding: 8px 12px; border: 1px solid transparent;
  border-radius: 7px; background: transparent; color: var(--sl-muted, #5a6170);
  text-align: left; font: 500 13px/1.3 var(--sl-font-ui, Inter, sans-serif); cursor: pointer;
}
body.lab-events .ev-settings-nav [role="tab"]:hover { background: var(--sl-surface-muted, #f3f1ea); color: var(--sl-ink, #1a1a22); }
body.lab-events .ev-settings-nav [role="tab"][aria-selected="true"] {
  border-color: var(--sl-border-soft, #e6e4da); background: var(--sl-surface, #fff);
  box-shadow: 0 1px 3px rgb(20 20 30 / 4%); color: var(--sl-ink, #1a1a22); font-weight: 700;
}
body.lab-events .ev-settings-tab-icon { display: none; }
body.lab-events .ev-settings-tab-mobile { display: none; }
body.lab-events .ev-settings-content {
  min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 24px 18px; box-sizing: border-box; background: var(--sl-surface, #fff);
}
body.lab-events .ev-settings-panel { min-height: 100%; box-sizing: border-box; color: var(--sl-ink, #1a1a22); }
body.lab-events .ev-settings-panel:focus { outline: none; }

/* Existing General and Theme controls are rendered by initSettingsRedesign(). */
body.lab-events .ev-settings-panel .rd-settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: 61px; box-sizing: border-box; padding: 10px 0;
  border-bottom: 1px solid var(--sl-border-soft, #e6e4da);
}
body.lab-events .ev-settings-panel .rd-settings-row:first-child { padding-top: 5px; }
body.lab-events .ev-settings-panel .rd-settings-row > div:first-child { min-width: 0; max-width: 370px; }
body.lab-events .ev-settings-panel .rd-settings-row strong { display: block; color: var(--sl-ink, #1a1a22); font: 600 13px/1.4 var(--sl-font-ui, Inter, sans-serif); }
body.lab-events .ev-settings-panel .rd-settings-row small,
body.lab-events .ev-settings-panel[data-section="theme"] h3 small {
  display: block; margin-top: 4px; color: var(--sl-muted, #5a6170);
  font: 400 12px/1.45 var(--sl-font-ui, Inter, sans-serif);
}
body.lab-events .ev-settings-panel .rd-settings-control { min-width: 0; flex: none; }
body.lab-events .ev-settings-panel .rd-settings-segments {
  display: inline-flex; max-width: 100%; overflow: hidden; border: 1px solid var(--sl-border, #d8d6c8);
  border-radius: 6px; background: var(--sl-surface, #fff);
}
body.lab-events .ev-settings-panel .rd-settings-choice { display: block; min-width: 0; cursor: pointer; }
body.lab-events .ev-settings-panel .rd-settings-choice input,
body.lab-events .ev-settings-panel .rd-settings-theme-card input,
body.lab-events .ev-settings-panel .rd-settings-switch input {
  position: absolute; width: 1px; height: 1px; opacity: 0;
}
body.lab-events .ev-settings-panel .rd-settings-choice + .rd-settings-choice { border-left: 1px solid var(--sl-border-soft, #e6e4da); }
body.lab-events .ev-settings-panel .rd-settings-choice span {
  display: block; padding: 9px 12px; background: transparent; color: var(--sl-ink, #1a1a22);
  font: 500 12px/1.3 var(--sl-font-ui, Inter, sans-serif);
}
body.lab-events .ev-settings-panel .rd-settings-choice input:focus-visible + span {
  outline: 3px solid var(--sl-violet, #7e57c2); outline-offset: -3px;
}
body.lab-events .ev-settings-panel .rd-settings-choice input:checked + span {
  background: var(--sl-ink, #1a1a22); color: var(--sl-surface, #fff);
}
body.lab-events .ev-settings-panel .rd-settings-select {
  min-height: 35px; padding: 7px 12px; border-color: var(--sl-border, #d8d6c8);
  background: var(--sl-surface, #fff); color: var(--sl-ink, #1a1a22);
  font: 500 12px var(--sl-font-ui, Inter, sans-serif);
}
body.lab-events .ev-settings-panel .rd-settings-switch { display: inline-flex; position: relative; cursor: pointer; }
body.lab-events .ev-settings-panel .rd-settings-switch span {
  display: block; width: 45px; height: 24px; box-sizing: border-box; padding: 3px;
  border-radius: 20px; background: var(--sl-border, #d8d6c8); transition: background .15s;
}
body.lab-events .ev-settings-panel .rd-settings-switch span::before {
  content: ''; display: block; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px #0003; transition: transform .15s;
}
body.lab-events .ev-settings-panel .rd-settings-switch input:checked + span { background: var(--sl-ink, #1a1a22); }
body.lab-events .ev-settings-panel .rd-settings-switch input:checked + span::before { transform: translateX(21px); }
body.lab-events .ev-settings-panel .rd-settings-switch input:focus-visible + span {
  outline: 3px solid var(--sl-violet, #7e57c2); outline-offset: 2px;
}
body.lab-events .ev-settings-panel[data-section="general"] { display: flex; flex-direction: column; }
body.lab-events .rd-settings-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  margin-top: auto; padding-top: 24px;
}
body.lab-events .rd-settings-footer small {
  color: var(--sl-muted, #5a6170); font: 400 12px/1.4 var(--sl-font-ui, Inter, sans-serif);
}
body.lab-events .rd-settings-footer button {
  min-height: 35px; flex: none; padding: 8px 14px; border: 1px solid var(--sl-border, #d8d6c8);
  border-radius: 6px; background: var(--sl-surface, #fff); color: var(--sl-ink, #1a1a22);
  font: 600 12px var(--sl-font-ui, Inter, sans-serif); cursor: pointer;
}
body.lab-events .rd-settings-footer button:hover { background: var(--sl-surface-muted, #f3f1ea); }
@media (min-width: 768px) {
  body.lab-events .ev-settings-content:not([data-section="general"]) > .rd-settings-footer { display: none; }
}
body.lab-events .ev-settings-panel[data-section="theme"] h3 {
  display: block; margin: 0 0 20px; color: var(--sl-ink, #1a1a22);
  font: 600 19px/1.35 var(--sl-font-ui, Inter, sans-serif);
}
body.lab-events .ev-settings-panel[data-section="theme"] h3 small { margin-top: 3px; }
body.lab-events .ev-settings-panel .rd-settings-theme-cards {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
  padding-bottom: 27px; border-bottom: 1px solid var(--sl-border-soft, #e6e4da);
}
body.lab-events .ev-settings-panel .rd-settings-theme-card {
  display: block; min-width: 0; padding: 10px; border: 1px solid var(--sl-border, #d8d6c8);
  border-radius: 8px; background: var(--sl-surface, #fff); color: var(--sl-ink, #1a1a22);
  cursor: pointer;
}
body.lab-events .ev-settings-panel .rd-settings-theme-card:has(input:checked) {
  border-color: var(--sl-ink, #1a1a22); box-shadow: inset 0 0 0 1px var(--sl-ink, #1a1a22);
}
body.lab-events .ev-settings-panel .rd-settings-theme-card:has(input:focus-visible) {
  outline: 3px solid var(--sl-violet, #7e57c2); outline-offset: 2px;
}
body.lab-events .ev-settings-panel .rd-settings-theme-card strong { display: block; padding: 10px 2px 1px; font-size: 13px; }
body.lab-events .ev-settings-panel .rd-settings-theme-preview {
  display: grid; grid-template-columns: 27% 1fr; grid-template-rows: 13px 1fr 1fr;
  gap: 5px; height: 94px; box-sizing: border-box; padding: 6px;
  border: 1px solid #ddd; border-radius: 5px; background: #f6f5f1;
}
body.lab-events .ev-settings-panel .rd-settings-theme-preview i {
  grid-column: 1 / -1; border-radius: 3px; background: #22232b;
}
body.lab-events .ev-settings-panel .rd-settings-theme-preview b {
  grid-column: 2; border: 1px solid #e1ded7; border-radius: 3px; background: #fff;
}
body.lab-events .ev-settings-panel .rd-theme-dark { border-color: #33313b; background: #1a1920; }
body.lab-events .ev-settings-panel .rd-theme-dark b { border-color: #37343f; background: #26242d; }
body.lab-events .ev-settings-panel .rd-theme-system {
  background: linear-gradient(90deg, #f6f5f1 50%, #1a1920 50%);
}
body.lab-events .ev-settings-panel[data-section="theme"] .rd-settings-row { min-height: 82px; }

body.lab-events.rd-thick-lines .js-plotly-plot .scatterlayer .trace .js-line { stroke-width: 3px !important; }
body.lab-events.rd-thick-lines .js-plotly-plot .xtick text,
body.lab-events.rd-thick-lines .js-plotly-plot .ytick text { font-weight: 700 !important; }

/* Mascot section from the accepted Miscellaneous sheet. */
body.lab-events .ev-settings-mascots-heading { display:flex;flex-wrap:wrap;align-items:baseline;gap:8px;margin-bottom:16px; }
body.lab-events .ev-settings-mascots-heading .ev-settings-mascot-none {margin-left:auto;}
body.lab-events .ev-settings-panel.ev-settings-mascots h3 {
  margin: 0 0 4px; color: var(--sl-ink, #1a1a22);
  font: 600 19px/1.35 var(--sl-font-ui, Inter, sans-serif);
}
body.lab-events .ev-settings-mascots-heading p,
body.lab-events .ev-settings-mascot-help {
  margin: 0; color: var(--sl-muted, #5a6170);
  font: 400 12px/1.5 var(--sl-font-ui, Inter, sans-serif);
}
body.lab-events .ev-settings-mascot-group { margin-bottom: 16px; }
body.lab-events .ev-settings-mascot-group-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
body.lab-events .ev-settings-mascot-group h4 { margin:0;color:var(--sl-muted);font:400 10px/1.4 var(--sl-font-mono);letter-spacing:1px;text-transform:uppercase; }
body.lab-events .ev-settings-mascot-none { border: 0; background: transparent; color: var(--sl-accent, #c2481a); font: 600 12px var(--sl-font-ui, Inter, sans-serif); cursor: pointer; }
body.lab-events .ev-settings-mascot-none:hover { text-decoration: underline; }
body.lab-events .ev-settings-mascot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
body.lab-events .ev-settings-mascot-grid[data-mascot-group="corners"] { grid-template-columns: repeat(2, minmax(0, 1fr));max-width:400px; }
body.lab-events .ev-settings-mascot-card {
  position: relative; display: flex; align-items: center; gap: 11px; min-width: 0; min-height: 74px;
  box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--sl-border-soft, #e6e4da);
  border-radius: 8px; background: var(--sl-surface-soft, #fbfaf5); cursor: pointer;
}
body.lab-events .ev-settings-mascot-card:hover { border-color: var(--sl-border, #d8d6c8); }
body.lab-events .ev-settings-mascot-card:has(input:checked) { border-color: var(--sl-ink, #1a1a22); background: var(--sl-surface, #fff); }
body.lab-events .ev-settings-mascot-art { display: grid; place-items: center; width: 34px; height: 34px; flex: none; font-size: 25px; }
body.lab-events .ev-settings-mascot-text { min-width: 0; flex: 1; }
body.lab-events .ev-settings-mascot-text strong { display: block; color: var(--sl-ink, #1a1a22); font: 600 12px/1.4 var(--sl-font-ui, Inter, sans-serif); }
body.lab-events .ev-settings-mascot-text small { display: block; margin-top: 2px; color: var(--sl-muted, #5a6170); font: 400 10px/1.3 var(--sl-font-ui, Inter, sans-serif); }
body.lab-events .ev-settings-mascot-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
body.lab-events .ev-settings-mascot-toggle { position: relative; width: 31px; height: 18px; flex: none; border-radius: 20px; background: var(--sl-border, #d8d6c8); }
body.lab-events .ev-settings-mascot-toggle::before { content: ''; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #0003; transition: transform .15s; }
body.lab-events .ev-settings-mascot-card input:checked + .ev-settings-mascot-toggle { background: var(--sl-ink, #1a1a22); }
body.lab-events .ev-settings-mascot-card input:checked + .ev-settings-mascot-toggle::before { transform: translateX(13px); }
body.lab-events .ev-settings-mascot-card:has(input:focus-visible) { outline: 3px solid var(--sl-violet, #7e57c2); outline-offset: 2px; }
body.lab-events .ev-settings-mascot-help {padding:12px;border:1px solid var(--sl-border-soft);border-radius:8px;background:var(--sl-surface-soft);}
/* 5d-D preview tiles, backed by the existing mascot toggles. */
body.lab-events .ev-settings-mascot-card {display:grid;grid-template-columns:minmax(0,1fr) 18px;gap:10px;padding:10px;min-height:124px;}
body.lab-events .ev-settings-mascot-art {position:relative;grid-column:1 / -1;width:100%;height:65px;background:var(--sl-surface-muted);border:1px solid var(--sl-border-soft);border-radius:7px;font-size:20px;}
body.lab-events .ev-settings-mascot-art::before {content:'';position:absolute;inset:8px;border:1px dashed var(--sl-border);border-radius:3px;}
body.lab-events .ev-settings-mascot-art>span {position:absolute;z-index:1;}
body.lab-events [data-mascot='chachito'] .ev-settings-mascot-art>span {bottom:2px;right:8px;}
body.lab-events [data-mascot='fantasmita'] .ev-settings-mascot-art>span {top:2px;left:8px;}
body.lab-events [data-mascot-group='walkers'] .ev-settings-mascot-art {height:76px;}
body.lab-events [data-mascot-group='walkers'] .ev-settings-mascot-art::before {inset:10px 0 auto;height:22px;border:0;border-radius:7px 7px 0 0;background:#17171d;}
body.lab-events [data-mascot-group='walkers'] .ev-settings-mascot-art::after {content:'';position:absolute;left:8px;right:8px;top:42px;height:8px;background:var(--sl-surface);border:1px solid var(--sl-border-soft);box-shadow:0 14px 0 -1px var(--sl-surface);}
body.lab-events [data-mascot-group='walkers'] .ev-settings-mascot-art>span {top:10px;left:calc(50% - 10px);font-size:17px;}
body.lab-events .ev-settings-mascot-card input {position:static;opacity:1;width:15px;height:15px;accent-color:var(--sl-ink);justify-self:end;margin:0;}
body.lab-events .ev-settings-mascot-toggle {display:none;}

body.lab-events .ev-settings-modal button:focus-visible,
body.lab-events .ev-settings-modal select:focus-visible { outline: 3px solid var(--sl-violet, #7e57c2); outline-offset: 2px; }

/* Override the legacy inline dark modal rule with the approved palette. */
body.lab-events.theme-dark .ev-settings-card {
  background: var(--sl-surface, #1b1b23); border-color: var(--sl-border-soft, #2c2c38);
  color: var(--sl-ink, #ece8dc); box-shadow: var(--sl-shadow-dialog, 0 30px 80px rgb(0 0 0 / 35%));
}
body.lab-events.theme-dark .ev-settings-close,
body.lab-events.theme-dark .ev-settings-back { background: transparent; color: var(--sl-muted, #9a9fae); }
body.lab-events.theme-dark .ev-settings-close:hover,
body.lab-events.theme-dark .ev-settings-back:hover { background: var(--sl-surface-soft, #22222b); color: var(--sl-ink, #ece8dc); }

@media (max-width: 767px) {
  body.lab-events .ev-settings-card { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  body.lab-events .ev-settings-header { min-height: 52px; padding: 0 12px; }
  body.lab-events .ev-settings-header h2 { font-size: 20px; }
  body.lab-events .ev-settings-back { display: grid; width: 44px; height: 44px; margin-left: -10px; margin-right: 8px; font-size: 24px; }
  body.lab-events .ev-settings-close { display: none; }
  body.lab-events .ev-settings-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  body.lab-events .ev-settings-nav {
    flex-direction: row; gap: 6px; padding: 10px 14px; overflow: visible;
    border-right: 0; border-bottom: 1px solid var(--sl-border-soft, #e6e4da);
    background: var(--sl-surface, #fff);
  }
  body.lab-events .ev-settings-nav [role="tab"] {
    display: grid; place-items: center; flex: 1 1 0; width: auto; min-width: 0; min-height: 40px; padding: 8px 4px;
    border: 1px solid var(--sl-border-soft, #e6e4da); border-radius: 8px;
    text-align: center; font-size: 13px; font-weight: 500;
  }
  body.lab-events .ev-settings-nav [role="tab"][aria-selected="true"] {
    border-color: var(--sl-ink, #1a1a22); background: var(--sl-ink, #1a1a22);
    color: var(--sl-surface, #fff); box-shadow: none; font-weight: 600;
  }
  body.lab-events .ev-settings-tab-icon { display: none; }
  body.lab-events [data-settings-tab="misc"] .ev-settings-tab-label { display: none; }
  body.lab-events .ev-settings-tab-mobile { display: inline; }
  /* 8d-M3 keeps its common footer outside the scrollable active panel. */
  body.lab-events .ev-settings-content { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
  body.lab-events .ev-settings-panel { flex: 1; min-height: 0; padding: 14px; overflow-y: auto; overscroll-behavior: contain; }
  body.lab-events .ev-settings-panel .rd-settings-row {
    display: block; min-height: 0; padding: 15px 0;
  }
  body.lab-events .ev-settings-panel .rd-settings-row:first-child { padding-top: 3px; }
  body.lab-events .ev-settings-panel .rd-settings-row strong { font-size: 13px; }
  body.lab-events .ev-settings-panel .rd-settings-row small { font-size: 11px; }
  body.lab-events .ev-settings-panel .rd-settings-control { margin-top: 10px; width: 100%; }
  body.lab-events .ev-settings-panel .rd-settings-segments { display: flex; width: 100%; }
  body.lab-events .ev-settings-panel .rd-settings-choice { flex: 1 1 0; text-align: center; }
  body.lab-events .ev-settings-panel .rd-settings-choice span { padding: 9px 5px; font-size: 11px; }
  body.lab-events .ev-settings-panel .rd-settings-select { width: 100%; }
  body.lab-events .ev-settings-panel .rd-settings-row:has(#rdThickLines) { display: flex; align-items: center; gap: 12px; }
  body.lab-events .ev-settings-panel .rd-settings-control:has(#rdThickLines) { flex: none; width: auto; margin-top: 0; }
  body.lab-events .rd-settings-footer {
    position: static; flex: none; z-index: 1; flex-wrap: wrap; gap: 10px;
    margin: 0; padding: 12px 14px max(18px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--sl-border-soft, #e6e4da); background: var(--sl-surface, #fff);
  }
  body.lab-events .rd-settings-footer small { flex: 1; font-size: 11.5px; }
  body.lab-events .rd-settings-footer button { margin-left: auto; }
  body.lab-events .rd-settings-footer button { min-height: 44px; border-radius: 8px; font-size: 13px; }
  body.lab-events .ev-settings-panel[data-section="theme"] h3 { margin-bottom: 8px; font-size: 14px; }
  body.lab-events .ev-settings-panel[data-section="theme"] h3 small { display: none; }
  body.lab-events .ev-settings-panel .rd-settings-theme-cards { gap: 8px; padding-bottom: 14px; }
  body.lab-events .ev-settings-panel .rd-settings-theme-card { padding: 8px; border-radius: 10px; }
  body.lab-events .ev-settings-panel .rd-settings-theme-preview { height: 64px; }
  body.lab-events .ev-settings-panel .rd-settings-theme-card strong { padding: 6px 0 0; font-size: 12.5px; text-align: center; }
  body.lab-events .ev-settings-panel.ev-settings-mascots h3 { font-size: 16px; }
  body.lab-events .ev-settings-mascot-grid,
  body.lab-events .ev-settings-mascot-grid[data-mascot-group="corners"] { grid-template-columns: 1fr; }
  body.lab-events .ev-settings-mascot-card { min-height: 66px; }
}
