/* =====================================================================
   1.17.42 – Projektweite UI-Konsolidierung
   Referenz: Klientenliste Stadt
   Ziel: Schrift ausschließlich schwarz/weiß, Tabellen/Listen einheitlich,
   Benutzerfarbe in Tabellenköpfen, runde Ecken, Nachnamen fett.
   Diese Datei wird bewusst als LETZTE Stylesheet-Schicht geladen.
   ===================================================================== */
:root{
  --consistency-text:#000000;
  --consistency-card-radius:14px;
  --consistency-control-radius:9px;
  --consistency-cell-y:10px;
  --consistency-cell-x:13px;
  --text:#000000!important;
  --text-light:#000000!important;
  --status-ok-text:#000000!important;
  --status-warn-text:#000000!important;
  --status-danger-text:#000000!important;
  --status-neu-text:#000000!important;
  --status-abg-text:#000000!important;
  --ds-success:#000000!important;
  --ds-warning:#000000!important;
  --login-text:#000000!important;
  --login-muted:#000000!important;
  --login-danger:#000000!important;
  --select-text:#000000!important;
  --select-muted:#000000!important;
}
html[data-theme="dark"],html[data-theme="dark"] body{
  --consistency-text:#ffffff;
  --text:#ffffff!important;
  --text-light:#ffffff!important;
  --status-ok-text:#ffffff!important;
  --status-warn-text:#ffffff!important;
  --status-danger-text:#ffffff!important;
  --status-neu-text:#ffffff!important;
  --status-abg-text:#ffffff!important;
  --ds-success:#ffffff!important;
  --ds-warning:#ffffff!important;
  --login-text:#ffffff!important;
  --login-muted:#ffffff!important;
  --login-danger:#ffffff!important;
  --select-text:#ffffff!important;
  --select-muted:#ffffff!important;
}

/* Standardschriftfarbe: keine grauen/blauen/grünen/roten Textfarben mehr. */
body,main,.page,.content-wrap,.admin-page,.admin-ui,
.card,.info-card,.kpi-box,.modal-box,.settings-card,.diag-card,
label,.lbl,.helper,.muted,.page-sub,.sub,.field-hint,small,
.section-title,.section-label,.admin-section-heading,.section-heading,
.kpi-value,.kpi-label,.stat-bar-label,.stat-bar-value,.tab-btn,
.empty-state,td.empty-state,.frist-first-name,.frist-last-name,
.archive-empty,.fristen-empty,.field-error,.creation-errors,
.audit-chain-ok,.audit-chain-bad,.diag-ok,.diag-bad{
  color:var(--consistency-text)!important;
}

/* Inhaltslinks sind wie normaler Text schwarz/weiß. Farbakzent kommt über
   Fläche, Rahmen und Hover – nicht über die Schriftfarbe. */
main a:not(.btn):not(.archive-action-btn),
.page a:not(.btn):not(.archive-action-btn),
.content-wrap a:not(.btn):not(.archive-action-btn),
.admin-page a:not(.btn),
.admin-ui main a:not(.btn),
.fristen-table a,
.archive-card td a,
#attendanceCalendar td.name-cell a{
  color:var(--consistency-text)!important;
}
main a:not(.btn):hover,.page a:not(.btn):hover,.content-wrap a:not(.btn):hover{
  color:var(--consistency-text)!important;
}

/* Header/Sidebar liegen auf Benutzerfarbe: dort entscheidet nur die bereits
   serverseitig berechnete Kontrastfarbe – jetzt normiert auf Schwarz/Weiß. */
