/* ==========================================================================
   AtlasConnect – Kasten-Design, Mobile First
   ========================================================================== */
:root {
  /* Markenpalette – abgeleitet aus dem Atlas-Connect-Logo (#73c7d5) */
  --brand: #73c7d5;          /* Logo-Teal (Akzent) */
  --brand-deep: #0f2e36;     /* Dunkles Teal/Slate (Logo dunkle Balken) */

  --bg: #eef3f5;
  --surface: #ffffff;
  --surface-2: #f5f9fa;
  --border: #dde7ea;
  --text: #0f2e36;
  --muted: #5b7884;
  --primary: #1f8ea3;        /* Aktionsfarbe (kräftigeres Teal) */
  --primary-dark: #176d7e;
  --primary-soft: #e4f5f8;   /* Hintergrund aktiver Elemente */
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 46, 54, .06), 0 10px 30px rgba(15, 46, 54, .08);
  --shadow-sm: 0 1px 2px rgba(15, 46, 54, .08);
  --ring: 0 0 0 3px rgba(31, 142, 163, .18);
  --header-h: 62px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Auth-Layout (gebrandeter Login) ---------- */
.auth-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 32px 20px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(115, 199, 213, .28), transparent 60%),
    radial-gradient(600px 500px at 110% 110%, rgba(115, 199, 213, .18), transparent 55%),
    linear-gradient(160deg, #0b272e 0%, #103d48 55%, #0c2d35 100%);
}
/* dezente Lichtflecken */
.auth-wrap::before,
.auth-wrap::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .35;
  pointer-events: none;
}
.auth-wrap::before { width: 280px; height: 280px; background: #73c7d5; top: -80px; left: -60px; }
.auth-wrap::after { width: 320px; height: 320px; background: #1f8ea3; bottom: -120px; right: -80px; opacity: .25; }

.auth-hero {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.auth-logo { width: 230px; max-width: 70vw; height: auto; display: block; }
.auth-tagline {
  color: rgba(255, 255, 255, .75);
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 410px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(5, 28, 34, .45);
  padding: 30px 26px;
}
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }

/* Markenkopf (App-Header & Fallback) */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.01em;
}
.brand .mark { height: 30px; width: auto; display: block; }
.brand .dot {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--brand));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 16px;
}
.brand .brand-text b { color: var(--brand-deep); }
.brand .brand-text span { color: var(--primary); }
.auth-sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

/* ---------- Formularelemente ---------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 15px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}
textarea { resize: vertical; min-height: 80px; }

/* Custom Select (Formular-Dropdown) */
.custom-select { position: relative; }
.custom-select.disabled { opacity: .65; pointer-events: none; }
.cs-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; font-size: 15px; color: var(--text);
  cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.cs-trigger:hover:not(:disabled) { background: var(--surface-2); }
.custom-select:not(.disabled) .cs-trigger[aria-expanded="true"],
.cs-trigger:focus-visible {
  outline: none; border-color: var(--primary); box-shadow: var(--ring);
}
.cs-value { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-value.placeholder { color: var(--muted); }
.cs-caret { color: var(--muted); font-size: 11px; flex-shrink: 0; transition: transform .15s; }
.cs-trigger[aria-expanded="true"] .cs-caret { transform: rotate(180deg); }
.cs-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; max-height: 240px; overflow: auto;
}
.cs-menu[hidden] { display: none; }
.cs-option {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left;
  border: 0; background: transparent; padding: 9px 12px;
  border-radius: 8px; cursor: pointer; font: inherit; font-size: 14px; color: var(--text);
}
.cs-option:hover { background: var(--surface-2); }
.cs-option.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.cs-option.active::after { content: '✓'; color: var(--primary); font-weight: 800; flex-shrink: 0; }

[hidden] { display: none !important; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { width: auto; padding: 8px 12px; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--primary); border-color: transparent; width: auto; padding: 6px 8px; }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Logo-Auswahl ---------- */
.logo-pick { display: flex; align-items: center; gap: 14px; }
.logo-preview {
  width: 64px; height: 64px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); overflow: hidden; text-align: center; padding: 4px;
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-pick-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.logo-pick-actions .btn { width: auto; }

/* ---------- Meldungen ---------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  margin-bottom: 14px;
  display: none;
}
.alert.show { display: block; }
.alert.error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.alert.success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.alert.info { background: #eff6ff; color: var(--primary-dark); border: 1px solid #bfdbfe; }

.muted { color: var(--muted); }
.text-center { text-align: center; }
.mt { margin-top: 14px; }
.small { font-size: 13px; }

/* ==========================================================================
   App-Shell (eingeloggter Bereich)
   ========================================================================== */
