/* ============================================================
   rail.solutions – Click-Dummy Styles
   ============================================================ */

/* Google Fonts: Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* ------------------------------------------------------------
   1. CSS Custom Properties – Light Theme (Default)
   ------------------------------------------------------------ */
:root {
  --color-primary:            #26537D;
  --color-primary-hover:      #316AA0;
  --color-primary-light:      #E8F0FB;
  --color-bg-app:             #F8F7F2;
  --color-bg-surface:         #F8F7F2;
  --color-bg-sidebar:         #1C3C5A;
  --color-bg-sidebar-hover:   #26537D;
  --color-bg-sidebar-active:  #26537D;
  --color-text-primary:       #F8F7F2;
  --color-text-secondary:     #060D14;
  --color-text-inverted:      #060D14;
  --color-border:             #1C3C5A;
  --color-border-focus:       #316AA0;
  --color-accent-1:           #5F98CE;
  --color-accent-2:           #3C82C3;
  --color-shadow:             rgba(0,0,0,0.08);

  /* Status */
  --status-pruefung-bg:       #FEF3C7;
  --status-pruefung-text:     #D97706;
  --status-planung-bg:        #DBEAFE;
  --status-planung-text:      #1D4ED8;
  --status-freigabe-bg:       #D1FAE5;
  --status-freigabe-text:     #065F46;
  --status-error-bg:          #FEE2E2;
  --status-error-text:        #DC2626;

  /* SEV / Ausfall */
  --color-sev:                #9333EA;
  --color-sev-bg:             #F3E8FF;
  --color-ausfall:            #DC2626;
  --color-ausfall-bg:         #FEF2F2;

  /* Layout */
  --sidebar-width:            250px;
  --sidebar-collapsed:        64px;
  --topbar-height:            56px;
  --transition-speed:         0.22s;
}

/* ------------------------------------------------------------
   2. Dark Theme
   ------------------------------------------------------------ */
[data-theme="dark"] {
  --color-primary:            #1C3C5A;
  --color-primary-hover:      #316AA0;
  --color-primary-light:      #1e3a5f;
  --color-bg-app:             #060D14;
  --color-bg-surface:         #0e1f30;
  --color-bg-sidebar:         #1C3C5A;
  --color-bg-sidebar-hover:   #26537D;
  --color-bg-sidebar-active:  #26537D;
  --color-text-primary:       #F8F7F2;
  --color-text-secondary:     #060D14;
  --color-text-inverted:      #F8F7F2;
  --color-border:             #26537D;
  --color-border-focus:       #5F98CE;
  --color-accent-1:           #5F98CE;
  --color-accent-2:           #3C82C3;
  --color-shadow:             rgba(0,0,0,0.3);
  --color-sev-bg:             #2d1b4e;
  --color-ausfall-bg:         #2d1010;
}

/* ------------------------------------------------------------
   3. Base Reset & Typography
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.95rem;
  color: var(--color-text-inverted);
  background: var(--color-bg-app);
  transition: background var(--transition-speed), color var(--transition-speed);
}

h1 { font-weight: 700; font-size: 1.5rem; }
h2 { font-weight: 600; font-size: 1.2rem; }
h3 { font-weight: 600; font-size: 1.05rem; }

a { color: var(--color-accent-1); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

/* ------------------------------------------------------------
   4. App Shell
   ------------------------------------------------------------ */
#app-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-bg-sidebar);
}

#app-main {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ------------------------------------------------------------
   5. Sidebar
   ------------------------------------------------------------ */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--color-bg-sidebar);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-speed), min-width var(--transition-speed);
  overflow: visible; /* allow edge button to peek out */
  overflow-x: clip;
  z-index: 100;
  flex-shrink: 0;
  position: relative;
}

#sidebar.sidebar-collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

#sidebar.sidebar-collapsed .sidebar-badge {
  display: none;
}

/* Floating collapse toggle — sits on the right border of the sidebar */
.sidebar-edge-btn {
  position: absolute;
  top: 50%;
  left: calc(var(--sidebar-width) - 16px);
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: #ffffff;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  transition: background 0.15s, color 0.15s, left var(--transition-speed);
  padding: 0;
  font-size: 0.75rem;
}
.sidebar-edge-btn:hover { background: var(--color-primary); color: #ffffff; }

/* Collapsed state: follow the collapsed sidebar width */
.app-shell:has(#sidebar.sidebar-collapsed) .sidebar-edge-btn {
  left: calc(var(--sidebar-collapsed) - 16px);
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-bottom {
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.nav-collapse {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: rgba(248,247,242,0.55);
  cursor: pointer;
  transition: color var(--transition-speed);
  white-space: nowrap;
}

.nav-collapse:hover { color: var(--color-text-primary); }

/* ------------------------------------------------------------
   6. Content Area
   ------------------------------------------------------------ */
#content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-bg-app);
  transition: background var(--transition-speed);
}

/* Topbar */
#topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-app);
  transition: background var(--transition-speed), border-color var(--transition-speed);
  z-index: 50;
}

.topbar-breadcrumb {
  font-size: 0.875rem;
  color: var(--color-text-inverted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.breadcrumb-sep { color: var(--color-accent-1); font-weight: 600; }

.breadcrumb-link {
  color: var(--color-accent-1);
  cursor: pointer;
  font-weight: 500;
}
.breadcrumb-link:hover { text-decoration: underline; }

.breadcrumb-current {
  color: var(--color-text-inverted);
  font-weight: 600;
}

.topbar-logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.3px;
  cursor: pointer;
  white-space: nowrap;
}

[data-theme="dark"] .topbar-logo { color: var(--color-accent-1); }

/* Main Screen Scroll Area */
#screen-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.screen {
  display: none;
  padding: 24px;
  animation: fadeIn 0.18s ease;
  min-height: 100%;
}

.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   7. Login Screen
   ------------------------------------------------------------ */
.login-card {
  background: var(--color-bg-app);
  border-radius: 14px;
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 {
  color: var(--color-primary);
  font-size: 1.8rem;
  margin: 0;
}

.login-logo span {
  font-size: 0.8rem;
  color: var(--color-text-inverted);
  opacity: 0.55;
}

.login-form label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-inverted);
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  display: block;
}

.login-form .form-control {
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-inverted);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.login-form .form-control:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(49,106,160,0.18);
  outline: none;
  background: var(--color-bg-surface);
  color: var(--color-text-inverted);
}

