/* MyAPL – SBB Corporate Design */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --sbb-red: #EB0000;
  --sbb-red-dark: #C40000;
  --sbb-red-light: #FFEDED;
  --sbb-black: #000000;
  --sbb-dark: #1a1a1a;
  --sbb-grey-900: #222222;
  --sbb-grey-800: #333333;
  --sbb-grey-700: #444444;
  --sbb-grey-500: #767676;
  --sbb-grey-300: #BBBBBB;
  --sbb-grey-200: #DCDCDC;
  --sbb-grey-100: #F0F0F0;
  --sbb-grey-50:  #F8F8F8;
  --sbb-white: #FFFFFF;

  --sbb-blue: #2D6CC0;
  --sbb-blue-light: #EBF2FC;
  --sbb-green: #00804A;
  --sbb-green-light: #E0F5ED;
  --sbb-orange: #E84E10;
  --sbb-orange-light: #FEF0EB;
  --sbb-yellow: #FACC00;
  --sbb-yellow-light: #FFFBE0;

  --sidebar-width: 240px;
  --header-height: 56px;
  --radius: 4px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.10);
  --shadow-md: 0 2px 8px rgba(0,0,0,.12);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.15);
  --transition: 150ms ease;

  --font: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 14px;
  color: var(--sbb-grey-800);
  background: var(--sbb-grey-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--sbb-red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LAYOUT ── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
#sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: 1px solid var(--sbb-grey-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--sbb-grey-200);
  background: white;
  box-sizing: border-box;
  flex-shrink: 0;
}

.sidebar-logo-img {
  height: 20px;
  width: auto;
  display: block;
}

nav { flex: 1; padding: 12px 0; }

.nav-section-label {
  padding: 16px 20px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--sbb-grey-400);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sbb-grey-600);
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  font-size: 13.5px;
  user-select: none;
}

.nav-item:hover {
  color: var(--sbb-grey-900);
  background: var(--sbb-grey-50);
}

.nav-item.active {
  color: var(--sbb-red);
  background: var(--sbb-red-light);
  border-left-color: var(--sbb-red);
  font-weight: 500;
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  opacity: .7;
  flex-shrink: 0;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--sbb-red);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 16px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--sbb-grey-200);
  color: var(--sbb-grey-500);
  font-size: 11px;
}

/* MAIN */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

/* TOPBAR */
#topbar {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--sbb-grey-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--sbb-grey-900);
  flex: 1;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* SUBBAR (sticky toolbar below topbar) */
#subbar {
  background: white;
  border-bottom: 1px solid var(--sbb-grey-200);
  padding: 10px 24px;
  flex-shrink: 0;
  z-index: 40;
}

/* CONTENT */
#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  min-height: 0;
}

/* ── CARDS ── */
.card {
  background: white;
  border: 1px solid var(--sbb-grey-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sbb-grey-100);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sbb-grey-900);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--sbb-red);
  color: white;
  border-color: var(--sbb-red);
}
.btn-primary:hover { background: var(--sbb-red-dark); border-color: var(--sbb-red-dark); }

.btn-secondary {
  background: white;
  color: var(--sbb-grey-800);
  border-color: var(--sbb-grey-300);
}
.btn-secondary:hover { background: var(--sbb-grey-100); border-color: var(--sbb-grey-400); }
.btn-blue { background: #1A5CB0; border-color: #1A5CB0; color: white; transition: background 150ms, border-color 150ms, transform 80ms, box-shadow 150ms; }
.btn-blue:hover { background: #154d96; border-color: #154d96; transform: translateY(-1px); box-shadow: 0 2px 6px rgba(26,92,176,0.3); }
.btn-blue:active { transform: translateY(0); box-shadow: none; }

.btn-ghost {
  background: transparent;
  color: var(--sbb-grey-700);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--sbb-grey-100); }

.btn-danger {
  background: white;
  color: var(--sbb-red);
  border-color: var(--sbb-red);
}
.btn-danger:hover { background: var(--sbb-red-light); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 22px; font-size: 14px; }

.btn svg { width: 14px; height: 14px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--sbb-grey-700);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

input, select, textarea {
  width: 100%;
  padding: 5px 10px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--sbb-grey-900);
  background: white;
  border: 1px solid var(--sbb-grey-300);
  border-radius: var(--radius);
  transition: border-color var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--sbb-red);
  box-shadow: 0 0 0 3px rgba(235,0,0,.1);
}

