/* ============================================================================
   KOS KLIMA Intranet – Organigramm-Schaubild (app/org.js)
   ----------------------------------------------------------------------------
   Gilt für die versteckte Seite im Portal UND für den Bildschirm im Haus
   (organigramm.html lädt nur ds-tokens.css und diese Datei).

   Das Schaubild selbst ist absolut gesetzt: app/org.js rechnet jede Karte in
   festen Entwurfseinheiten aus und skaliert die ganze Bühne. Die Pixelwerte
   unten (Schriftgrößen, Radien) gelten deshalb bei Maßstab 1 – auf einem
   4K-Fernseher werden sie mit der Bühne größer.

   Die Kopfzeile darüber rechnet in em: org.js setzt die Grundschrift der
   Ansicht aus ihrer Breite (1920 px Breite = 16 px).

   Für Browser in Fernsehern bewusst zurückhaltend: keine Flex-Abstände per
   "gap", kein color-mix(), kein "inset" – nur, was auch ältere Geräte kennen.
   ========================================================================== */

/* ---------------------------------------------------------------- Ansicht */
.org-view {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: #fff;
  font-family: var(--font-body);
  background: #1f3a5a;
  background: radial-gradient(ellipse at 50% -10%, #34516f 0%, #243f5d 42%, #1b2c43 100%);
}

.org-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  height: 4.6em;
  padding: 0 2.2em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.org-top-logo { height: 2.7em; margin-right: 1.5em; display: flex; align-items: center; }
.org-top-logo img,
.org-top-logo svg { height: 100%; width: auto; display: block; }
.org-top-txt { flex: 1 1 auto; min-width: 0; }
.org-top-title {
  font: 700 1.8em/1.05 var(--font-headline);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
}
.org-top-sub {
  margin-top: 0.25em;
  font-size: 0.95em;
  color: rgba(255, 255, 255, 0.66);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.org-top-meta { margin-left: 1.5em; text-align: right; font-size: 0.95em; line-height: 1.45; color: rgba(255, 255, 255, 0.7); }
.org-top-meta span { display: block; white-space: nowrap; }
.org-top-meta strong { color: #fff; font-family: var(--font-headline); font-size: 1.3em; }

.org-fit { position: relative; flex: 1 1 auto; overflow: hidden; }
.org-fit.org-scroll { overflow: auto; }
.org-sizer { position: relative; margin: 0 auto; }
.org-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

/* Verbindungslinien */
.org-links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.org-links path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ----------------------------------------------------------------- Teams */
.org-team {
  position: absolute;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.org-staff { background: rgba(108, 173, 198, 0.09); border-style: dashed; border-color: rgba(255, 255, 255, 0.2); }
.org-thead {
  position: absolute;
  display: flex;
  align-items: center;
  padding: 0 14px 0 20px;
  border-radius: 18px 18px 8px 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
.org-tname {
  flex: 1 1 auto;
  min-width: 0;
  font: 700 22px/1.12 var(--font-headline);
  letter-spacing: 0.02em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.org-tcount {
  flex: 0 0 auto;
  margin-left: 12px;
  min-width: 40px;
  height: 40px;
  padding: 0 9px;
  box-sizing: border-box;
  border: 2px solid;
  border-radius: 20px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 18px/1 var(--font-headline);
}

/* ---------------------------------------------------------------- Karten */
.org-card {
  position: absolute;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 0 14px 0 20px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(10, 22, 40, 0.3);
  overflow: hidden;
}
.org-card:before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 7px;
  background: var(--tc);
}
/* Teamleitung: ganze Karte in der Teamfarbe (sie steht mittig in der ersten
   Reihe des Teams), Schrift in Weiß oder Navy – was mehr Kontrast hat (--ink
   setzt org.js). Ein heller Rand hebt auch dunkle Teamfarben vom Hintergrund
   ab, der weiße Ring das Bild von der gleichfarbigen Karte. */
.org-card.org-lead {
  background: var(--tc);   /* ohne CSS-Variablen bleibt sie weiß und lesbar */
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6), 0 10px 26px rgba(10, 22, 40, 0.42);
}
.org-card.org-lead:before { display: none; }
.org-card.org-lead .org-name { color: var(--ink); font-weight: 700; }
.org-card.org-lead .org-title { color: var(--ink); opacity: 0.86; }
.org-card.org-lead .org-av { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92); }

.org-av {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  margin-right: 14px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 21px/1 var(--font-headline);
  letter-spacing: 0.02em;
}
.org-av img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; }
.org-av-lg { width: 108px; height: 108px; margin-right: 24px; font-size: 38px; }

.org-txt { position: relative; z-index: 1; flex: 1 1 auto; min-width: 0; }
/* Name bis zu zwei Zeilen (lange Doppelnamen werden sonst abgeschnitten),
   die Funktion darunter einzeilig – zusammen passt das immer in die Karte. */
.org-name {
  font: 600 20.5px/1.15 var(--font-headline);
  color: #1f3a5a;
  overflow: hidden;
  word-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.org-name.org-long { font-size: 18px; }
.org-title {
  margin-top: 3px;
  font-size: 15px;
  line-height: 1.25;
  color: #55627a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Spitze */
.org-headcard {
  position: absolute;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 0 32px;
  background: #fff;
  border-radius: 22px;
  border-top: 8px solid #6CADC6;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}
.org-headcard .org-name { font-size: 32px; font-weight: 700; }
.org-headcard .org-title { font-size: 19px; margin-top: 6px; white-space: normal; }
.org-headcard.org-empty { background: rgba(255, 255, 255, 0.08); border: 2px dashed rgba(255, 255, 255, 0.45); box-shadow: none; }
.org-headcard.org-empty .org-name,
.org-headcard.org-empty .org-title { color: #fff; }

/* ------------------------------------------------- Meldungen (Bildschirm) */
.org-msg { margin: auto; padding: 2em; max-width: 42em; text-align: center; }
.org-msg-over { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); }
.org-msg-logo svg { height: 4em; width: auto; margin-bottom: 1.6em; }
.org-msg-title { font: 700 1.6em/1.25 var(--font-headline); color: #fff; }
.org-msg-text { margin-top: 0.8em; font-size: 1.05em; line-height: 1.55; color: rgba(255, 255, 255, 0.72); }
.org-offline {
  display: none;
  position: absolute;
  right: 1.4em;
  bottom: 1.1em;
  padding: 0.35em 0.9em;
  border-radius: 999px;
  font-size: 0.85em;
  color: #fff;
  background: rgba(160, 38, 34, 0.75);
}

/* Bildschirmseite (organigramm.html) */
html.org-tvhtml,
body.org-tvbody { height: 100%; margin: 0; overflow: hidden; background: #1b2c43; }
body.org-tvbody #org-root { position: fixed; left: 0; top: 0; right: 0; bottom: 0; }
body.org-tvbody .org-view { transition: transform 2s ease; }
body.org-nocursor,
body.org-nocursor * { cursor: none !important; }

/* ---------------------------------------------------------- Portal: Seite */
.org-bar { display: flex; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.org-bar .btn { margin: 0 6px 6px 0; }
.org-bar .btn svg { width: 14px; height: 14px; }
.org-bar .btn[disabled] { opacity: 0.45; cursor: default; }
.org-bar-sep { display: inline-block; width: 1px; height: 24px; margin: 0 10px 6px 4px; background: var(--hairline-strong); }
.org-bar-group { display: inline-flex; align-items: center; }
.org-bar-note { margin: 0 0 6px 6px; font-size: 13px; color: var(--text-meta); }
.org-bar-note.org-dirty { color: #8a5a00; font-weight: 600; }

.org-shell {
  position: relative;
  min-height: 360px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #1b2c43;
  box-shadow: var(--shadow-card-dark);
}
.org-shell:fullscreen { border-radius: 0; height: 100vh !important; width: 100vw; }
/* eigene Regel: ein unbekannter Selektor würde sonst die ganze Liste ungültig machen */
.org-shell:-webkit-full-screen { border-radius: 0; height: 100vh !important; width: 100vw; }
.org-shell.org-narrow { min-height: 0; overflow: visible; border-radius: 0; background: transparent; box-shadow: none; }
.org-shell.org-narrow .org-view { height: auto; overflow: visible; color: inherit; background: none; }
.org-shell.org-narrow .org-msg-title { color: var(--text-heading); }

/* Bearbeiten */
.org-editing .org-card,
.org-editing .org-thead,
.org-editing .org-headcard { cursor: pointer; }
.org-editing .org-card:hover,
.org-editing .org-headcard:hover { box-shadow: 0 0 0 4px #6CADC6, 0 8px 22px rgba(10, 22, 40, 0.3); }
/* Auf einer Karte in der Teamfarbe ginge der blaue Rahmen unter */
.org-editing .org-card.org-lead:hover { box-shadow: 0 0 0 4px #fff, 0 8px 22px rgba(10, 22, 40, 0.3); }
.org-editing .org-thead:hover { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.85); }
.org-editing .org-card[draggable="true"] { cursor: grab; }
.org-ghost {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 2px dashed rgba(255, 255, 255, 0.38);
  border-radius: 14px;
  font: 600 17px/1 var(--font-headline);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}
.org-ghost:hover { border-color: #6CADC6; color: #fff; background: rgba(108, 173, 198, 0.14); }
.org-ghost-plus { font-size: 30px; margin-right: 10px; line-height: 1; }
.org-dragging { opacity: 0.35; }
.org-drop { outline: 4px solid #6CADC6 !important; outline-offset: 3px; }
.org-team.org-drop { background: rgba(108, 173, 198, 0.2); }
/* Team auf den Kopf eines anderen gezogen: Balken auf der Seite, auf der es
   eingereiht wird */
.org-thead.org-drop-l:after,
.org-thead.org-drop-r:after {
  content: "";
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 8px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 0 0 3px #6CADC6;
}
.org-thead.org-drop-l:after { left: -19px; }
.org-thead.org-drop-r:after { right: -19px; }
/* Team in die Fläche eines anderen gezogen: wird dessen Unterteam */
.org-team.org-drop-in:after {
  content: "Als Unterteam einordnen";
  position: absolute;
  left: 50%;
  bottom: -40px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
  font: 600 17px/1.2 var(--font-headline);
  color: #1f3a5a;
  background: #fff;
  box-shadow: 0 0 0 3px #6CADC6;
  pointer-events: none;
  z-index: 5;
}

.org-emptybox {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 560px;
  max-width: 90%;
  transform: translate(-50%, -50%);
  padding: 24px 28px;
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-menu);
  text-align: center;
  font-size: 14px;
  line-height: 1.55;
}
.org-emptybox-title { font: 700 20px/1.2 var(--font-headline); color: var(--text-heading); margin-bottom: 8px; }
.org-emptybox .btn { margin: 8px 4px 0; }
.org-emptybox .btn svg { width: 15px; height: 15px; }

/* Ablage "Nicht zugeordnet" */
.org-pool { margin-top: 16px; }
.org-pool.org-drop { outline: 3px solid var(--blue-light) !important; }
.org-pool .card-header { flex-wrap: wrap; }
.org-pool-hint { font-size: 12.5px; color: var(--text-meta); }
.org-pool-empty { padding: 2px 2px 8px; font-size: 13px; color: var(--text-meta); }
.org-pool-list { display: flex; flex-wrap: wrap; }
.org-chip {
  display: flex;
  align-items: center;
  width: 250px;
  margin: 0 10px 10px 0;
  padding: 8px 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  background: #fff;
  cursor: grab;
}
.org-chip:hover { border-color: var(--blue-light); }
.org-chip .org-av { width: 38px; height: 38px; margin-right: 10px; font-size: 14px; }
.org-chip .org-name { font-size: 14px; }
.org-chip .org-title { font-size: 12px; -webkit-line-clamp: 1; }

/* Schmale Ansicht: Liste */
.org-list-head,
.org-list-team { margin-bottom: 14px; border-radius: 14px; background: #fff; box-shadow: var(--shadow-pill); overflow: hidden; }
.org-list-head { display: flex; align-items: center; padding: 14px 16px; border-top: 5px solid #6CADC6; }
.org-list-thead { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font: 700 15px/1.2 var(--font-headline); }
.org-list-thead small { margin-left: 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.8; }
.org-list-row { position: relative; display: flex; align-items: center; padding: 9px 14px; border-top: 1px solid var(--hairline); }
/* Teamleitung in der Liste: Streifen und Hauch der Teamfarbe, fett */
.org-list-row.org-lead:before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--tc);
}
.org-list-row.org-lead:after {
  content: "";
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  background: var(--tc);
  opacity: 0.16;
  pointer-events: none;
}
.org-list-row.org-lead .org-name { font-weight: 700; }
/* Unterteam: eingerückt (Maß setzt org.js je Ebene), mit Anschlusslinie */
.org-list-team.org-list-sub { position: relative; overflow: visible; }
.org-list-team.org-list-sub:before {
  content: "";
  position: absolute;
  left: -12px;
  top: -14px;
  width: 8px;
  height: 34px;
  border-left: 2px solid var(--hairline-strong);
  border-bottom: 2px solid var(--hairline-strong);
  border-bottom-left-radius: 6px;
}
.org-list-sub .org-list-thead { border-radius: 14px 14px 0 0; }
.org-list-sub .org-list-row:last-child { border-radius: 0 0 14px 14px; }
.org-list .org-av { width: 40px; height: 40px; margin-right: 12px; font-size: 15px; }
.org-list .org-name { font-size: 15px; }
.org-list .org-title { font-size: 12.5px; }

/* ---------------------------------------------------------------- Dialoge */
.org-form { display: flex; flex-direction: column; }
.org-form > * + * { margin-top: 12px; }
.org-form p { margin: 0; font-size: 13.5px; line-height: 1.55; }
.org-form-photo { display: flex; align-items: center; }
.org-form-photo .org-av-lg { width: 84px; height: 84px; margin-right: 16px; font-size: 30px; }
.org-form-photo-btns .btn { margin: 0 6px 6px 0; }
.org-form-photo-btns .btn svg { width: 14px; height: 14px; }
.org-form-photo-btns .org-nophoto { margin: 2px 0 2px; font-size: 13px; }
.org-form-note { margin-top: 4px; font-size: 12px !important; color: var(--text-meta); }
.org-form .org-off { opacity: 0.5; cursor: default; }
/* Team-Dialog: Teamleitung anhaken */
.org-lead-pick {
  max-height: 232px;
  overflow-y: auto;
  padding: 4px 0;
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
}
.org-lead-opt {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 13.5px;
  cursor: pointer;
}
.org-lead-opt:hover { background: var(--accent-08); }
.org-lead-opt input { flex: 0 0 auto; width: auto; margin: 0 10px 0 0; }
.org-lead-opt span { min-width: 0; }
.org-lead-opt small { margin-left: 6px; font-size: 12px; color: var(--text-meta); }
.org-form-actions { display: flex; flex-wrap: wrap; align-items: center; padding-top: 12px; border-top: 1px solid var(--hairline); }
.org-form-actions .btn { margin: 0 6px 6px 0; }
.org-form-actions .btn svg { width: 14px; height: 14px; }
.org-spacer { flex: 1 1 auto; }
.btn.org-danger { color: var(--danger); border-color: rgba(201, 48, 44, 0.35); }
.org-swatches { display: flex; flex-wrap: wrap; }
.org-swatch {
  width: 34px;
  height: 34px;
  margin: 0 8px 8px 0;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--hairline-strong);
  cursor: pointer;
}
.org-swatch.on { box-shadow: 0 0 0 3px var(--blue-dark); }
.org-link-row { display: flex; align-items: center; }
.org-link-row .field-input { flex: 1 1 auto; min-width: 0; margin-right: 8px; font-size: 12.5px; }
.org-link-row .btn { margin-right: 6px; white-space: nowrap; }
.org-link-row .btn svg { width: 14px; height: 14px; }

/* Abgleich: breiterer Dialog mit Liste */
.modal:has(.org-wide) { max-width: 820px; }
.org-sync-meta { font-size: 12.5px; color: var(--text-meta); }
.org-sync-meta a,
.org-form-note a { color: var(--blue-dark); font-weight: 600; }
.org-sync-head { margin-top: 18px !important; font: 700 12px/1 var(--font-headline); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-meta); }
.org-sync-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--hairline-strong); border-radius: 10px; }
.org-sync-row { display: flex; align-items: center; padding: 8px 12px; border-top: 1px solid var(--hairline); }
.org-sync-row:first-child { border-top: 0; }
.org-sync-who { flex: 1 1 auto; min-width: 0; margin-right: 12px; }
.org-sync-who strong { display: block; font: 600 14px/1.3 var(--font-headline); color: var(--text-heading); }
.org-sync-who span { display: block; font-size: 12px; color: var(--text-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-sync-row select { flex: 0 0 auto; width: 240px; }
.org-sync-gone { cursor: pointer; }
.org-sync-gone input { margin: 0 12px 0 0; width: auto; }
@media (max-width: 640px) {
  .org-sync-row { flex-wrap: wrap; }
  .org-sync-row select { width: 100%; margin-top: 6px; }
}
