/*
 * Zentrales Layout und kleine Korrekturen für Bootstrap, TinyMCE und Tabulator.
 */

body {
  min-height: 100vh;
}

.hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1f2937, #0f172a);
}

.hero .card {
  max-width: 850px;
}

.card {
  box-shadow: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.12);
}

.tox-tinymce {
  border-radius: 0.5rem !important;
}

.signature-dialog-canvas {
  background: #fff;
  border: 1px solid #6c757d;
  border-radius: 0.35rem;
  display: block;
  height: 220px;
  max-width: 100%;
  touch-action: none;
  width: 720px;
}

.signature-dialog-hint {
  color: #6c757d;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Unterschriften im Dialog müssen zum aktiven Theme passen. */
[data-bs-theme="dark"] .signature-dialog-canvas {
  background: #212529;
  border-color: #6c757d;
}

[data-bs-theme="dark"] .signature-dialog-hint {
  color: #adb5bd;
}

/*
 * Tabulator Dark-Mode Nacharbeit:
 * tabulator_midnight liefert die Grundfarben. Diese Regeln sorgen zusätzlich dafür,
 * dass Filterfelder, Zeilentext und Platzhalter gut lesbar bleiben.
 */
.tabulator {
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: #1f2937;
}

.tabulator .tabulator-header,
.tabulator .tabulator-header .tabulator-col {
  background-color: #111827;
  color: #f9fafb;
}

.tabulator .tabulator-header .tabulator-col input,
.tabulator .tabulator-header .tabulator-col select {
  background-color: #0f172a;
  color: #f9fafb;
  border: 1px solid #475569;
}

.tabulator .tabulator-row {
  color: #f9fafb;
}

.tabulator .tabulator-row.tabulator-row-even {
  background-color: #1f2937;
}

.tabulator .tabulator-row.tabulator-row-odd {
  background-color: #273449;
}

.tabulator .tabulator-row:hover {
  background-color: #334155;
}

.tabulator .tabulator-placeholder {
  color: #f9fafb;
}

.status-badge {
  border-radius: 0.5rem;
  display: inline-block;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
}

.status-created { background: #6c757d; color: #fff; }
.status-inwork { background: #0d6efd; color: #fff; }
.status-critical { background: #dc3545; color: #fff; }
.status-closed { background: #198754; color: #fff; }
.status-cancelled { background: #343a40; color: #fff; }

.gantt-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.gantt-label {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-line {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.4rem;
  height: 2rem;
  position: relative;
}

.gantt-bar {
  border-radius: 0.35rem;
  font-size: 0.85rem;
  height: 100%;
  overflow: hidden;
  padding: 0.3rem 0.5rem;
  position: absolute;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * jQueryGantt/Twproject Integration
 * ---------------------------------
 * Die Bibliothek bringt ein helles Standardtheme mit. Diese Regeln passen sie
 * an das dunkle Bootstrap-Theme des Workflow Frameworks an.
 */
.gantt-card {
  background-color: #111827;
}

#workSpace,
#workSpace .splitBox1,
#workSpace .splitBox2,
#workSpace .gantt,
#workSpace .ganttFixHead,
#workSpace .ganttTable,
#workSpace .gdfTable {
  background-color: #111827 !important;
  color: #e5e7eb !important;
}

#workSpace input,
#workSpace select,
#workSpace textarea {
  background-color: #0f172a !important;
  border: 1px solid #475569 !important;
  color: #f9fafb !important;
}

#workSpace .gdfCell,
#workSpace .gdfColHeader,
#workSpace .ganttHead1,
#workSpace .ganttHead2,
#workSpace .ganttToday {
  background-color: #1f2937 !important;
  border-color: #475569 !important;
  color: #f9fafb !important;
}

#workSpace .taskBox .layout {
  border-radius: 0.35rem;
}

#workSpace .taskStatus[status='STATUS_ACTIVE'] { background-color: #0d6efd !important; }
#workSpace .taskStatus[status='STATUS_FAILED'] { background-color: #dc3545 !important; }
#workSpace .taskStatus[status='STATUS_DONE'] { background-color: #198754 !important; }
#workSpace .taskStatus[status='STATUS_SUSPENDED'] { background-color: #343a40 !important; }
#workSpace .taskStatus[status='STATUS_UNDEFINED'],
#workSpace .taskStatus[status='STATUS_WAITING'] { background-color: #6c757d !important; }

/*
 * Gantt Darkmode v2
 * -----------------
 * Twproject/jQueryGantt bringt viele helle Inline-/Standardfarben mit.
 * Diese Nacharbeit übersteuert die wichtigsten Bereiche gezielt, damit
 * Raster, Kopfzeilen, Eingabefelder, Status-Balken und SVG-Elemente im
 * dunklen Workflow-Theme klar lesbar sind.
 */
.gantt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.gantt-legend .status-badge {
  min-width: 110px;
  text-align: center;
}

.gantt-card {
  background: #0b1220 !important;
  border: 1px solid #334155 !important;
}

#workSpace {
  background: #0b1220 !important;
  border: 1px solid #334155 !important;
  color: #e5e7eb !important;
}

#workSpace * {
  scrollbar-color: #475569 #0f172a;
}

#workSpace .TWGanttWorkSpace,
#workSpace .ganttContainer,
#workSpace .splitBox1,
#workSpace .splitBox2,
#workSpace .splitElement,
#workSpace .gantt,
#workSpace .ganttFixHead,
#workSpace .ganttTable,
#workSpace .ganttTableBody,
#workSpace .ganttLinks,
#workSpace .gdfTable,
#workSpace .gdfTable tbody,
#workSpace .gdfTable tr {
  background: #0b1220 !important;
  color: #e5e7eb !important;
}

#workSpace .ganttButtonBar,
#workSpace .button,
#workSpace button.button,
#workSpace .ganttButtonBar .buttons {
  background: #111827 !important;
  border-color: #334155 !important;
  color: #e5e7eb !important;
}

