/* FloatChart — visual planning canvas. Sibling of SuperJira (same token family). */

:root {
  /* section headings (BOARDS, LABELS, SHAPES, STATUS FILTER…) — a step darker than
     the muted --ink-3 so they read as structure, not as placeholder text */
  --ink-head: color-mix(in srgb, var(--ink-3) 42%, var(--ink-2));
  --bg: #FBFBFA; --panel: #FFFFFF; --canvas: #F4F5F3; --band: #EDEFEC;
  --line: #E3E5E1; --line-2: #CDD1CC;
  --ink: #20262B; --ink-2: #5C6670; --ink-3: #8A939C;
  --accent: #0F6E6B; --accent-soft: #E0EEED;
  /* brand wordmark ink — the navy from the logo, not the UI ink */
  --brand-ink: #1E2D4E; --brand-ink-2: #566A8C;
  --ok: #3E7D4E; --warn: #B07C1F; --bad: #B3455A;
  --h-blue: #2F6FB3; --h-teal: #0F6E6B; --h-green: #3E7D4E; --h-amber: #B07C1F;
  --h-orange: #C05621; --h-rose: #B3455A; --h-violet: #7B61C4; --h-indigo: #4C5FD5; --h-slate: #5C6670;
  --shadow: 0 1px 2px rgba(24, 30, 34, .06), 0 4px 14px rgba(24, 30, 34, .07);
  --shadow-lg: 0 4px 10px rgba(24, 30, 34, .10), 0 14px 40px rgba(24, 30, 34, .16);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #14181B; --panel: #1B2125; --canvas: #101417; --band: #171C20;
  --line: #2A3238; --line-2: #39434A;
  --ink: #E6EAED; --ink-2: #9AA6AE; --ink-3: #6C7880;
  --accent: #3FBDB7; --accent-soft: #16302F;
  --brand-ink: #E6EAED; --brand-ink-2: #8B97A3;
  --ok: #6FBF7F; --warn: #D9A648; --bad: #E08296;
  --h-blue: #6FA8DC; --h-teal: #3FBDB7; --h-green: #6FBF7F; --h-amber: #D9A648;
  --h-orange: #E08A5A; --h-rose: #E08296; --h-violet: #A48FE3; --h-indigo: #8B9AE8; --h-slate: #9AA6AE;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-lg: 0 4px 10px rgba(0, 0, 0, .45), 0 18px 48px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* Dark theme lightens the accent/ok/bad hues, so white text on them drops to ~2:1.
   Everything that paints text on a filled accent surface flips to dark ink instead. */
:root[data-theme="dark"] .btn.primary,
:root[data-theme="dark"] .seg button.on,
:root[data-theme="dark"] .chips button.on,
:root[data-theme="dark"] .toast { color: #10171A; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); }
body {
  font: 13.5px/1.45 -apple-system, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  display: flex; flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::placeholder { color: var(--ink-3); }

/* ============ top app bar ============ */
.appbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--bg);
  flex: 0 0 auto; z-index: 40;
}
.logo { display: flex; align-items: center; gap: 7px; }
.logo svg { display: block; }
/* the wordmark carries a weight contrast rather than a colour one: "float" solid,
   "chart" light. Brand navy in light mode; in dark it takes the page ink, because
   navy on a near-black appbar reads as a smudge. */
.logo .wm { font-weight: 700; font-size: 16px; letter-spacing: -.015em; color: var(--brand-ink); }
.logo .wm i { font-style: normal; font-weight: 400; color: var(--brand-ink-2); }

.boardsw {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px;
  font-weight: 600; max-width: 340px; position: relative;
}
.boardsw:hover { background: var(--canvas); }
.boardsw .bname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boardsw .chev { color: var(--ink-3); flex: 0 0 auto; }
.bname-edit {
  font-weight: 600; font-size: 13.5px; border: 1px solid var(--accent); border-radius: 8px;
  padding: 4px 9px; background: var(--panel); min-width: 180px;
}
/* autosave is silent by design; this is the only signal that it happened */
.savestat {
  font-size: 11.5px; color: var(--ink-3); white-space: nowrap;
  margin-left: 2px; min-width: 96px;
}
.menu .mhead {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); padding: 7px 12px 3px;
}
.tplchip {
  font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border-radius: 5px; padding: 2px 7px;
}

.abspace { flex: 1; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px; color: var(--ink-2); flex: 0 0 auto;
}
.iconbtn:hover { background: var(--canvas); color: var(--ink); }
.iconbtn:disabled { opacity: .38; cursor: default; }
.iconbtn:disabled:hover { background: none; color: var(--ink-2); }
.iconbtn.on { background: var(--accent-soft); color: var(--accent); }
.zoomlbl {
  font-size: 11.5px; color: var(--ink-3); width: 48px; text-align: center;
  font-variant-numeric: tabular-nums; background: none; border: 1px solid transparent;
  border-radius: 6px; padding: 3px 2px; cursor: text; flex: 0 0 auto;
}
.zoomlbl:hover { border-color: var(--line-2); color: var(--ink-2); }
.zoomlbl:focus { border-color: var(--accent); color: var(--ink); outline: none; background: var(--panel); }
.vsep { width: 1px; height: 20px; background: var(--line-2); margin: 0 3px; flex: 0 0 auto; }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; flex: 0 0 auto; }
.seg button { padding: 4px 10px; color: var(--ink-2); font-weight: 550; font-size: 11.5px; white-space: nowrap; }
.seg button:hover { background: var(--canvas); color: var(--ink); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }
/* status-filter group: icon toggles */
.seg.filterseg button { padding: 4px 8px; display: flex; align-items: center; color: var(--ink-3); }
.seg.filterseg button:hover { color: var(--ink); }
.seg.filterseg button.on { background: var(--accent-soft); color: var(--accent); }
.seg.filterseg svg { display: block; }
/* small caps labels in front of a control group */
.ctl-label {
  font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-head);
  font-weight: 700; flex: 0 0 auto; cursor: help; white-space: nowrap;
}
.ctl-label:hover { color: var(--ink-2); }
@media (max-width: 1320px) { .ctl-label { display: none; } }

/* ============ shape palette ============ */
.palette {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-bottom: 1px solid var(--line); background: var(--bg);
  flex: 0 0 auto; z-index: 35; overflow-x: auto;
}
.pal-label {
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-head); font-weight: 600; flex: 0 0 auto; margin-right: 2px;
}
.chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 8px; border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--sh) 42%, var(--line-2));
  background: color-mix(in srgb, var(--sh) 11%, var(--panel));
  color: var(--ink); font-weight: 550; font-size: 12.5px;
  cursor: grab; user-select: none; flex: 0 0 auto;
  transition: border-color .12s ease, box-shadow .12s ease, color .12s ease;
  touch-action: none;
}
.chip:hover { border-color: var(--sh); box-shadow: var(--shadow); }
.chip.armed { color: var(--ink); border-color: var(--sh); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sh) 30%, transparent); }
.chip svg { display: block; }
/* per-board shape recolor swatch on each chip */
.chip .chip-color {
  width: 13px; height: 13px; padding: 0; border: none; border-radius: 50%;
  appearance: none; -webkit-appearance: none; background: none; cursor: pointer;
  opacity: .5; margin-left: 3px; flex: 0 0 auto; transition: opacity .12s ease;
}
.chip:hover .chip-color { opacity: 1; }
.chip .chip-color::-webkit-color-swatch-wrapper { padding: 0; }
.chip .chip-color::-webkit-color-swatch { border: 1.5px solid color-mix(in srgb, var(--sh) 60%, var(--line-2)); border-radius: 50%; }
.pal-hint { font-size: 11.5px; color: var(--ink-3); margin-left: auto; flex: 0 0 auto; padding-left: 10px; }

