/* WP5 Kontakte: eigene Styles (WP0 legt die Datei leer an und verlinkt sie in base.html; Eigentum WP5, SPEC_UI_CLOSE_1ZU1 F.2) */

/* =============================================================================
   Kontaktliste (C-08, Nachtrag KON-01 bis KON-10) – Listenseite wie die Kontaktliste in Close (B.5, B.6.4; Bild E311).
   Maße an close\03_leads_all.png und close\M02_smartview_liste.png nachgemessen (je inkl. 1 px Linie):
   Name 295 px, Icon-Spalten 45 px, übrige Spalten 257 px, Kopf und Zeilen 41 px → die Tabelle ist 899 px breit.
   Alle Regeln hängen an .contacts-page / .contact-*, damit sie keine andere Liste treffen.
   ============================================================================= */

/* ---------- Seitenkopf 68 px + Linie wie die Leads-Liste (M02: y 49–116, Linie 117): beim Wechsel Leads ↔ Kontakte springt nichts ---------- */
.contacts-page > .page-head { min-height: 69px; }

/* ---------- Filterleiste: Suche · Trefferzahl · Sortierung · Spalten ---------- */
.contacts-page > .filter-bar { height: 49px; gap: 16px; }          /* 48 px + Linie [B 03: y 278–326] */
.contacts-page .filter-bar__right { gap: 4px; }                    /* 4 px zwischen „Sortierung“ und „Spalten“ wie in der Leads-Liste [M02] */
.contact-search { position: relative; flex: 0 1 280px; min-width: 160px; margin: 0; }
.contact-search .input { padding-left: 36px; }
.contact-search .input:focus { border-color: var(--border-search-focus); }   /* Suchfelder: #a9c7ff (B.6.2) */
.contact-search__icon { position: absolute; left: 12px; top: 8px; display: inline-flex; color: var(--gray-60); pointer-events: none; }
.contact-search .input::-webkit-search-cancel-button { cursor: pointer; }
.contacts-page .filter-bar__count b { font-weight: 600; }          /* „7.450 Kontakte“: Zahl 600 (KON-02) */
.contact-sort { display: inline-flex; }
.contact-sort > .btn .icon, .contacts-page .filter-bar__right > .btn .icon { color: var(--text-default); }   /* Icons der Knöpfe in Textfarbe wie in der Leads-Liste [M02] */
/* Maße der zwei Knöpfe wie in der Leads-Liste [M02]: Pfeil-Mitte 17,5 px, Text ab 30 px; Spalten-Icon 14 × 12 px ab 11 px, rechts 13 px frei */
.contacts-page .filter-bar__right .btn-sm { gap: 4px; padding: 0 9px 0 10px; }
.contacts-page .filter-bar__right .btn-sm .icon-columns-2 { margin-right: -3px; }
.contacts-page .filter-bar__right .btn-sm:has(.icon-columns-2) { padding: 0 13px 0 9px; }

/* Sortier-Menü: oben der zweigeteilte Richtungsschalter, darunter die Felder mit Häkchen (Close: Sort-Popover E249) */
.contact-sort-menu { width: 240px; padding-top: 8px; }
.contact-sort-dir { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin: 0 0 6px; padding: 2px; border-radius: 8px; background: var(--surface-dark); }
.contact-sort-dir__item.menu-item { justify-content: center; gap: 6px; min-height: 28px; padding: 0 8px; border-radius: 6px; font-size: 13px; line-height: 18px; color: var(--text-medium); }
.contact-sort-dir__item.menu-item:hover { background: var(--menu-item-hover); }
.contact-sort-dir__item.menu-item.is-on { background: var(--surface); color: var(--text-default); box-shadow: 0 0 0 1px var(--border-default); }
.contact-sort-dir__item.menu-item .icon { color: currentColor; }

/* ---------- Tabelle ---------- */
.contact-table { width: 0; }                                        /* Breiten nur aus <colgroup>: die Tabelle ist so breit wie ihre Spalten */
.contact-table col.col-name { width: 295px; }
.contact-table col.col-icon { width: 45px; }
.contact-table col.col-std { width: 257px; }
.contact-table thead th, .contact-table td, .contact-table tbody th { height: 41px; }   /* 40 px + Linie */
/* Name ist die erste Spalte (keine Checkbox-Spalte): Text bei x = 24 wie in den Close-Listen ohne Auswahl (E316), ↳ bei x = 6 */
.contact-table .col-name { left: 0; width: auto; padding: 0 12px 0 24px; }
.contact-table .col-icon, .contact-table .col-std { width: auto; }
/* Icons der Icon-Spalten: 12 px mit kräftiger Linie wie Close (M02: Tinte 12 × 12 bzw. 12 × 10; im Kopf #2e2e2e, in Zeilen #474747) – KON-08 */
.contact-table .col-icon .icon { width: 12px; height: 12px; stroke-width: 2; }
.contact-table thead .col-icon .icon { display: block; margin: 0 auto; color: var(--text-default); }
.contact-action .icon { position: relative; top: 1px; }                 /* in den Zeilen 1 px unter der Mitte wie Close [M02: y 361–372 in 346–385] */
.contact-table tbody tr.is-cursor > * { background: var(--table-row-cursor); }
.contact-table .row-cursor-marker { top: 50%; margin-top: -7px; }

