/* ============================================================
   Kontakte-Modul — Styles (kt-*)
   Nutzt globale Tokens (--brand/--bg/--surface/--border/--text*) und
   globale .btn/.page-header. Ergänzt modul-lokale Buttons/Layout.
   ============================================================ */

#kontakte-mount { padding: 22px 26px; overflow-y: auto; height: 100%; }

/* ---- Buttons (modul-lokal) ---- */
#kontakte-mount .btn.sm { padding: 4px 9px; font-size: 12px; }
#kontakte-mount .btn.danger { color: #b42318; border-color: #f1c4bf; }
#kontakte-mount .btn.danger:hover { background: #fdf3f2; }
#kontakte-mount .iconbtn { display: inline-grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text-muted); cursor: pointer; }
#kontakte-mount .iconbtn:hover { background: var(--bg); color: var(--brand-dark); }
#kontakte-mount .iconbtn.danger:hover { color: #b42318; background: #fdf3f2; }
#kontakte-mount .iconbtn svg, #kontakte-mount .btn svg { width: 15px; height: 15px; }

/* ---- Banner ---- */
.kt-banner { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 12.5px; margin: 12px 0; border: 1px solid var(--border); background: var(--surface); }
.kt-banner.on { background: #f0fbf6; border-color: #cdeedd; }
.kt-banner.mock { background: #fff8ec; border-color: #f3e2bf; }
.kt-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.kt-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; }
.kt-banner.mock .kt-pill .dot { background: #d99a16; }
.kt-banner-txt { color: var(--text-muted); }

/* ---- Tabs ---- */
.kt-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.kt-tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border: none; background: none;
  color: var(--text-muted); font-size: 13.5px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.kt-tab svg { width: 16px; height: 16px; }
.kt-tab:hover { color: var(--text); }
.kt-tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.kt-cnt { font-size: 11px; background: var(--bg); color: var(--text-muted); border-radius: 10px; padding: 1px 7px; }
.kt-tab.active .kt-cnt { background: var(--brand-soft); color: var(--brand-dark); }

/* ---- Toolbar ---- */
.kt-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.kt-search { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 7px; padding: 7px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.kt-search svg { width: 16px; height: 16px; color: var(--text-dim); }
.kt-search input { border: none; outline: none; flex: 1; font-size: 14px; background: none; color: var(--text); }
.kt-select { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 13px; }
.kt-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; }

/* ---- Split: Liste + Detail ---- */
.kt-split { display: grid; grid-template-columns: minmax(280px, 1.1fr) minmax(320px, 1.4fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .kt-split { grid-template-columns: 1fr; } }

.kt-list-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; max-height: 70vh; overflow-y: auto; }
.kt-table { width: 100%; border-collapse: collapse; }
.kt-table tr { cursor: pointer; border-bottom: 1px solid var(--border); }
.kt-table tr:last-child { border-bottom: none; }
.kt-table tr:hover { background: var(--bg); }
.kt-table tr.sel { background: var(--brand-soft); }
.kt-table tr.inact { opacity: 0.5; }
.kt-table td { padding: 10px 14px; vertical-align: middle; font-size: 13.5px; }
.kt-main { font-weight: 600; color: var(--text); }
.kt-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.kt-right { text-align: right; color: var(--text-muted); font-size: 12.5px; white-space: nowrap; }
.kt-empty { text-align: center; color: var(--text-dim); padding: 28px; font-size: 13px; }

/* ---- Detail ---- */
.kt-detail { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 18px 20px; min-height: 200px; }
.kt-detail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-dim); padding: 40px 0; }
.kt-detail-empty svg { width: 26px; height: 26px; }
.kt-detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kt-detail-head h2 { margin: 0; font-size: 18px; }
.kt-role { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.kt-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--bg); color: var(--text-muted); font-weight: 600; }
.kt-badge.inact { background: #fdecea; color: #b42318; }
.kt-badge.t-auftraggeber { background: #e6f6fc; color: var(--brand-dark); }
.kt-badge.t-planer { background: #ecfdf3; color: #15803d; }
.kt-badge.t-lieferant { background: #fef6e7; color: #b45309; }
.kt-badge.t-subunternehmer { background: #f3effe; color: #6d28d9; }
.kt-badge.t-behoerde, .kt-badge.t-bauherrschaft { background: #eef2f7; color: #475569; }
.kt-detail-actions { display: flex; gap: 8px; margin: 12px 0 4px; }
.kt-fields { margin: 12px 0; }
.kt-frow { display: flex; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.kt-frow:last-child { border-bottom: none; }
.kt-flabel { flex: 0 0 110px; color: var(--text-muted); font-size: 12.5px; }
.kt-fval { flex: 1; color: var(--text); word-break: break-word; }
.kt-fval a { color: var(--brand-dark); text-decoration: none; }
.kt-fval a:hover { text-decoration: underline; }
.kt-section { margin-top: 16px; }
.kt-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); margin: 0 0 8px; }
.kt-muted { color: var(--text-dim); font-size: 13px; margin: 0; }
.kt-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; margin: 0 6px 6px 0;
  border: 1px solid var(--border); border-radius: 16px; background: var(--bg); font-size: 12.5px; cursor: pointer; color: var(--text); }
.kt-chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.kt-chip svg { width: 13px; height: 13px; }
.kt-chip-sub { color: var(--text-muted); }
.kt-ti { width: 13px; height: 13px; color: var(--text-dim); vertical-align: -1px; margin-right: 2px; }
.kt-check { margin-right: 8px; vertical-align: -1px; cursor: pointer; accent-color: var(--brand); }
.kt-selbar[hidden] { display: none; }
.kt-selbar { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 12px;
  background: var(--brand-soft); border: 1px solid #bde6f4; border-radius: var(--radius-sm); }
.kt-selcount { font-weight: 600; color: var(--brand-dark); font-size: 13px; }
.kt-mailopt { display: flex; align-items: center; gap: 11px; width: 100%; justify-content: flex-start; padding: 12px 14px; text-align: left; }
.kt-mailopt svg { width: 18px; height: 18px; flex-shrink: 0; }
.kt-mailopt span { display: flex; flex-direction: column; line-height: 1.3; }
.kt-mailopt small { font-weight: 400; opacity: 0.8; font-size: 11.5px; margin-top: 1px; }
.kt-sublist { max-height: 320px; }
.kt-sublist .kt-table td { padding: 7px 12px; }
.kt-chip.mini { cursor: default; padding: 3px 8px; font-size: 11.5px; }
.kt-chip.mini:hover { border-color: var(--border); color: var(--text); }

/* ---- Editor-Overlay ---- */
.kt-overlay { position: fixed; inset: 0; background: rgba(20,28,38,0.42); z-index: 1000;
  display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 16px; }
.kt-dialog { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 540px; margin: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.kt-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.kt-dialog-head h2 { margin: 0; font-size: 16px; }
.kt-dialog-body { padding: 16px 20px; max-height: 64vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.kt-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.kt-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-muted); }
.kt-field input, .kt-field select, .kt-field textarea { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); background: var(--surface); font-family: inherit; }
.kt-field input:focus, .kt-field select:focus, .kt-field textarea:focus { outline: none; border-color: var(--brand); }
.kt-field textarea { min-height: 60px; resize: vertical; }
.kt-grid2 { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.kt-grid3 { display: grid; grid-template-columns: 0.8fr 1fr 1fr; gap: 10px; }
.kt-sub-head { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.kt-sub-head h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }
.kt-sub-head select { margin-left: auto; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; }
.kt-grid-kanal { display: grid; grid-template-columns: 0.9fr 1.5fr 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.kt-grid-kanal select, .kt-grid-kanal input { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; }
.kt-grid-firma { display: grid; grid-template-columns: 1.1fr 1fr 1fr auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.kt-grid-firma input { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; }
.kt-firma-name { font-size: 13px; font-weight: 600; color: var(--text); }
.kt-mini { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--text-muted); }

/* ---- Provenienz / Review ---- */
.kt-prov { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 9px; vertical-align: middle; }
.kt-prov svg { width: 11px; height: 11px; }
.kt-prov.auto { background: #f3effe; color: #6d28d9; }
.kt-prov.ver { background: #ecfdf3; color: #15803d; padding: 1px 4px; }
.kt-cnt.review { background: #fde68a; color: #92651b; }
.kt-grouprow td { background: var(--bg); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-dim); font-weight: 600; padding: 7px 14px; cursor: default; }
.kt-grouprow { cursor: default; }
.kt-grouprow:hover td { background: var(--bg); }
.kt-review-hint { display: flex; align-items: flex-start; gap: 7px; background: #fff8ec; border: 1px solid #f3e2bf;
  color: #92651b; font-size: 12.5px; padding: 8px 11px; border-radius: var(--radius-sm); margin: 10px 0 4px; }
.kt-review-hint svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }

/* ---- State (Loading/Error) ---- */
.kt-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 60px 0; color: var(--text-muted); }
.kt-state svg { width: 22px; height: 22px; }
.kt-spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: kt-spin 0.8s linear infinite; }
@keyframes kt-spin { to { transform: rotate(360deg); } }