/* ============ main split ============ */
.main { flex: 1; display: flex; min-height: 0; position: relative; }

/* left drawer */
.drawer {
  width: 232px; flex: 0 0 auto; background: var(--bg);
  display: flex; flex-direction: column; min-height: 0; z-index: 30;
  transition: width .18s ease; overflow: hidden;
}
.drawer.closed { width: 0; }
.drawer-inner { width: 232px; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dr-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 6px; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-head); font-weight: 600;
}
.dr-h button { color: var(--accent); font-size: 16px; line-height: 1; width: 20px; height: 20px; border-radius: 5px; }
.dr-h button:hover { background: var(--accent-soft); }
.dr-boards { overflow-y: auto; padding: 0 8px 8px; }
.dr-b {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; border-radius: 8px; text-align: left; color: var(--ink-2);
}
.dr-b:hover { background: var(--canvas); color: var(--ink); }
.dr-b.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.dr-b .n { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-b .t { font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); flex: 0 0 auto; }
.dr-b .x { color: var(--ink-3); width: 18px; height: 18px; border-radius: 4px; display: none; align-items: center; justify-content: center; flex: 0 0 auto; }
.dr-b:hover .x { display: inline-flex; }
.dr-b .x:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.lg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin-bottom: 4px; }
.lg-row { display: flex; align-items: center; gap: 9px; padding: 5px 6px; color: var(--ink-2); font-size: 12px; }
.lg-row svg { flex: 0 0 auto; }
.lg-row .hint { color: var(--ink-3); font-size: 11px; }
/* full-height rail on the panel's edge — collapses it, and is the only sliver left
   when collapsed (never overlaps the panel's content) */
.drawer-rail {
  flex: 0 0 auto; width: 14px; z-index: 31;
  background: var(--bg); border-right: 1px solid var(--line);
  color: var(--ink-3); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .12s ease, color .12s ease;
}
.drawer-rail:hover { background: var(--canvas); color: var(--accent); }
.drawer-rail svg { display: block; }
.drawer-rail .ch-r { display: none; }
.drawer.closed + .drawer-rail .ch-l { display: none; }
.drawer.closed + .drawer-rail .ch-r { display: block; }

/* ============ account ============ */
.acctbtn {
  display: flex; align-items: center; gap: 7px; padding: 4px 9px 4px 4px;
  border-radius: 20px; border: 1px solid var(--line); background: var(--panel);
  max-width: 168px; flex: 0 0 auto;
}
.acctbtn[hidden] { display: none !important; }
.acctbtn:hover { border-color: var(--line-2); background: var(--canvas); }
.acctbtn .an { font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; background: var(--accent);
}
/* the avatar carries the plan, so the badge is never a separate thing to look for */
.av.plan-pro { background: var(--h-indigo); }
.av.plan-business { background: var(--h-violet); }
.av.out { background: var(--line-2); }
:root[data-theme="dark"] .av { color: #10171A; }

.planrow { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.planbadge {
  font: 700 10.5px/1 var(--mono, ui-monospace), monospace; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 6px; color: #fff; background: var(--accent);
}
.planbadge.plan-pro { background: var(--h-indigo); }
.planbadge.plan-business { background: var(--h-violet); }
.planwhat { font-size: 12.5px; color: var(--ink-3); }

.btn.oauth {
  width: 100%; justify-content: center; gap: 9px; padding: 11px;
  border: 1px solid var(--line-2); font-weight: 620; margin-top: 4px;
}
.btn.oauth:hover { background: var(--canvas); }
.or { display: flex; align-items: center; gap: 12px; margin: 16px 0 4px; color: var(--ink-3); font-size: 11.5px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.modal.plans { max-width: 660px; }
.plangrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 12px; }
@media (max-width: 560px) { .plangrid { grid-template-columns: 1fr; } }
.plancard { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--panel); }
.plancard h3 { margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.plancard .price { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.plancard .price b { font-size: 26px; color: var(--ink); font-weight: 720; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plancard .price span { font-size: 11.5px; color: var(--ink-3); }
.plancard .pb { margin: 0 0 10px; font-size: 12.5px; color: var(--ink-3); }
.plancard ul { margin: 0 0 14px; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); }
.plancard li { margin-bottom: 4px; }
.plancard .buy { width: 100%; justify-content: center; }

/* ============ assistant panel ============ */
.pshell-grow { flex: 1 1 auto; min-height: 160px; }
.ai-body { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 0 8px 8px; gap: 8px; }
.ai-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.ai-empty { color: var(--ink-3); font-size: 12px; line-height: 1.55; padding: 4px 4px 0; }
.ai-empty p { margin: 0 0 8px; }
.ai-eg { color: var(--ink-2); font-style: italic; }
.ai-note { border-top: 1px solid var(--line); padding-top: 8px; font-size: 11px; }
.ai-msg { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; line-height: 1.5; }
.ai-msg.user .ai-txt {
  align-self: flex-end; background: var(--accent-soft); color: var(--accent);
  border-radius: 10px 10px 3px 10px; padding: 7px 10px; max-width: 92%;
}
.ai-msg.user { align-items: flex-end; }
.ai-who { font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.ai-msg.bot .ai-txt {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px 10px 10px 3px;
  padding: 7px 10px; color: var(--ink-2);
}
.ai-think { color: var(--ink-3); font-style: italic; }
.ai-compose { display: flex; flex-direction: column; gap: 6px; }
.ai-compose textarea {
  width: 100%; resize: vertical; min-height: 46px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); font-size: 12.5px; line-height: 1.45; outline: none;
}
.ai-compose textarea:focus { border-color: var(--accent); }
.ai-send { width: 100%; justify-content: center; }
.modal.aisetup { max-width: 520px; }
.ai-lbl { display: block; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-head); font-weight: 700; margin: 10px 0 5px; }
.ai-key {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--canvas); font: 12.5px ui-monospace, SFMono-Regular, Consolas, monospace; outline: none;
}
.ai-key:focus { border-color: var(--accent); }
.ai-keyhint { margin: 6px 0 0; font-size: 11.5px; color: var(--ink-3); }
.ai-privacy {
  margin: 14px 0 4px; padding: 11px 13px; border-radius: 10px;
  background: var(--canvas); border: 1px solid var(--line);
  font-size: 12px; line-height: 1.55; color: var(--ink-2);
}
.ai-privacy b { display: block; color: var(--ink); margin-bottom: 5px; font-size: 12.5px; }
.ai-privacy ul { margin: 0; padding-left: 17px; }
.ai-privacy li { margin-bottom: 4px; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); margin-right: auto; }

/* ============ import / AI prompt ============ */
.warnlist {
  margin: 0 0 4px; padding: 10px 12px 10px 26px; max-height: 240px; overflow-y: auto;
  background: var(--canvas); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink-2); font-size: 12.5px; line-height: 1.6;
}
.warnlist li { margin: 0 0 2px; }
.modal.aiprompt { max-width: 680px; }
.promptseg { margin: 2px 0 10px; flex-wrap: wrap; }
.promptbox {
  width: 100%; height: 300px; resize: vertical;
  padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--canvas); color: var(--ink-2);
  font: 11.5px/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre; overflow: auto;
}
.promptbox:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ============ dockable panels ============
   Panels move by re-parenting, so their own styling must not assume a side. The right
   dock mirrors the left; both hide entirely when nothing is docked in them. */