/* Spaltenkopf (KON-09; Close E312): das Wort sortiert, Pfeil 12 px hinter dem Label; beim Überfahren Grund #f1f1f1, ⇅ #919191 an einer
   noch nicht sortierten Spalte und rechts ⋯ (Aufsteigend/Absteigend sortieren · Spalte ausblenden) */
.contact-table thead th.col-name, .contact-table thead th.col-std { padding: 0; }
.contact-table thead th:not(.col-icon):hover, .contact-table thead th:not(.col-icon):focus-within { background: var(--table-header-hover); }
.contact-th-inner { display: flex; align-items: center; height: 100%; min-width: 0; padding-right: 8px; }
.contact-th { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; height: 100%; padding: 0 4px 0 12px; color: var(--text-default); font-weight: 600; }
.contact-th > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.contact-th:hover { color: var(--text-default); text-decoration: none; }
.contact-th .icon { color: var(--text-default); flex: none; stroke-width: 3; }    /* Sortierpfeil wie in der Leads-Liste [M02: 8 × 13 px, kräftig] */
.contact-th .contact-th__hint { color: var(--gray-40); stroke-width: 2; visibility: hidden; }
.contact-table thead th:hover .contact-th__hint, .contact-th:focus-visible .contact-th__hint { visibility: visible; }
.contact-table thead th.col-name .contact-th { padding-left: 24px; }
.contact-th-more { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--gray-40); cursor: pointer; opacity: 0; flex: none; }
.contact-th-more:hover { background: var(--bg-hover); color: var(--icon-default); }
.contact-table thead th:hover .contact-th-more, .contact-th-more:focus-visible, .contact-th-more[aria-expanded="true"] { opacity: 1; }

/* Lead-Status (Spaltenwahl KON-06): Punkt 10 px in der Statusfarbe + Name, einzeilig mit Ellipse */
.contact-status { display: flex; align-items: center; gap: 12px; min-width: 0; }
.contact-status .status-dot { width: 10px; height: 10px; }
.contact-status__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Fußzeile „+ Berechnung“ (KON-10; Close E311: unter Name und Title): Knopf und Menü sind die der Leads-Liste (.calc-btn, .calc-menu) */
.contact-table tfoot td { height: 39px; padding: 0; }
.contact-table tfoot td.contact-calc--name { position: sticky; left: 0; z-index: calc(var(--z-sticky) + 1); }
.contact-calc--name .calc-btn { padding-left: 25px; }

/* Spalten-Popover (KON-06; Close E248): Bausteine des Spalten-Popovers der Leads-Liste, hier ohne Suchfeld (acht Zeilen) */
.contact-columns .popover__body { padding-top: 8px; }
.contact-columns .menu-group__head { cursor: default; }

/* Name: blauer Link direkt am Zeilenanfang, kein Avatar (Close-Kontaktliste, E311); einzeilig mit Ellipse */
.contact-table tbody .col-name .entity { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-table tbody .col-name .entity.is-unnamed { color: var(--text-light); }      /* leerer Name: „(ohne Namen)“ #767676 (E18) */

/* Icon-Spalten: E-Mail / Anrufen, Icon 12 px #474747; ohne Adresse bzw. Nummer #ababab und nicht bedienbar (KON-01, KON-08) */
.contact-action { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; color: var(--icon-default); vertical-align: middle; }
a.contact-action:hover { background: var(--bg-hover); text-decoration: none; color: var(--icon-default); }
.contact-action.is-off { color: var(--gray-30); }

/* Nachladen: Sentinel-Zeile ohne Linien; während der Anfrage ein Skelett-Balken statt des Links (B.6.12) */
.contact-table tr.sentinel > td { height: 40px; padding: 0 12px 0 24px; border-right: 0; border-bottom: 0; background: transparent; font-size: 13px; line-height: 18px; }
.contact-table tr.sentinel:hover > td { background: transparent; }
.contact-table tr.sentinel.htmx-request a { visibility: hidden; }
.contact-table tr.sentinel.htmx-request > td { background: linear-gradient(var(--bg-skeleton), var(--bg-skeleton)) 24px center / 180px 12px no-repeat; }

/* Leerzustand unter dem Tabellenkopf, in der sichtbaren Breite zentriert */
.contact-empty { position: sticky; left: 0; padding: 48px 24px; }

/* Schmale Fenster (B.7): der Name bleibt nicht links stehen, sonst bliebe für die übrigen Spalten kein Platz */
@media (max-width: 767.98px) {
  .contacts-page > .filter-bar { gap: 12px; padding: 0 16px; }
  .contact-table .col-name { left: auto; }
}
