:root {
  --bg: #f3f4f7;
  --panel: #ffffff;
  --line: #e5e7ee;
  --line-strong: #d3d7e0;
  --text: #171a23;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --radius: 10px;
  --plan-w: 318px;
  --design-w: 340px;
  --ui-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
@supports (height: 100dvh) { html, body { height: 100dvh; } } /* mobile browsers: the visible height, not the height behind the address bar */
body { font: 13px/1.45 var(--ui-font); 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; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { display: block; }

/* ---------- top bar */
.topbar { height: 52px; flex: none; min-width: 0; display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 30; }
.brand { min-width: 0; white-space: nowrap; display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.version { font-weight: 500; font-size: 11px; color: #9096a3; background: #f0f1f5; border-radius: 999px; padding: 2px 8px; letter-spacing: 0; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 8px; border: 1px solid transparent; background: none; font-weight: 600; white-space: nowrap; }
.btn svg, .icon-btn svg, .tabbar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.ghost { border-color: var(--line-strong); background: #fff; }
.btn.ghost:hover { background: #f6f7fa; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: default; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: 8px; color: #3b4252; }
.icon-btn:hover { background: #f0f1f5; }
.icon-btn:disabled { opacity: 0.3; cursor: default; background: none; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 40px; width: 250px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 34px rgba(20, 24, 40, 0.16); padding: 6px; z-index: 50; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; }
.menu button:hover { background: #f3f4f8; }
.menu b { display: block; font-weight: 600; }
.menu small { color: var(--muted); font-size: 11.5px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }

/* ---------- layout */
.app { flex: 1; min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
#panel-plan { width: var(--plan-w); max-width: 46vw; }
#panel-design { width: var(--design-w); max-width: 46vw; }
.panel { position: relative; background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
#panel-plan { border-right: 1px solid var(--line); }
#panel-design { border-left: 1px solid var(--line); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.panel-head h2 { margin: 0; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.sheet-close { display: none; border: 0; background: #f0f1f5; width: 28px; height: 28px; border-radius: 50%; }
.panel-body { flex: 1; overflow-y: auto; padding: 4px 12px 24px; overscroll-behavior: contain; }
.stage-wrap { position: relative; min-width: 0; min-height: 0; }
.stage { position: absolute; inset: 0; overflow: auto; padding: 28px 28px 64px; scroll-padding-bottom: 64px; display: flex; } /* room at the foot so the chart's toolbar can always scroll clear of the zoom control */
.chart-col { margin: auto; flex: none; width: 100%; max-width: 1280px; }
/* under the chart: the add actions (dashed: they make something new) on the left, the view toolbar on the right */
.chart-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 2px 0; position: sticky; left: 0; width: max-content; max-width: 100%; min-width: 100%; }
.ca-adds { display: inline-flex; align-items: center; gap: 6px; }
.chart-add .add-btn { background: #fff; display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 13px 0 9px; }
.add-btn svg { width: 14px; height: 14px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.chart-add-note { color: #9096a3; font-size: 12px; }
/* notes and warnings take a line of their own underneath, so the buttons above never move when one comes or goes */
.ca-notes { order: 9; flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 0 4px; }
.ca-notes:not(:has(> :not([hidden]):not(:empty))) { display: none; }
.paste-link { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.paste-link:hover { color: var(--accent); background: var(--accent-soft); }
.paste-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chart-add .paste-link { display: none; } /* on a desktop the Plan panel's paste button is always in view */
/* the view toolbar: one white bar like the look bar, pinned to the chart's right edge */
.qs { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; padding: 2px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 1px 2px rgba(20, 24, 40, 0.05); }
.qs-btn { position: relative; flex: none; height: 26px; padding: 0 10px; border-radius: 7px; border: 0; background: none; color: #3b4252; font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.qs-btn > svg { width: 15px; height: 15px; flex: none; fill: none; stroke: #8a90a0; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.qs-btn:hover { background: #f1f2f6; color: #111827; }
.qs-btn:hover > svg { stroke: currentColor; }
.qs-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.qs-btn[aria-pressed="true"] > svg { stroke: currentColor; }
/* every label a button can show sits in one cell, so it is always as wide as its longest and nothing moves when it changes */
.qs-l { display: inline-grid; }
.qs-l > span { grid-area: 1 / 1; visibility: hidden; }
.qs-l > span.on { visibility: visible; }
.qs-count { position: absolute; top: -7px; right: -5px; background: var(--accent); color: #fff; border: 2px solid #fff; border-radius: 999px; font-size: 10.5px; font-weight: 700; line-height: 14px; min-width: 18px; padding: 0 4px; text-align: center; }
.qs-more { width: 28px; padding: 0; justify-content: center; }
.qs-more > svg circle { fill: currentColor; stroke: none; }
.qs-btn:disabled { opacity: 0.35; cursor: default; }
.qs-btn:disabled:hover { background: none; color: #3b4252; }
.qs-btn:disabled:hover > svg { stroke: #8a90a0; }
.qs-sep { flex: none; width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.link-btn.quiet { font-size: 12px; color: var(--muted); padding: 4px 6px; }
.link-btn.quiet:hover { color: var(--accent); }
.marker-jump { position: absolute; left: 16px; bottom: 16px; z-index: 6; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; color: #3b4252; font-weight: 600; font-size: 12.5px; box-shadow: 0 4px 14px rgba(20, 24, 40, 0.12); }
.marker-jump:hover { border-color: var(--accent); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 32px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; padding: 3px 5px; }
.chips:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14); }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 3px 1px 9px; font-size: 12.5px; font-weight: 600; }
.chip-x { border: 0; background: none; color: inherit; opacity: 0.6; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; padding: 0; line-height: 1; }
.chip-x:hover { opacity: 1; background: rgba(79, 70, 229, 0.15); }
.chip-in { flex: 1; min-width: 70px; border: 0; outline: none; background: none; font: inherit; padding: 3px 4px; }
.canvas-wrap { border-radius: 12px; box-shadow: 0 1px 2px rgba(20, 24, 40, 0.06), 0 10px 36px rgba(20, 24, 40, 0.1); overflow: hidden; background: #fff; }
.canvas-wrap.transparent { background: repeating-conic-gradient(#e9ebf0 0% 25%, #fff 0% 50%) 0 0 / 18px 18px; }
.canvas-wrap.transparent.dark { background: repeating-conic-gradient(#232733 0% 25%, #181b24 0% 50%) 0 0 / 18px 18px; }
#chart { width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
#chart [data-role] { fill: transparent; }
#chart text, #chart polygon, #chart polyline, #chart line { pointer-events: none; } /* labels never block grabbing the bar beneath */
#chart [data-role='move'] { cursor: grab; }
#chart [data-role='resize-l'], #chart [data-role='resize-r'], #chart [data-role='progress'], #chart [data-role='today'] { cursor: ew-resize; }
#chart [data-role='row'] { cursor: ns-resize; }
#chart.dragging, #chart.dragging * { cursor: grabbing !important; }
#chart .touchlock { touch-action: none; }
#chart [data-role='today'] { touch-action: pan-y; }

/* ---------- outline */
.outline { display: flex; flex-direction: column; position: relative; }
.orow { display: flex; align-items: center; gap: 2px; height: 34px; border-radius: 8px; padding-right: 4px; position: relative; }
.orow:hover { background: #f6f7fa; }
.orow.sel { background: var(--accent-soft); }
.orow.lvl0 { margin-top: 6px; }
.orow.lvl0:first-child { margin-top: 0; }
.orow.dragging { opacity: 0.35; }
.grip { flex: none; width: 20px; height: 30px; display: grid; place-items: center; color: #b3b8c5; cursor: grab; touch-action: none; font-size: 12px; letter-spacing: -2px; user-select: none; }
.grip:hover { color: #6b7280; }
.indent { flex: none; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 3px; margin: 0 6px 0 2px; }
.dot.ms { transform: rotate(45deg) scale(0.86); border-radius: 2px; }
.orow .nm { flex: 1; min-width: 0; height: 28px; border: 1px solid transparent; background: none; border-radius: 6px; padding: 0 6px; outline: none; text-overflow: ellipsis; }
.orow.lvl0 .nm { font-weight: 700; }
.orow.lvl2 .nm { color: #4b5563; }
.orow .nm:focus { background: #fff; border-color: var(--accent); }
.orow .dates { flex: none; font-size: 11px; color: #9aa1af; padding: 0 4px; font-variant-numeric: tabular-nums; pointer-events: none; }
.orow .more { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: none; border-radius: 6px; color: #b3b8c5; padding: 0; }
.orow .more:hover { background: #e8eaf0; color: #3b4252; }
.orow .more.on { color: var(--accent); background: #dfe2ff; }
.orow .more svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s; }
.orow .more.on svg { transform: rotate(180deg); }
.pop.wide { width: 360px; }
.pop .paste-area { height: auto; min-height: 150px; padding: 8px 10px; resize: vertical; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 4; }
.pop-btns { display: flex; gap: 8px; justify-content: flex-end; }
.pop-adds { display: flex; flex-wrap: wrap; gap: 6px; }
.pop-adds .chip-btn { height: 28px; font-size: 12px; }
.detail .pop-adds { margin-bottom: 6px; }
.pop-foot .pop-adds { flex: 1 0 100%; padding-bottom: 2px; }
.pop-foot .pop-adds .chip-btn { border-style: dashed; border-radius: 999px; padding: 0 11px; font-weight: 600; }
.drop-line { position: absolute; left: 8px; right: 0; height: 3px; border-radius: 2px; background: var(--accent); pointer-events: none; z-index: 5; }
.detail { margin: 2px 0 8px 22px; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: grid; gap: 10px; }
.detail .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail .note { color: var(--muted); font-size: 12px; margin: 0; }
.dep-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.dep-chips span { display: inline-flex; align-items: center; gap: 4px; background: #f0f1f5; border-radius: 999px; padding: 2px 4px 2px 9px; font-size: 12px; max-width: 100%; }
.dep-chips button { border: 0; background: none; padding: 0 4px; color: var(--muted); }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.row-actions button { height: 28px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line-strong); background: #fff; font-size: 12px; font-weight: 500; }
.row-actions button:hover { background: #f6f7fa; }
.pop { overflow-x: hidden; grid-template-columns: minmax(0, 1fr); }
.pop > * { min-width: 0; }
.pop .two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.accs { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0 -2px; }
.acc { border-top: 1px solid var(--line); }
.acc-h { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 0 2px; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.acc-h:hover .acc-t { color: var(--accent); }
.acc-t { font-size: 12.5px; font-weight: 600; color: #3b4252; white-space: nowrap; }
.acc-s { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.acc .chev { flex: none; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform 0.15s; margin: 0 3px 0 2px; }
.acc.open .chev { transform: rotate(45deg); }
.acc-b { display: none; padding: 2px 2px 12px; gap: 8px; }
.acc.open .acc-b { display: grid; }
.acc-b > .field > span:first-child { display: none; } /* the section title says it already */
.dotc { display: inline-block; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 1px var(--line-strong); flex: none; }
.pop-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.pop-foot .pf-l, .pop-foot .pf-r { display: inline-flex; gap: 4px; }
.pop-foot button { height: 28px; min-width: 30px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-strong); background: #fff; font-size: 12px; font-weight: 500; }
.pop-foot button:hover { background: #f6f7fa; }
.pop-foot button.danger { color: #c0262d; }
.pop-foot button:disabled { opacity: 0.4; cursor: default; }
.pop .row-actions { gap: 3px; flex-wrap: nowrap; }
.pop .row-actions button { padding: 0 6px; font-size: 11.5px; white-space: nowrap; }
.row-actions button.danger { color: #c0262d; margin-left: auto; }
.row-actions button:disabled { opacity: 0.4; cursor: default; }
.add-row { display: flex; gap: 6px; margin: 14px 0 10px 22px; flex-wrap: wrap; }
.chip-btn { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px dashed var(--line-strong); background: none; font-weight: 600; color: #3b4252; }
.paste-btn { display: flex; align-items: center; gap: 8px; width: calc(100% - 22px); height: 34px; margin: 0 0 4px 22px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: #3b4252; font-size: 12.5px; font-weight: 500; text-align: left; }
.paste-btn:hover { border-color: var(--accent); color: var(--accent); }
.paste-btn svg { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 2px; font-weight: 500; font-size: 12.5px; color: var(--muted); }
.link-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.link-btn:hover { color: var(--accent); text-decoration: underline; }
.orow.drop-into { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.chip-btn[aria-pressed="true"] { border-style: solid; border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chip-btn:hover { border-style: solid; border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.hint { color: #9096a3; font-size: 11.5px; margin: 10px 4px 0 22px; }
.tips { margin: 18px 4px 4px 22px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; color: #6b7280; }
.tips[open] { border-color: var(--line); background: #fafbfd; }
.tips > summary { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 500; color: #9096a3; user-select: none; border-radius: 8px; }
.tips > summary svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: none) { .tips { display: none; } } /* keyboard shortcuts mean nothing on a phone */
.tips > summary::-webkit-details-marker { display: none; }
.tips > summary::after { content: ''; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; margin-left: 2px; }
.tips[open] > summary::after { transform: rotate(45deg); }
.tips > summary:hover { color: #3b4252; }
.tip-list { list-style: none; margin: 0; padding: 0 10px 10px; display: grid; gap: 7px; }
.tip-list li { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: start; line-height: 1.35; }
.tip-k { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; color: #3b4252; font-weight: 600; font-size: 11.5px; }
.tip-k kbd { font-weight: 600; color: #3b4252; background: #fff; white-space: nowrap; }
.tip-plus { color: #9aa1af; }
kbd { font: inherit; font-size: 10.5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: #fff; }
.grip-demo { letter-spacing: -2px; }

/* ---------- form controls */
.field { display: grid; gap: 4px; min-width: 0; }
.field > span, .lbl { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.inp, select.inp { height: 32px; width: 100%; min-width: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; padding: 0 9px; outline: none; }
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14); }
input[type='range'] { width: 100%; accent-color: var(--accent); margin: 0; }
.range-row { display: flex; align-items: center; gap: 8px; }
.range-row output { width: 38px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.group { padding: 4px 4px 6px; border-bottom: 1px solid var(--line); }
.gbody { display: grid; grid-template-columns: minmax(0, 1fr); gap: 11px; padding: 4px 0 10px; }
.group.collapsed .gbody { display: none; }
.ctl.col .seg button { padding: 0 4px; }
.group:last-child { border-bottom: 0; }
.group h3 { margin: 0; font-size: 12.5px; font-weight: 700; }
.ghead { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 8px; }
.ghead:hover .gt { color: var(--accent); }
.ghead:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ghead .chev { width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -3px 3px 0 3px; flex: none; transition: transform 0.15s; }
.group.collapsed .ghead .chev { transform: rotate(-45deg); margin: 0 3px 0 1px; }
.gsum { display: none; margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.group.collapsed .gsum { display: block; flex: 1; text-align: right; }
.gsum .gdots { vertical-align: middle; margin-right: 6px; }
.gdots { display: inline-flex; }
.gdots i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #fff; margin-left: -3px; box-shadow: 0 0 0 1px var(--line-strong); }
.gdots i:first-child { margin-left: 0; }
.ghd { margin: 6px 0 -3px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.gbody > .ghd:first-child { margin-top: 0; }
.ctl { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; }
.ctl.col { display: grid; gap: 5px; justify-content: stretch; }
.ctl.col > select.inp { width: 100%; }
.ctl.sub { padding-left: 12px; border-left: 2px solid var(--line); }
.seg { display: flex; background: #eef0f4; border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 6px; height: 26px; padding: 0 8px; font-size: 12px; font-weight: 500; color: #4b5563; white-space: nowrap; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(20, 24, 40, 0.14); font-weight: 600; }
.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; width: 100%; height: 100%; }
.switch i { position: absolute; inset: 0; background: #cfd3dc; border-radius: 999px; transition: background 0.15s; }
.switch i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25); }
.color { display: flex; align-items: center; gap: 6px; }
.color input[type='color'] { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: none; cursor: pointer; overflow: hidden; }
.color input[type='color']::-webkit-color-swatch-wrapper { padding: 0; }
.color input[type='color']::-webkit-color-swatch { border: 0; }
.color input[type='color']::-moz-color-swatch { border: 0; }
.color .hex { width: 78px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; text-transform: lowercase; }
.seed-row { width: 100%; }
.seed-in { flex: 1; width: auto !important; min-width: 0; }
.pal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pal { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px; text-align: left; display: grid; gap: 5px; min-width: 0; }
.pal:hover { border-color: var(--line-strong); }
.pal.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2); }
.pal .strip { display: flex; height: 18px; border-radius: 6px; overflow: hidden; }
.pal .strip i { flex: 1; }
.pal .pn { font-size: 11.5px; font-weight: 500; color: #3b4252; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg { display: grid; gap: 6px; }
.off-list { display: grid; gap: 4px; }
.off-chip { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 3px 4px 3px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; background: #fff; }
.off-add { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.off-add .off-name { grid-column: 1 / 3; }
.off-add .btn { grid-column: 1 / 3; }
.off-add .inp.bad { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }
.pe { display: grid; gap: 8px; margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--line); }
.pe:empty { display: none; }
.pe-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.pe-sw { position: relative; width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); padding: 0; cursor: pointer; }
.pe-sw:hover { transform: scale(1.08); }
.pe-sw.on { box-shadow: 0 0 0 2px var(--accent); }
.pe-sw.ms::after { content: '◆'; position: absolute; right: -4px; bottom: -6px; font-size: 10px; line-height: 1; color: var(--muted); text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
.pe-add { width: 26px; height: 26px; border-radius: 50%; border: 1.5px dashed var(--line-strong); background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 0; cursor: pointer; }
.pe-add:hover { border-color: var(--accent); color: var(--accent); }
.pe-sel { flex-wrap: wrap; }
.pe-save { display: flex; gap: 6px; }
.pe-save .inp.bad { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }
.pal-wrap { position: relative; display: block; min-width: 0; }
.pal-wrap .pal { width: 100%; }
.pal-x { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; font-size: 10px; opacity: 0; background: rgba(255, 255, 255, 0.9); }
.pal-wrap:hover .pal-x, .pal-x:focus-visible { opacity: 1; }
@media (hover: none) { .pal-x { opacity: 1; } .orow .more { color: #8a90a0; } } /* touch screens have no hover to reveal these */
.seed-block { display: grid; gap: 6px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); padding: 0; }
.sw:hover { transform: scale(1.1); }
.sw.on { box-shadow: 0 0 0 2px var(--accent); }
.sw.custom { position: relative; overflow: hidden; display: inline-block; background: conic-gradient(#ef4444, #f59e0b, #22c55e, #06b6d4, #6366f1, #d946ef, #ef4444); }
.sw.custom input { position: absolute; inset: -6px; width: 40px; height: 40px; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.range-row.off input[type='range'] { opacity: 0.4; }
.range-row output { min-width: 34px; }
.clearable { position: relative; }
.clearable .inp { padding-right: 32px; }
.clearable .x-btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); }
.x-btn { flex: none; width: 22px; height: 22px; border: 0; border-radius: 50%; background: #eef0f4; color: #6b7280; font-size: 11px; line-height: 1; padding: 0; }
.x-btn:hover:not(:disabled) { background: #e1e4ea; color: var(--text); }
.x-btn:disabled { opacity: 0.35; cursor: default; }
.sw-hex { width: 78px; height: 24px; padding: 0 7px; font: 11.5px ui-monospace, SFMono-Regular, Menlo, monospace; }
.sw.auto { width: auto; padding: 0 9px; border-radius: 999px; background: #fff; color: #6b7280; font-size: 11px; font-weight: 600; height: 22px; }
.themes { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.themes button { aspect-ratio: 1; border-radius: 8px; border: 1px solid rgba(0, 0, 0, 0.12); padding: 0; position: relative; overflow: hidden; }
.themes button:hover { transform: scale(1.08); }
.themes button i { position: absolute; inset: 22% 22% auto 22%; height: 22%; border-radius: 2px; }
.themes button i + i { inset: auto 22% 22% 22%; }

/* ---------- modal */
.modal-back { position: fixed; inset: 0; background: rgba(18, 21, 32, 0.45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: #fff; width: min(680px, 100%); max-height: 100%; border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-sub { margin: 0; color: var(--muted); }
.modal textarea { width: 100%; min-height: 190px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; outline: none; tab-size: 4; }
.modal textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14); }
.imp-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.imp-file-note { color: var(--muted); font-size: 12px; }
.imp-preview { max-height: 170px; overflow: auto; border-radius: 10px; background: #f6f7fa; padding: 0; font-size: 12.5px; }
.imp-preview:empty { display: none; }
.imp-preview .sum { position: sticky; top: 0; background: #f6f7fa; padding: 8px 12px 4px; font-weight: 600; }
.imp-preview .pr { display: flex; gap: 10px; padding: 2px 12px; white-space: nowrap; }
.imp-preview .pr span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.imp-preview .pr span + span { color: var(--muted); font-variant-numeric: tabular-nums; }
.imp-preview .pr.l0 { font-weight: 700; }
.imp-preview .pr.l1 { padding-left: 28px; }
.imp-preview .pr.l2 { padding-left: 44px; color: #4b5563; }
.modal-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.check input { accent-color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #171a23; color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 500; z-index: 200; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); max-width: calc(100vw - 32px); }

.tabbar { display: none; }

/* ---------- collapsible panels */
.collapse-btn { width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: none; border-radius: 7px; color: #8a90a0; margin: -4px -6px -4px auto; }
.collapse-btn:hover { background: #f0f1f5; color: var(--text); }
.collapse-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* drag handles on the panels' inner edges */
.resizer { position: absolute; top: 0; bottom: 0; width: 10px; z-index: 12; cursor: col-resize; touch-action: none; outline: none; }
#panel-plan > .resizer { right: -5px; }
#panel-design > .resizer { left: -5px; }
.resizer::after { content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: transparent; transition: background 0.15s; }
.resizer:hover::after, .resizer.active::after, .resizer:focus-visible::after { background: var(--accent); }
.panel.collapsed > .resizer { display: none; }
body.resizing { cursor: col-resize; user-select: none; -webkit-user-select: none; }
body.resizing * { cursor: col-resize !important; }
@media (max-width: 860px) { .resizer { display: none; } }

@media (min-width: 861px) {
  .panel.collapsed { width: 44px !important; cursor: pointer; }
  .panel.collapsed:hover { background: #f8f9fb; }
  .panel.collapsed .panel-body { display: none; }
  .panel.collapsed .panel-head { flex-direction: column-reverse; gap: 12px; padding: 12px 0; align-items: center; justify-content: flex-end; }
  .panel.collapsed .panel-head h2 { writing-mode: vertical-rl; }
  .panel.collapsed .collapse-btn { margin: 0; }
  .panel.collapsed .collapse-btn svg { transform: rotate(180deg); }
}

.ctl.disabled { opacity: 0.5; pointer-events: none; }
.ctl-note.warn { color: #b45309; }
.chart-warn { color: #b45309; font-size: 12px; font-weight: 600; margin-left: 6px; }
.ca-notes .chart-warn { margin-left: 0; }
.chart-warn .warn-fix { color: #b45309; font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; padding: 2px 3px; }
.chart-warn .warn-fix:hover { color: #7c2d12; }
.chart-warn .warn-or { font-weight: 500; white-space: pre; }
.design-search { position: relative; margin: 0 12px 6px; display: flex; align-items: center; }
.design-search svg { position: absolute; left: 10px; width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.design-search input { width: 100%; height: 32px; padding: 0 56px 0 32px; border: 1px solid var(--line-strong); border-radius: 8px; background: #f8f9fb; font: inherit; font-size: 13px; color: inherit; outline: none; }
.design-search input::-webkit-search-cancel-button { display: none; }
.design-search input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14); }
.srch-kbd { position: absolute; right: 8px; font: 600 10.5px/1 inherit; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 3px 4px; background: #fff; pointer-events: none; }
.design-search input:focus ~ .srch-kbd, .design-search.has-q .srch-kbd { display: none; }
.srch-clear { position: absolute; right: 5px; display: none; width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.srch-clear:hover { background: var(--accent-soft); color: var(--accent); }
.design-search.has-q .srch-clear { display: block; }
.panel.collapsed .design-search { display: none; }
#design.searching .group.collapsed .gbody { display: grid; }
#design.searching .group .gsum { display: none !important; }
#design.searching .ghead { cursor: default; }
#design.searching .ghead .chev { visibility: hidden; }
#design .lbl mark { background: #fde68a; color: inherit; border-radius: 2px; padding: 0 1px; }
.srch-hint { margin: -6px 0 0; padding-left: 12px; font-size: 11.5px; color: var(--accent); line-height: 1.4; }
.ctl.unavail, .pal-ctl.unavail { opacity: 0.45; pointer-events: none; }
.srch-empty { margin: 18px 6px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.ctl-note { margin: -4px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.dialog { width: min(440px, 100%); }
.dialog h2 { margin: 0; font-size: 16px; }
.dialog-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.btn.danger { background: #c0262d; color: #fff; }
.btn.danger:hover { filter: brightness(1.1); }
.seg button:disabled { opacity: 0.4; cursor: default; }

/* ---------- zoom */
.selbar { position: absolute; left: 0; top: 0; z-index: 7; display: flex; align-items: center; gap: 4px; background: #fff; color: #1f2430; border: 1px solid var(--line); border-radius: 12px; padding: 4px 4px 4px 12px; box-shadow: 0 10px 30px rgba(20, 24, 40, 0.16), 0 2px 6px rgba(20, 24, 40, 0.08); font-size: 13px; font-weight: 500; white-space: nowrap; }
.selbar::after { content: ''; z-index: -1; position: absolute; left: var(--cx, 50%); bottom: -6px; width: 10px; height: 10px; background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: translateX(-50%) rotate(45deg); }
.selbar.below::after { bottom: auto; top: -6px; border: 0; border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.selbar #selbar-count { color: var(--muted); padding-right: 6px; font-variant-numeric: tabular-nums; }
.selbar-btn { border: 0; background: none; color: #3b4252; height: 28px; padding: 0 11px; border-radius: 8px; font-weight: 600; font-size: 13px; }
.selbar-btn:hover { background: #eef0f4; }
.selbar-btn.primary { background: var(--accent); color: #fff; }
.selbar-btn.primary:hover { background: var(--accent); filter: brightness(1.1); }
.selbar-btn[data-sel="clear"] { padding: 0; width: 28px; color: var(--muted); }
.zoombar { position: absolute; right: 16px; bottom: 16px; display: flex; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 14px rgba(20, 24, 40, 0.12); padding: 2px; z-index: 5; }
.zoombar button { border: 0; background: none; height: 28px; min-width: 28px; border-radius: 7px; font-weight: 600; color: #3b4252; font-variant-numeric: tabular-nums; }
.zoombar button:hover { background: #f0f1f5; }
#zoom-val { min-width: 50px; font-size: 12px; }

/* ---------- editing on the chart */
#chart [data-role='timeline'] { cursor: pointer; }
#chart [data-role='title'] { cursor: text; }
.pop { position: fixed; z-index: 90; width: 268px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(20, 24, 40, 0.2); padding: 12px; display: grid; gap: 10px; max-height: calc(100vh - 16px); overflow-y: auto; }
.pop h4 { margin: 0; font-size: 12.5px; }
.pop .two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
@supports (-webkit-touch-callout: none) { /* iOS gives date fields a minimum width of their own, which spills out of a half-width column */
  /* iOS lays its date fields out as a flexbox to centre the date: keep that (full width), and drop the value's own margins */
  input.inp[type='date'] { -webkit-appearance: none; appearance: none; display: flex; align-items: center; min-width: 0; max-width: 100%; padding-top: 0; padding-bottom: 0; }
  input.inp[type='date']::-webkit-date-and-time-value { text-align: left; margin: 0; }
}
.pop .note { margin: 0; color: var(--muted); font-size: 12px; }
.pop .pop-name { font-weight: 600; }
.dur { display: grid; grid-template-columns: 72px 1fr; gap: 8px; }
.btn.wide { width: 100%; justify-content: center; height: 32px; font-weight: 500; }
.inline-edit { position: fixed; z-index: 95; border: 0; outline: 2px solid var(--accent); border-radius: 6px; background: #fff; color: #111827; padding: 0 6px; box-shadow: 0 8px 24px rgba(20, 24, 40, 0.18); }

/* ---------- narrower desktops */
@media (max-width: 1180px) {
  :root { --plan-w: 280px; --design-w: 300px; }
  .stage { padding: 18px 18px 60px; }
}

/* ---------- mobile: panels become bottom sheets */
@media (max-width: 860px) {
  .app { display: block; position: relative; }
  .stage-wrap { position: absolute; inset: 0; }
  .stage { padding: 14px 14px 80px; display: block; }
  .stage { touch-action: pan-x pan-y; } /* a pinch here zooms the chart (app.js), never the page */
  .zoombar { right: 14px; bottom: calc(70px + env(safe-area-inset-bottom)); }
  .zoombar:not(.zoomed) { display: none; } /* pinching is how a phone zooms; the control appears only to undo it */
  .zoombar button { height: 34px; min-width: 34px; }
  .collapse-btn { display: none; }
  #panel-plan, #panel-design { width: auto; max-width: none; }
  /* the chart is wider than the screen (app.js sets its width from the zoom); its toolbars stay screen-wide and in view as it scrolls */
  .lookbar, .chart-add { width: calc(100vw - 28px); min-width: 0; max-width: none; }
  .ca-notes:not(:has(> .chart-warn:not([hidden]))) { display: none; } /* the add note is hidden here */
  .chart-add .paste-link { display: inline-flex; } /* the Plan panel's paste button is a sheet away here */
  .qs { margin-left: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .qs::-webkit-scrollbar { display: none; }
  .qs-btn { height: 30px; padding: 0 7px; font-size: 12.5px; }
  .chart-add .add-btn { height: 36px; } /* the same height as the view toolbar beside them, a little taller for fingers */
  .qs { gap: 1px; }
  .paste-link { white-space: nowrap; }
  .chart-add-note { display: none; }
  .panel { position: fixed; left: 0; right: 0; bottom: 0; height: min(66vh, 620px); border: 0 !important; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(20, 24, 40, 0.22); transform: translateY(105%); transition: transform 0.22s ease; z-index: 60; padding-bottom: env(safe-area-inset-bottom); }
  .panel.open { transform: none; }
  .panel { transition: transform 0.22s ease, height 0.22s ease; }
  .panel.full { height: calc(100% - 44px); }
  .panel-head { position: relative; padding-top: 20px; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
  .panel-head::before { content: ''; position: absolute; top: 7px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: var(--line-strong); }
  .seg button { min-height: 32px; }
  .ghead { min-height: 44px; }
  .ctl { min-height: 36px; }
  .orow .more { width: 36px; height: 36px; }
  .sheet-close { display: block; }
  .panel-body { padding-bottom: 84px; }
  .tabbar button.on { background: rgba(255, 255, 255, 0.18); }
  .tabbar { display: flex; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); background: #171a23; border-radius: 999px; padding: 5px; gap: 2px; z-index: 70; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28); }
  .tabbar button { display: flex; align-items: center; gap: 7px; border: 0; background: none; color: #fff; font-weight: 600; height: 38px; padding: 0 16px; border-radius: 999px; }
  .tabbar button:active { background: rgba(255, 255, 255, 0.14); }
  .btn span { display: none; }
  .btn { padding: 0 10px; }
  .btn.primary span { display: inline; }
  .topbar { padding: 0 10px; }
  .sep { display: none; }
  .orow { height: 40px; }
  .orow .nm { height: 34px; font-size: 16px; }
  .inp, .modal textarea { font-size: 16px; }
  .pop { width: min(320px, calc(100vw - 16px)); }
  .grip { width: 28px; height: 40px; font-size: 14px; }
  .themes { grid-template-columns: repeat(8, 1fr); }
  .version { display: none; }
  .top-actions { gap: 4px; }
  input:not([type="checkbox"]):not([type="color"]), select, textarea, .design-search input { font-size: 16px; } /* below 16px iOS zooms the page on focus */
  .srch-kbd { display: none; }
}
@media (min-width: 600px) and (max-width: 860px) { /* tablets: a sheet as wide as a phone reads better than one stretched across the screen */
  #panel-plan, #panel-design { left: 50%; right: auto; width: 620px; margin-left: -310px; }
}
@media (max-width: 440px) {
  .brand > span:first-of-type { display: none; } /* the logo is enough on a phone; the actions need the room */
  .topbar { padding: 0 8px; }
  .top-actions .icon-btn { width: 32px; }
}
.check kbd { margin-left: 6px; color: var(--muted); font-size: 10px; }
.pop .pop-foot { position: sticky; bottom: -12px; background: #fff; padding-bottom: 12px; margin-bottom: -12px; z-index: 1; } /* stays in view when the popover scrolls */
.status-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 3px; font-size: 11.5px; }
.reset-row { padding: 14px 0 22px; text-align: center; border-top: 1px solid var(--line); margin-top: 8px; }
.link-box { width: 100%; margin: 4px 0 14px; font-size: 12px; }

/* hover and selection on the chart: the rings themselves are drawn in the SVG; this is the tip and the links around it */
.chart-tip { position: fixed; z-index: 95; display: grid; gap: 2px; max-width: 260px; padding: 7px 10px; border-radius: 8px; background: #1f2430; color: #fff; font-size: 12px; line-height: 1.35; box-shadow: 0 6px 18px rgba(20, 24, 40, 0.22); pointer-events: none; }
.chart-tip b { font-weight: 600; }
.chart-tip span { color: #c3c8d4; }
.chart-tip[hidden] { display: none; }
.orow.hov:not(.sel) { background: #f5f6fa; }
.qs-span svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; flex: none; }
.qs-span #qs-span-text { font-variant-numeric: tabular-nums; }
/* the Style section in a popover: the Design panel's own controls, so it says plainly that they change every item of the kind */
.pop .style-note { font-size: 11.5px; line-height: 1.4; }
.pop .acc-b .ctl { min-height: 26px; }
.pop .acc-b .ctl.col { gap: 4px; }
.pop .acc-b .ctl.sub { padding-left: 10px; }
.pop .seg.ts button { padding: 0 8px; font-variant-numeric: tabular-nums; }
.pop .seg.ts button[data-ts="auto"] { flex: 1.6; }
.pop .pop-more { justify-self: start; font-size: 12px; }
.group.flash { animation: sec-flash 1.5s ease-out; }
@keyframes sec-flash { 0%, 35% { background: var(--accent-soft); box-shadow: 0 0 0 6px var(--accent-soft); } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }
.pop .acc-b { grid-template-columns: minmax(0, 1fr); }
.pop .acc-b .seg { min-width: 0; }
.pop .acc-b .seg button { min-width: 0; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; }
/* the look toolbar above the chart: one row, a fixed height, the timeline always first so nothing after it can push it around */
.lookbar { display: flex; align-items: center; gap: 2px; height: 42px; margin-bottom: 10px; padding: 0 5px; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 1px 2px rgba(20, 24, 40, 0.05); position: sticky; left: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; white-space: nowrap; }
.lookbar::-webkit-scrollbar { display: none; }
.lb-ctx { display: flex; align-items: center; gap: 2px; flex: 1; min-width: max-content; }
.lb-time { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; font-size: 12.5px; font-weight: 600; color: #3b4252; font-variant-numeric: tabular-nums; }
.lb-time svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; flex: none; }
.lb-time .qs-span-k { color: var(--muted); font-weight: 500; }
.lb-time:hover, .lb-time[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.lb-time:hover .qs-span-k, .lb-time[aria-pressed="true"] .qs-span-k { color: inherit; }
.lb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 5px; flex: none; }
.lb-scope { font-size: 11.5px; color: var(--muted); padding: 0 6px 0 2px; flex: none; }
.lb-lbl { font-size: 11.5px; color: var(--muted); padding: 0 4px; flex: none; }
.lb-ib { flex: none; width: 30px; height: 30px; border: 0; border-radius: 7px; background: none; color: #3b4252; display: inline-flex; align-items: center; justify-content: center; }
.lb-ib svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lb-ib:hover, .lb-ts:hover, .lb-colour:hover, .lb-pal:hover, .lb-more:hover { background: #f0f1f5; }
.lb-ib.on { background: var(--accent-soft); color: var(--accent); }
.lb-ib:disabled { opacity: 0.35; cursor: default; background: none; }
.lb-ts { flex: none; height: 30px; min-width: 46px; padding: 0 6px; border: 0; border-radius: 7px; background: none; font-size: 12px; font-weight: 600; color: #3b4252; font-variant-numeric: tabular-nums; }
.lb-colour, .lb-pal { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 9px 0 7px; border: 0; border-radius: 7px; background: none; font-size: 12.5px; font-weight: 600; color: #3b4252; }
.lb-sw { width: 16px; height: 16px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.lb-dots { display: inline-flex; }
.lb-dots i { width: 9px; height: 16px; } .lb-dots i:first-child { border-radius: 4px 0 0 4px; } .lb-dots i:last-child { border-radius: 0 4px 4px 0; }
.lb-seg { display: inline-flex; background: #eef0f4; border-radius: 8px; padding: 2px; gap: 2px; flex: none; }
.lb-seg button { border: 0; background: none; border-radius: 6px; height: 26px; padding: 0 7px; font-size: 12px; font-weight: 500; color: #4b5563; }
.lb-seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(20, 24, 40, 0.14); font-weight: 600; }
.lb-sel { flex: none; height: 30px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; font: inherit; font-size: 12.5px; padding: 0 6px; max-width: 150px; }
.lb-more { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 3px; height: 30px; padding: 0 6px 0 10px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.lb-more svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* the item popover: stacked rows, one menu at a time, pages with a way back */
.props { display: grid; margin: 0 -6px; }
.prow { display: flex; align-items: center; gap: 8px; min-height: 34px; width: 100%; padding: 0 6px; border: 0; border-radius: 7px; background: none; text-align: left; font: inherit; font-size: 12.5px; color: var(--text); }
.prow:hover { background: #f4f5f8; }
.prow .pk { flex: none; width: 92px; color: var(--muted); font-weight: 500; }
.prow .pv { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
.pv-empty { color: #9aa1af; font-weight: 400; }
.pchev { flex: none; width: 6px; height: 6px; border-right: 1.5px solid #a3a9b6; border-bottom: 1.5px solid #a3a9b6; transform: rotate(-45deg); margin: 0 3px 0 2px; }
.pchev.down { transform: rotate(45deg); margin-top: -4px; }
.pv-avs { display: inline-flex; flex: none; }
.pv-avs i { width: 18px; height: 18px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-style: normal; font-size: 8.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 1.5px #fff; }
.pv-avs i + i { margin-left: -5px; }
.pop-add { justify-self: start; border: 0; background: none; padding: 4px 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pop-add:hover, .pop-add[aria-expanded="true"] { color: var(--accent); }
.pop-page { display: grid; gap: 10px; animation: page-in 0.16s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.pop-page > .field > span:first-child { display: none; } /* the page title says it already */
.pop-back { justify-self: start; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border: 0; background: none; padding: 2px 0; font: inherit; font-size: 12px; font-weight: 500; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pop-back::before { content: ''; flex: none; width: 6px; height: 6px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.pop-back:hover { color: var(--accent); }
.pop-ptitle { font-size: 14px !important; margin: -4px 0 0 !important; }
.pop-note { height: auto; min-height: 64px; padding: 8px 10px; resize: vertical; line-height: 1.4; font: inherit; font-size: 13px; }
.pop-count { justify-self: end; margin-top: -6px; font-size: 11px; color: #9aa1af; font-variant-numeric: tabular-nums; }
.danger-link { justify-self: start; color: #c0262d; padding-left: 0; }
.danger-link:hover { color: #a51d24; }
.pop .note.warn { color: #b45309; }
.st-list { display: grid; gap: 6px; }
.st-row { display: flex; align-items: center; gap: 4px; }
.st-row .inp { flex: 1; min-width: 0; height: 30px; }
.st-sw { position: relative; flex: none; width: 26px; height: 26px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); cursor: pointer; margin-right: 2px; }
.st-sw input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.st-b { flex: none; width: 24px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 12px; }
.st-b:hover:not(:disabled) { background: #f0f1f5; color: var(--text); }
.st-b[data-pact="s-del"]:hover { color: #c0262d; }
.st-b:disabled { opacity: 0.3; cursor: default; }
.pop-menu { position: fixed; z-index: 96; display: grid; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(20, 24, 40, 0.2); max-height: calc(100vh - 16px); overflow-y: auto; }
.pop-menu .mi { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 6px 9px; border: 0; border-radius: 7px; background: none; text-align: left; font: inherit; font-size: 13px; color: var(--text); }
.pop-menu .mi:hover, .pop-menu .mi:focus-visible { background: #f0f1f5; outline: none; }
.pop-menu .mi[aria-checked="true"] { font-weight: 600; }
.pop-menu .ck { margin-left: auto; color: var(--accent); }
.pop-menu .dotc.none { background: none; box-shadow: inset 0 0 0 1.5px #c3c8d2; }
.pop-menu .two-line span { display: grid; gap: 1px; }
.pop-menu .two-line small { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.pop-menu .msep { height: 1px; background: var(--line); margin: 4px 3px; }
.pop-menu .m-sw { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; max-width: 250px; }
@media (prefers-reduced-motion: reduce) { .pop-page { animation: none; } }

.lookbar.narrow .qs-span-k { display: none; }
.lookbar.more-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
@media (max-width: 860px) { /* after .lookbar above: the look bar stays at the top of the screen while the chart scrolls under it */
  .lookbar { top: -8px; z-index: 4; overscroll-behavior-x: contain; box-shadow: 0 2px 10px rgba(20, 24, 40, 0.1); }
}

/* ---------- select mode (Plan → Select, or the popover's select button): taps add or remove items */
.pick-btn { margin-left: auto; margin-right: 10px; height: 24px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; color: #3b4252; font-size: 12px; font-weight: 600; }
.pick-btn:hover { border-color: var(--accent); color: var(--accent); }
.pick-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.panel.collapsed .pick-btn, .panel.collapsed .plan-selbar { display: none; }
.pick { display: none; flex: none; width: 18px; height: 18px; margin: 0 4px 0 6px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: #fff; }
body.selecting .outline .pick { display: block; }
body.selecting .outline .orow.sel .pick { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center / 13px no-repeat; border-color: var(--accent); }
body.selecting .outline .nm { pointer-events: none; } /* a tap on a name picks the row instead of editing it */
body.selecting .outline .more { visibility: hidden; }
body.selecting .outline .orow { cursor: pointer; }
.selbar-btn.ib { width: 30px; padding: 0; display: inline-grid; place-items: center; }
.selbar-btn.ib svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.selbar-btn.danger { color: #c0262d; }
.selbar-btn.danger:hover { background: #fdecec; }
.selbar-btn:disabled { opacity: 0.38; cursor: default; background: none; }
.selbar-btn.primary:disabled { background: var(--accent); }
.selbar-btn.done { background: #1f2430; color: #fff; }
.selbar-btn.done:hover { background: #1f2430; filter: brightness(1.25); }
.selbar-count { color: var(--muted); padding-right: 6px; font-variant-numeric: tabular-nums; }
.sb-short { display: none; }
.plan-selbar { position: static; margin: 2px 12px 8px; padding: 4px 4px 4px 10px; gap: 2px; box-shadow: none; border-color: var(--line-strong); flex-wrap: wrap; white-space: normal; }
.plan-selbar .sb-long { display: none; }
.plan-selbar .sb-short { display: inline; }
.plan-selbar .selbar-btn { padding: 0 8px; }
.plan-selbar .selbar-btn.ib { width: 30px; padding: 0; }
.plan-selbar::after { display: none; }
.pop-foot .pf-pick { padding: 0 9px 0 7px; display: inline-flex; align-items: center; gap: 5px; margin-left: 4px; }
.pop-foot .pf-pick:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pop-foot .pf-pick svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 860px) {
  .sb-long, .sb-hint { display: none; } /* a phone has no room for the hint beside the buttons */
  .sb-short { display: inline; }
  .pick-btn { height: 30px; padding: 0 14px; font-size: 13px; }
  .selbar-btn { height: 32px; }
  .selbar-btn.ib { width: 32px; }
  .selbar:not(.plan-selbar) { padding: 3px 3px 3px 9px; gap: 1px; }
  .selbar:not(.plan-selbar) .selbar-btn:not(.ib) { padding: 0 8px; }
}
.pick-btn + .collapse-btn { margin-left: 0; }
.lb-tip { z-index: 96; max-width: 260px; }
.lb-tip span { color: #c7ccd8; }

/* ---------- the title's options, under it while it is being edited */
.title-bar { position: fixed; z-index: 96; display: flex; align-items: center; gap: 2px; padding: 3px; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 8px 24px rgba(20, 24, 40, 0.16); white-space: nowrap; }
.title-bar button { height: 28px; padding: 0 9px; border: 0; border-radius: 8px; background: none; color: #3b4252; font: inherit; font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.title-bar button:hover { background: #f1f2f6; color: #111827; }
.title-bar button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.title-bar svg { width: 14px; height: 14px; fill: var(--accent); }
.title-bar .tb-seg { display: inline-flex; gap: 1px; background: #f1f2f6; border-radius: 8px; padding: 2px; }
.title-bar .tb-seg button { width: 28px; height: 24px; padding: 0; justify-content: center; border-radius: 6px; font-weight: 600; }
.title-bar .tb-seg button[aria-pressed="true"] { background: #fff; color: #111827; box-shadow: 0 1px 2px rgba(20, 24, 40, 0.12); }
.title-bar .tb-k { color: var(--muted); font-size: 12px; margin: 0 4px 0 6px; }
.title-bar .tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
@media (max-width: 860px) {
  .qs-count { position: static; border: 0; } /* the toolbar scrolls here, which would clip a badge on its corner */
  .title-bar button { height: 34px; }
  .title-bar .tb-seg button { width: 34px; height: 30px; }
}