input[type="url"] { font-family: var(--font-mono); font-size: 12px; }

textarea { resize: vertical; min-height: 80px; }

.input-prefix {
  display: flex;
  align-items: center;
  border: 1px solid var(--sbb-grey-300);
  border-radius: var(--radius);
  overflow: hidden;
}

.input-prefix span {
  padding: 8px 10px;
  background: var(--sbb-grey-100);
  color: var(--sbb-grey-500);
  font-size: 12px;
  border-right: 1px solid var(--sbb-grey-300);
  white-space: nowrap;
}

.input-prefix input {
  border: none;
  border-radius: 0;
}

.input-prefix input:focus { box-shadow: none; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
.pendenzen-wrap .table-wrap { overflow-x: hidden; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--sbb-grey-50);
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sbb-grey-500);
  border-bottom: 2px solid var(--sbb-grey-200);
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--sbb-grey-100);
  color: var(--sbb-grey-800);
  vertical-align: middle;
}

tbody tr:hover td { background: var(--sbb-grey-50); }
tbody tr:last-child td { border-bottom: none; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 450;
  letter-spacing: 0.2px;
}

.badge-red    { background: #FFE4E4; color: #C00000; }
.badge-green  { background: #D6F5E8; color: #007A45; }
.badge-blue   { background: #DDEEFF; color: #1A5CB0; }
.badge-grey   { background: #EBEBEB; color: #3A3A3A; }
.badge-orange { background: #FFE8DC; color: #C04000; }
.badge-yellow { background: #FFF5CC; color: #7A5800; }

/* Fachdienst badges */
.fd-fb { background: #EBF2FC; color: #1a5ba8; }
.fd-kab { background: #FFF3E0; color: #E65100; }
.fd-saz { background: #F3E5F5; color: #7B1FA2; }
.fd-fl { background: #E8F5E9; color: #2E7D32; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 1000;
  padding: 5vh 24px 5vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
  overflow-y: auto;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: calc(100vh - 10vh - 24px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px);
  transition: transform 200ms;
  flex-shrink: 0;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--sbb-grey-200);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--sbb-grey-900);
}

.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--sbb-grey-500);
  padding: 4px;
  border-radius: var(--radius);
  display: flex;
}
.modal-close:hover { background: var(--sbb-grey-100); color: var(--sbb-grey-800); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--sbb-grey-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Wide modal */
.modal.modal-lg { max-width: 900px; }
.modal.modal-xl { max-width: 1100px; }

/* ── TABS ── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--sbb-grey-200);
  margin-bottom: 20px;
  gap: 0;
}

.tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sbb-grey-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  white-space: nowrap;
}

.tab:hover { color: var(--sbb-grey-800); }
.tab.active { color: var(--sbb-red); border-bottom-color: var(--sbb-red); font-weight: 600; }

/* ── DASHBOARD STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid var(--sbb-grey-200);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sbb-grey-500);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--sbb-grey-900);
  line-height: 1;
}

.stat-sub {
  font-size: 12px;
  color: var(--sbb-grey-500);
  margin-top: 4px;
}

/* ── SEARCH ── */
.search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  color: var(--sbb-grey-400);
  width: 14px; height: 14px;
  pointer-events: none;
}

.search-wrap input {
  padding-left: 32px;
  width: 240px;
}

/* ── PILL TABS (fachdienst) ── */
.pill-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--sbb-grey-300);
  color: var(--sbb-grey-600);
  background: white;
  transition: var(--transition);
}

.pill:hover { border-color: var(--sbb-red); color: var(--sbb-red); }
.pill.active { background: var(--sbb-red); color: white; border-color: var(--sbb-red); }

/* ── MILESTONE INDICATORS ── */
.milestone-list { display: flex; flex-direction: column; gap: 6px; }

.milestone-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--sbb-grey-50);
  border-radius: var(--radius);
  border-left: 3px solid var(--sbb-grey-300);
  font-size: 12.5px;
}

.milestone-item.done { border-left-color: var(--sbb-green); }
.milestone-item.upcoming { border-left-color: var(--sbb-yellow); }
.milestone-item.overdue { border-left-color: var(--sbb-red); }

.milestone-name { font-weight: 500; flex: 1; }
.milestone-date { color: var(--sbb-grey-500); font-size: 12px; font-family: var(--font-mono); }

/* ── AVOR STATUS ── */
.avor-stages {
  display: flex;
  gap: 4px;
}

.avor-stage {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  background: var(--sbb-grey-100);
  color: var(--sbb-grey-500);
}

.avor-stage.active { background: var(--sbb-blue-light); color: var(--sbb-blue); }
.avor-stage.done { background: var(--sbb-green-light); color: var(--sbb-green); }
.avor-stage.snapshot { background: var(--sbb-yellow-light); color: #7A6000; }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--sbb-grey-400);
  text-align: center;
}

.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--sbb-grey-600); margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 300px; }

