/* IB-Verwaltung - im Look von iamleogs.de: Anthrazit, Champagner, Instrument Serif und Geist. */

@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/instrument-serif-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/instrument-serif-latin-ext-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist';
  src: url('/fonts/geist-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist';
  src: url('/fonts/geist-latin-ext-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;

  /* Flächen: von tief nach vorn */
  --bg: #0c0d0f;
  --bg-glow: rgba(205, 184, 138, 0.06);
  --surface: #111215;
  --surface-2: #16181b;
  --surface-3: #202226;
  --line: rgba(236, 231, 221, 0.08);
  --line-strong: rgba(236, 231, 221, 0.16);

  /* Schrift */
  --text: #ece7dd;
  --text-2: #a7a29a;
  --muted: #77726b;

  /* Akzent */
  --gold: #cdb88a;
  --gold-soft: #e4d5b1;
  --gold-ink: #0c0d0f;
  --gold-wash: rgba(205, 184, 138, 0.12);
  --gold-line: rgba(205, 184, 138, 0.4);

  --bad: #e0665a;
  --warn-text: #f0c77c;
  --info-text: #9cc3f2;
  --good: #4bbd87;

  /* Stufen: Punkt neben dem Text, nie als Textfarbe. Gegen Farbfehlsichtigkeit geprüft. */
  --st-kontakt: #8a9099;
  --st-registriert: #3987e5;
  --st-verifiziert: #d95926;
  --st-eingezahlt: #199e70;
  --st-vip: #c98500;
  --st-weg: #5f646b;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: none;
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.4), 0 16px 32px -16px rgba(0, 0, 0, 0.7);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --serif: "Instrument Serif", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 12% -8%, var(--bg-glow), transparent 60%),
    linear-gradient(180deg, #0e0f11 0%, var(--bg) 40%);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
p { margin: 0; }
[hidden] { display: none !important; }

h1 { font-family: var(--serif); font-size: 44px; line-height: 1; margin: 0; font-weight: 400; letter-spacing: -0.015em; }
/* Kartenüberschriften sind Hinweisschilder, keine Schlagzeilen. */
h2 {
  margin: 0 0 14px; font-family: var(--serif); font-size: 23px; font-weight: 400; line-height: 1.1;
  color: var(--text);
}
h3 { margin: 18px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }

.sub { margin-top: 4px; font-size: 13.5px; color: var(--muted); }
.muted { color: var(--muted); }
.hint { margin-top: 14px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.link { color: var(--gold); font-size: 13px; }
.link:hover { color: var(--gold-soft); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.92em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------- Bewegung */

@keyframes auftauchen { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes einblenden { from { opacity: 0; } to { opacity: 1; } }

/* Listenzeilen laufen leicht versetzt ein - das zeigt, dass sie zusammengehören. */
.person-row, .todo-row, .frow, .row, .session-row, .tile, .card {
  animation: auftauchen 0.34s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}
.card { animation-duration: 0.4s; }

/* --------------------------------------------------------------- Kopf */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(11, 12, 14, 0.72);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--serif); font-size: 22px; font-weight: 400; line-height: 1.05; }
.brand small { font-family: var(--font); }
.brand img { width: 32px; height: 32px; border-radius: 9px; box-shadow: 0 0 0 1px var(--line), 0 6px 14px -8px rgba(0,0,0,.9); }
.brand small { display: block; margin-top: 1px; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; }

.tabs { display: flex; gap: 2px; margin-left: 10px; }
.tabs a {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 8px 13px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-2);
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.tabs a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.tabs a.active { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.tabs a.active::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: -13px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: einblenden 0.3s var(--ease) both;
}
.tabs svg { width: 18px; height: 18px; opacity: 0.9; }
.tabs a.active svg { color: var(--gold); opacity: 1; }
.topbar .logout { margin-left: auto; }

main#view { max-width: 1200px; margin: 0 auto; padding: 28px 22px 64px; outline: none; }

/* Fünf Reiter brauchen Platz: auf mittleren Breiten nur das Logo, engere Reiter. */
@media (min-width: 721px) and (max-width: 900px) {
  .topbar { gap: 12px; }
  .brand span { display: none; }
  .tabs { margin-left: 2px; }
  .tabs a { gap: 6px; padding: 8px 9px; }
  .tabs a.active::after { left: 9px; right: 9px; }
}

@media (max-width: 720px) {
  /* backdrop-filter macht die Kopfzeile zum Bezugsrahmen für position: fixed -
     die untere Leiste klebte sonst oben an ihr fest. */
  .topbar { padding: 10px 14px; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0;
    justify-content: space-around; gap: 0;
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    background: rgba(16, 18, 21, 0.92);
    backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-top: 1px solid var(--line);
  }
  .tabs a { flex-direction: column; gap: 3px; padding: 6px 12px; font-size: 10.5px; letter-spacing: 0.01em; }
  .tabs a.active { background: none; }
  .tabs a.active::after { left: 50%; right: auto; bottom: 2px; width: 16px; transform: translateX(-50%); border-radius: 2px; }
  .tabs svg { width: 21px; height: 21px; }
  main#view { padding: 18px 14px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 23px; }
  input, select, textarea { font-size: 16px; } /* verhindert das Hineinzoomen auf dem iPhone */
}

/* ------------------------------------------------------------ Bausteine */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }

.card {
  position: relative; min-width: 0; margin-bottom: 16px; padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 120px), var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.card-head .total { font-size: 13.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile {
  min-width: 0; padding: 18px 20px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 90px), var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease);
}
.tile:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.tile .label { font-size: 12px; font-weight: 500; color: var(--text-2); letter-spacing: 0.02em; }
.tile .value {
  margin: 7px 0 3px; font-family: var(--serif); font-size: 42px; font-weight: 400; line-height: 1; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile .note { font-size: 12.5px; color: var(--muted); }
.delta-up { color: #6fd29f; font-weight: 600; }
.delta-down { color: #f0928a; font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }

@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 430px) {
  .tile { padding: 15px 16px; }
  .tile .value { font-size: 23px; }
  .tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles.three .tile .value { font-size: 18px; }
}

/* ------------------------------------------------------------- Knöpfe */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font-size: 14px; font-weight: 550; white-space: nowrap; cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.12s var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: rgba(255, 255, 255, 0.2); }
.btn:active { transform: scale(0.975); }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  border-color: rgba(0, 0, 0, 0.25); color: var(--gold-ink); font-weight: 650;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 20px -10px rgba(205, 184, 138, 0.8);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.05); }
.btn.danger { color: var(--bad); border-color: rgba(224, 102, 90, 0.35); }
.btn.danger:hover { background: rgba(224, 102, 90, 0.1); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn svg { width: 16px; height: 16px; flex: none; }

.icon-btn {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: rgba(224, 102, 90, 0.12); color: var(--bad); }

/* ------------------------------------------------------------ Eingaben */

input, select, textarea {
  width: 100%; min-width: 0; min-height: 38px; padding: 8px 11px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease);
}
input::placeholder, textarea::placeholder { color: #6a7078; }
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, 0.2); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold-line); background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px var(--gold-wash);
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator { filter: invert(0.75); opacity: 0.7; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--gold); }
textarea { resize: vertical; min-height: 46px; line-height: 1.5; }

