/* ===== ABRAMS Nachkalk – Clean Compact v7 ===== */
:root{
  --abn-blue:#0b5fff;
  --abn-blue-dark:#0847c7;
  --abn-red:#d7263d;

  --abn-green:#16a34a;      /* PDF/Drucken */
  --abn-green-dark:#15803d;
  --abn-yellow:#facc15;     /* Zurücksetzen */
  --abn-yellow-dark:#eab308;

  --abn-gray-50:#f9fafb;
  --abn-gray-100:#f3f4f6;
  --abn-gray-200:#e5e7eb;
  --abn-gray-300:#d1d5db;
  --abn-gray-500:#6b7280;
  --abn-gray-700:#374151;
  --abn-gray-800:#1f2937;

  --abn-radius:8px;
  --abn-shadow:0 1px 3px rgb(0 0 0 / 0.1),0 1px 2px -1px rgb(0 0 0 / 0.1);

  --abn-minh:38px; /* einheitliche Control-Höhe */
  --abn-cell-pad-y:10px; /* mehr Zeilenhöhe */
}

/* ---------- Grundlayout ---------- */
.abn-wrap{font-family:"Roboto",system-ui,-apple-system,Segoe UI,Arial,sans-serif;color:var(--abn-gray-800);padding:10px 0}
.abn-wrap h2{margin:0 0 12px;font-size:22px;font-weight:700}

/* ---------- Filterleiste ---------- */
.abn-bar{
  display:flex;flex-wrap:wrap;gap:10px;align-items:center;
  margin:8px 0 12px;padding:12px;background:#fff;
  border:1px solid var(--abn-gray-200);border-radius:var(--abn-radius);box-shadow:var(--abn-shadow)
}
.abn-bar label{display:flex;gap:6px;align-items:center;font-size:13px}
.abn-bar input[type="text"],
.abn-bar input[type="month"],
.abn-bar select{
  height:var(--abn-minh) !important;min-height:var(--abn-minh) !important;
  padding:6px 10px !important;border:1px solid var(--abn-gray-300) !important;border-radius:var(--abn-radius) !important
}
.abn-bar input[type="checkbox"]{
  width:16px !important;height:16px !important;min-height:unset !important;margin:0 4px 0 0 !important;
  accent-color:var(--abn-blue)
}

/* Buttons in der Leiste */
.abn-bar .button,
.abn-bar .button-primary{
  min-height:var(--abn-minh) !important;line-height:1.2 !important;font-size:13px !important;
  border-radius:var(--abn-radius) !important;padding:6px 12px !important;border:none !important;
  font-weight:500 !important;box-shadow:var(--abn-shadow)
}
/* Blau: Anzeigen */
.abn-bar .button-primary{background:var(--abn-blue) !important;color:#fff !important}
.abn-bar .button-primary:hover{background:var(--abn-blue-dark) !important}
/* Gelb: Zurücksetzen (Link ohne target und ohne .button-primary) */
.abn-bar a.button:not([target]):not(.button-primary){
  background:var(--abn-yellow) !important;color:#000 !important
}
.abn-bar a.button:not([target]):not(.button-primary):hover{background:var(--abn-yellow-dark) !important}
/* Grün: PDF/Drucken (hat target="_blank") */
.abn-bar a.button[target="_blank"]{
  background:var(--abn-green) !important;color:#fff !important
}
.abn-bar a.button[target="_blank"]:hover{background:var(--abn-green-dark) !important}

/* ---------- Tabellen-Container (immer scrollbar, wenn nötig) ---------- */
.abn-scroll{
  overflow:auto;border:1px solid var(--abn-gray-200);border-radius:10px;
  background:#fff;box-shadow:var(--abn-shadow);padding:4px;margin-bottom:14px
}

/* ---------- Tabelle (Desktop & Mobile – keine Kartenansicht) ---------- */
.abn-table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}
.abn-table thead th{
  position:sticky;top:0;z-index:1;background:var(--abn-gray-100);
  font-weight:700;font-size:13px;text-align:left;padding:8px 8px;
  border-bottom:1px solid var(--abn-gray-200);white-space:nowrap
}
.abn-table th,.abn-table td{
  padding:var(--abn-cell-pad-y) 8px;border-bottom:1px solid var(--abn-gray-200);
  vertical-align:middle;font-size:13px
}