/* ── ALERTS ── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-info { background: var(--sbb-blue-light); color: var(--sbb-blue); }
.alert-warn { background: var(--sbb-yellow-light); color: #7A6000; }
.alert-danger { background: var(--sbb-red-light); color: var(--sbb-red-dark); }
.alert-success { background: var(--sbb-green-light); color: var(--sbb-green); }

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--sbb-grey-200);
  margin: 20px 0;
}

/* ── PAGE GRID ── */
.page-grid {
  display: grid;
  gap: 20px;
}

.page-grid-2 { grid-template-columns: 1fr 1fr; }
.page-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.page-grid-sidebar { grid-template-columns: 1fr 320px; }

/* ── UTILS ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--sbb-grey-500); }
.text-red { color: var(--sbb-red); }
.text-green { color: var(--sbb-green); }
.text-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── TOAST ── */
#toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2000;
}

.toast {
  background: white;
  color: var(--sbb-grey-800);
  padding: 10px 14px 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 450;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  min-width: 200px;
  border-left: 3px solid var(--sbb-grey-300);
  animation: toastIn 180ms ease;
}

.toast svg { width: 14px; height: 14px; flex-shrink: 0; }

.toast.success { border-left-color: var(--sbb-green); color: var(--sbb-grey-800); }
.toast.success svg { color: var(--sbb-green); }
.toast.error   { border-left-color: var(--sbb-red); }
.toast.error svg { color: var(--sbb-red); }
.toast.info    { border-left-color: var(--sbb-blue); }
.toast.info svg { color: var(--sbb-blue); }
.toast.warning { border-left-color: #E84E10; }
.toast.warning svg { color: #E84E10; }

@keyframes toastIn {
  from { transform: translateX(16px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── DROPDOWN ── */
.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: white;
  border: 1px solid var(--sbb-grey-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  z-index: 500;
  overflow: hidden;
  display: none;
}

.dropdown-menu.open { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--sbb-grey-800);
  cursor: pointer;
  transition: var(--transition);
}

.dropdown-item:hover { background: var(--sbb-grey-50); }
.dropdown-item.danger { color: var(--sbb-red); }
.dropdown-item svg { width: 14px; height: 14px; }

.dropdown-divider { height: 1px; background: var(--sbb-grey-200); margin: 4px 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sbb-grey-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--sbb-grey-400); }

/* ── PRINT / PDF ─────────────────────────────────────────────────── */
@media print {
  #sidebar, #topbar, .btn, .modal-overlay, #toast-container,
  .topbar-actions, [onclick], button { display: none !important; }

  #app { display: block; }
  #main { overflow: visible; }
  #content { padding: 0; overflow: visible; }

  body { font-size: 11px; color: #000; background: white; }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
    margin-bottom: 12px;
  }

  table { font-size: 10px; }
  thead th { background: #f0f0f0 !important; }

  /* Gantt print */
  .gantt-wrap { overflow: visible !important; }
  .gantt-wrap table { font-size: 9px; }

  /* Show project info compact */
  .print-header {
    display: block !important;
    border-bottom: 2px solid #EB0000;
    margin-bottom: 16px;
    padding-bottom: 8px;
  }

  .page-grid-sidebar { grid-template-columns: 1fr !important; }
  .page-grid-2 { grid-template-columns: 1fr 1fr !important; }

  @page {
    size: A4 landscape;
    margin: 12mm 10mm;
  }
}

.print-header { display: none; }

/* ── LOGIN SCREEN ── */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sbb-grey-50);
  padding: 24px;
}

.login-card {
  background: white;
  border: 1px solid var(--sbb-grey-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 32px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--sbb-red);
}

.login-logo .logo-mark {
  width: 36px; height: 36px;
  background: var(--sbb-red);
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.login-logo .logo-mark span {
  color: white; font-weight: 700; font-size: 14px;
}

.login-logo .logo-text {
  font-size: 18px; font-weight: 600; color: var(--sbb-grey-900);
}

.login-logo .logo-sub {
  font-size: 10px; font-weight: 400; color: var(--sbb-grey-500);
  text-transform: uppercase; letter-spacing: 0.5px;
}

.login-error {
  background: var(--sbb-red-light);
  color: var(--sbb-red-dark);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 12px;
}

.login-success {
  background: var(--sbb-green-light);
  color: var(--sbb-green);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 12px;
}

.login-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--sbb-grey-200);
  text-align: center;
  font-size: 11px;
  color: var(--sbb-grey-400);
}

/* ── LOADING ── */
.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--sbb-grey-200);
  border-top-color: var(--sbb-red);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Kontakt Import */
