:root {
  --bg-sidebar: #1A1D24;
  --bg-main: #F4F5F7;
  --bg-card: #FFFFFF;
  --purple: #5530F9;
  --purple-dark: #4322D6;
  --orange: #FF6B2B;
  --orange-dark: #E4551A;
  --text-dark: #1A1D24;
  --text-muted: #6B7280;
  --border: #E4E6EB;
  --sidebar-text: #C7CAD4;
  --sidebar-text-dim: #6E7280;
  --green: #1FA37D;
  --red: #E0413B;
  --amber: #D9930B;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-main);
  color: var(--text-dark);
}

h1, h2, h3, .brand, .agent-name { font-family: 'Space Grotesk', 'Inter', sans-serif; }
.mono, .kpi-value, .stat-num { font-family: 'IBM Plex Mono', monospace; }

button { font-family: inherit; cursor: pointer; }

/* ---------- Login Screen ---------- */
#login-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, #241A5C 0%, #1A1D24 55%, #100E17 100%);
  z-index: 100;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

/* Bewusst KEIN display:flex + align-items:center hier - Flexbox-Zentrierung
   schneidet ueberlaufenden Inhalt in einigen mobilen Browsern oben ab, wenn
   der Container selbst scrollt. Normale Block-Zentrierung per margin:auto
   ist zuverlaessig scrollbar und schneidet nichts ab. */
.login-card {
  background: rgba(26, 29, 36, 0.7);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 48px 44px;
  width: 420px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  margin: 6vh auto;
}

@media (max-height: 640px) {
  .login-card { margin: 16px auto; }
}

.login-logo {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.login-logo span { color: var(--orange); }

.login-sub {
  color: var(--sidebar-text);
  font-size: 14px;
  margin-bottom: 28px;
}

.demo-banner {
  background: rgba(255, 107, 43, 0.12);
  border: 1px solid rgba(255, 107, 43, 0.35);
  color: #FFB48A;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 28px;
  text-align: left;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple), #7A52FF);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  width: 100%;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 24px rgba(85, 48, 249, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(85, 48, 249, 0.45); }

.login-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.login-fields input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 12px 14px;
  color: #fff;
  font-size: 14px;
}
.login-fields input::placeholder { color: #6E7280; }
.login-fields input:disabled { opacity: 0.5; }

/* ---------- App Shell ---------- */
#app {
  display: none;
  height: 100vh;
  overflow: hidden;
}
#app.active { display: flex; }

