/* kreativloft Mindmap – nach CI/CD-Manual 2026
   Palette: Schwarz #000000 · Dunkelgrau #575756 · Hellgrau #B2B2B2 · Weiss #FFFFFF
   Schrift: Source Code Pro 600 (Titel, Buttons, Labels) · Source Sans 3 (Fliesstext) */
:root {
  --black: #000000;
  --grey-dark: #575756;
  --grey-light: #B2B2B2;
  --white: #FFFFFF;
  --black-40: rgba(0, 0, 0, .4);
  --dark-20: rgba(87, 87, 86, .2);
  --dark-08: rgba(87, 87, 86, .08);
  --line: rgba(87, 87, 86, .22);
  --mono: 'Source Code Pro', ui-monospace, monospace;
  --sans: 'Source Sans 3', system-ui, sans-serif;
  --side-w: 272px;
  --text-w: 360px;
  --bar-h: 60px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 15px/1.5 var(--sans); color: var(--grey-dark); background: var(--white); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: var(--black); }
h1, h2, h3 { font-family: var(--mono); font-weight: 600; color: var(--black); margin: 0; letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
svg { stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--grey-dark); opacity: .8; }
.small { font-size: 13px; line-height: 1.45; margin: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1.5px solid transparent;
  font: 600 13px/1 var(--mono); white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: var(--grey-dark); }
.btn-ghost { background: transparent; color: var(--black); }
.btn-ghost:hover { background: var(--dark-08); }
.btn-ghost[aria-pressed="true"] { border-color: var(--black); }
.btn:disabled { opacity: .35; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--black); }
.icon-btn:hover { background: var(--dark-08); }
.icon-btn svg { width: 19px; height: 19px; }

/* Anmeldung */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; background: var(--white); }
.login-card { width: min(360px, 100%); display: grid; gap: 14px; }
.login-logo { width: 96px; height: auto; margin-bottom: 18px; }
.login h1 { font-size: 34px; margin-bottom: 12px; }
.setup-note { margin: -4px 0 6px; color: var(--black); }
label { display: grid; gap: 6px; font: 600 12px/1.2 var(--mono); color: var(--grey-dark); }
input:not([type=checkbox]), .outline { width: 100%; height: 42px; padding: 0 12px; border: 1.5px solid var(--grey-light); border-radius: 10px; background: var(--white); font: 400 15px var(--sans); }
input:focus, textarea:focus { outline: none; border-color: var(--black); }
.form-error { min-height: 1.2em; margin: 0; color: var(--black); font-weight: 600; font-size: 14px; }
.form-error:not(:empty)::before { content: ''; display: inline-block; width: 8px; height: 8px; background: var(--black); border-radius: 2px; margin-right: 8px; vertical-align: 1px; }
.check { display: flex; align-items: center; gap: 8px; font: 400 14px var(--sans); color: var(--black); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--black); }

/* Layout */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; height: 100%; }
.sidebar { display: flex; flex-direction: column; min-height: 0; border-right: 1.5px solid var(--line); background: var(--white); }
.sidebar-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.side-logo { width: 40px; height: auto; }
.sidebar-head strong { display: block; font: 600 16px/1.1 var(--mono); color: var(--black); }
.sidebar-head .muted { font-size: 13px; }
.side-close { display: none; margin-left: auto; }
.search { margin: 0 14px 10px; width: auto !important; height: 36px !important; font-size: 14px !important; }
.catalogs { flex: 1; overflow: auto; padding: 4px 8px 12px; }
.cat { margin-bottom: 6px; }
.cat-head { display: flex; align-items: center; gap: 4px; padding: 8px 6px 6px 10px; }
.cat-name { flex: 1; font: 600 13px/1.2 var(--mono); color: var(--black); background: none; border: 0; padding: 0; text-align: left; display: flex; align-items: center; gap: 8px; }
.cat-name .count { font-weight: 400; color: var(--grey-light); }
.cat-name svg { width: 14px; height: 14px; transition: transform .15s; }
.cat.closed .cat-name svg { transform: rotate(-90deg); }
.cat.closed .cat-maps { display: none; }
.cat-head .icon-btn { width: 28px; height: 28px; opacity: 0; }
.cat-head:hover .icon-btn, .cat-head:focus-within .icon-btn { opacity: 1; }
.cat-maps { list-style: none; margin: 0; padding: 0; }
.map-item { display: flex; align-items: center; border-radius: 9px; }
.map-item a { flex: 1; min-width: 0; display: block; padding: 7px 10px 7px 32px; color: var(--black); text-decoration: none; border-radius: 9px; }
.map-item a span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-item a small { display: block; font-size: 12px; color: var(--grey-dark); opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-item:hover { background: var(--dark-08); }
.map-item.active { background: var(--black); }
.map-item.active a, .map-item.active a small, .map-item.active .icon-btn { color: var(--white); }
.map-item .icon-btn { width: 28px; height: 28px; opacity: 0; margin-right: 4px; }
.map-item:hover .icon-btn, .map-item.active .icon-btn, .map-item:focus-within .icon-btn { opacity: 1; }
.map-item.active .icon-btn:hover { background: rgba(255,255,255,.15); }
.cat-empty { padding: 4px 10px 8px 32px; font-size: 13px; color: var(--grey-dark); opacity: .7; }
.add-catalog { margin: 0 14px 12px; justify-content: flex-start; }
.sidebar-foot { display: flex; align-items: center; gap: 4px; padding: 12px 12px 14px; border-top: 1.5px solid var(--line); }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px; border-radius: 9px; text-align: left; color: var(--black); }
.me:hover { background: var(--dark-08); }
.me span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--grey-dark); color: var(--white); font: 600 12px var(--mono); }