.ki-radio { transition: all .15s; }
.ki-radio.active[data-decision="keep"] { background: var(--sbb-grey-100); border-color: var(--sbb-grey-400); font-weight: 600; }
.ki-radio.active[data-decision="overwrite"] { background: #fde8e8; border-color: var(--sbb-red); font-weight: 600; color: var(--sbb-red); }

/* Kontakte Tabelle */
.kontakte-table { font-size: 12px; }
.kontakte-table thead th { padding: 7px 8px; font-size: 10px; }
.kontakte-table tbody td { padding: 7px 8px; }
.kontakte-table td:last-child { white-space: nowrap; }

.k-group-header td {
  background: var(--sbb-grey-50) !important;
  padding: 10px 8px !important;
  border-bottom: 2px solid var(--sbb-grey-200) !important;
  font-size: 13px;
}
.k-group-header + tr td { border-top: none; }

#k-group-btn.active {
  background: var(--sbb-red);
  color: #fff;
  border-color: var(--sbb-red);
}

/* Searchable Select */
.search-select { position: relative; }
.search-select input {
  width: 100%; cursor: pointer;
  background: white;
}
.search-select-dd {
  display: none; position: absolute;
  background: white; border: 1px solid var(--sbb-grey-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md); max-height: 220px; overflow-y: auto; z-index: 1100;
}
.search-select-dd .ss-item {
  padding: 7px 12px; cursor: pointer; font-size: 13px;
}
.search-select-dd .ss-item:hover,
.search-select-dd .ss-item.selected { background: var(--sbb-grey-50); }
.search-select-dd .ss-item.selected { font-weight: 600; color: var(--sbb-red); }
.search-select-dd .ss-empty { padding: 12px; text-align: center; color: var(--sbb-grey-400); font-size: 13px; }