.sidebar {
  width: 250px;
  min-width: 250px;
  background: var(--bg-sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.sidebar-brand {
  padding: 0 20px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}
.sidebar-brand .logo-dot {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--purple), var(--orange));
  border-radius: 8px;
  flex-shrink: 0;
}
.sidebar-brand .logo-text { color: #fff; font-weight: 700; font-size: 17px; }
.sidebar-brand .logo-text span { color: var(--orange); }

.bereich-select {
  margin: 0 16px 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.bereich-select .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }

.nav-section-label {
  padding: 4px 20px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-text-dim);
  margin-top: 14px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--sidebar-text);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s ease;
  position: relative;
}
.nav-item:hover:not(.disabled) { background: rgba(255,255,255,0.05); }
.nav-item.active { background: rgba(85,48,249,0.18); border-left-color: var(--purple); color: #fff; }
.nav-item .icon { width: 18px; text-align: center; opacity: 0.85; }

.nav-item.disabled {
  color: #4B4E58;
  cursor: not-allowed;
}
.nav-item.disabled .icon { opacity: 0.4; }
.nav-item.disabled .lock { margin-left: auto; font-size: 11px; }

.nav-item .tooltip {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  background: #0F1116;
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.nav-item.disabled:hover .tooltip { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: var(--sidebar-text-dim);
}

/* ---------- Main content ---------- */
.main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  min-height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar .badge-demo {
  background: rgba(255,107,43,0.12);
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.view { display: none; padding: 24px 28px; flex: 1; }
.view.active { display: block; }

/* dashboard grid on chat view */
.dash-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.card h2 { font-size: 15px; margin: 0 0 14px; }
.card h2 .sub { color: var(--text-muted); font-weight: 400; font-size: 12px; margin-left: 6px; }

/* ---------- Chat ---------- */
.chat-card { display: flex; flex-direction: column; height: 640px; }

.agent-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.agent-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  font-size: 13px;
  white-space: nowrap;
  background: #fff;
  transition: all 0.15s ease;
}
.agent-chip:hover { border-color: var(--purple); }
.agent-chip.selected { background: rgba(85,48,249,0.08); border-color: var(--purple); color: var(--purple-dark); font-weight: 600; }
.agent-chip .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 4px 12px;
}

.msg { display: flex; gap: 10px; max-width: 85%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700;
}
.msg.user .avatar { background: var(--text-dark); }
.msg-body { display: flex; flex-direction: column; gap: 3px; }
.msg-name { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.msg.user .msg-name { text-align: right; }
.msg-bubble {
  background: #F1F2F5;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
}
.msg.user .msg-bubble { background: var(--purple); color: #fff; }
.msg.agent .msg-bubble { background: #F1F2F5; }
.msg.system .msg-bubble { background: rgba(217,147,11,0.12); color: #8A6205; font-size: 13px; }

.typing-dots span {
  display: inline-block;
  width: 6px; height: 6px;
  background: #9AA0AC;
  border-radius: 50%;
  margin-right: 3px;
  animation: blink 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.suggested-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.q-chip {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  color: var(--text-dark);
  transition: all 0.15s ease;
}
.q-chip:hover { border-color: var(--orange); color: var(--orange-dark); background: rgba(255,107,43,0.06); }

.chat-input-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.chat-input-row input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
}
.chat-input-row button {
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 18px;
  font-weight: 600;
  font-size: 14px;
}
.chat-input-row button:hover { background: var(--purple-dark); }

/* ---------- Forecast widget ---------- */
.forecast-note {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.5;
  background: #F8F7FF;
  border: 1px solid #E9E4FF;
  border-radius: 8px;
  padding: 10px 12px;
}

/* ---------- Filialen ---------- */
#map { height: 560px; border-radius: 14px; overflow: hidden; position: relative; z-index: 1; }
#map .leaflet-pane, #map .leaflet-tile-pane, #map .leaflet-control-container { border-radius: 14px; }
#map .leaflet-container { border-radius: 14px; }
.status-ok { color: var(--green); font-weight: 600; }
.status-defekt { color: var(--red); font-weight: 600; }
.status-wartung { color: var(--amber); font-weight: 600; }

/* Marker */
.ci4u-marker { background: transparent; border: none; }
.ci4u-marker-dot {
  display: block;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.ci4u-marker-dot:hover { transform: scale(1.15); }

/* Tooltip (Hover-Vorschau, Klick oeffnet das grosse Modal) */
.leaflet-tooltip.leaflet-tooltip-top {
  background: #1A1D24;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.3);
  font-family: 'Inter', sans-serif;
  opacity: 1 !important;
}
.leaflet-tooltip.leaflet-tooltip-top::before { border-top-color: #1A1D24; }
.map-tip-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.map-tip-row { font-size: 11.5px; color: #C7CAD4; margin: 1px 0; }
.map-tip-hint { font-size: 10.5px; color: var(--orange); font-weight: 600; margin-top: 5px; }

.filialen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.filiale-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.filiale-card:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(85,48,249,0.12);
}
.filiale-card .fname { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.filiale-card .frow { font-size: 12px; color: var(--text-muted); margin: 2px 0; }
.filiale-card .fmore { font-size: 11px; color: var(--purple); font-weight: 600; margin-top: 8px; }

/* ---------- Filiale-Detail-Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 22, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-card {
  background: #fff;
  border-radius: 16px;
  width: 480px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 26px 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}
.modal-header h3 { font-size: 18px; margin: 0; }
.modal-header .msub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.modal-close {
  background: #F1F2F5;
  border: none;
  border-radius: 8px;
  width: 28px; height: 28px;
  font-size: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.modal-close:hover { background: #E4E6EB; }

.modal-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0 6px;
}
.modal-kpi {
  background: #F8F7FF;
  border: 1px solid #E9E4FF;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}
.modal-kpi .mlabel { font-size: 10.5px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.modal-kpi .mvalue { font-size: 16px; font-weight: 700; color: var(--purple-dark); }

.modal-rows { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.modal-row { display: flex; justify-content: space-between; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.modal-row .mk { color: var(--text-muted); }
.modal-row .mv { font-weight: 600; }

.modal-chart-wrap { margin-top: 18px; }
.modal-chart-wrap .clabel { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

/* ---------- Berichte ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi-tile {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.kpi-tile .label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 700; }
.kpi-value.up { color: var(--green); }
.kpi-value.down { color: var(--red); }
.kpi-trend { font-size: 11.5px; margin-top: 4px; font-weight: 600; }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }
.kpi-tile .spark-canvas { position: absolute; right: 10px; bottom: 10px; width: 72px; height: 30px; opacity: 0.85; }

.wow-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  align-items: stretch;
}
@media (max-width: 1100px) { .wow-grid { grid-template-columns: 1fr; } }

.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut-canvas-box { width: 130px; height: 130px; flex-shrink: 0; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.donut-legend .litem { display: flex; align-items: center; gap: 8px; }
.donut-legend .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .lval { font-weight: 700; margin-left: auto; padding-left: 14px; }

/* ---------- CTA Footer ---------- */
.cta-footer {
  background: linear-gradient(120deg, #1A1D24, #241A5C);
  color: #fff;
  border-radius: 14px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.cta-footer .txt { font-size: 14px; max-width: 520px; line-height: 1.5; color: #D8D9E3; }
.cta-footer .txt b { color: #fff; }
.cta-footer a.btn-cta {
  background: var(--orange);
  color: #fff;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.cta-footer a.btn-cta:hover { background: var(--orange-dark); }

/* ---------- Bestellvorschlag ---------- */
.bestellung-head-card { padding: 18px 20px; }
.bestellung-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.bestellung-sub { font-size: 13px; color: var(--text-muted); }

.filiale-select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dark);
  min-width: 220px;
}
.filiale-select:focus { outline: none; border-color: var(--purple); }

.bestellung-table-wrap { overflow-x: auto; }
.bestellung-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bestellung-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.bestellung-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.bestellung-table tr:last-child td { border-bottom: none; }
.bestellung-table .bt-produkt { font-weight: 700; }
.bestellung-table .bt-empf { font-weight: 700; color: var(--purple-dark); }
.bestellung-table .bt-grund { color: var(--text-muted); max-width: 320px; }
.bestellung-table tr.event-row { background: rgba(255,107,43,0.045); }
.event-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,107,43,0.14);
  color: var(--orange-dark);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
  white-space: nowrap;
}

.diff-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.diff-badge.pos { background: rgba(31,163,125,0.12); color: var(--green); }
.diff-badge.neg { background: rgba(224,65,59,0.12); color: var(--red); }
.diff-badge.neutral { background: #F1F2F5; color: var(--text-muted); }

.bestellung-disclaimer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  background: #F8F7FF;
  border: 1px solid #E9E4FF;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.5;
}

/* ---------- Schreibtisch ---------- */
.desk-hero {
  background: linear-gradient(120deg, #1A1D24, #241A5C);
  color: #fff;
  border-radius: 14px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.desk-hero-greeting { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; }
.desk-hero-sub { font-size: 13px; color: #C7CAD4; margin-top: 4px; }
.desk-hero-badge {
  background: rgba(255,107,43,0.18);
  color: #FFB48A;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.desk-kachel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.desk-kachel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 16px;
  aspect-ratio: 1 / 0.82;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.desk-kachel:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(85,48,249,0.12);
}
.desk-kachel.locked { cursor: default; }
.desk-kachel.locked:hover { border-color: var(--border); transform: none; box-shadow: none; }

.desk-kachel .dk-top { display: flex; align-items: flex-start; justify-content: space-between; }
.desk-kachel .dk-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: rgba(85,48,249,0.09);
}
.desk-kachel .dk-badge {
  background: var(--orange);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.desk-kachel .dk-badge.zero { background: #E4E6EB; color: #8A8E99; }
.desk-kachel .dk-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 14px; margin-top: 10px; }
.desk-kachel .dk-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.desk-kachel .dk-lock { font-size: 10.5px; font-weight: 600; color: var(--text-muted); background: #F1F2F5; display: inline-block; padding: 3px 8px; border-radius: 999px; margin-top: 10px; align-self: flex-start; }

.activity-list, .news-list, .termine-list, .notizen-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item { display: flex; gap: 10px; }
.activity-item .avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700;
}
.activity-item .a-body { font-size: 13px; line-height: 1.45; }
.activity-item .a-body b { font-weight: 700; }
.activity-item .a-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.news-item { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; padding-bottom: 0; }
.news-item .n-title { font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.news-item .n-kurz { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }

.termine-item { display: flex; align-items: baseline; gap: 10px; font-size: 13px; }
.termine-item .t-zeit {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  color: var(--purple-dark);
  background: #F8F7FF;
  border-radius: 6px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.notizen-item {
  background: #FFFBEA;
  border: 1px solid #F3E7B8;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: #7A6220;
  line-height: 1.45;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.module-tile {
  border-radius: 12px;
  padding: 16px 14px;
  text-align: center;
  border: 1px solid var(--border);
}
.module-tile.aktiv {
  background: linear-gradient(135deg, rgba(85,48,249,0.08), rgba(255,107,43,0.06));
  border-color: var(--purple);
}
.module-tile.bald { background: #FAFAFB; color: var(--text-muted); }
.module-tile .m-icon { font-size: 22px; display: block; margin-bottom: 8px; }
.module-tile .m-name { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.module-tile.bald .m-name { color: #9CA0AC; }
.module-tile .m-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 999px;
}
.module-tile.aktiv .m-status { background: var(--purple); color: #fff; }
.module-tile.bald .m-status { background: #E4E6EB; color: #8A8E99; }

@media (max-width: 800px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Handy / Tablet hochkant ---------- */
@media (max-width: 720px) {
  .login-card { padding: 32px 22px; }
  .login-logo { font-size: 24px; }
  .demo-banner { font-size: 12.5px; padding: 12px 14px; }

  html, body { height: auto; min-height: 100%; overflow-x: hidden; }

  #app {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    padding: 6px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .sidebar-brand, .bereich-select, .sidebar-footer, .nav-section-label { display: none; }
  .nav-item {
    flex-direction: column;
    gap: 3px;
    padding: 8px 12px;
    font-size: 10.5px;
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    text-align: center;
  }
  .nav-item.active { border-bottom-color: var(--purple); }
  .nav-item .icon { width: auto; font-size: 16px; }
  .nav-item.disabled .lock { margin-left: 0; }
  .nav-item .tooltip { display: none; }

  .main { overflow-y: visible; flex: none; }
  .topbar { padding: 0 14px; height: 50px; min-height: 50px; }
  .topbar h1 { font-size: 15px; }
  .view { padding: 14px; }

  .chat-card { height: auto; }
  .chat-messages { max-height: 50vh; -webkit-overflow-scrolling: touch; }

  #map { height: 340px; }

  .filialen-grid, .module-grid { grid-template-columns: 1fr 1fr; }

  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-value { font-size: 20px; }

  .bestellung-head-row { flex-direction: column; align-items: stretch; }
  .filiale-select { width: 100%; }
  .bestellung-table { font-size: 12px; }
  .bt-grund { max-width: 200px; }

  .modal-card { padding: 20px 18px; width: 100%; }
  .modal-kpi-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }

  .cta-footer { padding: 18px; }
  .cta-footer .txt { font-size: 13px; }

  .desk-hero { padding: 16px 18px; }
  .desk-hero-greeting { font-size: 18px; }
}

@media (max-width: 420px) {
  .filialen-grid, .module-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .donut-wrap { flex-direction: column; text-align: center; }
}