.drawer[hidden], .dockR[hidden] { display: none !important; }
.dockR {
  width: 232px; flex: 0 0 auto; background: var(--bg); z-index: 30;
  display: flex; flex-direction: column; min-height: 0;
  border-left: 1px solid var(--line); overflow: hidden;
}
.dock-inner { width: 232px; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.pshell { display: flex; flex-direction: column; min-height: 0; }
.pshell[hidden] { display: none !important; }
.pshell + .pshell { padding-top: 10px; }
/* the grip is the panel's own title — dragging the label it already has beats adding
   a separate handle nobody would find */
.pgrip { cursor: grab; border-radius: 5px; padding: 1px 4px; margin-left: -4px; }
.pgrip:hover { background: var(--canvas); color: var(--accent); }
body.docking, body.docking .pgrip { cursor: grabbing; }
.dockghost {
  padding: 6px 12px; border-radius: 8px; background: var(--panel);
  border: 1px solid var(--accent); color: var(--accent);
  font-size: 12px; font-weight: 650; box-shadow: var(--shadow);
}
.dropzone {
  position: fixed; z-index: 60; pointer-events: none;
  border: 2px dashed var(--line-2); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--canvas) 70%, transparent);
  transition: background .1s ease, border-color .1s ease;
}
.dropzone span {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 650;
}
/* the zone a panel already occupies is shown as an outline only — it sits directly
   over that panel's own content, and a filled scrim with a caption collides with it */
.dropzone.here { border-style: solid; background: none; opacity: .45; }
.dropzone.here span { display: none; }
.dropzone.hot {
  border-color: var(--accent); border-style: solid;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.dropzone.hot span { color: var(--accent); }

/* ============ board tabs ============
   The tab strip and the drawer's board list are two renderings of one list, in file
   order. Order is user-controlled (drag to reorder), so neither may sort by `updated`
   or a deliberate arrangement would rearrange itself after every edit. */
.tabstrip {
  flex: 0 0 auto; display: flex; align-items: stretch; gap: 4px;
  height: 34px; padding: 0 8px;
  background: var(--bg); border-top: 1px solid var(--line); z-index: 32;
}
/* the display:flex above outranks the UA [hidden] rule */
.tabstrip[hidden] { display: none !important; }
.tabgrip {
  flex: 0 0 auto; display: flex; align-items: center; padding: 0 4px; margin: 6px 0 6px -2px;
  color: var(--ink-3);
}
.tabgrip:hover { color: var(--accent); background: var(--canvas); }
.tabs { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 7px; flex: 0 0 auto;
  max-width: 190px; padding: 0 11px;
  border-top: 2px solid transparent;
  color: var(--ink-2); white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.tab:hover { background: var(--canvas); color: var(--ink); }
.tab.on { background: var(--canvas); color: var(--accent); font-weight: 620; border-top-color: var(--accent); }
.tab .tn { overflow: hidden; text-overflow: ellipsis; }
.tab svg { flex: 0 0 auto; }
.tab.dragging { opacity: .3; }
/* insertion marker — drawn on the tab the drop would land before, or the trailing
   edge of the last tab when the drop lands at the end */
.tab.dropL { box-shadow: inset 2px 0 0 var(--accent); }
.tabs.dropEnd .tab:last-child { box-shadow: inset -2px 0 0 var(--accent); }
.tabadd {
  flex: 0 0 auto; width: 26px; margin: 5px 0; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 16px; line-height: 1;
}
.tabadd:hover { background: var(--canvas); color: var(--accent); }
.tab-edit {
  flex: 0 0 auto; align-self: center; width: 150px;
  padding: 3px 7px; border: 1px solid var(--accent); border-radius: 6px;
  background: var(--panel); font-size: 12.5px; outline: none;
}

/* ============ canvas viewport ============ */
.viewport {
  flex: 1; position: relative; overflow: hidden; background: var(--canvas);
  background-image: radial-gradient(color-mix(in srgb, var(--line-2) 55%, transparent) 1px, transparent 1px);
  background-size: 12px 12px;
  cursor: default; min-width: 0;
  touch-action: none;
}
.viewport.panning { cursor: grabbing; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

/* lanes — each carries its own hue via --lc so bands read at a glance */
.lane {
  position: absolute; left: 0; border-radius: 12px;
  /* opaque: mixing into --panel keeps the light tint but hides the canvas dots */
  background: color-mix(in srgb, var(--lc, var(--accent)) 7%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--lc, var(--line)) 32%, var(--line));
  border-left: 4px solid color-mix(in srgb, var(--lc, var(--line-2)) 62%, var(--line-2));
}
.lane-gut {
  position: absolute; left: 0; top: 0; bottom: 0; width: 42px;
  background: color-mix(in srgb, var(--lc, var(--panel)) 13%, var(--panel));
  border-right: 1px solid color-mix(in srgb, var(--lc, var(--line)) 30%, var(--line));
  border-radius: 8px 0 0 8px;
  display: flex; align-items: center; justify-content: center;
}
.lane-name {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: color-mix(in srgb, var(--lc, var(--ink-2)) 72%, var(--ink)); white-space: nowrap;
  max-height: calc(100% - 40px);
  overflow: hidden; text-overflow: ellipsis; cursor: text; padding: 4px 0;
}
.lane-name:hover { color: var(--accent); }
/* lane color picker — small swatch at the bottom of the gutter */
.lane-color {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  width: 17px; height: 17px; padding: 0; border: none; border-radius: 50%;
  background: none; appearance: none; -webkit-appearance: none; cursor: pointer;
  opacity: .55; transition: opacity .12s ease, box-shadow .12s ease;
}
.lane:hover .lane-color { opacity: 1; }
.lane-color::-webkit-color-swatch-wrapper { padding: 0; }
.lane-color::-webkit-color-swatch { border: 2px solid var(--panel); border-radius: 50%; }
.lane-color:hover { box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--lc, var(--accent)) 45%, transparent); border-radius: 50%; }
.lane-name-edit {
  position: absolute; z-index: 5; font-size: 11.5px; font-weight: 650;
  border: 1px solid var(--accent); border-radius: 6px; padding: 3px 7px; background: var(--panel);
  width: 130px;
}
.lane-x {
  position: absolute; left: 11px; top: 6px; width: 20px; height: 20px; border-radius: 5px;
  color: var(--ink-3); display: none; align-items: center; justify-content: center; font-size: 13px;
}
.lane:hover .lane-x { display: flex; }
.lane-x:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.lane-add {
  position: absolute; height: 30px; padding: 0 13px 0 10px; border-radius: 9px;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, var(--line-2));
  color: var(--accent); font-size: 11.5px; font-weight: 650;
  background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}
.lane-add .plus { font-size: 15px; line-height: 1; }
.lane-add:hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow); }
.lane.dropglow { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* edges svg */
#edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
#edges .e { fill: none; stroke: color-mix(in srgb, var(--ink-2) 72%, var(--line-2)); stroke-width: 1.75; }
#edges .e.sel { stroke: var(--accent); stroke-width: 2.5; }
#edges .e.adj { stroke: color-mix(in srgb, var(--ink) 55%, var(--line-2)); stroke-width: 2.5; }
#edges .e.ehover { stroke: var(--accent); stroke-width: 2.7; } /* hover-trace a connector */
#edges .ehit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
#edges .e.ph-line {
  stroke: var(--line-2); stroke-dasharray: 4 5; stroke-width: 1.6;
  opacity: 0; transition: opacity .15s ease; /* hidden with its slot */
}
#edges .e.ph-line.reveal,
body.dragging-shape #edges .e.ph-line,
body.armed #edges .e.ph-line { opacity: 1; }
body.dragging-shape #edges .e.ph-line,
body.armed #edges .e.ph-line { stroke: color-mix(in srgb, var(--accent) 60%, var(--line-2)); }
/* guide lines to undropable slots vanish with them — no arrows to nowhere */
body.dragging-shape #edges .e.ph-line.invalid { opacity: 0; }
#edges .e.ph-line.hot { stroke: var(--accent); opacity: 1; }
#edges .elbl { font-size: 11px; font-weight: 600; fill: var(--ink-2); }
#edges .elbl-bg { fill: var(--canvas); stroke: var(--line-2); stroke-width: 1; rx: 6; }
#edges .linkline { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; fill: none; }

