body.builder { height: 100vh; overflow: hidden; }
.app { height: 100vh; display: grid; grid-template-columns: 216px minmax(0, 1fr) 320px; grid-template-rows: 54px minmax(0, 1fr);
  grid-template-areas: "top top top" "pal stage panel"; }

/* top bar */
.topbar { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--line); min-width: 0; }
.topbar select { max-width: 260px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.tb-group { display: flex; gap: 4px; }
.tb-right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.saved { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 230px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: grid; }
.menu.right .menu-pop { left: auto; right: 0; }
.menu-pop button { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.menu-pop button:hover { background: var(--surface-2); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; width: auto; }
.danger { color: var(--warn) !important; }

/* palette */
.palette { grid-area: pal; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 10px 10px 30px; }
.pal-group h4 { margin: 12px 4px 6px; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.pal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tile { display: grid; justify-items: center; gap: 2px; padding: 6px 4px 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
  cursor: grab; font-size: 11.5px; line-height: 1.2; text-align: center; user-select: none; touch-action: none; }
.tile:hover { border-color: var(--accent); }
.tile:active { cursor: grabbing; }
.tile .art { width: 100%; height: 44px; display: grid; place-items: center; background: #fff; border-radius: 5px; }
.tile .art svg { max-height: 40px; width: auto; }
.flow-list { display: grid; gap: 5px; }
.flow-btn { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); cursor: pointer; font-size: 12px; text-align: left; }
.flow-btn .art { background: #fff; border-radius: 4px; display: grid; }
.flow-btn .art svg { width: 70px; height: 20px; }
.flow-btn.active { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.pal-note { font-size: 11.5px; color: var(--muted); margin: 6px 4px 0; line-height: 1.4; }

/* stage */
.stage { grid-area: stage; position: relative; overflow: hidden; background: var(--paper); }
#canvas { width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: default; background: #fbfbf8; }
#canvas.panning { cursor: grabbing; }
#canvas.linking .node { cursor: crosshair; }
#canvas.drop-target { box-shadow: inset 0 0 0 3px var(--accent); }
.node { cursor: move; }
.node .hit { fill: transparent; pointer-events: all; }
.link { cursor: pointer; }
.link .hit { stroke: transparent; pointer-events: stroke; }
.link.is-sel .glow { stroke: #0a6c55; stroke-opacity: .22; }
.sel-outline { fill: rgba(10,108,85,.06); stroke: #0a6c55; stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none; }
.link-from .sel-outline { stroke: #d97706; fill: rgba(217,119,6,.08); stroke-dasharray: none; }
.drop-ok .sel-outline { stroke: #d97706; stroke-dasharray: none; }
.handle { fill: #0a6c55; stroke: #fff; stroke-width: 2.5; cursor: crosshair; }
.handle:hover { r: 9; }
.rubber { stroke: #d97706; stroke-width: 2; stroke-dasharray: 6 4; fill: none; pointer-events: none; }
.hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 7px 14px; border-radius: 999px;
  font-size: 13px; box-shadow: var(--shadow); pointer-events: none; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.empty { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 400px; text-align: center; background: var(--surface);
  border: 1px dashed var(--line); border-radius: 14px; padding: 20px 24px; box-shadow: var(--shadow); }
.empty h3 { margin: 0 0 6px; } .empty p { color: var(--muted); font-size: 14px; margin: 6px 0; }
.zoom { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 4px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px; box-shadow: var(--shadow); }
.zoom .btn { padding: 3px 10px; }
#zoomLabel { font: 12px var(--mono); min-width: 44px; text-align: center; color: var(--muted); }

/* panel */
.panel { grid-area: panel; background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; padding: 12px 14px 40px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.stat .v { font: 600 17px var(--mono); }
.stat .l { font-size: 11px; color: var(--muted); }
.stat.warn .v { color: var(--warn); }
.section-title { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 16px 0 6px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.balance { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.balance svg { display: block; width: 100%; height: auto; }
.issues { margin: 8px 0 0; padding: 0; list-style: none; font-size: 12.5px; }
.issues li { padding: 5px 8px; border-radius: 6px; background: var(--warn-soft); color: var(--ink); margin-bottom: 4px; }
.props-head { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.props-head .art { width: 52px; height: 44px; background: #fff; border: 1px solid var(--line); border-radius: 6px; display: grid; place-items: center; flex: none; }
.props-head .art svg { max-height: 38px; width: auto; }
.props-head h3 { margin: 0; font-size: 16px; }
.props-desc { font-size: 12.5px; color: var(--muted); margin: 6px 0 10px; line-height: 1.45; }
.field { display: grid; gap: 3px; margin-bottom: 9px; }
.field > span { font-size: 12.5px; font-weight: 600; }
.field em { font-style: normal; color: var(--muted); font-weight: 400; }
.field input, .field textarea, .field select { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field small, .check + small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 4px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.computed { font: 12.5px var(--mono); background: var(--accent-soft); border-radius: 6px; padding: 6px 8px; margin: 2px 0 10px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.checklist { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.checklist li { display: flex; gap: 8px; padding: 3px 0; align-items: baseline; }
.checklist .ok { color: var(--accent); font-weight: 700; width: 14px; flex: none; }
.checklist .no { color: var(--muted); width: 14px; flex: none; }
.checklist a { color: var(--muted); font-size: 11.5px; margin-left: auto; }

/* tour */
.tour { position: fixed; inset: 0; z-index: 100; }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(10, 14, 18, .58); transition: all .25s ease; pointer-events: none; outline: 3px solid var(--kaizen); }
.tour-card { position: fixed; width: min(360px, calc(100vw - 32px)); background: var(--surface); border-radius: 14px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(0,0,0,.35);
  transition: top .25s ease, left .25s ease; }
.tour-step { font: 600 11px var(--mono); color: var(--accent); letter-spacing: .07em; text-transform: uppercase; }
.tour-card h3 { margin: 4px 0 6px; font-size: 17px; }
.tour-card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.tour-actions { display: flex; gap: 6px; align-items: center; }
.tour-demo { background: #fff; border: 1px solid var(--line); border-radius: 8px; margin: -4px 0 12px; }
.tour-demo svg { display: block; width: 100%; height: auto; }



/* palette drag ghost */
.drag-ghost { position: fixed; z-index: 200; pointer-events: none; transform: translate(-50%, -50%); background: #fff; border-radius: 8px;
  padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: .9; }

/* panel tabs */
.tabs { display: flex; gap: 4px; margin: -2px 0 12px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }

/* KPIs */
.kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--bg); }
.kpi-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: 14px; }
.pill { font: 600 11px var(--mono); padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.mid { background: #fdf0d5; color: #8a5a00; }
.pill.bad { background: var(--warn-soft); color: var(--warn); }
.kpi-nums { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); margin: 6px 0; align-items: center; }
.kpi-nums b { color: var(--ink); font-family: var(--mono); }
.kpi-nums input { width: 70px; padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-family: var(--mono); }
.spark { width: 100%; height: 54px; display: block; background: #fff; border-radius: 6px; border: 1px solid var(--line); }
.kpi-log { display: grid; grid-template-columns: 1fr 1fr auto; gap: 5px; margin-top: 6px; }
.kpi-log input { min-width: 0; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 12.5px; }
.kpi-log .btn { padding: 3px 10px; }
.kpi details { margin-top: 6px; font-size: 12.5px; }
.kpi summary { cursor: pointer; color: var(--muted); }
.kpi-hist { list-style: none; padding: 0; margin: 6px 0; }
.kpi-hist li { display: grid; grid-template-columns: 86px 60px 1fr 20px; gap: 6px; align-items: center; padding: 2px 0; border-bottom: 1px dashed var(--line); }
.kpi-hist em { color: var(--muted); font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-hist button { border: 0; background: none; cursor: pointer; color: var(--warn); }

/* right-click menu */
.ctx { position: fixed; z-index: 150; width: 240px; max-height: calc(100vh - 16px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.22); padding: 6px; font-size: 13px; }
.ctx > button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.ctx > button:hover, .ctx-list button:hover, .ctx-grid button:hover { background: var(--surface-2); }
.ctx-title { font-weight: 700; padding: 4px 8px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-label { font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 8px 8px 4px; }
.ctx-sep { border-top: 1px solid var(--line); margin: 6px 2px; }
.ctx select { width: calc(100% - 16px); margin: 0 8px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.sw { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 8px; }
.sw button { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); cursor: pointer; padding: 0; }
.sw button.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw .sw-reset { background: var(--surface); font-size: 11px; line-height: 1; color: var(--muted); }
.seg { display: flex; margin: 0 8px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--bg); padding: 5px 4px; cursor: pointer; font-size: 12px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.ctx-list { display: grid; gap: 2px; padding: 0 4px; }
.ctx-list button { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: center; background: none; border: 0; border-radius: 6px; padding: 3px 4px; cursor: pointer; text-align: left; }
.ctx-list button.on { background: var(--accent-soft); font-weight: 600; }
.ctx-list .art { background: #fff; border-radius: 4px; display: grid; }
.ctx-list .art svg { width: 64px; height: 18px; }
.ctx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; }
.ctx-grid button { display: grid; justify-items: center; gap: 2px; background: none; border: 1px solid var(--line); border-radius: 7px; padding: 5px 2px; cursor: pointer; font-size: 11px; }

/* assistant */
.assist-btn { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.assist { position: fixed; top: 54px; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 70; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -12px 0 30px rgba(0,0,0,.12); display: grid; grid-template-rows: auto 1fr auto auto; }
.assist[hidden] { display: none; }
.assist-head { display: flex; align-items: center; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.assist-head div { flex: 1; display: grid; }
.assist-head small { color: var(--muted); font-size: 12px; }
.assist-log { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.msg.bot { background: var(--bg); border: 1px solid var(--line); border-top-left-radius: 4px; align-self: flex-start; }
.msg.me { background: var(--accent); color: var(--accent-ink); border-top-right-radius: 4px; align-self: flex-end; white-space: pre-wrap; }
.msg p { margin: 0 0 6px; } .msg p:last-child { margin: 0; }
.msg ul { margin: 4px 0; padding-left: 18px; }
.msg .formula { font-size: 12.5px; margin: 6px 0; }
.assist-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.assist-chips:empty { display: none; }
.assist-chips button { border: 1px solid var(--accent); color: var(--accent); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; text-align: left; }
.assist-chips button.on { background: var(--accent); color: var(--accent-ink); }
.assist-chips button.go { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.assist-form { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); }
.assist-form textarea { resize: vertical; min-height: 40px; max-height: 200px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.step-card { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; margin-top: 8px; }
.step-card label { display: grid; gap: 2px; font-size: 11.5px; color: var(--muted); }
.step-card input { padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); min-width: 0; }
.step-card .wide { grid-column: 1 / -1; }
.step-card .check { display: flex; gap: 6px; align-items: center; color: var(--ink); font-size: 12.5px; }
.step-card .btn { grid-column: 1 / -1; justify-content: center; }
.msg table.cmp { font-size: 12.5px; margin: 8px 0 0; } .msg table.cmp td, .msg table.cmp th { padding: 4px 6px; }

/* start-from-a-form dialog */
.vsm-form { width: min(1180px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.vsm-form::backdrop { background: rgba(10,14,18,.5); }
.vsm-form form { display: grid; gap: 10px; padding: 16px 18px; }
.vsm-form header, .vsm-form footer { display: flex; align-items: center; gap: 8px; }
.vsm-form header h3 { margin: 0; flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 12px; }
.form-grid label { display: grid; gap: 3px; font-size: 12.5px; font-weight: 600; }
.form-grid small { font-weight: 400; color: var(--muted); }
.form-grid input, .form-grid select, .form-table input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); min-width: 0; font-weight: 400; }
.form-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.form-table table { margin: 0; min-width: 1100px; }
.form-table th { font-size: 11.5px; white-space: nowrap; }
.form-table td { padding: 4px; }
.form-table td:first-child input { min-width: 150px; }
.form-table input[type="number"] { width: 70px; }

.node.under { opacity: .9; }
.node.under .hit { pointer-events: all; }

/* simulation + suggestions dock */
.sim-btn { border-color: #1d4ed8; color: #1d4ed8; font-weight: 600; }
.dock { position: absolute; left: 0; right: 0; bottom: 0; height: min(46%, 380px); z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(0,0,0,.12); display: grid; grid-template-rows: auto 1fr; }
.dock[hidden] { display: none; }
.stage.docked .zoom { bottom: calc(min(46%, 380px) + 12px); }
.dock-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dock-tabs { display: flex; gap: 4px; }
.dock-tabs button { border: 0; background: none; padding: 6px 10px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--muted); }
.dock-tabs button.on { background: var(--accent-soft); color: var(--accent); }
.dock-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; font-size: 13px; }
.dock-ctl[hidden] { display: none; }
.dock-ctl label { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.dock-ctl select, .dock-ctl input { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.dock-ctl input { width: 56px; }
.dock-head .btn.ghost { margin-left: auto; }
.dock-body { overflow-y: auto; padding: 10px 12px 16px; }
.dock-body[hidden] { display: none; }
.sim-stats { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.sim-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--muted); margin: 8px 0 4px; }
.sim-legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.sim-legend i.dot { width: 10px; height: 10px; border-radius: 50%; }
.findings { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; font-size: 13px; }
.findings li { padding: 7px 10px; border-radius: 7px; background: var(--bg); border-left: 4px solid var(--muted); }
.findings li.bad { border-left-color: #cf222e; background: var(--warn-soft); }
.findings li.warn { border-left-color: #d97706; }
.findings li.ok { border-left-color: var(--accent); }
.findings a { font-size: 12px; margin-left: 4px; }
.idea-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.idea { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); font-size: 13px; }
.idea-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.idea p { margin: 5px 0; color: var(--muted); line-height: 1.45; }
.idea p.how { color: var(--ink); }
.idea .row-actions { margin-top: 6px; }
.idea .row-actions .btn { padding: 4px 9px; font-size: 12.5px; }
.whatif table.cmp { font-size: 12.5px; margin: 6px 0 0; }
.whatif td, .whatif th { padding: 3px 6px; }
.whatif .verdict { margin: 8px 0 4px; padding: 7px 9px; border-radius: 8px; background: var(--accent-soft, #e3f1ec); color: var(--ink); font-weight: 600; line-height: 1.45; }
.idea.tested { border-color: var(--accent, #0a6c55); box-shadow: 0 0 0 2px rgba(10,108,85,.15); }
.testing-bar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; padding: 7px 10px; border-radius: 8px; background: #fff4cc; border: 1px dashed #b45309; font-size: 13px; }


/* collapsible panes */
@media (min-width: 901px) and (min-height: 521px), (min-width: 901px) and (pointer: fine) {
  .app.pal-off { grid-template-columns: 0 minmax(0, 1fr) 320px; }
  .app.side-off { grid-template-columns: 216px minmax(0, 1fr) 0; }
  .app.pal-off.side-off { grid-template-columns: 0 minmax(0, 1fr) 0; }
  .app.pal-off .palette, .app.side-off .panel { overflow: hidden; padding: 0; border: 0; }
}
.pane-toggle { position: absolute; top: 50%; z-index: 25; width: 22px; height: 56px; margin-top: -28px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0; box-shadow: var(--shadow); }
.pane-toggle:hover { color: var(--accent); border-color: var(--accent); }
.pane-toggle.left { left: 0; border-left: 0; border-radius: 0 8px 8px 0; }
.pane-toggle.right { right: 0; border-right: 0; border-radius: 8px 0 0 8px; }
.section-title.fold { cursor: pointer; user-select: none; }
.section-title.fold::before { content: "▾"; font-size: 11px; color: var(--muted); }
.section-title.fold.closed::before { content: "▸"; }
.folded { display: none !important; }
.dock.min { height: auto; }
.dock.min .dock-body { display: none; }
.stage.docked.dock-min .zoom { bottom: 70px; }

/* mobile tab bar (shown on phones) */

.mtabs { grid-area: tabs; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); z-index: 90; }
.mtabs button { border: 0; background: none; display: grid; justify-items: center; align-content: center; gap: 1px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.mtabs button span { font-size: 18px; line-height: 1.1; }
.mtabs button.on { color: var(--accent); font-weight: 600; }

/* goals */
.goal-quick { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.goal-quick .btn { padding: 4px 9px; font-size: 12.5px; }
.goal-list { display: grid; gap: 6px; margin-bottom: 8px; }
.goal-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 5px; align-items: center; font-size: 12.5px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.goal-row select { grid-column: 1 / -1; }
.goal-row select, .goal-row input { padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); min-width: 0; }
.goal-row .op { font-weight: 700; color: var(--accent); }
.goal-row .u { color: var(--muted); font-size: 11.5px; }
.goal-row .btn { padding: 2px 6px; }
.goal-cmp { font-size: 12.5px; }
.goal-cmp td, .goal-cmp th { padding: 5px 6px; }
.goal-cmp .g-ok { color: var(--accent); font-weight: 700; }
.goal-cmp .g-bad { color: var(--warn); font-weight: 600; }
.plan-head { padding: 8px 10px; border-radius: 8px; font-size: 13px; background: var(--accent-soft); margin-bottom: 6px; }
.plan-head.warn { background: var(--warn-soft); }
.plan-list { margin: 4px 0 8px; padding-left: 20px; font-size: 13px; display: grid; gap: 4px; }
.plan-list .muted { color: var(--muted); }
.plan-checks li.ok { background: var(--accent-soft); }



/* tooltips */
.tip { display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 5px; border-radius: 50%; font-size: 11px; font-style: normal; font-weight: 600;
  color: var(--muted); border: 1px solid var(--line); cursor: help; vertical-align: 1px; line-height: 1; }
.tip:hover, .tip:focus { color: var(--accent); border-color: var(--accent); outline: none; }
.tipbox { position: fixed; z-index: 400; max-width: 280px; padding: 8px 10px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); pointer-events: none; }
.stat[data-tip], .section-title[data-tip] { cursor: help; }
.more-fields { width: 100%; justify-content: center; margin: 2px 0 8px; color: var(--accent); }

/* notices */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 300; max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

/* settings */
.settings-dlg { width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 32px); border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.settings-dlg::backdrop { background: rgba(10,14,18,.5); }
.settings-dlg form { padding: 16px 18px 20px; display: grid; gap: 14px; }
.settings-dlg header { display: flex; align-items: center; }
.settings-dlg header h3 { margin: 0; flex: 1; }
.set-sec h4 { margin: 0 0 8px; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.mode-seg { margin: 0 0 6px; max-width: 360px; }
.feat-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.feat { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); cursor: pointer; font-size: 13.5px; }
.feat input { margin-top: 3px; }
.feat span { display: grid; gap: 2px; }
.feat small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.ai-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin: 6px 0; }
.ai-row input, .ai-row select, .settings-dlg .field input, .settings-dlg .field select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); min-width: 0; }
.ai-status { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); margin-bottom: 8px; }
.ai-status.ok { background: var(--accent-soft); }
@media (max-width: 600px) { .feat-list { grid-template-columns: 1fr; } }

/* feature switches */
body.off-sim #simBtn, body.off-sim .mtabs [data-m="sim"],
body.off-ideas #ideasBtn, body.off-ideas .dock-tabs [data-dtab="ideas"],
body.off-assistant #assistBtn, body.off-assistant .mtabs [data-m="assist"], body.off-assistant [data-start="assist"],
body.off-goals .tabs [data-tab="goals"], body.off-kpis .tabs [data-tab="kpi"] { display: none !important; }
body.off-sim .mtabs, body.off-assistant .mtabs { grid-template-columns: repeat(4, 1fr); }
body.off-sim.off-assistant .mtabs { grid-template-columns: repeat(3, 1fr); }

/* blank start */
.empty { max-width: 560px; width: calc(100% - 32px); }
.rename-btn { padding: 4px 9px; font-size: 15px; margin-left: -4px; }
.recent-list { display: grid; gap: 8px; margin: 10px 0 18px; text-align: left; }
.recent-card { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-soft); cursor: pointer; font-size: 12.5px; color: var(--muted); text-align: left; }
a.recent-card { text-decoration: none; border-color: #b45309; background: #fff7e0; }
.recent-card b { font-size: 14.5px; color: var(--ink); }
.recent-card:hover { filter: brightness(.97); }
.start-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 8px; text-align: left; }
.start-card { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; font-size: 13px; color: var(--muted); }
.start-card b { font-size: 14.5px; color: var(--ink); }
.start-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.empty-foot { font-size: 12.5px; }
.only-phone { display: none; }


/* detail maps */
.crumb { position: absolute; top: 10px; left: 30px; z-index: 22; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: calc(100% - 60px);
  padding: 5px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); font-size: 13px; }
.crumb[hidden] { display: none; }
.crumb button { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 2px 4px; }
.crumb button:hover { text-decoration: underline; }
.crumb span { color: var(--muted); }
.drill { cursor: pointer; }
.drill:hover rect { fill: #08503f; }


/* feature switches for the new tabs */
body.off-plan .tabs [data-tab="plan"], body.off-mix .tabs [data-tab="mix"] { display: none !important; }
.tabs button { padding: 6px 8px; }

/* implementation plan */
.plan-sum { display: grid; gap: 4px; font-size: 12.5px; }
.plan-sum .bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.plan-sum .bar i { display: block; height: 100%; background: var(--accent); }
.late { color: var(--warn); font-size: 12px; font-weight: 600; }
.loop { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 10px; background: var(--bg); }
.loop-head { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.loop-head input { flex: 1; font-weight: 700; border: 0; background: none; padding: 3px 2px; border-bottom: 1px dashed var(--line); min-width: 0; }
.loop-head span { font: 600 11px var(--mono); color: var(--muted); }
.act { border: 1px solid var(--line); border-left: 4px solid #9ca3af; border-radius: 8px; padding: 6px; margin-bottom: 6px; background: var(--surface); display: grid; gap: 4px; }
.act.st-doing { border-left-color: #d97706; } .act.st-done { border-left-color: #16a34a; opacity: .85; } .act.st-blocked, .act.is-late { border-left-color: #cf222e; }
.act { grid-template-columns: minmax(0, 1fr); }
.act-top, .act-row { display: flex; gap: 4px; min-width: 0; }
.act input, .act select { min-width: 0; width: 0; flex: 1; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-size: 12.5px; }
.act-top select { flex: 0 0 104px; } .act-top input { font-weight: 600; }
.act .btn { padding: 2px 7px; flex: none; }

/* product mix */
.mix-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.mix { margin: 0; font-size: 12px; }
table.mix td, table.mix th { padding: 3px 4px; text-align: center; }
table.mix td:first-child input { width: 92px; } table.mix input[type="number"] { width: 58px; }
table.mix input { padding: 3px 4px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); }
table.mix th.rot { height: 90px; vertical-align: bottom; } table.mix th.rot span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: 11px; }
.fam { margin: 0; padding-left: 18px; font-size: 13px; } .fam .muted { color: var(--muted); }
.mix-epei { font-size: 12px; } .mix-epei small { color: var(--muted); }

/* import, versions */
.io-dlg .mix-wrap { max-height: 220px; overflow: auto; margin-bottom: 8px; }
.versions { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.versions li { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.versions li div { flex: 1; display: grid; } .versions small { color: var(--muted); }

/* rename in place */
.inline-name { position: fixed; z-index: 60; padding: 4px 8px; border: 2px solid var(--accent); border-radius: 6px; font: 700 14px var(--sans); text-align: center; background: var(--surface); color: var(--ink); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
/* plans */
.plan-badge { padding: 4px 10px; font-size: 12.5px; border-radius: 999px; white-space: nowrap; }
.plan-badge[hidden] { display: none; }
.plan-badge.trial { background: #fff4cc; border-color: #d4a017; color: #6b4e00; }
.plan-badge.pro { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.plan-badge.low { background: var(--warn-soft, #fbe7dc); border-color: var(--warn, #b4410e); color: var(--warn, #b4410e); }
.pay-dlg form { gap: 12px; }
.pay-dlg .worth { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); line-height: 1.5; }
.pay-dlg .meters { display: flex; gap: 10px; flex-wrap: wrap; }
.pay-dlg .meters div { flex: 1; min-width: 120px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; font: 600 18px var(--mono); }
.pay-dlg .meters span { display: block; font: 400 12px var(--sans); color: var(--muted); }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-card { display: grid; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; color: var(--ink); font: inherit; }
.pay-card b { font-size: 15px; } .pay-card span { font: 700 14px var(--mono); color: var(--accent); } .pay-card small { color: var(--muted); line-height: 1.4; }
.pay-card.main { border: 2px solid var(--accent); background: var(--accent-soft); }
.pay-card:hover { border-color: var(--accent); }
.ref-box { padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; font-size: 13px; }
.ref-row { display: flex; gap: 6px; margin-top: 6px; } .ref-row input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font: 12px var(--mono); background: var(--surface); color: var(--ink); }
.pay-msg { margin: 0; font-size: 13px; color: var(--muted); min-height: 1em; }
@media (max-width: 560px) { .pay-grid { grid-template-columns: 1fr; } }
.acct-plan { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.acct-plan > div:first-child { display: grid; gap: 2px; }
.acct-plan small { color: var(--muted); }
.acct-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.plan-pill { justify-self: start; font: 700 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.plan-pill.pro { background: var(--accent); color: #fff; }
.sub-line { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
.sub-line small { color: var(--muted); }
.acct-page h4 { margin: 8px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
table.inv { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.inv th, table.inv td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.inv th { font: 600 11px var(--mono); text-transform: uppercase; color: var(--muted); }
.celebrate { width: min(460px, calc(100vw - 24px)); overflow: hidden; text-align: center; }
.celebrate .confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.celebrate .cel-body { position: relative; padding: 28px 26px 24px; display: grid; justify-items: center; gap: 8px; }
.celebrate h2 { margin: 6px 0 0; font-size: 24px; border: 0; padding: 0; }
.celebrate p { margin: 0; color: var(--muted); line-height: 1.5; }
.celebrate ul { text-align: left; margin: 6px 0 10px; padding-left: 20px; line-height: 1.7; }
.celebrate li::marker { content: '✓  '; color: var(--accent); }
.celebrate .btn { padding: 10px 26px; font-size: 15px; }
.help-flash { outline: 3px solid #f3c637 !important; outline-offset: 3px; border-radius: 8px; animation: helpFlash 1.2s ease-in-out 2; }
@keyframes helpFlash { 50% { outline-color: rgba(243,198,55,.25); } }
/* account */
.acct-btn[hidden] { display: none; }
.acct-btn.acct-on { width: 30px; height: 30px; min-width: 30px; padding: 0; border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); font: 700 13px/1 var(--sans); display: inline-grid; place-items: center; overflow: hidden; flex: none; align-self: center; }
.acct-btn.acct-on img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acct-btn.acct-err { background: var(--warn); border-color: var(--warn); }
.acct-dlg form { gap: 10px; }
.acct-dlg .dlg-head { display: flex; align-items: center; justify-content: space-between; }
.acct-dlg .dlg-head h3 { margin: 0; }
.gsi-slot { display: flex; justify-content: center; min-height: 44px; }
.captcha-slot { margin: 6px 0 0; }
.captcha-slot:empty { margin: 0; }
.google-btn[hidden] { display: none; }
.google-btn { justify-content: center; gap: 10px; padding: 9px 12px; font-weight: 600; background: var(--surface); }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.acct-msg { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); font-size: 13px; }
.acct-bad { color: var(--warn); }
/* guided mode */
.guide { grid-column: 1; grid-row: 2; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); font-size: 13.5px; }
.guide[hidden] { display: none; }
.guide header { display: flex; align-items: baseline; gap: 8px; padding: 10px 12px 4px; }
.guide header b { font-size: 16px; }
.guide .g-k { font: 600 11px var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.guide .g-head-btns { margin-left: auto; display: flex; gap: 2px; }
.guide .g-head-btns .btn { padding: 2px 8px; }
@media (min-width: 901px) { .guide .g-minbtn { display: none; } }
.guide .g-dots { display: flex; gap: 4px; padding: 4px 12px 8px; flex-wrap: wrap; }
.guide .g-dot { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); font: 600 11px var(--mono); color: var(--muted); cursor: pointer; padding: 0; }
.guide .g-dot.ok { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.guide .g-dot.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.guide .g-body { padding: 0 12px 6px; overflow: auto; }
.guide .g-why { margin: 0 0 10px; color: var(--muted); line-height: 1.5; }
.guide label { display: grid; gap: 3px; font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.guide label.g-inline { display: flex; align-items: center; gap: 8px; }
.guide input, .guide select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); font: inherit; font-weight: 400; min-width: 0; }
.guide .g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.guide .g-cards { display: grid; gap: 8px; margin-bottom: 8px; }
.guide .g-step { border: 1px solid var(--line); border-radius: 10px; padding: 7px 8px; background: var(--bg); }
.guide .g-step-top { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.guide .g-step-top input { flex: 1; font-weight: 600; }
.guide .g-step-top .btn { padding: 2px 7px; }
.guide .g-n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font: 600 11px var(--mono); flex: none; }
.guide .g-nums { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.guide .g-nums label { font-size: 10.5px; font-weight: 600; color: var(--muted); margin: 0; }
.guide .g-nums input { width: 100%; padding: 5px 6px; background: var(--surface); }
.guide .g-steps { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.guide .g-steps th { font-size: 11px; text-align: left; color: var(--muted); padding: 2px 3px; font-weight: 600; }
.guide .g-steps td { padding: 2px 3px; }
.guide .g-steps td:first-child { width: 34%; }
.guide .g-steps input { width: 100%; padding: 5px 6px; }
.guide .g-steps .btn { padding: 2px 6px; }
.guide .g-big { margin: 8px 0 4px; padding: 9px 11px; border-radius: 9px; background: var(--accent-soft); font-size: 14px; }
.guide .g-note { margin: 4px 0; color: var(--muted); line-height: 1.45; }
.guide .g-read { margin: 0 0 10px; padding-left: 18px; line-height: 1.5; }
.guide .g-read li { margin-bottom: 4px; }
.guide .g-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.guide footer { display: flex; gap: 6px; padding: 8px 12px 10px; border-top: 1px solid var(--line); }
.guide .g-fill { flex: 1; }
.start-card.start-main { grid-column: 1 / -1; border-color: var(--accent); background: var(--accent-soft); }
body.guiding #empty, body.guiding #hint { display: none !important; }
body.guide-build .tabs button:not([data-tab="data"]), body.guide-build #ideasBtn, body.guide-build #simBtn { display: none; }
@media (min-width: 901px) {
  body.guiding .app { grid-template-columns: 400px minmax(0, 1fr) 320px; }
  body.guiding .app.side-off { grid-template-columns: 400px minmax(0, 1fr) 0; }
  body.guiding .palette, body.guiding #palToggle { display: none; }
}
@media (max-width: 1400px) { .hide-md { display: none !important; } }
/* panel tabs: one-line segmented control */
.panel .tabs { display: flex; gap: 2px; padding: 3px; margin: 0 0 12px; border: 0; border-radius: 10px; background: var(--surface-2); position: sticky; top: 0; z-index: 3; }
.panel .tabs button { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 6px 4px; border: 0; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); background: transparent; transition: background .15s, color .15s; }
.panel .tabs button:hover { color: var(--ink); }
.panel .tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); border-bottom: 0; }
/* top bar: everything fits from laptop to wide screens */
.topbar { overflow: visible; }   /* visible: the Save and share, New map and Help menus drop out of it */
.topbar .brand { white-space: nowrap; flex: none; }
.topbar .tb-right { flex: none; margin-left: auto; }
#mapSelect { max-width: 280px; min-width: 120px; flex: 0 1 280px; }
.help-menu .menu-pop a { display: block; padding: 8px 12px; color: var(--ink); text-decoration: none; border-radius: 6px; font-size: 14px; }
.help-menu .menu-pop a:hover { background: var(--surface-2); }
@media (max-width: 1700px) { .topbar .saved { display: none; } }
@media (max-width: 1560px) { .topbar .brand-name { display: none; } .lbl-lg { display: none; } #mapSelect { max-width: 230px; } }
@media (max-width: 1320px) { .topbar .lbl { display: none; } .topbar .plan-badge { max-width: 150px; overflow: hidden; text-overflow: ellipsis; } }
@media (max-width: 1100px) { #mapSelect { max-width: 170px; } .topbar .plan-badge { display: none; } }
@media (max-width: 900px), (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .guide { position: fixed; left: 8px; right: 8px; bottom: 66px; z-index: 40; max-height: 58%; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.2); }
  .guide.mini .g-dots, .guide.mini .g-body, .guide.mini footer { display: none; }
  /* Phone layout: one pane at a time, switched from a bottom tab bar like a mobile app. */
  body.builder { height: 100dvh; overflow: hidden; }
  .app { height: 100dvh; display: grid; grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) 58px; grid-template-areas: "top" "main" "tabs"; }
  .app.pal-off, .app.side-off, .app.pal-off.side-off { grid-template-columns: 1fr; }
  .topbar { grid-area: top; flex-wrap: nowrap; overflow-x: auto; padding: 8px 12px; gap: 6px; scrollbar-width: none; }
  .topbar::-webkit-scrollbar { display: none; }
  .topbar select { max-width: 150px; }
  .hide-sm, .saved, #simBtn, #ideasBtn, #assistBtn, #tourBtn { display: none; }
  .palette, .stage, .panel { grid-area: main; min-height: 0; }
  .palette { display: none; border: 0; padding: 12px 16px 20px; }
  .panel { display: none; border: 0; padding: 12px 16px 24px; }
  body[data-m="pal"] .palette { display: block; }
  body[data-m="data"] .panel { display: block; }
  body[data-m="pal"] .stage, body[data-m="data"] .stage { visibility: hidden; }
  .pal-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .flow-list { grid-template-columns: 1fr 1fr; }
  .pane-toggle { display: none; }
  .mtabs { display: grid; }
  .dock, .assist { position: fixed; left: 0; right: 0; top: auto; bottom: 58px; width: auto; z-index: 80; }
  .dock { height: 52%; }
  .assist { top: 56px; }
  body:not([data-m="sim"]) .dock { display: none; }
  body:not([data-m="assist"]) .assist { display: none; }
  .stage.docked .zoom { bottom: calc(52% + 12px); }
  .only-phone { display: inline-flex; }
  .start-grid { grid-template-columns: 1fr; }
  .tour-card { left: 12px !important; right: 12px; width: auto; top: auto !important; bottom: 70px; }
}
/* phone held sideways: tabs move to a side rail so the map gets the full height */
@media (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .app { grid-template-columns: 60px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "tabs top" "tabs main"; }
  .mtabs { grid-template-columns: 1fr !important; grid-template-rows: repeat(5, 1fr); border-top: 0; border-right: 1px solid var(--line); }
  .topbar { padding: 4px 8px; }
  .dock, .assist { left: 60px; bottom: 0; }
  .dock { height: 60%; }
  .assist { top: 0; }
  .stage.docked .zoom { bottom: calc(60% + 10px); }
}
@media (min-width: 901px) and (pointer: fine), (min-width: 901px) and (min-height: 521px) { .mtabs { display: none; } }

.msg .muted { color: var(--muted); }
/* phone: keep sign-in / account reachable next to the logo (the plan shows inside the account dialog) */
@media (max-width: 900px), (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .topbar #acctBtn:not([hidden]) { position: fixed; top: 8px; right: 8px; z-index: 60; box-shadow: 0 2px 10px rgba(0,0,0,.15); background: var(--surface); }
  .topbar #acctBtn.acct-on { background: var(--accent); }
  .topbar { padding-right: 104px; }
  .topbar .plan-badge { display: none; }
}
/* phone: the top bar wraps onto two rows so every control stays reachable */
@media (max-width: 900px), (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .topbar { flex-wrap: wrap; overflow: visible; row-gap: 6px; padding-top: 6px; padding-bottom: 6px; height: auto; }
  .topbar .tb-right { margin-left: 0; }
  #mapSelect { flex: 1 1 120px; max-width: none; }
}
@media (max-width: 900px), (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .topbar { column-gap: 6px; }
  .topbar .btn, .topbar summary.btn { padding: 6px 9px; font-size: 13px; }
  .topbar .tb-group { gap: 4px; }
  .topbar .tb-right { gap: 4px; }
  #renameBtn { display: none; }
}
@media (max-width: 900px), (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .topbar { padding-right: 10px; }
  .topbar #acctBtn:not([hidden]) { position: static; box-shadow: none; }
}

/* team dialog */
.team-dlg form { max-width: 520px; }
.team-row { display: flex; gap: 8px; align-items: center; }
.team-row input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.team-row input[type=number] { flex: 0 0 90px; }
.team-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 9px; }
.team-list li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-top: 1px solid var(--line); font-size: 13.5px; }
.team-list li:first-child { border-top: 0; }
.team-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.team-list li em { font-style: normal; font-size: 12px; color: var(--muted); }
.team-list li.pending span { color: var(--muted); }
.team-list .btn { padding: 3px 8px; font-size: 12px; }
.team-plan { border: 1px dashed var(--line); border-radius: 9px; padding: 10px 12px; }
.team-plan p { margin: 0 0 8px; font-size: 13px; }
.btn.danger { color: #b3261e; }
.unlock-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; }

/* 👍/👎 feedback */
.fb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.fb-btn { border: 1px solid transparent; background: none; border-radius: 6px; padding: 1px 5px; font-size: 14px; line-height: 1.4; cursor: pointer; filter: grayscale(1); opacity: .65; }
.fb-btn:hover { opacity: 1; filter: none; border-color: var(--line); }
.fb-btn.on { opacity: 1; filter: none; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.fb-more { display: flex; gap: 6px; width: 100%; margin-top: 4px; }
.fb-more textarea { flex: 1; min-width: 0; font: inherit; font-size: 12.5px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); resize: vertical; }
.fb-more .btn { padding: 3px 10px; font-size: 12px; align-self: flex-start; }

/* report a problem */
.report-dlg form { max-width: 520px; }
.report-dlg .rep-ctx { white-space: pre-wrap; font: 11.5px/1.45 'IBM Plex Mono', monospace; background: var(--surface-2); border-radius: 7px; padding: 8px 10px; max-height: 160px; overflow: auto; margin: 6px 0 0; }