#workSpace .button:hover,
#workSpace button.button:hover {
  background: #1f2937 !important;
  color: #ffffff !important;
}

#workSpace .gdfColHeader,
#workSpace .ganttHead1 th,
#workSpace .ganttHead2 th,
#workSpace .ganttHead1,
#workSpace .ganttHead2 {
  background: #111827 !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
  font-weight: 700 !important;
}

#workSpace .gdfCell,
#workSpace .ganttToday,
#workSpace .ganttTable td,
#workSpace .ganttTable th {
  background: #111827 !important;
  border-color: #334155 !important;
  color: #e5e7eb !important;
}

#workSpace .taskEditRow:nth-child(even) .gdfCell,
#workSpace .ganttTable tr:nth-child(even) td {
  background: #172033 !important;
}

#workSpace .taskEditRow:hover .gdfCell,
#workSpace .ganttTable tr:hover td {
  background: #22304a !important;
}

#workSpace .focused .gdfCell,
#workSpace .taskEditRow.focused .gdfCell {
  background: #1d4ed8 !important;
  color: #ffffff !important;
}

#workSpace input,
#workSpace select,
#workSpace textarea,
#workSpace .gdfCellInput {
  background: #020617 !important;
  border: 1px solid #475569 !important;
  color: #f8fafc !important;
}

#workSpace input:focus,
#workSpace select:focus,
#workSpace textarea:focus {
  border-color: #60a5fa !important;
  box-shadow: 0 0 0 0.15rem rgba(96, 165, 250, 0.25) !important;
  outline: none !important;
}

#workSpace .ganttLines,
#workSpace .ganttLinesSVG,
#workSpace .ganttLinksSVG {
  background: #0b1220 !important;
}

#workSpace svg,
#workSpace .ganttSVGBox {
  background: #0b1220 !important;
}

#workSpace .taskBoxDiv .layout,
#workSpace .taskBoxSVG .taskLayout {
  stroke: #e5e7eb !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

#workSpace .taskBoxDiv .taskProgress,
#workSpace .taskBoxSVG .taskProgress {
  fill: rgba(255, 255, 255, 0.22) !important;
  background: rgba(255, 255, 255, 0.22) !important;
}

#workSpace .taskBoxDiv .layout .taskLabel,
#workSpace .taskBoxSVG text,
#workSpace .textPerc {
  fill: #f8fafc !important;
  color: #f8fafc !important;
  font-weight: 600;
}