/* ============ tiles ============ */
.tile {
  position: absolute; user-select: none; cursor: pointer;
  transition: filter .12s ease;
  touch-action: none;
}
.tile .chrome { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.tile .chrome .geo {
  fill: color-mix(in srgb, var(--sh) 22%, var(--panel));
  stroke: color-mix(in srgb, var(--sh) 85%, var(--line-2));
  stroke-width: 1.75;
}
.tile:hover .chrome .geo { stroke: var(--sh); filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--sh) 30%, transparent)); }
.tile.sel .chrome .geo { stroke: var(--sh); stroke-width: 2.5; filter: drop-shadow(0 0 0.5px var(--sh)) drop-shadow(0 3px 10px color-mix(in srgb, var(--sh) 35%, transparent)); }
.tile .tlabel {
  position: absolute; display: flex; align-items: center; justify-content: center; text-align: center;
  font-weight: 600; font-size: 12.5px; line-height: 1.28; color: var(--ink);
  overflow: hidden; pointer-events: none; padding: 2px;
  overflow-wrap: anywhere;
}
.tile .tlabel .clamp {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.tile .tlabel .unnamed { color: var(--ink-3); font-weight: 500; font-style: italic; }
.tile .tmeta {
  /* sits clear of the shape-switch button that straddles the bottom edge */
  position: absolute; left: 8px; right: 8px; bottom: -31px; height: 18px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 10px; color: var(--ink-3); cursor: pointer;
}
.tile .tmeta:hover .mchip { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tile .tmeta:empty { pointer-events: none; } /* an empty strip must not swallow clicks */
.tile .tmeta .mchip.lchip {
  color: color-mix(in srgb, var(--lc, var(--accent)) 75%, var(--ink));
  border-color: color-mix(in srgb, var(--lc, var(--line)) 50%, var(--line));
  background: color-mix(in srgb, var(--lc, var(--panel)) 14%, var(--panel));
}
.tile .tmeta .mchip.lchip:hover { text-decoration: line-through; }
.tile .tmeta .mchip {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 0 6px; line-height: 15px; white-space: nowrap; font-weight: 600;
}
.tile .tmeta .mchip.who {
  color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  max-width: 96px; overflow: hidden;
}
/* in-shape data type chip (shapes that declare dtypes) */
.tile .dtchip {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  max-width: 72%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 9.5px; font-weight: 650; line-height: 1; padding: 3px 9px;
  border-radius: 8px; border: 1px solid color-mix(in srgb, var(--sh) 45%, var(--line-2));
  background: color-mix(in srgb, var(--sh) 12%, var(--panel));
  color: color-mix(in srgb, var(--sh) 70%, var(--ink)); cursor: pointer; z-index: 2;
  transition: opacity .12s ease, border-color .12s ease;
}
.tile .dtchip:hover { border-color: var(--sh); background: color-mix(in srgb, var(--sh) 22%, var(--panel)); }
.tile .dtchip.empty { opacity: 0; border-style: dashed; color: var(--ink-3); font-style: italic; font-weight: 550; }
.tile:hover .dtchip.empty { opacity: 1; }
/* long names fade out instead of hard-clipping (.of set when the text overflows) */
.tile .tmeta .mchip.who.of {
  -webkit-mask-image: linear-gradient(90deg, #000 70%, transparent 97%);
  mask-image: linear-gradient(90deg, #000 70%, transparent 97%);
}
/* status badge (top-right): clock=planned, hammer=doing, check=done, exclamation=blocked */
.tile .sbadge {
  position: absolute; top: -9px; right: -8px; width: 20px; height: 20px;
  z-index: 2; pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(16, 22, 26, .22));
}
.tile .sbadge svg { display: block; }
/* review flag (top-left): gray ? on hover, sticks bright amber once set */
.tile .rvbtn {
  --rv-hot: color-mix(in srgb, var(--h-amber) 55%, #FFC400);
  position: absolute; top: -12px; left: -10px; width: 25px; height: 25px;
  z-index: 2; padding: 0; cursor: pointer; color: var(--ink-3);
  opacity: 0; transition: opacity .12s ease, color .12s ease, transform .1s ease;
  filter: drop-shadow(0 1px 2px rgba(16, 22, 26, .2));
}
.tile .rvbtn { pointer-events: none; } /* hidden = untouchable (no click theft between stacked tiles) */
.tile:hover .rvbtn, .tile.review .rvbtn, .tile.rvdone .rvbtn { pointer-events: auto; }
.tile:hover .rvbtn { opacity: 1; }
.tile .rvbtn:hover { color: var(--rv-hot); transform: scale(1.12); }
.tile.review .rvbtn { opacity: 1; color: var(--rv-hot); }
.tile.rvdone .rvbtn { opacity: 1; color: var(--h-blue); } /* resolved: blue chat bubble — go read the discussion */
.tile .rvbtn svg { display: block; }
/* per-tile delete: red trash, bottom-left on hover */
.tile .delbtn {
  position: absolute; bottom: -11px; left: -10px; width: 23px; height: 23px;
  padding: 0; z-index: 2; cursor: pointer; color: var(--bad);
  opacity: 0; transition: opacity .12s ease, transform .1s ease;
  filter: drop-shadow(0 1px 2px rgba(16, 22, 26, .2));
}
.tile .delbtn { pointer-events: none; } /* hidden = untouchable */
.tile:hover .delbtn { opacity: 1; pointer-events: auto; }
.tile .delbtn:hover { transform: scale(1.15); }
.tile .delbtn svg { display: block; }
/* quick-edit pencil, bottom-right on hover (mirrors the trash) */
.tile .editbtn {
  position: absolute; bottom: -11px; right: -10px; width: 23px; height: 23px;
  padding: 0; z-index: 2; cursor: pointer; color: var(--accent);
  opacity: 0; pointer-events: none;
  transition: opacity .12s ease, transform .1s ease;
  filter: drop-shadow(0 1px 2px rgba(16, 22, 26, .2));
}
.tile:hover .editbtn { opacity: 1; pointer-events: auto; }
.tile .editbtn:hover { transform: scale(1.15); }
.tile .editbtn svg { display: block; }
/* change-shape, straddling the bottom edge dead centre */
.tile .shapebtn {
  position: absolute; bottom: -10px; left: 50%; margin-left: -10px; width: 20px; height: 20px;
  padding: 0; z-index: 2; cursor: pointer; color: var(--ink-2);
  opacity: 0; pointer-events: none;
  transition: opacity .12s ease, transform .1s ease, color .12s ease;
  filter: drop-shadow(0 1px 2px rgba(16, 22, 26, .2));
}
.tile:hover .shapebtn { opacity: 1; pointer-events: auto; }
.tile .shapebtn:hover { color: var(--sh); transform: scale(1.15); }
.tile .shapebtn svg { display: block; }
/* ctrl+click multi-selection */
.tile.msel .chrome .geo { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 7 4; }
.tile.msel { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 38%, transparent)); }
/* connector endpoint handles (visible when a line is selected) */
.ehandle {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2.5px solid var(--panel);
  box-shadow: 0 0 0 1.5px var(--accent); cursor: grab; z-index: 4;
  transition: transform .1s ease;
}
.ehandle:hover { transform: scale(1.25); }
/* while an edge's handles are showing, its source tile's out-port yields the spot */
.tile.portoff .port { opacity: 0 !important; pointer-events: none !important; }
/* review spotlight: everything unflagged steps back */
/* status filter: everything outside the selected states steps back */
body.filtering .tile.fdim { opacity: .2; }
body.filtering .tile.fdim:hover { opacity: .65; }
body.filtering #edges .e:not(.ph-line) { opacity: .3; }
body.filtering .tile:not(.fdim) .chrome .geo { stroke-width: 2.5; }
.tile.dragging { opacity: .45; }

/* link port — invisible controls are NOT hit-testable (they'd steal neighbors' clicks) */
.tile .port {
  position: absolute; right: -8px; top: 50%; margin-top: -8px; width: 17px; height: 17px;
  border-radius: 50%; background: var(--panel); border: 2.5px solid var(--accent);
  opacity: 0; transform: scale(.7); transition: opacity .12s ease, transform .12s ease;
  cursor: crosshair; z-index: 3; pointer-events: none;
}
.tile:hover .port, .tile .port.hot { opacity: 1; transform: scale(1); pointer-events: auto; }
.tile.linktarget .chrome .geo { stroke: var(--accent); stroke-width: 2.5; }
.tile.linkbad .chrome .geo { stroke: var(--bad); stroke-dasharray: 4 3; }

/* placeholders */
.ph {
  position: absolute; border: 1.6px dashed var(--line-2); border-radius: 11px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--ink-3); font-size: 11.5px; font-weight: 550;
  cursor: pointer; transition: opacity .12s ease, border-color .12s ease, color .12s ease, background .12s ease;
  background: color-mix(in srgb, var(--panel) 35%, transparent);
}
.ph .plus { font-size: 15px; line-height: 1; }
.ph[hidden] { display: none !important; } /* author display:flex above would beat the UA [hidden] rule */
/* Slots are INVISIBLE by default (clean canvas). They appear when:
   - .always  — an empty lane's "Start here"
   - .reveal  — hovering a tile reveals that tile's own slots
   - body.dragging-shape / body.armed — ALL slots show while placing */
.ph { --pho: .9; opacity: 0; pointer-events: none; }
.ph.k-branch, .ph.k-root { --pho: .6; }
.ph.always, .ph.reveal {
  opacity: var(--pho); pointer-events: auto;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2));
  color: var(--ink-2);
}
.ph:hover, .ph.hot { opacity: 1; border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
body.dragging-shape .ph, body.armed .ph {
  opacity: 1; pointer-events: auto;
  border: 2px dashed color-mix(in srgb, var(--accent) 72%, var(--line-2));
  background: color-mix(in srgb, var(--accent-soft) 72%, transparent);
  color: color-mix(in srgb, var(--accent) 75%, var(--ink-2));
  font-weight: 600;
}
body.dragging-shape .ph.hot, body.armed .ph.hot { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
/* slots the dragged tile cannot legally drop on are hidden entirely —
   during a drag, everything visible IS a valid drop target */
body.dragging-shape .ph.invalid, body.dragging-shape .ph.invalid:hover {
  opacity: 0; pointer-events: none; box-shadow: none;
}
body.dragging-shape .tile .port { opacity: 0 !important; }
/* while creating a dependency, other tiles' ports are NOT anchors — never show them */
body.linking .tile .port:not(.hot) { opacity: 0 !important; transform: scale(.7); }

/* inline label editor — bare text on an underline, right inside the shape */
.tedit {
  position: absolute; z-index: 20; resize: none; text-align: center;
  font-weight: 600; font-size: 12.5px; line-height: 1.3; color: var(--ink);
  background: transparent; border: none; border-radius: 0;
  border-bottom: 1.5px solid var(--accent);
  padding: 2px 2px 3px; overflow: hidden; box-shadow: none;
  caret-color: var(--accent);
}
.tedit:focus { outline: none; }
.tedit::placeholder { color: var(--ink-3); font-weight: 500; font-style: italic; }
.tile.editing .tlabel { visibility: hidden; } /* the editor replaces the label while typing */
.enode.editing .ename { visibility: hidden; }

/* drag ghost */
.ghost {
  position: fixed; z-index: 100; pointer-events: none;
  display: flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 9px; background: var(--panel);
  border: 1.5px solid var(--sh, var(--accent)); box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: 12.5px; color: var(--ink);
  transform: translate(-50%, -120%);
}

/* edge floating toolbar */
.edgechip {
  position: absolute; z-index: 22; display: flex; align-items: center; gap: 4px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 9px;
  box-shadow: var(--shadow-lg); padding: 4px;
  transform: translate(-50%, -50%);
}
.edgechip input {
  width: 92px; border: none; background: var(--canvas); border-radius: 6px;
  padding: 4px 8px; font-size: 12px; font-weight: 600;
}
.edgechip button { width: 24px; height: 24px; border-radius: 6px; color: var(--ink-3); display: flex; align-items: center; justify-content: center; }
.edgechip button:hover { color: var(--ink); background: var(--canvas); }
.edgechip button.ec-del:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }

/* shape picker popover */
.shapepick {
  position: absolute; z-index: 24; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 11px; box-shadow: var(--shadow-lg); padding: 5px; display: grid; gap: 2px;
  min-width: 168px;
}
.shapepick button {
  display: flex; align-items: center; gap: 9px; padding: 6px 9px; border-radius: 8px;
  color: var(--ink-2); font-weight: 550; font-size: 12.5px; text-align: left;
}
.shapepick button:hover { background: var(--canvas); color: var(--ink); }

/* ============ right detail panel ============ */
.panel {
  width: 0; flex: 0 0 auto; border-left: 1px solid var(--line); background: var(--bg);
  overflow: hidden; transition: width .18s ease; z-index: 30; display: flex;
}
.panel.open { width: 324px; }
.panel-inner { width: 324px; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.pn-h { display: flex; align-items: flex-start; gap: 9px; padding: 14px 14px 8px; }
.pn-h .geoicon { flex: 0 0 auto; margin-top: 2px; }
.pn-h .shname { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--sh, var(--ink-3)); font-weight: 700; }
.pn-title {
  width: 100%; border: none; background: none; font-weight: 700; font-size: 15px; padding: 2px 0 0;
  color: var(--ink);
}
.pn-title:hover, .pn-title:focus { background: var(--canvas); border-radius: 6px; }
.pn-x { margin-left: auto; }
.pn-body { flex: 1; overflow-y: auto; padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 13px; }
.f { display: flex; flex-direction: column; gap: 5px; }
.f > label { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 650; }
.f input[type="text"], .f textarea, .f select {
  border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; background: var(--panel);
  font-size: 12.5px; width: 100%;
}
.f textarea { min-height: 74px; resize: vertical; line-height: 1.4; }
.f input:focus, .f textarea:focus { border-color: var(--accent); outline: none; }
.frow { display: flex; gap: 9px; }
.frow .f { flex: 1; min-width: 0; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chips button {
  padding: 4px 10px; border-radius: 7px; border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 11.5px; font-weight: 600; background: var(--panel);
}
.chips button:hover { border-color: var(--ink-3); color: var(--ink); }
.chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips.status button.on[data-v="done"] { background: var(--ok); border-color: var(--ok); }
.chips.status button.on[data-v="blocked"] { background: var(--bad); border-color: var(--bad); }

/* links list */
.lnk { display: flex; align-items: center; gap: 6px; }
.lnk input { flex: 1; min-width: 0; border: 1px solid var(--line-2); border-radius: 7px; padding: 5px 8px; font-size: 12px; background: var(--panel); }
.lnk input.lbl { flex: 0 0 34%; }
.lnk a, .lnk button { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); flex: 0 0 auto; }
.lnk a:hover { color: var(--accent); background: var(--accent-soft); }
.lnk button:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.addrow { align-self: flex-start; color: var(--accent); font-weight: 600; font-size: 12px; padding: 4px 8px; border-radius: 7px; }
.addrow:hover { background: var(--accent-soft); }

/* deps list */
.dep { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: 12px; }
.dep .n { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.dep .n:hover { color: var(--accent); }
.dep button { color: var(--ink-3); width: 20px; height: 20px; border-radius: 5px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.dep button:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.dep .dir { font-size: 9.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); font-weight: 650; flex: 0 0 auto; }

.pn-foot { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 8px; }
.dangerbtn {
  padding: 6px 12px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line-2));
  color: var(--bad); font-weight: 600; font-size: 12px;
}
.dangerbtn:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }

/* ============ modal ============ */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 20, 23, .42); z-index: 80;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 18px; max-width: 660px; width: calc(100vw - 60px);
  max-height: calc(100vh - 80px); overflow-y: auto;
}
.modal h2 { margin: 0 0 4px; font-size: 16px; }
.modal .sub { color: var(--ink-2); font-size: 12.5px; margin: 0 0 14px; }
.tplgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tplcard {
  border: 1px solid var(--line-2); border-radius: 11px; padding: 12px; text-align: left;
  background: var(--panel); display: flex; flex-direction: column; gap: 6px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.tplcard:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tplcard .tn { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.tplcard .tb { color: var(--ink-2); font-size: 12px; line-height: 1.4; }
.tplcard .shrow { display: flex; gap: 5px; margin-top: 2px; flex-wrap: wrap; }
.modal textarea { width: 100%; min-height: 120px; border: 1px solid var(--line-2); border-radius: 9px; padding: 9px; background: var(--panel); font-size: 12px; font-family: ui-monospace, Consolas, monospace; }
.modal .mrow { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.btn { padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 12.5px; border: 1px solid var(--line-2); color: var(--ink-2); background: var(--panel); }
.btn:hover { color: var(--ink); border-color: var(--ink-3); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:hover { color: var(--ink-2); border-color: var(--line-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }

/* boards dropdown */
.menu {
  position: absolute; z-index: 60; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 11px; box-shadow: var(--shadow-lg); padding: 5px; min-width: 250px; max-height: 60vh; overflow-y: auto;
}
.menu .mi {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; border-radius: 8px;
  color: var(--ink-2); text-align: left; font-weight: 550;
}
.menu .mi:hover { background: var(--canvas); color: var(--ink); }
.menu .mi.on { color: var(--accent); font-weight: 650; }
.menu .mi .n { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu .mi .t { font-size: 9.5px; text-transform: uppercase; color: var(--ink-3); }
.menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu .mi.newb { color: var(--accent); font-weight: 650; }

/* help popover */
.helppop {
  position: absolute; right: 12px; top: 46px; z-index: 70; width: 330px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 14px 16px; font-size: 12.5px; color: var(--ink-2);
}
.helppop h3 { margin: 0 0 8px; font-size: 13.5px; color: var(--ink); }
.helppop ul { margin: 0; padding-left: 17px; display: flex; flex-direction: column; gap: 6px; }
.helppop b { color: var(--ink); font-weight: 650; }
.helppop kbd {
  font: 600 10.5px ui-monospace, Consolas, monospace; background: var(--canvas);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px;
}

/* ============ question-thread modal ============ */
.modal.qam { max-width: min(1150px, 94vw); width: 94vw; padding: 0; display: flex; }
.modal.qam #qaInner { display: flex; flex-direction: column; width: 100%; max-height: calc(100vh - 90px); }
.qa-h { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.qa-h h2 { margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-h .sub { margin: 3px 0 0; color: var(--ink-2); font-size: 12.5px; }
.qa-empty { padding: 56px 20px; text-align: center; color: var(--ink-2); font-size: 13px; line-height: 1.6; }
.qa-canvas { flex: 1; overflow: auto; background: var(--canvas); min-height: 300px; }
.qa-world { position: relative; }
.qa-edges { position: absolute; left: 0; top: 0; pointer-events: none; }
.qitem {
  position: absolute; background: var(--panel); border: 1.5px solid var(--line-2);
  border-radius: 11px; padding: 8px 10px; cursor: pointer; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px;
}
.qitem.t-question { border-color: color-mix(in srgb, var(--h-amber) 60%, var(--line-2)); }
.qitem.t-question.qdone { border-color: color-mix(in srgb, var(--ok) 55%, var(--line-2)); }
.qitem.t-answer { border-color: color-mix(in srgb, var(--h-teal) 55%, var(--line-2)); }
.qitem:hover { border-width: 2px; padding: 7.5px 9.5px; }
.q-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.q-type { font-size: 9.5px; letter-spacing: .05em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); }
.qitem.t-question .q-type { color: var(--h-amber); }
.qitem.t-question.qdone .q-type { color: var(--ok); }
.qitem.t-answer .q-type { color: var(--h-teal); }
.q-status {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--h-amber) 50%, var(--line-2));
  color: var(--h-amber); background: color-mix(in srgb, var(--h-amber) 10%, var(--panel));
}
.qitem.qdone .q-status { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line-2)); background: color-mix(in srgb, var(--ok) 10%, var(--panel)); }
.q-status:hover { filter: brightness(1.06); box-shadow: var(--shadow); }
/* clamp long question text so a card can't spill over the one below it */
.q-text {
  font-size: 12.5px; font-weight: 550; color: var(--ink); line-height: 1.35; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden;
}
.qitem.qform .q-text { -webkit-line-clamp: none; display: block; }
.q-meta { font-size: 10.5px; color: var(--ink-2); font-weight: 600; }
.qitem.qform { cursor: default; gap: 6px; box-shadow: var(--shadow-lg); }
.qform .q-ftext { width: 100%; border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 8px; font-size: 12.5px; resize: vertical; min-height: 46px; background: var(--bg); }
.qform .q-frow { display: flex; gap: 6px; align-items: center; }
.qform .q-frow input { flex: 1; min-width: 0; border: 1px solid var(--line-2); border-radius: 7px; padding: 5px 8px; font-size: 11.5px; background: var(--bg); }
.qform .btn { padding: 5px 10px; font-size: 11.5px; }
.btn.qdel { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line-2)); }
.btn.qdel:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.qslot {
  position: absolute; border: 1.6px dashed color-mix(in srgb, var(--accent) 40%, var(--line-2));
  border-radius: 11px; display: flex; align-items: center; justify-content: center; gap: 8px;
  opacity: .55; transition: opacity .12s ease;
}
.qslot:hover { opacity: 1; }
.qslot button {
  font-size: 11px; font-weight: 650; color: var(--ink-2); padding: 4px 9px;
  border: 1px solid var(--line-2); border-radius: 7px; background: var(--panel);
}
.qslot button:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.qa-f { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); align-items: center; }