/* ------------------------------------------------------------
   8. Buttons
   ------------------------------------------------------------ */
.btn-primary-rs {
  background: var(--color-primary);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  padding: 9px 20px;
  cursor: pointer;
  transition: background var(--transition-speed), transform 0.08s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary-rs:hover { background: var(--color-primary-hover); }
.btn-primary-rs:active { transform: scale(0.98); }
.btn-primary-rs:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary-rs {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-inverted);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 8px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background var(--transition-speed), border-color var(--transition-speed);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary-rs:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.btn-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1.5px solid var(--color-border);
  background: transparent;
  cursor: pointer;
  color: var(--color-text-inverted);
  transition: background var(--transition-speed), border-color var(--transition-speed);
}

.btn-icon:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

/* Dropdown button */
.btn-dropdown {
  position: relative;
  display: inline-block;
}

.btn-dropdown .dropdown-menu-rs {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 190px;
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 4px 20px var(--color-shadow);
  z-index: 200;
  overflow: hidden;
  animation: dropdownIn 0.14s ease;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.btn-dropdown.open .dropdown-menu-rs { display: block; }

.dropdown-item-rs {
  padding: 9px 14px;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--color-text-inverted);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition-speed);
}

.dropdown-item-rs:hover { background: var(--color-primary-light); }
.dropdown-item-rs.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ------------------------------------------------------------
   9. Cards & Surfaces
   ------------------------------------------------------------ */
.surface-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px var(--color-shadow);
  transition: background var(--transition-speed), border-color var(--transition-speed);
}

[data-theme="dark"] .surface-card {
  background: var(--color-bg-surface);
  border-color: var(--color-border);
}

/* ------------------------------------------------------------
   10. Status Badges
   ------------------------------------------------------------ */
.badge-rs {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Ausfall */
.text-ausfall {
  color: var(--color-ausfall);
  font-weight: 600;
  text-decoration: line-through;
  opacity: 0.8;
}

/* ------------------------------------------------------------
   11. Dashboard
   ------------------------------------------------------------ */
.dashboard-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: auto 1fr;
  gap: 20px;
  height: calc(100vh - var(--topbar-height) - 48px);
}

.dashboard-list-panel {
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-map-panel {
  grid-column: 2;
  grid-row: 1;
  min-height: 320px;
}

.db-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.db-list-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-text-inverted);
}

.db-count-badge {
  background: var(--color-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

.vorgang-list { display: flex; flex-direction: column; gap: 8px; }

.vorgang-card {
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed), background var(--transition-speed);
  position: relative;
}

.vorgang-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 12px var(--color-shadow);
}

.vorgang-card.active {
  border-color: var(--color-accent-1);
  background: var(--color-primary-light);
}

.vorgang-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.vorgang-id {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary);
}

.vorgang-assignee {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.vorgang-assignee:hover::after {
  content: attr(data-name);
  position: absolute;
  top: -30px;
  right: 0;
  background: var(--color-bg-sidebar);
  color: var(--color-text-primary);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 300;
}

.vorgang-track {
  font-size: 0.82rem;
  color: var(--color-text-inverted);
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ------------------------------------------------------------
   12. Schematic Rail Map (SVG)
   ------------------------------------------------------------ */
.map-container {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px 24px 16px;
  box-shadow: 0 2px 8px var(--color-shadow);
  transition: background var(--transition-speed), border-color var(--transition-speed);
  overflow: hidden;
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.map-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-inverted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

.map-legend {
  display: flex;
  gap: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-inverted);
  opacity: 0.65;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

#schematic-map {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* SVG theming */
.map-line-normal { stroke: var(--color-primary); }
.map-line-affected { stroke: #D97706; }
.map-line-critical { stroke: var(--color-ausfall); }
.map-station-dot { fill: var(--color-bg-surface); stroke: var(--color-primary); }
.map-station-dot.affected { stroke: #D97706; fill: #FEF3C7; }
.map-station-label { fill: var(--color-text-inverted); }
[data-theme="dark"] .map-station-dot { fill: var(--color-bg-app); }

/* ------------------------------------------------------------
   13. Meldungen (S-03)
   ------------------------------------------------------------ */
.meldung-card {
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
  transition: border-color var(--transition-speed);
}

.meldung-card:hover { border-color: var(--color-accent-1); }

.meldung-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-inverted);
  margin-bottom: 12px;
}

.meldung-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--color-text-inverted);
  opacity: 0.7;
}

.meldung-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.weekday-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.weekday-chip {
  width: 28px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-inverted);
  opacity: 0.4;
}

.weekday-chip.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  opacity: 1;
}

/* ------------------------------------------------------------
   14. Züge & Pläne (S-04, S-05)
   ------------------------------------------------------------ */
.trains-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  height: calc(100vh - var(--topbar-height) - 48px);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}

.trains-sidebar {
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.trains-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.trains-list { overflow-y: auto; flex: 1; }

.trains-line-header {
  padding: 10px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-inverted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--color-border);
  user-select: none;
  transition: background var(--transition-speed);
}

.trains-line-header:hover { background: var(--color-primary-light); }

.line-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}

.trains-sub-list { background: var(--color-bg-app); }

.train-item {
  padding: 9px 16px 9px 32px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--color-text-inverted);
  opacity: 0.75;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  transition: background var(--transition-speed), opacity var(--transition-speed);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.train-item:hover { background: var(--color-primary-light); opacity: 1; }
.train-item.active { background: var(--color-primary-light); opacity: 1; font-weight: 600; }

.train-item-nr { font-weight: 700; font-size: 0.82rem; color: var(--color-primary); }
.train-item-route { font-size: 0.75rem; opacity: 0.65; }

.trains-detail {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.trains-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-inverted);
  opacity: 0.35;
  gap: 8px;
  font-size: 0.9rem;
  text-align: center;
}

.detail-field {
  margin-bottom: 16px;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-inverted);
  opacity: 0.5;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-inverted);
  background: var(--color-bg-app);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 7px 12px;
}

.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--color-bg-sidebar);
  border: 2px solid var(--color-border);
}

/* Stops list */
.stops-container {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-bg-app);
}

.stop-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 0.85rem;
  color: var(--color-text-inverted);
  gap: 8px;
  transition: background var(--transition-speed);
}

.stop-item:last-child { border-bottom: none; }

.stop-item:hover { background: var(--color-primary-light); }