label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; font-size: 12.5px; color: var(--text-2); }
label.check { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-size: 12.5px; color: var(--text-2); }

/* ------------------------------------------------------------ Merkmale */

.badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 9px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.055); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 550; white-space: nowrap;
}
.badge i, .chip i.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--st-kontakt); }
.stage-registriert i, i.dot.stage-registriert { background: var(--st-registriert); }
.stage-verifiziert i, i.dot.stage-verifiziert { background: var(--st-verifiziert); }
.stage-eingezahlt i, i.dot.stage-eingezahlt { background: var(--st-eingezahlt); }
.stage-vip i, i.dot.stage-vip { background: var(--st-vip); }
.stage-weg i, i.dot.stage-weg { background: var(--st-weg); }

.flag {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--text-2); font-size: 11.5px; white-space: nowrap;
}
.flag.warn { border-color: rgba(226, 166, 59, 0.45); background: rgba(226, 166, 59, 0.1); color: var(--warn-text); }
.flag.info { border-color: rgba(91, 155, 230, 0.45); background: rgba(91, 155, 230, 0.1); color: var(--info-text); }
.flag.quiet { color: var(--muted); }

.avatar {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  font-size: 13px; font-weight: 650; letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1.5px var(--ring, var(--line-strong));
}
.avatar.big { width: 62px; height: 62px; font-size: 20px; }
.avatar.stage-registriert { --ring: var(--st-registriert); }
.avatar.stage-verifiziert { --ring: var(--st-verifiziert); }
.avatar.stage-eingezahlt { --ring: var(--st-eingezahlt); }
.avatar.stage-vip { --ring: var(--st-vip); }
.avatar.stage-weg { --ring: var(--st-weg); color: var(--muted); }

.pips { display: inline-flex; gap: 3px; }
.pip {
  padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.05);
  font-size: 10px; font-weight: 650; letter-spacing: 0.03em; color: #6f757d;
}
.pip.on { background: var(--gold-wash); color: var(--gold-soft); box-shadow: inset 0 0 0 1px rgba(205, 184, 138, 0.25); }

.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty.small { padding: 12px 0; text-align: left; font-size: 13.5px; }
.notice {
  margin-bottom: 16px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px;
  border: 1px solid rgba(224, 102, 90, 0.3); background: rgba(224, 102, 90, 0.08); color: #f1a39a;
}
.tag {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); color: var(--muted); font-size: 10.5px; font-weight: 500;
  text-transform: none; letter-spacing: 0.02em;
}
.tag.custom { background: var(--gold-wash); color: var(--gold-soft); }

/* ------------------------------------------------------------ Anmeldung */

.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: min(390px, 100%); display: grid; gap: 16px; margin: 0; padding: 32px; text-align: center;
  animation: auftauchen 0.5s var(--ease) both;
}
.login-card img { width: 56px; height: 56px; margin: 0 auto; border-radius: 14px; box-shadow: 0 10px 30px -12px rgba(0,0,0,.9); }
.login-card label { text-align: left; }
.login-card .btn { height: 42px; }

/* ------------------------------------------------------------ Übersicht */

.todo-group + .todo-group { margin-top: 20px; }
.todo-title {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-2);
}
.todo-title b { padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--text); font-size: 11px; letter-spacing: 0; }
.todo-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line);
  transition: background 0.16s var(--ease);
}
.todo-row:hover { background: rgba(255, 255, 255, 0.015); }
.who { display: flex; flex: 1; align-items: center; gap: 11px; min-width: 0; }
.who > span:last-child { min-width: 0; }
.who b { display: block; font-weight: 600; }
.who small { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; flex: none; gap: 7px; }
@media (max-width: 480px) {
  .todo-row { flex-wrap: wrap; }
  .row-actions { width: 100%; padding-left: 51px; }
}