/* ============ quick-edit popover (tile pill row) ============ */
.quickedit {
  position: absolute; z-index: 26; width: 280px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 11px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.quickedit .qe-h { font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quickedit textarea, .quickedit input {
  border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 8px;
  font-size: 12px; background: var(--bg); width: 100%;
}
.quickedit textarea { resize: vertical; min-height: 40px; }
.quickedit .qe-row { display: flex; gap: 6px; }
.quickedit .chips button { padding: 3px 8px; font-size: 11px; }

/* ============ labels (drawer) ============ */
.dr-labels { padding: 0 8px 10px; overflow-y: auto; }
.dr-sub {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-head);
  font-weight: 700; padding: 11px 6px 4px; cursor: pointer; border-radius: 6px;
}
.dr-sub:hover { color: var(--accent); }
.dr-sub .gn { flex: 1; }
/* the count is what makes a folded group still informative */
.dr-sub .gc {
  font-size: 9.5px; letter-spacing: 0; color: var(--ink-3); font-weight: 650;
  background: var(--canvas); border-radius: 20px; padding: 1px 6px; min-width: 18px; text-align: center;
}
.dr-sub .tw { flex: 0 0 auto; transition: transform .15s ease; }
.dr-sub.off .tw { transform: rotate(-90deg); }
.dr-grp[hidden] { display: none !important; }
/* panel-level fold, on the panel's own header */
.pfold { color: var(--ink-3); width: 20px; height: 20px; border-radius: 5px; display: flex; align-items: center; justify-content: center; }
.pfold:hover { background: var(--canvas); color: var(--accent); }
.pfold svg { transition: transform .15s ease; }
.pshell.folded .pfold svg { transform: rotate(-90deg); }
.pshell.folded .dr-labels, .pshell.folded .dr-boards { display: none; }
.dr-add { color: var(--accent); font-size: 15px; line-height: 1; width: 20px; height: 20px; border-radius: 5px; }
.dr-add:hover { background: var(--accent-soft); }
.dr-lbl {
  display: flex; align-items: center; gap: 8px; padding: 5px 9px; border-radius: 8px;
  color: var(--ink-2); cursor: grab; user-select: none; touch-action: none;
}
.dr-lbl:hover { background: var(--canvas); color: var(--ink); }
.dr-lbl.on { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.dr-lbl.on .lbl-dot { box-shadow: 0 0 0 2px color-mix(in srgb, var(--lc, var(--accent)) 55%, transparent); }
.dr-lbl .n { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; font-weight: 550; }
.dr-lbl .x { color: var(--ink-3); width: 18px; height: 18px; border-radius: 4px; display: none; align-items: center; justify-content: center; flex: 0 0 auto; }
.dr-lbl:hover .x { display: inline-flex; }
.dr-lbl .x:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
/* native colour picker, styled as a round swatch (same as lanes and shapes) */
input.lbl-dot {
  width: 15px; height: 15px; padding: 0; border: none; border-radius: 50%;
  appearance: none; -webkit-appearance: none; background: none; cursor: pointer; flex: 0 0 auto;
}
input.lbl-dot::-webkit-color-swatch-wrapper { padding: 0; }
input.lbl-dot::-webkit-color-swatch { border: 2px solid var(--panel); border-radius: 50%; box-shadow: 0 0 0 1px var(--line-2); }
input.lbl-dot:hover::-webkit-color-swatch { box-shadow: 0 0 0 2px var(--ink-3); }
.lbl-swatch {
  width: 15px; height: 15px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line-2);
}
.lbl-count {
  font-size: 10px; font-weight: 700; color: var(--ink-3); flex: 0 0 auto;
  background: var(--canvas); border-radius: 8px; padding: 1px 6px; min-width: 18px; text-align: center;
}
.dr-lbl.on .lbl-count { background: var(--panel); color: var(--accent); }
.dr-lbl.can-del:hover .lbl-count { display: none; } /* the ✕ takes this slot on hover */
.lbl-edit {
  flex: 1; min-width: 0; border: 1px solid var(--accent); border-radius: 6px;
  padding: 3px 7px; font-size: 12px; background: var(--panel);
}
.dr-hint { padding: 2px 12px 6px; color: var(--ink-3); font-size: 11.5px; line-height: 1.5; }

/* delete bin (bottom of the left panel; shows with a multi-selection or during tile drags) */
.binzone {
  position: absolute; left: 12px; bottom: 14px; z-index: 45;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 132px; padding: 15px 10px;
  border: 2px dashed color-mix(in srgb, var(--bad) 45%, var(--line-2));
  border-radius: 14px; background: color-mix(in srgb, var(--panel) 90%, transparent);
  color: var(--bad); font-size: 11px; font-weight: 600; text-align: center;
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .15s ease, transform .15s ease, box-shadow .15s ease, background .15s ease;
  cursor: pointer; user-select: none;
}
.binzone.show { opacity: 1; pointer-events: auto; transform: none; }
.binzone:hover { border-color: var(--bad); }
.binzone.hot {
  border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--panel));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 22%, transparent); transform: scale(1.04);
}