.stop-connector {
  width: 2px;
  height: 100%;
  background: var(--color-accent-1);
  margin: 0 6px;
  flex-shrink: 0;
  align-self: stretch;
}

.stop-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  background: var(--color-bg-surface);
  flex-shrink: 0;
}

.stop-dot.terminal { background: var(--color-primary); }

/* Timetable table in S-06 */
.zug-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.zug-table {
  width: 100%;
  min-width: 500px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.zug-table th {
  background: var(--color-bg-sidebar);
  color: var(--color-text-primary);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.zug-table td {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  color: var(--color-text-inverted);
}

.zug-table tr:last-child td { border-bottom: none; }
.zug-table tr:hover td { background: var(--color-primary-light); }

/* ------------------------------------------------------------
   15. Drop Zone
   ------------------------------------------------------------ */
.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-speed), background var(--transition-speed);
  background: var(--color-bg-app);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.drop-zone-icon {
  color: var(--color-accent-1);
  opacity: 0.7;
}

.drop-zone-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-inverted);
  opacity: 0.6;
}

.drop-zone-sub {
  font-size: 0.72rem;
  color: var(--color-text-inverted);
  opacity: 0.4;
}

/* File chip */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-inverted);
  max-width: 100%;
}

.file-chip .chip-icon { flex-shrink: 0; }

.chip-spinner {
  animation: spin 1s linear infinite;
  color: var(--color-accent-1);
}

.chip-ok { color: #059669; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Read-only field */
.readonly-field {
  background: var(--color-bg-app);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.875rem;
  color: var(--color-text-inverted);
  min-height: 36px;
}

.readonly-field.empty {
  color: var(--color-text-inverted);
  opacity: 0.35;
  font-style: italic;
}

/* Tabs */
.rs-tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 20px;
  gap: 0;
}

.rs-tab {
  padding: 9px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-inverted);
  opacity: 0.5;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: opacity var(--transition-speed), border-color var(--transition-speed);
  white-space: nowrap;
}

.rs-tab.active {
  opacity: 1;
  border-bottom-color: var(--color-primary);
  color: var(--color-primary);
}

.rs-tab.disabled { cursor: not-allowed; opacity: 0.25; }

/* ------------------------------------------------------------
   16. Abweichungs-Detail (S-07)
   ------------------------------------------------------------ */
.deviation-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.deviation-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.dir-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-inverted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-pager {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-pager-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1.5px solid var(--color-border);
  background: transparent;
  cursor: pointer;
  color: var(--color-text-inverted);
  font-size: 0.85rem;
  transition: background var(--transition-speed);
}

.date-pager-btn:hover { background: var(--color-primary-light); }
.date-pager-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.date-display {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-inverted);
  min-width: 100px;
  text-align: center;
  padding: 4px 10px;
  background: var(--color-bg-app);
  border-radius: 6px;
  border: 1px solid var(--color-border);
}

/* Fahrplan table */
.fahrplan-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--color-shadow);
  background: var(--color-bg-surface);
}

.fahrplan-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: var(--color-bg-surface);
}

.fahrplan-table thead th {
  background: var(--color-bg-surface);
  color: var(--color-text-inverted);
  padding: 10px 14px;
  text-align: center;
  font-weight: 600;
  font-size: 0.78rem;
  position: sticky;
  top: 0;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.1);
}

.fahrplan-table thead th:first-child {
  text-align: left;
  min-width: 165px;
}

.fahrplan-table thead .train-header { background: var(--color-primary); }
.fahrplan-table thead .sev-header   { background: var(--color-sev); }

.fahrplan-table tbody td {
  padding: 7px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  border-right: 1px solid rgba(0,0,0,0.04);
  text-align: center;
  color: var(--color-text-inverted);
  background: var(--color-bg-surface);
  white-space: nowrap;
}

.fahrplan-table tbody td:last-child { border-right: none; }
.fahrplan-table tbody td:first-child { text-align: left; font-weight: 500; }

.fahrplan-table tbody tr:last-child td { border-bottom: none; }

.fahrplan-table tbody tr.affected-row td:first-child {
  border-left: 3px solid var(--color-sev);
}

.fahrplan-table tbody tr:hover td { background: var(--color-primary-light); }

.cell-normal { color: var(--color-text-inverted); font-weight: 500; }
.cell-ausfall {
  color: var(--color-ausfall);
  font-weight: 600;
  font-size: 0.72rem;
  text-decoration: line-through;
  opacity: 0.75;
}
.cell-sev {
  color: var(--color-sev);
  font-weight: 600;
}
.cell-empty { color: var(--color-text-inverted); opacity: 0.2; }
.cell-terminus { font-style: italic; opacity: 0.6; font-size: 0.75rem; }

/* Row separator (──────) */
.cell-separator {
  color: var(--color-text-inverted);
  opacity: 0.25;
  font-size: 0.7rem;
}

/* Deviation bottom panels */
.deviation-bottom {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
}

.docs-panel {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px;
}

.docs-panel-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-inverted);
  opacity: 0.5;
  margin-bottom: 10px;
  background: var(--color-primary-light);
}

.doc-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--color-border);
  font-size: 0.78rem;
  color: var(--color-text-inverted);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background var(--transition-speed);
  background: var(--color-bg-app);
}

.doc-chip:hover { background: var(--color-primary-light); }

.timeline-panel {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
}

.timeline-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-inverted);
  opacity: 0.5;
  margin-bottom: 12px;
  background: var(--color-primary-light);
}



/* ------------------------------------------------------------
   17. SEV Info Panel
   ------------------------------------------------------------ */
.sev-hint {
  background: var(--color-sev-bg);
  border: 1px solid var(--color-sev);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.75rem;
  color: var(--color-sev);
  display: flex;
  align-items: center;
  gap: 7px;
  opacity: 0.9;
}

/* ------------------------------------------------------------
   18. Toast Notifications
   ------------------------------------------------------------ */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  min-width: 280px;
  max-width: 380px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  animation: toastIn 0.2s ease;
  pointer-events: all;
  color: var(--color-text-inverted);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

.toast-success  { background: #059669; }
.toast-info     { background: var(--color-accent-2); }
.toast-error    { background: #DC2626; }
.toast-warning  { background: #D97706; }

/* ------------------------------------------------------------
   19. Settings Screen
   ------------------------------------------------------------ */
.settings-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}

.settings-row:last-child { border-bottom: none; }

.settings-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-inverted);
}