/* Projekte table */
.projekte-table { font-size: 12px; }
.projekte-table thead th { padding: 7px 8px; font-size: 10px; }
.projekte-table tbody td { padding: 8px 8px; }
.projekte-table tfoot td {
  padding: 6px 8px;
  font-size: 11px; font-weight: 600;
  background: var(--sbb-grey-50);
  border-top: 2px solid var(--sbb-grey-200);
  color: var(--sbb-grey-600);
}

.pendenzen-table { font-size: 12px; width: 100%; }
.pendenzen-table thead { position: sticky; top: 0; z-index: 2; background: white; }
.pendenzen-table thead th { padding: 7px 8px; font-size: 10px; white-space: nowrap; border-bottom: 1px solid var(--sbb-grey-100); }
.pendenzen-table tbody td { padding: 8px 8px; vertical-align: middle; border-bottom: 1px solid var(--sbb-grey-100); }
.pendenzen-table tbody tr:last-child td { border-bottom: none; }
.pendenzen-table tbody tr:hover { background: var(--sbb-grey-50); }
.pendenzen-table tr.spacer-row td { border: none !important; line-height: 0; }
.pendenzen-table tr.spacer-row + tr.group-header td { border-top: 1px solid #FFCCCC !important; }

/* Filter group */
/* Filter bar (all pages) */
.filter-bar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.filter-bar .search-wrap input {
  height: 32px; padding: 4px 10px 4px 30px; font-size: 12px; box-sizing: border-box;
}
.filter-bar .search-wrap svg { top: 50%; transform: translateY(-50%); }
.filter-bar select {
  height: 32px; padding: 4px 10px; font-size: 12px; box-sizing: border-box;
  border: 1px solid var(--sbb-grey-200); border-radius: var(--radius);
}
.filter-bar .btn-sm { height: 32px; box-sizing: border-box; }

.filter-group { display: flex; gap: 6px; align-items: center; }
.filter-group select,
.filter-group-btn {
  border: 1px solid var(--sbb-grey-200); border-radius: var(--radius);
  padding: 5px 10px; font-size: 12px; background: white; cursor: pointer;
  outline: none; white-space: nowrap; height: 32px; box-sizing: border-box;
}
.filter-group select { padding-right: 28px; }
.filter-group select,
.filter-bar select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23767676' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}
.filter-group select:hover,
.filter-group-btn:hover { background-color: var(--sbb-grey-50); }
.filter-group select:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23767676' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 8px center; }
.filter-group-btn.active {
  background: var(--sbb-red); color: white; font-weight: 600;
}

#proj-group-btn.active {
  background: var(--sbb-red);
  color: #fff;
  border-color: var(--sbb-red);
}

/* Project link icons */
.proj-link-icon {
  color: var(--sbb-grey-400); transition: all .15s;
  display: inline-flex; align-items: center;
  padding: 2px;
}
.proj-link-icon:hover { color: var(--sbb-red); transform: scale(1.15); }

/* Team groups */
.team-group {
  border: 1px solid var(--sbb-grey-200);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.team-group-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .4px; color: var(--sbb-grey-500);
  padding: 8px 14px;
  background: var(--sbb-grey-50);
  border-bottom: 1px solid var(--sbb-grey-200);
  margin-bottom: 4px;
}
.modal .team-group-title { margin-bottom: 10px; }
.team-group > .form-group,
.team-group > div:not(.team-group-title) { padding: 0 14px; }
.team-group > .form-group:last-child { padding-bottom: 14px; }
.team-group > button { margin: 4px 14px 10px; }