/* ============ ERD mode ============ */
.erdonly { display: none; }
body.erdmode .erdonly { display: flex; }
body.erdmode span.erdonly { display: inline-block; }
body.erdmode .flowonly { display: none; }
body.erdmode .lane, body.erdmode .lane-add { display: none; }

/* the shape's hue has to carry the card: at 62%/15% every entity type read as the
   same grey box, which is the whole point of having Entity/Lookup/Junction/External */
.enode {
  position: absolute; background: var(--panel); border: 1.5px solid color-mix(in srgb, var(--sh) 85%, var(--line-2));
  border-radius: 10px; box-shadow: var(--shadow); user-select: none; cursor: grab;
  touch-action: none; overflow: visible;
}
.enode:hover { border-color: var(--sh); box-shadow: var(--shadow-lg); }
.enode.sel { border-color: var(--sh); border-width: 2.5px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--sh) 22%, transparent), var(--shadow-lg); }
.enode.msel { border-style: dashed; border-color: var(--accent); }
.enode.linktarget { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.enode.dragging { opacity: .75; cursor: grabbing; }
.ehead {
  display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px;
  background: color-mix(in srgb, var(--sh) 30%, var(--panel));
  border-radius: 8px 8px 0 0; border-bottom: 1.5px solid color-mix(in srgb, var(--sh) 60%, var(--line));
  font-weight: 700; font-size: 13px; color: var(--ink);
}
.enode .enames { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; line-height: 1.15; }
.enode .ename { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.enode .ename i { color: var(--ink-3); font-weight: 500; }
/* API name: quieter second line, only when populated */
.enode .eapi {
  font-size: 9.5px; font-weight: 500; color: var(--ink-3); letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, Consolas, monospace;
}
.enode .ecol { color: var(--ink-3); font-size: 11px; width: 14px; flex: 0 0 auto; }
.enode .ecol:hover { color: var(--sh); }
.enode .ecount { font-size: 10px; font-weight: 700; color: var(--ink-3); }
.efields { padding: 7px 0; }
.efield {
  display: flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px;
  font-size: 11.5px; color: var(--ink-2); position: relative; cursor: text;
}
.efield:hover { background: color-mix(in srgb, var(--sh) 7%, transparent); }
.efield .ekey {
  width: 20px; flex: 0 0 auto; font-size: 8.5px; font-weight: 800; letter-spacing: .04em;
  color: var(--ink-3); cursor: pointer; text-align: center; border-radius: 3px;
}
.ekey.k-pk { color: var(--h-amber); }
.ekey.k-fk { color: var(--h-blue); }
.ekey.k-uq { color: var(--h-violet); }
.ekey.k-rq { color: var(--bad); }
.ekey.k-ix { color: var(--h-teal); }
.ekey.k-none { color: var(--line-2); font-weight: 600; } /* a quiet hyphen invites a click */
.efield:hover .ekey.k-none { color: var(--ink-3); }
.efield .ekey:hover { background: var(--canvas); }
.shapepick.keypick button { gap: 9px; }
.shapepick.keypick .ekey { width: 22px; }
.shapepick.keypick button.cur { background: var(--accent-soft); }
.efield .efname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 550; }
.efield .efname i { color: var(--ink-3); font-weight: 400; }
.efield .eftype { font-size: 10px; color: var(--ink-3); flex: 0 0 auto; }
.efield .efport {
  position: absolute; right: -7px; top: 50%; margin-top: -6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--panel); border: 2px solid var(--accent);
  opacity: 0; pointer-events: none; cursor: crosshair; z-index: 3;
}
.efield:hover .efport { opacity: 1; pointer-events: auto; }
.efield.editing { gap: 5px; padding: 0 7px; }
.ef-name { flex: 1; min-width: 0; border: 1px solid var(--accent); border-radius: 5px; padding: 2px 6px; font-size: 11.5px; background: var(--bg); }
.ef-type { flex: 0 0 92px; border: 1px solid var(--line-2); border-radius: 5px; padding: 2px 4px; font-size: 10.5px; background: var(--bg); }
/* lives in the reserved strip at the card's foot (ERD.ADD in the geometry) */
.eaddf {
  display: block; width: calc(100% - 16px); margin: 0 8px; height: 19px; padding: 0;
  font-size: 10.5px; font-weight: 650; color: var(--ink-3); border: 1px dashed var(--line-2);
  border-radius: 6px; opacity: 0; transition: opacity .12s ease;
}
.enode:hover .eaddf { opacity: 1; }
.eaddf:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.eside {
  position: absolute; width: 19px; height: 19px; border-radius: 50%; z-index: 4;
  background: var(--panel); border: 1.5px solid var(--accent); color: var(--accent);
  font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .12s ease, transform .1s ease;
}
.enode:hover .eside { opacity: 1; pointer-events: auto; }
.eside:hover { transform: scale(1.2); background: var(--accent); color: #fff; }
/* left/right sit level with the HEADER, not the middle of the card — at mid-height
   they landed on top of a field row's connector dot */
.es-t { top: -10px; left: 50%; margin-left: -9px; }
.es-b { bottom: -10px; left: 50%; margin-left: -9px; }
.es-l { left: -10px; top: 10px; }
.es-r { right: -10px; top: 10px; }
.enode .edel {
  position: absolute; top: -9px; right: -9px; width: 19px; height: 19px; border-radius: 50%;
  background: var(--panel); border: 1.5px solid var(--bad); color: var(--bad); font-size: 11px;
  display: flex; align-items: center; justify-content: center; z-index: 5;
  opacity: 0; pointer-events: none; transition: opacity .12s ease;
}
.enode:hover .edel { opacity: 1; pointer-events: auto; }
.enode .edel:hover { background: var(--bad); color: #fff; }
.enode .emeta { position: absolute; left: 6px; right: 6px; bottom: -19px; }

#edges .erel {
  fill: none; stroke: color-mix(in srgb, var(--ink-2) 78%, var(--line-2)); stroke-width: 1.7;
  transition: stroke .18s ease, stroke-width .18s ease;
}
#edges .erel.tinted { stroke: var(--rc); }
/* line colour: a dot on the hover badge + in the chip, and the picker they open */
.reldot {
  display: block; width: 13px; height: 13px; border-radius: 50%;
  background: color-mix(in srgb, var(--ink-2) 78%, var(--line-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 18%, transparent);
}
.reldot.none { background: transparent; box-shadow: inset 0 0 0 2px var(--ink-3); }
.shapepick.relcolors { padding: 8px; }
.rcgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.rcdot {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px; border: 1.5px solid transparent; background: none;
}
.rcdot:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.rcdot.on { border-color: var(--accent); background: var(--accent-soft); }
.edgechip [data-relcolor] { display: flex; align-items: center; justify-content: center; }

/* Named columns belong to a LANE, so each band strip renders inside its own lane
   rather than as one row across the canvas — a global strip would misrepresent
   lanes whose columns differ. Kept quiet and semi-transparent so the lane's tint
   reads through and the band visually belongs to that lane. */
.colband {
  position: absolute; height: 22px; display: flex; align-items: center; gap: 4px;
  padding: 0 9px; border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 74%, transparent);
  border: 1px solid var(--line); z-index: 3;
}
/* the bucket a dragged tile will land in */
.colband.colhot {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}
.colband.colhot .col-name { color: var(--accent); }
.col-name {
  flex: 1; min-width: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-head, var(--ink-2)); cursor: text;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.col-name:hover { color: var(--accent); }
.col-x {
  opacity: 0; flex: 0 0 auto; font-size: 11px; line-height: 1; color: var(--ink-3);
  background: none; border: 0; cursor: pointer; padding: 2px 3px; border-radius: 4px;
}
.colband:hover .col-x { opacity: 1; }
.col-x:hover { color: var(--danger, #d4553e); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.colrule {
  position: absolute; width: 1px; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, var(--line-2), color-mix(in srgb, var(--line) 40%, transparent));
}
/* Add-column lives in the LANE GUTTER, with the other lane controls, not on the
   canvas. On the canvas it sat exactly where tiles and marquee drags begin, and
   hover-revealing it made it interactive precisely when pointed at — so it kept
   swallowing selection sweeps. The gutter is already chrome and already excluded
   from canvas gestures. */
.lane-colbtn {
  position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; line-height: 1;
  padding: 3px 4px; border-radius: 5px;
  border: 1px dashed var(--line-2); background: none; cursor: pointer;
  color: var(--ink-3); font-size: 11px; font-weight: 700;
  opacity: 0; transition: opacity .15s ease, border-color .15s ease, color .15s ease;
}
.lane-colbtn span { font-size: 7.5px; letter-spacing: .04em; text-transform: uppercase; }
.lane:hover .lane-colbtn { opacity: .8; }
.lane-colbtn:hover, .lane-colbtn:focus-visible { opacity: 1; border-color: var(--accent); color: var(--accent); }
.col-name-edit {
  position: absolute; left: 5px; top: 2px; right: 5px; height: 18px;
  font: 700 11.5px/1 inherit; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink); background: var(--panel); border: 1.5px solid var(--accent);
  border-radius: 5px; padding: 0 6px; outline: none; z-index: 4;
}

