:root {
  --bg: #f4f2ee;
  --bg-2: #ebe7df;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --text: #17161c;
  --muted: #6d6a75;
  --border: rgba(23, 22, 28, 0.1);
  --border-strong: rgba(23, 22, 28, 0.18);
  --accent: #5b4bff;
  --accent-2: #ff5fa2;
  --accent-3: #ffb547;
  --accent-text: #ffffff;
  --danger: #e0443a;
  --warn-bg: #fff1cc;
  --warn-text: #6e4a00;
  --line: #b7b2c2;
  --select: #5b4bff;
  --node-bg: #ffffff;
  --root-text: #ffffff;
  --shadow-sm: 0 1px 2px rgba(23, 22, 28, 0.06), 0 2px 8px rgba(23, 22, 28, 0.05);
  --shadow: 0 2px 6px rgba(23, 22, 28, 0.06), 0 12px 32px rgba(23, 22, 28, 0.08);
  --shadow-lg: 0 24px 64px rgba(40, 30, 90, 0.18);
  --radius: 14px;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --gradient: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 60%, var(--accent-3) 100%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #08080a;
    --bg-2: #15141b;
    --panel: rgba(28, 26, 36, 0.72);
    --panel-solid: #1c1a24;
    --text: #f1eff6;
    --muted: #9a96a8;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --accent: #8b7dff;
    --accent-2: #ff6fb0;
    --accent-3: #ffc266;
    --warn-bg: #3a2c0f;
    --warn-text: #ffd98a;
    --line: #4a4658;
    --select: #a99fff;
    --node-bg: #1f1d28;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; }
button, input, select { font: inherit; color: inherit; }
button {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
button:hover:not(:disabled) { border-color: var(--border-strong); }
button:disabled { opacity: 0.38; cursor: default; }
button.primary {
  background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600;
}
button.primary:hover:not(:disabled) { border-color: var(--text); }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover:not(:disabled) { background: var(--bg-2); border-color: transparent; }
button.danger { color: var(--danger); }
button svg { width: 16px; height: 16px; flex: none; }
input[type="text"], input[type="password"] {
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 11px 14px;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.5em; margin: 4px 0; font-size: 13px; }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Login ---------- */
.auth {
  min-height: 100%; display: grid; grid-template-columns: 1.15fr 1fr; position: relative; overflow: hidden;
}
.auth-art { position: relative; padding: 48px; display: flex; flex-direction: column; justify-content: flex-end; }
.auth-art svg.mesh { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.auth-art .mesh path { fill: none; stroke: var(--line); stroke-width: 1.5; }
.auth-art .mesh circle { fill: var(--panel-solid); stroke: var(--border-strong); stroke-width: 1.5; }
.auth-art .mesh circle.hub { fill: url(#hubGrad); stroke: none; }
.auth-art .mesh .plasma-glow path { stroke: var(--accent-2); stroke-width: 6; opacity: 0.9; }
.auth-art .mesh .plasma-core path { stroke: #fff; stroke-width: 1.4; }
.auth-art .mesh .plasma-glow path, .auth-art .mesh .plasma-core path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.auth-art .mesh circle.plasma-orb { fill: url(#orbGrad); stroke: none; pointer-events: none; opacity: 0; }
.auth-art .mesh circle.charged { stroke: var(--accent-2); }
.auth-headline { position: relative; font-size: clamp(40px, 6vw, 84px); line-height: 0.95; margin: 0 0 18px; max-width: 9ch; }
.auth-sub { position: relative; color: var(--muted); font-size: 16px; max-width: 38ch; margin: 0; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; position: relative; }
.login {
  width: 100%; max-width: 380px; padding: 32px;
  background: var(--panel); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg);
}
.login h2 { margin: 0 0 4px; font-size: 26px; }
.login p.muted { margin: 0 0 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.btn-block { width: 100%; justify-content: center; padding: 12px; border-radius: 12px; font-size: 15px; }
.blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; pointer-events: none;
}
.blob.b1 { width: 420px; height: 420px; background: var(--accent); top: -120px; right: -80px; }
.blob.b2 { width: 360px; height: 360px; background: var(--accent-2); bottom: -140px; right: 22%; }
.blob.b3 { width: 260px; height: 260px; background: var(--accent-3); top: 30%; left: -100px; opacity: 0.35; }

/* ---------- Home ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 28px 20px 80px; position: relative; }
.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 40px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; flex: 1; }
.brand-mark { width: 28px; height: 28px; border-radius: 9px; background: var(--gradient); display: grid; place-items: center; }
.brand-mark svg { width: 16px; height: 16px; color: #fff; }
.hero { margin-bottom: 28px; }
.hero h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1; margin: 0 0 10px; }
.hero p { margin: 0; color: var(--muted); font-size: 16px; }

.new-map {
  display: flex; gap: 10px; padding: 10px; margin-bottom: 28px;
  background: var(--panel); backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
}
.new-map input { border: 0; background: transparent; font-size: 16px; box-shadow: none !important; }
.new-map button { padding: 10px 18px; border-radius: 12px; white-space: nowrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.map-card {
  position: relative; display: flex; flex-direction: column; min-height: 168px;
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 18px; padding: 18px;
  box-shadow: var(--shadow-sm); text-decoration: none; color: var(--text); overflow: hidden;
  will-change: transform;
}
.map-card .thumb { position: absolute; inset: 0; opacity: 0.9; pointer-events: none; }
.map-card .thumb path { fill: none; stroke: var(--line); stroke-width: 1.5; }
.map-card .thumb circle { fill: var(--bg-2); stroke: var(--border-strong); }
.map-card .thumb circle.hub { stroke: none; }
.map-card .body { position: relative; margin-top: auto; }
.map-card .title { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.map-card .meta { color: var(--muted); font-size: 12.5px; }
.map-card .actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 4px; opacity: 0; transform: translateY(-4px); transition: opacity 0.2s, transform 0.2s; }
.map-card:hover .actions, .map-card:focus-within .actions { opacity: 1; transform: none; }
.map-card .actions button { padding: 6px; background: var(--panel); backdrop-filter: blur(8px); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  padding: 3px 10px; border-radius: 99px; background: var(--warn-bg); color: var(--warn-text); margin-bottom: 8px;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); border: 1.5px dashed var(--border-strong); border-radius: 18px; }

.panel {
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 18px; padding: 22px; box-shadow: var(--shadow-sm);
  margin-top: 28px; overflow: hidden;
}
.panel h2 { margin: 0 0 14px; font-size: 20px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > input { flex: 1; min-width: 140px; width: auto; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 10px 6px; border-top: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; border-top: 0; }

/* ---------- Editor ---------- */
.editor-body { overflow: hidden; }
.toolbar {
  position: fixed; top: 12px; left: 12px; right: 12px; z-index: 10;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 6px; background: var(--panel); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
}
.toolbar .sep { width: 1px; height: 22px; background: var(--border-strong); margin: 0 4px; }
.toolbar .grow { flex: 1; }
.toolbar button { padding: 6px 9px; border-radius: 10px; }
.toolbar .back { text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 10px; }
.toolbar .back:hover { background: var(--bg-2); }
.toolbar .back .brand-mark { width: 30px; height: 30px; }
.toolbar .map-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar #btn-edit { margin-left: 6px; padding: 7px 14px; }
.status { font-size: 12.5px; color: var(--muted); padding: 0 8px; display: flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: 0; transition: opacity 0.2s, background 0.2s; }
.status[data-state="saved"]::before { background: #22b573; opacity: 1; }
.status[data-state="saving"]::before { background: var(--accent-3); opacity: 1; }
.status[data-state="error"]::before { background: var(--danger); opacity: 1; }
.banner {
  position: fixed; top: 72px; left: 50%; z-index: 9; translate: -50% 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); backdrop-filter: blur(14px); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 99px; font-size: 13px; box-shadow: var(--shadow); white-space: nowrap;
}
.banner.locked { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.swatches { display: flex; gap: 5px; padding: 0 4px; }
.swatch { width: 18px; height: 18px; border-radius: 50%; padding: 0; border: 2px solid var(--panel-solid); box-shadow: 0 0 0 1px var(--border-strong); justify-content: center; font-size: 11px; color: var(--muted); }
.swatch:hover:not(:disabled) { transform: scale(1.2); }
.viewers { display: flex; padding-right: 4px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; margin-left: -6px;
  background: var(--gradient); color: #fff; font-size: 11px; font-weight: 700; border: 2px solid var(--panel-solid);
}

#viewport {
  position: fixed; inset: 0; cursor: grab; touch-action: none;
  background-color: var(--bg);
}
#viewport.panning, #viewport.panning * { cursor: grabbing !important; }
#stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#links { position: absolute; overflow: visible; left: 0; top: 0; pointer-events: none; }
#links path { fill: none; stroke: var(--line); stroke-width: 2.25; stroke-linecap: round; }

.node {
  --c: var(--accent);
  position: absolute; width: max-content; max-width: 280px;
  background: var(--node-bg); border: 1.5px solid var(--border-strong); border-radius: 14px;
  padding: 9px 14px; box-shadow: var(--shadow-sm); cursor: pointer; user-select: none;
  white-space: pre-wrap; word-break: break-word; transform-origin: center;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.node:hover { box-shadow: var(--shadow); }
.node.root {
  background: var(--gradient); color: var(--root-text); border: 0;
  font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.01em;
  padding: 14px 22px; border-radius: 18px; box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent);
}
.node.selected { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5.5px var(--select), var(--shadow); }
.node.peer:not(.selected) { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5.5px var(--peer), var(--shadow); }
.node .peer-tag {
  position: absolute; left: 6px; bottom: calc(100% + 7px); pointer-events: none; white-space: nowrap;
  font: 600 11px/1.2 var(--font-body); letter-spacing: 0; color: #fff; background: var(--peer);
  padding: 3px 8px; border-radius: 99px 99px 99px 3px; box-shadow: var(--shadow-sm);
}
#toast { bottom: 64px; }
.node.drop-target { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5.5px var(--accent-2); }
.node.dragging { opacity: 0.6; z-index: 2; box-shadow: var(--shadow-lg); }
.node .text:empty::before { content: "Digite…"; color: var(--muted); }
.node.root .text:empty::before { color: rgba(255, 255, 255, 0.7); }
.node .text[contenteditable="true"] { outline: none; cursor: text; user-select: text; min-width: 20px; display: inline-block; }
.node img { display: block; max-width: none; border-radius: 9px; margin: 2px 0 8px; cursor: zoom-in; }
.node .toggle {
  position: absolute; top: 50%; translate: 0 -50%;
  width: 20px; height: 20px; border-radius: 50%; padding: 0; font-size: 10px; font-weight: 700; justify-content: center;
  background: var(--panel-solid); border: 1.5px solid var(--line); color: var(--muted);
}
.node .toggle:hover { border-color: var(--accent); color: var(--accent); }
.node .toggle.right { right: -30px; }
.node .toggle.left { left: -30px; }

.node.c-blue { --c: #3b82f6; } .node.c-green { --c: #22a55b; } .node.c-yellow { --c: #e3a805; } .node.c-orange { --c: #f08a24; }
.node.c-red { --c: #e0443a; } .node.c-purple { --c: #8b5cf6; } .node.c-pink { --c: #ec4899; } .node.c-gray { --c: #8a93a5; }
.node[class*="c-"]:not(.root) { border-color: var(--c); background: color-mix(in srgb, var(--c) 11%, var(--node-bg)); }
.node[class*="c-"]:not(.root)::before {
  content: ""; position: absolute; left: 6px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--c);
}
.node[class*="c-"]:not(.root) { padding-left: 18px; }
.node.root[class*="c-"] { background: var(--c); box-shadow: 0 10px 30px color-mix(in srgb, var(--c) 35%, transparent); }

/* Conteúdo extra dos nós */
.node .line { display: flex; align-items: flex-start; gap: 7px; }
.node .line .text { flex: 1; min-width: 0; }
.node .node-icon { font-size: 1.1em; line-height: 1.35; }
.node .check {
  width: 17px; height: 17px; flex: none; margin-top: 2px; padding: 0; border-radius: 5px; justify-content: center;
  border: 1.5px solid var(--line); background: var(--panel-solid); color: #fff;
}
.node .check.on { background: #22a55b; border-color: #22a55b; }
.node .check svg { width: 12px; height: 12px; stroke-width: 3; }
.node.done .text { text-decoration: line-through; opacity: 0.55; }
.node .star {
  position: absolute; top: -9px; right: -9px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: #ffc233; color: #7a4d00; box-shadow: var(--shadow-sm);
}
.node .star svg { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.node .badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.node .badge-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 99px; font: 500 11px/1.4 var(--font-body);
  background: var(--bg-2); border: 1px solid var(--border); color: var(--muted); text-decoration: none; max-width: 180px; white-space: nowrap; overflow: hidden;
}
.node .badge-chip:hover { color: var(--accent); border-color: var(--accent); }
.node .badge-chip svg { width: 12px; height: 12px; flex: none; }
.node.root .badge-chip { background: rgba(255, 255, 255, 0.18); border-color: transparent; color: #fff; }

/* Ligações cruzadas */
#links path.branch { fill: none; stroke-linecap: round; opacity: 0.9; }
#links marker path { fill: var(--accent-2); stroke: none; }
#links path.xlink { fill: none; stroke: var(--accent-2); stroke-width: 2; stroke-dasharray: 7 6; }
#links path.xlink.selected { stroke-width: 3.5; stroke-dasharray: none; }
#links path.xlink-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
#links .xlink-del { pointer-events: all; cursor: pointer; }
#links .xlink-del circle { fill: var(--danger); }
#links .xlink-del path { stroke: #fff; stroke-width: 2; stroke-linecap: round; }

/* Painéis */
.detail-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; margin: 0 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 99px; padding: 5px 12px; font-size: 13px; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip svg { width: 14px; height: 14px; }
.field-label { display: flex; gap: 6px; align-items: baseline; margin: 16px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.lock-hint { text-transform: none; letter-spacing: 0; color: var(--accent-2); font-weight: 500; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.emoji { justify-content: center; padding: 5px 0; font-size: 17px; background: transparent; }
.emoji.on { background: var(--bg-2); border-color: var(--accent); }
.long-text {
  width: 100%; resize: vertical; min-height: 140px; padding: 10px 12px; border-radius: 12px; font: 14px/1.55 var(--font-body);
  background: var(--panel-solid); color: var(--text); border: 1px solid var(--border-strong);
}
.long-text:focus { outline: none; border-color: var(--accent); }
.long-text[readonly] { opacity: 0.75; }
.long-text.notebook { min-height: calc(100vh - 230px); }
.open-link { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); color: var(--text); }
.open-link svg { width: 16px; height: 16px; }
.files { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.file-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--border); font-size: 13px; }
.file-row a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row a:hover { color: var(--accent); }
.file-row svg { width: 15px; height: 15px; flex: none; }
.file-row button { padding: 2px 8px; }
.fav-row { width: 100%; justify-content: flex-start; margin-bottom: 6px; text-align: left; }
.fav-row svg { color: #e0a400; fill: currentColor; }

.node.match:not(.selected) { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent-3), var(--shadow-sm); }
.node.match-current { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent-3), 0 0 26px color-mix(in srgb, var(--accent-3) 60%, transparent); }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 180px; padding: 6px;
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 2px;
}
.menu button { background: transparent; border: 0; justify-content: flex-start; width: 100%; padding: 8px 10px; }
.menu button:hover { background: var(--bg-2); }

.ctxmenu {
  position: fixed; z-index: 40; min-width: 230px; max-width: 280px; padding: 6px;
  background: var(--panel); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 1px; user-select: none;
}
.ctx-item {
  width: 100%; justify-content: flex-start; gap: 10px; padding: 7px 10px; border: 0; border-radius: 9px;
  background: transparent; font-size: 13.5px; text-align: left;
}
.ctx-item:hover, .ctx-item:focus-visible { background: var(--bg-2); outline: none; }
.ctx-item svg { width: 16px; height: 16px; color: var(--muted); }
.ctx-item.checked svg { color: #22a55b; stroke-width: 3; }
.ctx-item.danger, .ctx-item.danger svg { color: var(--danger); }
.ctx-item .ctx-label { flex: 1; }
.ctx-item kbd { font: 11px var(--font-body); color: var(--muted); background: var(--bg-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.ctx-title { padding: 6px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.menu button.checked { background: var(--bg-2); font-weight: 600; }
/* Menus da barra do editor */
.menu.menu-left { right: auto; left: 0; }
.menu.menu-center { right: auto; left: 50%; translate: -50% 0; }
.menu { min-width: 220px; }
.menu button { gap: 10px; font-size: 13.5px; }
.menu button svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.menu-title { padding: 6px 10px 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.menu-title .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.menu-row { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 8px 6px; }
.menu-row.levels button { width: auto; min-width: 32px; justify-content: center; padding: 5px 9px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; }
.menu-row.levels button.checked { border-color: var(--accent); color: var(--accent); }
.toolbar .chev { margin-left: -2px; }
.toolbar .chev svg, .toolbar svg.chev { width: 12px; height: 12px; opacity: 0.6; }
.img-tools { display: inline-flex; gap: 2px; }
.img-tools.hidden { display: none; }

/* Modo leitura (link de compartilhamento): some tudo que edita */
body.readonly .edit-only, body.readonly .login-only, body.readonly #swatches, body.readonly .toolbar .sep, body.readonly .help { display: none !important; }
/* Leitor (só vê e comenta) e botões só do dono */
body.viewonly .edit-only, body.viewonly #swatches, body.viewonly .help { display: none !important; }
body:not(.is-owner) .owner-only { display: none !important; }

/* Painel "Quem pode acessar" */
.access-options .dialog-option span { display: flex; flex-direction: column; gap: 2px; }
.access-options .dialog-option small { color: var(--muted); font-weight: 400; font-size: 12px; }
.access-options .dialog-option { align-items: flex-start; }
.access-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.access-row:first-of-type { border-top: 0; }
.access-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.access-row em { font-style: normal; font-size: 12px; }
.segmented.small button { padding: 4px 8px; font-size: 12px; }
.segmented.small button.on { background: var(--accent); color: #fff; }

/* Biblioteca: pastas, favoritos e busca */
.library-bar { display: flex; gap: 12px; align-items: center; margin: -8px 0 18px; flex-wrap: wrap; }
.folder-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.folder-chip { border-radius: 99px; padding: 6px 12px; font-size: 13px; background: var(--panel-solid); }
.folder-chip svg { width: 14px; height: 14px; }
.folder-chip em { font-style: normal; color: var(--muted); font-size: 12px; }
.folder-chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.folder-chip.on em { color: var(--bg); opacity: 0.7; }
.folder-chip.add { border-style: dashed; color: var(--muted); background: transparent; }
.folder-chip.drop { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.map-search { display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--panel-solid); width: min(260px, 100%); }
.map-search svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.map-search input { border: 0; background: transparent; padding: 8px 4px; box-shadow: none !important; }
.map-card .fav-btn.on { color: #e0a400; }
.map-card .fav-btn.on svg { fill: currentColor; }
.map-card .card-star { position: absolute; top: 14px; left: 14px; color: #e0a400; }
.map-card .card-star svg { width: 18px; height: 18px; fill: currentColor; }
.map-card .actions { flex-wrap: wrap; justify-content: flex-end; max-width: 70%; }
select { font: inherit; color: inherit; background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px 12px; width: 100%; }

.access-tags { display: flex; gap: 6px; margin-bottom: 6px; }
.access-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--bg-2); color: var(--muted); }
.access-tag svg { width: 12px; height: 12px; }

/* Tarefas na tela inicial */
#btn-tasks { position: relative; }
.task-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; display: inline-grid; place-items: center; background: var(--bg-2); color: var(--text); font-size: 11px; font-weight: 700; }
.task-count.urgent { background: var(--danger); color: #fff; }
#tasks-card input[type="checkbox"] { flex: none; width: auto; min-width: 0; }
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--bg-2); }
.segmented button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; font-size: 13px; }
.segmented button.on { background: var(--panel-solid); box-shadow: var(--shadow-sm); font-weight: 600; }
.task-group { margin-bottom: 14px; }
.task-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 6px; font-family: var(--font-body); }
.task-group.late h3 { color: var(--danger); }
.task-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 6px; background: var(--panel-solid); }
.task-row.done { opacity: 0.55; }
.task-row.done .task-text span { text-decoration: line-through; }
.task-check { width: 20px; height: 20px; padding: 0; border-radius: 6px; justify-content: center; border: 1.5px solid var(--line); flex: none; color: #fff; }
.task-check.on { background: #22a55b; border-color: #22a55b; }
.task-check svg { width: 13px; height: 13px; stroke-width: 3; }
.task-text { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: var(--text); }
.task-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-text small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-text:hover span { color: var(--accent); }
.task-meta { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.task-meta em { font-style: normal; color: var(--text); }
.template-section { margin: 18px 0 0; font-size: 14px; font-family: var(--font-display); }
.template-card { position: relative; cursor: pointer; }
.template-del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; padding: 0; justify-content: center; opacity: 0; }
.template-card:hover .template-del, .template-card:focus-within .template-del { opacity: 1; }

/* Modelos */
.dialog.templates { width: min(760px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 14px; }
.template-card {
  flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; border-radius: 14px; min-height: 120px;
  background: var(--bg); transition: border-color 0.2s, transform 0.2s;
}
.template-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.template-card:focus-visible, .template-card.default:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.template-card .template-emoji { font-size: 26px; }
.template-card strong { font-family: var(--font-display); font-size: 16px; }
.template-card .muted { font-size: 12.5px; line-height: 1.4; }

/* Notificações (sino) */
.notif-bell { position: relative; }
.notif-count {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  display: grid; place-items: center; background: var(--accent-2); color: #fff; font-size: 10.5px; font-weight: 700;
  box-shadow: 0 0 0 2px var(--panel-solid);
}
.notif-panel {
  position: fixed; z-index: 45; width: min(380px, calc(100vw - 16px)); max-height: min(520px, calc(100vh - 100px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 8px 16px; }
.notif-head button { font-size: 12.5px; padding: 4px 8px; }
.notif-list { overflow-y: auto; padding: 0 8px 8px; }
.notif-empty { padding: 8px; }
.notif-row { position: relative; display: block; padding: 10px 12px 10px 22px; border-radius: 12px; color: var(--text); text-decoration: none; }
.notif-row:hover { background: var(--bg-2); }
.notif-row.unread::before { content: ""; position: absolute; left: 8px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); }
.notif-row:not(.unread) { opacity: 0.65; }
.notif-top { font-size: 13.5px; }
.notif-text { margin-top: 4px; color: var(--muted); font-size: 13px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.notif-when { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.notif-pop {
  position: fixed; right: 16px; z-index: 44; display: flex; align-items: center; gap: 10px; max-width: min(380px, calc(100vw - 32px));
  padding: 12px 14px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--accent-2) 50%, transparent);
  background: var(--panel-solid); box-shadow: var(--shadow-lg); text-align: left; font-size: 13.5px;
}
.notif-pop svg { width: 18px; height: 18px; color: var(--accent-2); flex: none; }
.notif-pop span { flex: 1; }
.notif-pop em { font-style: normal; font-weight: 600; color: var(--accent-2); }

/* Painel Compartilhar: duas seções (leitura e agente) */
.share-title { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; font-size: 14px; font-family: var(--font-display); }
.share-title:first-child { margin-top: 2px; }
.share-title svg { width: 16px; height: 16px; color: var(--accent); }
.share-box { padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel-solid); }
.share-box p { margin-top: 0; }
.share-box .row a { margin-right: auto; font-size: 13px; }

/* Comentários */
.comment-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; }
.comment { padding: 10px 12px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--border); }
.comment.mentions-me { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.comment.resolved { opacity: 0.6; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comment-head .muted { margin-left: auto; font-size: 11.5px; }
.comment-text { margin: 6px 0 4px; white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.5; }
.mention { color: var(--accent); font-weight: 600; }
.mention.me { background: color-mix(in srgb, var(--accent-2) 20%, transparent); color: var(--accent-2); border-radius: 5px; padding: 0 3px; }
.comment-actions { display: flex; gap: 4px; justify-content: flex-end; }
.comment-actions button { padding: 3px 8px; font-size: 12px; }
.resolved-list summary { cursor: pointer; color: var(--muted); font-size: 13px; margin: 4px 0 8px; }
.resolved-list .comment { margin-bottom: 8px; }
.composer { position: relative; display: flex; flex-direction: column; gap: 8px; }
.composer .comment-input { min-height: 80px; }
.composer > button { align-self: flex-end; }
.mention-pop {
  position: absolute; bottom: calc(100% + 4px); left: 0; right: 0; z-index: 5; padding: 4px;
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.mention-option { width: 100%; justify-content: flex-start; border: 0; background: transparent; padding: 7px 10px; }
.mention-option.active, .mention-option:hover { background: var(--bg-2); }
.avatar.small { width: 22px; height: 22px; font-size: 9.5px; margin: 0; border-width: 0; }
.node .comment-chip { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 40%, transparent); }
.note-view { white-space: pre-wrap; padding: 10px 12px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--border); line-height: 1.55; }

/* Avatares clicáveis (seguir) e cursores das outras pessoas */
button.avatar { padding: 0; cursor: pointer; justify-content: center; }
button.avatar:hover { transform: translateY(-2px); }
.avatar.following { box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 4px var(--text); }
.peer-cursor {
  position: absolute; z-index: 30; pointer-events: none; transform-origin: 0 0;
  transform: scale(var(--inv, 1)); transition: opacity 0.3s;
}
.peer-cursor svg { width: 18px; height: 22px; display: block; fill: var(--peer); stroke: #fff; stroke-width: 1.4; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
.peer-cursor span {
  position: absolute; left: 14px; top: 18px; white-space: nowrap; padding: 2px 8px; border-radius: 99px;
  background: var(--peer); color: #fff; font: 600 11px/1.4 var(--font-body);
}
.peer-cursor.away { opacity: 0; }

/* Janelas de confirmação */
.dialog-overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 5, 8, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.dialog {
  width: min(400px, 100%); padding: 24px; border-radius: 20px;
  background: var(--panel-solid); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.dialog h3 { margin: 0 0 6px; font-size: 20px; }
.dialog p { margin: 0 0 4px; color: var(--muted); line-height: 1.5; }
.dialog-icon {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 14px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
}
.dialog-icon.danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.dialog-icon svg { width: 22px; height: 22px; }
.dialog-field { display: block; margin-top: 14px; font-size: 13px; font-weight: 500; color: var(--muted); }
.dialog-field input { margin-top: 6px; }
.dialog-options { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 260px; overflow-y: auto; }
.dialog-option {
  width: 100%; justify-content: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text); font-size: 14px; font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}
.dialog-option:hover { border-color: var(--border-strong); }
.dialog-option > svg:first-child { width: 17px; height: 17px; color: var(--muted); }
.dialog-option span { flex: 1; text-align: left; }
.dialog-option > svg:last-child { width: 16px; height: 16px; color: var(--accent); opacity: 0; transition: opacity 0.15s; }
.dialog-option.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, var(--bg)); box-shadow: 0 0 0 1px var(--accent) inset; }
.dialog-option.on > svg:first-child { color: var(--accent); }
.dialog-option.on > svg:last-child { opacity: 1; }
.dialog-option:focus-visible { outline: none; }
.dialog-checks .dialog-option span { display: flex; flex-direction: column; gap: 2px; }
.dialog-checks .dialog-option small { color: var(--muted); font-weight: 400; font-size: 12px; }
.dialog-checks .dialog-option { align-items: flex-start; }
.dialog-checks { max-height: 320px; }
.dialog-preview {
  margin-top: 8px; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 400; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; max-height: 320px; overflow-y: auto;
}
/* Nó esperando a IA */
.node.ai-busy { animation: ai-busy 1.1s ease-in-out infinite; }
@keyframes ai-busy { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 24px color-mix(in srgb, var(--accent) 50%, transparent); } }
.ctx-item .ctx-off { margin-left: auto; font-size: 11px; color: var(--muted); }
.dialog-error { color: var(--danger) !important; min-height: 1.4em; font-size: 13px; margin-top: 8px !important; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.dialog-actions button { padding: 9px 18px; border-radius: 11px; }
button.primary.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Toque longo armado (celular): o nó "levanta" */
.node.pressing { scale: 1.06; box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent-2), var(--shadow-lg); transition: scale 0.15s; }

/* Celular: barra mais compacta, painéis em tela cheia */
@media (max-width: 700px) {
  .toolbar { left: 6px; right: 6px; top: 6px; gap: 2px; padding: 4px; }
  .toolbar button { padding: 6px; }
  .toolbar .map-title { max-width: 120px; }
  .toolbar .sep, .toolbar .grow, .toolbar .status, .toolbar .chev, .toolbar #btn-redo, .toolbar #btn-delete { display: none; }
  .drawer { top: auto; left: 6px; right: 6px; bottom: 6px; width: auto; max-height: 70vh; }
  .searchbar { right: 6px; left: 6px; width: auto; }
  .ctx-item { padding: 10px 12px; }
  .library-bar { margin-top: 0; }
  .map-search { width: 100%; }
  .topbar { gap: 2px; margin-bottom: 24px; }
  .topbar .label { display: none; }
  .new-map { flex-wrap: wrap; }
  .new-map input { flex-basis: 100%; }
  .new-map button { flex: 1; justify-content: center; }
  .map-card .actions { opacity: 1; transform: none; }
}

/* Modo apresentação */
body.presenting .toolbar, body.presenting .minimap-wrap, body.presenting .help, body.presenting .banner,
body.presenting .notif-pop, body.presenting .peer-cursor { display: none !important; }
body.presenting .node { transition: opacity 0.6s, box-shadow 0.4s; }
body.presenting .node.pres-dim { opacity: 0.05 !important; }
body.presenting .node.pres-current { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px color-mix(in srgb, var(--accent) 70%, transparent), var(--shadow-lg); }
body.presenting #links path.branch { transition: opacity 0.6s; }
.pres-bar {
  position: fixed; left: 50%; bottom: 22px; translate: -50% 0; z-index: 30; display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: 99px; background: var(--panel); backdrop-filter: blur(18px); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.pres-bar button { border-radius: 99px; min-width: 40px; height: 40px; justify-content: center; font-size: 18px; }
.pres-info { display: flex; flex-direction: column; align-items: center; min-width: 180px; max-width: 46vw; padding: 0 8px; }
.pres-info strong { font-family: var(--font-display); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pres-info .muted { font-size: 12px; }
.banner { cursor: default; }
.banner[onclick], .banner.clickable { cursor: pointer; }

/* #Etiquetas */
.node .tag { color: var(--accent); font-weight: 600; }
.node.root .tag { color: #fff; text-decoration: underline; }
.node .tag.on { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 5px; padding: 0 2px; }
.node.tag-dim { opacity: 0.18 !important; }
.tagbar {
  position: fixed; top: 72px; left: 50%; translate: -50% 0; z-index: 11; display: flex; align-items: center; gap: 8px;
  max-width: min(760px, calc(100vw - 24px)); padding: 6px 6px 6px 12px;
  background: var(--panel); backdrop-filter: blur(18px); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.tagbar > svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; }

/* Prazo e responsável */
.node .task-chip { color: var(--text); }
.node .task-chip.today { color: #b77800; border-color: #e3b505; }
.node .task-chip.late { color: #fff; background: var(--danger); border-color: var(--danger); }
.avatar.tiny { width: 18px; height: 18px; font-size: 8.5px; margin: 0 0 0 2px; border-width: 0; display: inline-grid; }
.task-box { margin-top: 4px; }
.chip.person { gap: 6px; }
.date-input { width: auto; padding: 5px 10px; border-radius: 99px; font-size: 13px; color-scheme: light dark; }

/* Comparar versões */
.node.diff-added { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px #22a55b, var(--shadow); }
.node.diff-changed { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px #e3b505, var(--shadow); }
.diff-box { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.diff-section { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.diff-item { justify-content: flex-start; text-align: left; padding: 5px 8px; border-radius: 8px; font-size: 13px; background: var(--bg); }
.diff-item.added { color: #22a55b; }
.diff-item.changed { color: #c99a00; }
.diff-item.removed { color: var(--danger); padding: 5px 8px; }

/* Paleta de comandos */
.palette-overlay { place-items: start center; padding-top: 12vh; }
.palette { width: min(620px, 100%); border-radius: 18px; overflow: hidden; background: var(--panel-solid); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.palette-input svg { width: 18px; height: 18px; color: var(--muted); }
.palette-input input { border: 0; background: transparent; font-size: 16px; padding: 4px 0; box-shadow: none !important; }
.palette-input kbd { font: 11px var(--font-body); color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette-list .muted { padding: 10px; margin: 0; }
.palette-item { width: 100%; justify-content: flex-start; gap: 12px; border: 0; background: transparent; padding: 9px 12px; border-radius: 10px; text-align: left; }
.palette-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.palette-item.active, .palette-item:hover { background: var(--bg-2); }
.palette-item.active svg { color: var(--accent); }
.palette-label { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.palette-label small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item em { font-style: normal; font-size: 11.5px; color: var(--muted); }

/* Prévia de onde o nó arrastado vai cair */
.drop-ghost {
  position: absolute; z-index: 1; pointer-events: none; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; padding: 0 12px;
  border: 2px dashed var(--accent); border-radius: 14px; color: var(--muted); font-size: 13px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
#links path.drop-preview { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 6 5; }

/* Ajuda recolhível */
.help { padding-right: 34px; }
.help #help-toggle { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; padding: 0; justify-content: center; font-size: 13px; }
.help.collapsed { padding: 0; width: 40px; height: 40px; border-radius: 50%; }
.help.collapsed > div { display: none; }
.help.collapsed #help-toggle { inset: 0; width: 100%; height: 100%; font-weight: 700; font-size: 15px; border-radius: 50%; }

/* Seleção múltipla */
.node.selected.primary { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--select), var(--shadow); }
.marquee {
  position: fixed; z-index: 15; pointer-events: none; border-radius: 6px;
  border: 1.5px dashed var(--select); background: color-mix(in srgb, var(--select) 10%, transparent);
}

/* Botão de recolher no organograma (embaixo) e nos tópicos (à esquerda) */
.node .toggle.down { top: auto; bottom: -28px; left: 50%; translate: -50% 0; }
.node .toggle.list { left: -28px; }

/* Minimapa */
.minimap-wrap {
  position: fixed; left: 12px; bottom: 12px; z-index: 6; width: 250px; height: 165px;
  background: var(--panel); backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm);
  overflow: hidden; transition: width 0.3s, height 0.3s;
}
.minimap-wrap canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.minimap-wrap #minimap-toggle { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; padding: 0; justify-content: center; font-size: 11px; }
.minimap-wrap.collapsed { width: 34px; height: 30px; }
.minimap-wrap.collapsed canvas { visibility: hidden; }
.minimap-wrap.collapsed #minimap-toggle { transform: rotate(180deg); }
@media (max-width: 700px) { .minimap-wrap { display: none; } }
.ctx-row { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px 6px; }
.ctx-row .emoji { width: 30px; padding: 3px 0; font-size: 15px; border-radius: 8px; }
.ctx-row .swatch { width: 20px; height: 20px; margin: 2px; }
.ctx-row .swatch.on { box-shadow: 0 0 0 2px var(--text); }

.searchbar {
  position: fixed; top: 72px; right: 12px; z-index: 11; display: flex; align-items: center; gap: 4px;
  padding: 6px 6px 6px 12px; width: min(380px, calc(100vw - 24px));
  background: var(--panel); backdrop-filter: blur(18px); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.searchbar > svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.searchbar input { border: 0; background: transparent; padding: 6px; box-shadow: none !important; }
.searchbar .muted { font-size: 12px; white-space: nowrap; }
.searchbar { flex-wrap: wrap; }
.searchbar > input { flex: 1; min-width: 0; }
.replace-row { flex-basis: 100%; display: flex; align-items: center; gap: 4px; padding: 4px 0 0 22px; border-top: 1px solid var(--border); margin-top: 4px; }
.replace-row input { flex: 1; min-width: 0; }
.replace-row button { padding: 5px 9px; font-size: 12.5px; }
#search-replace-toggle.on { color: var(--accent); }
/* Texto com destaque nos nós */
.node .text strong { font-weight: 700; }
.node .text em { font-style: italic; }
.node .text code, .help code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.9em; padding: 0 4px; border-radius: 5px; background: color-mix(in srgb, var(--text) 12%, transparent); }
.menu button kbd { margin-left: auto; font-size: 11px; color: var(--muted); }

.drawer {
  position: fixed; top: 72px; right: 12px; bottom: 12px; z-index: 12; width: min(360px, calc(100vw - 24px));
  display: flex; flex-direction: column;
  background: var(--panel); backdrop-filter: blur(18px); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.drawer header { display: flex; align-items: center; padding: 12px 10px 8px 16px; }
.drawer header h3 { margin: 0; flex: 1; font-size: 17px; }
.drawer-body { overflow-y: auto; padding: 0 12px 14px; flex: 1; }
.version { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel-solid); }
.version .when { font-weight: 600; }
.version .meta { color: var(--muted); font-size: 12.5px; }
.version .row { margin-top: 8px; }
.version .row button { padding: 5px 10px; font-size: 13px; }
.outline { margin: 8px 0 0; padding: 8px 10px; background: var(--bg); border-radius: 8px; font-size: 12.5px; max-height: 240px; overflow: auto; white-space: pre; }

.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 8, 16, 0.82); backdrop-filter: blur(6px);
  display: grid; place-items: center; cursor: zoom-out;
}
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 12px; box-shadow: var(--shadow-lg); }
.help {
  position: fixed; right: 12px; bottom: 12px; font-size: 12px; max-width: 340px; z-index: 5; line-height: 1.8;
  background: var(--panel); backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm); color: var(--muted);
}
.help kbd { background: var(--panel-solid); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font: 11px var(--font-body); color: var(--text); }
.upload-progress {
  position: fixed; left: 50%; bottom: 20px; translate: -50% 0; z-index: 20;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 13px; box-shadow: var(--shadow-lg);
}

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 300px; padding: 28px 20px; }
  .help { display: none; }
  .toolbar .label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .badge::before { animation: none; }
}
/* Cores dentro do menu "Nó": bolinhas, não itens de largura total */
.menu .swatches { padding: 4px 10px 8px; gap: 6px; }
.menu .swatches .swatch { width: 22px; height: 22px; min-width: 0; padding: 0; flex: none; border-radius: 50%; justify-content: center; font-size: 12px; color: #fff; }
.menu .swatches .swatch:hover { background: inherit; outline: 2px solid var(--border-strong); outline-offset: 1px; }
.menu.menu-center { min-width: 290px; }
.menu button { white-space: nowrap; }
