/* =====================================================================
   Pedigree Studio – practical edition: styles
   The canvas, symbol and connection styles are Pedigree Studio's own.
   The toolbar, inspector and menus are laid out for a narrow workbench.
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1a2332;
  --text-muted: #647086;
  --accent: #0b6b8a;
  --accent-hover: #0a5a74;
  --accent-light: rgba(11, 107, 138, 0.09);
  --border: #dde1e6;
  --border-light: #eaecf0;
  --canvas-dot: #d6dae0;
  --danger: #b3261e;
  --pick: #d9480f;
  --bar-h: 50px;
}

html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh; height: 100dvh;
  overflow: hidden;
  display: flex; flex-direction: column;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85em; border: 1px solid #cbd3de; border-bottom-width: 2px; border-radius: 4px; padding: 0 0.3em; background: #fff; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.92em; background: var(--bg); padding: 0 0.3em; border-radius: 3px; }

/* ── Toolbar ── */
.st-bar {
  flex: none; display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  min-height: var(--bar-h); padding: 6px 8px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: relative; z-index: 300;
}
.st-group { display: flex; align-items: center; gap: 2px; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--border-light); }
.st-group:last-child { border-right: 0; }
.st-right { border-right: 0; padding-right: 0; margin-right: 0; }
.st-spacer { flex: 1; }
.st-glabel { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: 0 4px 0 2px; }
.st-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-width: 40px; height: 38px; padding: 2px 6px;
  border: 1px solid transparent; border-radius: 7px; background: none; cursor: pointer;
  color: var(--text); font-size: 10.5px; font-weight: 600; line-height: 1.1; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.st-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.st-btn:hover { background: var(--bg); border-color: var(--border); }
.st-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.st-btn.active, .st-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-btn:disabled { opacity: 0.35; cursor: default; background: none; border-color: transparent; }
.add-btn svg { stroke-width: 2.1; }
.add-btn:active { transform: scale(0.96); }

/* compact toolbar when the workbench is narrow: drop the group names
   first, then tighten the buttons, and only lose the button names when
   there is really no room (the tutorial refers to the buttons by name) */
@media (max-width: 1000px) {
  .st-glabel { display: none; }
}
@media (max-width: 820px) {
  .st-bar { gap: 2px; padding: 5px 6px; }
  .st-group { padding-right: 4px; }
  .st-btn { min-width: 34px; padding: 2px 4px; font-size: 10px; }
}
@media (max-width: 699px) {
  .st-btn span { display: none; }
  .st-bar { gap: 1px; padding: 4px; }
  .st-group { padding-right: 3px; margin-right: 0; }
  .st-btn { min-width: 32px; height: 34px; padding: 2px 3px; }
}