.settings-sub {
  font-size: 0.75rem;
  color: var(--color-text-inverted);
  opacity: 0.5;
  margin-top: 2px;
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.theme-option {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-inverted);
  opacity: 0.5;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background var(--transition-speed), opacity var(--transition-speed);
}

.theme-option.active {
  background: var(--color-primary);
  color: #fff;
  opacity: 1;
}

/* Language select */
.rs-select {
  background: var(--color-bg-app);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-inverted);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  min-width: 120px;
}

/* ------------------------------------------------------------
   20. About Screen
   ------------------------------------------------------------ */
.about-card {
  max-width: 520px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 36px;
  text-align: center;
}

.about-logo {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.about-tagline {
  font-size: 0.9rem;
  color: var(--color-text-inverted);
  opacity: 0.6;
  margin-bottom: 24px;
}

.about-text {
  font-size: 0.875rem;
  color: var(--color-text-inverted);
  opacity: 0.75;
  line-height: 1.7;
  text-align: left;
  margin-bottom: 20px;
}

.about-version {
  font-size: 0.75rem;
  opacity: 0.4;
  color: var(--color-text-inverted);
}

/* ------------------------------------------------------------
   21. Wizard
   ------------------------------------------------------------ */
.wizard-container {
  max-width: 640px;
}

.wizard-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-inverted);
  margin-bottom: 20px;
}

.wizard-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}

.wizard-field label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-inverted);
  opacity: 0.5;
  display: block;
  margin-bottom: 4px;
}

/* Deviations list S-05 style */
.deviations-list-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Modal overlay */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 28px;
  min-width: 340px;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  animation: fadeIn 0.18s ease;
}

/* Success banner */
.success-banner {
  background: var(--status-freigabe-bg);
  border: 1px solid var(--status-freigabe-text);
  color: var(--status-freigabe-text);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

/* Import success banner */
.import-banner {
  background: var(--color-primary-light);
  border: 1px solid var(--color-accent-1);
  color: var(--color-primary);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

/* Help badge / Legende popup */
.legende-popup {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  padding: 14px;
  min-width: 260px;
  box-shadow: 0 4px 20px var(--color-shadow);
  z-index: 200;
  font-size: 0.8rem;
}

.legende-popup.open { display: block; animation: dropdownIn 0.14s ease; }

.legende-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--color-text-inverted);
}

/* Dividers */
.section-divider {
  height: 1px;
  background: var(--color-border);
  margin: 16px 0;
  opacity: 0.5;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-accent-1); }

/* Utilities */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-8  { display: flex; align-items: center; gap: 8px; }
.flex-gap-12 { display: flex; align-items: center; gap: 12px; }
.mt-0  { margin-top: 0; }
.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.text-sm   { font-size: 0.8rem; }
.text-xs   { font-size: 0.72rem; }
.text-muted { opacity: 0.5; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

/* ============================================================
   LAYOUT – App Shell
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 56px 1fr;
  min-height: 100vh;
  background: var(--color-bg);
}

/* Topbar */
.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand, .topbar-logo-rs { font-weight: 700; font-size: 1.1rem; color: var(--color-primary); }
.topbar-logo-dot { color: var(--color-accent); font-weight: 700; }
.topbar-logo-sol { font-weight: 700; color: var(--color-primary); }
.topbar-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; }
.topbar-burger { display: none; }
@media(max-width:768px) { .topbar-burger { display: flex; } }

/* Sidebar */
.sidebar {
  grid-column: 1;
  grid-row: 2;
  background: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}
.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav-bottom { margin-top: auto; border-top: 1px solid var(--color-border); padding-top: 8px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background 0.15s;
}
.sidebar-link:hover { background: var(--color-bg); color: var(--color-primary); }
.sidebar-link.active { border-left-color: var(--color-primary); background: var(--color-bg); color: var(--color-primary); font-weight: 600; }
.sidebar-badge { margin-left: auto; background: var(--color-primary); color: #fff; border-radius: 10px; padding: 2px 7px; font-size: 0.72rem; font-weight: 600; }
.sidebar-badge.badge-orange { background: var(--color-warn); }
@media(max-width:768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; left: 0; top: 56px; height: calc(100vh - 56px); width: 220px; z-index: 200; }
  .sidebar.sidebar-open { display: flex; }
}

/* Main content */
.main-content {
  grid-column: 2;
  grid-row: 2;
  padding: 24px;
  overflow-y: auto;
}
@media(max-width:768px) { .main-content { grid-column: 1; padding: 16px; } }

/* Screen panels */
.screen-panel { display: none; }
.screen-panel.active { display: block; }