/* >>> Fixes: keine abgeschnittenen Inhalte, Zeilen wachsen mit <<< */
.abn-table td{
  white-space:normal !important;
  overflow:visible !important;
  text-overflow:clip !important;
  line-height:1.35;
}

/* Eingabefelder in Zellen – volle Breite, mittig */
.abn-table input[type="text"],
.abn-table input[type="number"],
.abn-table input[type="month"],
.abn-table input[type="date"],
.abn-table select{
  display:block !important;width:100% !important;min-width:0 !important;max-width:100% !important;
  height:var(--abn-minh) !important;min-height:var(--abn-minh) !important;
  padding:6px 10px !important;border:1px solid var(--abn-gray-300) !important;border-radius:var(--abn-radius) !important;
  overflow:hidden !important;text-overflow:ellipsis !important;white-space:nowrap !important;box-sizing:border-box
}
.abn-table input[disabled]{
  background:var(--abn-gray-100) !important;color:var(--abn-gray-500) !important;border-color:transparent !important;box-shadow:none !important
}

/* ---------- Spaltenbreiten ---------- */
.abn-table th:nth-child(1),  .abn-table td:nth-child(1){width:10%} /* Kunde   */
.abn-table th:nth-child(2),  .abn-table td:nth-child(2){width:12%} /* Adresse */
.abn-table th:nth-child(3),  .abn-table td:nth-child(3){width:10%} /* SB      */
.abn-table th:nth-child(4),  .abn-table td:nth-child(4){width:7%}  /* Aufbau  */
.abn-table th:nth-child(5),  .abn-table td:nth-child(5){width:7%}  /* Abbau   */
.abn-table th:nth-child(6),  .abn-table td:nth-child(6){width:7%}  /* Angebot */
.abn-table th:nth-child(7),  .abn-table td:nth-child(7){width:7%}  /* Woche   */
.abn-table th:nth-child(8),  .abn-table td:nth-child(8){width:5%}  /* Standzeit */
.abn-table th:nth-child(9),  .abn-table td:nth-child(9){width:6%}  /* Std Aufb*/
.abn-table th:nth-child(10), .abn-table td:nth-child(10){width:6%} /* Std Abb */
.abn-table th:nth-child(11), .abn-table td:nth-child(11){width:7%;text-align:right;background:var(--abn-gray-100)} /* Summe  */
.abn-table th:nth-child(12), .abn-table td:nth-child(12){width:7%;text-align:right;background:var(--abn-gray-100)} /* Kosten */
.abn-table th:nth-child(13), .abn-table td:nth-child(13){width:7%;text-align:center} /* Diff   */
.abn-table th:nth-child(14), .abn-table td:nth-child(14){width:8%} /* Dateien */
.abn-table th:nth-child(15), .abn-table td:nth-child(15){width:12%;min-width:170px} /* Aktion */

/* Zahlen-/Badge-Spalten kompakt lassen */
.abn-table td[data-th="Summe"],
.abn-table td[data-th="Kosten"],
.abn-table td[data-th="Diff"]{
  white-space:nowrap !important;
}

/* Datumsfelder kompakt */
.abn-table td:nth-child(4) input,
.abn-table td:nth-child(5) input{max-width:110px}

/* ---------- Datei-Bereich ---------- */
.abn-filelinks,
.abn-filelinks a{
  overflow-wrap:anywhere;word-break:break-word;white-space:normal !important
}
.abn-file-btn{
  display:inline-block;background:#fff;border:1px solid var(--abn-gray-300);
  color:var(--abn-gray-800);padding:6px 8px;border-radius:var(--abn-radius);
  cursor:pointer;user-select:none;white-space:nowrap;height:var(--abn-minh)
}
.abn-file-btn:hover{background:var(--abn-gray-100)}
.abn-file-btn input[type="file"]{display:none}

/* Fallback für natives <input type=file> */
.abn-table input[type="file"]{font-size:0;width:110px;height:var(--abn-minh)}
.abn-table input[type="file"]::file-selector-button{
  font-size:12px;padding:6px 8px;border:1px solid var(--abn-gray-300);border-radius:var(--abn-radius);background:#fff;color:var(--abn-gray-800);cursor:pointer;height:calc(var(--abn-minh) - 2px)
}