/* ── Pop-up menus ── */
.st-pop {
  position: fixed; z-index: 400; background: #fff; border: 1px solid #cbd3de; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.18); padding: 5px; min-width: 240px; max-width: calc(100vw - 16px);
  max-height: calc(100vh - var(--bar-h) - 16px); overflow: auto;
}
.st-pop > button {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left;
  padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.st-pop > button:hover, .st-pop > button:focus-visible { background: var(--bg); outline: none; }
.st-pop > button svg { width: 34px; height: 20px; flex: none; fill: none; stroke: var(--text); stroke-width: 1.8; }
.st-pop hr { border: 0; border-top: 1px solid var(--border-light); margin: 4px 0; }
.st-pop-wide { width: 330px; padding: 4px 12px 10px; }
.pop-sec { padding: 9px 0; border-bottom: 1px solid var(--border-light); }
.pop-sec:last-child { border-bottom: 0; }
.pop-h { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 6px; }
.pop-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.pop-note { font-size: 11.5px; color: var(--text-muted); line-height: 1.45; margin-top: 4px; }
.pop-note a { color: var(--accent); }

/* buttons inside panels */
.pbtn {
  border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 5px 9px; cursor: pointer;
  font-size: 12px; font-weight: 550; line-height: 1.25; color: var(--text);
}
.pbtn:hover { background: var(--bg); }
.pbtn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pbtn.danger { color: var(--danger); border-color: #f2c9c6; background: #fdf3f2; }
.pbtn.danger:hover { background: #fbe4e2; }
.pbtn.wide { display: block; width: 100%; margin-top: 10px; }
.pop-row .pbtn { flex: 1; }
.seg2, .seg3, .seg5 { display: grid; gap: 4px; }
.seg2 { grid-template-columns: 1fr 1fr; }
.seg3 { grid-template-columns: repeat(3, 1fr); }
.seg5 { grid-template-columns: repeat(5, 1fr); }
.seg2 .pbtn, .seg3 .pbtn, .seg5 .pbtn { padding: 5px 4px; font-size: 11.5px; }
.slider-l { display: block; font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.slider-l input { display: block; width: 100%; accent-color: var(--accent); margin-top: 2px; }
.size-btn { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: 16px; font-weight: 600; cursor: pointer; }
#labelSizeDisplay { min-width: 38px; text-align: center; font-weight: 600; }

/* toggles (Pedigree Studio's) */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.toggle-row label { font-size: 13px; cursor: pointer; }
.toggle-switch { position: relative; width: 38px; height: 21px; flex: none; background: #cdd3db; border-radius: 11px; cursor: pointer; transition: background 0.2s; border: none; }
.toggle-switch.on { background: var(--accent); }
.toggle-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.toggle-switch.on::after { transform: translateX(17px); }

/* ── Canvas (Pedigree Studio) ── */
.canvas-area {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--canvas-dot) 1px, transparent 1px);
  background-size: 24px 24px;
  touch-action: none;
}
#canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
#lines-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; }
#lines-layer line, #lines-layer path { pointer-events: stroke; cursor: pointer; }
#draw-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 15; overflow: visible; }
#canvas.eraser-active #draw-layer { pointer-events: auto; }
#canvas.eraser-active #draw-layer path { pointer-events: stroke; cursor: pointer; }
#canvas.eraser-active #draw-layer path:hover { opacity: 0.4; filter: drop-shadow(0 0 4px var(--danger)); }
.draw-settings-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.draw-color-btn { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; flex-shrink: 0; }
.draw-color-btn.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }

.person { position: absolute; cursor: grab; user-select: none; -webkit-user-select: none; z-index: 10; touch-action: none; display: flex; flex-direction: column; align-items: center; }
.person:hover .person-shape { filter: drop-shadow(0 0 3px rgba(11,107,138,0.35)); }
.person.dragging { cursor: grabbing; z-index: 999; }
#canvas.draw-active .person, #canvas.draw-active .label, #canvas.draw-active .legend-box { pointer-events: none; }
#canvas.draw-active #draw-layer { pointer-events: auto; }
.person.selected .shape-border { stroke: var(--accent) !important; stroke-width: 2.5 !important; }
.person.multi-selected .shape-border { stroke: #e67e22 !important; stroke-width: 2.5 !important; stroke-dasharray: 4 3; }
.person-shape { width: 52px; height: 52px; position: relative; transition: filter 0.15s; }
.person-shape svg { width: 100%; height: 100%; }
.person .delete-btn { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; border: 2px solid #fff; font-size: 13px; line-height: 1; cursor: pointer; display: none; align-items: center; justify-content: center; z-index: 20; }
.person.selected .delete-btn { display: flex; }
@media (hover: hover) { .person:hover .delete-btn { display: flex; } }
.person-number { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 700; color: var(--text-muted); white-space: nowrap; pointer-events: none; letter-spacing: 0.3px; }
.person-number.editable { pointer-events: auto; cursor: pointer; border-bottom: 1px dashed var(--text-muted); padding: 0 2px; }
.person-number.editable:focus { outline: none; cursor: text; background: var(--accent-light); border-radius: 2px; border-bottom: 1px solid var(--accent); }
.person-number.shifted-left { left: -2px; transform: translateX(-100%); }
.person-number.shifted-right { left: auto; right: -2px; transform: translateX(100%); }
.person-text { position: absolute; top: 56px; left: 30px; font-size: 11px; line-height: 1.35; color: var(--text); white-space: pre; pointer-events: none; text-align: left; }
.person-text.wrapped { white-space: pre-wrap; }
.person-text.text-left { left: auto; right: 30px; text-align: right; }
.person-text.text-left.proband-left { top: 74px; }
.miscarriage-sex { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 600; color: var(--text-muted); white-space: nowrap; pointer-events: none; text-transform: uppercase; letter-spacing: 0.5px; }
.proband-arrow { position: absolute; top: 54px; left: -18px; width: 18px; height: 18px; pointer-events: none; }

/* practical edition: picking and highlighting people */
.person.picked .shape-border { stroke: var(--pick) !important; stroke-width: 4 !important; stroke-dasharray: none !important; }
.person.picked::after { content: '✓'; position: absolute; top: -9px; left: -9px; width: 20px; height: 20px; border-radius: 50%; background: var(--pick); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; }
.person.hl-issue .person-shape { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 5px #e8590c) drop-shadow(0 0 2px #e8590c); }
.person.hl-answer .person-shape { filter: drop-shadow(0 0 5px #2b8a3e) drop-shadow(0 0 2px #2b8a3e); }
.person.hl-flash .person-shape { animation: hlflash 1.2s ease 2; }
@keyframes hlflash { 0%, 100% { filter: none; } 50% { filter: drop-shadow(0 0 8px var(--accent)) drop-shadow(0 0 3px var(--accent)); } }
body.picking .person { cursor: pointer; }
body.picking .person .delete-btn { display: none !important; }
body.readonly .st-bar, body.readonly .inspector { display: none !important; }

/* free text labels */
.label { position: absolute; cursor: grab; user-select: none; -webkit-user-select: none; z-index: 10; font-size: 14px; color: var(--text-muted); font-style: italic; padding: 4px 8px; border-radius: 4px; min-width: 20px; touch-action: none; }
.label:hover { background: rgba(0,0,0,0.04); }
.label.dragging { cursor: grabbing; z-index: 999; }
.label.selected { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.label .delete-btn { position: absolute; top: -10px; right: -10px; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; border: 2px solid #fff; font-size: 13px; cursor: pointer; display: none; align-items: center; justify-content: center; }
.label:hover .delete-btn, .label.selected .delete-btn { display: flex; }
.label-text { outline: none; min-height: 1em; cursor: grab; white-space: pre-wrap; }
.label-text[contenteditable="true"] { cursor: text; background: var(--accent-light); border-radius: 3px; }
.label.bordered .label-text { border: 1.5px solid #6b7a8d; padding: 4px 8px; border-radius: 4px; }

/* connections */
.conn-hit { pointer-events: stroke; cursor: pointer; }
.partnership-line.highlighted { stroke: var(--accent) !important; stroke-width: 4 !important; filter: drop-shadow(0 0 6px var(--accent)) drop-shadow(0 0 12px var(--accent)); }
.partnership-line.highlighted + .partnership-route { stroke: var(--accent); stroke-width: 4; filter: drop-shadow(0 0 6px var(--accent)) drop-shadow(0 0 12px var(--accent)); }
.child-link-highlighted { stroke: var(--accent) !important; stroke-width: 4 !important; filter: drop-shadow(0 0 6px var(--accent)) drop-shadow(0 0 12px var(--accent)); }
.link-delete-btn { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; border: 2px solid #fff; font-size: 13px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 20; pointer-events: auto; box-shadow: 0 1px 4px rgba(0,0,0,0.2); transform: translate(-50%, -50%); }

/* colour key */
.legend-box { position: absolute; z-index: 15; background: #fff; border: 1.5px solid var(--border); border-radius: 8px; padding: 12px 16px; min-width: 180px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.legend-box.dragging { cursor: grabbing; z-index: 999; box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.legend-box h4 { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted); margin-bottom: 8px; pointer-events: none; }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; pointer-events: auto; }
.legend-swatch { width: 18px; height: 18px; border-radius: 3px; border: 1px solid var(--border); flex-shrink: 0; }
.legend-input { flex: 1; border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px; font-size: 11px; line-height: 14px; font-family: -apple-system, "Segoe UI", system-ui, Helvetica, sans-serif; outline: none; background: var(--bg); min-width: 0; }
.legend-input:focus { border-color: var(--accent); }
/* a long entry widens the key (its field is sized to its text), or wraps onto more lines in a key of a set width,
   which the grip on its right edge changes (as in Pedigree Studio) */
.legend-box:not(.wrap) .legend-input { flex: none; }
.legend-box.wrap .legend-row { align-items: flex-start; }
.legend-box.wrap .legend-swatch { margin-top: 2px; }
textarea.legend-input { display: block; resize: none; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.legend-resize { position: absolute; top: 10px; bottom: 10px; right: -6px; width: 12px; cursor: ew-resize; touch-action: none; }
.legend-resize::after { content: ''; position: absolute; top: 50%; left: 4px; width: 4px; height: 26px; margin-top: -13px; border-radius: 2px; background: var(--border); }
.legend-resize:hover::after { background: var(--accent); }
.legend-empty { font-size: 11px; color: var(--text-muted); font-style: italic; pointer-events: none; }

/* banners and overlays on the canvas */
.mode-banner { display: none; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 20px); background: var(--accent); color: #fff; padding: 7px 16px; border-radius: 8px; font-size: 12px; font-weight: 600; z-index: 160; box-shadow: 0 4px 16px rgba(11,107,138,0.3); cursor: pointer; text-align: center; }
.mode-banner.visible { display: block; }
.pick-banner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 20px); z-index: 170; background: var(--pick); color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 12.5px; font-weight: 600; box-shadow: 0 4px 16px rgba(217,72,15,0.3); text-align: center; }
.pick-banner b { background: rgba(255,255,255,0.22); border-radius: 99px; padding: 0 8px; margin-left: 4px; }
.status-bar { position: absolute; left: 10px; bottom: 12px; z-index: 90; font-size: 11px; color: var(--text-muted); background: rgba(245,246,248,0.9); padding: 3px 8px; border-radius: 6px; max-width: calc(100% - 200px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.zoom-controls { position: absolute; bottom: 10px; right: 10px; display: flex; gap: 4px; z-index: 100; }
.zoom-btn { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); font-size: 18px; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.zoom-btn:hover { background: var(--bg); }
.zoom-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.zoom-label { padding: 0 8px; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text-muted); font-size: 12px; font-weight: 600; display: flex; align-items: center; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.empty-hint { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; z-index: 5; padding: 20px; }
.empty-hint svg { width: 120px; height: 70px; fill: none; stroke: #b9c3cf; stroke-width: 2; margin-bottom: 8px; }
.empty-hint p { color: var(--text-muted); font-size: 13px; line-height: 1.5; max-width: 320px; }
.empty-hint b { color: var(--text); }

/* ── Inspector (properties of the selection) ── */
.inspector {
  position: absolute; top: 10px; right: 10px; z-index: 200; width: 276px; max-height: calc(100% - 64px); overflow: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 28px rgba(16,24,40,0.16);
  padding: 10px 12px 12px; display: none; overscroll-behavior: contain; touch-action: pan-y;
}
.inspector.show { display: block; }
.inspector > .panel-section { display: none; }
.inspector > .panel-section.visible { display: block; }
#drawPanel[style*="display: none"], #drawPanel[style*="display:none"] { display: none !important; }
.inspector > #drawPanel:not([style*="none"]) { display: block; }
.inspector > #twinPanel.visible { display: block; }
.insp-close { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; font-size: 19px; line-height: 1; color: var(--text-muted); cursor: pointer; z-index: 2; }
.insp-close:hover { background: var(--bg); color: var(--text); }
.insp-h { font-size: 13px; font-weight: 700; margin: 0 26px 8px 0; display: flex; align-items: baseline; gap: 6px; }
.insp-num { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.multi-select-count { font-size: 12px; color: var(--accent); font-weight: 700; }
.lbl { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: 11px 0 5px; }
.qa { margin-top: 2px; }
.qa .lbl { margin-top: 2px; }
.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.qa-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; border: 1px solid #bfdfe9; background: #f2f9fb; color: var(--accent-hover); border-radius: 7px; padding: 4px 2px 5px; cursor: pointer; font-size: 11px; font-weight: 650; }
.qa-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.qa-btn:hover { background: #e2f1f6; border-color: var(--accent); }
.qa-btn:active { transform: scale(0.97); }
#personText { width: 100%; height: 58px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 12.5px; line-height: 1.45; resize: vertical; background: var(--bg); outline: none; touch-action: auto; }
#personText:focus { border-color: var(--accent); background: #fff; }
.fill-mode-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin-bottom: 6px; }
.fill-mode-btn { padding: 5px 2px; border: 1px solid var(--border); border-radius: 5px; background: #fff; font-size: 11px; font-weight: 550; cursor: pointer; }
.fill-mode-btn:hover { background: var(--bg); }
.fill-mode-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.fill-colors { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; align-items: center; }
.fill-swatch { width: 23px; height: 23px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; }
.fill-swatch:hover { transform: scale(1.12); }
.fill-swatch.active { border-color: var(--text); }
.fill-swatch.clear-swatch { background: #fff !important; position: relative; }
.fill-swatch.clear-swatch::after { content: ''; position: absolute; top: 2px; left: 50%; width: 1.5px; height: calc(100% - 4px); background: var(--danger); transform: rotate(45deg); }
.color-hex-input { width: 70px; height: 23px; border: 1.5px solid var(--border); border-radius: 4px; padding: 0 4px 0 7px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; background: var(--bg); outline: none; border-left-width: 5px; touch-action: auto; }
.color-hex-input:focus { border-color: var(--accent); }
.grid-row { display: flex; align-items: flex-start; margin-bottom: 4px; }
.quarter-grid, .half-grid { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 2px; border: 1.5px solid var(--border); border-radius: 4px; overflow: hidden; width: 52px; height: 52px; flex: none; }
.quarter-cell, .half-cell { cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 8px; color: var(--text-muted); font-weight: 600; position: relative; }
.quarter-cell:hover, .half-cell:hover { filter: brightness(0.92); }
.quarter-cell.active-quarter, .half-cell.active-half { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 1; }
.quarter-label { font-size: 11px; color: var(--text-muted); margin-left: 10px; }
.shading-option-row { display: flex; gap: 4px; margin-bottom: 5px; }
.shading-option-btn { flex: 1; padding: 5px 3px; border: 1px solid var(--border); border-radius: 5px; background: #fff; font-size: 11px; font-weight: 550; cursor: pointer; }
.shading-option-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ct-row { display: flex; flex-wrap: wrap; gap: 3px; }
.ct-btn { border: 1px solid var(--border); background: #fff; border-radius: 5px; padding: 4px 7px; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.ct-btn:hover { background: var(--bg); }
.ct-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ct-num { display: inline-flex; }
.ct-num input { width: 30px; border: 1px solid var(--border); border-right: 0; border-radius: 5px 0 0 5px; padding: 3px 4px; text-align: center; font-size: 12px; font-weight: 700; }
.ct-num .ct-btn { border-radius: 0 5px 5px 0; }
.shape-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.sh-btn { border: 1px solid var(--border); background: #fff; border-radius: 5px; padding: 3px 0; font-size: 14px; line-height: 1.2; cursor: pointer; white-space: nowrap; }
.sh-btn:hover { background: var(--bg); border-color: var(--accent); }
.insp-more { margin-top: 10px; border-top: 1px solid var(--border-light); padding-top: 6px; }
.insp-more summary { cursor: pointer; font-size: 11.5px; font-weight: 650; color: var(--text-muted); }

/* narrow workbench: the inspector becomes a sheet at the bottom */
@media (max-width: 620px) {
  .inspector { top: auto; left: 6px; right: 6px; bottom: 54px; width: auto; max-height: 52%; border-radius: 12px; }
  .status-bar { display: none; }
}

/* ── Help ── */
.help-back { position: fixed; inset: 0; z-index: 900; background: rgba(15,23,32,0.42); display: grid; place-items: center; padding: 16px; }
.help-card { position: relative; background: #fff; border-radius: 12px; max-width: 560px; width: 100%; max-height: 92vh; overflow: auto; padding: 20px 22px 18px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.help-card h2 { font-size: 18px; margin-bottom: 10px; }
.help-steps { padding-left: 20px; display: grid; gap: 7px; line-height: 1.5; font-size: 13px; color: #384355; }
.help-keys { margin-top: 12px; border-collapse: collapse; font-size: 12.5px; width: 100%; }
.help-keys td { padding: 4px 6px 4px 0; border-bottom: 1px solid var(--border-light); }
.help-keys td:first-child { white-space: nowrap; width: 1%; padding-right: 14px; }
.sib-move { display: flex; align-items: center; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.sib-move span { font-size: 11px; color: var(--text-muted); flex: 1 1 100%; }
.sib-move .pbtn { flex: 1; padding: 3px 6px; font-size: 11px; }
.flash-ctl { animation: flashctl 1.2s ease 2; border-radius: 7px; }
@keyframes flashctl { 0%, 100% { box-shadow: none; } 40%, 60% { box-shadow: 0 0 0 3px #ffb347, 0 0 12px #ffb347; } }