/* Login screen */
.screen-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-sidebar);
}
.screen-login.active { display: flex; }
.login-card { background: #ffffff; border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 40px; width: 100%; max-width: 380px; box-shadow: 0 8px 32px rgba(0,0,0,0.25); }
.login-logo { font-size: 1.5rem; text-align: center; margin-bottom: 4px; }
.login-logo-rs, .login-logo-sol { font-weight: 700; color: var(--color-primary); }
.login-logo-dot { font-weight: 700; color: var(--color-accent); }
.login-subtitle { text-align: center; font-size: 0.82rem; color: var(--color-text-muted); margin-bottom: 24px; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-title { font-size: 1.3rem; font-weight: 700; margin: 0; }
.page-subtitle { font-size: 0.85rem; color: var(--color-text-muted); }

/* ============================================================
   KPI ROW
   ============================================================ */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-card { background: var(--color-bg-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px 20px; }
.kpi-card--warn { border-left: 4px solid var(--color-warn); }
.kpi-value { font-size: 2rem; font-weight: 700; color: var(--color-primary); line-height: 1; }
.kpi-label { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 4px; }

/* ============================================================
   MAP CARD
   ============================================================ */
.map-card { background: var(--color-bg-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; margin-bottom: 0; }
.map-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 12px; }
.map-svg-wrap { overflow-x: auto; }
.map-svg-wrap svg { min-width: 700px; width: 100%; height: auto; display: block; }
.map-stn text { fill: var(--color-text); font-size: 10px; }

/* ============================================================
   FAHRPLAN TABLE
   ============================================================ */
.fahrplan-table { font-size: 0.82rem; }
.fahrplan-table thead th { background: var(--color-bg); font-weight: 600; white-space: nowrap; }
.fp-station { font-size: 0.82rem; white-space: nowrap; padding: 6px 10px !important; }
.fp-cell { text-align: center; padding: 4px 8px !important; vertical-align: middle; }
.fp-empty { color: var(--color-text-muted); }
.fp-normal { font-variant-numeric: tabular-nums; }
.fp-an { color: var(--color-primary); font-weight: 600; }
.fp-sev { background: rgba(139,92,246,0.07); }
.fp-ausfall { background: rgba(239,68,68,0.05); }
.text-ausfall { color: var(--color-error, #ef4444); font-weight: 600; font-size: 0.75rem; text-decoration: line-through; }
.time-an { font-weight: 600; }

/* ── An/Ab sub-rows inside a cell ── */
.fp-time-row {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  line-height: 1.6;
}
.fp-time-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted, #999);
  width: 14px;
  flex-shrink: 0;
  opacity: 0.6;
}

/* ── Editable time wrapper ── */
.fp-time-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 3px;
  transition: background 0.12s;
}
.fp-time-wrap:hover {
  background: var(--color-primary-light);
}
.fp-time-wrap:hover .fp-edit-icon {
  opacity: 1;
}

.fp-time {
  font-size: 0.82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  outline: none;
  min-width: 36px;
  text-align: center;
  border-radius: 3px;
  transition: color 0.15s;
}
.fp-time[contenteditable="true"] {
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-border-focus);
  box-shadow: 0 0 0 2px rgba(49,106,160,0.15);
  padding: 0 4px;
  cursor: text;
}

.fp-edit-icon {
  font-size: 0.65rem;
  opacity: 0;
  color: var(--color-accent-1);
  transition: opacity 0.12s;
  pointer-events: none;
  flex-shrink: 0;
}

/* ── Time deviation colours (matches Legende) ── */
.fp-time-early { color: #33CCCC !important; font-weight: 600; }
.fp-time-late  { color: var(--color-accent-2) !important; font-weight: 600; }

/* ── Cancelled stop: original time greyed + strikethrough (matches Legende) ── */
.fp-ausfall-orig {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: #888;
  text-decoration: line-through;
}

/* ── SEV transfer suggestion: original time shown struck-through until user edits it ── */
.fp-time[data-pristine] {
  color: #999;
  text-decoration: line-through;
  font-style: italic;
}

/* ── Per-row SEV highlight: light purple background + left border ── */
.fp-time-row.fp-time-row-sev {
  background: var(--color-sev-bg, #f3e8ff);
  border-left: 3px solid var(--color-sev, #9333ea);
  border-radius: 3px;
  padding-left: 4px;
  margin-bottom: 1px;
}

/* ── Per-row Ersatzzug highlight: light blue background + left border ── */
.fp-time-row.fp-time-row-train {
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid var(--color-accent-1, #3b82f6);
  border-radius: 3px;
  padding-left: 4px;
  margin-bottom: 1px;
}

/* ── Editable train-number badge (click to re-enter input) ── */
.fp-badge-edit {
  cursor: pointer;
  transition: opacity 0.15s;
}
.fp-badge-edit:hover { opacity: 0.75; }

/* ── Header badge container ── */
.fp-col-badges {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
}

/* ── Ersatzzug badge (read-only, from data) ── */
.badge-ersatz {
  background: rgba(59, 130, 246, 0.12);
  color: var(--color-accent-1, #3b82f6);
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Delete button inside header badge ── */
.fp-badge-del-wrap { padding-right: 4px; }
.fp-plan-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 2px;
  color: inherit;
  opacity: 0.65;
  vertical-align: middle;
}
.fp-plan-delete:hover { opacity: 1; }

/* ── Readonly train-number input (non-planung status) ── */
.fp-train-nr-input[readonly] {
  background: transparent;
  border-color: transparent;
  cursor: default;
  color: var(--color-text-muted);
  pointer-events: none;
}

/* ── Planning UI: hover icons on cancelled (!) cells ── */
.fp-plan-icons {
  display: none;
  gap: 4px;
  margin-top: 4px;
  justify-content: center;
}
.fp-cell.fp-ausfall:hover .fp-plan-icons,
.fp-cell.fp-planned-sev:hover .fp-plan-icons,
.fp-cell.fp-planned-train:hover .fp-plan-icons,
.fp-cell.fp-normal:hover .fp-plan-icons {
  display: flex;
}
.fp-plan-icon {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 5px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.fp-plan-icon:hover {
  background: var(--color-accent-1);
  color: #fff;
  border-color: var(--color-accent-1);
}
.fp-plan-icon[data-plan-type="sev"]:hover   { background: var(--color-sev);    border-color: var(--color-sev); color: #fff; }
.fp-plan-icon[data-plan-type="train"]:hover { background: var(--color-accent-1); border-color: var(--color-accent-1); color: #fff; }

/* ── Connection warning icon ── */
.fp-conn-warn {
  display: inline;
  margin-left: 3px;
  font-size: 0.75rem;
  color: #e67e00;
  cursor: help;
  line-height: 1;
}

/* ── Connection redirect button (next to ⚠ on AB time) ── */
.fp-conn-redirect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  padding: 0 3px;
  font-size: 0.7rem;
  color: var(--color-accent-1);
  background: transparent;
  border: 1px solid var(--color-accent-1);
  border-radius: 3px;
  cursor: pointer;
  line-height: 1.4;
  vertical-align: middle;
}
.fp-conn-redirect:hover {
  background: var(--color-accent-1);
  color: #fff;
}

/* ── Connection candidate dropdown ── */
.fp-conn-dropdown {
  position: absolute;
  z-index: 1050;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  overflow: hidden;
}
.fp-conn-dropdown-header {
  padding: 6px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-bg-app);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.fp-conn-candidate {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 6px 10px;
  font-size: 0.8rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  text-align: left;
  color: var(--color-text);
}
.fp-conn-candidate:last-child { border-bottom: none; }
.fp-conn-candidate:hover { background: var(--color-accent-1-light, #e8f0fe); }
.fp-conn-cand-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-left: 8px;
}

/* ── Virtual connection column ── */
.fp-th-conn {
  background: color-mix(in srgb, var(--color-accent-1) 6%, var(--color-bg-surface));
  border-left: 2px dashed var(--color-accent-1) !important;
}
.fp-conn-col-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-accent-1);
}
.fp-conn-col-del {
  font-size: 0.65rem;
  cursor: pointer;
  opacity: 0.7;
  padding: 1px 4px;
}
.fp-conn-col-del:hover { opacity: 1; }

/* ── Connection handoff cell ── */
.fp-conn-handoff-cell {
  background: color-mix(in srgb, var(--color-accent-1) 8%, var(--color-bg-surface));
  border-left: 2px dashed var(--color-accent-1) !important;
  text-align: center;
}
/* Normal stop in virtual connection column */
.fp-conn-cell {
  border-left: 2px dashed var(--color-accent-1) !important;
  background: color-mix(in srgb, var(--color-accent-1) 3%, var(--color-bg-surface));
}
.fp-conn-handoff-arrow {
  font-size: 1rem;
  color: var(--color-accent-1);
  line-height: 1;
}
.fp-conn-time {
  font-weight: 600;
  color: var(--color-accent-1);
}
.fp-conn-empty {
  border-left: 2px dashed var(--color-accent-1) !important;
  color: var(--color-text-muted);
  text-align: center;
  font-size: 0.7rem;
}

/* ── Prüfung modal OK button – disabled when blocking errors present ── */
#btn-modal-pruefung-ok:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  pointer-events: auto; /* keep pointer-events so tooltip/title is visible */
}

/* ── Planning mode: source cell ── */
.fp-cell.fp-planning-source {
  outline: 2px solid var(--color-accent-1);
  outline-offset: -2px;
  background: rgba(var(--color-accent-1-rgb, 59,130,246), 0.08);
}

/* ── Planning mode: valid drop target ── */
.fp-cell.fp-drop-target {
  outline: 2px dashed var(--color-accent-1);
  outline-offset: -2px;
  cursor: pointer;
  background: rgba(var(--color-accent-1-rgb, 59,130,246), 0.06);
}
.fp-cell.fp-drop-target:hover {
  background: rgba(var(--color-accent-1-rgb, 59,130,246), 0.18);
}

/* ── Original (struck-through) hint inside planned cells ── */
.fp-planned-orig-hint {
  display: flex;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.fp-planned-orig-hint .fp-ausfall-orig {
  font-size: 0.72rem;
}

/* ── Replacement-train number input in table header ── */
.fp-ersatz-nr-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}
.fp-train-nr-input {
  width: 72px;
  font-size: 0.75rem;
  padding: 1px 4px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg-card);
  color: var(--color-text);
  text-align: center;
}
.fp-train-nr-input:focus {
  outline: none;
  border-color: var(--color-accent-1);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge-sev {   background: var(--color-sev-bg);   color: var(--color-sev); font-size: 0.72rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; white-space: nowrap; }
.badge-status-planung { background: var(--status-planung-bg);  color: var(--status-planung-text); }
.badge-status-pruefung { background: var(--status-pruefung-bg); color: var(--status-pruefung-text);  }
.badge-status-freigegeben {background: var(--status-freigabe-bg); color: var(--status-freigabe-text);  }
.badge-status-ausgeleitet {background: var(--status-freigabe-bg); color: var(--status-freigabe-text); }

/* ============================================================
   META FIELDS
   ============================================================ */
.meta-label { font-size: 0.75rem; color: var(--color-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.meta-value { font-size: 0.88rem; margin-top: 2px; }

/* ============================================================
   WEEKDAY CELLS
   ============================================================ */
.weekday-cells { white-space: nowrap; }
.wd { display: inline-block; width: 24px; height: 24px; border-radius: 4px; text-align: center; line-height: 24px; font-size: 0.7rem; font-weight: 600; margin-right: 2px; }
.wd-on  { background: var(--color-primary); color: #fff; }
.wd-off { background: var(--color-bg); color: var(--color-text-muted); border: 1px solid var(--color-border); }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item { background: var(--color-bg-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 10px 16px; font-size: 0.85rem; box-shadow: 0 4px 12px rgba(0,0,0,0.12); opacity: 0; transform: translateY(8px); transition: opacity 0.3s, transform 0.3s; min-width: 220px; }
.toast-item.show { opacity: 1; transform: translateY(0); }
.toast-success { border-left: 4px solid #10b981; }
.toast-info    { border-left: 4px solid #3b82f6; }
.toast-error   { border-left: 4px solid #ef4444; }

/* ============================================================
   BTN-ICON
   ============================================================ */
.btn-icon { background: none; border: none; cursor: pointer; padding: 6px; border-radius: var(--radius-sm, 6px); color: var(--color-text); display: flex; align-items: center; justify-content: center; font-size: 1rem; transition: background 0.15s; }
.btn-icon:hover { background: var(--color-bg); }
.btn-icon:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============================================================
   APP SHELL – NEW LAYOUT (2-column: sidebar + main-area)
   ============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-bg-app);
  min-width: 0;
}

/* ============================================================
   SIDEBAR – UPDATED SELECTORS
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background: var(--color-bg-sidebar);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-speed), min-width var(--transition-speed);
  overflow: hidden;
  z-index: 100;
  flex-shrink: 0;
  position: relative;
  top: auto;
}

.sidebar.sidebar-collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

.sidebar-top {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: 0 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: var(--color-primary-hover);
  color: var(--color-text-primary);
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
  cursor: default;
}

.sidebar-username {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-primary);
  opacity: 0.9;
  transition: opacity var(--transition-speed);
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.sidebar-collapsed .sidebar-username,
#sidebar.sidebar-collapsed .sidebar-username { opacity: 0; pointer-events: none; }

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
  overflow-x: hidden;
  list-style: none;
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: rgba(248,247,242,0.75);
  cursor: pointer;
  transition: background var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed);
  border-left: 3px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  text-align: left;
}

.sidebar-link:hover {
  background: var(--color-bg-sidebar-hover);
  color: var(--color-text-primary);
}

.sidebar-link.active {
  background: var(--color-bg-sidebar-active);
  color: var(--color-text-primary);
  border-left-color: var(--color-accent-1);
}

.sidebar-link i {
  width: 20px;
  min-width: 20px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-link span:not(.sidebar-badge) {
  transition: opacity var(--transition-speed);
}

.sidebar.sidebar-collapsed .sidebar-link span:not(.sidebar-badge),
#sidebar.sidebar-collapsed .sidebar-link span:not(.sidebar-badge),
.sidebar.sidebar-collapsed .sidebar-username,
#sidebar.sidebar-collapsed .sidebar-username {
  opacity: 0;
  pointer-events: none;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--color-accent-2);
  color: #fff;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.sidebar-badge.badge-orange { background: var(--status-pruefung-text); }

.sidebar-bottom {
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-collapse-btn {
  color: rgba(248,247,242,0.55);
}

.sidebar-collapse-btn:hover { color: var(--color-text-primary); }

.sidebar-link-logout { color: rgba(248,247,242,0.55); }
.sidebar-link-logout:hover { color: #f87171; background: rgba(220,38,38,0.12); }

/* Mobile sidebar */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform var(--transition-speed);
    z-index: 200;
  }
  .sidebar.sidebar-open { transform: translateX(0); }
  .topbar-burger { display: flex !important; }
}

/* ============================================================
   TOPBAR – UPDATED
   ============================================================ */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-surface);
  z-index: 50;
  flex-shrink: 0;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.bc-item { color: var(--color-text-inverted); }
.bc-current { font-weight: 600; }
.bc-link { color: var(--color-accent-1); cursor: pointer; text-decoration: none; }
.bc-link:hover { text-decoration: underline; }
.bc-sep { color: var(--color-accent-1); font-weight: 600; margin: 0 2px; }

.topbar-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
  user-select: none;
}
[data-theme="dark"] .topbar-logo { color: var(--color-accent-1); }

.topbar-logo-rs  { color: var(--color-primary); }
.topbar-logo-dot { color: var(--color-accent-1); }
.topbar-logo-sol { color: var(--color-primary); }
[data-theme="dark"] .topbar-logo-rs,
[data-theme="dark"] .topbar-logo-sol { color: var(--color-accent-1); }

.topbar-actions { gap: 6px; }

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  background: var(--color-bg-app);
}

/* ── Züge & Pläne: Upload-State ─────────────────────────────── */
.zp-upload-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.zp-upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  min-height: 260px;
  border: 2px dashed var(--color-border);
  border-radius: 14px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  text-align: center;
  padding: 36px 24px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.zp-upload-drop.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.zp-upload-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text);
}
.zp-upload-hint {
  font-size: 0.85rem;
  line-height: 1.5;
}
.zp-upload-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
}
.zp-upload-file-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text);
}
.zp-upload-file-list .bi-check-circle-fill { color: #2e7d32; }


.screen-panel { display: none; animation: fadeIn 0.18s ease; }

.screen-panel.active { display: block; }

.screen-zuege.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height) - 48px);
  overflow: hidden;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text-inverted);
}