/* Trichter: ein Farbton, die Länge trägt die Aussage */
.funnel { display: grid; gap: 3px; }
.frow {
  display: grid; grid-template-columns: 108px minmax(0, 1fr) 38px 48px; align-items: center;
  gap: 12px; margin: 0 -10px; padding: 8px 10px; border-radius: var(--radius-sm);
  transition: background 0.16s var(--ease);
}
.frow:hover { background: rgba(255, 255, 255, 0.04); }
.flabel { font-size: 13.5px; color: var(--text-2); }
.ftrack { display: flex; align-items: center; height: 20px; background: rgba(255,255,255,.04); border-radius: 0 5px 5px 0; }
.fbar {
  height: 20px; border-radius: 0 5px 5px 0;
  background: linear-gradient(90deg, rgba(217,180,90,.55), var(--gold));
  transition: width 0.7s var(--ease);
}
.fval { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.fpct { text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Säulen: Provision pro Monat */
.colchart { position: relative; height: 214px; margin: 16px 0 0 58px; }
.cc-grid { position: absolute; inset: 0 0 26px 0; }
.cc-tick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.cc-tick.base { border-top-color: var(--line-strong); }
.cc-tick span {
  position: absolute; right: calc(100% + 10px); top: -8px; white-space: nowrap;
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.cc-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.cc-col { position: relative; border-radius: 8px; transition: background 0.16s var(--ease); }
.cc-col:hover, .cc-col:focus-visible { background: rgba(255, 255, 255, 0.035); }
.cc-plot { position: absolute; inset: 0 0 26px 0; display: flex; align-items: flex-end; justify-content: center; }
.cc-bar {
  width: min(22px, 58%); border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--gold-soft), rgba(205, 184, 138, 0.75));
  transition: height 0.7s var(--ease), filter 0.18s var(--ease);
}
.cc-col:hover .cc-bar, .cc-col:focus-visible .cc-bar { filter: brightness(1.15); }
.cc-col.on .cc-bar { box-shadow: 0 0 18px -4px rgba(205, 184, 138, 0.6); }
.cc-val {
  position: absolute; left: 50%; transform: translate(-50%, -6px);
  font-size: 11.5px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.cc-x {
  position: absolute; left: 0; right: 0; bottom: 0; height: 26px; line-height: 26px;
  text-align: center; font-size: 11px; color: var(--muted);
}
.cc-col.on .cc-x { color: var(--text); font-weight: 600; }
@media (max-width: 480px) { .colchart { margin-left: 48px; height: 190px; } .cc-x { font-size: 10px; } }

details.twin { margin-top: 12px; }
details.twin summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
details.twin summary:hover { color: var(--text-2); }
details.twin summary .tag { margin-left: 8px; }
details.twin > form { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-weight: 500; color: var(--muted); }
th.num, td.num { text-align: right; }

#tip {
  position: fixed; left: 0; top: 0; z-index: 50; max-width: 270px; padding: 7px 10px;
  border-radius: 9px; font-size: 12.5px; pointer-events: none; opacity: 0;
  background: rgba(34, 38, 43, 0.96); border: 1px solid var(--line-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); backdrop-filter: blur(8px);
  transition: opacity 0.14s var(--ease);
}
#tip.show { opacity: 1; }

/* --------------------------------------------------------------- Leute */

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar input { flex: 1; }
.toolbar select { flex: none; width: auto; }
.chips { display: flex; gap: 7px; margin-bottom: 12px; padding-bottom: 4px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; flex: none; height: 34px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: transparent;
  font-size: 13.5px; color: var(--text-2); white-space: nowrap; cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.chip b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--gold-wash); border-color: var(--gold-line); color: var(--text); }

