/*
 * FDS Finaler UI-Abgleich
 * Sprint UI-4.5
 * Version: 4.5
 *
 * Letzte visuelle Qualitätsschicht für die gesamte Plattform.
 * Fachlogik, Berechnungen und Datenquellen bleiben unverändert.
 */

/* =========================================================
   1. PLATTFORMWEITE BASIS
   ========================================================= */
html {
  background: #090d11;
}

body.fds-business-system.ui-final-polish {
  min-width: 320px;
  overflow-x: hidden;
  background: #090d11;
  color-scheme: dark;
}

body.fds-business-system.ui-final-polish .workspace,
body.fds-business-system.ui-final-polish:not(.cockpit-business) .workspace {
  min-width: 0;
  background: #090d11;
}

body.fds-business-system.ui-final-polish .workspace main {
  width: 100%;
  max-width: var(--fds-content-max, 1540px);
  padding: 24px;
}

body.fds-business-system.ui-final-polish .workspace footer {
  width: calc(100% - 48px);
  max-width: calc(var(--fds-content-max, 1540px) - 48px);
  margin: 0 auto;
  padding: 17px 0 22px;
  border-top: 1px solid var(--fds-line, #2a343d);
  color: var(--fds-muted-2, #66727b);
  font-size: 10px;
  letter-spacing: .04em;
}

body.fds-business-system.ui-final-polish main :is(img, svg, canvas) {
  max-width: 100%;
}

body.fds-business-system.ui-final-polish main canvas {
  display: block;
}

/* Verhindert, dass einzelne lange Werte oder Bezeichnungen die Seite verbreitern. */
body.fds-business-system.ui-final-polish main :is(
  .card,
  .fds-panel,
  .management-panel,
  .operations-panel,
  .fleet-card,
  .economy-kpi-card,
  .comparison-summary-card,
  .anomaly-kpi-card,
  .cause-kpi-card,
  .replacement-kpi-card
) {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* =========================================================
   2. KONSISTENTE KANTEN, SCHATTEN UND INTERAKTIONEN
   ========================================================= */
body.fds-business-system.ui-final-polish main :is(
  .card,
  .btn,
  input,
  select,
  textarea,
  .table-wrap,
  .alert,
  .notice
) {
  border-radius: 2px;
}

body.fds-business-system.ui-final-polish main .card {
  box-shadow: none;
}

body.fds-business-system.ui-final-polish main :is(.btn, button, a, input, select, textarea) {
  transition-duration: 150ms;
}

body.fds-business-system.ui-final-polish main :is(.btn, button, a, input, select, textarea):focus-visible,
body.fds-business-system.ui-final-polish .logout-link:focus-visible,
body.fds-business-system.ui-final-polish .side-nav a:focus-visible {
  outline: 2px solid var(--fds-green-bright, #91d000);
  outline-offset: 2px;
  box-shadow: none;
}

body.fds-business-system.ui-final-polish .side-nav .nav-disabled {
  pointer-events: none;
  cursor: default;
}

body.fds-business-system.ui-final-polish .side-nav a[aria-current="page"] {
  color: #fff;
}

/* =========================================================
   3. MELDUNGEN UND FORMULARDETAILS
   ========================================================= */
body.fds-business-system.ui-final-polish main > .alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--fds-line, #2a343d);
  border-left: 3px solid var(--fds-info, #63a7c8);
  background: #10171c;
  color: var(--fds-text-soft, #c2cbd1);
  box-shadow: none;
}

body.fds-business-system.ui-final-polish main > .alert.success {
  border-left-color: var(--fds-positive, #7fc93a);
  background: rgba(127, 201, 58, .07);
  color: #b8e88c;
}

body.fds-business-system.ui-final-polish main > .alert.error {
  border-left-color: var(--fds-danger, #ff613f);
  background: rgba(255, 97, 63, .07);
  color: #ffb09e;
}

body.fds-business-system.ui-final-polish :is(input, select, textarea) {
  color-scheme: dark;
}

body.fds-business-system.ui-final-polish :is(input, select, textarea):disabled,
body.fds-business-system.ui-final-polish :is(input, select, textarea)[readonly] {
  opacity: .62;
  cursor: not-allowed;
}

body.fds-business-system.ui-final-polish select option {
  background: #0b1116;
  color: #f3f5f6;
}

/* =========================================================
   4. TABELLEN UND STATUS
   ========================================================= */
body.fds-business-system.ui-final-polish .table-wrap,
body.fds-business-system.ui-final-polish .fds-table-wrap {
  max-width: 100%;
  overscroll-behavior-inline: contain;
}

body.fds-business-system.ui-final-polish main table th {
  white-space: nowrap;
}

body.fds-business-system.ui-final-polish main table tbody tr {
  transition: background 120ms ease;
}

body.fds-business-system.ui-final-polish main table tbody tr:focus-within {
  background: rgba(145, 208, 0, .045);
}

/* =========================================================
   5. LOGIN UND INSTALLATION
   ========================================================= */
body.fds-login-page {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(120,185,0,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,185,0,.025) 1px, transparent 1px),
    #090d11;
  background-size: 38px 38px;
  color: #f3f5f6;
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.fds-login-shell {
  width: min(430px, 100%);
}

.fds-login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 18px;
}

.fds-login-wordmark {
  color: #f8fafc;
  font-size: 38px;
  font-style: italic;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.08em;
}

.fds-login-wordmark em {
  color: #78b900;
  font-style: inherit;
}

.fds-login-brand-copy b,
.fds-login-brand-copy span {
  display: block;
}

.fds-login-brand-copy b {
  color: #f3f5f6;
  font-size: 14px;
  letter-spacing: .02em;
}

.fds-login-brand-copy span {
  margin-top: 3px;
  color: #8f9ba5;
  font-size: 11px;
}

.fds-login-card {
  padding: 24px;
  border: 1px solid #2a343d;
  border-top: 3px solid #78b900;
  border-radius: 2px;
  background: linear-gradient(180deg, #11181e 0%, #0e1419 100%);
  box-shadow: 0 22px 60px rgba(0,0,0,.34);
}

.fds-login-card h1 {
  margin: 0;
  color: #f3f5f6;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -.025em;
}

.fds-login-intro {
  margin: 8px 0 20px;
  color: #8f9ba5;
  font-size: 12px;
  line-height: 1.55;
}

.fds-login-card label {
  display: block;
  margin: 13px 0 6px;
  color: #c2cbd1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.fds-login-card input {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  padding: 10px 11px;
  border: 1px solid #3a4650;
  border-radius: 2px;
  background: #0b1116;
  color: #f3f5f6;
  font-size: 13px;
}

.fds-login-card input:focus {
  border-color: #78b900;
  outline: 2px solid rgba(145,208,0,.22);
  outline-offset: 1px;
}

.fds-login-submit {
  width: 100%;
  min-height: 42px;
  margin-top: 18px;
  border: 1px solid #5d8f00;
  border-radius: 2px;
  background: #78b900;
  color: #071006;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.fds-login-submit:hover {
  border-color: #91d000;
  background: #91d000;
}

.fds-login-alert {
  margin: 0 0 14px;
  padding: 11px 12px;
  border: 1px solid #2a343d;
  border-left: 3px solid #ff613f;
  border-radius: 2px;
  background: rgba(255,97,63,.08);
  color: #ffb09e;
  font-size: 12px;
}

.fds-login-alert.success {
  border-left-color: #7fc93a;
  background: rgba(127,201,58,.08);
  color: #b8e88c;
}

.fds-login-meta {
  margin: 14px 0 0;
  color: #66727b;
  font-size: 10px;
  letter-spacing: .04em;
  text-align: center;
}

/* =========================================================
   6. RESPONSIVE UND BEWEGUNGSREDUKTION
   ========================================================= */
@media (max-width: 1000px) {
  body.fds-business-system.ui-final-polish .workspace main {
    padding: 20px;
  }
  body.fds-business-system.ui-final-polish .workspace footer {
    width: calc(100% - 40px);
    max-width: none;
  }
}

@media (max-width: 720px) {
  body.fds-business-system.ui-final-polish .workspace main {
    padding: 14px;
  }
  body.fds-business-system.ui-final-polish .workspace footer {
    width: calc(100% - 28px);
  }
  body.fds-business-system.ui-final-polish .user-area {
    gap: 8px;
  }
  body.fds-business-system.ui-final-polish .logout-link {
    padding: 7px 9px;
  }
  body.fds-login-page {
    padding: 14px;
  }
  .fds-login-card {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.fds-business-system.ui-final-polish *,
  body.fds-login-page * {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  html,
  body.fds-business-system.ui-final-polish {
    background: #fff !important;
    color-scheme: light;
  }
  body.fds-business-system.ui-final-polish .workspace {
    background: #fff !important;
  }
  body.fds-business-system.ui-final-polish .workspace main {
    padding: 0;
  }
  body.fds-business-system.ui-final-polish .workspace footer {
    display: none !important;
  }
}