/* ============================================================
   S-02 DASHBOARD LAYOUT
   ============================================================ */
.dashboard-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .dashboard-layout { grid-template-columns: 1fr; }
}

.db-list-col { display: flex; flex-direction: column; gap: 8px; }
#db-list { display: flex; flex-direction: column; gap: 8px; }

.db-list-item {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.db-list-item:hover { border-color: var(--color-primary); box-shadow: 0 2px 8px var(--color-shadow); }

.db-list-item-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.db-list-item-id { font-weight: 600; font-size: 0.875rem; color: var(--color-text-inverted); }
.db-list-item-track { font-size: 0.82rem; color: var(--color-text-muted, #666); }

/* Map card  */
.db-map-col { display: flex; flex-direction: column; }
.map-card { background: var(--color-bg-surface); border: 1px solid var(--color-border); border-radius: 10px; overflow: hidden; }
.map-title { padding: 10px 14px 6px; font-weight: 600; font-size: 0.9rem; color: var(--color-text-inverted); border-bottom: 1px solid var(--color-border); }

.map-svg-wrap { padding: 12px 8px 8px; overflow-x: auto; overflow-y: hidden; }
.map-svg-wrap svg { width: 100%; min-width: 700px; height: auto; display: block; }
/* Do NOT override fill here — SVG uses per-element fill colors */
.map-legend { display: flex; align-items: center; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--color-border); font-size: 0.78rem; flex-wrap: wrap; }
.legend-title { font-weight: 700; color: var(--color-text-inverted); }
.legend-item { color: var(--color-text-muted, #555); }
.legend-item-msg i { color: var(--color-accent-2); }
.legend-item-task i { color: var(--status-pruefung-text); }

/* ============================================================
   S-03 MELDUNGEN – WEEKDAY CHIPS
   ============================================================ */
.wd-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}
.wd-chip-on  { background: var(--color-primary); color: #fff; }
.wd-chip-off { background: var(--color-bg-app); color: var(--color-text-muted, #888); border: 1px solid var(--color-border); }

/* ============================================================
   S-04 ZÜGE & PLÄNE LAYOUT
   ============================================================ */
.zp-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

@media (max-width: 768px) {
  .zp-layout { grid-template-columns: 1fr; }
}

.zp-list-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.zp-detail-col {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.zp-detail-col .card {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  color: var(--color-text-inverted);
  background: var(--color-bg-app);
}

.zp-mini-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-top: 6px;
  border: 1.5px dashed var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .15s, background .15s;
}
.zp-mini-upload:hover,
.zp-mini-upload.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.zp-line-item {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px 8px 0 0;
  border-bottom: none;
}

/* When the train list is collapsed, close the bottom of the header card */
.zp-line-item:has(+ .zp-train-list[style*="display: none"]),
.zp-line-item:has(+ .zp-train-list.d-none) {
  border-radius: 8px;
  border-bottom: 1px solid var(--color-border);
}

.zp-line-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--color-primary-light);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-inverted);
  border-radius: 8px 8px 0 0;
  text-align: left;
}

.zp-line-name { flex: 1; }

.zp-train-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 0 0 8px 8px;
  max-height: 420px;
  overflow-y: auto;
}

.zp-train-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.12s;
}
.zp-train-item:last-child { border-bottom: none; }
.zp-train-item:hover { background: var(--color-primary-light); }

.zp-train-nr { font-weight: 600; font-size: 0.85rem; color: var(--color-text-inverted); min-width: 52px; }
.zp-train-route { font-size: 0.8rem; color: var(--color-text-muted, #666); }

.zp-stops-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.zp-stop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
}
.zp-stop-item:last-child { border-bottom: none; }
.zp-stop-remove { opacity: 0; transition: opacity 0.15s; }
.zp-stop-item:hover .zp-stop-remove { opacity: 1; }

.zp-stop-add-btn {
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.82rem;
  color: var(--color-accent-1);
  cursor: pointer;
  width: 100%;
  margin-top: 6px;
  transition: background 0.12s, border-color 0.12s;
}
.zp-stop-add-btn:hover { background: var(--color-primary-light); border-color: var(--color-primary); }

.zp-color-chip {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

/* ============================================================
   S-06 WIZARD
   ============================================================ */
.wizard-card {
  max-width: 680px; 
  background: var(--color-bg-app);
}
.wizard-card .nav-link {
  color: var(--color-text-inverted);
}
.wizard-card .nav-item .active {
  background: var(--color-accent-1);
  color: var(--color-text-primary);
}

.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--color-bg-app);
}
.drop-zone:hover, .drop-zone.dz-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.drop-zone-sm { padding: 14px 20px; }

.drop-zone-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.drop-zone-icon { font-size: 1.8rem; color: var(--color-accent-1); }
.drop-zone-icon-sm { font-size: 1.2rem; color: var(--color-accent-1); }
.drop-zone-label { font-size: 0.85rem; color: var(--color-text-muted, #666); }
.drop-zone-label-sm { font-size: 0.8rem; color: var(--color-text-muted, #666); }

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.82rem;
  margin: 6px 0;
}

.file-chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.wz-chip-status { font-size: 0.9rem; }

.wz-fields .wz-field-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text-inverted);
  padding: 4px 0;
  border-bottom: 1px solid var(--color-border);
  min-height: 28px;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.spin { display: inline-block; animation: spin 1s linear infinite; }

/* ============================================================
   S-07 DETAIL – JIRA-STYLE LAYOUT
   ============================================================ */
.detail-jira-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1024px) {
  .detail-jira-layout { grid-template-columns: 1fr; }
}

.detail-main-col { min-width: 0; }
.detail-side-col { min-width: 0; }

.detail-jira-layout .card{
    background: var(--color-bg-surface);
    color: var(--color-text-inverted);
}

.fp-toolbar { border-radius: 8px 8px 0 0 !important; border-bottom: none !important; }
.fp-toolbar .card-body { 
  padding: 8px 14px !important;
  background: var(--color-bg-surface);
}

.fp-th-station { min-width: 150px; white-space: nowrap; }
.fp-th { min-width: 100px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 4px 0; position: relative; }

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 6px 8px 6px 0;
  position: relative;
  align-items: flex-start;
}

/* Line segment: from below current dot down to bottom of item */
.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 4px; /* center of 10px dot */
  top: calc(6px + 4px + 10px + 4px); /* padding-top + margin-top + dot-height + gap */
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

/* Line segment: from top of item up to just above dot */
.timeline-item + .timeline-item::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0;
  height: calc(6px + 4px - 4px); /* padding-top + margin-top - gap */
  width: 2px;
  background: var(--color-border);
}