/* ---------- Aktionen: Buttons mittig, dürfen umbrechen ---------- */
.abn-actions{
  display:flex;align-items:center;justify-content:flex-start;
  gap:8px;flex-wrap:wrap;min-height:var(--abn-minh)
}
.abn-actions form{display:contents}          /* Formular-Box unsichtbar fürs Layout */
.abn-actions .button,
.abn-actions .button-primary,
.abn-actions .button-danger{
  font-size:12px !important;padding:6px 10px !important;line-height:1.2 !important;white-space:nowrap
}

/* WP-Button-Farben vereinheitlichen */
.button{border-radius:var(--abn-radius) !important}
.button-primary{background:var(--abn-blue) !important;border-color:var(--abn-blue) !important;color:#fff !important}
.button-primary:hover{background:var(--abn-blue-dark) !important;border-color:var(--abn-blue-dark) !important}
.button-danger{background:var(--abn-red) !important;border-color:var(--abn-red) !important;color:#fff !important}
.button-danger:hover{filter:brightness(0.95)}

/* ---------- Badges & Links ---------- */
.abn-badge{display:inline-block;padding:3px 8px;border-radius:999px;font-weight:700}
.abn-badge.ok{background:#d1fae5;color:#065f46}
.abn-badge.bad{background:#fee2e2;color:#991b1b}
.abn-filelinks a{text-decoration:none;color:var(--abn-blue)}
.abn-filelinks a:hover{text-decoration:underline}
.muted{color:var(--abn-gray-500)}

/* ---------- Responsiv: nur Scroll, keine Kartenansicht ---------- */
/* Bei schmalen Viewports einfach horizontal/vertikal scrollen (ist Default durch .abn-scroll).
   Leicht reduzierte Spaltenabstände für sehr schmale Screens. */
@media (max-width: 900px){
  .abn-table th,.abn-table td{padding:8px 6px}
}
/* ---- FIX: Action-Buttons wieder exakt mittig in der Zelle ---- */

/* Sicherheitsnetz: Alle Zellen mittig ausrichten */
.abn-table th,
.abn-table td{
  vertical-align: middle !important;
}

/* Die Aktions-Zelle selbst als Flex-Container über die volle Höhe */
.abn-table td.abn-actions{
  display: flex !important;
  align-items: center !important;   /* vertikal mittig */
  justify-content: flex-start;      /* horizontal links */
  gap: 8px;
  flex-wrap: wrap;
  min-height: var(--abn-minh);
  height: 100%;                     /* => nimmt volle Zeilenhöhe ein */
  padding-top: var(--abn-cell-pad-y);
  padding-bottom: var(--abn-cell-pad-y);
}

/* Forms in der Aktionszelle sollen kein eigenes Box-Layout erzeugen */
.abn-table td.abn-actions form{
  display: contents;
}

/* Buttons kompakt halten */
.abn-table td.abn-actions .button,
.abn-table td.abn-actions .button-primary,
.abn-table td.abn-actions .button-danger{
  line-height: 1.2;
  white-space: nowrap;
}
/* ===============================
   FIX: Immer horizontal scrollen,
   Zeilenhöhe stabil halten,
   Dateinamen nicht zersägen
   =============================== */

/* 1) Scroll-Container: horizontales Scrollen erzwingen,
      vertikal nichts abschneiden (wichtig für lange Zellen) */
.abn-scroll{
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch; /* smooth on iOS */
}

/* 2) Tabelle darf nie zusammenschrumpfen -> feste Mindestbreite.
      (Wert bei Bedarf anpassen) */
.abn-table{
  min-width: 1400px !important;   /* 1500–1600px geht auch, wenn’s dir lieber ist */
  table-layout: fixed;             /* verhindert erratisches Spalten-Zittern */
}

/* 3) Zellen sollen die Reihe nicht „quetschen“ */
:root{
  --abn-row-min: 46px;            /* gefühlte Mindesthöhe je Reihe */
  --abn-cell-pad-y: 8px;          /* vertikale Luft in Zellen */
}
.abn-table th,
.abn-table td{
  vertical-align: middle !important;
  padding-top: var(--abn-cell-pad-y) !important;
  padding-bottom: var(--abn-cell-pad-y) !important;
  height: var(--abn-row-min);     /* Mindesthöhe in jeder Zelle */
  white-space: nowrap;            /* kein automatischer Umbruch in Standardzellen */
}

/* 4) Dateien-Spalte: Links niemals Buchstabenweise umbrechen,
      lieber abschneiden + Ellipsis, mehrere Links untereinander */
.abn-filelinks{
  display: block;
}
.abn-filelinks a{
  display: block;                 /* jeder Link eigene Zeile */
  max-width: 240px;               /* Breite innerhalb der Zelle */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;            /* kein Zeilenumbruch im Namen */
  word-break: normal !important;  /* NICHT break-all/break-anywhere */
}
.abn-filelinks > div{
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

/* 5) Aktions-Spalte (Bearbeiten / Speichern / Löschen) sauber mittig */
.abn-table td.abn-actions{
  display: flex !important;
  align-items: center !important; /* vertikal mittig */
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  height: 100%;
}
.abn-table td.abn-actions form{ display: contents; }

/* 6) Buttons kompakt, kein Zeilenbruch im Buttontext */
.abn-table td.abn-actions .button,
.abn-table td.abn-actions .button-primary,
.abn-table td.abn-actions .button-danger{
  line-height: 1.2;
  white-space: nowrap;
}
/* === Aktion-Spalte: Buttons wirklich mittig ausrichten === */

/* Zelle wieder wie echte Tabellenzelle behandeln – nicht als Flexbox */
.abn-table td.abn-actions{
  display: table-cell !important;
  vertical-align: middle !important;
  white-space: nowrap;
  padding-top: var(--abn-cell-pad-y) !important;
  padding-bottom: var(--abn-cell-pad-y) !important;
}

/* Forms „auflösen“, damit die Buttons wie direkte Inline-Items wirken */
.abn-table td.abn-actions form{
  display: contents !important;
}

/* Kleine Abstände zwischen den Buttons + vertikale Mitte für Inline-Items */
.abn-table td.abn-actions .button,
.abn-table td.abn-actions .button-primary,
.abn-table td.abn-actions .button-danger{
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}
.abn-table td.abn-actions .button:last-child,
.abn-table td.abn-actions .button-primary:last-child,
.abn-table td.abn-actions .button-danger:last-child{
  margin-right: 0;
}
/* === Aktionsspalte: saubere, einheitliche Optik === */
.abn-table td.abn-actions{
  text-align: right;                 /* Buttons bündig rechts */
  padding-right: 12px !important;    /* etwas Luft zur Tabellenkante */
}

/* Buttons gleich breit + zentrierter Text + konsistente Abstände */
.abn-table td.abn-actions .button,
.abn-table td.abn-actions .button-primary,
.abn-table td.abn-actions .button-danger{
  min-width: 96px;                   /* gleiche visuelle Breite */
  text-align: center;
  margin-left: 8px;                  /* Abstand zwischen Buttons */
  margin-right: 0;
}

/* Optional: kleine Variante, wenn’s sehr knapp wird */
@media (max-width: 1100px){
  .abn-table td.abn-actions .button,
  .abn-table td.abn-actions .button-primary,
  .abn-table td.abn-actions .button-danger{
    min-width: 88px;
  }
}
/* === Top-Scrollbar über jeder abn-scroll-Tabelle ======================= */
:root{
  /* Wenn du eine fixe Seitenkopfzeile hast, hier den Offset anpassen (z.B. 60px) */
  --abn-sticky-offset: 0px;
  --abn-topbar-height: 14px;
}

.abn-top-scroll{
  overflow-x: auto;
  overflow-y: hidden;
  height: var(--abn-topbar-height);
  margin: 6px 0 8px;
  border: 1px solid var(--abn-gray-200);
  border-radius: 8px;
  background: #fff;

  /* optional sticky – bleibt oben sichtbar, solange die Tabelle im Viewport ist */
  position: sticky;
  top: var(--abn-sticky-offset);
  z-index: 30;
}

/* Optik der Mini-Scrollbar */
.abn-top-scroll::-webkit-scrollbar{ height: 10px; }
.abn-top-scroll::-webkit-scrollbar-thumb{
  background: var(--abn-gray-300);
  border-radius: 8px;
}
.abn-top-scroll-inner{ height: 1px; } /* braucht nur Breite, keine Höhe */

/* Wenn du die Leiste auf sehr kleinen Screens nicht brauchst, ausblenden: */
/* @media (max-width: 720px){ .abn-top-scroll{ display:none; } } */