/* Team rows (detail card) */
.team-rows { padding: 6px 14px 10px; }
.team-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--sbb-grey-50);
}
.team-row:last-child { border-bottom: none; }
.team-fn {
  font-size: 11px; font-weight: 600; color: var(--sbb-grey-500);
  text-transform: uppercase; letter-spacing: .3px;
  flex-shrink: 0; min-width: 60px;
}
.team-name {
  cursor: pointer; color: var(--sbb-grey-800); font-weight: 500;
  transition: color .15s;
}
.team-name:hover { color: var(--sbb-red); }

/* Contact popover */
.contact-popover {
  position: absolute; z-index: 1001;
  background: white; border: 1px solid var(--sbb-grey-200);
  border-radius: var(--radius-lg); padding: 12px 16px;
  box-shadow: var(--shadow-lg); min-width: 200px; max-width: 300px;
}

/* ── PROJEKT LINKS ─────────────────────────────────────────── */
.pl-group { margin-bottom: 12px; }
.pl-group:last-child { margin-bottom: 0; }

.pl-group-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .4px; color: var(--sbb-grey-400);
  padding: 4px 0 6px 2px;
}
.pl-group-rename {
  background: none; border: none; cursor: pointer;
  font-size: 10px; color: var(--sbb-grey-300); font-family: var(--font);
  padding: 0; text-transform: none; letter-spacing: 0; font-weight: 400;
  transition: color .15s;
}
.pl-group-rename:hover { color: var(--sbb-red); }

.pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.pl-tile {
  border: 1px solid var(--sbb-grey-200);
  border-radius: var(--radius);
  padding: 8px 10px;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  background: white;
  display: flex; flex-direction: column; gap: 3px;
}
.pl-tile:hover {
  border-color: var(--sbb-red);
  box-shadow: 0 2px 6px rgba(235,0,0,.09);
  transform: translateY(-1px);
  text-decoration: none;
}

.pl-tile-top {
  display: flex; align-items: center; gap: 6px;
}
.pl-tile-name {
  flex: 1; font-size: 12px; font-weight: 600;
  color: var(--sbb-grey-900);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pl-tile-edit {
  background: none; border: none; cursor: pointer; flex-shrink: 0;
  color: var(--sbb-grey-300); padding: 2px; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
  line-height: 1;
}
.pl-tile-edit:hover { color: var(--sbb-grey-700); background: var(--sbb-grey-100); }

.pl-tile-desc {
  font-size: 11px; color: var(--sbb-grey-500); line-height: 1.35;
  overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
}

.pl-tile-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 1px;
}
.pl-tile-host {
  font-size: 10px; color: var(--sbb-grey-300);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pl-tile-date {
  font-size: 10px; color: var(--sbb-grey-300); white-space: nowrap; margin-left: 6px;
}

.pl-empty {
  color: var(--sbb-grey-300); font-size: 13px; padding: 8px 2px;
}

/* ── TODOS / PENDENZEN v2 ──────────────────────────────────── */
.todo-kanban-card {
  background: white;
  border: 1px solid var(--sbb-grey-200);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.todo-kanban-card:hover {
  border-color: var(--sbb-red);
  box-shadow: 0 2px 6px rgba(235,0,0,.08);
}
.badge-orange { background: var(--sbb-orange-light); color: var(--sbb-orange); }

/* ── TODOS TABLE COLUMNS ───────────────────────────────────── */
#todos-body table { width: 100%; }
#todos-body table thead th:nth-child(1) { width: 36px; }
#todos-body table thead th:nth-child(2) { width: auto; }
#todos-body table thead th:nth-child(3) { width: 140px; }
#todos-body table thead th:nth-child(4) { width: 70px; }
#todos-body table thead th:nth-child(5) { width: 100px; }
#todos-body table thead th:nth-child(6) { width: 100px; }
#todos-body table thead th:nth-child(7) { width: 180px; }
#todos-body table thead th:nth-child(8) { width: 48px; }