.timeline-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: 50%;
  background: var(--color-accent-1);
  margin-top: 4px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

/* Avatar circle for comment entries */
.timeline-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
  margin-right: 5px;
  flex-shrink: 0;
}

.timeline-comment-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.timeline-content { display: flex; flex-direction: column; gap: 1px; }
.timeline-ts { font-size: 0.72rem; color: var(--color-text-muted, #888); }
.timeline-text { font-size: 0.82rem; color: var(--color-text-inverted); }

/* Inline comment input */
.timeline-add-row {
  display: flex;
  gap: 8px;
  padding: 6px 8px 6px 0;
  align-items: center;
}

.timeline-add-input {
  flex: 1;
  font-size: 0.82rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 4px 8px;
  outline: none;
  background: var(--color-bg-surface);
  color: var(--color-text-inverted);
}

.timeline-add-input:focus {
  border-color: var(--color-primary);
}

.timeline-add-confirm {
  font-size: 0.78rem;
  padding: 4px 10px;
}


/* Docs */
.file-chip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  transition: background 0.12s;
  color: var(--color-text-inverted);
}
.file-chip-row:hover { background: var(--color-primary-light); }
.file-chip-name { flex: 1; }

/* Assignee */
.assignee-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   TOAST – CLOSE BUTTON
   ============================================================ */
.toast-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
  color: inherit;
  opacity: 0.6;
  flex-shrink: 0;
}
.toast-close:hover { opacity: 1; }