#workSpace .colorByStatus .taskStatusSVG[status='STATUS_WAITING'] .taskLayout,
#workSpace .colorByStatus .taskStatusSVG[status='STATUS_UNDEFINED'] .taskLayout,
#workSpace .taskStatus[status='STATUS_WAITING'],
#workSpace .taskStatus[status='STATUS_UNDEFINED'] {
  fill: #6c757d !important;
  background: #6c757d !important;
}

#workSpace .colorByStatus .taskStatusSVG[status='STATUS_ACTIVE'] .taskLayout,
#workSpace .taskStatus[status='STATUS_ACTIVE'] {
  fill: #0d6efd !important;
  background: #0d6efd !important;
}

#workSpace .colorByStatus .taskStatusSVG[status='STATUS_FAILED'] .taskLayout,
#workSpace .taskStatus[status='STATUS_FAILED'] {
  fill: #dc3545 !important;
  background: #dc3545 !important;
}

#workSpace .colorByStatus .taskStatusSVG[status='STATUS_DONE'] .taskLayout,
#workSpace .taskStatus[status='STATUS_DONE'] {
  fill: #198754 !important;
  background: #198754 !important;
}

#workSpace .colorByStatus .taskStatusSVG[status='STATUS_SUSPENDED'] .taskLayout,
#workSpace .taskStatus[status='STATUS_SUSPENDED'] {
  fill: #343a40 !important;
  background: #343a40 !important;
}

#workSpace .taskBoxSVG.critical .taskLayout {
  stroke: #ff6b6b !important;
  stroke-width: 2px !important;
}

#workSpace .linkHandleSVG,
#workSpace .dependencyLine,
#workSpace path {
  stroke: #93c5fd;
}

#workSpace .splitterContainer,
#workSpace .vSplitBar,
#workSpace .splitterBar {
  background-color: #334155 !important;
  border-color: #475569 !important;
}

#workSpace .ganttToday {
  background: rgba(251, 191, 36, 0.18) !important;
}

/*
 * Gantt Light Mode Override
 * -------------------------
 * Die Gantt-Bibliothek bleibt bewusst hell, auch wenn das restliche
 * Workflow-Framework im Dark-Theme läuft. Das erhöht die Lesbarkeit des
 * komplexen Gantt-Rasters und macht Abhängigkeitspfeile klarer sichtbar.
 */
.gantt-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}

#workSpace,
#workSpace .TWGanttWorkSpace,
#workSpace .ganttContainer,
#workSpace .splitBox1,
#workSpace .splitBox2,
#workSpace .splitElement,
#workSpace .gantt,
#workSpace .ganttFixHead,
#workSpace .ganttTable,
#workSpace .ganttTableBody,
#workSpace .ganttLinks,
#workSpace .gdfTable,
#workSpace .gdfTable tbody,
#workSpace .gdfTable tr {
  background: #ffffff !important;
  color: #111827 !important;
}

#workSpace {
  border: 1px solid #cbd5e1 !important;
}

#workSpace .ganttButtonBar,
#workSpace .button,
#workSpace button.button,
#workSpace .ganttButtonBar .buttons {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #111827 !important;
}

#workSpace .button:hover,
#workSpace button.button:hover {
  background: #e2e8f0 !important;
  color: #000000 !important;
}

#workSpace .gdfColHeader,
#workSpace .ganttHead1 th,
#workSpace .ganttHead2 th,
#workSpace .ganttHead1,
#workSpace .ganttHead2 {
  background: #e5e7eb !important;
  border-color: #cbd5e1 !important;
  color: #111827 !important;
  font-weight: 700 !important;
}

#workSpace .gdfCell,
#workSpace .ganttToday,
#workSpace .ganttTable td,
#workSpace .ganttTable th {
  background: #ffffff !important;
  border-color: #d1d5db !important;
  color: #111827 !important;
}

#workSpace .taskEditRow:nth-child(even) .gdfCell,
#workSpace .ganttTable tr:nth-child(even) td {
  background: #f8fafc !important;
}

#workSpace .taskEditRow:hover .gdfCell,
#workSpace .ganttTable tr:hover td {
  background: #e0f2fe !important;
}

