:root {
  --bg: #eef0f3; --panel: #fff; --line: #e3e6ea; --line-2: #eef0f3;
  --text: #16202c; --muted: #6b7480; --faint: #9aa2ad;
  --accent: #2f6feb; --accent-dk: #1f57c3; --accent-bg: #eaf1fe;
  --ok: #14713a; --ok-bg: #e6f6ec; --warn: #9a5b00; --warn-bg: #fff6e8; --danger: #cf222e;
  --r: 9px; --r-sm: 6px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.07);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text); background: var(--bg); display: flex; flex-direction: column; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd3da; border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }

/* ---------- topbar ---------- */
.topbar { height: 52px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 14px; background: #131c29; color: #fff; }
.brand { font-weight: 700; font-size: 16px; }
.chip { display: inline-flex; align-items: center; gap: 7px; max-width: 260px; padding: 4px 11px; border-radius: 999px;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.14); color: #dfe6ee; cursor: pointer; font-size: 12.5px; }
.chip:hover { background: rgba(255,255,255,.16); }
.chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: #6b7480; flex: none; }
.chip.ready .chip-dot { background: #37d67a; } .chip.warn .chip-dot { background: #ffb020; }
.coach { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; justify-content: center; color: #c8d3e0; font-size: 12.8px; }
.coach span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach-dot { width: 8px; height: 8px; border-radius: 50%; background: #4c8dff; box-shadow: 0 0 0 4px rgba(76,141,255,.18); flex: none; }
.coach.done .coach-dot { background: #37d67a; box-shadow: 0 0 0 4px rgba(55,214,122,.18); }
.coach b { color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 7px; margin-left:auto; flex-shrink:0; }
.divider { width: 1px; height: 20px; background: rgba(255,255,255,.16); }
.icon-btn { width: 30px; height: 30px; border-radius: var(--r-sm); border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06);
  color: #e6ecf3; cursor: pointer; font-size: 14px; line-height: 1; }
.icon-btn:hover { background: rgba(255,255,255,.16); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.lang-btn { width: auto; min-width: 30px; padding: 0 8px; font-size: 12px; font-weight: 600; }
/* (appearance none: WebKit otherwise draws a white native control on the dark bar) */
#dpiTop { width: auto; -webkit-appearance: none; appearance: none; color: #e6ecf3; border: 1px solid rgba(255,255,255,.16); border-radius: var(--r-sm); padding: 5px 22px 5px 8px; cursor: pointer;
  background: rgba(255,255,255,.08) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23c8d3e0' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 7px center; }
#dpiTop option { color: #000; }
.split { display: inline-flex; }
.split .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split .caret { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 6px 8px; border-left: 1px solid rgba(255,255,255,.3); }
.menu-wrap { position: relative; }
.text-btn { height: 30px; border: none; background: none; color: #dfe6ef; font-size: 13px; padding: 0 8px; border-radius: var(--r-sm); cursor: pointer; }
.text-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 230px; background: #fff; color: var(--text); border-radius: var(--r);
  box-shadow: 0 10px 34px rgba(16,24,40,.24); padding: 5px; }
.menu.right { left: auto; right: 0; }
.menu button, .menu label { display: block; width: 100%; text-align: left; border: none; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.menu button:hover, .menu label:hover { background: #f2f5f9; }
.menu small { display: block; color: var(--faint); font-size: 11.5px; margin-top: 1px; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.menu .danger { color: var(--danger); }
.menu-check { display: flex !important; align-items: center; gap: 6px; font-size: 12.5px !important; }
.menu-check input { width: auto; margin: 0; accent-color: var(--accent); }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-sm);
  border: 1px solid #d3d8de; background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; transition: .12s; }
.btn:hover { border-color: #b9c1ca; background: #fbfcfd; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn.ghost { background: transparent; border-color: transparent; color: #cfd8e3; }
.btn.ghost:hover { background: rgba(255,255,255,.1); }
#panel .btn.ghost, #quantPanel .btn.ghost, .col-head .btn.ghost { color: var(--muted); }
#panel .btn.ghost:hover, #quantPanel .btn.ghost:hover, .col-head .btn.ghost:hover { background: #f2f4f7; color: var(--text); }
.btn.sm { padding: 4px 9px; font-size: 12.3px; }
.btn.big { padding: 9px 14px; font-size: 13.5px; }
input[type=number], input[type=text], select, textarea { border: 1px solid #d3d8de; border-radius: var(--r-sm); padding: 5px 8px; background: #fff; width: 100%; transition: .12s; }
/* A native popup button is ~8px shorter in Safari than in Chromium, so a select no longer lines up with the
   28px inputs and buttons beside it. Draw the control ourselves instead (same chevron as #dpiTop). */
select:not(#dpiTop) { -webkit-appearance: none; appearance: none; height: 28px; padding: 0 24px 0 8px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237a8799' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 8px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
input[type=range] { flex: 1; min-width: 80px; width: 100%; -webkit-appearance: none; height: 4px; border-radius: 3px; background: #dfe3e8; outline: none; box-shadow: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 1.5px solid var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.2); cursor: pointer; }
input[type=number].num, input[type=text].num, .num { width: 64px; }
textarea { resize: vertical; }
.switch { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.3px; cursor: pointer; user-select: none; }
.switch input { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; cursor: pointer; }

/* ---------- layout ---------- */
#app { flex: 1; display: flex; min-height: 0; }
#panel { width: 316px; flex: none; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; }
#stage { flex: 1; display: flex; min-width: 0; gap: 1px; background: var(--line); }
.pane-col { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #f6f7f9; }
#rawCol { flex: 1.2; }
.col-head { flex: none; height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--line); }
.col-title { font-weight: 700; font-size: 13px; }
.col-sub { color: var(--faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { flex: 1; }
.zoomlabel { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

#editorBox { flex: 1; position: relative; overflow: hidden; outline: none; background:
  linear-gradient(rgba(0,0,0,.035) 1px, transparent 1px) 0 0/22px 22px, linear-gradient(90deg, rgba(0,0,0,.035) 1px, transparent 1px) 0 0/22px 22px, #f7f8fa; }
#editorBox:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-bg); }
#editor { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#dropHint { position: absolute; inset: 22px; border: 2px dashed #c6ccd4; border-radius: 14px; color: var(--faint); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; pointer-events: none; background: rgba(255,255,255,.55); transition: .15s; }
.dh-icon { font-size: 34px; } .dh-text { font-size: 15px; color: var(--muted); font-weight: 600; } .dh-sub { font-size: 12px; }
body.dragging #dropHint, #editorBox.drag #dropHint { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-dk); }
body.dragging #dropHint.hidden { display: flex !important; z-index: 5; }

#previewBox { flex: 1; position: relative; overflow: auto; display: flex; }
#preview { margin: auto; padding: 24px 24px 24px 64px; position: relative; }     /* (room for the row tags on the left) */
#preview svg { display: block; background: #fff; box-shadow: 0 2px 16px rgba(16,24,40,.13); }
#preview .ed { cursor: text; }
/* Highlight editable labels without blurring small text. */
#preview .ed:hover text, #preview .ed.active text { fill: #2f6feb; }
#preview g[data-edit="arrow"]:hover path { fill: #2f6feb; }
#preview g[data-edit="bracket"]:hover path { stroke: #2f6feb; }
#preview g[data-edit="cond"] { cursor: pointer; }
#preview g[data-edit="arrow"] { cursor: ns-resize; }

#preview.arming image[data-edit="gel"] { cursor: crosshair; }
#preview .ghost-group { pointer-events: none; }
.mode-banner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: #16202c; color: #fff; border-radius: 16px;
  padding: 6px 8px 6px 16px; font-size: 12.5px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); z-index: 4;
  width: max-content; max-width: calc(100% - 24px); line-height: 1.4; }   /* (a long hint wraps instead of running off both ends) */
.mode-banner button { flex: none; white-space: nowrap; border: none; background: rgba(255,255,255,.14); color: #fff; border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: 12px; }
#viewBanner { max-width: calc(100% - 24px); }
#viewBanner span { overflow: hidden; text-overflow: ellipsis; }
#viewBanner #viewModeText { min-width: 0; }
#viewBanner #viewModeExtra { display: flex; gap: 6px; flex: none; overflow: visible; }
#viewBanner #viewModeExtra:empty { display: none; }

/* ---------- panel ---------- */
.sec { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.sec-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; margin-bottom: 10px; }
.sec-n { width: 20px; height: 20px; border-radius: 50%; background: #eef1f5; color: var(--muted); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.sec.done .sec-n { background: var(--ok-bg); color: var(--ok); }
.sec.done .sec-n::before { content: "✓"; } .sec.done .sec-n { font-size: 0; } .sec.done .sec-n::before { font-size: 11px; }
.sec.todo .sec-n { background: var(--accent); color: #fff; }
.sec-status { margin-left: auto; font-weight: 400; font-size: 11.5px; color: var(--faint); }
.sec-status.warn { color: var(--warn); }
.h3-note { font-weight: 400; color: var(--faint); font-size: 11.5px; margin-left: 4px; }
.lead { color: var(--muted); font-size: 12.3px; margin: 0 0 8px; }
.lead b { color: var(--text); }
.field { margin: 9px 0; }
.field > label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.field b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-label { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.range-row { color: var(--muted); font-size: 12.5px; flex-wrap: nowrap; }
.range-row select { width: auto; min-width: 60px; }
.hint { color: var(--faint); font-size: 11.5px; margin: 6px 0 0; line-height: 1.55; }
.hint code, .lead code { background: #f1f3f6; padding: 1px 4px; border-radius: 4px; }
.adv { margin-top: 8px; }
.adv > summary { cursor: pointer; color: var(--muted); font-size: 12px; list-style: none; padding: 3px 0; }
.adv > summary::-webkit-details-marker { display: none; }
.adv > summary::before { content: "▸"; display: inline-block; width: 12px; color: var(--faint); transition: .15s; }
.adv[open] > summary::before { transform: rotate(90deg); }
.adv.flush { margin: 0; }
.adv > summary.as-summary { color: var(--text); font-size: 13.5px; margin: 0; }
.adv > summary.as-summary::before { display: none; }
#histo { width: 100%; height: 40px; display: block; border-radius: var(--r-sm); background: #f6f8fa; }
.seg { display: inline-flex; background: #f1f3f6; border-radius: 8px; padding: 3px; gap: 2px; }
.seg.full { display: flex; }
.seg.full button { flex: 1; }
.seg button { border: none; background: none; padding: 5px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 12.3px; }
.seg button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16,24,40,.1); }

.list { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; margin-top: 6px; }
.item { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: var(--r-sm); }
.item:hover { background: #f6f8fb; }
.item.sel { background: var(--accent-bg); }
.item.out { opacity: .45; }
.item .idx { width: 22px; text-align: right; color: var(--faint); font-variant-numeric: tabular-nums; font-size: 11.5px; flex: none; }
.item input[type=text] { flex: 1; min-width: 0; border-color: transparent; background: transparent; padding: 3px 6px; }
.item input[type=text]:hover { background: #fff; border-color: #e0e4e9; }
.item .x { border: none; background: none; color: var(--faint); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 3px; border-radius: 4px; }
.item .x:hover { color: var(--danger); background: #fdecee; }
.item .tag { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: #eef1f5; color: var(--muted); flex: none; }
.item .tag.ok { background: var(--ok-bg); color: var(--ok); } .item .tag.man { background: #fdf0e0; color: var(--warn); }
.item .kind { font-size: 11px; color: var(--faint); flex: none; min-width: 28px; white-space: nowrap; }

.crop-lanes { margin-top: 10px; padding: 9px 11px; border-radius: var(--r); background: #f6f8fb; }
.cl-head { font-size: 12.3px; font-weight: 600; }
.crop-lanes .field { margin: 7px 0 0; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tool { border: 1px solid var(--line); background: #fff; border-radius: var(--r); padding: 8px 6px; cursor: pointer; text-align: center; font-size: 12.3px; transition: .12s; }
.tool:hover { border-color: var(--accent); background: var(--accent-bg); }
.tool.on { border-color: var(--accent); background: var(--accent); color: #fff; }
.tool.on small { color: rgba(255,255,255,.8); }
.tool .ti { display: block; font-size: 16px; line-height: 1.2; margin-bottom: 2px; }
.tool small { display: block; color: var(--faint); font-size: 10.5px; line-height: 1.3; margin-top: 2px; }

.empty { padding: 40px 24px; text-align: center; }
.empty-icon { font-size: 40px; color: #cfd6de; }
.empty h2 { font-size: 16px; margin: 10px 0 6px; }
.empty p { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 0 0 18px; }
.empty .btn { display: flex; width: 100%; margin-bottom: 8px; }
.empty .privacy { font-size: 11.5px; color: var(--faint); margin-top: 14px; }
.empty .hint { font-size: 11.5px; line-height: 1.6; margin: 10px 0 0; }
.empty .hint a { color: var(--accent, #2f6fdb); }
.storage-note { color: #a15c00; }
.storage-note.panel-note { margin: 10px 16px 0; padding: 7px 10px; background: #fff6e6; border-radius: var(--r); font-size: 11.5px; line-height: 1.5; }
.legend { margin: 12px 16px 20px; padding: 10px 12px; background: #f6f8fb; border-radius: var(--r); font-size: 11.8px; color: var(--muted); line-height: 1.6; }
.legend:empty { display: none; }
.legend b { color: var(--text); display: block; margin-bottom: 2px; }

/* ---------- floating editor / popover ---------- */
.float-ed { position: fixed; z-index: 70; width: 140px; padding: 4px 8px !important; border: 1.5px solid var(--accent) !important; border-radius: 6px;
  box-shadow: 0 6px 20px rgba(16,24,40,.22) !important; font-size: 13px; background: #fff; }
.popover { position: fixed; z-index: 70; background: #fff; border-radius: var(--r); box-shadow: 0 10px 34px rgba(16,24,40,.25); padding: 12px; width: 250px; }
.popover h4 { margin: 0 0 8px; font-size: 12.5px; overflow-wrap: anywhere; }
.popover .field { margin: 7px 0; }
.popover .est { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.popover .est b { color: var(--text); }
.popover .actions { display: flex; gap: 6px; margin-top: 10px; }
.popover .actions .btn { flex: 1; }
.popover .danger { color: var(--danger); }

/* ---------- overlays ---------- */
#warnings { position: fixed; right: 18px; bottom: 16px; z-index: 15; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; max-width: 520px; }
#warnings div { background: var(--warn-bg); color: var(--warn); border: 1px solid #f2ddba; border-radius: 10px; padding: 7px 12px; font-size: 12px; box-shadow: var(--shadow); display: flex; gap: 8px; align-items: flex-start; }
#warnings div button { border: none; background: none; color: inherit; cursor: pointer; opacity: .6; font-size: 14px; line-height: 1; padding: 0; }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #16202c; color: #fff; border-radius: 999px; padding: 8px 18px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(16,24,40,.24); animation: toastIn .22s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.dlg { position: fixed; inset: 0; background: rgba(14,20,28,.42); display: flex; align-items: center; justify-content: center; z-index: 90; }
.dlg-body { position: relative; background: #fff; border-radius: 14px; padding: 22px 28px; max-width: 640px; max-height: 86vh; overflow: auto; box-shadow: 0 20px 60px rgba(16,24,40,.3); }
.dlg-body h3 { margin: 14px 0 6px; font-size: 14px; } .dlg-body h3:first-of-type { margin-top: 0; }
.dlg-body li { margin: 4px 0; }
.dlg-x { position: absolute; top: 12px; right: 14px; border: none; background: none; font-size: 22px; color: var(--faint); cursor: pointer; }
#busy { position: fixed; inset: 0; background: rgba(247,249,251,.72); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 95; }
.spinner { width: 26px; height: 26px; border: 2.5px solid #d7dde4; border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.busy-text { color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 11.5px; }
/* laptops (1280–1366 px) keep the coach line: it says what to do in each step */
@media (max-width: 1250px) { #panel { width: 290px !important; } .col-sub { display: none; } .coach { font-size: 12px; } .topbar { gap: 9px; } }
@media (max-width: 1000px) { .coach { display: none; } }

/* ---------- export check, draft, resolution, text-size bar (as GelFigure) ---------- */
.pf { width: 560px; }
/* quantification panel: method, warning list, the linearity table */
/* ---------- the quantification workspace ----------
 * Not a sixth step: while it is open the five steps on the left are swapped for the quantification column, the
 * membrane view is hidden and the figure takes the middle. The numbers get a column of their own, so the user
 * reads a decision on the left, the figure in the middle and its consequence on the right. */
#quantPanel { width: 330px; flex: none; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; }
body.quant-mode #panel, body.quant-mode #rawCol { display: none !important; }
body.quant-mode #figureToolbar, body.quant-mode #warnings { display: none !important; }   /* both edit the figure */
body.quant-mode #app { position: relative; }
body.quant-mode #preview { padding-left: 24px; }   /* no row tags to make room for */
#quantData { width: 460px; flex: none; background: #fff; }
.q-only { display: none; }
body.quant-mode .q-only { display: inline-flex; }
body.quant-mode .n-only { display: none; }
#qSetBtn { display: none !important; }
body.quant-mode #figCol .col-head { gap: 9px; }
.qpreview-tabs { padding: 6px 12px; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#qChartBox { flex: 1; overflow: auto; padding: 24px; background: #f7f8fa; }
#qChartBox svg { display: block; width: 100%; min-width: 280px; height: auto; max-width: 1100px; margin: 0 auto; background: #fff; box-shadow: 0 2px 16px rgba(16,24,40,.1); }
.q-plot-point { cursor: pointer; }
.q-plot-point:focus { stroke: #111; stroke-width: 2; outline: none; }
body.quant-chart #btnTIFF, body.quant-chart #btnPPTX, body.quant-chart #btnRaw, body.quant-chart #btnLegend { display: none; }
.qtargets { display: grid; gap: 5px; max-height: 170px; overflow-y: auto; }
.qtargets label, .qcheck-option { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; line-height: 1.5; }
.qtargets label span { overflow-wrap: anywhere; }
.qtargets input, .qcheck-option input { flex: none; margin-top: 3px; accent-color: var(--accent); }
#qAdvanced > summary { font-weight: 600; }
#qAdvanced .qcheck-option { margin-top: 10px; }
.qcontrol-label { margin: 10px 0 3px; font-size: 11.5px; color: var(--muted); }
.qnc.qpoint-sel { background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent); }

.qhead { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.qhead-title { font-weight: 700; font-size: 13px; }
.qbody { padding: 2px 12px 22px; }
.qsec { padding: 13px 0; border-bottom: 1px solid var(--line-2); }
.qsec:last-child { border-bottom: none; }
.qsec-h { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12.5px; margin-bottom: 8px; }
.qnum { width: 17px; height: 17px; flex: none; border-radius: 50%; background: var(--accent-bg); color: var(--accent-dk);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.qopts { display: grid; gap: 4px; }
.qopt { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border: 1px solid transparent;
  border-radius: var(--r-sm); cursor: pointer; }
.qopt:hover { background: #f5f7fa; }
.qopt.on { border-color: #cfe0ff; background: var(--accent-bg); }
.qopt input { margin: 3px 0 0; accent-color: var(--accent); flex: none; }
.qopt b { display: block; font-weight: 600; font-size: 12.5px; }
.qopt small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.qdep { margin-top: 9px; }
.qdep select { width: 100%; }
.qrow { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.qrow label { flex: none; font-size: 12.3px; color: var(--muted); }
.qrow select, .qrow input { flex: 1; min-width: 0; }

/* one line per protein: a verdict is per row, so a single "check" button would have nothing to report */
.qlin-list { display: grid; gap: 3px; }
.qlin-note { margin: 0 0 3px 6px; font-size: 11.5px; }
.qlin { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; text-align: left; border: none; background: none;
  padding: 5px 6px; border-radius: var(--r-sm); cursor: pointer; font-size: 12.3px; }
.qlin:hover { background: #f5f7fa; }
.qlin.sel { background: var(--accent-bg); }
.qlin .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
/* the reason names the exposures that were lost, so it usually needs a line of its own */
.qlin .qwhy { flex: 1 1 100%; min-width: 0; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.qlin .qcheck { flex: 1 1 100%; min-width: 0; font-size: 11.5px; line-height: 1.45; }
.qlin .good { color: var(--ok); } .qlin .bad { color: var(--warn); } .qlin .none { color: var(--faint); }

/* ---------- the numbers column ---------- */
.qwarnbar { flex: none; max-height: 32%; overflow: auto; padding: 8px 14px; background: var(--warn-bg);
  border-bottom: 1px solid #f0dfc4; color: var(--warn); font-size: 12.2px; line-height: 1.5; }
.qwarnbar .w { margin: 2px 0; }
.qtablewrap { flex: 0 1 auto; overflow: auto; padding: 8px 12px 2px; }
.qtable { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.qtable caption { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 2px 0 5px; }
.qtable th, .qtable td { padding: 3px 3px; text-align: right; white-space: nowrap; font-size: 11.5px; }
.qtable thead th { color: var(--faint); font-weight: 600; font-size: 11px; background: #fff; border-bottom: 1px solid var(--line); }
.qtable th.qrowh, .qtable td.qrowh { position: sticky; left: 0; z-index: 2; background: #fff; text-align: left; font-weight: 500; }
.qtable thead th.qrowh { z-index: 3; }
.qtable tbody tr { cursor: pointer; }
.qtable tbody tr:hover td { background: #f7f9fc; }
.qtable tbody tr.sel td, .qtable tbody tr.sel td.qrowh { background: var(--accent-bg); }
.qtable td.qnc { min-width: 30px; position: relative; padding-bottom: 5px; }
.qcell { display: block; }
/* the bar is the cell's own bottom edge, not another column: nine lanes still fit without scrolling */
.qbar { position: absolute; left: 3px; right: 3px; bottom: 1px; height: 2px; border-radius: 1px; background: var(--line-2); overflow: hidden; }
.qbar i { display: block; height: 100%; background: var(--accent); }
.qtable td.sat { color: var(--danger); }
.qtable td.na { color: var(--faint); }
.qname { display: inline-block; max-width: 78px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.qchip { display: inline-block; margin-left: 3px; padding: 0 3px; border-radius: 4px; font-size: 10.5px; }
.qchip.ok { color: var(--ok); background: var(--ok-bg); }
.qchip.bad { color: var(--warn); background: var(--warn-bg); }
.qchip.none { color: var(--faint); background: #f1f3f6; }
.qmenu { border: none; background: none; cursor: pointer; color: var(--faint); padding: 0 2px; font-size: 12px; }
.qmenu:hover { color: var(--accent); }

/* ---------- the selected row, under the table ---------- */
.qdetail { flex: 1; min-height: 0; overflow: auto; background: #fff; border-top: 1px solid var(--line); padding: 10px 14px 18px; }
.qdetail:empty { display: none; }
.qcontrol-badge { display: inline-block; margin-left: 5px; color: var(--accent); font-size: 10px; font-weight: 500; }
.qtable td.qcontrol-cell { color: var(--muted); font-size: 10.5px; text-align: center; }
#qRawDetails { flex: 0 0 auto; max-height: 35%; overflow: auto; border-top: 1px solid var(--line); padding: 8px 12px; }
#qRawDetails > summary { color: var(--muted); cursor: pointer; font-size: 11.5px; }
#qRawTable { overflow: auto; margin-top: 8px; }
.qcontrol-source { display: block; color: var(--muted); font-size: 9px; font-weight: normal; }
.qroi-dialog { box-sizing: border-box; width: min(1380px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--r); color: var(--text); background: var(--panel); overflow: hidden; }
.qroi-dialog[open] { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: auto minmax(0, 1fr) auto; }
.qroi-dialog::backdrop { background: #15233288; }
.qroi-head, .qroi-tools, .qroi-footer, .qroi-navigation { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qroi-head { grid-column: 1 / -1; padding: 14px 18px; border-bottom: 1px solid var(--line); justify-content: space-between; }
.qroi-head .hint { margin: 3px 0 0; }
.qroi-head h2 { margin: 0; flex: 1; font-size: 16px; }
.qroi-head #qRoiClose { color: #445166; }
.qroi-dialog > .hint { margin: 10px 0; }
.qroi-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.qroi-fields label { display: grid; gap: 5px; min-width: 0; font-size: 11.5px; color: var(--muted); }
.qroi-fields input, .qroi-fields select { box-sizing: border-box; min-width: 0; width: 100%; border: 1px solid #cbd3df; border-radius: var(--r-sm); padding: 6px 8px; background: #fff; font-size: 12px; }
.qroi-fields input:focus, .qroi-fields select:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.qroi-main { padding: 16px; min-width: 0; overflow: auto; background: #f8f9fb; }
.qroi-side { padding: 14px; border-left: 1px solid var(--line); min-width: 0; overflow: auto; }
.qroi-side .adv { margin-top: 0; }
.qroi-side .adv > .qroi-fields { margin-top: 12px; }
.qroi-size-fields { grid-template-columns: 110px 110px minmax(0, 1fr); align-items: end; }
.qroi-size { padding: 6px 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.qroi-navigation { margin: 10px 0; }
.qroi-navigation select { width: 65px; }
.qroi-navigation .hint { flex: 1; min-width: 140px; }
.qroi-results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 12px 0 8px; font-size: 12px; }
.qroi-tools { margin: 10px 0; font-size: 12px; }
.qroi-canvas-wrap { min-width: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
#qRoiCanvas { display: block; width: 100%; touch-action: none; cursor: crosshair; }
.qroi-values { overflow: auto; }
.qroi-values .qtable { width: 100%; font-size: 11px; }
.qroi-values .qtable th { white-space: normal; }
.qroi-values .qtable td:last-child { white-space: normal; min-width: 80px; }
.qroi-values tr[data-lane-index] { cursor: pointer; }
.qroi-values tr[data-lane-index]:hover { background: var(--accent-bg); }
.qroi-footer { grid-column: 1 / -1; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel); }
.qroi-footer > .hint { flex: 1; min-width: 180px; }
.box-dimensions { font-size: 11px; white-space: nowrap; color: var(--accent-dk); background: var(--accent-bg); border-radius: var(--r-sm); padding: 3px 6px; }
.condition-layout { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; margin: 6px 0; }
.condition-layout-name { color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.condition-layout .field { margin: 6px 0 0; }
.condition-layout select { width: auto; }
.qpreview-tabs { flex-wrap: wrap; }
@media (max-width: 1150px) { .qroi-dialog[open] { grid-template-columns: minmax(0, 1fr) 310px; } }
@media (max-width: 850px) { .qroi-dialog[open] { grid-template-columns: minmax(0, 1fr); overflow: auto; } .qroi-side { border-left: 0; border-top: 1px solid var(--line); max-height: 260px; } .qroi-footer { position: sticky; bottom: 0; } .qroi-size-fields { grid-template-columns: 90px 90px minmax(0, 1fr); } }
.qd-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.qd-h b { font-size: 13px; }
.qd-sub { color: var(--faint); font-size: 11.5px; }
.qchart { display: block; width: 100%; height: 118px; }
.qstat { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.qstat th, .qstat td { padding: 3px 6px; text-align: right; border-bottom: 1px solid var(--line-2); }
.qstat th:first-child, .qstat td:first-child { text-align: left; color: var(--muted); }
.qstat thead th { color: var(--faint); font-size: 11px; }
.qd-line { font-size: 11.8px; color: var(--muted); margin-top: 7px; line-height: 1.5; }
.qinfoline { font-size: 12.2px; margin-top: 6px; }
.qinfoline .ok { color: var(--ok); } .qinfoline .w { color: var(--warn); }

/* the card at the end of step 5: the way in */
.qcard { margin-top: 16px; padding: 12px 14px; border: 1px solid #d7e3f7; border-radius: var(--r);
  background: linear-gradient(#f7faff, #fff); }
.qcard-h { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; }
.qcard-i { color: var(--accent); }
.qcard .hint { margin: 6px 0 10px; }

@media (max-width: 1250px) { #quantPanel { width: 290px !important; } #quantData { width: 400px; } }
/* below this the left column would squeeze the figure: it becomes a drawer over it (the numbers never move) */
@media (max-width: 1120px) {
  #quantPanel { position: absolute; left: 0; top: 0; bottom: 0; z-index: 45; width: 300px !important;
    box-shadow: 12px 0 34px rgba(16,24,40,.18); transform: translateX(-104%); transition: transform .16s; }
  body.q-set-open #quantPanel { transform: none; }
  body.quant-mode #qSetBtn { display: inline-flex !important; }
  #quantData { width: min(420px, 46vw); min-width: 320px; }
}
.pf-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 12.8px; }
.pf-item .lv { flex: none; width: 44px; font-size: 11px; font-weight: 700; border-radius: 4px; text-align: center; padding: 1px 0; }
.pf-item .lv.block { background: #fdecee; color: var(--danger); }
.pf-item .lv.warn { background: var(--warn-bg); color: var(--warn); }
.pf-item .lv.info { background: #eef1f5; color: var(--muted); }
.pf-item .tx { flex: 1; }
.pf-ok { color: var(--ok); padding: 10px 0; }
.pf-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.draft { margin: 12px 0; padding: 10px 12px; border-radius: var(--r); background: var(--accent-bg); text-align: left; font-size: 12.5px; display: flex; flex-direction: column; gap: 8px; }
.dpiline { font-size: 11.5px; color: var(--muted); margin: -2px 0 6px; line-height: 1.6; }
.dpiline .bad { color: var(--warn); font-weight: 600; }
.dpiline .ok { color: var(--ok); }
.dpiline .btn { margin-left: 4px; }
.float-ta { resize: none; overflow: hidden; line-height: 1.35; display: block; }
.fed-bar { position: fixed; z-index: 71; display: flex; align-items: center; gap: 4px; padding: 4px 6px; background: #16202c; color: #fff; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(16,24,40,.25); font-size: 12px; white-space: nowrap; }
.fed-bar button { border: none; background: rgba(255,255,255,.13); color: #fff; border-radius: 6px; padding: 3px 8px; font-size: 12px; cursor: pointer; }
.fed-bar button:hover { background: rgba(255,255,255,.24); }
.fed-lbl { color: #b8c3d1; margin-right: 2px; }
.fed-size { min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }
.fed-hint { color: #8e9aab; margin-left: 4px; }

/* ---------- BlotFigure additions ---------- */
#panel { width: 330px; }
.blot-card { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; margin-bottom: 8px; }
.blot-card.view { border-color: #b8cdf7; box-shadow: 0 0 0 2px var(--accent-bg); }
.blot-head { display: flex; align-items: center; gap: 6px; }
.blot-head input { flex: 1; border-color: transparent; font-weight: 600; padding: 2px 6px; }
.blot-head input:hover { border-color: #e0e4e9; }
.blot-sub { color: var(--faint); font-size: 11.5px; margin: 2px 0 4px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.thumb { position: relative; width: 86px; cursor: pointer; }
.thumb canvas { width: 86px; height: 64px; display: block; border-radius: 5px; border: 1px solid var(--line); background: #222; object-fit: contain; }
.thumb.on canvas { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.thumb .cap { font-size: 10.5px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb .cap b { color: var(--text); font-weight: 600; }
.thumb .more { position: absolute; top: 2px; right: 2px; border: none; background: rgba(0,0,0,.55); color: #fff; border-radius: 4px; font-size: 11px; line-height: 1; padding: 2px 4px; cursor: pointer; }
.thumb .uses { position: absolute; left: 3px; top: 47px; display: flex; gap: 2px; padding: 2px 3px; background: rgba(255,255,255,.92); border-radius: 4px; }
.thumb .uses i { width: 7px; height: 7px; border-radius: 50%; display: block; }
/* the membrane lay elsewhere in this picture: aligned onto the others */
.thumb .aligned { position: absolute; right: 2px; top: 47px; font-size: 9.5px; background: #e3edff; color: #1d4fbf; border-radius: 3px; padding: 0 3px; }
.thumb .aligned.base { background: #eef1f5; color: #4a5563; }
.popover .align-info { font-size: 12px; color: var(--muted); line-height: 1.4; }
.popover .actions.left { justify-content: flex-start; margin-top: 2px; }
.ladder-sel { margin-top: 6px; font-size: 12px; }
.row-item { display: flex; align-items: center; gap: 5px; padding: 4px 6px; border-radius: var(--r-sm); border: 1px solid transparent; }
.row-item:hover { background: #f6f8fb; }
.row-item.sel { background: var(--accent-bg); border-color: #c9dafc; }
.row-item.off { opacity: .45; }
.row-item input[type=text] { flex: 1; min-width: 0; border-color: transparent; background: transparent; padding: 3px 6px; }
.row-item input[type=text]:hover { background: #fff; border-color: #e0e4e9; }
.row-item .kda { font-size: 11px; color: var(--faint); width: 52px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.row-item .x { border: none; background: none; color: var(--faint); cursor: pointer; font-size: 15px; padding: 0 3px; border-radius: 4px; }
.row-item .x:hover { color: var(--danger); background: #fdecee; }
.expo-chip { flex: none; max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid #d3d8de; background: #fff; border-radius: 999px; font-size: 11px; padding: 1px 8px; cursor: pointer; color: var(--muted); position: relative; }
.expo-chip.best { border-color: #f0c36d; background: #fff8e6; color: #8a5a00; }
.expo-chip.other { border-style: dashed; }
.expo-chip.sat::after { content: ""; position: absolute; top: -2px; right: -2px; width: 7px; height: 7px; border-radius: 50%; background: #e5484d; border: 1.5px solid #fff; }
.expo-chip:hover { border-color: var(--accent); }
.expo-compare { margin: 2px 4px 8px 16px; padding: 8px; border: 1px solid #c9dafc; border-top: none; border-radius: 0 0 var(--r-sm) var(--r-sm); background: #fbfcff; }
.expo-compare .why { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; line-height: 1.45; }
.expo-compare .link { border: none; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 11.5px; text-decoration: underline; }
.expo-compare .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.expo-compare .tile { display: flex; flex-direction: column; gap: 3px; padding: 3px; border: 1.5px solid #e0e4e9; border-radius: 6px; background: #fff; cursor: pointer; text-align: left; }
.expo-compare .tile img { width: 100%; height: 44px; object-fit: fill; display: block; border-radius: 3px; image-rendering: auto; background: #fff; }
.expo-compare .tile .cap { font-size: 10.5px; color: var(--muted); display: flex; gap: 4px; align-items: center; white-space: nowrap; overflow: hidden; }
.expo-compare .tile .cap b { color: #d99a00; }
.expo-compare .tile .cap i { font-style: normal; font-size: 10px; padding: 0 4px; border-radius: 3px; margin-left: auto; }
.expo-compare .tile.v-sat .cap i { background: #fdecee; color: #c8333a; }
.expo-compare .tile.v-weak .cap i, .expo-compare .tile.v-faint .cap i { background: #f0f2f5; color: var(--faint); }
.expo-compare .tile.v-weak img { opacity: .75; }
.expo-compare .tile.rec { border-color: #f0c36d; }
.expo-compare .tile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.expo-compare .tile:hover { border-color: var(--accent); }
.expo { display: flex; gap: 2px; flex: none; }
.expo button { border: 1px solid #d3d8de; background: #fff; border-radius: 5px; font-size: 10.5px; padding: 1px 5px; cursor: pointer; color: var(--muted); position: relative; }
.expo button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.expo button.sat::after, .dot-sat { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #e5484d; }
.expo button.sat::after { position: absolute; top: -3px; right: -3px; border: 1.5px solid #fff; }
.expo button.weak { color: var(--faint); border-style: dashed; }
/* lanes of the selected row's boxes */
.sub-head { font-size: 12.3px; font-weight: 600; color: var(--text); margin: 12px 0 0; }
.bt-head { display: flex; align-items: center; gap: 6px; font-size: 12.3px; margin: 2px 0 4px; }
.bt-head .swatch { width: 4px; height: 14px; border-radius: 2px; }
.bt-head .muted { font-size: 11.5px; }
.bt-seg { margin: 4px 0; padding: 5px 6px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; }
.bt-seg.sel { border-color: #c9dafc; background: var(--accent-bg); }
.bt-seg.clash { border-color: #f1b4b8; background: #fff5f5; }
.bt-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.bt-line + .bt-line { margin-top: 5px; }
.bt-line b { color: var(--text); font-variant-numeric: tabular-nums; }
.bt-line .ptag { flex: none; width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 5px; background: #3c4655; color: #fff; font-weight: 700; font-size: 11px; }
.bt-seg.sel .ptag { background: var(--accent); }
.bt-line .bt-cols { margin-left: auto; }
.bt-line .pnav { flex: none; border: 1px solid #d3d8de; background: #fff; border-radius: 5px; width: 20px; height: 21px; cursor: pointer; color: var(--muted); padding: 0; }
.bt-line .pnav:hover { border-color: var(--accent); color: var(--accent); }
.bt-line .tag-m { color: #7a5a00; background: #fff3c4; border-radius: 4px; padding: 0 4px; font-size: 11px; }
.bt-line .tag-x { color: var(--faint); background: #f0f2f5; border-radius: 4px; padding: 0 4px; font-size: 11px; }
.bt-even { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.bt-even input.num { width: 44px; }
/* marker size picker, row stitching */
.kda-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 4px 0 6px; }
.kda-grid button { border: 1px solid #d3d8de; background: #fff; border-radius: 5px; padding: 4px 0; font-size: 12px; cursor: pointer; font-variant-numeric: tabular-nums; }
.kda-grid button.on { background: #fff3c4; border-color: #e0a800; font-weight: 700; }
.kda-grid button:hover { border-color: var(--accent); }
.popover:has(.kda-grid) { width: 290px; }
.kda-grid button.ref { border-color: #f08c4b; color: #c2410c; }
/* the ladder's own pattern while marking */
.ladder-card { position: absolute; top: 58px; right: 12px; z-index: 3; width: 140px; background: rgba(255,255,255,.96); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px 10px; font-size: 11.5px; }
.ladder-card .lc-head { display: flex; align-items: center; justify-content: space-between; }
.ladder-card .lc-head button { border: none; background: none; color: var(--faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.ladder-card .lc-name { color: var(--muted); font-size: 11px; margin: 2px 0 4px; line-height: 1.35; }
.ladder-card svg { display: block; font-family: -apple-system, Segoe UI, Arial; font-variant-numeric: tabular-nums; }
.ladder-card .lc-note { margin: 4px 0 0; color: var(--faint); font-size: 10.5px; line-height: 1.45; }
.ladder-card .lc-note b { color: #c2410c; }
.expo-compare .seg-line { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.expo-compare .seg-line b { color: var(--text); }
.levelbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.levelbar input[type=range] { max-width: 140px; }
#imgTabs { max-width: 100%; overflow-x: auto; }
#imgTabs button { flex: 0 0 auto; white-space: nowrap; max-width: 150px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row-item .kda:empty { display: none; }
.rowtag { max-width: 48px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.blot-card, .blot-head, #sum1 { min-width: 0; overflow-wrap: anywhere; }
.blot-head input { min-width: 0; flex: 1; }
.image-tools { padding-bottom: 8px; }
.image-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.image-actions label { display: flex; align-items: center; gap: 4px; }
.image-tools select { width: 100%; margin-top: 6px; }
.thumb.selected canvas { outline: 2px solid var(--accent); }
.thumb .image-select { position: absolute; top: 3px; left: 3px; margin: 0; cursor: pointer; }
.thumb .image-remove { position: absolute; top: 2px; right: 25px; border: 0; border-radius: 4px; background: #fff; color: #a4262c; font-size: 16px; line-height: 18px; width: 21px; padding: 0; cursor: pointer; }
.new-image-group { padding: 12px; margin-top: 10px; border: 1px dashed #a7b8cf; border-radius: 8px; text-align: center; color: var(--muted); font-size: 12px; }
.legacy-binding { padding: 10px; margin: 8px 0; border: 1px solid #e0bd7e; border-radius: 8px; background: #fff8eb; font-size: 12px; }
.legacy-binding p { margin: 5px 0 8px; color: var(--muted); line-height: 1.5; }
.drop-images { outline: 2px solid var(--accent); background: var(--accent-bg); }
.row-item .visibility { font-size: 11px; white-space: nowrap; color: var(--accent); }
.row-item.off { opacity: .7; background: #f3f4f6; }
.bt-even { display: flex; align-items: center; gap: 6px; }
.thumb .cap b { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
#imgTabs button .tag-m { font-size: 10px; color: #7a5a00; background: #fff3c4; border-radius: 3px; padding: 0 3px; margin-left: 3px; }
#viewBlot { width: auto; margin-right: 6px; }
#preview g[data-edit="rowname"] { cursor: text; }
#preview image[data-row] { cursor: grab; }
#preview.picking image[data-row] { cursor: crosshair; }
#preview.bracketing, #preview.bracketing * { cursor: ns-resize !important; user-select: none; }
#preview g[data-edit="arrow"] { cursor: ns-resize; }
#preview g[data-edit="bracket"] { cursor: pointer; }
/* a bracket being drawn: the bar where it will go, beside the rows */
.brk-ghost { position: absolute; width: 7px; border: 2.5px solid var(--accent); box-shadow: 0 0 0 2px rgba(47,111,235,.15); }
.brk-ghost.l { border-right: 0; } .brk-ghost.r { border-left: 0; }
.anno-arrow { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; }
#preview.arranging, #preview.arranging * { cursor: grabbing !important; user-select: none; }
/* arranging the figure: piece tags left of the rows, where a dragged row goes */
.prev-ov { position: absolute; inset: 0; pointer-events: none; }
/* the quantification workspace marks the row being read, and the lane under the pointer, on the figure */
.q-hl { position: absolute; border: 1px dashed rgba(47,111,235,.30); border-radius: 3px; }
.q-hl.sel { border: 1.5px solid var(--accent); background: rgba(47,111,235,.07); }
.q-hl.lane { border: 1.5px solid #1f57c3; background: rgba(47,111,235,.18); }
.q-hl.q-integration { border: 1.5px solid #c56813; border-radius: 0; background: rgba(230,155,50,.15); }
.rowtag { position: absolute; transform: translate(-100%, -50%); pointer-events: auto; cursor: grab; font-size: 10.5px; font-weight: 700; color: #6b7685;
  background: #eef1f5; border: 1px solid #dde2e8; border-radius: 5px; padding: 1px 5px; white-space: nowrap; user-select: none; }
.rowtag:hover { color: var(--accent); border-color: #9db8ef; background: #fff; }
.rowtag.sel { color: #fff; background: var(--accent); border-color: var(--accent); }
.dropline { position: absolute; height: 0; border-top: 2.5px solid var(--accent); border-radius: 2px; box-shadow: 0 0 0 2px rgba(47,111,235,.18); }
.dropbox { position: absolute; border: 2px dashed var(--accent); border-radius: 4px; background: rgba(47,111,235,.07); }
.droptip { position: absolute; background: #16202c; color: #fff; font-size: 11.5px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
/* the row's tag in the list: its colour on the membrane, the pieces it comes from; the handle for reordering */
.row-item .grip { flex: none; align-self: stretch; display: flex; align-items: center; justify-content: center; min-width: 20px; padding: 0 4px;
  border-left: 4px solid var(--c); border-radius: 3px; background: color-mix(in srgb, var(--c) 14%, #fff); color: #36404d;
  font-size: 10px; font-weight: 700; white-space: nowrap; cursor: grab; user-select: none; }
.row-item .grip:hover { background: color-mix(in srgb, var(--c) 26%, #fff); }
.row-item.dragging { opacity: .5; }
.row-item.drop-before { box-shadow: inset 0 2.5px 0 var(--accent); }
.row-item.drop-after { box-shadow: inset 0 -2.5px 0 var(--accent); }

/* ---------- steps: done / the one to do now ---------- */
.sec { transition: background .2s; }
.coach.act { cursor: pointer; }
.coach.act:hover #coachText { color: #fff; }
.coach-go { display: inline-block; margin-left: 4px; color: #8fb6ff; font-weight: 700; }
/* "this one": what the coach line points at glows (on the dark top bar: white) */
.flash { animation: flash .45s ease 3; }
.topbar .flash { animation-name: flashLight; }
@keyframes flash { 50% { box-shadow: 0 0 0 5px rgba(47,111,235,.35); } }
@keyframes flashLight { 50% { box-shadow: 0 0 0 5px rgba(255,255,255,.45); } }
.warn-t { color: var(--warn); }
/* membranes: pictures grouped by kind */
.blot-head .link, .mk-blot .link { border: none; background: none; color: var(--accent); cursor: pointer; padding: 0 2px; font-size: 11.5px; white-space: nowrap; }
.blot-head .link:hover, .mk-blot .link:hover { text-decoration: underline; }
.th-label { font-size: 11px; color: var(--faint); margin: 6px 0 2px; }
.thumb-more { width: 86px; height: 64px; border: 1px dashed #c9d0d8; border-radius: 5px; background: #f7f8fa; color: var(--muted); font-size: 12px; cursor: pointer; }
.thumb-more:hover { border-color: var(--accent); color: var(--accent); }
.th-label span { color: var(--muted); font-weight: 600; margin-left: 2px; }
/* the marker step */
.mk-blot + .mk-blot { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.mk-title { font-weight: 600; font-size: 12.3px; margin-bottom: 4px; }
.mk-label { display: flex; align-items: baseline; gap: 6px; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.mk-note { font-size: 11px; color: var(--faint); }
.ladder-sel.todo { border-color: #f0b44c; box-shadow: 0 0 0 3px #fff3dc; }
/* the ladder's sizes as its maker lists them, the reference bands in orange */
.mk-sizes { display: flex; flex-wrap: wrap; gap: 3px; margin: 6px 0 2px; }
.mk-sizes span { font-size: 10.5px; font-variant-numeric: tabular-nums; padding: 0 4px; border-radius: 3px; background: #eef2fb; color: #3b4c6b; line-height: 17px; }
.mk-sizes span.ref { background: #fff0e6; color: #c2410c; font-weight: 700; }
.mk-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 2px; }
.mk-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #e3d3a3; background: #fffdf5; border-radius: 7px; padding: 3px 7px 3px 4px; cursor: pointer; font-size: 11.5px; color: #6b5414; max-width: 100%; }
.mk-chip b { width: 17px; height: 17px; line-height: 17px; text-align: center; border-radius: 4px; background: #3c4655; color: #fff; font-size: 10.5px; flex: none; }
.mk-chip span { font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-chip i { font-style: normal; font-size: 10px; padding: 0 4px; border-radius: 3px; background: #fff1c2; color: #8a6100; flex: none; }
.mk-chip.manual { border-color: #b9dfc6; background: #f4fbf6; color: #2f6b45; }
.mk-chip.manual i { background: var(--ok-bg); color: var(--ok); }
.mk-chip.none, .mk-chip.few { border-color: #f1b4b8; background: #fff7f7; color: var(--muted); }
.mk-chip.none i, .mk-chip.few i { background: #fdecee; color: #c8333a; }
.mk-chip.unused { opacity: .55; }
.mk-chip:hover { border-color: var(--accent); }
.mk-links { display: flex; gap: 12px; margin-top: 6px; }
.mk-links:empty { display: none; }
.row-detail .lane-help { font-size: 11.5px; color: var(--muted); line-height: 1.55; background: #f3f6fb; border-radius: var(--r-sm); padding: 6px 8px 6px 22px; margin: 0 0 6px; }
.row-detail .lane-help b { color: var(--text); }
.tag-hand { font-size: 10px; color: #1d4fbf; background: #e3edff; border-radius: 3px; padding: 0 4px; margin-left: 4px; }
#viewBanner #viewModeExtra button.go { background: var(--accent); }
/* the selected row, opened */
.row-detail .rd-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text); margin: 4px 0 5px; }
.row-detail .rd-title span { font-weight: 400; font-size: 11px; color: var(--faint); line-height: 1.45; }
.row-detail .tiles + .rd-title { margin-top: 10px; }
.add-row { margin-top: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.add-row .hint { margin: 0; }
/* text buttons (links) anywhere */
button.link { border: none; background: none; color: var(--accent); cursor: pointer; padding: 0 2px; font-family: inherit; font-size: 11.5px; white-space: nowrap; }
button.link:hover { text-decoration: underline; }
/* the figure before there is one: the steps, the one to do now marked (centred over the whole column) */
.fig-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; pointer-events: none; }
.fe-card { pointer-events: auto; width: 100%; max-width: 360px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px 18px; box-shadow: 0 6px 24px rgba(16,24,40,.06); }
.fe-card h3 { margin: 0 0 4px; font-size: 15.5px; text-align: center; color: var(--text); }
.fe-sub { margin: 0 0 14px; font-size: 12.3px; color: var(--muted); text-align: center; line-height: 1.55; }
.fe-steps { list-style: none; margin: 0; padding: 0; counter-reset: fe; }
.fe-steps li { counter-increment: fe; display: grid; grid-template-columns: 24px 1fr; column-gap: 10px; align-items: baseline; padding: 7px 8px; border-radius: 8px; color: var(--faint); }
.fe-steps li::before { content: counter(fe); grid-row: span 2; width: 22px; height: 22px; border-radius: 50%; background: #eef1f5; color: var(--muted); font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.fe-steps li b { font-size: 13px; color: var(--muted); font-weight: 600; }
.fe-steps li span { font-size: 11.5px; line-height: 1.45; }
.fe-steps li.done::before { content: "✓"; background: var(--ok-bg); color: var(--ok); }
.fe-steps li.cur { background: var(--accent-bg); color: var(--muted); }
.fe-steps li.cur::before { background: var(--accent); color: #fff; }
.fe-steps li.cur b { color: var(--accent-dk); }
/* the steps on the left: the one open (.cur) shows its body, done ones a line (a click opens them again),
   later ones wait (.locked) */
.sec.step .step-body, .sec.step .step-sum { display: none; }
.sec.step.cur .step-body { display: block; }
.sec.step.done:not(.cur) .step-sum { display: block; }
.sec.step .sec-head { margin-bottom: 0; }
.sec.step.cur .sec-head { margin-bottom: 10px; color: var(--accent-dk); }
.sec.step.cur { background: linear-gradient(90deg, rgba(47,111,235,.06), transparent 70%); box-shadow: inset 3px 0 0 var(--accent); }
.sec.step.cur .sec-n { background: var(--accent); color: #fff; font-size: 11px; }
.sec.step.cur .sec-n::before { content: none; }
.sec.step.done:not(.cur) .sec-head { cursor: pointer; }
.sec.step.done:not(.cur):hover { background: #f7f9fc; }
.sec.step.done:not(.cur) .sec-head::after { content: "修改"; margin-left: 8px; font-size: 11.5px; font-weight: 500; color: var(--accent); }
/* the furthest step reached, while an earlier one is open again: back to it */
.sec.step.reach .sec-head { cursor: pointer; }
.sec.step.reach:hover { background: #f7f9fc; }
.sec.step.reach .sec-head::after { content: "继续 →"; margin-left: 8px; font-size: 11.5px; font-weight: 600; color: var(--accent); white-space: nowrap; }
/* (the English interface) */
html[lang=en] .sec.step.done:not(.cur) .sec-head::after { content: "Edit"; }
html[lang=en] .sec.step.reach .sec-head::after { content: "Continue →"; }
.sec.step.locked { opacity: .5; }
.sec.step.locked .sec-head { cursor: default; }
.step-sum { font-size: 12px; color: var(--muted); margin: 6px 0 0 28px; line-height: 1.55; }
.step-sum b { color: var(--text); font-weight: 600; }
.step-next { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.step-next .btn { width: 100%; justify-content: center; }
.howto { margin: 0 0 8px; padding-left: 18px; font-size: 12.3px; color: var(--muted); line-height: 1.7; }
.howto b { color: var(--text); }
.sub-title { font-size: 12.5px; font-weight: 700; color: var(--text); margin: 14px 0 6px; }
.sub-title:first-child { margin-top: 0; }
.adv > summary.sub-title { margin: 14px 0 6px; }
.mk-star { display: inline-block; font-size: 11px; font-weight: 700; color: #7a5a00; background: #fff3c4; border-radius: 4px; padding: 0 5px; }
/* step 1: the pictures of each membrane, the Marker picture marked */
.thumb .cap .setmk { border: none; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 10.5px; }
.thumb .cap .setmk:hover { text-decoration: underline; }
.thumb.mk canvas { border-color: #e0a800; box-shadow: 0 0 0 2px #fff3c4; }
.thumb .cap .isx { color: #7a5a00; font-weight: 700; }
/* step 2: the pieces of each membrane */
.pc-blot { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 6px; font-size: 12.3px; }
.pc-blot.view { border-color: #b8cdf7; background: var(--accent-bg); }
.pc-blot .link { border: none; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 11.5px; margin-left: auto; }
/* step 5: the protein names */
.name-item { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.name-item .grip { flex: none; min-width: 20px; padding: 2px 4px; border-left: 4px solid var(--c); border-radius: 3px; background: color-mix(in srgb, var(--c) 14%, #fff); font-size: 10px; font-weight: 700; color: #36404d; text-align: center; }
.name-item input { flex: 1; min-width: 0; }
.name-item .kda { font-size: 11px; color: var(--faint); width: 56px; text-align: right; flex: none; }
/* the row's box: its tilt */
.bt-rot { display: inline-flex; align-items: center; gap: 4px; }
.bt-rot b { min-width: 38px; text-align: center; }
/* the first-run tour */
.tour { position: fixed; inset: 0; z-index: 85; background: rgba(14,20,28,.38); }
.tour-card { position: fixed; width: 300px; background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: 0 14px 40px rgba(16,24,40,.3); font-size: 12.8px; line-height: 1.65; color: var(--muted); }
.tour-card b { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
#tourOk { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); padding: 9px 26px; font-size: 14px; }
.dlg-body .link { border: none; background: none; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; font-size: inherit; }

/* Optional columns stay inside the final naming step. */
.column-controls { margin: 0 0 10px; }
.column-tabs { display:flex; flex-wrap:wrap; gap:5px; }
.column-tabs button { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.column-controls .field input[type="text"], #columnTitle { min-width:0; flex:1; width:130px; }
.column-controls select { width:auto; max-width:100%; }
.name-item .kda:empty { display:none; }
.column-controls .adv { margin-top:6px; }
.marker-visibility { display:flex; flex-wrap:wrap; gap:12px; margin:12px 0; }
.marker-visibility label { display:flex; align-items:center; gap:4px; }

/* Steps are expandable tools; the active editing mode is separate from completed progress. */
.sec.step .step-body, .sec.step.cur .step-body { display:none; }
.sec.step.open .step-body { display:block; }
.sec.step.open .step-sum { display:none; }
.sec.step .sec-head::after { content:none !important; }
.sec.step .sec-head { cursor:pointer; gap:7px; }
.step-toggle { margin-left:auto; padding:5px 7px; border:0; background:transparent; color:var(--accent); white-space:nowrap; font:inherit; font-size:11px; cursor:pointer; }
.step-toggle:disabled { color:var(--faint); cursor:default; }
.sec.step.completed .step-next { display:none; }
#secPieces.open .step-next { display:flex; }
.add-row { margin:0 0 14px; padding:10px; background:var(--accent-bg); border-radius:8px; display:flex; flex-direction:column; align-items:stretch; gap:7px; }
.row-name-link { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; }
.row-menu { position:absolute; transform:translateY(-50%); pointer-events:auto; border:0; padding:0 3px; background:transparent; color:var(--muted); cursor:pointer; }
.row-menu:hover { background:var(--accent-bg); color:var(--accent); }
.cache-status { border:0; background:transparent; color:#b9c7d9; font-size:11px; max-width:140px; white-space:nowrap; cursor:pointer; }
.cache-status.error { color:#ffca80; }
.library-card { border:1px solid var(--line-2); border-radius:8px; padding:12px; margin:8px 0; display:flex; align-items:center; gap:10px; }
.library-card .project-info { flex:1; min-width:0; }
.library-card .project-info button { max-width:100%; text-align:left; overflow:hidden; text-overflow:ellipsis; }
.library-card small { display:block; color:var(--muted); margin-top:5px; }
.extra-dialog .dlg-body { width:min(560px,92vw); max-height:85vh; overflow:auto; }
.marker-import-preview { display:flex; gap:6px; flex-wrap:wrap; margin:12px 0; }
.marker-import-preview span { padding:4px 8px; background:var(--accent-bg); border-radius:5px; }

.image-gallery,.gallery-inspect { display:none; }
.gallery-mode #rawCol > .col-head,.gallery-mode #rawCol > #levelBar,.gallery-mode #editorBox,.gallery-mode #figCol > .col-head,.gallery-mode #previewBox { display:none !important; }
.gallery-mode .image-gallery { display:block; flex:1; padding:16px; overflow:auto; }
.gallery-mode .gallery-inspect { display:flex; flex:1; min-height:0; flex-direction:column; padding:16px; gap:12px; }
.gallery-mode #warnings { display:none; }
.gallery-top { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.image-gallery .thumbs { display:grid; grid-template-columns:repeat(auto-fill,minmax(155px,1fr)); gap:10px; }
.image-gallery .thumb { width:auto; min-width:0; }
.image-gallery .thumb canvas { width:100%; height:145px; object-fit:contain; background:#f2f4f7; }
.image-gallery .blot-card { margin-top:14px; padding:12px; }
.image-gallery .cap { white-space:normal; }
.gallery-caption { min-width:0; }
.gallery-caption b { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.gallery-caption span { font-size:12px; color:var(--muted); }
.gallery-actions { display:flex; flex-wrap:wrap; gap:6px; }
.gallery-image-scroll { overflow:auto; flex:1; min-height:0; background:#e9edf2; border-radius:8px; }
.gallery-image-scroll canvas { display:block; height:auto; }

.gallery-mode #secImages .step-next { display:none; }

.gallery-mode #legendHints,.gallery-mode #secImages .step-body > button:first-child { display:none; }

.image-gallery .image-tools > .hint { display:none; }

.tool-nav { position:sticky; top:0; z-index:8; display:grid; grid-template-columns:repeat(5,1fr); background:#fff; border-bottom:1px solid var(--line-2); padding:5px; gap:2px; }
.tool-nav button { border:0; background:transparent; font:inherit; font-size:11px; border-radius:5px; padding:7px 2px; color:var(--muted); cursor:pointer; }
.tool-nav button.on { background:var(--accent-bg); color:var(--accent); font-weight:700; }
.tool-nav button:disabled { opacity:.45; cursor:default; }
.sec.step { scroll-margin-top:42px; }

.lane-default { padding:10px; margin:12px 0; border:1px solid var(--line-2); border-radius:8px; background:#f7f9fc; }
.lane-default > label { display:block; font-size:12px; font-weight:600; }
.lane-default .field { margin:6px 0; }
.lane-default.compact { margin-top:8px; }

/* The whole image-group card is a keyboard-accessible review target. */
button.pc-blot { width:100%; text-align:left; font:inherit; cursor:pointer; color:inherit; }
button.pc-blot:hover { border-color:var(--accent,#2f6feb); background:#f3f7ff; }
button.pc-blot:focus-visible { outline:2px solid #2f6feb; outline-offset:2px; }
.pc-status { color:#61728b; font-size:11px; margin-left:auto; }

.group-guide { border:1px solid #d8e5f4; background:#f4f8fe; border-radius:10px; padding:12px 14px; margin:12px 0; line-height:1.55; font-size:12px; color:#3b5069; }
.group-guide b { color:#24466f; font-size:13px; }
.group-guide p { margin:6px 0; }
.group-guide span { display:block; color:#5b6d83; }

/* Controls must fit the available pane, including small laptop displays. */
.levelbar { flex-wrap:wrap; gap:7px 12px; }
#levelName { flex:1 0 100%; min-width:0; display:flex; align-items:center; flex-wrap:wrap; gap:4px; overflow-wrap:anywhere; }
#levelName b { max-width:65%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.level-slider { display:flex; align-items:center; gap:7px; flex:1 1 120px; min-width:0; color:var(--muted); font-size:12px; }
.level-slider span { flex:none; }
.levelbar .level-slider input { min-width:40px; width:60px; max-width:none; flex:1; }
.level-actions { display:flex; align-items:center; gap:8px; flex:none; }
.level-actions .btn.ghost { color:var(--muted); }
.level-actions .switch { white-space:nowrap; }
.pane-col { min-height:0; }
.col-head { height:auto; min-height:42px; padding:6px 10px; flex-wrap:wrap; }
#imgTabs { flex:1 1 160px; min-width:0; }
#viewBlot { max-width:140px; min-width:0; flex:0 1 120px; }
#editorBox { min-height:100px; }
.popover { max-width:calc(100vw - 16px); max-height:calc(100dvh - 24px); overflow:auto; overscroll-behavior:contain; }
.popover .actions { flex-wrap:wrap; }
.menu { max-width:calc(100vw - 20px); max-height:calc(100dvh - 76px); overflow:auto; }
.ladder-card { max-width:calc(100% - 24px); max-height:calc(100% - 24px); overflow:auto; }
#viewBanner { flex-wrap:wrap; }
#viewBanner #viewModeText { flex:1 1 180px; }
#viewBanner #viewModeExtra { flex-wrap:wrap; min-width:0; }
.box-selection-bar { position:absolute; z-index:5; bottom:12px; left:12px; max-width:calc(100% - 24px); display:flex; flex-wrap:wrap; gap:8px; align-items:center; padding:8px 11px; background:#edf4ff; border:1px solid #8eb8f9; border-radius:8px; color:#244e89; font-size:12px; }
.box-selection-bar button { background:#fff; color:#a42736; border:1px solid #c6d7ef; border-radius:5px; padding:3px 8px; cursor:pointer; }
.box-selection-bar span:last-child { color:#5c7392; font-size:11px; }
@media(max-width:1100px){
 .topbar { height:auto; min-height:52px; flex-wrap:wrap; padding-top:7px; padding-bottom:7px; }
 .topbar-right { margin-left:auto; }
 .coach { display:flex; order:4; flex:1 0 100%; justify-content:flex-start; padding:3px 5px; }
 .coach span:last-child { white-space:normal; }
 #panel { width:260px!important; }
}
@media(max-height:650px){
 .levelbar { padding:5px 8px; gap:5px 8px; }
 #levelName { max-height:44px; overflow:auto; }
}

#warnings { max-width:min(520px,calc(100vw - 36px)); max-height:28vh; overflow:auto; }
#toasts { max-width:calc(100vw - 24px); }
.toast { max-width:100%; overflow-wrap:anywhere; border-radius:14px; }

#zoomLabel { width:44px; min-width:44px; flex:none; text-align:right; }

.extra-dialog .actions { flex-wrap:wrap; }
/* Desktop publication controls: one toolbar beside the figure, and one inline editor. */
.figure-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:7px 12px;padding:8px 12px;border-bottom:1px solid var(--border,#dce3ec);background:var(--panel,#fff);font-size:12px;flex-shrink:0}
.figure-toolbar label{display:flex;align-items:center;gap:5px;white-space:nowrap}.figure-toolbar input[type=range]{width:80px}.figure-toolbar select{max-width:145px}.figure-toolbar .num{width:49px}
.layout-settings{margin-top:12px;padding-top:10px;border-top:1px solid var(--border,#dce3ec)}.layout-settings h4{font-size:13px;margin:0 0 12px}
.fed-bar{max-width:calc(100vw - 12px);flex-wrap:wrap;overflow:auto;max-height:calc(100vh - 70px)}.text-formats{flex-basis:100%;display:flex;flex-wrap:wrap;align-items:center;gap:8px;max-width:460px;border-top:1px solid #dce3ec;padding-top:5px}.format-buttons{display:flex;flex-wrap:wrap;gap:3px;width:100%}.text-formats label{display:flex;align-items:center;gap:4px;font-size:12px}.text-formats button{font-size:12px}.text-formats .num{width:48px}.text-formats .hidden{display:none}
.note-popover{position:fixed;width:300px;max-width:calc(100vw - 16px);max-height:calc(100vh - 16px);overflow:auto;z-index:75}.note-format-buttons{display:flex;gap:3px;flex-wrap:wrap;margin-top:5px}.note-format-buttons button{font-size:11px;padding:3px 5px;border:1px solid #d7e0eb;background:#f5f8fd;color:#283c57;border-radius:4px;cursor:pointer}.note-draw{cursor:crosshair}.note-draw image{cursor:crosshair!important}[data-note-handle],[data-bracket-end]{cursor:nwse-resize;opacity:0}g.ed:hover [data-note-handle],g.ed:hover [data-bracket-end]{opacity:1}[data-bracket-end]{cursor:ns-resize}g[data-edit=note]{cursor:move}
/* Local release history and optional community dialogs, adapted from GelFigure. */
.community-entry{white-space:nowrap;font-size:12px}.export-thanks,.update-notice{position:fixed;right:20px;bottom:22px;width:350px;max-width:calc(100vw - 40px);padding:19px 22px;border:1px solid #d4dfef;border-radius:14px;background:#fff;box-shadow:0 12px 36px #11233d24;z-index:80;color:#263b58}.export-thanks p,.export-thanks small{font-size:12px;line-height:1.6;color:#5b6c83;display:block;margin-top:8px}.support-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}.support-close,.update-dismiss{position:absolute;right:9px;top:7px;background:none;border:0;font-size:22px;cursor:pointer;color:#6f7c90}.community-body,.feedback-body,.sponsor-body,.updates-body{max-width:620px;width:calc(100vw - 40px);max-height:calc(100vh - 60px);overflow:auto}.community-choices{display:grid;gap:10px;margin-top:18px}.community-choice{display:block;text-align:left;padding:16px;background:#f5f8fe;border:1px solid #d7e2f2;border-radius:10px;color:#243b58;text-decoration:none;cursor:pointer}.community-choice strong,.community-choice span{display:block}.community-choice span{font-size:12px;line-height:1.5;color:#66778d;margin-top:5px}.feedback-body form>label{display:flex;flex-direction:column;gap:6px;margin:14px 0}.feedback-body textarea{min-height:130px;width:100%;resize:vertical}.feedback-status{font-size:13px;line-height:1.5;margin:10px 0}.feedback-status.error{color:#b83245}.feedback-status.success{color:#167c59}.feedback-copy-text{width:100%;min-height:130px}.sponsor-body p{line-height:1.7}.sponsor-qr{display:block;width:220px;height:220px;max-width:100%;margin:18px auto;object-fit:contain}.sponsor-star{border-top:1px solid #dce3ee;padding-top:16px;margin-top:20px}.updates-head{display:flex;justify-content:space-between;gap:15px}.updates-close{align-self:start;border:0;background:none;font-size:26px;cursor:pointer}.updates-history{max-height:60vh;overflow:auto;padding-right:10px}.release-entry{padding:16px 0;border-bottom:1px solid #e2e8f1}.release-entry.current{border-left:3px solid #3478ff;padding-left:12px}.release-entry h4{margin:0 0 6px}.release-entry time{font-size:12px;color:#6d7c91}.release-entry ul,.update-notice ul{padding-left:20px;font-size:13px;line-height:1.7;margin:10px 0}.release-current{font-size:11px;color:#3478ff;margin-left:8px}.updates-footer,.update-notice-footer{font-size:12px;display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:15px}.update-eyebrow{color:#3478ff;font-weight:600;font-size:12px}.update-notice h3{font-size:16px;margin:8px 0}.update-notice-footer span{color:#7a8799}.export-thanks.hidden,.update-notice.hidden{display:none}
#sponsorQr{display:block;width:220px;max-width:100%;height:auto;margin:18px auto}.feedback-body .honeypot{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
#sponsorDlg{z-index:92}#feedbackDlg{z-index:94}#updatesDlg{z-index:96}.feedback-honey{position:absolute!important;left:-10000px;width:1px;height:1px;overflow:hidden}
.font-menu{position:fixed;z-index:76;background:#fff;border:1px solid #d5e0ef;border-radius:10px;padding:14px;box-shadow:0 8px 28px #11233d24;width:280px;max-width:calc(100vw - 12px)}.font-menu label{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:7px 0;font-size:13px}.font-menu .num{width:70px}.font-menu select{max-width:180px}.fed-bar{width:430px;max-width:calc(100vw - 12px)}.figure-toolbar .hidden{display:none}
.range-row{flex-wrap:wrap}.range-row>span{white-space:nowrap;flex-shrink:0}.range-row select{min-width:65px;max-width:100px;flex:1}.range-row .btn{flex-shrink:0}
.figure-toolbar .btn.ghost{color:#52647c}.figure-toolbar .btn.ghost:hover{background:#edf3fd;color:#213c65}
