:root {
  --ink: #13212b;
  --muted: #68747c;
  --paper: #f3f0e9;
  --panel: #fffefb;
  --line: #dedbd3;
  --navy: #0d1a24;
  --navy-2: #142733;
  --cyan: #49d6cf;
  --cyan-soft: #c9f6f1;
  --amber: #ffb84d;
  --green: #22c55e;
  --violet: #a78bfa;
  --danger: #da5d5d;
  --shadow: 0 16px 44px rgba(13, 26, 36, 0.07);
  --radius: 16px;
}

* { box-sizing: border-box; }
/* `hidden` is only a display:none of the lowest possible weight, so any rule
   that sets display: flex/grid on the same element beats it — which is how the
   empty measurement bar sat under the chart with nothing in it. One rule for
   the whole app rather than a [hidden] variant per component. */
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { min-width: 1100px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { display: grid; grid-template-columns: 286px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; padding: 24px 18px 18px; color: #f7faf9; background: var(--navy); border-right: 1px solid rgba(255,255,255,.08); }
.sidebar::after { content: ""; position: absolute; width: 240px; height: 240px; left: -120px; bottom: -100px; border-radius: 50%; background: rgba(73,214,207,.06); filter: blur(1px); pointer-events: none; }
.brand { display: flex; align-items: center; gap: 13px; padding: 2px 7px 24px; }
.brand h1 { margin: 2px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 24px; font-weight: 500; letter-spacing: -.3px; }
.eyebrow { color: #8ea4af; font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; }
.eyebrow.dark { color: #7d8b91; }
.brand-mark { width: 31px; height: 31px; display: flex; align-items: end; gap: 3px; padding: 6px 5px; border: 1px solid rgba(73,214,207,.4); border-radius: 8px; background: rgba(73,214,207,.06); }
.brand-mark i { display: block; width: 3px; border-radius: 3px 3px 0 0; background: var(--cyan); }
.brand-mark i:nth-child(1) { height: 35%; }.brand-mark i:nth-child(2) { height: 85%; }.brand-mark i:nth-child(3) { height: 54%; }.brand-mark i:nth-child(4) { height: 100%; }
.source-card { position: relative; display: grid; grid-template-columns: 1fr 8px; gap: 10px; align-items: center; margin-bottom: 22px; padding: 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 11px; background: rgba(255,255,255,.035); }
.source-card strong { display: block; overflow: hidden; color: #d7e3e7; font-size: 12px; font-weight: 650; letter-spacing: .2px; text-overflow: ellipsis; white-space: nowrap; }
.source-card .status-dot { width: 7px; height: 7px; margin: 0; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 3px rgba(73,214,207,.12); }
.side-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 9px; color: #7e929c; font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.side-heading-actions { display: flex; align-items: center; gap: 10px; }
.text-button { border: 0; color: #8fa8b2; background: none; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.text-button:hover { color: var(--cyan); }
.spectrum-list { flex: 1; overflow: auto; padding-right: 3px; scrollbar-width: thin; scrollbar-color: #2b414c transparent; }
.spectrum-item { display: grid; grid-template-columns: 16px 1fr 18px 8px; gap: 10px; align-items: center; width: 100%; margin: 2px 0; padding: 10px 9px; border: 1px solid transparent; border-radius: 9px; color: #a6b5bc; background: transparent; text-align: left; transition: .16s ease; }
/* Remove-from-panel: present on every row, but only obvious on hover/focus. */
.spectrum-remove { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 5px; opacity: 0; color: #9fb0b7; background: transparent; cursor: pointer; font-size: 16px; line-height: 1; transition: .14s ease; }
.spectrum-item:hover .spectrum-remove, .spectrum-item.active .spectrum-remove { opacity: .65; }
.spectrum-remove:hover { opacity: 1; color: #fff; background: #b4432a; }
.spectrum-remove:focus-visible { opacity: 1; outline: 2px solid var(--cyan); }
.restore-builtins { width: 100%; margin-top: 8px; padding: 8px; border: 1px dashed rgba(255,255,255,.16); border-radius: 8px; color: #9fb0b7; background: transparent; cursor: pointer; font-size: 11px; }
.restore-builtins:hover { border-color: rgba(73,214,207,.4); color: #d8fffb; }
.regions-empty { display: grid; gap: 9px; justify-items: start; padding: 12px 20px 4px; }
.region-empty { color: #7d8a90; font-size: 11.5px; line-height: 1.6; }
.region-empty b { color: #47585f; }
.primary-button.danger { border-color: #b4432a; background: #a83c25; }
.primary-button.danger:hover { background: #8f3220; }
.dialog-note { margin: 8px 0 0; color: #6d7a80; font-size: 12px; line-height: 1.65; }
.spectrum-item:hover { background: rgba(255,255,255,.035); }
.spectrum-item.active { color: #fff; border-color: rgba(73,214,207,.15); background: linear-gradient(90deg, rgba(73,214,207,.12), rgba(73,214,207,.025)); }
.sample-check { width: 14px; height: 14px; border: 1px solid #4c626c; border-radius: 4px; appearance: none; background: transparent; cursor: pointer; }
.sample-check:checked { border-color: var(--cyan); background: var(--cyan); box-shadow: inset 0 0 0 3px var(--navy); }
.sample-copy strong, .sample-copy span { display: block; }
/* Sample rows carry the full .RAW file name, which has no spaces to break on. */
.sample-copy strong { font-size: 12.5px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }.sample-copy span { margin-top: 2px; color: #697f89; font-size: 11px; }
.active-chevron { color: var(--cyan); opacity: 0; font-size: 16px; }.spectrum-item.active .active-chevron { opacity: 1; }
.sidebar-footer { position: relative; z-index: 1; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-footer p { margin: 0 0 12px; color: #607680; font-size: 11px; text-align: center; }
kbd { display: inline-block; padding: 2px 5px; border: 1px solid currentColor; border-radius: 4px; font-family: inherit; font-size: 11px; font-weight: 800; opacity: .8; }

.workspace { min-width: 0; padding: 30px 38px 24px; }
.topbar { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.breadcrumb { margin-bottom: 8px; color: #718087; font-size: 11px; font-weight: 800; letter-spacing: 1.5px; }.breadcrumb span { padding: 0 7px; color: #a7aca9; }
.topbar h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 29.5px; font-weight: 500; letter-spacing: -.5px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.saved-state { color: #738087; font-size: 12px; }.saved-state span { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: #48b976; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; color: #64727a; background: rgba(255,255,255,.5); font-weight: 700; }
.icon-button:hover { background: #fff; }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(120px, .8fr)) minmax(190px, 1.3fr); margin-bottom: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.48); overflow: hidden; box-shadow: 0 6px 22px rgba(13,26,36,.025); }
.metric { min-width: 0; padding: 14px 17px 13px; border-right: 1px solid var(--line); }.metric:last-child { border: 0; }
.metric > span, .metric > small { display: block; color: #7c878c; font-size: 11px; }.metric > span { margin-bottom: 5px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; }
.metric strong { display: inline-block; max-width: 100%; margin-right: 5px; overflow: hidden; color: #1b2c35; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18.5px; white-space: nowrap; text-overflow: ellipsis; }.metric small { display: inline; }
.metric.primary strong { color: #157c78; }.metric.meta strong { display: block; font-family: inherit; font-size: 16px; }.metric.meta small { display: block; margin-top: 4px; }

.chart-card { border: 1px solid #1c303c; border-radius: var(--radius); background: var(--navy); overflow: hidden; box-shadow: 0 18px 54px rgba(13,26,36,.13); }
.chart-card:fullscreen, .chart-card:-webkit-full-screen, .chart-card:-moz-full-screen { display: flex; flex-direction: column; width: 100vw; height: 100vh; border-radius: 0; }
.chart-card:fullscreen .chart-wrap, .chart-card:-webkit-full-screen .chart-wrap, .chart-card:-moz-full-screen .chart-wrap { flex: 1; height: auto; min-height: 0; }
.chart-toolbar { min-height: 55px; display: flex; align-items: center; gap: 15px; padding: 10px 15px; border-bottom: 1px solid rgba(255,255,255,.08); color: #d8e4e7; background: #11222d; }
.tool-group { display: flex; padding: 3px; border: 1px solid rgba(255,255,255,.07); border-radius: 8px; background: rgba(0,0,0,.13); }
.tool { height: 29px; padding: 0 10px; border: 0; border-radius: 6px; color: #80949e; background: transparent; font-size: 12.5px; }.tool span { margin-left: 4px; font-size: 11px; font-weight: 700; }.tool:hover { color: #d5e3e5; }.tool.active { color: #d8fffb; background: rgba(73,214,207,.14); }
.toolbar-divider { align-self: stretch; width: 1px; background: rgba(255,255,255,.07); }
.control-label { display: flex; align-items: center; gap: 8px; color: #78909a; font-size: 11px; font-weight: 700; text-transform: uppercase; }
select { border: 1px solid rgba(255,255,255,.1); border-radius: 7px; color: #dce7e9; background: #182d39; outline: none; }
.control-label select { height: 31px; padding: 0 27px 0 9px; font-size: 12px; text-transform: none; }
/* The compare control only means anything with exactly two samples ticked. */
.control-label.is-off { opacity: .4; }
.compare-control select { border-color: rgba(73,214,207,.35); }
/* Bigger type made the toolbar buttons wrap onto two lines. */
.chart-toolbar .secondary-button, .chart-toolbar .tool { white-space: nowrap; }
.scale-control { display: flex; align-items: center; gap: 7px; color: #78909a; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.scale-control input[type="range"] { width: 72px; accent-color: var(--cyan); }.scale-control output { width: 29px; color: #bccbd0; font-size: 11px; font-variant-numeric: tabular-nums; text-transform: none; }.threshold-control { margin-right: auto; }
.secondary-button, .primary-button { min-height: 35px; padding: 0 15px; border-radius: 8px; font-size: 12px; font-weight: 750; transition: .15s ease; }
.secondary-button { border: 1px solid #d2d4d0; color: #40515a; background: transparent; }.secondary-button:hover { background: rgba(255,255,255,.8); }.chart-toolbar .secondary-button { border-color: rgba(255,255,255,.13); color: #9fb1b8; }.chart-toolbar .secondary-button:hover { color: #fff; background: rgba(255,255,255,.06); }
.secondary-button:disabled, .primary-button:disabled { opacity: .35; cursor: not-allowed; }.secondary-button:disabled:hover { background: transparent; }
.chart-toolbar .secondary-button.active { border-color: #ffb84d; color: #ffe1b0; background: rgba(255,184,77,.16); }.chart-toolbar .secondary-button.active:hover { background: rgba(255,184,77,.22); }
.primary-button { border: 1px solid #15948e; color: white; background: #167f7a; }.primary-button:hover { background: #116e6a; }.compact { min-height: 31px; padding: 0 11px; }.full { width: 100%; }
.sidebar .secondary-button { border-color: rgba(255,255,255,.12); color: #b7c7cc; background: rgba(255,255,255,.03); }.sidebar .secondary-button:hover { color: #fff; background: rgba(255,255,255,.07); }

.chart-wrap { position: relative; height: clamp(370px, 45vh, 520px); min-height: 340px; overflow: hidden; }
.chart-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }.chart-wrap #interactionCanvas { touch-action: none; }
.chart-empty { position: absolute; inset: 0; display: none; place-items: center; color: #617681; font-size: 14px; }.chart-empty.visible { display: grid; }
.mode-hint { position: absolute; top: 13px; left: 50%; transform: translateX(-50%); padding: 6px 10px; border: 1px solid rgba(255,255,255,.07); border-radius: 6px; color: #627883; background: rgba(13,26,36,.7); font-size: 11px; pointer-events: none; }
.chart-tooltip { position: absolute; z-index: 5; min-width: 138px; padding: 9px 11px; border: 1px solid rgba(73,214,207,.25); border-radius: 8px; color: #dae8e9; background: rgba(8,18,25,.94); box-shadow: 0 8px 30px rgba(0,0,0,.25); font-size: 12px; pointer-events: none; }
.chart-tooltip strong { display: block; margin-bottom: 5px; color: #fff; font-family: ui-monospace, monospace; font-size: 14px; }.chart-tooltip span { display: block; margin-top: 3px; color: #8fa4ad; }.chart-tooltip i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; }
.chart-footer { min-height: 41px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 7px 18px; border-top: 1px solid rgba(255,255,255,.075); background: #10202a; }
.legend { display: flex; flex-wrap: wrap; gap: 15px; min-width: 0; }.legend-item { display: flex; align-items: center; min-width: 0; color: #82959e; font-size: 11px; }.legend-item i { width: 13px; height: 2px; margin-right: 6px; }.legend-item.active { color: #d8e2e5; }
.view-readout { display: flex; gap: 15px; color: #6f848d; font-family: ui-monospace, monospace; font-size: 11px; white-space: nowrap; }

.measure-bar { display: flex; align-items: center; gap: 12px; padding: 9px 18px; border-top: 1px solid rgba(255,255,255,.075); background: #0c1a22; color: #cfe0e3; font-size: 12px; }
.measure-content { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.measure-chip { display: flex; align-items: center; gap: 6px; color: #8fa4ad; }
.measure-chip i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.measure-chip b { color: #dcebee; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; }
.measure-chip small { color: #6d838d; }
.measure-headline { display: flex; align-items: baseline; gap: 7px; padding: 3px 11px; border: 1px solid rgba(73,214,207,.28); border-radius: 7px; background: rgba(73,214,207,.1); color: #a9efe9; }
.measure-headline span { color: #7fb9b5; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.measure-headline b { color: #d8fffb; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; }
.measure-hint { color: #6d838d; font-style: italic; }
.measure-warn { color: #ffce85; }
.measure-clear { flex: 0 0 auto; width: 22px; height: 22px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; color: #8fa4ad; background: transparent; font-size: 16px; line-height: 1; }
.measure-clear:hover { color: #fff; background: rgba(255,255,255,.08); }

.analysis-grid { display: grid; grid-template-columns: minmax(540px, 1.15fr) minmax(440px, .85fr); gap: 14px; margin-top: 14px; }
.panel { min-height: 320px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 14px; }.panel-header h3, dialog h3 { margin: 4px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 21px; font-weight: 500; }
/* Folding a panel down to its title. The ▾ button is appended to every
   .panel-header by app.js, so the title block takes the slack and the
   actions sit next to the button on the right. */
.panel-header { gap: 10px; }
.panel-title { margin-right: auto; }
.panel-toggle { flex: none; width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: #6d7c84; background: rgba(255,255,255,.5); font-size: 0; line-height: 1; cursor: pointer; transition: .15s ease; }
.panel-toggle:hover { color: #24323a; background: #fff; }
.panel-toggle::before { content: "▾"; display: block; font-size: 12.5px; transition: transform .18s ease; }
/* Folded: the body and the header's action buttons go, the title stays. */
.panel.is-collapsed { min-height: 0; align-self: start; }
.panel.is-collapsed > *:not(.panel-header) { display: none; }
.panel.is-collapsed .panel-header > *:not(.panel-title):not(.panel-toggle) { display: none; }
.panel.is-collapsed .panel-header { padding: 14px 20px; }
.panel.is-collapsed .panel-toggle::before { transform: rotate(-90deg); }
.panel-subhead { display: grid; grid-template-columns: 1fr 1.5fr .9fr .6fr 24px; gap: 8px; padding: 8px 18px; border-top: 1px solid #ece9e2; border-bottom: 1px solid #ece9e2; color: #879196; background: #faf9f5; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.table-body { max-height: 315px; overflow: auto; }
.region-row { display: grid; grid-template-columns: 1fr 1.5fr .9fr .6fr 24px; gap: 8px; align-items: center; min-height: 47px; padding: 7px 18px; border-bottom: 1px solid #eeece7; font-size: 12px; }
.region-range { display: flex; align-items: center; gap: 4px; min-width: 0; }
.region-range-input { width: 100%; min-width: 0; padding: 4px 5px; border: 1px solid #e2e0da; border-radius: 5px; color: #304048; background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; font-size: 12px; }
.region-range-input:hover { border-color: #d0d5d0; }
.region-range-input:focus { border-color: #75bdb8; outline: none; box-shadow: 0 0 0 2px rgba(22,127,122,.1); }
.range-dash { flex: 0 0 auto; color: #98a3a7; }
.region-add { padding: 14px 18px; border-top: 1px solid #ece9e2; background: #faf9f5; }
.region-add h4 { margin: 0 0 9px; font-family: Georgia, "Times New Roman", serif; font-size: 14px; font-weight: 600; color: #1b2c35; }
.region-add-row { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; }
.region-add-row label { display: flex; flex-direction: column; gap: 5px; color: #6f7d83; font-size: 11px; font-weight: 700; }
.region-add-row input { width: 92px; padding: 7px 8px; border: 1px solid #d6d9d5; border-radius: 7px; color: #273941; background: #fff; font-size: 12.5px; }
.region-add-row input:focus { border-color: #75bdb8; outline: none; box-shadow: 0 0 0 3px rgba(22,127,122,.08); }
.region-name { display: flex; align-items: center; min-width: 0; }.color-swatch { flex: 0 0 auto; width: 8px; height: 8px; margin-right: 8px; border-radius: 2px; }.region-name input { min-width: 0; width: 100%; border: 1px solid transparent; color: #304048; background: transparent; font-weight: 650; }.region-name input:focus { border-color: #cfd6d3; outline: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }.muted { color: #829097; }.delete-button { border: 0; color: #a7afae; background: none; font-size: 17px; }.delete-button:hover { color: var(--danger); }
/* Mass calculator & compound library */
.mass-entry { display: grid; grid-template-columns: 150px 1fr 170px 110px 110px 80px; gap: 10px; padding: 0 20px 14px; }
.mass-entry label { display: flex; flex-direction: column; gap: 5px; color: #7c8a8f; font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }
.mass-entry input, .mass-entry select { min-height: 34px; padding: 0 9px; border: 1px solid #ddd9d0; border-radius: 7px; color: #26333b; background: #fff; font-family: inherit; font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.mass-entry #massInput { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .4px; }
.mass-entry input:focus, .mass-entry select:focus { border-color: var(--teal); outline: none; }
.mass-result { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 20px 14px; }
.mass-card { padding: 12px 14px; border: 1px solid #e2e0da; border-radius: 10px; background: #faf9f5; }
.mass-card span { display: block; color: #7c8a8f; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.mass-card b { display: block; margin-top: 4px; color: #1d2b33; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; font-weight: 650; }
.mass-card small { display: block; margin-top: 3px; color: #93a3a0; font-size: 11px; }
.mass-card.wide { grid-column: 1 / -1; }
.mass-card.formula b { color: #157c78; font-size: 15px; overflow-wrap: anywhere; }
.mass-error { margin: 0 20px 14px; padding: 11px 14px; border: 1px solid #f0d6c9; border-radius: 10px; color: #a2320a; background: #fdf4f0; font-size: 12px; }
/* The same box used as a neutral hint rather than an error. */
.mass-error.mass-hint { border-color: #e2e0da; color: #7c8a8f; background: #faf9f5; }
.mass-series { margin: 0 20px 16px; border: 1px solid #e2e0da; border-radius: 10px; overflow: hidden; }
.mass-series-head, .mass-series-row { display: grid; grid-template-columns: 60px 1fr 1fr 1fr; gap: 8px; padding: 7px 13px; font-size: 12px; }
.mass-series-head { color: #879196; background: #faf9f5; border-bottom: 1px solid #ece9e2; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.mass-series-row { border-bottom: 1px solid #f2f0eb; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mass-series-row:last-child { border-bottom: 0; }
.mass-series-row b { color: #1d2b33; font-weight: 650; }
.mass-series-row i { color: #93a3a0; font-style: normal; }
.mass-library-head { display: flex; align-items: baseline; gap: 9px; padding: 0 20px 8px; color: #7c8a8f; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.mass-library-head small { color: #a2aeb2; font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: none; }
.mass-lib-row { display: grid; grid-template-columns: 1.1fr 1.4fr .9fr .9fr 24px; gap: 9px; align-items: center; padding: 9px 20px; border-top: 1px solid #f2f0eb; font-size: 12px; }
.mass-lib-row:hover { background: #faf9f5; }
.mass-lib-row > div { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.mass-lib-row strong { color: #1d2b33; font-size: 12.5px; font-weight: 650; }
.mass-lib-head { display: grid; grid-template-columns: 1.1fr 1.4fr .9fr .9fr 24px; gap: 9px; padding: 7px 20px; border-top: 1px solid #ece9e2; color: #879196; background: #faf9f5; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.mass-lib-head span:nth-child(3), .mass-lib-head span:nth-child(4) { text-align: right; }
.mass-lib-row span { color: #7c8a8f; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; overflow-wrap: anywhere; }
.mass-lib-row .mass-lib-num { color: #157c78; text-align: right; }
.mass-lib-empty { padding: 14px 20px; color: #93a3a0; font-size: 12px; }
.mass-lib-load { border: 0; background: none; color: #157c78; font-size: 11px; font-weight: 750; text-align: left; cursor: pointer; padding: 0; }
.mass-lib-load:hover { text-decoration: underline; }
/* Shift interpretation inside the measure bar */
.shift-z { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.shift-z b { margin-right: 3px; color: #9fb1b8; font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }
.shift-z button { min-width: 26px; padding: 3px 6px; border: 1px solid rgba(255,255,255,.14); border-radius: 6px; color: #9fb1b8; background: transparent; font-size: 11px; font-weight: 750; cursor: pointer; }
.shift-z button:hover { color: #fff; background: rgba(255,255,255,.07); }
.shift-z button.active { border-color: var(--cyan); color: #04231f; background: var(--cyan); }
.shift-guess { display: flex; flex-direction: column; gap: 4px; width: 100%; margin-top: 7px; }
.shift-guess-row { display: grid; grid-template-columns: 1fr 92px 78px; gap: 9px; align-items: center; padding: 6px 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 7px; background: rgba(255,255,255,.03); font-size: 11.5px; }
.shift-guess-row strong { color: #dbe7ec; font-weight: 650; }
.shift-guess-row em { display: block; margin-top: 2px; color: #7f9099; font-size: 11px; font-style: normal; }
.shift-guess-row span { color: #9fb1b8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; }
.shift-guess-row.is-pair { opacity: .72; }
.shift-guess-row.is-miss { border-style: dashed; border-color: rgba(255,184,77,.3); opacity: .8; }
.shift-guess-row.is-miss span:last-child { color: #ffb84d; }
.shift-guess-row span i { color: #6d7f88; font-size: 11px; font-style: normal; text-transform: uppercase; }
.shift-guess-none { padding: 6px 9px; color: #a2aeb2; font-size: 11.5px; }
.shift-note { width: 100%; margin-top: 5px; color: #7f9099; font-size: 11px; }
.panel-footer-note { display: flex; align-items: center; gap: 7px; padding: 12px 18px; color: #849096; font-size: 11px; }.info-mark { width: 15px; height: 15px; display: inline-grid; place-items: center; border: 1px solid #aab5b7; border-radius: 50%; font-family: serif; font-size: 11px; }
.group-filter { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 13px; }.filter-chip { padding: 5px 9px; border: 1px solid #dadbd7; border-radius: 99px; color: #748087; background: #fff; font-size: 11px; }.filter-chip.active { border-color: #91cbc7; color: #176d69; background: #ebf9f7; }
.diff-panel { min-height: 0; margin-top: 14px; }
.diff-summary { padding: 16px 20px 6px; color: #5b6b72; font-size: 12px; line-height: 1.7; }.diff-summary b { color: #263941; }
.diff-subhead { grid-template-columns: .9fr .85fr .85fr 1.7fr; }
.diff-row { display: grid; grid-template-columns: .9fr .85fr .85fr 1.7fr; gap: 10px; align-items: center; min-height: 42px; padding: 7px 18px; border-bottom: 1px solid #eeece7; font-size: 12px; }
.diff-note { display: flex; align-items: center; min-width: 0; }
.diff-row.only-a .diff-note b, .diff-row.higher-a .diff-note b { color: #b3661f; }
.diff-row.only-b .diff-note b, .diff-row.higher-b .diff-note b { color: #b23a72; }
.diff-empty { padding: 26px 18px; color: #849096; font-size: 12px; text-align: center; }

.calc-panel { min-height: 0; margin-top: 14px; }
.calc-intro { margin: 0; padding: 16px 20px 4px; color: #5b6b72; font-size: 12px; line-height: 1.7; }.calc-intro b { color: #263941; }
.calc-block { padding: 16px 20px; border-top: 1px solid #ece9e2; }
.calc-block h4 { margin: 0 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: 16px; font-weight: 600; color: #1b2c35; }
.calc-missing p { margin: 0; color: #8a5a1f; font-size: 12px; line-height: 1.6; }
.calc-areas { display: grid; gap: 6px; margin-bottom: 14px; }
.calc-area { display: grid; grid-template-columns: 1.15fr 1.2fr 1.15fr .7fr 22px; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 6px; background: #faf9f5; font-size: 12px; }
.calc-area-conc { color: #157c78; text-align: right; }
.calc-area .delete-button { justify-self: end; }
.calc-step-sub { margin: -2px 0 2px 14px; color: #7c8a8f; font-size: 11.5px; line-height: 1.6; }
.calc-step-sub b { color: #445059; }
.calc-area span:first-child { color: #4b5b62; font-weight: 650; }
/* A species split over NH3 adducts: the windows are indented under their sum. */
.calc-area-adduct { margin-left: 14px; background: #fdfcf9; }
.calc-area-adduct span:first-child { color: #6f7d83; font-weight: 600; }
.calc-area-sum { background: #f2f8f7; border: 1px solid #dcece9; }
.calc-area-sum span:first-child { color: #157c78; }
.calc-area-addrow { padding: 0 10px; background: none; }
.calc-area-warn { background: #fdf4f0; color: #a2320a; }
.calc-area-warn span:nth-child(2) { color: #a2320a; font-weight: 600; }
.calc-adduct-button { padding: 2px 7px; border: 1px dashed #bcd4d1; border-radius: 5px; color: #157c78; background: transparent; font-size: 11px; font-weight: 750; cursor: pointer; }
.calc-adduct-button:hover { border-style: solid; background: #eef6f5; }
.calc-formula { display: grid; gap: 6px; margin-bottom: 14px; padding: 12px 14px; border: 1px dashed #d8dbd5; border-radius: 8px; background: #fbfaf7; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: #445059; }
.calc-step span:first-child { margin-right: 4px; color: #167c77; }
.calc-step b { color: #1b2c35; }
.calc-results { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calc-result { padding: 12px 14px; border: 1px solid #dcece9; border-radius: 10px; background: #f2f8f7; }
.calc-result-label { display: block; margin-bottom: 6px; color: #157c78; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.calc-result-formula { display: block; margin-bottom: 8px; color: #7c8a8f; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; line-height: 1.5; word-break: break-word; }
.calc-result-value { display: block; color: #1b2c35; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17.5px; }
.calc-result-log { display: block; margin-top: 4px; color: #7c8a8f; font-size: 11.5px; }
.calc-conc { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 0 20px 16px; padding: 13px 15px; border: 1px solid #dcece9; border-radius: 10px; background: #f2f8f7; }
.calc-conc label { display: flex; flex-direction: column; gap: 5px; color: #6f7d83; font-size: 11px; font-weight: 700; }
.calc-conc input { width: 118px; padding: 8px 9px; border: 1px solid #cfe0dd; border-radius: 7px; color: #273941; background: #fff; font-size: 12.5px; }
.calc-conc input:focus { border-color: #75bdb8; outline: none; box-shadow: 0 0 0 3px rgba(22,127,122,.08); }
.calc-conc-meta { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 4px 14px; color: #7c8a8f; font-size: 11px; line-height: 1.6; }
.calc-conc-source { color: #14615e; font-weight: 700; }
.calc-conc-hint b { color: #3f5158; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; }
.calc-empty { padding: 26px 20px; color: #849096; font-size: 12px; text-align: center; }
.calc-range { display: flex; align-items: center; gap: 4px; color: #7c8a8f; }
.calc-range-input { width: 62px; padding: 3px 5px; border: 1px solid #d6d9d5; border-radius: 5px; color: #304048; background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.calc-range-input:focus { border-color: #75bdb8; outline: none; box-shadow: 0 0 0 2px rgba(22,127,122,.1); }
.calc-add { padding: 16px 20px; border-top: 1px solid #ece9e2; background: #faf9f5; }
.calc-add h4 { margin: 0 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: 15px; font-weight: 600; color: #1b2c35; }
.calc-add-row { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.calc-add-row label { display: flex; flex-direction: column; gap: 5px; color: #6f7d83; font-size: 11px; font-weight: 700; }
.calc-add-row input { width: 110px; padding: 8px 9px; border: 1px solid #d6d9d5; border-radius: 7px; color: #273941; background: #fff; font-size: 12.5px; }
.calc-add-row input:focus { border-color: #75bdb8; outline: none; box-shadow: 0 0 0 3px rgba(22,127,122,.08); }
.calc-header-actions { display: flex; gap: 8px; }
/* --- Copy the species windows onto other spectra -------------------------- */
.calc-copy-dialog { width: min(620px, 92vw); }
.calc-copy-source { margin: 18px 0 16px; padding: 12px 14px; border: 1px solid #dcece9; border-radius: 10px; background: #f2f8f7; color: #4b6a68; font-size: 12px; line-height: 1.65; }
.calc-copy-source strong { color: #14615e; }
.calc-copy-windows { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 8px; }
.calc-copy-window { padding: 3px 7px; border: 1px solid #cfe0dd; border-radius: 99px; background: #fff; color: #3f5551; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.calc-copy-window small { color: #93a3a0; }
.calc-copy-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.calc-copy-label { margin-right: auto; color: #7c8a8f; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.calc-copy-list { max-height: 230px; overflow: auto; border: 1px solid #e2e0da; border-radius: 10px; }
.calc-copy-row { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-bottom: 1px solid #eeece7; cursor: pointer; }
.calc-copy-row:last-child { border-bottom: 0; }
.calc-copy-row:hover { background: #f7fbfa; }
.calc-copy-row:has(input:checked) { background: #eefaf8; }
.calc-copy-row input { flex: none; width: 13px; height: 13px; margin: 0; accent-color: #17807b; }
.calc-copy-row-main { min-width: 0; flex: 1; }
.calc-copy-row-main strong { display: block; overflow: hidden; color: #263941; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.calc-copy-row-main span { display: block; margin-top: 2px; color: #879399; font-size: 11px; }
.calc-copy-row-main span b { color: #a8734a; font-weight: 700; }
.calc-copy-empty { padding: 16px; color: #819096; font-size: 12px; text-align: center; }
.calc-copy-options { display: grid; gap: 9px; margin-top: 14px; }
.calc-copy-options label { display: flex; align-items: start; gap: 8px; color: #4b5b62; font-size: 12px; line-height: 1.5; cursor: pointer; }
.calc-copy-options input { flex: none; margin: 2px 0 0; accent-color: #17807b; }
.calc-copy-options b { color: #263941; }
.calc-copy-options small { display: block; margin-top: 2px; color: #879399; font-size: 11px; line-height: 1.6; }
.calc-copy-check { padding-top: 9px; border-top: 1px dashed #e2e0d8; }
/* --- Response factors  ------------------------------------ */
.rf-panel { min-height: 0; margin-top: 14px; }
.rf-header-actions { display: flex; gap: 8px; }
.rf-header-actions .secondary-button.active { border-color: #91cbc7; color: #14615e; background: #ebf9f7; }
.rf-step { padding: 18px 20px; border-top: 1px solid #ece9e2; }
.rf-step h4 { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: 16px; font-weight: 600; color: #1b2c35; }
.rf-sub { margin-top: 22px !important; padding-top: 16px; border-top: 1px dashed #e2e0d8; }
.rf-num { display: grid; place-items: center; flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; background: #16837e; color: #fff; font-family: system-ui, sans-serif; font-size: 12px; font-weight: 800; }
.rf-note { margin: 0 0 13px; color: #5b6b72; font-size: 12px; line-height: 1.7; }
.rf-note b { color: #263941; } .rf-note i { color: #4b5b62; }
.rf-demo-flag { color: #9a6a12; }
.rf-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 13px; }
.rf-fields label { display: flex; flex-direction: column; gap: 5px; color: #6f7d83; font-size: 11px; font-weight: 700; }
.rf-fields input { width: 110px; padding: 8px 9px; border: 1px solid #d6d9d5; border-radius: 7px; color: #273941; background: #fff; font-size: 12.5px; }
.rf-fields .rf-wide input { width: 190px; }
.rf-fields input:focus, .rf-row input:focus, .rf-row select:focus { border-color: #75bdb8; outline: none; box-shadow: 0 0 0 3px rgba(22,127,122,.08); }
.rf-row { display: grid; gap: 9px; align-items: center; padding: 6px 10px; border-radius: 6px; font-size: 12px; }
.rf-row + .rf-row { margin-top: 4px; }
.rf-row input, .rf-row select { min-width: 0; padding: 6px 8px; border: 1px solid #d6d9d5; border-radius: 6px; color: #273941; background: #fff; font-size: 12px; }
.rf-species-row { grid-template-columns: 1.6fr 52px 52px 74px 1.5fr 30px; background: #faf9f5; }
.rf-point-row { grid-template-columns: 1.9fr 1.3fr 92px 78px; background: #faf9f5; }
.rf-point-row.on { background: #f0f8f7; box-shadow: inset 2px 0 0 #16837e; }
.rf-sample-name { overflow: hidden; color: #3f5158; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.rf-formula-cell { color: #16837e; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.rf-subhead { display: grid; gap: 9px; align-items: end; padding: 4px 10px; color: #97a1a6; font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; background: none; }
.rf-subhead span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-species-row .calc-range { min-width: 0; gap: 5px; }
.rf-species-row .calc-range-input { width: 100%; min-width: 0; padding: 6px 7px; font-size: 12px; }
.rf-step > button { margin-top: 10px; }
.rf-tablewrap { max-width: 100%; margin-bottom: 13px; overflow-x: auto; border: 1px solid #e6e4dd; border-radius: 8px; }
.rf-table { width: 100%; border-collapse: collapse; font-size: 11.5px; white-space: nowrap; }
.rf-table th { padding: 7px 9px; border-bottom: 1px solid #e6e4dd; color: #6f7d83; background: #faf9f5; font-size: 11px; font-weight: 750; text-align: left; }
.rf-table th small { color: #9aa4a8; font-weight: 500; }
.rf-table td { padding: 6px 9px; border-bottom: 1px solid #f1efe9; color: #3f5158; }
.rf-table tr:last-child td { border-bottom: 0; }
.rf-table .rf-mat { background: #f0f8f7; color: #14615e; }
.rf-table th.rf-mat { background: #e4f2f0; }
.rf-table .muted { color: #97a1a6; }
.rf-table .rf-bad { color: #c2410c; font-weight: 700; }
.rf-results { margin-bottom: 4px; }
.rf-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 13px; }
.rf-chips .secondary-button { margin: 0; }
.rf-chip { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 11px; border: 1px solid #dcece9; border-radius: 8px; background: #f2f8f7; font-size: 12px; }
.rf-chip label { display: flex; align-items: center; gap: 5px; color: #6f7d83; font-weight: 700; }
.rf-chip input { width: 46px; padding: 5px 6px; border: 1px solid #cfe0dd; border-radius: 6px; color: #273941; background: #fff; font-size: 12px; }
.rf-chip input:focus { border-color: #75bdb8; outline: none; box-shadow: 0 0 0 3px rgba(22,127,122,.08); }
.rf-chip-tag { color: #14615e; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
.rf-chip-count { color: #8fa3a4; font-size: 11px; }
.rf-modes { display: grid; gap: 8px; margin-bottom: 13px; }
.rf-radio { display: grid; grid-template-columns: 16px 1fr; gap: 9px; align-items: start; padding: 9px 11px; border: 1px solid #e6e4dd; border-radius: 8px; background: #fbfaf7; color: #5b6b72; font-size: 12px; line-height: 1.65; cursor: pointer; }
.rf-radio:hover { border-color: #cfd6d3; }
.rf-radio input { margin: 2px 0 0; accent-color: #16837e; }
.rf-radio b { color: #263941; }
.rf-radio:has(input:checked) { border-color: #91cbc7; background: #f2f8f7; }
.rf-charge-tag { padding: 2px 8px; border: 1px solid #cfe0dd; border-radius: 99px; background: #f2f8f7; color: #14615e; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 700; }
.rf-range-empty input { border-style: dashed; color: #a7b0b3; background: #fbfaf7; }
.rf-method { background: #fcfbf8; }
.rf-method h5 { margin: 16px 0 7px; color: #16837e; font-family: system-ui, sans-serif; font-size: 11px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; }
.rf-method h5:first-of-type { margin-top: 0; }
.rf-method .calc-formula { background: #fff; }
.rf-method .calc-step span:first-child { display: inline-block; min-width: 62px; }
.rf-method .rf-note { margin-bottom: 0; }
.rf-method-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .rf-method-grid { grid-template-columns: 1fr; } }
.rf-skip-note { margin: -6px 0 12px; padding-left: 11px; border-left: 2px solid #e8dcc2; color: #7a6431; font-size: 11.5px; }
.rf-eq-block { margin-bottom: 18px; }
.rf-eq-block:last-child { margin-bottom: 0; }
.rf-warn { margin: 0 20px 14px; padding: 11px 13px; border: 1px solid #e8dcc2; border-radius: 8px; background: #fdf8ec; color: #7a6431; font-size: 12px; line-height: 1.65; }
.rf-warn div + div { margin-top: 6px; }
.rf-step .rf-warn { margin: 0 0 12px; }
/* A response factor that came out <= 0 is not a result, so it must not look like one. */
.rf-result-bad { border-color: #e6b8a2; background: #fdf3ee; }
.rf-result-bad .calc-result-value { color: #c2410c; }
.calc-result-log.rf-bad { color: #c2410c; font-weight: 600; }
.rf-group-note { padding-left: 11px; border-left: 2px solid #bfe3df; color: #2c6b67; }
.rf-table .rf-why { color: #9a7b3c; font-family: inherit; font-size: 11px; text-align: left; white-space: normal; }
/* Sum x*corr is an identity, not a measurement - shown, but visibly not a result. */
.rf-table .rf-identity { color: #8b9498; background: #f6f8f8; }
.rf-table .rf-lambda { color: #167c77; background: #f2fbfa; }
/* Editable peak areas: visible as inputs, and unmistakable once overridden. */
.rf-area-cell { position: relative; padding: 2px 3px; }
.rf-area-input { width: 100%; min-width: 62px; padding: 3px 4px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #879399; font-family: ui-monospace, monospace; font-size: 11px; text-align: right; }
.rf-area-input:hover { border-color: #dfe4e2; background: #fff; }
.rf-area-input:focus { border-color: #16837e; background: #fff; color: #263941; outline: none; }
.rf-area-edited { background: #fff6ee; }
.rf-area-edited .rf-area-input { color: #c2410c; font-weight: 700; }
.rf-area-reset { position: absolute; top: 1px; right: 1px; padding: 0 3px; border: 0; border-radius: 3px; background: none; color: #c2410c; cursor: pointer; font-size: 11px; line-height: 1.4; }
.rf-area-reset:hover { background: #fde6d6; }
.rf-edit-note { margin: -4px 0 12px; padding-left: 11px; border-left: 2px solid #dfe4e2; color: #7a848a; font-size: 11.5px; }
/* Step 5b — the recovery step shown only when a response factor comes out < 0 */
.rf-rescue { margin: 14px 0 4px; padding: 14px 15px; border: 1px solid #e6c4a8; border-radius: 10px; background: #fffaf5; }
.rf-rescue .rf-sub { margin-top: 0; }
.rf-rescue-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); margin: 10px 0; }
.rf-rescue-option { display: flex; flex-direction: column; gap: 7px; padding: 11px 12px; border: 1px solid #eddfd0; border-radius: 8px; background: #fff; }
.rf-rescue-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; color: #4b3a2c; font-size: 12px; }
.rf-rescue-count { padding: 1px 6px; border-radius: 4px; background: #f4ece3; color: #8a6d52; font-size: 11px; }
.rf-rescue-why { margin: 0; color: #7a6a5c; font-size: 11.5px; line-height: 1.6; }
.rf-rescue-eq { font-size: 11px; }
.rf-rescue-option button { align-self: flex-start; }
.rf-term { display: inline-block; padding: 1px 4px; border-radius: 4px; background: #f4ece3; white-space: nowrap; }

/* ---- Tables panel ---- */
.table-panel .calc-intro code { padding: 1px 4px; border-radius: 4px; background: #eef3f2; font-size: 11px; }
.table-builder { display: grid; grid-template-columns: minmax(190px, 260px) 1fr; gap: 18px; padding: 0 20px 14px; align-items: start; }
@media (max-width: 900px) { .table-builder { grid-template-columns: 1fr; } }
.table-builder h4 { margin: 0 0 8px; color: #46565d; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.table-rows { display: grid; gap: 3px; max-height: 210px; overflow: auto; }
.table-row-pick { display: flex; gap: 7px; align-items: center; padding: 5px 7px; border: 1px solid transparent; border-radius: 6px; color: #6b7a80; cursor: pointer; font-size: 11.5px; }
.table-row-pick:hover { background: #f4f7f6; }
.table-row-pick.on { border-color: #cfe8e5; background: #f2fbfa; color: #29585a; }
.table-cols { display: grid; gap: 7px; }
.table-col-row { display: grid; grid-template-columns: 22px minmax(90px, 1fr) minmax(150px, 1.6fr) 26px; gap: 7px; align-items: center; }
.table-letter { display: grid; place-items: center; height: 22px; border-radius: 5px; background: #eef3f2; color: #46565d; font-size: 11px; }
.table-col-row input, .table-col-row select { min-height: 28px; padding: 4px 7px; border: 1px solid #dfe4e2; border-radius: 6px; background: #fff; color: #263941; font-size: 11.5px; }
.table-col-row input:focus, .table-col-row select:focus { border-color: #16837e; outline: none; }
.table-formula { font-family: ui-monospace, monospace !important; color: #167c77 !important; }
.data-table th { vertical-align: bottom; }
.table-letter-mini { display: block; color: #a2adb2; font-size: 11px; font-weight: 700; }
.table-err { color: #c2410c; font-size: 11px; }

/* ---- Plots over the table ---- */
.plot-section { padding: 4px 20px 20px; }
.plot-section > h4 { margin: 10px 0 6px; color: #46565d; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.calc-intro.tight { padding: 0 0 12px; }
.table-plots { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; align-items: start; }
.plot-card { padding: 10px 11px 11px; border: 1px solid #e6e4dd; border-radius: 10px; background: #fbfaf7; }
.plot-card.wide { grid-column: 1 / -1; }
.plot-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.plot-controls input.plot-title { flex: 1 1 120px; min-width: 96px; }
.plot-controls input, .plot-controls select, .plot-axis select { min-height: 27px; padding: 3px 6px; border: 1px solid #dfe4e2; border-radius: 6px; background: #fff; color: #263941; font-size: 11.5px; }
.plot-controls input:focus, .plot-controls select:focus, .plot-axis select:focus { border-color: #16837e; outline: none; }
.plot-controls .secondary-button.compact { min-height: 27px; padding: 0 8px; font-size: 11px; }
/* The two axis pickers are the part people look for, so they get their own
   labelled boxes below the title row rather than sitting in the button strip. */
.plot-axes { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.5fr) auto; gap: 8px; align-items: stretch; margin-bottom: 9px; }
@media (max-width: 620px) { .plot-axes { grid-template-columns: 1fr; } }
.plot-card.wide .plot-axes { grid-template-columns: minmax(180px, 300px) minmax(240px, 1fr) auto; }
/* Column so the control sits at the bottom of the box however many lines the
   label wraps to — the X and Y boxes then line up whatever the card's width. */
.plot-axis { min-width: 0; display: flex; flex-direction: column; padding: 6px 8px 7px; border: 1px solid #e6e4dd; border-radius: 8px; background: #fff; }
.plot-axis > label { display: block; margin-bottom: 5px; color: #8b9599; font-size: 11px; font-weight: 700; }
.plot-axis > label b { display: inline-grid; place-items: center; width: 14px; height: 14px; margin-right: 4px; border-radius: 4px; color: #fff; background: #16837e; font-size: 11px; vertical-align: -2px; }
.plot-axis > select, .plot-axis > .plot-ypicks { margin-top: auto; }
.plot-axis > select { width: 100%; }
.plot-fitbox { align-self: end; }
.plot-ypicks { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.plot-chip { max-width: 100%; display: inline-flex; gap: 5px; align-items: center; padding: 3px 7px; border: 1px solid #dfe4e2; border-radius: 5px; color: #7b8990; background: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.plot-chip i { flex: none; width: 7px; height: 7px; border-radius: 2px; }
.plot-chip b { flex: none; font-weight: 800; }
.plot-chip span { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.plot-chip.on { border-width: 1.5px; background: #f7fbfa; }
.plot-chip:hover { border-color: #b7c6c4; background: #f4f7f6; }
.plot-fitbox { display: inline-flex; gap: 5px; align-items: center; padding: 0 9px; min-height: 32px; border: 1px solid #dfe4e2; border-radius: 8px; background: #fff; color: #5b6a70; font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.plot-fitbox.off { opacity: .45; cursor: not-allowed; }
.plot-fitbox input { margin: 0; accent-color: #16837e; }
.plot-heading { margin: 0 0 4px; color: #263941; font-family: Georgia, "Times New Roman", serif; font-size: 15px; font-weight: 500; }
.plot-svg { display: block; width: 100%; height: auto; border: 1px solid #eceae3; border-radius: 8px; background: #fff; }
.plot-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 7px; color: #6b7a80; font-size: 11px; }
.plot-legend span { display: inline-flex; gap: 5px; align-items: center; }
.plot-legend i { width: 9px; height: 9px; border-radius: 2px; }
.plot-hint { color: #97a1a6; font-size: 11px; font-style: italic; }
.plot-empty { padding: 34px 16px; border: 1px dashed #dfe4e2; border-radius: 8px; color: #8b9599; background: #fff; font-size: 11.5px; text-align: center; }

.assignment-table { max-height: 330px; overflow: auto; }.assignment-row { display: grid; grid-template-columns: 1fr 68px 32px; gap: 9px; align-items: center; padding: 10px 20px; border-top: 1px solid #eeece7; }.assignment-row.hidden { display: none; }
.assignment-main { min-width: 0; }.assignment-main strong { display: block; overflow: hidden; color: #263941; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }.assignment-main span { display: block; margin-top: 3px; color: #879399; font-size: 11px; }.assignment-mz { color: #167c77; font-family: ui-monospace, monospace; font-size: 12px; }.assignment-tag { display: inline-block; max-width: 100%; margin-left: 6px; padding: 2px 5px; border-radius: 4px; background: #f0f0eb; color: #67747a; overflow: hidden; vertical-align: middle; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { min-height: 220px; display: grid; place-content: center; justify-items: center; padding: 20px; color: #819096; text-align: center; }.empty-state.hidden { display: none; }.empty-glyph { width: 39px; height: 39px; display: grid; place-items: center; margin-bottom: 10px; border: 1px solid #d3d9d6; border-radius: 50%; color: #16837e; background: #edf9f7; font-size: 21px; }.empty-state strong { color: #4b5b62; font-family: Georgia, serif; font-size: 16px; }.empty-state p { max-width: 250px; margin: 6px 0; font-size: 11px; line-height: 1.55; }.empty-state p b { color: #1c7f7b; }
.source-details { margin: 14px 2px 0; color: #899397; font-size: 11px; line-height: 1.5; }

dialog { border: 0; border-radius: 16px; color: var(--ink); background: var(--panel); box-shadow: 0 28px 90px rgba(3,16,24,.32); }dialog::backdrop { background: rgba(7,19,27,.62); backdrop-filter: blur(4px); }
.assignment-dialog { width: min(570px, 90vw); padding: 0; }.assignment-dialog form { padding: 23px; }.dialog-header { display: flex; align-items: start; justify-content: space-between; }.dialog-close { width: 30px; height: 30px; border: 0; border-radius: 50%; color: #7e8a8e; background: #f0efe9; font-size: 22px; line-height: 1; }.selected-peak { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 19px 0; border: 1px solid #dfe2dd; border-radius: 10px; background: #dfe2dd; overflow: hidden; }.selected-peak > div { padding: 11px 13px; background: #f8f8f4; }.selected-peak span { display: block; margin-bottom: 3px; color: #849096; font-size: 11px; font-weight: 750; text-transform: uppercase; }.selected-peak strong { color: #167f7a; font-family: ui-monospace, monospace; font-size: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 115px 80px; gap: 13px; }.form-grid label { color: #6f7d83; font-size: 11px; font-weight: 700; }.form-grid .wide { grid-column: 1 / -1; }.form-grid input:not([type=color]), .form-grid select, .form-grid textarea { width: 100%; margin-top: 6px; padding: 9px 10px; border: 1px solid #d6d9d5; border-radius: 7px; color: #273941; background: #fff; outline: none; font-size: 12.5px; }.form-grid select { height: 35px; }.form-grid input:focus, .form-grid textarea:focus { border-color: #75bdb8; box-shadow: 0 0 0 3px rgba(22,127,122,.08); }.form-grid input[type=color] { display: block; width: 100%; height: 35px; margin-top: 6px; padding: 3px; border: 1px solid #d6d9d5; border-radius: 7px; background: #fff; }.form-grid textarea { resize: vertical; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.import-note { margin: 14px 0; padding: 11px 13px; border: 1px solid #e4e0d3; border-radius: 8px; background: #fbf8ef; color: #6f6248; font-size: 11.5px; line-height: 1.6; }.import-note b { color: #4b4130; }
.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }.import-grid label { color: #6f7d83; font-size: 11px; font-weight: 700; }.import-grid .wide { grid-column: 1 / -1; }.import-grid input { display: block; width: 100%; margin-top: 6px; padding: 9px 10px; border: 1px solid #d6d9d5; border-radius: 7px; color: #273941; background: #fff; outline: none; font-size: 12.5px; }.import-grid input:focus { border-color: #75bdb8; box-shadow: 0 0 0 3px rgba(22,127,122,.08); }.import-grid input[type=file] { padding: 7px; font-size: 12px; }
.import-status { margin: 12px 0 0; color: #5b6b72; font-size: 12px; line-height: 1.6; }
.import-raw { margin: 16px 0 4px; padding: 14px; border: 1px solid #cfe6e3; border-radius: 10px; background: #f2f8f7; }
.import-raw-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.import-raw-head strong { display: block; color: #14615e; font-size: 12.5px; }
.import-raw-head span { display: block; margin-top: 3px; color: #6d8481; font-size: 11px; }
.import-recent { margin-top: 11px; }
.import-recent:empty { display: none; }
.import-recent-head { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.import-recent-head .primary-button { margin-left: auto; }
.import-recent-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.import-recent-label { color: #7c8a8f; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.recent-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 230px; padding: 4px 9px 4px 7px; border: 1px solid #cfd9d7; border-radius: 99px; background: #fff; }
.recent-chip:hover { border-color: #75bdb8; background: #eafaf7; }
.recent-chip:has(.recent-check:checked) { border-color: #2fa39c; background: #e3f7f4; }
.recent-check { flex: none; width: 12px; height: 12px; margin: 0; accent-color: #17807b; cursor: pointer; }
.recent-chip-open { max-width: 185px; padding: 1px 0; border: 0; color: #3f5551; background: none; font: inherit; font-size: 11px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.recent-chip-open:hover { color: #14615e; text-decoration: underline; }
.recent-chip-open small { margin-left: 6px; color: #93a3a0; }
.help-dialog { width: min(520px, 90vw); padding: 26px; }.help-dialog .dialog-close { float: right; }.help-grid { display: grid; gap: 1px; margin: 20px 0; border: 1px solid #e0e1dc; border-radius: 10px; background: #e0e1dc; overflow: hidden; }.help-grid > div { display: grid; grid-template-columns: 92px 1fr; align-items: center; padding: 10px 12px; color: #65747b; background: #faf9f5; font-size: 12px; }.help-grid kbd { width: max-content; color: #176f6b; background: #edf9f7; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; padding: 10px 14px; border-radius: 8px; color: #e8f6f5; background: #16333d; box-shadow: 0 10px 35px rgba(0,0,0,.22); font-size: 12px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }.toast.visible { opacity: 1; transform: none; }

@media (max-width: 1300px) {
  .workspace { padding: 25px 25px 20px; }
  .analysis-grid { grid-template-columns: 1fr; }
  .threshold-control { display: none; }
  .calc-results { grid-template-columns: 1fr; }
  .calc-area, .diff-row { grid-template-columns: 1fr; gap: 3px; }
  .rf-results { grid-template-columns: 1fr; }
}

@media (max-width: 1120px) {
  body { min-width: 960px; }
  .app-shell { grid-template-columns: 250px minmax(0,1fr); }
  .sidebar { padding-inline: 13px; }.workspace { padding-inline: 18px; }
  .tool span, .scale-control > span { display: none; }
}

/* ---------------------------------------------------------------- copilot --
   The chat panel. Two colour rules carry meaning and should not be prettified
   away: a STAGED tool line is amber (nothing has happened yet) and a destructive
   line in the review list is red-edged, because Apply runs the whole list. */
.copilot-panel { margin-bottom: 18px; }
.cop-model { color: var(--muted); font-size: 12.5px; font-family: ui-monospace, "SF Mono", Consolas, monospace; }

.cop-setup { margin: 4px 0 2px; padding: 12px 14px; border: 1px solid #f0dcc0; border-left: 3px solid var(--amber); border-radius: 10px; background: #fdf7ee; font-size: 14.5px; line-height: 1.55; }
.cop-setup code { padding: 1px 5px; border-radius: 4px; background: rgba(13,26,36,.06); font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }

.cop-log { max-height: 340px; overflow-y: auto; margin: 6px 0 0; padding: 2px; scrollbar-width: thin; }
.cop-log:empty { display: none; }
.cop-msg { max-width: 86%; margin: 7px 0; padding: 9px 13px; border-radius: 13px; font-size: 15px; line-height: 1.55; }
.cop-user { margin-left: auto; border-bottom-right-radius: 4px; color: #0d1a24; background: var(--cyan-soft); }
.cop-assistant { border: 1px solid var(--line); border-bottom-left-radius: 4px; background: var(--panel); }
.cop-note { margin: 6px 2px; color: var(--muted); font-size: 13px; font-style: italic; }
.cop-note.bad { color: var(--danger); font-style: normal; font-weight: 600; }
/* One line per tool call, so it is always visible what the copilot actually did. */
.cop-tool { margin: 3px 2px; color: var(--muted); font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; letter-spacing: .2px; }
.cop-tool::before { content: "› "; }
.cop-tool.write { color: #a16207; font-weight: 600; }

.cop-pending { margin: 12px 0 4px; padding: 13px 15px; border: 1px solid #cfeae7; border-left: 3px solid var(--cyan); border-radius: 12px; background: #f3fbfa; }
.cop-pending-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 9px; font-size: 15px; }
.cop-pending-note { color: var(--muted); font-size: 13px; }
.cop-diff { margin: 0 0 12px; padding-left: 20px; font-size: 14.5px; line-height: 1.7; }
.cop-diff li { padding-left: 2px; }
.cop-diff li.danger { color: #8c2f2f; }
.cop-diff li.danger::marker { color: var(--danger); }
.cop-mono { color: var(--muted); font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }
.cop-pending-actions { display: flex; gap: 9px; }

.cop-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: end; margin-top: 12px; }
.cop-form textarea { width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); font-size: 15px; line-height: 1.5; resize: vertical; }
.cop-form textarea:focus { outline: 0; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(73,214,207,.16); }
.cop-form textarea:disabled { opacity: .55; }

.cop-examples { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.cop-chip { padding: 5px 11px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); background: var(--panel); font-size: 13px; transition: .15s ease; }
.cop-chip:hover { border-color: var(--cyan); color: var(--ink); background: #f3fbfa; }

.cop-thinking { display: flex; align-items: center; gap: 4px; margin: 10px 2px 0; color: var(--muted); font-size: 14px; }
.cop-thinking span { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); animation: cop-pulse 1.15s ease-in-out infinite; }
.cop-thinking span:nth-child(2) { animation-delay: .16s; }
.cop-thinking span:nth-child(3) { animation-delay: .32s; margin-right: 5px; }
@keyframes cop-pulse { 0%, 70%, 100% { opacity: .25; transform: scale(.85); } 35% { opacity: 1; transform: scale(1); } }
/* `hidden` only sets display:none at the lowest priority, so the display:flex and
   display:grid above silently defeated it and the spinner and the input box were
   always on screen. Restate it for the elements that get toggled. */
.cop-thinking[hidden], .cop-form[hidden], .cop-pending[hidden], .cop-setup[hidden], .cop-model[hidden] { display: none; }
.cop-setup-why { margin-top: 8px; padding-top: 8px; border-top: 1px solid #f0dcc0; color: #8a5a12; font-size: 14px; }
/* White background option for the spectrum plot (Background: White in the chart
   toolbar). The canvases are drawn for a dark ground, so they are inverted with
   the hues turned back — every trace, label and module layer stays readable. */
.chart-card.chart-white .chart-wrap { background: #fff; }
.chart-card.chart-white .chart-wrap canvas { filter: invert(1) hue-rotate(180deg) brightness(.7) saturate(2.4); }
.chart-card.chart-white .chart-empty { color: #5a6b73; }

/* Drag-and-drop target: shown while files or a .D folder are dragged over the window. */
.drop-hint { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 30px; background: rgba(20, 154, 147, .14); pointer-events: none; }
.drop-hint > div { display: grid; gap: 6px; padding: 28px 40px; border: 3px dashed #149a93; border-radius: 20px; background: rgba(255, 255, 255, .95); color: #13212b; text-align: center; box-shadow: 0 20px 60px rgba(13, 26, 36, .2); }
.drop-hint b { font-size: 22px; }
.drop-hint span { color: #5b6a72; font-size: 14px; }