html:not([data-theme="dark"]) .app-sidebar,
html:not([data-theme="dark"]) .app-toprail,
html:not([data-theme="dark"]) .app-sidebar :is(a,button,label,strong,span,small),
html:not([data-theme="dark"]) .app-toprail :is(a,button,label,strong,span,small),
html:not([data-theme="dark"]) .sidebar-section-label,
html:not([data-theme="dark"]) .sidebar-weather-place,
html:not([data-theme="dark"]) .sidebar-weather .wetter-aktuell span,
html:not([data-theme="dark"]) .sidebar-weather .wetter-tag-name{
  color:var(--user-area-text,#000000)!important;
}
html[data-theme="dark"] .app-sidebar,
html[data-theme="dark"] .app-toprail,
html[data-theme="dark"] .app-sidebar :is(a,button,label,strong,span,small),
html[data-theme="dark"] .app-toprail :is(a,button,label,strong,span,small){
  color:#ffffff!important;
}

/* Buttons: Text nur schwarz/weiß. Primärfläche folgt Benutzerfarbe. */
.btn-primary,.btn-save,.btn-submit,.btn-success,.btn-green,
.nav-btn,.btn-new-client,.btn-complete,.archive-action-btn,
button.primary{
  background:var(--user-area-color,var(--primary))!important;
  border-color:var(--user-area-color-dark,var(--primary-dark))!important;
  color:var(--user-area-text,#ffffff)!important;
}
.btn-primary:hover,.btn-save:hover,.btn-submit:hover,.btn-success:hover,.btn-green:hover,
.nav-btn:hover,.btn-new-client:hover,.btn-complete:hover,.archive-action-btn:hover,
button.primary:hover{
  background:var(--user-area-color-dark,var(--primary-dark))!important;
  color:var(--user-area-text,#ffffff)!important;
}
.btn-secondary,.btn-ghost,.btn-cancel,.btn-edit,.theme-button,.logout-button{
  color:var(--consistency-text)!important;
}
.btn-danger,.btn-delete,.btn-red{
  color:var(--consistency-text)!important;
}
.btn-danger:hover,.btn-delete:hover,.btn-red:hover{
  color:#ffffff!important;
}

/* Statusinformationen behalten ihre semantischen Flächen/Rahmen, aber nicht
   mehr semantisch gefärbte Schrift. */
.badge,.status-badge,.uebrig-badge,.db-tag,.cat-status,
.status-success,.status-warning,.status-danger,.status-info,
.notice-success,.notice-warning,.notice-danger,.notice-info,
.frist-urgent td,.hours-negative td,.no-hours-red td{
  color:var(--consistency-text)!important;
}
.toast-success,.toast-error{color:#ffffff!important}

/* Einheitliche Tabellen-/Listenoptik wie Klientenliste Stadt. */
.table-wrap,.table-scroll,.table-wrapper,.archive-card,.fristen-card,.admin-list-card{
  border:1px solid var(--border)!important;
  border-radius:var(--consistency-card-radius)!important;
  overflow:auto!important;
  background:var(--card-bg)!important;
  box-shadow:none!important;
}
.table-wrap>table,.table-scroll>table,.table-wrapper>table,.archive-card>table,.fristen-card table,.admin-list-card table{
  border:0!important;
  border-radius:0!important;
}
table:not(#attendanceCalendar){
  width:100%!important;
  border-collapse:separate!important;
  border-spacing:0!important;
  border:1px solid var(--border)!important;
  border-radius:var(--consistency-card-radius)!important;
  overflow:hidden!important;
  background:var(--card-bg)!important;
  color:var(--consistency-text)!important;
}
.table-wrap>table:not(#attendanceCalendar),.table-scroll>table:not(#attendanceCalendar),
.table-wrapper>table:not(#attendanceCalendar),.archive-card>table:not(#attendanceCalendar),
.fristen-card table:not(#attendanceCalendar),.admin-list-card table:not(#attendanceCalendar){
  border:0!important;
}
table:not(#attendanceCalendar) thead th,
.admin-ui main table thead th,
.fristen-table thead th,
.papierkorb-page table thead th,
.archive-card table thead th{
  background:var(--user-area-color,var(--primary))!important;
  background-color:var(--user-area-color,var(--primary))!important;
  color:var(--user-area-text,#ffffff)!important;
  padding:var(--consistency-cell-y) var(--consistency-cell-x)!important;
  font-size:12px!important;
  font-weight:700!important;
  line-height:1.25!important;
  letter-spacing:0!important;
  text-transform:none!important;
  border:0!important;
  white-space:nowrap!important;
}
table:not(#attendanceCalendar) tbody td,
.admin-ui main table tbody td,
.fristen-table tbody td,
.papierkorb-page table tbody td,
.archive-card table tbody td{
  padding:var(--consistency-cell-y) var(--consistency-cell-x)!important;
  font-size:13px!important;
  line-height:1.35!important;
  color:var(--consistency-text)!important;
  background:var(--card-bg)!important;
  border-bottom:1px solid var(--border)!important;
  vertical-align:middle!important;
}
table:not(#attendanceCalendar) tbody tr:last-child td{border-bottom:0!important}
table:not(#attendanceCalendar) tbody tr:hover td,
.admin-ui main table tbody tr:hover td,
.fristen-table tbody tr:not(.frist-urgent):hover td,
.papierkorb-page table tbody tr:hover td,
.archive-card table tbody tr:hover td{
  background:color-mix(in srgb,var(--user-area-color,var(--primary)) 9%,var(--card-bg))!important;
  color:var(--consistency-text)!important;
}
html[data-theme="dark"] table:not(#attendanceCalendar) tbody tr:hover td{
  background:color-mix(in srgb,var(--user-area-color,var(--primary)) 16%,var(--card-bg))!important;
}
table:not(#attendanceCalendar) thead th:first-child{border-top-left-radius:calc(var(--consistency-card-radius) - 1px)!important}
table:not(#attendanceCalendar) thead th:last-child{border-top-right-radius:calc(var(--consistency-card-radius) - 1px)!important}

/* Listen im engeren Sinn: ruhiges, gleichmäßiges Spacing. */
.card :is(ul,ol),.admin-page :is(ul,ol),.content-wrap :is(ul,ol){
  margin:0!important;
  padding-left:1.25rem!important;
  color:var(--consistency-text)!important;
}
.card li,.admin-page li,.content-wrap li{
  padding:4px 0!important;
  color:var(--consistency-text)!important;
  line-height:1.4!important;
}

/* Namenskonvention: Nachname fett, Vorname normal. */
.client-last-name,.frist-last-name,
td[data-label="Nachname"] strong,
.archive-card tbody td:first-child strong,
.caseworker-last-name{
  font-weight:700!important;
  color:var(--consistency-text)!important;
}
.client-first-name,.frist-first-name{font-weight:400!important;color:var(--consistency-text)!important}

/* Erwachsenen-Kalender ist fachlich ein dichter Kalender, übernimmt aber
   dieselbe Farb-/Namenssprache und runde Außenkante. */
.attendance-scroll{
  border:1px solid var(--border)!important;
  border-radius:var(--consistency-card-radius)!important;
  overflow:auto!important;
}
#attendanceCalendar.attendance-calendar{
  border:0!important;
  color:var(--consistency-text)!important;
}
#attendanceCalendar.attendance-calendar thead th,
#attendanceCalendar.attendance-calendar thead th.name-col,
#attendanceCalendar.attendance-calendar thead th.id-col,
#attendanceCalendar.attendance-calendar thead th.cat-col,
#attendanceCalendar.attendance-calendar thead th.sum-col,
#attendanceCalendar.attendance-calendar thead th.uebrig-col,
#attendanceCalendar.attendance-calendar thead th.day-col,
#attendanceCalendar.attendance-calendar thead th.day-col.weekend,
#attendanceCalendar.attendance-calendar thead th.day-col.today,
#attendanceCalendar.attendance-calendar thead th.day-col.feiertag{
  background:var(--user-area-color,var(--primary))!important;
  color:var(--user-area-text,#ffffff)!important;
}
#attendanceCalendar.attendance-calendar thead th.day-col.today{
  box-shadow:inset 0 -3px 0 var(--danger)!important;
}
#attendanceCalendar.attendance-calendar thead th.day-col.feiertag{
  box-shadow:inset 0 -3px 0 var(--warning)!important;
}
#attendanceCalendar.attendance-calendar tbody td,
#attendanceCalendar.attendance-calendar td.name-cell,
#attendanceCalendar.attendance-calendar td.id-cell,
#attendanceCalendar.attendance-calendar td.cat-cell,
#attendanceCalendar.attendance-calendar td.sum-cell,
#attendanceCalendar.attendance-calendar td.uebrig-cell,
#attendanceCalendar.attendance-calendar select{
  color:var(--consistency-text)!important;
}
#attendanceCalendar.attendance-calendar tbody tr:hover td{
  background:color-mix(in srgb,var(--user-area-color,var(--primary)) 9%,var(--card-bg))!important;
}
#attendanceCalendar td.name-cell a{color:var(--consistency-text)!important;font-weight:400!important}
#attendanceCalendar .client-last-name{font-weight:700!important}
#attendanceCalendar .client-first-name{font-weight:400!important}

/* Standalone-Seiten: ebenfalls nur Schwarz/Weiß als Schriftfarbe. */
.login-brand span,.login-heading p,.login-footer,.login-version,.password-toggle,
.selection-brand-copy span,.welcome,.selection-intro p,.selection-quote cite,
.selection-footer,.selection-funfact,.area-meta,.area-hint{
  color:var(--consistency-text)!important;
}
.area-icon,.area-name,.area-color-action,.area-card strong,.selection-quote,.selection-funfact-label{
  color:var(--consistency-text)!important;
}
.login-error,.error{color:var(--consistency-text)!important}
html[data-theme="dark"] .login-error,html[data-theme="dark"] .error{color:#ffffff!important}

/* Placeholder und deaktivierte Texte bleiben Schwarz/Weiß; Hierarchie kommt
   über Gewicht/Opacity, nicht über eine dritte Schriftfarbe. */
input::placeholder,textarea::placeholder{color:var(--consistency-text)!important;opacity:.62}
input:disabled,select:disabled,textarea:disabled,input[readonly],textarea[readonly]{color:var(--consistency-text)!important}

/* Harte Endregel: sichtbare Schrift kennt nur Schwarz oder Weiß. Diese Regel
   steht bewusst vor den nachfolgenden Kontrastausnahmen. */
html:not([data-theme="dark"]) body *{color:#000000!important}
html[data-theme="dark"] body *{color:#ffffff!important}

/* Kontrastausnahmen für Flächen in Benutzerfarbe. */
html:not([data-theme="dark"]) :is(.app-sidebar,.app-toprail) *,
html:not([data-theme="dark"]) :is(.btn-primary,.btn-save,.btn-submit,.btn-success,.btn-green,.nav-btn,.btn-new-client,.btn-complete,.archive-action-btn,button.primary) *,
html:not([data-theme="dark"]) table:not(#attendanceCalendar) thead th *,
html:not([data-theme="dark"]) #attendanceCalendar thead th *{
  color:var(--user-area-text,#ffffff)!important;
}
html:not([data-theme="dark"]) :is(.app-sidebar,.app-toprail),
html:not([data-theme="dark"]) :is(.btn-primary,.btn-save,.btn-submit,.btn-success,.btn-green,.nav-btn,.btn-new-client,.btn-complete,.archive-action-btn,button.primary),
html:not([data-theme="dark"]) table:not(#attendanceCalendar) thead th,
html:not([data-theme="dark"]) #attendanceCalendar thead th{
  color:var(--user-area-text,#ffffff)!important;
}
html[data-theme="dark"] :is(.app-sidebar,.app-toprail) *,
html[data-theme="dark"] :is(.app-sidebar,.app-toprail){color:#ffffff!important}

/* Gefahrenflächen und Toasts sind dunkel genug für weiße Schrift. */
:is(.btn-danger,.btn-delete,.btn-red):hover,
:is(.btn-danger,.btn-delete,.btn-red):hover *,
.toast-success,.toast-success *,
.toast-error,.toast-error *{color:#ffffff!important}

/* Access-/DB-Badges bekommen eine helle Markenfläche statt dunkler, eigener
   Farbcodes. Dadurch bleibt schwarze Schrift im Hellmodus sicher lesbar. */
html:not([data-theme="dark"]) :is(.badge.db-stadt,.badge.db-kreis,.badge.db-erwachsene,.db-tag,.cat-status-on){
  background:color-mix(in srgb,var(--user-area-color,var(--primary)) 18%,var(--card-bg))!important;
  border-color:color-mix(in srgb,var(--user-area-color,var(--primary)) 42%,var(--border))!important;
  color:#000000!important;
}
html[data-theme="dark"] :is(.badge.db-stadt,.badge.db-kreis,.badge.db-erwachsene,.db-tag,.cat-status-on){
  color:#ffffff!important;
}

/* Interaktionsliste im Klientdetail ist ebenfalls eine Liste mit Kopfzeile. */
.interaction-list-head{
  padding:8px 12px!important;
  border-radius:var(--consistency-control-radius) var(--consistency-control-radius) 0 0!important;
  background:var(--user-area-color,var(--primary))!important;
  color:var(--user-area-text,#ffffff)!important;
  text-transform:none!important;
  letter-spacing:0!important;
}
.interaction-list-head *{color:var(--user-area-text,#ffffff)!important}
#interactionRows{
  gap:0!important;
  border:1px solid var(--border)!important;
  border-top:0!important;
  border-radius:0 0 var(--consistency-card-radius) var(--consistency-card-radius)!important;
  overflow:hidden!important;
}
.interaction-row{
  padding:10px 12px!important;
  gap:12px!important;
  border:0!important;
  border-bottom:1px solid var(--border)!important;
  border-radius:0!important;
  background:var(--card-bg)!important;
}
.interaction-row:last-child{border-bottom:0!important}
.interaction-row:hover{background:color-mix(in srgb,var(--user-area-color,var(--primary)) 9%,var(--card-bg))!important}
.interaction-delete-btn{color:var(--consistency-text)!important}
.interaction-delete-btn:hover{background:var(--danger)!important;color:#ffffff!important}
.interaction-delete-btn:hover *{color:#ffffff!important}


/* 1.17.43 – Fristen: Namen strikt Kontrastfarbe; Tabelle kompakter/schmaler. */
.fristen-table a,
.fristen-table a:hover,
.fristen-table .frist-last-name,
.fristen-table .frist-first-name{
  color:var(--consistency-text)!important;
}
.fristen-page .fristen-card{
  width:min(100%,900px)!important;
  max-width:900px!important;
  margin-left:auto!important;
  margin-right:auto!important;
}
.fristen-page .fristen-table-wrap{width:100%!important}


/* 1.17.62 – Klientenlisten Stadt/Kreis/Erwachsene vertikal kompakter.
   Keine feste Maximalhöhe/kein Abschneiden: Unterlängen wie g, y, p, q, j bleiben sichtbar. */
#clientTable tbody tr{
  height:auto!important;
  min-height:32px!important;
  max-height:none!important;
}
#clientTable tbody td{
  height:auto!important;
  min-height:32px!important;
  max-height:none!important;
  padding:4px 9px!important;
  line-height:1.35!important;
  vertical-align:middle!important;
  overflow:visible!important;
}
#clientTable tbody td,
#clientTable tbody td :is(a,span,strong,small){
  line-height:1.35!important;
}
#clientTable .status-badge,
#clientTable .uebrig-badge{
  min-height:22px!important;
  padding:2px 7px!important;
  line-height:1.3!important;
  vertical-align:middle!important;
}
#clientTable .client-row-actions{
  gap:4px!important;
  align-items:center!important;
}
#clientTable .client-row-actions button{
  min-height:28px!important;
  padding:3px 7px!important;
  line-height:1.25!important;
}