#workSpace .focused .gdfCell,
#workSpace .taskEditRow.focused .gdfCell {
  background: #bfdbfe !important;
  color: #111827 !important;
}

#workSpace input,
#workSpace select,
#workSpace textarea,
#workSpace .gdfCellInput {
  background: #ffffff !important;
  border: 1px solid #94a3b8 !important;
  color: #111827 !important;
}

#workSpace input:focus,
#workSpace select:focus,
#workSpace textarea:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 0.15rem rgba(37, 99, 235, 0.2) !important;
  outline: none !important;
}

#workSpace .ganttLines,
#workSpace .ganttLinesSVG,
#workSpace .ganttLinksSVG,
#workSpace svg,
#workSpace .ganttSVGBox {
  background: #ffffff !important;
}

#workSpace .taskBoxDiv .layout,
#workSpace .taskBoxSVG .taskLayout {
  stroke: #334155 !important;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

#workSpace .taskBoxDiv .layout .taskLabel,
#workSpace .taskBoxSVG text,
#workSpace .textPerc {
  fill: #111827 !important;
  color: #111827 !important;
  font-weight: 600;
}

#workSpace .linkHandleSVG,
#workSpace .dependencyLine,
#workSpace path {
  stroke: #1d4ed8 !important;
  stroke-width: 1.8px !important;
}

#workSpace .ganttToday {
  background: rgba(251, 191, 36, 0.28) !important;
}

/*
 * Tabellen-Actionsmenü
 * -------------------
 * Wird bei einem einfachen Klick auf eine Tabulator-Zeile angezeigt.
 */
.table-action-modal {
  background-color: #1f2937;
  border: 1px solid #475569;
  color: #f9fafb;
}

.table-action-modal .modal-header,
.table-action-modal .modal-footer {
  border-color: #475569;
}

.table-action-modal .table-action-title {
  font-size: 1.05rem;
  font-weight: 500;
  word-break: break-word;
}

.tabulator .tabulator-row {
  cursor: pointer;
}


/* Gantt stability fixes V3.5.3 */
.gantt-card { overflow: visible !important; }
#workSpace .splitterContainer,
#workSpace .splitElement { height: 100% !important; }
#workSpace .splitBox1,
#workSpace .splitBox2 { padding-bottom: 0 !important; box-sizing: border-box !important; }
#workSpace .gdfTable tbody tr:last-child td,
#workSpace .gdfTable tbody tr:last-child th { border-bottom: 2px solid #94a3b8 !important; }
#workSpace .vSplitBar { z-index: 20 !important; cursor: col-resize !important; }
#workSpace .vSplitBar .toLeft,
#workSpace .vSplitBar .toCenter,
#workSpace .vSplitBar .toRight { cursor: pointer !important; pointer-events: auto !important; }
.gantt-view-toolbar { position: relative; z-index: 30; }
.modalPopup { z-index: 10050 !important; }
.modalPopup .bwinPopupd { box-sizing: border-box; }

/* V3.5.3 Fix 2: Die interne Gantt-Fläche darf nicht zusätzlich zur Buttonleiste 100 % hoch sein. */
#workSpace > #TWGanttArea {
  min-height: 300px;
  overflow: hidden !important;
}

#workSpace #TWGanttArea .splitBox1,
#workSpace #TWGanttArea .splitBox2 {
  padding-bottom: 2px;
}


/* BUG-000006 – echtes Gantt-Vollbild innerhalb der Anwendung */
html.gantt-fullscreen-active,
body.gantt-fullscreen-active {
  overflow: hidden !important;
  width: 100% !important;
  height: 100% !important;
}

#workSpace.TWGanttWorkSpace.ganttFullScreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  z-index: 2147483000 !important;
  background: #fff !important;
  overflow: hidden !important;
}

#workSpace.ganttFullScreen > #TWGanttArea {
  width: 100% !important;
  max-width: none !important;
}

#workSpace.ganttFullScreen .ganttButtonBar {
  margin: 0 !important;
}

/* V3.7.1: Richtext wird standardmäßig als interaktiver Lesebereich angezeigt. */
[data-richtext-view] {
  min-height: 6rem;
}