/* Ctrl+drag selection window */
.marquee {
  position: absolute; z-index: 40; pointer-events: none;
  border: 1.5px dashed var(--accent); border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
#edges .erel.hot { stroke: var(--accent); stroke-width: 2.4; }
#edges .erel.sel { stroke: var(--accent); stroke-width: 2.6; }
#edges .erelhit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
/* alignment guide shown while a dragged entity snaps its connector straight */
#edges .erdalign {
  fill: none; stroke: var(--accent); stroke-width: 1.2;
  stroke-dasharray: 3 4; opacity: .85; pointer-events: none;
}
#edges .erdtmp, #edges .erdprev { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 4; }
#edges .erdprev { opacity: .8; }
.erdghost {
  position: absolute; border: 2px dashed var(--accent); border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 8%, transparent); pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 11px; font-weight: 650; z-index: 1;
}
/* the display:flex above outranks the UA [hidden] rule, so hiding it needs saying
   explicitly — without this the ghost box stays on screen forever */
.erdghost[hidden] { display: none !important; }
.erdflip {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  background: var(--panel); border: 1.5px solid var(--accent); color: var(--accent);
  display: flex; align-items: center; justify-content: center; z-index: 6; cursor: pointer;
  box-shadow: var(--shadow); opacity: 1; transition: opacity .18s ease, transform .12s ease;
}
.erdflip.leaving { opacity: 0; }
.erdflip:hover { background: var(--accent); color: #fff; }
.erdflip.vert svg { transform: rotate(90deg); }
.erdchip select { border: 1px solid var(--line-2); border-radius: 6px; padding: 3px 5px; font-size: 11.5px; background: var(--panel); }
/* relationship-type pickers show the real line */
.rtico { display: block; flex: 0 0 auto; }
#erdTypeSeg button { padding: 2px 5px; }
#erdTypeSeg button.on .rtico path { stroke: var(--accent); }
.shapepick.reltypes { min-width: 210px; }
.shapepick.reltypes button { gap: 8px; padding: 5px 8px; }
.shapepick.reltypes span { font-size: 12px; }

/* custom tooltip for tile hover-icons */
.tip {
  position: fixed; z-index: 130; pointer-events: none;
  background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 600;
  padding: 4px 9px; border-radius: 7px; box-shadow: var(--shadow-lg);
  opacity: 0; transition: opacity .1s ease; max-width: 250px; text-align: center;
}
.tip.show { opacity: 1; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 9px;
  font-weight: 600; font-size: 12.5px; box-shadow: var(--shadow-lg);
  opacity: 0; transition: opacity .18s ease, translate .18s ease; pointer-events: none;
}
.toast.show { opacity: 1; }

/* empty state */
.emptyhint {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%);
  z-index: 2; pointer-events: none; color: var(--ink-3);
  font-size: 13px; text-align: center; width: 300px;
}
.emptyhint b { color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