.app-header {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
}
.app-header { border-top: 3px solid var(--brand); }
.app-header .brand { font-size: 16px; margin: 0; }
.app-header .brand:hover { text-decoration: none; }
.app-header .brand .mark { height: 26px; }
.app-header .brand .dot { width: 26px; height: 26px; font-size: 14px; }
@media (max-width: 420px) { .app-header .brand .brand-text { display: none; } }
.header-spacer { flex: 1; }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface);
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); padding: 0;
}
.icon-btn:hover { background: var(--surface-2); }

.svg-ic { display: block; flex-shrink: 0; color: currentColor; }

/* Profil-Wechsler (Custom-Dropdown mit Logo) */
.profile-switch { position: relative; }
.profile-trigger {
  display: flex; align-items: center; gap: 9px; max-width: 240px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 12px; padding: 6px 10px; cursor: pointer; font: inherit; color: var(--text);
}
.profile-trigger:hover { background: var(--surface-2); }
.profile-trigger .mark { height: 24px; width: auto; max-width: 44px; object-fit: contain; flex-shrink: 0; }
.pt-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; min-width: 0; }
.pt-company { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.pt-profile { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.pt-caret { color: var(--muted); font-size: 11px; margin-left: 2px; transition: transform .15s; }
.profile-trigger[aria-expanded="true"] .pt-caret { transform: rotate(180deg); }

.profile-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 45;
  width: 290px; max-width: 88vw; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  padding: 6px; max-height: 72vh; overflow: auto;
}
.profile-menu[hidden] { display: none; }
.pm-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.pm-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 9px 10px; border-radius: 10px;
  cursor: pointer; font: inherit; color: var(--text);
}
.pm-item:hover { background: var(--surface-2); }
.pm-item.active { background: var(--primary-soft); }
.pm-item .mark { height: 28px; width: auto; max-width: 44px; object-fit: contain; flex-shrink: 0; }
.pm-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; flex: 1; }
.pm-company { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-profile { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-check { color: var(--primary); font-weight: 800; }
.pm-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.pm-action { color: var(--primary-dark); font-weight: 600; }
.pm-action .pm-ic {
  width: 28px; height: 28px; border-radius: 8px; background: var(--primary-soft);
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}

@media (max-width: 560px) {
  .pt-text { display: none; }
  .profile-trigger { max-width: none; }
}

/* Layout: Sidebar + Content */
.layout { display: flex; min-height: calc(100dvh - var(--header-h)); }
.sidebar {
  width: 230px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  flex-shrink: 0;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 600; font-size: 14px;
  text-decoration: none; margin-bottom: 3px;
}
.nav a .ic {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--muted);
}
.nav a:hover .ic { color: var(--text); }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary-dark); }
.nav a.active .ic { color: var(--primary-dark); }
/* Unter-Navigation (z. B. Rollen & Rechte unter Benutzer) */
.nav a.sub {
  margin-left: 18px; padding-left: 14px; font-size: 13px; font-weight: 600;
  border-left: 2px solid var(--border); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.nav a.sub .ic { width: 18px; height: 18px; }
.nav a.sub.active { border-left-color: var(--primary); }
.nav .sep { height: 1px; background: var(--border); margin: 10px 6px; }
.nav .label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 12px 4px; }

.content { flex: 1; padding: 18px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page-title { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .grow { flex: 1; min-width: 200px; }

/* ---------- Karten (Kasten-Design) ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 700; margin: 0 0 12px; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr; }
.grid.cols-3 { grid-template-columns: 1fr; }
.grid.stats { grid-template-columns: repeat(2, 1fr); }

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
}
.stat .n { font-size: 28px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 13px; }

/* Listen als Karten (Mobile First) */
.list { display: grid; gap: 10px; }
.list-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  display: flex; align-items: center; gap: 12px;
}
.list-card .avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-soft), #cfeef3);
  color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.list-card .grow { flex: 1; min-width: 0; }
