/* §CHATLIST-DESKTOP-2026-10-17 — Chatliste Desktop (≥ 900 px, Maus) im Stil
 * WhatsApp Web / Signal Desktop, Dark Mode.
 *
 *   [Rail] | Sidebar min(380px, 35 %) | Chat oder Platzhalter [| Panel ≥ 1200]
 *
 * Markup: index.html (.ecf-contacts) + ui-render.js syncRooms()/ecfPaintRoomMeta().
 * Daten: ausschließlich window.ecChatListMeta (gemeinsam mit der Mobil-Liste).
 * Tablet/iPad (Touch) läuft in der Mobil-Shell — siehe ec-tablet-split.css.
 *
 * Spezifität: Bestandsregeln in desktop-overrides.css / ec-theme-layer.css
 * tragen EINE ID (+ !important, bis 1-4-2). Hier steht die Shell-ID doppelt
 * (2-x-x), damit diese Datei unabhängig von der Ladereihenfolge gewinnt.
 * Nur unter body.auth-ready und nur ≥ 900 px — die Mobil-Shell (< 900 px oder
 * Touch) blendet #ec-claude-shell-final ohnehin aus. */

html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final {
  --ecl-bg: #0b0e14;
  --ecl-line: rgba(255, 255, 255, 0.06);
  --ecl-edge: rgba(255, 255, 255, 0.08);
  --ecl-hover: rgba(255, 255, 255, 0.04);
  --ecl-active: rgba(255, 255, 255, 0.07);
  --ecl-name: #f1f5f9;
  --ecl-muted: #939393;
  --ecl-accent: #afafaf;
  --ecl-accent-ink: #131313;
  --ecl-read: #aaaaaa;
}
/* Themes (ec-theme-layer.css): Fläche und Akzent aus den Theme-Tokens. */
html[data-theme]:not([data-theme="oled-midnight"]) body.auth-ready #ec-claude-shell-final#ec-claude-shell-final {
  --ecl-bg: color-mix(in srgb, var(--bg-primary, #0b0e14) 88%, var(--bg-panel, #0b0e14));
  --ecl-accent: var(--accent-color, #afafaf);
  --ecl-accent-ink: #0f0f0f;
}

@media (min-width: 900px) {
  /* ── Raster: feste Sidebar, Chat füllt den Rest ───────────────────────── */
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-main { padding: 0 !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-chat-layout {
    grid-template-columns: min(380px, 35%) minmax(0, 1fr) !important;
    gap: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts,
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-chat-panel {
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-chat-panel {
    border: 0 !important;
    min-width: 0 !important;
  }

  /* ── Sidebar ──────────────────────────────────────────────────────────── */
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts {
    width: auto !important; max-width: none !important; min-width: 0 !important;
    display: flex !important; flex-direction: column !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: var(--ecl-bg) !important;
    border: 0 !important;
    border-right: 1px solid var(--ecl-edge) !important;
    backdrop-filter: none !important;
  }

  /* Kopf: "Chats" + kleines Schloss, runde Aktionsknöpfe rechts. */
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-panel-head {
    display: flex !important; align-items: center !important; gap: 8px !important;
    flex: 0 0 auto !important;
    margin: 0 !important; padding: 14px 12px 10px 16px !important;
    border: 0 !important; background: none !important; min-height: 0 !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-head-title {
    display: flex !important; align-items: center !important; gap: 8px !important;
    flex: 1 1 auto !important; min-width: 0 !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-panel-head .ecf-kicker,
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-panel-head .ecf-status { display: none !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-panel-head h1 {
    margin: 0 !important;
    font-size: 28px !important; font-weight: 700 !important; line-height: 1.15 !important;
    letter-spacing: -0.02em !important;
    color: var(--ecl-name) !important;
    white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important;
    min-width: 0 !important;
    background: none !important; -webkit-text-fill-color: currentColor !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-head-lock {
    flex: 0 0 auto; display: inline-grid; place-items: center;
    width: 16px; height: 16px; color: var(--ecl-muted); margin-top: 2px;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-head-lock svg { width: 16px; height: 16px; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-head-actions {
    display: flex !important; align-items: center !important; gap: 4px !important; flex: 0 0 auto !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-head-actions .ecf-head-btn {
    width: 36px !important; height: 36px !important; min-width: 36px !important; min-height: 36px !important;
    padding: 0 !important; margin: 0 !important;
    display: inline-grid !important; place-items: center !important;
    border: 0 !important; border-radius: 50% !important;
    background: transparent !important; box-shadow: none !important;
    color: #d4d4d4 !important; cursor: pointer !important;
    transition: background-color .15s ease, color .15s ease !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-head-actions .ecf-head-btn:hover { background: rgba(255, 255, 255, 0.08) !important; color: #fff !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-head-actions .ecf-head-btn:focus-visible { outline: 2px solid var(--ecl-accent) !important; outline-offset: 1px !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-head-actions .ecf-head-btn svg { width: 20px; height: 20px; }

  /* Suchfeld */
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-toolbar {
    display: block !important; flex: 0 0 auto !important;
    margin: 0 !important; padding: 0 16px 10px !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-search {
    display: flex !important; align-items: center !important; gap: 10px !important;
    box-sizing: border-box !important;
    width: 100% !important; height: 36px !important; min-height: 36px !important;
    padding: 0 12px !important; margin: 0 !important;
    border: 0 !important; border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.08) !important; box-shadow: none !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-search:focus-within { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14) !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-search-ico {
    flex: 0 0 auto; display: inline-grid; place-items: center; width: 18px; height: 18px; color: var(--ecl-muted);
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-search-ico svg { width: 18px; height: 18px; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-search input {
    flex: 1 1 auto !important; min-width: 0 !important; width: auto !important; height: 100% !important;
    padding: 0 !important; margin: 0 !important; border: 0 !important; outline: 0 !important;
    background: transparent !important; box-shadow: none !important;
    color: #e9edef !important; font-size: 14px !important; line-height: 36px !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-search input::placeholder { color: var(--ecl-muted) !important; opacity: 1 !important; }

  /* Filter-Chips 28 px, eine Zeile (scrollt bei Bedarf in sich). */
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-filter-row {
    display: flex !important; flex-wrap: nowrap !important; gap: 8px !important;
    flex: 0 0 auto !important;
    margin: 0 !important; padding: 0 16px 10px !important;
    overflow-x: auto !important; overflow-y: hidden !important; scrollbar-width: none !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-filter-row::-webkit-scrollbar { display: none; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-filter-row button {
    flex: 0 0 auto !important;
    height: 28px !important; min-height: 28px !important; max-height: 28px !important;
    padding: 0 12px !important; margin: 0 !important;
    border: 0 !important; border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.06) !important; box-shadow: none !important;
    color: #b8b8b8 !important;
    font-size: 13px !important; font-weight: 500 !important; line-height: 28px !important;
    letter-spacing: 0 !important; text-transform: none !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-filter-row button:hover { background: rgba(255, 255, 255, 0.1) !important; color: #e9edef !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-filter-row button.active,
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-contacts .ecf-filter-row button[aria-pressed="true"] {
    background: color-mix(in srgb, var(--ecl-accent) 18%, transparent) !important;
    color: color-mix(in srgb, var(--ecl-accent) 70%, #ffffff) !important;
  }

  /* ── Liste: flache Zeilen, Trennlinie erst ab der Textspalte ──────────── */
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list {
    display: block !important;
    flex: 1 1 auto !important; min-height: 0 !important;
    margin: 0 !important; padding: 0 !important; gap: 0 !important;
    overflow-x: hidden !important; overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
    background: transparent !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room {
    content-visibility: auto;
    contain-intrinsic-size: auto 72px;
    display: grid !important;
    grid-template-columns: 50px minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 14px !important; row-gap: 0 !important;
    box-sizing: border-box !important;
    width: 100% !important; min-width: 0 !important;
    min-height: 72px !important; height: 72px !important;
    margin: 0 !important; padding: 0 0 0 16px !important;
    border: 0 !important; border-radius: 0 !important; outline: 0;
    background: transparent !important; box-shadow: none !important;
    transform: none !important;
    text-align: left !important; color: inherit !important; cursor: pointer !important;
    transition: background-color .12s ease !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room::before,
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room::after { display: none !important; content: none !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room:hover { background: var(--ecl-hover) !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room.active,
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room.active:hover { background: var(--ecl-active) !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ecl-accent) 60%, transparent) !important; }

  /* Avatar 50×50 rund (Profil-/Gruppenbild aus ec-chat-extras.js legt sich darüber). */
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-avatar {
    position: relative !important;
    display: grid !important; place-items: center !important;
    width: 50px !important; height: 50px !important; min-width: 50px !important;
    margin: 0 !important; padding: 0 !important;
    border: 0 !important; border-radius: 50% !important; overflow: hidden !important;
    background: linear-gradient(145deg, #333333, #1c1c1c) !important; box-shadow: none !important;
    color: #e3e3e3 !important; font-size: 18px !important; font-weight: 600 !important; line-height: 1 !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-avatar > img.ec-av-img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  }

  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-body {
    display: flex !important; flex-direction: column !important; justify-content: center !important; gap: 3px !important;
    box-sizing: border-box !important;
    min-width: 0 !important; height: 100% !important;
    padding: 0 16px 0 0 !important;
    border-bottom: 1px solid var(--ecl-line) !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room:last-child .ecf-room-body { border-bottom-color: transparent !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-line1,
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-line2 {
    display: flex !important; align-items: center !important; gap: 6px !important; min-width: 0 !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-line1 { align-items: baseline !important; gap: 8px !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-name {
    flex: 1 1 auto !important; min-width: 0 !important;
    margin: 0 !important; display: block !important;
    font-size: 16px !important; font-weight: 600 !important; line-height: 21px !important;
    color: var(--ecl-name) !important;
    white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-time {
    flex: 0 0 auto !important; margin: 0 !important; padding: 0 !important;
    font-size: 12px !important; font-weight: 400 !important; line-height: 16px !important;
    color: var(--ecl-muted) !important; font-family: inherit !important; letter-spacing: 0 !important;
    white-space: nowrap !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room--unread .ecf-room-time { color: var(--ecl-accent) !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-status {
    flex: 0 0 auto; display: inline-grid; place-items: center; height: 18px; color: var(--ecl-muted);
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-status[hidden] { display: none !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-status svg { width: 18px; height: 18px; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-status[data-status="read"] { color: var(--ecl-read); }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-snippet {
    flex: 1 1 auto !important; min-width: 0 !important; display: block !important;
    margin: 0 !important; padding: 0 !important;
    font-size: 14px !important; font-weight: 400 !important; line-height: 20px !important;
    color: var(--ecl-muted) !important; text-transform: none !important; letter-spacing: 0 !important;
    white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-flags {
    flex: 0 0 auto !important; display: inline-flex !important; align-items: center !important; gap: 6px !important; margin-left: 2px !important;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-muted {
    display: inline-grid; place-items: center; width: 16px; height: 16px; color: var(--ecl-muted); font-style: normal;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-muted svg { width: 16px; height: 16px; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-unread {
    display: inline-grid; place-items: center; box-sizing: border-box;
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: var(--ecl-accent); color: var(--ecl-accent-ink);
    font-size: 12px; font-weight: 700; font-style: normal; line-height: 1;
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room--muted .ecf-room-unread { background: #656565; color: #0b0e14; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-muted[hidden],
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list .ecf-room-unread[hidden] { display: none !important; }

  /* Kontakte-Ansicht und Leerzustände nutzen dieselbe Liste: ruhig halten. */
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room[data-ec-final-contact] { height: auto !important; min-height: 64px !important; grid-template-columns: 50px minmax(0, 1fr) auto !important; padding-right: 16px !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room[data-ec-final-contact] strong { display: block; font-size: 16px; font-weight: 600; color: var(--ecl-name); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room[data-ec-final-contact] small { display: block; font-size: 13px; color: var(--ecl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room[data-ec-final-contact] > span:nth-child(2) { min-width: 0; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-empty { margin: 12px 16px !important; }

  /* ── Rechts: Platzhalter ohne aktiven Chat ────────────────────────────── */
  html body.auth-ready:not(.ec-final-room-open) #ec-claude-shell-final#ec-claude-shell-final .ecf-chat-head { display: none !important; }
  html body.auth-ready:not(.ec-final-room-open) #ec-claude-shell-final#ec-claude-shell-final .ecf-chat-panel { background: #121212 !important; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-chat-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    box-sizing: border-box; width: 100%; height: 100%; min-height: 240px; padding: 32px;
    text-align: center; color: var(--ecl-muted);
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-chat-placeholder-lock {
    display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.04); color: rgba(212, 212, 212, 0.55);
  }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-chat-placeholder-lock svg { width: 30px; height: 30px; }
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-chat-placeholder p {
    margin: 0; max-width: 340px; font-size: 15px; line-height: 1.5; color: var(--ecl-muted);
  }
}

/* ≥ 1200 px: Verwaltungs-Panel als dritte Spalte, nur bei offenem Chat
   und eingeblendetem Panel (sonst keine tote Spalte, vgl. ec-tablet-split.css). */
@media (min-width: 1200px) {
  html body.auth-ready.ec-final-room-open #ec-claude-shell-final#ec-claude-shell-final:not(.ecf-rp-hidden) .ecf-chat-layout {
    /* §CHAT-LAYOUT-RP-2026-11-02: Chat-Tools-Spalte 300–320 px (Owner: ~300–340). */
    grid-template-columns: min(380px, 35%) minmax(0, 1fr) minmax(300px, 320px) !important;
  }
  html body.auth-ready.ec-final-room-open #ec-claude-shell-final#ec-claude-shell-final:not(.ecf-rp-hidden) .ecf-rightpanel {
    border-radius: 0 !important; margin: 0 !important;
    border: 0 !important; border-left: 1px solid var(--ecl-edge) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final #ec-final-room-list > .ecf-room,
  html body.auth-ready #ec-claude-shell-final#ec-claude-shell-final .ecf-head-actions .ecf-head-btn { transition: none !important; }
}

/* Platzhalter füllt die ganze rechte Fläche (Kopf und Eingabe sind ohne Chat aus). */
@media (min-width: 900px) {
  html body.auth-ready:not(.ec-final-room-open) #ec-claude-shell-final#ec-claude-shell-final .ecf-chat-panel {
    display: flex !important; flex-direction: column !important;
  }
  html body.auth-ready:not(.ec-final-room-open) #ec-claude-shell-final#ec-claude-shell-final .ecf-chat-stream {
    flex: 1 1 auto !important; min-height: 0 !important; height: auto !important; max-height: none !important;
    background: transparent !important;
  }
}