/* Kontextmenü */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px; padding: 6px; background: var(--white); border: 1.5px solid var(--black); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px; font: 400 14px var(--sans); color: var(--black); }
.menu button:hover, .menu button:focus-visible { background: var(--dark-08); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu .danger { font-weight: 600; }
.floating-menu { position: fixed; }

/* Kopfzeile */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: var(--bar-h); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1.5px solid var(--line); }
.side-open { display: none; }
.title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.crumb { font: 400 12px/1 var(--mono); color: var(--grey-dark); opacity: .8; height: 13px; }
.map-title { border: 1.5px solid transparent !important; height: 32px !important; padding: 0 6px !important; margin-left: -7px; font: 600 18px var(--mono) !important; color: var(--black); background: transparent !important; text-overflow: ellipsis; }
.map-title:hover:not(:disabled) { border-color: var(--grey-light) !important; }
.map-title:focus { border-color: var(--black) !important; }
.map-title:disabled { color: var(--grey-light); }
.presence { display: flex; flex-direction: row-reverse; }
.presence .avatar { width: 30px; height: 30px; border: 2px solid var(--white); margin-left: -8px; }
.presence .avatar.me-av { background: var(--black); }
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--grey-dark); flex: none; }
.conn.off { background: transparent; border: 1.5px solid var(--black); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.toolbar { display: flex; align-items: center; gap: 2px; }
.toolbar .btn-ghost { padding: 0 10px; }

/* Arbeitsfläche */
.workspace { flex: 1; min-height: 0; display: flex; }
.stage { position: relative; flex: 1; min-width: 0; overflow: hidden; outline: none; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage.panning { cursor: grabbing; }
.canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; stroke: none; }
.edge { fill: none; stroke-linecap: round; }
.node { cursor: grab; }
.node.dragging { cursor: grabbing; }
.node .tile { transition: stroke-width .1s; }
.node.drop-target .tile { stroke: var(--black); stroke-width: 3; stroke-dasharray: 6 4; }
.node .sel-ring { fill: none; stroke: var(--black); stroke-width: 2; opacity: 0; }
.node.selected .sel-ring { opacity: 1; }
.node .remote-ring { fill: none; stroke: var(--grey-dark); stroke-width: 1.5; stroke-dasharray: 3 3; }
.node text { font-family: var(--sans); pointer-events: none; }
.node .badge text { font: 600 11px var(--mono); }
.node .badge { cursor: pointer; }

.editor { position: absolute; z-index: 20; resize: none; overflow: hidden; border: 2px solid var(--black); border-radius: 10px; padding: 8px 12px; background: var(--white); color: var(--black); text-align: center; box-shadow: 0 8px 26px rgba(0,0,0,.18); line-height: 1.3; }
.node-bar { position: absolute; z-index: 15; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--white); border: 1.5px solid var(--black); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.12); transform: translate(-50%, -100%); }
.node-bar button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; color: var(--black); }
.node-bar button:hover { background: var(--dark-08); }
.node-bar button svg { width: 18px; height: 18px; }
.node-bar .sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.sw::after { content: ''; width: 16px; height: 16px; border-radius: 5px; display: block; }
.sw-schwarz::after { background: var(--black); }
.sw-dunkelgrau::after { background: var(--grey-dark); }
.sw-hellgrau::after { background: var(--grey-light); }
.sw-weiss::after { background: var(--white); box-shadow: inset 0 0 0 1.5px var(--grey-dark); }
.sw.on { box-shadow: inset 0 0 0 1.5px var(--black); }