a.list-card { transition: border-color .15s, box-shadow .15s; }
a.list-card:hover { text-decoration: none; border-color: var(--primary); box-shadow: var(--shadow-sm); }
.list-card .name { font-weight: 700; }
.list-card .sub { color: var(--muted); font-size: 13px; word-break: break-word; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}
.badge.green { background: #f0fdf4; color: var(--success); border-color: #bbf7d0; }
.badge.red { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }
.badge.amber { background: #fffbeb; color: var(--warning); border-color: #fde68a; }
.badge.blue { background: var(--primary-soft); color: var(--primary-dark); border-color: #bfe6ec; }
.badge.teal { background: var(--primary-soft); color: var(--primary-dark); border-color: #bfe6ec; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ---------- Modal / Dialog ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: none; align-items: flex-end; justify-content: center; z-index: 50;
  padding: 0;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--surface); width: 100%; max-width: 560px;
  border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
  max-height: 92dvh; overflow-y: auto;
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head {
  position: sticky; top: 0; background: var(--surface);
  display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 18px; }
.modal-foot {
  position: sticky; bottom: 0; background: var(--surface);
  display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border);
}
.modal-foot .btn { flex: 1; }

/* Checkbox-Liste (Berechtigungen) */
.perm-group { margin-bottom: 14px; }
.perm-group h4 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.check {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer;
}
.check input { width: 18px; height: 18px; }
.check:hover { background: var(--surface-2); }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.spinner {
  width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Navigation: Toggle ist auf allen Breiten sichtbar (ein-/ausklappbar) */
.mobile-nav-toggle { display: inline-flex; }

@media (max-width: 860px) {
  /* Mobile: Sidebar als Off-Canvas-Panel */
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; z-index: 25;
    transform: translateX(-100%); transition: transform .2s ease; width: 250px;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,.3); z-index: 20; display: none; }
  .scrim.show { display: block; }
}

@media (min-width: 861px) {
  /* Desktop: Sidebar einklappbar (Breite animiert) */
  .sidebar {
    width: 230px; overflow: hidden;
    transition: width .2s ease, padding .2s ease, border-color .2s ease;
    white-space: nowrap;
  }
  .sidebar.collapsed {
    width: 0; padding-left: 0; padding-right: 0; border-right-color: transparent;
  }
  .grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid.stats { grid-template-columns: repeat(4, 1fr); }
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 18px; }
}

.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.form-section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 8px; }
.form-section-title:first-child { margin-top: 0; }

/* ==========================================================================
   Detail-Ansicht mit Tabs (z. B. Mitarbeiter)
   ========================================================================== */
.detail-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.detail-head .avatar-lg {
  width: 64px; height: 64px; border-radius: 18px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary-soft), #cfeef3);
  color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px;
}
.detail-head .grow { flex: 1; min-width: 200px; }
.detail-head .dh-name { font-size: 22px; font-weight: 800; margin: 0; }
.detail-head .dh-sub { color: var(--muted); margin: 2px 0 0; font-size: 14px; }
.detail-head .chips { margin-top: 8px; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  color: var(--muted); margin-bottom: 12px;
}
.back-link:hover { color: var(--primary); text-decoration: none; }

/* Tab-Leiste */
.tabs {
  display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border);
  margin-bottom: 18px; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  border: 0; background: transparent; cursor: pointer; font: inherit;
  padding: 11px 14px; font-size: 14px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Übersicht-Kacheln */
.kv-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .kv-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .kv-grid { grid-template-columns: repeat(3, 1fr); } }
.kv { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.kv .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv .v { font-size: 15px; font-weight: 600; margin-top: 2px; word-break: break-word; }

/* Sticky Aktionsleiste der Detailansicht */
.detail-actions {
  position: sticky; bottom: 0; background: var(--surface);
  border-top: 1px solid var(--border); margin: 18px -18px -18px; padding: 14px 18px;
  display: flex; gap: 10px; flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius);
}
.detail-actions .grow { flex: 1; }

