/* PositionTableEngine — Styles */
/* Datei: public/css/position-table-engine.css */

/* ── Wrap & Layout ────────────────────────────────────────────────────── */
.pte-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  border: 1px solid #e0e4ea;
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
  max-width: 100%;
}

.pte-table-area {
  overflow: hidden;
}

.pte-scroll-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 65vh;
}

/* ── Toolbar ──────────────────────────────────────────────────────────── */
.pte-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f7f9fc;
  border-bottom: 1px solid #e0e4ea;
  flex-wrap: wrap;
}

.pte-toolbar--loading {
  justify-content: center;
  padding: 16px;
}

.pte-toolbar-spacer { flex: 1; }

.pte-mode-badge {
  background: #3b5bdb;
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.pte-btn {
  padding: 5px 11px;
  border-radius: 5px;
  border: 1px solid #d0d5dd;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: background .1s, border-color .1s;
}
.pte-btn:hover { background: #f0f4ff; border-color: #3b5bdb; }
.pte-btn--primary { background: #3b5bdb; color: #fff; border-color: #3b5bdb; }
.pte-btn--primary:hover { background: #2c46b8; }
.pte-btn--ghost { background: transparent; border-color: #d0d5dd; }
.pte-btn--ghost:hover { background: #f0f4ff; }
.pte-btn--danger:hover { background: #fff0f0; border-color: #e74c3c; color: #e74c3c; }
.pte-btn--sm { padding: 3px 8px; font-size: 11px; }
.pte-btn--icon {
  padding: 2px 6px;
  min-width: 26px;
  border-color: transparent;
  background: transparent;
  font-size: 13px;
}
.pte-btn--icon:hover { background: #e8edff; border-color: #b0bce0; }

/* ── Speicherstatus ───────────────────────────────────────────────────── */
.pte-save-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 11px;
  border-bottom: 1px solid #e0e4ea;
  background: #f7f9fc;
}
.pte-save-status--saved { color: #27ae60; }
.pte-save-status--pending { color: #e67e22; }
.pte-save-status--saving { color: #3b5bdb; }
.pte-save-status--error { color: #e74c3c; background: #fff5f5; }
.pte-save-icon { font-size: 12px; }

/* ── Warnungsleiste ───────────────────────────────────────────────────── */
.pte-warning-bar {
  padding: 6px 12px;
  background: #fffbf0;
  border-bottom: 1px solid #f0d080;
  font-size: 12px;
  color: #7a5c00;
}

/* ── Tabelle ──────────────────────────────────────────────────────────── */
.pte-table {
  border-collapse: collapse;
  table-layout: fixed;
  /* width wird inline als Summe aller Spaltenbreiten gesetzt */
}

/* ── Header ───────────────────────────────────────────────────────────── */
.pte-header-row {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f0f4ff;
}

.pte-th {
  padding: 7px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: #4a5568;
  border-bottom: 2px solid #d0d9f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  user-select: none;
}

.pte-col-resize {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  background: transparent;
  z-index: 10;
}
.pte-col-resize:hover { background: var(--accent, #E73D25); opacity: 0.5; }
.pte-col-resize:active { background: var(--accent, #E73D25); opacity: 0.8; }
.pte-th { overflow: visible !important; }

/* ── Spalten Drag & Drop ─────────────────────────────────────────────── */
.pte-th[draggable="true"] { cursor: grab; }
.pte-th[draggable="true"]:active { cursor: grabbing; }
.pte-th--dragging { opacity: .4; background: #d0d9f0 !important; }
.pte-th--drag-over {
  background: #e0e8ff !important;
  box-shadow: inset 0 0 0 2px #3b5bdb;
  border-radius: 2px;
}

.pte-col-drag, .pte-col-actions { width: 32px; }
.pte-col-actions { width: 120px; }

/* ── Zeilen ───────────────────────────────────────────────────────────── */
.pte-row { border-bottom: 1px solid #f0f2f5; transition: background .08s; }
.pte-row:nth-child(even) { background: #fafbfd; }
.pte-row:hover { background: #f0f4ff; }
.pte-row--selected { background: #e8edff !important; }
.pte-row--warning { background: #fffbf0 !important; }
.pte-row--dragging { opacity: .5; }
.pte-row--drag-over { border-top: 2px solid #3b5bdb; }

/* Gruppenzeilen */
.pte-row--group-header {
  background: #eef1fa !important;
  font-weight: 600;
}
.pte-row--group-header:hover { background: #e4e9f8 !important; }

/* Unterzeilen */
.pte-row--subitem { background: #f8f9fe !important; }
.pte-row--subitem2 { background: #f4f5fc !important; }

/* Interne NB-Zeilen */
.pte-row--internal { opacity: .75; font-style: italic; }
.pte-row--internal:hover { opacity: 1; }

/* Optionale Positionen */
.pte-row--optional { background: #fffff0 !important; border-left: 3px solid #e6c800; }

/* ── Überschrift-Zeile (positionKind: heading) ────────────────────────── */
.pte-row--heading {
  background: #f0f9ff !important;
  border-top: 2px solid #bae6fd;
  border-bottom: 2px solid #bae6fd;
}
.pte-row--heading:hover { background: #e0f2fe !important; }

.pte-cell--heading-title {
  white-space: normal;
  overflow: visible;
  max-width: none;
  cursor: text;
}
.pte-cell--heading-title:hover { background: #dbeafe; border-radius: 3px; }
.pte-cell--heading-title:focus { outline: 2px solid #0ea5e9; outline-offset: -2px; background: #eff9ff; border-radius: 2px; }

.pte-heading-text {
  font-size: 13px;
  font-weight: 700;
  color: #0c4a6e;
  border-left: 3px solid #0ea5e9;
  padding-left: 8px;
  line-height: 1.4;
  min-height: 20px;
}

/* ── Texthinweis-Zeile (positionKind: textNote / type: text) ──────────── */
.pte-row--text-note {
  background: #fffbeb !important;
  border-bottom: 1px solid #fde68a;
}
.pte-row--text-note:hover { background: #fef9e7 !important; }

.pte-cell--text-title {
  white-space: normal;
  overflow: visible;
  max-width: none;
  cursor: text;
}
.pte-cell--text-title:hover { background: #fef3c7; border-radius: 3px; }
.pte-cell--text-title:focus { outline: 2px solid #d97706; outline-offset: -2px; background: #fffbeb; border-radius: 2px; }

.pte-text-note {
  font-size: 12px;
  font-style: italic;
  color: #78716c;
  min-height: 18px;
  line-height: 1.5;
}

/* ── Trennlinie-Zeile (positionKind: separator) ───────────────────────── */
.pte-row--separator { border-bottom: none; }
.pte-row--separator:hover { background: transparent !important; }
.pte-cell--separator { padding: 4px 8px; }
.pte-separator-line {
  border: none;
  border-top: 2px solid #d1d5db;
  margin: 4px 0;
}

/* ── Toolbar-Ergänzungen ─────────────────────────────────────────────── */
.pte-toolbar-sep {
  width: 1px;
  height: 18px;
  background: #d0d5dd;
  margin: 0 2px;
  flex-shrink: 0;
}
.pte-btn--text { color: #d97706; }
.pte-btn--text:hover { background: #fffbeb; border-color: #d97706; color: #d97706; }
.pte-btn--heading { color: #0ea5e9; }
.pte-btn--heading:hover { background: #f0f9ff; border-color: #0ea5e9; color: #0ea5e9; }
.pte-btn--sep { color: #6b7280; }
.pte-btn--sep:hover { background: #f3f4f6; border-color: #9ca3af; color: #374151; }

/* Systemgruppen (Monteur) */
.pte-row--system-group {
  background: #f0f8ff !important;
  border-left: 3px solid #0ea5e9;
}
.pte-row--system-group.pte-row--hours {
  background: linear-gradient(135deg, #fff8f0 0%, #ffe8cc 100%) !important;
  border-left-color: #e67e22;
}
.pte-row--system-group.pte-row--material {
  background: linear-gradient(135deg, #f0fff4 0%, #c8f7d6 100%) !important;
  border-left-color: #27ae60;
}
.pte-row--system { background: #f5fbff !important; font-size: 12px; }
.pte-row--system.pte-row--internal { opacity: 0.85; }
.pte-row--system.pte-row--billing-billable { background: #fffff0 !important; font-style: normal; opacity: 1; }
.pte-row--system.pte-row--billing-internal { font-style: italic; }
.pte-row--system.pte-row--billing-documentation { font-style: italic; color: #6c757d; }
.pte-row--system.pte-row--billing-attendance { font-style: italic; color: #868e96; }
.pte-row--system.pte-row--status-approved { border-left: 2px solid #27ae60; }
.pte-row--system.pte-row--status-submitted { border-left: 2px solid #f39c12; }
.pte-row--system.pte-row--status-draft { border-left: 2px solid #bdc3c7; }
.pte-row--system.pte-row--status-rejected { border-left: 2px solid #e74c3c; text-decoration: line-through; opacity: 0.5; }

/* ── Zellen ───────────────────────────────────────────────────────────── */
.pte-cell {
  padding: 5px 8px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0; /* wichtig für text-overflow in table-layout:fixed */
}

.pte-cell--drag { width: 32px; text-align: center; padding: 0 4px; }
.pte-cell--actions { width: 120px; white-space: nowrap; text-align: right; }
.pte-cell--system { color: #555; }

.pte-cell--editable { cursor: text; }
.pte-cell--editable:hover { background: #e8f0ff; border-radius: 3px; }
.pte-cell--editable:focus {
  outline: 2px solid #3b5bdb;
  outline-offset: -2px;
  border-radius: 2px;
  background: #f0f5ff;
  box-shadow: inset 0 0 0 1px #3b5bdb;
}

/* Zahl-Spalten rechtsbündig */
.pte-cell--unitPriceNet,
.pte-cell--listPriceNet,
.pte-cell--purchasePriceNet,
.pte-cell--lineTotalNet,
.pte-cell--lineTotalGross,
.pte-cell--contribution,
.pte-cell--quantity,
.pte-cell--quantityOrdered,
.pte-cell--quantityDelivered,
.pte-cell--quantityOpen,
.pte-cell--markupPercent,
.pte-cell--supplierDiscountPercent,
.pte-cell--discountPercent,
.pte-cell--taxRate {
  text-align: right;
}

/* ── Drag-Handle ──────────────────────────────────────────────────────── */
.pte-drag-handle {
  cursor: grab;
  color: #b0bac8;
  font-size: 15px;
  padding: 2px 4px;
  border-radius: 3px;
  display: inline-block;
}
.pte-drag-handle:hover { color: #3b5bdb; background: #e8edff; }
.pte-drag-handle:active { cursor: grabbing; }

/* ── Inline-Inputs ────────────────────────────────────────────────────── */
.pte-cell-input, .pte-cell-select {
  width: 100%;
  padding: 2px 4px;
  border: 1px solid #3b5bdb;
  border-radius: 3px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(59,91,219,.15);
}

/* ── Badges ───────────────────────────────────────────────────────────── */
.pte-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
}
.pte-badge--b { background: #d1fae5; color: #065f46; }
.pte-badge--nb { background: #fee2e2; color: #991b1b; }
.pte-badge--system { background: #bae6fd; color: #0c4a6e; }
.pte-badge--summary { background: #e8e8ff; color: #3b3b8d; margin-left: 8px; }
.pte-badge--billable { background: #fef3c7; color: #92400e; margin-left: 4px; }
.pte-badge--user { margin-left: auto; }

/* Klickbare Print-Status-Badges (B/nB) */
[data-toggle-print] .pte-badge {
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  cursor: pointer;
}
[data-toggle-print]:hover .pte-badge {
  transform: scale(1.15);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  filter: brightness(0.95);
}
[data-toggle-print]:focus-visible {
  outline: 2px solid #3b5bdb;
  outline-offset: 1px;
  border-radius: 3px;
}
[data-toggle-print]:active .pte-badge {
  transform: scale(0.95);
}

/* ── Systemgruppen ────────────────────────────────────────────────────── */
.pte-system-group-label { font-weight: 600; margin: 0 8px; }
.pte-cell--system-group { padding: 6px 12px; }

/* ── Summenleiste (einfach, z.B. Lieferschein) ──────────────────────── */
.pte-totals-bar--simple {
  display: flex;
  gap: 24px;
  padding: 8px 16px;
  background: #f0f4ff;
  border-top: 2px solid #d0d9f0;
  font-size: 13px;
  font-weight: 500;
  justify-content: flex-end;
}

/* ── Summenleiste Dunkel (Angebot/Auftrag — wie Mockup) ─────────────── */
.pte-totals {
  background: linear-gradient(135deg, #1e2433, #2d3752);
  padding: 14px 20px;
  display: flex;
  gap: 0;
  align-items: stretch;
  border-radius: 0 0 8px 8px;
  flex-wrap: wrap;
}
.pte-tot {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 18px;
  border-right: 1px solid rgba(255,255,255,.1);
}
.pte-tot:first-child { padding-left: 0; }
.pte-tot:last-child { border-right: none; }
.pte-tot--nb { margin-left: auto; }
.pte-tot-l {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255,255,255,.4);
}
.pte-tot-v {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pte-tot-v--accent { font-size: 20px; color: #60a5fa; }
.pte-tot-v--g  { color: #4ade80; }
.pte-tot-v--r  { color: #f87171; }
.pte-tot-v--nb { font-size: 13px; color: #c084fc; font-weight: 600; }

/* ── Leerzustand ──────────────────────────────────────────────────────── */
.pte-empty-state {
  text-align: center;
  padding: 32px;
  color: #888;
}

/* ── Error / Loading ─────────────────────────────────────────────────── */
.pte-error {
  padding: 20px;
  color: #e74c3c;
  background: #fff5f5;
  border-radius: 6px;
  margin: 12px;
}

.pte-loading-indicator {
  color: #888;
  font-style: italic;
}

.pte-skeleton {
  height: 200px;
  background: linear-gradient(90deg, #f0f2f5 25%, #e8ecf5 50%, #f0f2f5 75%);
  background-size: 400% 100%;
  animation: pte-shimmer 1.4s infinite;
  border-radius: 4px;
  margin: 12px;
}

/* ── Kontext-Menü ─────────────────────────────────────────────────────── */
.pte-context-menu {
  min-width: 200px;
}
.pte-context-menu button {
  display: block;
  width: 100%;
  padding: 7px 14px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: #222;
}
.pte-context-menu button:hover { background: #f0f4ff; }
.pte-context-menu hr { border: none; border-top: 1px solid #eee; margin: 4px 0; }

/* ── Animationen ──────────────────────────────────────────────────────── */
@keyframes pte-shimmer {
  0%   { background-position: -400% 0; }
  100% { background-position: 400% 0; }
}

@keyframes pte-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Artikelnummer-Link (Strg+Klick) ─────────────────────────────────── */
.pte-article-link { color: #2563eb; text-decoration: none; border-bottom: 1px dashed #93c5fd; }
td[data-product-id]:hover .pte-article-link { color: #1d4ed8; border-bottom-style: solid; }

/* ── Artikelsuche-Dropdown ───────────────────────────────────────────── */
#pte-article-suggestions li { list-style: none; }

/* ── NB-Zeilen (intern / nicht drucken) ──────────────────────────────── */
.pte-row--nb {
  background: repeating-linear-gradient(
    90deg,
    #faf8ff 0, #faf8ff 8px,
    #f3eeff 8px, #f3eeff 9px
  ) !important;
}
.pte-row--nb:hover {
  background: repeating-linear-gradient(
    90deg,
    #f3eeff 0, #f3eeff 8px,
    #e9dcff 8px, #e9dcff 9px
  ) !important;
}
.pte-row--nb .pte-cell { color: #6b21a8; opacity: .85; }

/* ── Gruppen-Header (reichhaltig, wie Mockup) ────────────────────────── */
.pte-gr-wrap { padding: 0; }
.pte-gr-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  min-height: 38px;
}
.pte-gr-dh {
  color: #c0c6d0;
  cursor: grab;
  font-size: 14px;
  user-select: none;
  padding: 2px 4px;
  flex-shrink: 0;
}
.pte-gr-dh:active { cursor: grabbing; }
.pte-gr-icon { font-size: 14px; flex-shrink: 0; }
.pte-gr-name { font-weight: 700; font-size: 13px; white-space: nowrap; }
.pte-gr-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.pte-gr-margin {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.pte-gr-margin--g { background: #dcfce7; color: #15803d; }
.pte-gr-margin--r { background: #fee2e2; color: #dc2626; }
.pte-gr-margin--w { background: #fff8e1; color: #b45309; }
.pte-gr-spacer { flex: 1; }
.pte-gr-total { font-size: 13px; font-weight: 700; white-space: nowrap; }
.pte-gr-acts {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .1s;
}
.pte-row--group-header:hover .pte-gr-acts { opacity: 1; }

/* Lump-Sum Preis-Eingabe */
.pte-gr-lump {
  display: flex;
  align-items: center;
  gap: 5px;
}
.pte-gr-lump-lbl { font-size: 10px; font-weight: 600; white-space: nowrap; }
.pte-gr-lump-arrow { color: #9ca3af; font-size: 11px; }
.pte-lump-in {
  width: 95px;
  text-align: right;
  border: 1px solid #d7b8e8;
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 13px;
  font-weight: 700;
  color: #7b1fa2;
  background: #fdf4ff;
  font-family: inherit;
  outline: none;
}
.pte-lump-in:focus { outline: 2px solid #9b59b6; }

/* Gruppentyp-Varianten */
.pte-row--group-std td, .pte-row--group-std .pte-gr-wrap {
  border-top: 2px solid #c7d2fe;
}
.pte-row--group-std { background: #eef2ff !important; }
.pte-row--group-std:hover { background: #e5ebff !important; }
.pte-row--group-std .pte-gr-name { color: #3730a3; }
.pte-row--group-std .pte-gr-tag { background: #e0e7ff; color: #4338ca; }
.pte-row--group-std .pte-gr-total { color: #3730a3; }

.pte-row--group-pau { background: #fdf4ff !important; }
.pte-row--group-pau:hover { background: #f9e8ff !important; }
.pte-row--group-pau td, .pte-row--group-pau .pte-gr-wrap {
  border-top: 2px solid #e9b8f8;
}
.pte-row--group-pau .pte-gr-name { color: #7b1fa2; }
.pte-row--group-pau .pte-gr-tag { background: #f3e5f5; color: #7b1fa2; border: 1px solid #e9b8f8; }
.pte-row--group-pau .pte-gr-total { color: #7b1fa2; }
.pte-row--group-pau .pte-gr-dh { color: #d7b8e8; }

.pte-row--group-hrs { background: #fff8e1 !important; }
.pte-row--group-hrs:hover { background: #fef3c0 !important; }
.pte-row--group-hrs td, .pte-row--group-hrs .pte-gr-wrap {
  border-top: 2px solid #ffe082;
}
.pte-row--group-hrs .pte-gr-name { color: #b45309; }
.pte-row--group-hrs .pte-gr-tag { background: #fef3c7; color: #b45309; }
.pte-row--group-hrs .pte-gr-total { color: #b45309; }

.pte-row--group-mat { background: #f0fff4 !important; }
.pte-row--group-mat:hover { background: #e6ffee !important; }
.pte-row--group-mat td { border-top: 2px solid #86efac; }
.pte-row--group-mat .pte-gr-name { color: #15803d; }
.pte-row--group-mat .pte-gr-tag { background: #dcfce7; color: #15803d; }

/* ── Add-Bar je Gruppe ───────────────────────────────────────────────── */
.pte-add-bar {
  padding: 4px 10px 4px 38px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.pte-add-bar--pau { border-bottom: 2px solid #e9b8f8; }

.pte-add-btn {
  font-size: 11px;
  color: #9ca3af;
  background: none;
  border: 1px dashed #d1d5db;
  padding: 3px 9px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all .1s;
}
.pte-add-btn:hover { border-color: #3b82f6; color: #1d4ed8; background: #eff6ff; }
.pte-add-bar--pau .pte-add-btn { color: #9b59b6; border-color: #d7b8e8; }
.pte-add-bar--pau .pte-add-btn:hover { background: #f3e5f5; }
.pte-add-btn--txt:hover { border-color: #d97706; color: #d97706; background: #fffbeb; }
.pte-add-btn--hdg:hover { border-color: #0ea5e9; color: #0ea5e9; background: #f0f9ff; }
.pte-add-btn--sep:hover { border-color: #9ca3af; color: #4b5563; background: #f3f4f6; }

/* ── Add-Gruppe-Bar ──────────────────────────────────────────────────── */
.pte-add-grp-bar {
  padding: 10px 14px;
  background: #f7f8fa;
  border-top: 1px solid #e2e6ed;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pte-btn--pau {
  color: #7b1fa2;
  border-color: #d7b8e8;
}
.pte-btn--pau:hover { background: #f3e5f5; border-color: #9b59b6; }

/* ── Kontext-Menü (Gruppe + Mehr-Menü) ──────────────────────────────── */
.pte-ctx-menu {
  background: #fff;
  border: 1px solid #e2e6ed;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  min-width: 180px;
  overflow: hidden;
  z-index: 10000;
  padding: 4px 0;
}
.pte-ctx-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  font-family: inherit;
}
.pte-ctx-item:hover { background: #f5f7fa; }
.pte-ctx-item--danger { color: #dc2626; }
.pte-ctx-item--danger:hover { background: #fef2f2; }

/* ── KI-Menüeintrag ─────────────────────────────────────────────────── */
.pte-ctx-item--ai { color: #7c3aed; font-weight: 500; }
.pte-ctx-item--ai:hover { background: #f5f3ff; color: #6d28d9; }

/* ── KI-Textbaustein-Dialog ─────────────────────────────────────────── */
.pte-ai-box {
  background: #fff;
  border-radius: 14px;
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
}
.pte-ai-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid #f0f2f5;
  flex-shrink: 0;
}
.pte-ai-icon { font-size: 22px; flex-shrink: 0; }
.pte-ai-title { font-size: 15px; font-weight: 700; color: #1a1d23; }
.pte-ai-sub { font-size: 11px; color: #9ca3af; margin-top: 1px; }
.pte-ai-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #9ca3af;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
}
.pte-ai-close:hover { background: #f3f4f6; color: #374151; }
.pte-ai-body {
  overflow-y: auto;
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pte-ai-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px;
  color: #7c3aed;
  font-size: 13px;
}
.pte-ai-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e9d5ff;
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: pte-spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes pte-spin { to { transform: rotate(360deg); } }

.pte-ai-card {
  border: 1px solid #e9d5ff;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .15s;
}
.pte-ai-card:hover { border-color: #7c3aed; }
.pte-ai-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f5f3ff;
  border-bottom: 1px solid #ede9fe;
}
.pte-ai-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #7c3aed;
}
.pte-ai-pick {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: #7c3aed;
  border: none;
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: background .1s;
}
.pte-ai-pick:hover { background: #6d28d9; }
.pte-ai-ctitle {
  font-size: 13px;
  font-weight: 600;
  color: #1a1d23;
  padding: 8px 12px 4px;
  line-height: 1.4;
}
.pte-ai-cdesc {
  font-size: 12px;
  color: #6b7280;
  padding: 0 12px 10px;
  line-height: 1.5;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .pte-scroll-wrap { max-height: 55vh; }
  .pte-totals { flex-direction: column; gap: 8px; padding: 12px; }
  .pte-tot { padding: 4px 0; border-right: none; border-bottom: 1px solid rgba(255,255,255,.1); }
}
