/* Posteingang: Liste, Zeilen, Tage, Geschaeftspost, Wartungen, Dubletten, privates Postfach, Kundenbank.
   Teil des frueheren portal.css (Refactoring 23.11.2026). portal.html laedt
   die Teile in DIESER Reihenfolge — die Kaskade bleibt dieselbe. */
    /* ===== two-pane inbox (list + detail) ===== */
    .inbox-split { display: block }
    .detail-empty { display: none }
    .lead.sel { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft) }
    @media (min-width: 1080px) {
      /* Full-width leads list. Opening a lead REPLACES the list with a
         full-width detail that expands in; closing brings the list back. */
      .inbox-split { display: block }
      .inbox-detail { margin-top: 12px }
      .inbox-detail:not(.has-sel) { display: none }
      .inbox-split:has(.inbox-detail.has-sel) .inbox-list { display: none }
      #inboxDetail .scrim { display: none }
      #inboxDetail .drawer {
        position: static; transform: none; width: 100%; max-width: none; height: auto;
        box-shadow: none; border: 1px solid var(--line); border-radius: 16px; display: none
      }
      #inboxDetail.has-sel .drawer { display: flex; animation: expandIn .28s cubic-bezier(.22, 1, .36, 1) }
      #inboxDetail .drawer-body { overflow: visible }
      .detail-empty { display: none }
    }
    @keyframes expandIn { from { opacity: 0; transform: scale(.975) } to { opacity: 1; transform: none } }
    .detail-empty .de-ic { font-size: 34px; opacity: .5; margin-bottom: 2px; }
    .detail-empty .de-t { font-size: 14.5px; font-weight: 700; color: var(--ink); }
    .detail-empty .de-s { font-size: 12.5px; color: var(--muted); max-width: 24em; line-height: 1.5; }

    /* lead list */
    .list {
      display: flex;
      flex-direction: column;
      gap: 10px
    }

    .lead {
      display: flex;
      align-items: center;
      gap: 13px;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 18px;
      padding: 15px 17px;
      box-shadow: var(--shadow);
      cursor: pointer;
      position: relative;
      transition: transform .16s cubic-bezier(.2,.7,.2,1), box-shadow .25s, border-color .2s
    }

    .lead:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-lg);
      border-color: color-mix(in srgb, var(--brand) 42%, var(--line))
    }

    .lead .av {
      width: 44px;
      height: 44px;
      border-radius: 13px;
      flex: none;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      color: #fff;
      font-size: 15px;
      box-shadow: 0 2px 6px rgba(20, 16, 40, .10)
    }
    /* initials avatar with a small channel badge in the corner (inbox card) */
    .lead .ava { position: relative; flex: none }
    .lead .ava .ini {
      width: 44px; height: 44px; border-radius: 13px;
      background: var(--brand-soft); color: var(--brand);
      font-weight: 800; font-size: 14.5px; letter-spacing: .02em;
      display: grid; place-items: center;
    }
    .lead .ava .ch {
      position: absolute; right: -4px; bottom: -4px;
      width: 20px; height: 20px; border-radius: 7px;
      background: var(--surface); border: 1px solid var(--line);
      display: grid; place-items: center; font-size: 11px; box-shadow: var(--shadow)
    }
    .lead .nm .pdot { width: 8px; height: 8px }

    .lead .main {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 4px
    }

    .lead .nm {
      font-weight: 800;
      font-size: 14px;
      letter-spacing: -.01em;
      display: flex;
      align-items: center;
      gap: 7px;
      flex-wrap: wrap
    }

    .lead .sub {
      color: var(--muted);
      font-size: 12.5px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis
    }

    .lead .meta {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 7px;
      flex: none
    }

    .lead .date {
      font-size: 11px;
      color: var(--muted);
      font-variant-numeric: tabular-nums;
      letter-spacing: .01em
    }
    /* New Inbox row meta: priority pill + channel(icon+name)/time in one row. */
    /* Posteingang nach Tagen (12.11.2026): Ueberschrift je Tag, Notfall oben. */
    .lgruppe { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 4px 0; }
    .lgruppe:first-child { margin-top: 2px; }
    .lgruppe.rot { color: #dc2626; }
    .lead.notfall { border-left: 4px solid #dc2626; }
    .lead .lkontakt { color: var(--muted); font-weight: 500; font-size: 12.5px; }
    /* Geschaeftspost: dieselbe Liste, nur leiser. */
    .lead.post { background: transparent; box-shadow: none; border-style: dashed; padding-top: 10px; padding-bottom: 10px; }
    .lead.post .ava .ini { width: 36px; height: 36px; border-radius: 11px; font-size: 12px; background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
    .lead.post .nm { font-weight: 700; font-size: 13px; color: color-mix(in srgb, var(--ink) 72%, var(--muted)); }
    .lead.post .sub { font-size: 12px; }
    .ptyp { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); letter-spacing: .02em; }
    .post-hinweis { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin: 0 4px 8px; }
    .post-hinweis .linkbtn { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--brand); cursor: pointer; }
    /* Wartungen je Kunde (22.11.2026) */
    .cw-liste { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
    .cw-zeile { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
      border: 1px solid var(--line, #e5e7eb); border-radius: 10px; padding: 8px 10px; }
    .cw-zeile.pausiert { opacity: .6; }
    .cw-text { font-size: 13.5px; line-height: 1.45; min-width: 0; }
    .cw-knoepfe { display: flex; gap: 6px; }
    .cw-knoepfe .btn-ghost { padding: 4px 10px; font-size: 12.5px; }
    .cw-leer { font-size: 13px; margin: 0 0 4px; }
    .cw-neu { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; }
    .cw-neu #cw_leistung { flex: 2 1 180px; }
    .cw-neu #cw_intervall { flex: 1 1 140px; max-width: 200px; }
    .cw-zuletzt { display: flex; flex-direction: column; font-size: 11.5px; color: var(--muted, #6b7280); flex: 1 1 140px; }
    /* Doppelte Kunden (18.11.2026) */
    .cust-row.waehlbar { cursor: pointer; }
    .cust-row.gewaehlt { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
    #cust_sel_btn.aktiv { color: var(--brand); border-color: var(--brand); }
    .dub-gruppe { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 0 0 12px; }
    .dub-zeile { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; font-size: 13.5px; }
    .dub-zeile input { margin-top: 4px; }
    /* Privates Postfach (18.11.2026) */
    .privat-box { margin: 0 0 14px; }
    .lead.privat .ava .ini { background: #fef3c7; color: #92400e; font-size: 16px; }
    .lead.privat.ungelesen .nm::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); display: inline-block; margin-left: 6px; }
    /* Mehrfachauswahl */
    .lead.waehlbar .ava .ini.wahl { background: var(--surface); border: 2px solid var(--line); color: #fff; font-size: 18px; }
    .lead.gewaehlt { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
    .lead.gewaehlt .ava .ini.wahl { background: var(--brand); border-color: var(--brand); }
    #selectBtn.aktiv { color: var(--brand); border-color: var(--brand); }
    .auswahl-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--brand); border-radius: 14px; padding: 8px 12px; margin: 0 0 10px; font-weight: 700; font-size: 13.5px; }
    .auswahl-bar button[disabled] { opacity: .45; cursor: default; }
    .lead .meta.mrow { flex-direction: row; align-items: center; gap: 13px; flex-wrap: wrap; justify-content: flex-end; }
    .pscore { font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
    .pscore.hot  { background: #dc26261a; color: #dc2626; }
    .pscore.warm { background: #d977061a; color: #d97706; }
    .pscore.cold { background: #2563eb1a; color: #2563eb; }
    [data-theme="dark"] .pscore.hot  { background: #f0576f24; color: #f0576f; }
    [data-theme="dark"] .pscore.warm { background: #e6a23c24; color: #e6a23c; }
    [data-theme="dark"] .pscore.cold { background: #5b9bff24; color: #5b9bff; }
    /* Dringlichkeit als Punkt, Auftragschance als Balken (04.11.2026) */
    .ampel { display: inline-flex; align-items: center; gap: 9px; }
    .pdot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
    .pdot.hot  { background: #dc2626; box-shadow: 0 0 0 3px #dc262626; }
    .pdot.warm { background: #d97706; box-shadow: 0 0 0 3px #d9770622; }
    .pdot.cold { background: #2563eb; box-shadow: 0 0 0 3px #2563eb22; }
    [data-theme="dark"] .pdot.hot  { background: #f0576f; box-shadow: 0 0 0 3px #f0576f33; }
    [data-theme="dark"] .pdot.warm { background: #e6a23c; box-shadow: 0 0 0 3px #e6a23c33; }
    [data-theme="dark"] .pdot.cold { background: #5b9bff; box-shadow: 0 0 0 3px #5b9bff33; }
    .cbars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; flex: none; }
    .cbars i { display: block; width: 4px; border-radius: 1.5px; background: color-mix(in srgb, var(--ink) 16%, transparent); }
    .cbars i:nth-child(1) { height: 6px; } .cbars i:nth-child(2) { height: 10px; } .cbars i:nth-child(3) { height: 14px; }
    .cbars.c1 i:nth-child(1) { background: #94a3b8; }
    .cbars.c2 i:nth-child(-n+2) { background: #65a30d; }
    .cbars.c3 i { background: #16a34a; }
    [data-theme="dark"] .cbars.c2 i:nth-child(-n+2) { background: #a3e635; }
    [data-theme="dark"] .cbars.c3 i { background: #4ade80; }
    .cbars.gross { height: 18px; gap: 3px; } .cbars.gross i { width: 5px; }
    .cbars.gross i:nth-child(1) { height: 7px; } .cbars.gross i:nth-child(2) { height: 12px; } .cbars.gross i:nth-child(3) { height: 18px; }
    .chance-box { flex-basis: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink); }
    .chance-box .ch-kopf { display: flex; align-items: center; gap: 8px; font-weight: 700; }
    .chance-box .ch-grund { font-weight: 500; opacity: .75; }
    .chance-box .ch-ang { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
    .chance-box .ch-ang span { padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, #16a34a 12%, transparent); font-weight: 600; font-size: 11.5px; }
    .chance-box .ch-fehlt { margin-top: 8px; font-size: 12px; }
    .chance-box .ch-fehlt span { padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, #d97706 14%, transparent); font-weight: 600; font-size: 11.5px; margin-left: 4px; display: inline-block; margin-top: 3px; }
    .chanbox { text-align: right; min-width: 92px; }
    .chanrow { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 12.5px; color: var(--ink); opacity: .82; font-weight: 500; }
    .chanrow svg { width: 14px; height: 14px; stroke-width: 1.8; flex: none; }
    .showall { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 11px; margin-top: 2px; background: none; border: 1px dashed var(--line); border-radius: 11px; color: var(--brand); font-weight: 600; font-size: 13px; cursor: pointer; transition: .15s; }
    .showall:hover { background: var(--surface); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
    /* ── Kundenbank (premium) ── */
    .cav { width: 42px; height: 42px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; background: var(--brand-soft); color: var(--brand); position: relative; }
    .cav.vip { background: linear-gradient(135deg, color-mix(in srgb, var(--acc1, var(--brand)) 26%, transparent), color-mix(in srgb, var(--acc2, var(--brand)) 42%, transparent)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 50%, transparent); color: var(--ink); }
    .cav .cstar { position: absolute; top: -8px; right: -7px; font-size: 14px; line-height: 1; color: #e6c260; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.45)); }
    .cust-rev { text-align: right; flex: none; }
    .cust-rev .num { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
    .cust-rev .num.dim { color: var(--muted); font-weight: 600; }
    .cust-rev .seen { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
    .cust-vip-chip { font-size: 11px; font-weight: 700; color: #3a2e00; background: linear-gradient(135deg, #e6c260, #f0d98a); padding: 3px 10px; border-radius: 99px; letter-spacing: .02em; white-space: nowrap; }
    .cust-stats-4 { grid-template-columns: repeat(4, 1fr) !important; }
    #cust_avatar.vip { background: linear-gradient(135deg, color-mix(in srgb, var(--acc1, var(--brand)) 30%, transparent), color-mix(in srgb, var(--acc2, var(--brand)) 46%, transparent)) !important; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 50%, transparent); color: var(--ink) !important; }

    .tag-src {
      font-size: 10.5px;
      font-weight: 600;
      color: #94a3b8;
      text-transform: uppercase;
      letter-spacing: .04em
    }

    .ltags {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
      margin-top: 6px
    }

    .ltag {
      font-size: 11px;
      font-weight: 600;
      color: #475569;
      background: #f1f5f9;
      border: 1px solid #e2e8f0;
      border-radius: 6px;
      padding: 1px 7px
    }

    .ltag::before {
      content: "#";
      opacity: .5
    }

    .qual {
      margin-top: 5px;
      display: inline-block;
      font-size: 12px;
      font-weight: 600;
      color: var(--brand-d);
      background: var(--brand-soft);
      padding: 3px 9px;
      border-radius: 8px
    }

    .pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 999px
    }

    .pill .pip {
      width: 7px;
      height: 7px;
      border-radius: 50%
    }

    .s-new {
      background: #e0edff;
      color: #1d4ed8
    }

    .s-new .pip {
      background: #2563eb
    }

    .s-contacted {
      background: #fef3c7;
      color: #92400e
    }

    .s-contacted .pip {
      background: #d97706
    }

    .s-qualified {
      background: #ede9fe;
      color: #6d28d9
    }

    .s-qualified .pip {
      background: #7c3aed
    }

    .s-won {
      background: #dcfce7;
      color: #15803d
    }

    .s-won .pip {
      background: #16a34a
    }

    .s-lost {
      background: #fee2e2;
      color: #b91c1c
    }

    .s-lost .pip {
      background: #dc2626
    }

    .empty {
      text-align: center;
      padding: 60px 20px;
      color: var(--muted)
    }

    .empty .ic {
      font-size: 40px;
      margin-bottom: 10px
    }

    .empty h3 {
      margin: 0 0 6px;
      color: var(--ink);
      font-size: 16px
    }
