/* Mamba HQ — TeleMamba design system (shared tokens) */
@font-face { font-family: "Bebas Neue"; src: url("/fonts/bebas-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/fonts/sgro-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/fonts/sgro-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jbmono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jbmono-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #070B14;
  --surface: #0C1322;
  --raised: #111A2E;
  --overlay: #16203A;
  --line: #1B2438;
  --line-strong: #27324A;
  --text: #EEF2F9;
  --text-2: #93A0B8;
  --text-3: #55617A;
  --acc: #C9D5EA;
  --acc-hover: #E6ECF7;
  --acc-down: #9AA9C4;
  --acc-wash: rgba(201, 213, 234, 0.10);
  --acc-glow: rgba(220, 230, 246, 0.22);
  --plat: linear-gradient(180deg, #FFFFFF 0%, #E8EDF5 45%, #98A5BC 100%);
  --ok: #2ECC71;
  --ok-wash: rgba(46, 204, 113, 0.13);
  --danger: #FF4D4D;
  --danger-wash: rgba(255, 77, 77, 0.13);
  --warn: #FFB020;
  --warn-wash: rgba(255, 176, 32, 0.13);
  --font-ui: "Inter", -apple-system, sans-serif;
  --font-tech: "Space Grotesk", "Inter", sans-serif;
  --font-display: "Bebas Neue", "Inter", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --r: 2px; --r-sm: 2px; --r-full: 2px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px; --s16: 64px;
  --fast: 120ms ease-out; --move: 150ms ease-out;
  --sidebar-w: 200px; --topbar-h: 48px; --bottom-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font: 13.5px/1.45 var(--font-ui); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
#app { min-height: 100%; height: 100%; }
html, body { overflow: hidden; }
body.login-open, body:has(.login) { overflow: auto; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--acc); text-decoration: none; }
a:hover { color: var(--acc-hover); }
::selection { background: var(--acc); color: #0B0E16; }
.boot { min-height: 100dvh; display: grid; place-items: center; color: var(--text-3); font-family: var(--font-tech); letter-spacing: .08em; text-transform: uppercase; font-size: 11px; }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.t2 { color: var(--text-2); } .t3 { color: var(--text-3); }
.label { font-family: var(--font-tech); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 14px; cursor: pointer;
  font-family: var(--font-tech); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--raised); color: var(--text);
  transition: background var(--fast), border-color var(--fast), color var(--fast), box-shadow var(--fast);
  user-select: none; white-space: nowrap;
}
.btn:hover { background: var(--overlay); border-color: var(--acc); }
.btn:active { background: var(--surface); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid #E6ECF7; outline-offset: 1px; }
.btn-primary {
  background: var(--plat); border-color: #FFFFFF; color: #0B0E16;
  box-shadow: 3px 3px 0 rgba(0,0,0,.6), 0 0 20px var(--acc-glow);
}
.btn-primary:hover { background: linear-gradient(180deg, #FFFFFF 0%, #F2F5FA 55%, #B4C0D6 100%); box-shadow: 3px 3px 0 rgba(0,0,0,.6), 0 0 26px rgba(220,230,246,.35); }
.btn-primary:active { box-shadow: 1px 1px 0 rgba(0,0,0,.6); }
.btn-outline { background: transparent; border-color: var(--acc); color: var(--acc); }
.btn-outline:hover { background: var(--acc-wash); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--raised); color: var(--text); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-lg { height: 40px; padding: 0 var(--s5); font-size: 13px; }
.btn-sm { height: 24px; padding: 0 var(--s2); font-size: 10.5px; }
.btn-block { width: 100%; }

/* Inputs */
.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 var(--s3);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text); font-size: 13px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.textarea { height: auto; min-height: 96px; padding: var(--s3); resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-wash); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2355617A' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
.field { display: flex; flex-direction: column; gap: var(--s1); margin-bottom: var(--s4); }

/* Cards / KPI */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--s4); box-shadow: inset 0 1px 0 rgba(255,255,255,.09);
}
.card h2, .card h3 { margin: 0 0 var(--s3); font-family: var(--font-tech); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.kpi {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09);
}
.kpi .lbl { font-family: var(--font-tech); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.kpi .num {
  font-family: var(--font-mono); font-size: 22px; font-weight: 600; line-height: 1.15;
  background: var(--plat); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.kpi.hot { border-color: rgba(201,213,234,.45); background: linear-gradient(160deg, rgba(220,230,246,.08), transparent 55%), var(--surface); }
.kpi .sub { font-size: 11px; font-family: var(--font-mono); color: var(--text-3); }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 18px; padding: 0 7px;
  font-size: 10px; font-weight: 600; border-radius: var(--r-full);
  border: 1px solid var(--line-strong); color: var(--text-2); background: var(--raised);
}
.badge.acc { background: var(--plat); border-color: #FFF; color: #0B0E16; font-weight: 700; }
.badge.ok { background: var(--ok-wash); border-color: transparent; color: var(--ok); }
.badge.warn { background: var(--warn-wash); border-color: transparent; color: var(--warn); }
.badge.danger { background: var(--danger-wash); border-color: transparent; color: var(--danger); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--ok); } .dot.live { background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Layout */
.shell {
  display: flex; height: 100dvh; max-height: 100dvh; min-height: 100dvh;
  overflow: hidden; width: 100%;
}
.sidebar {
  width: var(--sidebar-w); flex: none; align-self: stretch;
  background: linear-gradient(180deg, #090E1A 0%, #060A12 100%);
  border-right: 1px solid var(--line-strong);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh; max-height: 100dvh;
  overflow: hidden;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px; height: var(--topbar-h);
  padding: 0 var(--s4); border-bottom: 1px solid var(--line-strong); position: relative; flex: none;
}
.sidebar .brand::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, #FFFFFF, #C9D5EA 45%, rgba(152,165,188,.25));
}
.sidebar .brand img { width: 28px; height: 28px; }
.sidebar .brand .name {
  font-family: var(--font-display); font-size: 26px; letter-spacing: .08em; text-transform: uppercase;
  background: var(--plat); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--s4) var(--s2) var(--s3); }
.navsec { margin-bottom: var(--s4); }
.navsec > .label { display: flex; align-items: center; gap: 6px; padding: var(--s1) var(--s3) var(--s1) var(--s4); }
.navsec > .label::before { content: ""; width: 8px; height: 2px; background: var(--plat); flex: none; }
.navitem {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 var(--s4);
  font-family: var(--font-tech); font-size: 12.5px; font-weight: 500; color: var(--text-2);
  border: 0; background: transparent; border-left: 3px solid transparent; border-radius: 0;
  transition: all var(--fast); text-align: left; cursor: pointer;
}
.navitem:hover { color: var(--text); background: rgba(255,255,255,.03); transform: translateX(2px); }
.navitem.active {
  color: #FFF; font-weight: 700; border-left-color: #E6ECF7;
  background: linear-gradient(90deg, rgba(220,230,246,.16), transparent 75%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.navitem .ico { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); }
.navitem.active .ico, .navitem:hover .ico { color: #E6ECF7; }
.sidebar .foot { flex: none; margin-top: auto; padding: var(--s3) var(--s4); border-top: 1px solid var(--line); font-size: 11px; color: var(--text-3); display: flex; flex-direction: column; gap: 8px; }

.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s5); border-bottom: 1px solid var(--line); background: rgba(7,11,20,.72); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 5;
}
.topbar .crumb { font-family: var(--font-tech); font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.topbar .spacer { flex: 1; }
.content { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: var(--s5); padding-bottom: calc(var(--s8) + var(--safe-b)); max-width: 1040px; width: 100%; margin: 0 auto; }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.row { display: flex; gap: var(--s3); align-items: center; }
.row.between { justify-content: space-between; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }

/* Today hero */
.hero {
  padding: var(--s5); background: linear-gradient(160deg, rgba(220,230,246,.10), transparent 55%), var(--surface);
  border: 1px solid rgba(201,213,234,.35); border-radius: var(--r);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}
.hero .big {
  font-family: var(--font-mono); font-size: 40px; font-weight: 600; line-height: 1.05; margin: 6px 0 4px;
  background: var(--plat); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero .hint {
  margin-top: var(--s3); padding: 8px 10px; background: var(--acc-wash); border: 1px solid rgba(201,213,234,.2);
  border-radius: var(--r-sm); font-size: 12px; color: var(--acc); font-family: var(--font-tech);
}
.formula {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-3);
  padding: var(--s2) var(--s3); border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
}

/* Day list / table-ish */
.day-list { display: flex; flex-direction: column; }
.day-row {
  display: grid; grid-template-columns: 1.2fr 1fr auto; gap: var(--s3); align-items: center;
  padding: 10px var(--s2); border-bottom: 1px solid var(--line); transition: background var(--fast);
}
.day-row:last-child { border-bottom: 0; }
.day-row:hover { background: var(--raised); box-shadow: inset 3px 0 0 var(--acc); }
.day-row.live { background: linear-gradient(90deg, rgba(220,230,246,.08), transparent 70%); }
.day-row .day { font-weight: 600; }
.day-row .amt { font-family: var(--font-mono); font-weight: 600; text-align: right; }
.day-row .s { text-align: right; }

/* Todos */
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  height: 28px; padding: 0 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  border-radius: var(--r-sm); font-family: var(--font-tech); font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; cursor: pointer; transition: all var(--fast);
}
.chip:hover { border-color: var(--acc); color: var(--text); }
.chip.active { background: var(--plat); border-color: #FFF; color: #0B0E16; }
.add-row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.add-row .input, .add-row .select { flex: 1; min-width: 140px; }
.todo-list { display: flex; flex-direction: column; gap: var(--s2); }
.todo { display: flex; flex-direction: column; gap: var(--s2); transition: opacity var(--fast); }
.todo-head { display: flex; gap: var(--s3); align-items: flex-start; }
.todo-title { display: flex; gap: 6px; align-items: center; font-weight: 600; flex-wrap: wrap; }
.todo.is-done .todo-title { text-decoration: line-through; color: var(--text-3); }
.todo.is-hidden { opacity: .55; }
.todo-actions { display: flex; gap: 6px; padding-left: 28px; }
.plan-item { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plan-item:last-child { border-bottom: 0; }
.plan-item.is-done span { text-decoration: line-through; color: var(--text-3); }
.plan-item span { flex: 1; }
.check {
  appearance: none; width: 16px; height: 16px; border: 1px solid var(--line-strong); border-radius: 2px;
  background: var(--bg); cursor: pointer; flex: none; position: relative; margin-top: 2px;
}
.check:checked { background: var(--plat); border-color: #FFF; }
.check:checked::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px;
  border: solid #0B0E16; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Empty */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s3); padding: var(--s16) var(--s4); text-align: center; }
.empty svg { opacity: .18; color: var(--acc); }
.empty .title { font-family: var(--font-tech); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.empty .sub { color: var(--text-3); font-size: 12.5px; max-width: 280px; }

/* Modal */
.overlay { position: fixed; inset: 0; background: rgba(3,5,10,.82); display: grid; place-items: end center; z-index: 60; padding: 0; animation: fadeIn var(--move); }
.modal {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px 4px 0 0;
  width: min(560px, 100%); max-height: 88dvh; overflow: auto; padding: var(--s5);
  box-shadow: 0 -8px 40px rgba(0,0,0,.5); animation: slideUp var(--move);
}
.notes { display: flex; flex-direction: column; gap: var(--s2); margin: var(--s3) 0; }
.note { padding: var(--s3); background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-sm); }
.add-note { display: flex; flex-direction: column; gap: var(--s2); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + var(--safe-b) + var(--bottom-h, 0px));
  transform: translateX(-50%) translateY(8px); background: var(--raised); color: var(--text);
  border: 1px solid var(--line-strong); border-left: 3px solid var(--acc);
  padding: 10px 16px; border-radius: var(--r-sm); opacity: 0; transition: .2s; z-index: 80;
  pointer-events: none; font-family: var(--font-tech); font-size: 12px; font-weight: 600; letter-spacing: .04em;
  box-shadow: 4px 4px 0 rgba(0,0,0,.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { border-left-color: var(--danger); }

/* Login */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: var(--s5);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(201,213,234,.12), transparent 60%),
    var(--bg);
}
.login-card { width: min(400px, 100%); }
.login-card .brand-lockup { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: var(--s6); }
.login-card .brand-lockup img { width: 56px; height: 56px; filter: drop-shadow(0 0 18px var(--acc-glow)); }
.login-card .wordmark {
  font-family: var(--font-display); font-size: 42px; letter-spacing: .08em; text-transform: uppercase; line-height: 1;
  background: var(--plat); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.login-card .tag { font-family: var(--font-tech); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.form-error { color: var(--danger); min-height: 1.2em; margin: 4px 0; font-size: 12px; }

/* Bottom nav (mobile) */
.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--bottom-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: linear-gradient(180deg, #090E1A 0%, #060A12 100%);
  border-top: 1px solid var(--line-strong);
  grid-template-columns: repeat(5, 1fr);
}
.bottom-nav .navitem {
  flex-direction: column; height: var(--bottom-h); gap: 4px; justify-content: center;
  border-left: 0; border-top: 2px solid transparent; font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  padding: 0; transform: none;
}
.bottom-nav .navitem.active {
  border-top-color: #E6ECF7; border-left-color: transparent;
  background: linear-gradient(180deg, rgba(220,230,246,.14), transparent 80%);
}

/* Docs */
.docs { background: var(--bg); }
.docs-main { max-width: 860px; margin: 0 auto; padding: var(--s6) var(--s4); }
.docs-pre {
  white-space: pre-wrap; word-break: break-word;
  font: 12.5px/1.55 var(--font-mono); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: var(--s4); color: var(--text-2);
}

@media (max-width: 820px) {
  .sidebar { display: none; }
  .bottom-nav { display: grid; }
  .main { height: 100dvh; }
  .content { padding: var(--s4); padding-bottom: calc(var(--bottom-h) + var(--safe-b) + var(--s5)); }
  .grid-3 { grid-template-columns: 1fr; }
  .hero .big { font-size: 32px; }
  .day-row { grid-template-columns: 1fr auto; }
  .day-row .s { grid-column: 2; grid-row: 1; }
  .day-row .btn, .day-row .badge { grid-column: 1 / -1; justify-self: start; }
  .topbar { padding: 0 var(--s3); }
  .toast { bottom: calc(12px + var(--safe-b) + var(--bottom-h)); }
}
@media (min-width: 721px) {
  .overlay { place-items: center; padding: var(--s4); }
  .modal { border-radius: 2px; box-shadow: 6px 6px 0 rgba(0,0,0,.55); }
}
/* ── Mindmap Editor ── */
.mm-wrap {
  position: relative; width: 100%; height: calc(100vh - 120px); min-height: 400px;
  overflow: hidden; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  cursor: grab; user-select: none;
  background-image: radial-gradient(circle, rgba(201,213,234,.06) 1px, transparent 1px);
  background-size: 20px 20px;
}
.mm-wrap:active { cursor: grabbing; }
.mm-canvas {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  transform-origin: 0 0; will-change: transform;
}
.mm-svg {
  position: absolute; left: 0; top: 0;
  pointer-events: none; z-index: 1; overflow: visible;
}
.mm-path { stroke: var(--line-strong); stroke-width: 2; fill: none; }
.mm-path.active { stroke: var(--acc); stroke-width: 2.5; }
.mm-path.preview { stroke: var(--acc); stroke-width: 1.5; stroke-dasharray: 6 4; opacity: .6; }
.mm-conn-label {
  font-family: var(--font-tech); font-size: 10px; fill: var(--text-3);
  text-anchor: middle; dominant-baseline: auto;
}

/* Nodes */
.mm-node {
  position: absolute; z-index: 2; min-width: 140px; max-width: 500px;
  padding: 10px 18px 10px 12px; border: 2px solid var(--line);
  border-radius: var(--r); cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  font-family: var(--font-tech); transition: box-shadow .15s;
  box-sizing: border-box;
}
.mm-node:hover { box-shadow: 0 0 12px rgba(201,213,234,.15); }
.mm-node.selected { box-shadow: 0 0 0 2px var(--acc), 0 0 16px rgba(201,213,234,.25); }
.mm-node.connect-target { box-shadow: 0 0 0 2px var(--acc), 0 0 20px rgba(201,213,234,.35); }
.mm-type {
  font-size: 9.5px; font-weight: 700; letter-spacing: .8px; opacity: 1;
  text-transform: uppercase;
}
.mm-text {
  font-size: 14px; font-weight: 600; line-height: 1.4; word-break: break-word;
  min-height: 1.4em;
}
.mm-text.editing {
  outline: 1.5px solid var(--acc); outline-offset: 2px; padding: 2px 4px;
  border-radius: 2px; background: rgba(201,213,234,.08);
  user-select: text; cursor: text; -webkit-user-select: text;
}

/* Notes preview on node */
.mm-notes-preview {
  font-size: 12px; line-height: 1.45; opacity: 1; color: #fff !important;
  display: block; max-height: 7.25em; /* ~5 lines */
  overflow: hidden; word-break: break-word; margin-top: 5px;
  font-style: normal; border-top: 1px solid rgba(255,255,255,.2); padding-top: 5px;
  white-space: pre-line;
}

/* Connection handles (drag to connect) */
.mm-handle {
  position: absolute; right: -7px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; border-radius: 50%; background: var(--acc);
  border: 2px solid var(--bg); cursor: crosshair; z-index: 3; opacity: 0;
  transition: opacity .15s;
}
.mm-handle-left { right: auto; left: -7px; }
.mm-node:hover .mm-handle { opacity: 1; }

/* Add branch buttons (+) */
.mm-add-btn {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: var(--acc); color: var(--bg); font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 5; opacity: 0; transition: opacity .15s, transform .1s;
  line-height: 1; border: 2px solid var(--bg); pointer-events: auto;
}
.mm-add-btn:hover { transform: scale(1.2); }
.mm-node:hover .mm-add-btn { opacity: 1; }
.mm-add-right { right: -30px; top: 50%; transform: translateY(-50%); }
.mm-add-right:hover { transform: translateY(-50%) scale(1.2); }
.mm-add-bottom { bottom: -28px; left: 50%; transform: translateX(-50%); }
.mm-add-bottom:hover { transform: translateX(-50%) scale(1.2); }

/* Resize handle (right edge) */
.mm-resize {
  position: absolute; right: -3px; top: 6px; bottom: 6px; width: 6px;
  cursor: ew-resize; z-index: 4; border-radius: 2px;
}
.mm-resize:hover, .mm-resize:active { background: rgba(201,213,234,.2); }

/* Toolbar */
.mm-toolbar {
  position: absolute; top: 8px; left: 8px; z-index: 10;
  display: flex; gap: 6px; align-items: center;
  padding: 4px 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r);
}
.mm-zoom-label {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-3);
  min-width: 32px; text-align: center;
}

/* Type picker popup */
.mm-type-picker {
  position: absolute; z-index: 20; display: flex; flex-direction: column; gap: 2px;
  padding: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.mm-type-pick-item {
  padding: 6px 16px; text-align: left; font-family: var(--font-tech); font-size: 11px;
  font-weight: 600; color: var(--text); background: none; border: 1px solid transparent;
  border-radius: var(--r); cursor: pointer;
}
.mm-type-pick-item:hover { background: var(--raised); border-color: currentColor; }

/* Side panel */
.mm-side {
  position: absolute; top: 0; right: 0; width: 0; height: 100%; z-index: 15;
  background: var(--surface); border-left: 1px solid var(--line);
  overflow-y: auto; overflow-x: hidden; transition: width .2s;
  user-select: auto; -webkit-user-select: auto;
}
.mm-side.open { width: 300px; padding: 14px; }
.mm-side input, .mm-side textarea, .mm-side select {
  user-select: auto; -webkit-user-select: auto; cursor: text;
}
.mm-side-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.mm-side-type-badge {
  display: inline-block; padding: 2px 8px; font-family: var(--font-tech);
  font-size: 10px; font-weight: 700; border: 1px solid; border-radius: var(--r);
}
.mm-side-close {
  background: none; border: none; color: var(--text-3); font-size: 18px;
  cursor: pointer; padding: 0 4px;
}
.mm-side-close:hover { color: var(--text); }
.mm-side-row { margin-bottom: 10px; }
.mm-side-label {
  display: block; font-family: var(--font-tech); font-size: 10px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
}
.mm-side-select, .mm-side-input, .mm-side-textarea {
  width: 100%; padding: 6px 8px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--text); font-family: var(--font-tech); font-size: 12px;
}
.mm-side-textarea { resize: vertical; min-height: 120px; }
.mm-conn-row {
  display: flex; flex-direction: column; gap: 3px;
  padding: 4px 6px; font-size: 11px; color: var(--text-2);
  border-left: 2px solid var(--line-strong); margin: 3px 0;
}
.mm-conn-label-input {
  padding: 3px 6px !important; font-size: 10px !important;
  background: var(--bg) !important; border: 1px solid var(--line) !important;
  border-radius: var(--r); color: var(--text-3); width: 100%;
}
.mm-conn-del {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 14px; padding: 0 4px;
}
.mm-conn-del:hover { color: var(--danger, #ef4444); }

/* Right-click context menu */
.mm-ctx {
  position: fixed; z-index: 50; display: flex; flex-direction: column; gap: 1px;
  padding: 4px; min-width: 160px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.mm-ctx-item {
  padding: 6px 12px; font-family: var(--font-tech); font-size: 11px;
  color: var(--text); cursor: pointer; border-radius: var(--r);
  display: flex; align-items: center;
}
.mm-ctx-item:hover { background: var(--raised); }
.mm-ctx-danger { color: var(--danger, #ef4444); }
.mm-ctx-danger:hover { background: rgba(239,68,68,.12); }


/* ── Pay ladder ── */
.ladder { display: flex; flex-direction: column; gap: 6px; }
.ladder-row {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--raised); transition: border-color var(--fast), background var(--fast);
}
.ladder-row.current {
  border-color: rgba(201,213,234,.55);
  background: linear-gradient(90deg, rgba(220,230,246,.14), transparent 70%), var(--surface);
  box-shadow: inset 3px 0 0 #E6ECF7;
}
.ladder-row .idx {
  width: 22px; height: 22px; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  border: 1px solid var(--line-strong); border-radius: 2px; color: var(--text-2);
}
.ladder-row.current .idx { background: var(--plat); color: #0B0E16; border-color: #fff; }
.ladder-row .rng { font-family: var(--font-tech); font-size: 12px; font-weight: 600; }
.ladder-row .pay { font-family: var(--font-mono); font-weight: 600; }
.tier-editor { display: flex; flex-direction: column; gap: 8px; }
.tier-row { display: grid; grid-template-columns: 1fr 1fr 100px 90px 32px; gap: 6px; align-items: center; }

/* todo notes under title */
.note-bullets { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.note-bullets .note-bullet {
  position: relative; padding-left: 14px; color: var(--text-2); font-size: 12.5px; line-height: 1.45;
}
.note-bullets .note-bullet::before {
  content: ""; position: absolute; left: 0; top: 0.55em; width: 5px; height: 5px; border-radius: 1px;
  background: var(--acc); box-shadow: 0 0 6px var(--acc-glow);
}
.note-bullets .note-bullet strong { color: var(--text); font-weight: 700; }
.note-bullets .more { padding-left: 0; }
.note-bullets .more::before { display: none; }
.subitems { margin: 8px 0 0 28px; display: flex; flex-direction: column; gap: 4px; }
.subitem { display: flex; gap: 8px; align-items: center; }
.todo.prio-high { border-left: 3px solid var(--danger); }
.todo.prio-normal { border-left: 3px solid var(--line-strong); }
.todo.prio-low { border-left: 3px solid var(--text-3); }
.todo.dragging { opacity: .5; }
.todo-drag { cursor: grab; color: var(--text-3); padding: 0 4px; user-select: none; }
.inline-edit { border: 1px solid var(--acc); background: var(--bg); border-radius: 2px; padding: 2px 6px; width: 100%; }

/* shortcuts overlay */
.help-overlay { position: fixed; inset: 0; background: rgba(3,5,10,.82); z-index: 90; display: grid; place-items: center; padding: 20px; }
.help-card { width: min(480px, 100%); background: var(--surface); border: 1px solid var(--line-strong); padding: 20px; box-shadow: 6px 6px 0 rgba(0,0,0,.55); }
.help-card kbd { font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border: 1px solid var(--line-strong); background: var(--raised); border-radius: 2px; }
.help-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }

/* mindmap page chrome */
.mm-page { display: flex; flex-direction: column; height: calc(100dvh - var(--topbar-h)); min-height: 0; margin: calc(-1 * var(--s5)); }
.mm-page .mm-bar { display: flex; gap: 8px; align-items: center; padding: 10px var(--s4); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mm-page .mm-host { flex: 1; min-height: 0; position: relative; }
.mm-page .mm-host .mm-wrap { position: absolute; inset: 0; height: 100% !important; }
@media (max-width: 820px) {
  .mm-page { margin: calc(-1 * var(--s4)); height: calc(100dvh - var(--topbar-h) - var(--bottom-h)); }
  .mm-side { display: none !important; }
}

.todo-actions .select { min-width: 88px; max-width: 120px; }
@media (max-width: 820px) {
  .todo-actions { flex-wrap: wrap; padding-left: 0; gap: 8px; }
  .todo-actions .select { min-width: 110px; flex: 1 1 110px; height: 32px; }
  .todo-actions input[type=date] { min-width: 130px; flex: 1 1 130px; height: 32px; }
  .todo-head { flex-wrap: wrap; }
}

.ladder-hero {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-bottom: var(--s4);
  padding: var(--s4); border: 1px solid rgba(201,213,234,.35); border-radius: var(--r);
  background: linear-gradient(160deg, rgba(220,230,246,.12), transparent 55%), var(--surface);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}
.ladder-hero .hero-num {
  font-family: var(--font-mono); font-size: 32px; font-weight: 700; line-height: 1.1;
  background: var(--plat); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.ladder-progress { margin: 10px 0 4px; height: 8px; background: var(--raised); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.ladder-progress > i { display: block; height: 100%; background: var(--plat); box-shadow: 0 0 12px var(--acc-glow); }
@media (max-width: 820px) { .ladder-hero { grid-template-columns: 1fr; gap: var(--s3); } .ladder-hero .hero-num { font-size: 26px; } }

.todo-assignee, .todo-due {
  min-width: 110px; height: 32px; font-size: 12px; padding: 0 8px;
  appearance: auto; -webkit-appearance: menulist;
}
.todo-assignee { flex: 0 0 auto; max-width: 140px; }
.pay-version-list { display: flex; flex-direction: column; gap: 6px; }
.pay-version-list .version-row {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-2);
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--raised);
}
.ladder-card .ladder { margin-top: 14px; }

/* v3c: progress track/fill, tier editor layout, toast placement */
.ladder-progress { position: relative; height: 10px; margin: 8px 0 4px; background: #0B1220; border: 1px solid var(--line-strong); border-radius: 2px; overflow: hidden; }
.ladder-progress > i.fill, .ladder-progress > i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #8FA3C4, #E6ECF7); box-shadow: 0 0 10px var(--acc-glow); transition: width .4s ease; }
.tier-editor { max-width: 640px; }
.tier-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1.25fr) minmax(0,1fr) 36px; gap: 8px; max-width: 640px; }
.tier-row .input, .tier-row .select { width: 100%; min-width: 0; }
.tier-head { margin: 4px 0 6px; font-family: var(--font-tech); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.tier-actions { display: flex; gap: var(--s3); flex-wrap: wrap; margin: var(--s4) 0 var(--s5); clear: both; }
.tier-preview { margin-top: 0; }
.pay-version-list { margin-top: var(--s4); }
@media (min-width: 821px) {
  .toast { left: auto; right: 24px; bottom: 24px; transform: translateY(8px); }
  .toast.show { transform: translateY(0); }
}
@media (max-width: 820px) {
  .tier-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1.2fr) minmax(0,.9fr) 32px; gap: 6px; }
  .toast { left: 50%; right: auto; bottom: calc(12px + var(--safe-b) + var(--bottom-h)); transform: translateX(-50%) translateY(8px); }
  .toast.show { transform: translateX(-50%) translateY(0); }
}
