/* ==========================================================================
   1. BASIS & VARIABLEN
   ========================================================================== */
:root {
  /* aePlus CI aus Tailwind config */
  --ae-black: #0a1f1c;
  --ae-white: #ffffff;
  --ae-primary: #10b981;
  --ae-mint: #ecfdf5;
  --ae-gray: #F3F4F6;

  /* UI tokens */
  --bg: var(--ae-white);
  --text: var(--ae-black);
  --muted: #6b7280;
  --line: #e5e7eb;

  --radius: 12px;
  --shadow: 0 10px 26px rgba(10,31,28,.08);
  --font: Inter, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   2. LAYOUT & SIDEBAR
   ========================================================================== */
.shell { display: flex; min-height: 100%; }

.sidebar {
  width: 280px;
  border-right: 1px solid var(--line);
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: var(--ae-white);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.brand {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.05em;
  color: var(--ae-black);
  line-height: 1;
  text-decoration: none;
  display: inline-block;
}
.brand .plus { 
  color: var(--ae-primary); 
  font-weight: 600; 
}

.brand-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9ca3af;
  margin-top: 6px;
  font-weight: 500;
}

.nav-container {
  flex: 1;
  padding: 24px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Context Area */
.context-area {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.context-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #9ca3af;
  margin-bottom: 10px; /* Mehr Abstand zum Inhalt */
  font-weight: 700;
  padding-left: 12px;
}

.sidebar__footer {
  margin-top: auto;
  padding: 16px 16px; /* Padding angepasst damit Logout bündig wirkt */
  border-top: 1px solid var(--line);
  background: #f9fafb; /* wie restliche Sidebar */
}

/* Logout Link Style (wie Headers, aber interaktiv) */
.logout-link {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #9ca3af;
  font-weight: 700;
  text-decoration: none;
  padding-left: 12px; /* Bündig mit Headers */
  transition: color 0.2s;
}
.logout-link:hover {
  color: var(--ae-primary); /* Mouse over Effekt */
}


/* ==========================================================================
   3. NAVIGATION & DROPDOWNS
   ========================================================================== */

/* Gruppen Titel (Insights / System) */
.nav-group-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #9ca3af;
  margin: 24px 0 8px 0;
  font-weight: 700;
  padding-left: 12px;
}

/* Nav Items */
.nav__item {
  display: flex;
  align-items: center;
  padding: 8px 12px 8px 20px; /* Links 20px -> Einrückung gegenüber Titel (12px) */
  border-radius: 6px;
  color: #4b5563;
  text-decoration: none;
  border: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s;
}
.nav__item:hover {
  background: transparent;
  color: var(--text);
}

.nav__item--active {
  color: var(--ae-primary);
  font-weight: 600;
}

.nav__item--disabled { 
  opacity: .5; 
  cursor: not-allowed; 
  color: var(--muted) !important; 
}

/* Dropdown */
.select-styled {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background-color: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.select-styled:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.select-styled:focus {
  outline: none;
  border-color: var(--ae-primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}

/* Details/Summary für Aufklapp-Menüs */
.nav-details {
  display: block;
  margin-bottom: 2px;
}

.nav-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 8px 20px; /* Auch hier Einrückung */
  border-radius: 6px;
  color: #4b5563;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s;
}
.nav-summary:hover {
  color: var(--text);
}

.nav-summary::-webkit-details-marker { display: none; }

.nav-summary::after {
  content: '';
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.2s;
}
.nav-details[open] .nav-summary::after {
  transform: rotate(180deg);
}
.nav-details[open] .nav-summary {
  color: var(--ae-black);
  font-weight: 600;
}

/* Sub-Navigation */
.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  padding: 4px 0 8px 14px;
  border-left: 2px solid var(--line);
  margin-left: 12px;
}

/* Submenu links inside .nav-sub */
.nav-sub .nav__item {
  font-size: 13px;
  padding: 6px 12px;
  color: #9ca3af;
  border-radius: 4px;
}
.nav-sub .nav__item:hover {
  color: var(--text);
  background: transparent;
}
.nav-sub .nav__item.nav__item--active {
  color: var(--ae-primary);
}



/* ==========================================================================
   4. MAIN CONTENT & STANDARD COMPONENTS
   ========================================================================== */
.main { flex: 1; display: flex; flex-direction: column; }
.header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.header h1 { margin: 0; font-size: 18px; letter-spacing: -0.2px; }

.content { padding: 22px; background: var(--ae-gray); flex: 1; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.kpi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.kpi .box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.muted { color: var(--muted); font-size: 13px; }

/* Input Fields */
.input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  outline: none;
}
.input:focus {
  border-color: rgba(16,185,129,.55);
  box-shadow: 0 0 0 3px rgba(16,185,129,.16);
}

/* Buttons */
.btn {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(16,185,129,.35);
  background: rgba(16,185,129,.10);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}
.btn:hover { background: rgba(16,185,129,.16); }
.btn--primary {
  background: var(--ae-black);
  color: #fff;
  border-color: var(--ae-black);
}
.btn--primary:hover { background: #064e3b; }
.btn--danger {
  border-color: rgba(185,28,28,.35);
  background: rgba(185,28,28,.08);
}

/* Messages */
.msg { margin-top: 10px; font-size: 13px; }
.msg--err { color: #b91c1c; }
.msg--ok { color: #064e3b; }

/* Legacy Select */
.select {
  width: 100%;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

/* ==========================================================================
   5. LOGIN PAGE
   ========================================================================== */
.login-shell {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: #fff;
}
.login-card { width: 420px; }
.login-title { margin: 0 0 10px 0; letter-spacing: -0.3px; }
.login-sub { margin: 0 0 18px 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }


/* ==========================================================================
   6. TRACKING VISUALIZATION & TABS
   ========================================================================== */
.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  gap: 20px;
}
.tab-link {
  padding: 12px 4px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab-link:hover {
  color: var(--text);
}
.tab-link.active {
  color: var(--ae-primary);
  border-bottom-color: var(--ae-primary);
}

.viz-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.viz-row:last-child { border-bottom: none; }
.viz-label {
  width: 250px;
  flex-shrink: 0;
  padding-right: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viz-bar-area {
  flex: 1;
  display: flex;
  align-items: center;
  margin-right: 15px;
}
.viz-bar-bg {
  width: 100%;
  background: var(--ae-gray);
  border-radius: 4px;
  height: 20px;
  overflow: hidden;
  position: relative;
}
.viz-bar-fill {
  background: var(--ae-primary);
  height: 100%;
  border-radius: 4px;
  min-width: 2px;
}
.viz-bar-fill.secondary { background: #60a5fa; } 
.viz-val {
  width: 60px;
  text-align: right;
  font-weight: 600;
  color: var(--text);
}

.timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  margin-top: 20px;
}
.timeline::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 14px;
  width: 2px;
  background: var(--line);
  z-index: 0;
}
.tl-item {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}
.tl-marker {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ae-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: var(--ae-primary);
  flex-shrink: 0;
}
.tl-content {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  flex: 1;
}
.tl-time {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.tl-dwell {
  display: inline-block;
  background: var(--ae-mint);
  color: var(--ae-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}