.people {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.people-head, .person-row {
  display: grid; align-items: center; gap: 14px;
  grid-template-columns: 40px minmax(0, 1.6fr) minmax(0, 1.5fr) 120px 110px 106px 86px;
}
.people-head {
  padding: 11px 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.02);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted);
}
.person-row { padding: 13px 18px; border-bottom: 1px solid var(--line); transition: background 0.16s var(--ease); }
.person-row:last-child { border-bottom: 0; }
.person-row:hover { background: rgba(255, 255, 255, 0.03); }
.pr-main { min-width: 0; }
.pr-name { display: block; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-sub { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-stage { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pr-nums { display: contents; }
.pr-num small { display: none; }
.pr-when { text-align: right; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

@media (max-width: 900px) {
  .people-head { display: none; }
  .person-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas: "av main when" "av stage stage" "av nums nums";
    gap: 7px 12px;
  }
  .person-row .avatar { grid-area: av; align-self: start; }
  .pr-main { grid-area: main; }
  .pr-when { grid-area: when; align-self: start; }
  .pr-stage { grid-area: stage; }
  .pr-pips { display: none; }
  .pr-nums { grid-area: nums; display: flex; flex-wrap: wrap; gap: 3px 18px; }
  .pr-num { text-align: left; font-size: 13.5px; }
  .pr-num small { display: inline; margin-right: 5px; font-size: 12px; color: var(--muted); }
}

/* Auswahl und Spitznamen */
.person-row.selectable { cursor: pointer; font-size: 15px; color: var(--text); }
.person-row.selectable.checked { background: var(--gold-wash); }
.nick-input { height: 34px; font-size: 14px; }
.nick-input.saved { border-color: var(--st-eingezahlt); box-shadow: 0 0 0 3px rgba(25, 158, 112, 0.18); }
.pick-box { display: grid; place-items: center; width: 40px; height: 40px; }
.pick-box input { width: 20px; height: 20px; }
.person-row .pick-box { grid-area: av; }
@media (min-width: 901px) { .person-row .pick-box { grid-area: auto; } }
.select-all {
  display: flex; align-items: center; gap: 10px; padding: 11px 18px;
  border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-2);
}
.select-all input { width: 18px; height: 18px; }
.bulkbar {
  position: sticky; bottom: 18px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  margin-top: 14px; padding: 11px 16px; border-radius: var(--radius);
  background: rgba(26, 29, 33, 0.95); border: 1px solid var(--line-strong);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.8); backdrop-filter: blur(12px);
  animation: auftauchen 0.3s var(--ease) both;
}
.bulkbar .count { margin-right: auto; font-size: 14px; }
@media (max-width: 720px) { .bulkbar { bottom: calc(92px + env(safe-area-inset-bottom)); } }

/* -------------------------------------------------------------- Person */

.back { display: inline-block; margin-bottom: 14px; font-size: 13.5px; color: var(--muted); transition: color 0.16s var(--ease); }
.back:hover { color: var(--text); }
.person-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ph-main { flex: 1; min-width: 220px; }
.badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.step-btn {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 13px;
  text-align: left; border: 1px solid var(--line-strong); border-radius: 13px;
  background: rgba(0, 0, 0, 0.22); cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.14s var(--ease);
}
.step-btn:hover { border-color: rgba(255, 255, 255, 0.24); transform: translateY(-1px); }
.step.done .step-btn { border-color: var(--gold-line); background: var(--gold-wash); }
.step-dot {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.07); color: var(--text-2); font-size: 13px; font-weight: 650;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.step-dot svg { width: 16px; height: 16px; }
.step.done .step-dot { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: var(--gold-ink); }
.step-text { min-width: 0; }
.step-text b { display: block; font-size: 14px; }
.step-text small { display: block; font-size: 11.5px; line-height: 1.35; color: var(--muted); }
@media (max-width: 720px) { .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.rows { display: grid; }
.row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto 30px; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.row.comm-row { grid-template-columns: minmax(0, 1fr) auto auto 30px; }
.row > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.row .num { font-weight: 600; }
.row .muted { font-size: 12.5px; }
.neg { color: #f0928a; }
@media (max-width: 480px) { .row { grid-template-columns: auto minmax(0, 1fr) auto 30px; gap: 8px; } }

.inline-form {
  display: flex; flex-wrap: wrap; align-items: end; gap: 10px;
  margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line);
}
.inline-form > label { flex: 1 1 110px; grid-template-columns: minmax(0, 1fr); }
.inline-form > label.grow { flex: 2 1 180px; }
.inline-form > .btn, .inline-form > label.check { flex: 0 0 auto; }
.inline-form > label.check { height: 38px; }
.reminder-form { margin-top: 16px; }

.composer { display: flex; align-items: end; gap: 10px; margin-top: 12px; }
.composer textarea { flex: 1; }

.chat { display: flex; flex-direction: column; gap: 9px; max-height: 390px; overflow-y: auto; padding: 2px 2px 8px; }
.msg {
  align-self: flex-start; max-width: 85%; padding: 9px 13px; font-size: 14px;
  border-radius: 14px 14px 14px 5px; background: var(--surface-3);
  animation: auftauchen 0.3s var(--ease) both;
}
.msg.out { align-self: flex-end; border-radius: 14px 14px 5px 14px; background: rgba(205, 184, 138, 0.16); }
.msg p { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg time { display: block; margin-top: 3px; font-size: 10.5px; color: var(--muted); }

.note-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 30px; align-items: start; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.note-row p { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-row .muted { padding-top: 2px; font-size: 11.5px; white-space: nowrap; }

.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 16px; margin: 0 0 18px; font-size: 13.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.span-2 { grid-column: 1 / -1; }
.actions { display: flex; justify-content: flex-end; gap: 9px; }
.stack { display: grid; gap: 14px; }
.stack .actions { justify-content: flex-start; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

.radio-row { display: flex; flex-wrap: wrap; gap: 7px; }
.radio-pill { position: relative; display: inline-block; }
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill span {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); font-size: 13.5px; color: var(--text-2); cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.radio-pill input:checked + span { border-color: var(--gold-line); background: var(--gold-wash); color: var(--text); }
.radio-pill input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.month-switch { display: flex; align-items: center; gap: 8px; }
.month-switch b { min-width: 152px; text-align: center; font-weight: 600; }

.session-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.session-row b { font-weight: 600; }
.session-row small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }

/* Tradequo automatisch */
.tq-account { align-items: start; }
.tq-account .tag { margin-left: 8px; }
.tq-account small.tq-error { color: var(--bad); }
.tq-account details.twin { margin-top: 8px; }
.tq-schedule { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.tq-time { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tq-time input[type="time"] { width: auto; min-width: 110px; }

.log {
  max-height: 340px; margin: 14px 0 0; padding: 12px 14px; overflow: auto;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2);
}

/* ------------------------------------------------------------ Struktur */

/* Neu zeichnen nach dem Verschieben: ohne Einlauf, sonst flackert die ganze Seite. */
.calm .card, .calm .tile, .calm .row { animation: none; }
.calm .band { transition: none; }

.head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.seg { display: flex; gap: 6px; }
.seg .chip { height: 32px; padding: 0 12px; font-size: 12.5px; }

.notice.info {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  border-color: rgba(91, 155, 230, 0.35); background: rgba(91, 155, 230, 0.08); color: var(--info-text);
}
.tile .note .delta { margin-right: 4px; }
.delta { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: #6fd29f; }
.delta.down { color: #f0928a; }

/* Erste Schritte, solange es noch keinen Sub-IB gibt */
.guide {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; border-color: var(--gold-line);
  background: radial-gradient(90% 140% at 0% 0%, rgba(205, 184, 138, 0.12), transparent 60%), var(--surface);
}
.guide-icon {
  flex: none; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: var(--gold-ink);
  box-shadow: 0 10px 24px -12px rgba(205, 184, 138, 0.8);
}
.guide-icon svg { width: 25px; height: 25px; }
.guide-text { flex: 1; min-width: 240px; }
.guide-text h2 { margin-bottom: 8px; color: var(--text); }
.guide-text ol { display: grid; gap: 5px; margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--text-2); }
.guide-text b { color: var(--text); font-weight: 600; }

/* Ebenen-Pyramide: ein Dreieck aus Bändern - Spitze du, unten deine Kunden */
.levels { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0 2px; }
.band {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  width: 0; height: 58px; padding: 0 6%; border: 0; color: var(--text); text-align: center; cursor: pointer;
  transition: width 0.75s var(--ease), filter 0.18s var(--ease);
}
.band:hover, .band:focus-visible { filter: brightness(1.18); }
.band:focus-visible { outline: none; }
.band-label { max-width: 100%; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; opacity: 0.86; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band-value { max-width: 100%; font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band-du { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: var(--gold-ink); }
.band-sub.lvl-1 { background: linear-gradient(180deg, rgba(205, 184, 138, 0.46), rgba(205, 184, 138, 0.32)); }
.band-sub.lvl-2 { background: linear-gradient(180deg, rgba(205, 184, 138, 0.3), rgba(205, 184, 138, 0.2)); }
.band-sub.lvl-3 { background: linear-gradient(180deg, rgba(205, 184, 138, 0.2), rgba(205, 184, 138, 0.13)); }
.band-kunden { background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.06)); }
.band.on { filter: brightness(1.32) saturate(1.15); }
.band-kunden.on { background: linear-gradient(180deg, rgba(205, 184, 138, 0.24), rgba(205, 184, 138, 0.14)); }

/* Sub-IB-Liste */
.row.sub-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.sum-row {
  display: flex; justify-content: space-between; margin-top: 2px; padding-top: 11px;
  border-top: 1px solid var(--line-strong); font-size: 14px;
}
.sum-row b { font-variant-numeric: tabular-nums; }
.linkish { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.linkish:hover b { color: var(--gold-soft); }

.calc-text { font-size: 13.5px; line-height: 1.6; color: var(--text-2); }
.calc-text b { color: var(--text); font-variant-numeric: tabular-nums; }
.calc-example { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.calc-example div { padding: 9px 11px; border-radius: 10px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); }
.calc-example small { display: block; font-size: 11px; color: var(--muted); }
.calc-example b { color: var(--gold-soft); font-variant-numeric: tabular-nums; }

/* Werkzeugleiste der Struktur */
.tree-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
label.search-box { position: relative; display: block; flex: 1 1 200px; max-width: 290px; }
.search-box svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.search-box input { height: 36px; min-height: 36px; padding-left: 34px; }
.tree-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: transparent;
  color: var(--text-2); font-size: 12.5px; font-weight: 550; white-space: nowrap; cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.tool:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.tool[aria-pressed="true"] { background: var(--gold-wash); border-color: var(--gold-line); color: var(--text); }
.tool svg { width: 15px; height: 15px; flex: none; }
.tool.icon-only { width: 32px; padding: 0; justify-content: center; }
.zoom-tools { display: inline-flex; gap: 4px; margin-left: 2px; padding-left: 8px; border-left: 1px solid var(--line); }
.zoom-value { min-width: 58px; justify-content: center; font-variant-numeric: tabular-nums; }
.tree-note { margin: 0 0 4px; font-size: 12px; color: var(--muted); }

/* Die Strukturen als Organigramme - jedes Profil in seiner eigenen Bahn, untereinander */
.pyramid { --tree: rgba(205, 184, 138, 0.36); padding-top: 6px; }
.pyramid-inner { display: grid; gap: 14px; }

.lane {
  position: relative; border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.024), rgba(255, 255, 255, 0.006));
}
.lane.main { border-color: rgba(205, 184, 138, 0.24); }
.lane::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--gold), rgba(205, 184, 138, 0.15));
}
.lane-head {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px 13px 18px;
  border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer;
  transition: background 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.lane-head:hover { background: rgba(255, 255, 255, 0.025); }
.lane-no {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px;
  background: var(--gold-wash); color: var(--gold-soft); font-size: 12.5px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(205, 184, 138, 0.25);
}
.lane-title { flex: 1; min-width: 0; line-height: 1.3; }
.lane-title b { display: block; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.lane-title small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-sum { flex: none; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.lane-sum small { margin-right: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.lane-chevron { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--muted); }
.lane-chevron svg { width: 18px; height: 18px; transition: transform 0.2s var(--ease); }
.lane.closed .lane-chevron svg { transform: rotate(-90deg); }
.lane-head.drop-ready { box-shadow: inset 0 0 0 1px var(--gold-line); }
.lane-head.drop-blocked { opacity: 0.45; }
.lane-head.drop-on { background: var(--gold-wash); box-shadow: inset 0 0 0 2px var(--gold); }
.lane-body { overflow-x: auto; padding: 14px 20px 34px; border-top: 1px solid var(--line); scrollbar-width: thin; }
.lane-tree { width: max-content; margin: 0 auto; }

.pn { position: relative; display: flex; flex-direction: column; align-items: center; }
.pn-card {
  position: relative; width: 272px; padding: 13px 14px 12px; border-radius: 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 90px), var(--surface-2);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease),
    opacity 0.18s var(--ease), filter 0.18s var(--ease);
}
.pn-card.subib::before {
  content: ""; position: absolute; top: -1px; left: 16px; right: 16px; height: 2px; border-radius: 0 0 3px 3px;
  background: var(--accent, var(--gold));
}
.pn-card.lvl-1 { --accent: var(--gold); }
.pn-card.lvl-2 { --accent: #c4924a; }
.pn-card.lvl-3 { --accent: #9c8a6c; }
.pn-card.profile {
  width: 312px; border-color: var(--gold-line);
  background: radial-gradient(120% 90% at 0% 0%, rgba(205, 184, 138, 0.17), transparent 62%), var(--surface-2);
  box-shadow: var(--shadow), 0 20px 44px -26px rgba(205, 184, 138, 0.5);
}

.pn-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pn-head[data-drag] { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pn-head .avatar { width: 36px; height: 36px; font-size: 12px; }
.pn-title { flex: 1; min-width: 0; line-height: 1.25; }
.pn-title b { display: block; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn-title small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn-crown {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: var(--gold-ink);
  box-shadow: 0 6px 16px -8px rgba(205, 184, 138, 0.8);
}
.pn-crown svg { width: 19px; height: 19px; }
.pn-crown.big { width: 52px; height: 52px; border-radius: 15px; }
.pn-crown.big svg { width: 26px; height: 26px; }

.pn-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 12px; }
.pn-hero-value { min-width: 0; }
.pn-hero-value small { display: block; font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }
.pn-hero-value b { display: block; margin: 1px 0; font-family: var(--serif); font-size: 30px; font-weight: 400; line-height: 1.05; }
.pn-hero-value .delta { font-size: 11.5px; }
.pn-hero .spark { flex: none; width: 116px; margin-top: 0; padding-bottom: 3px; }
.pn-card.subib .spark { margin-top: 8px; }

.pn-actions { display: flex; flex: none; gap: 2px; margin-right: -6px; }
.pn-actions .icon-btn { width: 28px; height: 28px; color: var(--muted); }
.pn-actions .icon-btn svg { width: 15px; height: 15px; }
.icon-btn.add:hover { background: var(--gold-wash); color: var(--gold-soft); }

/* Kennzahlen-Leiste: drei Spalten, feine Trennlinien, keine Kästen */
.pn-stats {
  display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 0.92fr) minmax(0, 1.25fr); margin-top: 12px; padding: 9px 0 1px;
  border-top: 1px solid var(--line);
}
.stat { min-width: 0; padding: 0 8px; border-left: 1px solid var(--line); }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat small { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stat b { display: block; margin-top: 2px; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .delta { display: block; margin-top: 1px; font-size: 10.5px; }
.rate { color: var(--gold-soft); }
.rate.over { color: #f1a39a; }

.spark { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.spark svg { flex: 1; min-width: 0; height: 28px; overflow: visible; }
.spark span { flex: none; font-size: 10.5px; color: var(--muted); }
.spark.empty { height: 28px; }
.spark-area { fill: rgba(205, 184, 138, 0.15); }
.spark-line { fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }

.pn-warn { margin-top: 8px; font-size: 12px; color: #f1a39a; }
.pn-month {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin-top: 11px;
  padding: 7px 10px; border: 1px dashed var(--gold-line); border-radius: 10px; background: transparent;
  color: var(--gold-soft); font-size: 12.5px; text-align: left; cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.pn-month:hover { background: var(--gold-wash); }
.pn-month.set { border-style: solid; background: var(--gold-wash); color: var(--text-2); }
.pn-month.set b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.pn-month svg { flex: none; width: 14px; height: 14px; }

.pn-clients {
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px;
  margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line);
}
.pn-folded {
  width: 100%; margin-top: 12px; padding: 7px 10px; border: 1px dashed var(--line-strong); border-radius: 10px;
  background: transparent; color: var(--muted); font-size: 12px; text-align: left; cursor: pointer;
}
.pn-folded:hover { color: var(--text-2); background: rgba(255, 255, 255, 0.03); }

/* Ein-/Ausklappen: runder Knopf an der Unterkante, auf der Verbindungslinie */
.pn-fold {
  position: absolute; left: 50%; bottom: -13px; z-index: 2; display: grid; place-items: center;
  min-width: 26px; height: 26px; padding: 0 8px; transform: translateX(-50%);
  border: 1px solid var(--gold-line); border-radius: 999px; background: var(--surface-3);
  color: var(--gold-soft); font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background 0.16s var(--ease);
}
.pn-fold:hover, .pn-fold.closed { background: var(--gold-wash); }
.pn-fold svg { width: 13px; height: 13px; }

.icon-btn.edit:hover, .icon-btn.close:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }

/* Personen als Chips */
.pchip {
  position: relative; display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 32px; padding: 0 11px 0 4px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: rgba(0, 0, 0, 0.24);
  font-size: 12.5px; color: var(--text); cursor: grab;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), opacity 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.pchip:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.22); }
.pc-av {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-3); font-size: 9.5px; font-weight: 700; letter-spacing: 0.02em; color: var(--text-2);
  box-shadow: inset 0 0 0 1.5px var(--ring, var(--line-strong));
}
.pchip.stage-registriert .pc-av { --ring: var(--st-registriert); }
.pchip.stage-verifiziert .pc-av { --ring: var(--st-verifiziert); }
.pchip.stage-eingezahlt .pc-av { --ring: var(--st-eingezahlt); }
.pchip.stage-vip .pc-av { --ring: var(--st-vip); }
.pchip.stage-weg { opacity: 0.6; }
.pc-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-lots { flex: none; font-size: 11px; font-weight: 650; color: var(--gold-soft); font-variant-numeric: tabular-nums; }
.pc-check {
  flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold); color: var(--gold-ink);
}
.pc-check svg { width: 12px; height: 12px; stroke-width: 2.6; }

/* Der Griff ist nur auf Touch-Geräten zu sehen - dort startet nur er das Ziehen. */
.grip { display: none; flex: none; place-items: center; width: 24px; height: 30px; margin-left: -4px; color: var(--muted); touch-action: none; }
.grip svg { width: 15px; height: 15px; }
@media (hover: none), (pointer: coarse) {
  .grip { display: grid; }
  .pchip { height: 38px; padding-left: 2px; cursor: default; }
  .pn-head[data-drag] { cursor: default; }
}

/* Suche, Auswahl, hervorgehobene Ebene, gerade verschoben */
.pchip.sel, .pn-card.sel { border-color: var(--gold); background: var(--gold-wash); }
.pchip.hit, .pn-card.hit { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-wash), var(--shadow); }
.pchip.miss { opacity: 0.32; }
.pyramid.selecting .pchip, .pyramid.selecting .pn-head { cursor: pointer; }
.pyramid.focusing .pn-card:not(.focus) { opacity: 0.38; filter: saturate(0.5); }
.pyramid.focusing .pn-card.focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-wash), var(--shadow-lift); }
.pyramid.focusing-kunden .pchip { border-color: var(--gold-line); box-shadow: 0 0 0 3px var(--gold-wash); }
@keyframes aufleuchten {
  from { box-shadow: 0 0 0 0 rgba(205, 184, 138, 0.75); }
  to { box-shadow: 0 0 0 14px rgba(205, 184, 138, 0); }
}
.pchip.flash, .pn-card.flash { border-color: var(--gold); animation: aufleuchten 1s var(--ease) 2; }

/* Verbindungslinien: von der Karte nach unten, quer über alle Kinder, zu jedem Kind hinunter. */
.pn-kids { position: relative; display: flex; justify-content: center; align-items: flex-start; }
.pn-kids::before { content: ""; position: absolute; left: 50%; top: 0; height: 22px; border-left: 1.5px solid var(--tree); }
.pn-kids > .pn { padding: 44px 12px 0; }
.pn-kids > .pn::before, .pn-kids > .pn::after {
  content: ""; position: absolute; top: 22px; width: 50%; height: 22px; border-top: 1.5px solid var(--tree);
}
.pn-kids > .pn::before { right: 50%; }
.pn-kids > .pn::after { left: 50%; border-left: 1.5px solid var(--tree); }
.pn-kids > .pn:first-child::before, .pn-kids > .pn:last-child::after { border-top-color: transparent; }
.pn-kids > .pn:first-child::after { border-top-left-radius: 10px; }
.pn-kids > .pn:last-child::before { border-right: 1.5px solid var(--tree); border-top-right-radius: 10px; }
.pn-kids > .pn:last-child::after { border-left: 0; }
.pn-kids > .pn:only-child::before { border-right: 0; }
.pn-kids > .pn:only-child::after { border-left: 1.5px solid var(--tree); border-radius: 0; }

/* Ziehen */
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }
.dragging { opacity: 0.3; }
.pn-card.drop-ready { border-style: dashed; }
.pn-card.drop-blocked { opacity: 0.4; }
.pn-card.drop-on {
  border-style: solid; border-color: var(--gold);
  background: linear-gradient(180deg, rgba(205, 184, 138, 0.18), rgba(205, 184, 138, 0.06)), var(--surface-2);
  box-shadow: 0 0 0 4px var(--gold-wash), var(--shadow-lift);
}
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 80; margin: 0; pointer-events: none;
  opacity: 0.97; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.85);
}
.drag-ghost.pchip { background: var(--surface-3); border-color: var(--gold-line); }
.drag-ghost.pn-head { padding: 10px 12px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--gold-line); }
.drag-ghost.multi { padding: 0 15px; border-color: transparent; background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: var(--gold-ink); font-weight: 650; }
@keyframes dock-rein { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.drag-dock {
  position: fixed; left: 50%; bottom: 26px; z-index: 70; display: flex; align-items: center; gap: 10px;
  padding: 15px 24px; border: 1.5px dashed var(--gold); border-radius: 16px; transform: translateX(-50%);
  background: rgba(26, 29, 33, 0.96); color: var(--gold-soft); font-size: 14px; white-space: nowrap;
  box-shadow: 0 18px 50px -14px rgba(0, 0, 0, 0.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  animation: dock-rein 0.25s var(--ease) both;
}
.drag-dock svg { width: 20px; height: 20px; flex: none; }
.drag-dock.drop-on { border-style: solid; background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: var(--gold-ink); }

/* Auswahl-Leiste */
.struct-bar select { width: auto; max-width: 280px; height: 32px; min-height: 32px; padding: 4px 10px; font-size: 13px; }

/* Vollbild */
.tree-card.full { position: fixed; inset: 12px; z-index: 30; display: flex; flex-direction: column; margin: 0; animation: none; }
.tree-card.full .pyramid { flex: 1; overflow: auto; margin: 0 -20px -20px; padding: 6px 20px 20px; }
body.no-scroll { overflow: hidden; }

/* Am Handy wird die Pyramide zum Baum von oben nach unten. */
@media (max-width: 720px) {
  .pyramid-inner { gap: 12px; }
  .lane-head { padding: 12px 12px 12px 14px; gap: 10px; }
  .lane-sum small { display: none; }
  .tree-card { padding: 16px 12px; }
  .lane-body { overflow: visible; padding: 10px 8px 20px 10px; }
  .lane-tree { width: auto; zoom: 1 !important; }
  .pn-card { padding: 12px 12px 11px; }
  .pn-head { gap: 9px; }
  .pn-head .avatar { width: 32px; height: 32px; font-size: 11px; }
  .pn-actions .icon-btn.add { display: none; }
  .pn { align-items: stretch; }
  .pn-card, .pn-card.profile { width: auto; }
  .pn-kids { flex-direction: column; align-items: stretch; margin-left: 10px; padding-left: 10px; border-left: 1.5px solid var(--tree); }
  .pn-kids::before, .pn-kids > .pn::after { display: none; }
  .pn-kids > .pn { padding: 18px 0 0; }
  .pn-kids > .pn::before, .pn-kids > .pn:first-child::before, .pn-kids > .pn:last-child::before {
    top: 42px; left: -10px; right: auto; width: 10px; height: 0; border: 0; border-top: 1.5px solid var(--tree); border-radius: 0;
  }
  .pn-fold { left: auto; right: 16px; transform: none; }
  .zoom-tools { display: none; }
  label.search-box { flex-basis: 100%; max-width: none; }
  .band { height: 52px; }
  .band-label { font-size: 10.5px; }
  .band-value { font-size: 14px; }
  .drag-dock { bottom: calc(92px + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .tool span { display: none; }
  .tool { width: 34px; padding: 0; justify-content: center; }
}

/* Dialog-Blatt: mittig auf großen Bildschirmen, als Blatt von unten am Handy */
.sheet {
  width: min(500px, calc(100% - 32px)); max-width: none; max-height: calc(100% - 48px); padding: 0; overflow: auto;
  color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
}
.sheet[open] { animation: auftauchen 0.26s var(--ease) both; }
.sheet::backdrop {
  background: rgba(5, 6, 8, 0.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: einblenden 0.22s var(--ease) both;
}
@keyframes blatt-weg { to { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes schleier-weg { to { opacity: 0; } }
.sheet.closing { animation: blatt-weg 0.19s ease-in forwards; }
.sheet.closing::backdrop { animation: schleier-weg 0.19s ease-in forwards; }
.sheet-body { display: grid; gap: 18px; padding: 22px; }
.sheet-head { display: flex; align-items: center; gap: 14px; }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-head .icon-btn { align-self: flex-start; }
.sheet-title { margin: 0; font-size: 19px; font-weight: 650; text-transform: none; letter-spacing: -0.015em; color: var(--text); }
.sheet-section { padding-top: 18px; border-top: 1px solid var(--line); }
.sheet-label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: 12.5px; color: var(--text-2); }
.sheet-error {
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px;
  border: 1px solid rgba(224, 102, 90, 0.35); background: rgba(224, 102, 90, 0.1); color: #f1a39a;
}
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.actions .push-left { margin-right: auto; }
.hint.flush { margin-top: -4px; }

.pick-list {
  display: grid; gap: 3px; max-height: 270px; margin-top: -8px; padding: 4px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, 0.2);
}
label.pick-row {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 9px;
  font-size: 13.5px; color: var(--text); cursor: pointer; transition: background 0.14s var(--ease);
}
.pick-row:hover { background: rgba(255, 255, 255, 0.04); }
.pick-row input { position: absolute; opacity: 0; pointer-events: none; }
.pick-row:has(input:checked) { background: var(--gold-wash); box-shadow: inset 0 0 0 1px var(--gold-line); }
.pick-row:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: -2px; }
.pick-row .avatar, .pick-fixed .avatar { width: 32px; height: 32px; font-size: 11px; }
.pick-row b, .pick-fixed b { display: block; font-weight: 600; }
.pick-row small, .pick-fixed small { display: block; font-size: 11.5px; color: var(--muted); }
.pick-fixed { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, 0.2); }

@keyframes blatt-hoch { from { transform: translateY(100%); } to { transform: none; } }
@keyframes blatt-runter { to { transform: translateY(100%); } }
@media (max-width: 720px) {
  .sheet {
    width: 100%; max-height: 88vh; margin: auto 0 0; border-radius: 20px 20px 0 0;
    border-bottom: 0; padding-bottom: env(safe-area-inset-bottom);
  }
  .sheet[open] { animation: blatt-hoch 0.32s var(--ease) both; }
  .sheet.closing { animation: blatt-runter 0.2s ease-in forwards; }
}

/* ------------------------------------------------------------ Meldungen */

#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 13px; font-size: 14px;
  background: rgba(26, 29, 33, 0.97); border: 1px solid var(--line-strong);
  box-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.85); backdrop-filter: blur(12px);
  opacity: 0; transform: translate(-50%, 14px); pointer-events: none;
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast { display: flex; align-items: center; gap: 14px; }
#toast.show.has-action { pointer-events: auto; }
.toast-action {
  flex: none; padding: 5px 11px; border: 1px solid var(--gold-line); border-radius: 8px;
  background: var(--gold-wash); color: var(--gold-soft); font-size: 13px; font-weight: 600; cursor: pointer;
}
.toast-action:hover { filter: brightness(1.15); }
#toast.error { border-color: rgba(224, 102, 90, 0.6); }
@media (max-width: 720px) { #toast { bottom: calc(96px + env(safe-area-inset-bottom)); } }

/* Wer Bewegung reduziert haben will, bekommt sie nicht. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ----------------------------------------------------------------- Vorlagen */

.snippet-tools { display: grid; gap: 12px; margin-bottom: 18px; }
.snippet-tools .search-box { position: relative; max-width: 420px; }
.snippets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.snippet { display: grid; grid-template-rows: auto 1fr auto; gap: 12px; padding: 18px; }
.snippet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.snippet-head h3 { margin: 0; font-size: 17px; color: var(--text); }
.snippet-cat {
  flex: none; padding: 2px 10px; border: 1px solid var(--gold-line); border-radius: 999px;
  color: var(--gold-soft); font-size: 12px;
}
.snippet-body {
  display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden;
  padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18); color: var(--text-2); font-size: 14px; line-height: 1.55;
  text-align: left; white-space: pre-wrap; cursor: copy;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.snippet-body:hover { border-color: var(--gold-line); color: var(--text); }
.snippet-foot { display: flex; align-items: center; gap: 6px; }
.snippet-foot .muted { margin-right: auto; }
.snippet-foot .icon-btn:first-of-type:hover { background: var(--gold-wash); color: var(--gold); }
.snippet.copied { animation: copied 0.9s var(--ease); }
@keyframes copied {
  0% { box-shadow: 0 0 0 0 var(--gold-line); }
  30% { box-shadow: 0 0 0 4px var(--gold-line); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.snip-pick { margin-bottom: 8px; }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* Öffentliche Demo: Hinweis oben statt „Abmelden“ */
.demo-tag {
  margin-left: auto;
  padding: 3px 10px;
  border: 1px dashed var(--gold-line);
  border-radius: 999px;
  color: var(--gold);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}
.demo-tag + .logout { margin-left: 8px; }