/* ---------- Zeitsperren (Time Locks) ---------- */
.tl-status-card { padding: 0; overflow: hidden; }
.tl-status-inner {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
}
.tl-status-inner.ok { background: #ecfdf5; border-left: 4px solid var(--success); }
.tl-status-inner.blocked { background: var(--danger-bg); border-left: 4px solid var(--danger); }
.tl-status-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.tl-status-inner.ok .tl-status-dot { background: var(--success); }
.tl-status-inner.blocked .tl-status-dot { background: var(--danger); }

.tl-master {
  display: grid; gap: 16px; margin: 16px 0;
}
@media (min-width: 700px) {
  .tl-master { grid-template-columns: 1fr 280px; align-items: start; }
}
.tl-toggle { align-items: flex-start; gap: 12px; max-width: none; }
.tl-tz-field { margin: 0; }

.tl-presets {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}

.tl-week { display: grid; gap: 10px; }
@media (min-width: 700px) { .tl-week { grid-template-columns: 1fr 1fr; } }

.tl-day {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  background: var(--surface-2);
}
.tl-day.is-custom { background: var(--surface); }
.tl-day-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.tl-day-name { font-weight: 700; min-width: 90px; }
.tl-mode { min-width: 160px; }

.tl-day-windows { margin-top: 10px; display: grid; gap: 8px; }
.tl-window { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-time { width: 120px; padding: 8px 10px; }
.tl-window-sep { color: var(--muted); font-weight: 600; }

.tl-exc-list { margin-top: 12px; }
.tl-exc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.tl-exc-actions { display: flex; gap: 6px; flex-shrink: 0; }

.btn.small { padding: 6px 10px; font-size: 13px; }
.mt { margin-top: 14px; }

/* ---------- Mitarbeiter-Historie (Gehalt & Feedback) ---------- */
.hist-panel { padding-bottom: 8px; }
.hist-summary {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.hist-summary-item {
  background: var(--primary-soft); border: 1px solid rgba(31, 142, 163, .2);
  border-radius: 12px; padding: 12px 16px; min-width: 180px;
}
.hist-summary-item .k { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.hist-summary-item .v { display: block; font-size: 20px; font-weight: 800; color: var(--primary-dark); margin-top: 2px; }

.hist-form.card-inner {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; margin-bottom: 18px;
}
.hist-form .card-title { margin-bottom: 12px; font-size: 15px; }
.hist-form-actions { margin-top: 12px; display: flex; justify-content: flex-end; }

.hist-empty {
  text-align: center; color: var(--muted); padding: 32px 16px;
  background: var(--surface-2); border-radius: 12px; border: 1px dashed var(--border);
}

.hist-timeline { position: relative; padding-left: 28px; }
.hist-timeline::before {
  content: ''; position: absolute; left: 9px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.hist-item { position: relative; margin-bottom: 16px; }
.hist-item:last-child { margin-bottom: 0; }
.hist-dot {
  position: absolute; left: -24px; top: 14px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.hist-dot--create { border-color: var(--success); box-shadow: 0 0 0 3px #ecfdf5; }
.hist-dot--comment { border-color: var(--primary); }
.hist-dot--status { border-color: var(--warning); box-shadow: 0 0 0 3px #fffbeb; }
.hist-dot--update { border-color: var(--muted); box-shadow: 0 0 0 3px var(--surface-2); }
.hist-dot--in { border-color: var(--success); box-shadow: 0 0 0 3px #ecfdf5; }
.hist-dot--out { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.hist-dot--adjust { border-color: var(--warning); box-shadow: 0 0 0 3px #fffbeb; }
.hist-dot--key { border-color: var(--primary-dark); }
.hist-dot--assign { border-color: var(--primary); }
.hist-dot--default { border-color: var(--primary); }
.hist-item.current .hist-dot { background: var(--primary); }
.hist-body {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}
.hist-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.hist-top .grow { flex: 1; }
.hist-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--muted); }
.hist-reason, .hist-text { margin: 8px 0 0; font-size: 14px; line-height: 1.45; }
.hist-foot { margin-top: 8px; font-size: 12px; color: var(--muted); }
.hist-change { font-size: 13px; font-weight: 700; }
.hist-change.up { color: var(--success); }
.hist-change.down { color: var(--danger); }

.hist-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.hist-cat-btn {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; color: var(--text); transition: background .12s, border-color .12s;
}
.hist-cat-btn:hover { background: var(--surface-2); }
.hist-cat-btn.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }

.hist-rating-pick { margin-bottom: 12px; }
.hist-rating-mode { display: flex; gap: 6px; margin-bottom: 10px; }
.hist-mode-btn {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; padding: 7px 12px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.hist-mode-btn.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }

.hist-thumbs-pick, .hist-stars-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.hist-star { display: inline-flex; color: var(--border); }
.hist-star.on { color: var(--primary); }
.hist-star .svg-ic { width: 14px; height: 14px; }
.hist-thumb-btn {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; padding: 8px 16px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; color: var(--text);
}
.hist-thumb-btn:hover { background: var(--surface-2); }
.hist-thumb-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }

.hist-star-btn {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; padding: 8px 10px; cursor: pointer;
}
.hist-star-btn:hover { background: var(--surface-2); }
.hist-star-btn.active { border-color: var(--primary); background: var(--primary-soft); }

.hist-rating.stars .hist-star { font-size: 15px; }
.hist-rating.thumbs { font-size: 13px; font-weight: 700; }
.hist-rating.thumbs.up { color: var(--success); }
.hist-rating.thumbs.down { color: var(--danger); }

.hist-item.note-praise .hist-dot { border-color: var(--success); box-shadow: 0 0 0 3px #ecfdf5; }
.hist-item.note-late .hist-dot, .hist-item.note-warning .hist-dot, .hist-item.note-improvement .hist-dot { border-color: var(--warning); box-shadow: 0 0 0 3px #fffbeb; }
.hist-item.note-task_lost .hist-dot { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }

.hist-del { margin-left: auto; padding: 2px 6px !important; font-size: 12px; color: var(--muted); }
.hist-del:hover { color: var(--danger); }

.hidden { display: none !important; }

/* ---------- Zeitsperren-Kalender ---------- */
.tl-cal { margin: 16px 0; }
.tl-cal-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
}
.tl-cal-title { flex: 1; text-align: center; font-size: 17px; text-transform: capitalize; min-width: 160px; }
.tl-cal-legend {
  display: flex; flex-wrap: wrap; gap: 12px 16px; font-size: 12px; color: var(--muted); margin-bottom: 10px;
}
.tl-cal-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
.tl-cal-dot.closed { background: var(--danger); }
.tl-cal-dot.open { background: var(--success); }
.tl-cal-dot.custom { background: var(--warning); }

.tl-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.tl-cal-wd {
  text-align: center; font-size: 11px; font-weight: 700; color: var(--muted);
  padding: 6px 0; text-transform: uppercase; letter-spacing: .04em;
}
.tl-cal-day {
  position: relative; aspect-ratio: 1; min-height: 44px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  cursor: pointer; font: inherit; color: var(--text); padding: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: border-color .12s, background .12s, transform .08s;
}
.tl-cal-day:hover:not(.muted) { border-color: var(--primary); background: var(--surface-2); }
.tl-cal-day.muted { opacity: .35; cursor: default; background: var(--surface-2); }
.tl-cal-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.tl-cal-day.has-exc.closed { background: var(--danger-bg); border-color: #fecaca; }
.tl-cal-day.has-exc.open { background: #ecfdf5; border-color: #bbf7d0; }
.tl-cal-day.has-exc.custom { background: #fffbeb; border-color: #fde68a; }
.tl-cal-num { font-size: 14px; font-weight: 700; line-height: 1; }
.tl-cal-mark {
  position: absolute; bottom: 4px; right: 4px;
  font-size: 9px; font-weight: 800; color: var(--muted);
}
.tl-cal-hint { margin-top: 10px; }

/* ---------- Aufträge: Ansichten (Liste / Kanban / Kalender) ---------- */
.view-tabs {
  display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap;
}
.view-tabs .tab {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; color: var(--muted); border-bottom: 1px solid var(--border);
}
.view-tabs .tab:hover { background: var(--surface-2); color: var(--text); }
.view-tabs .tab.active {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark);
}

.kanban-board {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}
.kanban-col {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px; min-height: 120px;
}
.kanban-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 700; margin-bottom: 10px; padding: 0 4px;
}
.kanban-items { display: grid; gap: 8px; }
.ord-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; cursor: pointer; text-align: left; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
.ord-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.ord-card.overdue { border-color: #fecaca; background: var(--danger-bg); }
.ord-card .chips { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }

.ord-cal { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.ord-cal-day { padding: 12px; }
.ord-cal-day .card-title { font-size: 13px; margin-bottom: 8px; }
.ord-cal-items { display: grid; gap: 8px; }

.ord-modal-tabs { margin-bottom: 14px; }

/* ---------- Einsatzplanung Wochenansicht ---------- */
.plan-week-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}
.plan-week-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(152px, 1fr));
  gap: 10px;
  min-width: min(100%, 1060px);
}
@media (max-width: 900px) {
  .plan-week-board { min-width: 980px; }
}

.plan-week-col {
  display: flex;
  flex-direction: column;
  min-height: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.plan-week-col.is-today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(31, 142, 163, .25);
}
.plan-week-col.is-weekend { background: var(--surface-2); }

.plan-week-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.plan-week-col.is-today .plan-week-head { background: var(--primary-soft); }
.plan-week-date { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.plan-week-wd {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--muted); letter-spacing: .05em;
}
.plan-week-num { font-size: 22px; font-weight: 800; color: var(--text); }
.plan-week-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.plan-week-add {
  border: 0; background: transparent; color: var(--primary-dark);
  cursor: pointer; font-size: 20px; font-weight: 700; line-height: 1;
  width: 28px; height: 28px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.plan-week-add:hover { background: rgba(31, 142, 163, .15); }

.plan-week-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}
.plan-week-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 20px 10px;
  min-height: 96px;
}

.plan-dep-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 10px 10px 10px 11px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color .12s, box-shadow .12s, transform .08s;
}
.plan-week-col.is-weekend .plan-dep-card { background: var(--surface); }
.plan-dep-card:hover:not(:disabled) {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.plan-dep-card:disabled { cursor: default; }
.plan-dep-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}
.plan-dep-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}
.plan-dep-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plan-dep-person { font-weight: 600; color: var(--text); }
.plan-dep-badge { align-self: flex-start; font-size: 10px; padding: 2px 7px; }

.plan-dep-planned { border-left-color: #60a5fa; }
.plan-dep-confirmed { border-left-color: var(--primary); }
.plan-dep-in_progress { border-left-color: #f59e0b; }
.plan-dep-completed { border-left-color: var(--success); }
.plan-dep-cancelled { border-left-color: #94a3b8; opacity: .75; }

.plan-month-list { gap: 12px; }
.plan-month-list-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: start;
}
@media (max-width: 560px) {
  .plan-month-list-row { grid-template-columns: 1fr; }
}
.plan-month-list-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding-top: 10px;
}

/* ---------- Einsatzplanung Monatsansicht ---------- */
.plan-view-tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
}
.plan-view-tabs .tab {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; color: var(--muted);
}
.plan-view-tabs .tab.active {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark);
}

.plan-month-cal { margin-top: 4px; }
.plan-month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.plan-month-wd {
  text-align: center; font-size: 11px; font-weight: 700; color: var(--muted);
  padding: 6px 0; text-transform: uppercase;
}
.plan-month-day {
  min-height: 88px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); padding: 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  transition: border-color .12s, background .12s;
}
.plan-month-day:hover:not(.muted) { border-color: var(--primary); background: var(--surface-2); }
.plan-month-day.muted { opacity: .35; cursor: default; background: var(--surface-2); }
.plan-month-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.plan-month-num { font-size: 13px; font-weight: 700; line-height: 1; }
.plan-month-count {
  font-size: 10px; font-weight: 700; color: var(--primary-dark);
  background: var(--primary-soft); border-radius: 999px; padding: 2px 6px; align-self: flex-start;
}
.plan-month-pills { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.plan-month-pill {
  font-size: 10px; line-height: 1.2; padding: 3px 5px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.grid.stats.warn .stat { border-color: #fde68a; }
.stat.danger { background: var(--danger-bg); border-color: #fecaca; }
.stat.danger .n { color: var(--danger); }

.dash-overdue-list { display: grid; gap: 8px; margin-top: 8px; }
.dash-overdue-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); color: inherit; text-decoration: none;
}
.dash-overdue-item:hover { border-color: var(--primary); }
.dash-overdue-item .grow { flex: 1; min-width: 140px; }
.dash-overdue-item .name { font-weight: 700; font-size: 14px; }
.dash-overdue-item .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Kanban Drag & Drop */
.ord-card.dragging { opacity: .45; transform: rotate(1deg); }
.kanban-col.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--primary);
}
.kanban-empty { padding: 8px 4px; text-align: center; }

/* Modul-Platzhalter (WIP) */
.module-wip {
  max-width: 520px; margin: 24px auto; text-align: center; padding: 40px 28px;
}
.module-wip-icon {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted);
}

.quick-link {
  display: inline-flex; align-items: center; gap: 8px;
}
.quick-link .svg-ic { opacity: .75; }

.btn-ic {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 8px !important; min-width: 32px;
}
.btn-ic .svg-ic { width: 14px; height: 14px; }

.pt-caret, .cs-caret { display: inline-flex; align-items: center; color: var(--muted); }
.pm-ic { display: inline-flex; align-items: center; justify-content: center; color: var(--primary); }
.nav-wip .badge { font-size: 10px; vertical-align: middle; margin-left: 4px; }

/* Fahrzeuge */
.veh-card .chips { margin-top: 6px; }
.veh-key-chips { margin-top: 4px; }
.veh-keys-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.veh-key-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  background: var(--surface-2); text-align: center;
}
.veh-key-num { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.veh-key-holder { font-size: 15px; font-weight: 700; margin: 8px 0 10px; min-height: 1.2em; }
.alert.show.warn {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  padding: 10px 12px; border-radius: 10px;
}