.cursors { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cursor { position: absolute; left: 0; top: 0; transition: transform .08s linear; }
.cursor svg { width: 18px; height: 18px; fill: var(--grey-dark); stroke: var(--white); stroke-width: 1.2; }
.cursor span { position: absolute; left: 14px; top: 16px; padding: 2px 7px; border-radius: 6px; background: var(--grey-dark); color: var(--white); font: 600 11px var(--mono); white-space: nowrap; }

.zoom { position: absolute; left: 16px; bottom: 16px; display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--white); border: 1.5px solid var(--line); border-radius: 12px; }
.zoom-val { min-width: 58px; height: 34px; border: 0; background: none; border-radius: 9px; font: 600 12px var(--mono); color: var(--black); }
.zoom-val:hover { background: var(--dark-08); }
.hint { position: absolute; right: 16px; bottom: 16px; margin: 0; max-width: 420px; text-align: right; font-size: 13px; color: var(--grey-dark); opacity: .75; pointer-events: none; }

.empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; padding: 24px; background: var(--white); }
.empty img { width: 72px; height: auto; margin-bottom: 8px; }
.empty h2 { font-size: 22px; }
.empty p { margin: 0 0 8px; max-width: 34ch; }

/* Texteingabe */
.textpanel { width: var(--text-w); flex: none; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-left: 1.5px solid var(--line); background: var(--white); min-height: 0; }
.tp-head { display: flex; align-items: center; justify-content: space-between; }
.tp-head h2 { font-size: 15px; }
.outline { flex: 1; min-height: 200px; height: auto; padding: 12px; resize: none; font: 400 14px/1.6 var(--mono); tab-size: 2; white-space: pre; overflow: auto; }

/* Dialoge */
.dlg { border: 1.5px solid var(--black); border-radius: 16px; padding: 0; width: min(440px, calc(100% - 32px)); color: var(--grey-dark); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dlg::backdrop { background: var(--black-40); }
.dlg form, .dlg-pad { display: grid; gap: 14px; padding: 22px; }
.dlg h2 { font-size: 18px; }
.dlg h3 { font-size: 14px; margin-top: 10px; }
.dlg p { margin: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dlg-wide { width: min(640px, calc(100% - 32px)); }
.dlg select { width: 100%; height: 42px; padding: 0 10px; border: 1.5px solid var(--grey-light); border-radius: 10px; font: 400 15px var(--sans); background: var(--white); color: var(--black); }
.users { width: 100%; border-collapse: collapse; font-size: 14px; }
.users td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users td:first-child { color: var(--black); }
.users small { display: block; color: var(--grey-dark); opacity: .8; font-family: var(--mono); font-size: 12px; }
.users .actions { text-align: right; white-space: nowrap; }
.users .actions .btn { height: 30px; padding: 0 10px; font-size: 12px; }
.tag { display: inline-block; padding: 2px 7px; border-radius: 6px; border: 1.5px solid var(--grey-dark); font: 600 11px var(--mono); color: var(--grey-dark); }
.tag.off { border-style: dashed; }
.user-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.user-form label:nth-child(3), .user-form .check, .user-form .form-error, .user-form .btn { grid-column: 1 / -1; }
.user-form .btn { justify-self: start; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 20px); padding: 11px 18px; border-radius: 12px; background: var(--black); color: var(--white); font: 600 13px var(--mono); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Mobil */
@media (max-width: 1100px) {
  .toolbar .btn span { display: none; }
  .hint { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(var(--side-w), 86vw); z-index: 50; transform: translateX(-102%); transition: transform .2s; }
  .app.side-visible .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .side-close, .side-open { display: inline-grid; }
  .topbar { padding: 0 8px; gap: 6px; }
  .presence, .crumb { display: none; }
  .textpanel { position: absolute; inset: auto 0 0 0; width: auto; height: 50%; border-left: 0; border-top: 1.5px solid var(--black); z-index: 25; }
  .workspace { position: relative; }
  .map-item .icon-btn, .cat-head .icon-btn { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