/* ============================================================
   LOGIN – BRAND COLORS
   ============================================================ */
.login-logo-rs  { color: var(--color-primary); font-size: 1.8rem; font-weight: 700; }
.login-logo-dot { color: var(--color-accent-1); font-size: 1.8rem; font-weight: 700; }
.login-logo-sol { color: var(--color-primary); font-size: 1.8rem; font-weight: 700; }

.topbar-logo-rs  { color: var(--color-primary); font-weight: 700; }
.topbar-logo-dot { color: var(--color-accent-1); font-weight: 700; }
.topbar-logo-sol { color: var(--color-primary); font-weight: 700; }

/* ============================================================
   SCREEN TRANSITIONS (screen-login)
   ============================================================ */
.screen-login {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-bg-sidebar);
}
.screen-login.active { display: flex; }

/* ============================================================
   ABWEICHUNGEN LIST ITEM
   ============================================================ */
.abw-item { cursor: pointer; transition: box-shadow 0.15s; }
.abw-item:hover { box-shadow: 0 2px 8px var(--color-shadow); }

/* ============================================================
   FW-600 UTILITY
   ============================================================ */
.fw-600 { font-weight: 600; }

/* ============================================================
   AUTO-PROPOSAL BANNERS  (#fp-proposals)
   ============================================================ */
.proposal-banner {
  margin: 0.5rem 0;
  padding: 0.75rem 1rem;
  background: rgba(234, 179, 8, 0.07);
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-left: 4px solid #eab308;
  border-radius: 6px;
  font-size: 0.875rem;
}

.proposal-banner-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.proposal-banner-dir { font-size: 0.8rem; }

.proposal-banner-stops {
  margin: 0 0 0.5rem 1.25rem;
  padding: 0;
  list-style: disc;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.25rem;
}
.proposal-banner-stops li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.proposal-banner-note {
  margin-bottom: 0.6rem;
}

.proposal-banner-actions {
  display: flex;
  gap: 0.5rem;
}

/* Type tags inside proposal stop list */
.proposal-tag {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.proposal-tag-sev    { background: rgba(139, 92, 246, 0.15); color: #7c3aed; }
.proposal-tag-ersatz { background: rgba(59, 130, 246, 0.15); color: #1d4ed8; }
