@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Syne:wght@400;600;700;800&display=swap');

:root {
  --bg:        #0d0f14;
  --surface:   #141720;
  --surface2:  #1c2030;
  --border:    #262c3f;
  --green:     #22d67b;
  --yellow:    #f5c842;
  --red:       #ff4055;
  --blue:      #4f8ef7;
  --text:      #e8ecf5;
  --muted:     #6b7494;
  --font-display: 'Syne', sans-serif;
  --font-mono:    'DM Mono', monospace;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  height: 100%;
}

body { overflow-y: auto; }
body.admin-active { overflow: hidden; }

/* ── HEADER ──────────────────────────────────────────────────────────────── */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(13,15,20,0.95);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 100;
  height: 60px;
}

.logo {
  display: flex; align-items: center; gap: 8px;
}
.logo-img {
  height: 36px; width: auto;
}
.app-version {
  font-size: 0.58rem; font-weight: 400; letter-spacing: 0;
  color: var(--muted); align-self: flex-end; margin-bottom: 3px;
}

.ticker-bar {
  flex: 1; margin: 0 0 0 16px;
  overflow: hidden; position: relative;
  display: flex; align-items: center;
}
.ticker-inner {
  display: flex; gap: 0;
  animation: ticker 30s linear infinite;
  white-space: nowrap; font-size: 0.72rem; color: var(--muted);
}
.ticker-inner .t-red    { color: var(--red); }
.ticker-inner .t-yellow { color: var(--yellow); }
.ticker-inner .t-green  { color: var(--green); }
.ticker-inner .t-icon   { margin-right: 5px; }
.t-sep { color: var(--muted); padding: 0 20px; }
.t-app-badge {
  display: inline-block; padding: 1px 5px; border-radius: 3px;
  font-size: 0.65rem; font-weight: 700; margin-right: 6px; letter-spacing: 0;
}
.t-app-badge.t-red    { background: rgba(255,64,85,0.25);  color: var(--red); }
.t-app-badge.t-yellow { background: rgba(245,200,66,0.25); color: var(--yellow); }
.t-app-badge.t-green  { background: rgba(34,214,123,0.25); color: var(--green); }
@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(var(--ticker-shift, -50%)); }
}

.header-right { display: flex; align-items: center; gap: 12px; }

.info-badge {
  font-size: 0.72rem; color: var(--muted);
  padding: 3px 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; white-space: nowrap;
}
.info-badge.hidden { display: none; }
.user-chip {
  font-size: 0.72rem; color: var(--muted);
  padding: 4px 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; display: flex; align-items: center; gap: 6px;
}
.user-chip a { color: var(--muted); text-decoration: none; }
.user-chip a:hover { color: var(--text); }

.copyright {
  position: fixed; bottom: 5px; right: 10px;
  font-size: 0.52rem; color: var(--muted); opacity: 0.3;
  pointer-events: none; font-family: var(--font-mono);
}

.view-toggle {
  display: flex; gap: 4px;
  background: var(--surface); border-radius: 8px; padding: 4px;
}
.view-btn {
  padding: 6px 14px; border: none; cursor: pointer;
  border-radius: 6px; font-family: var(--font-mono); font-size: 0.75rem;
  transition: all 0.2s; background: transparent; color: var(--muted);
}
.view-btn.active { background: var(--border); color: var(--text); }
.view-btn[hidden] { display: none; }

/* ── STATUS BAR ──────────────────────────────────────────────────────────── */
.status-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 28px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: 0.72rem; color: var(--muted);
  height: 37px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  animation: blink 2s ease-in-out infinite;
}
.status-dot.warn { background: var(--yellow); }
.status-dot.crit { background: var(--red); }
@keyframes blink {
  0%,100% { opacity: 1; } 50% { opacity: 0.4; }
}

/* ── USER VIEW ───────────────────────────────────────────────────────────── */
#user-view { padding: 24px 28px; }

.section-label {
  font-family: var(--font-display); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}

.my-incidents {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 18px; margin-bottom: 24px;
  display: flex; align-items: center; gap: 14px; font-size: 0.8rem;
}
.my-incidents-icon { font-size: 1.2rem; }
.countdown { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.countdown-ring { width: 36px; height: 36px; position: relative; }
.countdown-ring svg { transform: rotate(-90deg); }
.countdown-ring circle {
  fill: none; stroke-width: 3;
  stroke-dasharray: 100; stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}
.countdown-ring .bg { stroke: var(--border); }
.countdown-ring .fg { stroke: var(--yellow); stroke-linecap: round; }
.countdown-text {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 0.55rem; font-weight: 500; color: var(--yellow);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: 160px;
  gap: 12px; margin-bottom: 32px;
}
.app-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 16px;
  cursor: pointer; transition: all 0.2s;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
  height: 100%;
}
.app-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.app-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: 12px 12px 0 0;
}
.app-card.green::before  { background: var(--green); }
.app-card.yellow::before { background: var(--yellow); }
.app-card.red::before    { background: var(--red); animation: pulse-red 3s ease-in-out infinite; }
.app-card.red            { background-color: rgba(255,64,85,0.08); }
@keyframes pulse-red { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.app-name { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; line-height: 1.2; }
.app-hint {
  font-size: 0.67rem; color: var(--muted); line-height: 1.4; margin-top: -4px;
  padding-right: 8px; hyphens: auto; overflow-wrap: break-word;
}
.app-card-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.app-meta { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.status-pill {
  font-size: 0.65rem; padding: 4px 9px; border-radius: 20px;
  font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.status-pill.green  { background: rgba(34,214,123,0.15); color: var(--green); }
.status-pill.yellow { background: rgba(245,200,66,0.15);  color: var(--yellow); }
.status-pill.red    { background: rgba(255,64,85,0.15);   color: var(--red); }
.app-counts { display: flex; flex-direction: column; gap: 2px; }
.app-count-line { font-size: 0.68rem; color: var(--muted); }
.app-count-line strong { color: var(--text); font-weight: 500; }

/* ── MODAL ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 16px; width: 520px; max-width: 95vw;
  max-height: 85vh; overflow-y: auto;
  transform: translateY(20px); transition: transform 0.25s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.modal-sub   { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.2rem; transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; }

/* Checkbox-Liste im Modal (statt Freitext) */
.template-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.template-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.2s;
}
.template-item:hover { border-color: var(--blue); }
.template-item input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--blue); flex-shrink: 0; cursor: pointer;
}
.template-item label { font-size: 0.82rem; cursor: pointer; flex: 1; }
.template-item.done { opacity: 0.45; cursor: default; }
.template-item.done label { cursor: default; }
.submit-btn {
  background: var(--red); border: none; cursor: pointer;
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 0.9rem;
  padding: 12px; border-radius: 8px; transition: all 0.2s; width: 100%;
}
.submit-btn:hover { filter: brightness(1.15); }
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Aktive Incidents im Modal */
.incident-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  margin-bottom: 8px; transition: all 0.2s;
}
.incident-item.voted { border-color: var(--yellow); background: rgba(245,200,66,0.05); }
.incident-desc { flex: 1; font-size: 0.82rem; }
.incident-count { font-size: 0.72rem; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.me-too-btn {
  background: var(--border); border: none; cursor: pointer;
  color: var(--text); font-family: var(--font-mono); font-size: 0.72rem;
  padding: 5px 10px; border-radius: 6px; transition: all 0.2s; white-space: nowrap;
}
.me-too-btn:hover  { background: var(--blue); }
.me-too-btn.active { background: var(--yellow); color: #000; }

/* ── TOAST ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2); border: 1px solid var(--green);
  border-radius: 10px; padding: 12px 20px;
  font-size: 0.82rem; color: var(--green);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 300; white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── CONFIRM / DELETE BANNER ─────────────────────────────────────────────── */
.confirm-banner {
  background: rgba(245,200,66,0.1); border: 1px solid var(--yellow);
  border-radius: 10px; padding: 14px 18px; margin-bottom: 20px; display: none;
}
.confirm-banner.show { display: block; }
.confirm-banner p { font-size: 0.82rem; margin-bottom: 10px; }
.confirm-actions { display: flex; gap: 8px; }
.btn-yes, .btn-no {
  flex: 1; padding: 8px; border-radius: 6px; border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 0.78rem; transition: all 0.2s;
}
.btn-yes { background: var(--yellow); color: #000; font-weight: 600; }
.btn-no  { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-yes:hover { filter: brightness(1.1); }

.my-incidents-actions {
  display: flex; flex-direction: row; gap: 6px; align-items: center;
}
.reset-timer-btn {
  background: rgba(255,64,85,0.18); border: 1px solid var(--red);
  color: var(--red); font-family: var(--font-mono); font-size: 0.68rem;
  padding: 5px 10px; border-radius: 8px; cursor: pointer;
  transition: all 0.2s; white-space: nowrap; text-align: center;
}
.reset-timer-btn:hover { background: rgba(255,64,85,0.32); }
@keyframes reset-flash {
  0%   { background: rgba(255,64,85,0.18); }
  30%  { background: rgba(255,64,85,0.75); color: #fff; box-shadow: 0 0 0 3px rgba(255,64,85,0.4); }
  100% { background: rgba(255,64,85,0.18); }
}
.reset-timer-btn.flash { animation: reset-flash 0.5s ease-out; transition: none; }
.delete-btn {
  background: rgba(34,214,123,0.12); border: 1px solid var(--green);
  color: var(--green); font-family: var(--font-mono); font-size: 0.68rem;
  padding: 5px 10px; border-radius: 8px; cursor: pointer;
  transition: all 0.2s; white-space: nowrap; text-align: center;
}
.delete-btn:hover { background: rgba(34,214,123,0.25); }

.my-incidents { cursor: pointer; }

/* ── ADMIN VIEW (scrollfrei, 100vh) ──────────────────────────────────────── */
#admin-view {
  height: calc(100vh - 97px);   /* 60px header + 37px status-bar */
  overflow: hidden;
  padding: 12px 16px;
  display: none;
  flex-direction: column;
}
body.admin-active #admin-view { display: flex; }
body.admin-active #user-view  { display: none; }

.admin-grid {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 1fr 6px 1fr;
  gap: 0; overflow: hidden;
}

/* ── RESIZE HANDLE ───────────────────────────────────────────────────────── */
.resize-handle {
  cursor: col-resize; width: 6px; height: 100%; align-self: stretch;
  background: var(--border); border-radius: 3px; transition: background 0.2s;
}
.resize-handle:hover,
.resize-handle.active { background: var(--blue); }

/* ── MAP (Leaflet) ───────────────────────────────────────────────────────── */
.map-container {
  height: 100%; min-height: unset;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; position: relative; z-index: 0;
  /* z-index:0 erzeugt einen eigenen Stacking Context, der Leaflets interne
     z-indexes (Panes 200–800) einkapselt und verhindert, dass sie den
     Modal-Overlay (z-index 200 im Root-Context) überlagern. */
}
#map { width: 100%; height: 100%; }

/* Leaflet-UI in Dark-Theme */
.leaflet-control-zoom a {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover { background: var(--border) !important; }
.leaflet-popup-content-wrapper {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}
.leaflet-popup-tip { background: var(--surface2) !important; }

/* ── RECHTE PANELS-SPALTE ────────────────────────────────────────────────── */
.admin-panels {
  height: 100%; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.admin-panels::-webkit-scrollbar { width: 4px; }
.admin-panels::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; flex-shrink: 0;
}
.panel-title {
  font-family: var(--font-display); font-weight: 700; font-size: 0.8rem;
  margin-bottom: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}

.stat-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.8rem;
}
.stat-row:last-child { border-bottom: none; }
.stat-badge {
  font-size: 0.7rem; padding: 3px 8px; border-radius: 20px; font-weight: 600;
}
.stat-badge.red    { background: rgba(255,64,85,0.2);   color: var(--red); }
.stat-badge.yellow { background: rgba(245,200,66,0.2);  color: var(--yellow); }
.stat-badge.green  { background: rgba(34,214,123,0.2);  color: var(--green); }

/* ── TREND CHART ─────────────────────────────────────────────────────────── */
.trend-chart {
  display: flex; align-items: flex-end; gap: 4px; height: 60px; margin-top: 10px;
}
.trend-bar {
  flex: 1; border-radius: 3px 3px 0 0; background: var(--border);
  transition: height 0.4s ease;
}
.trend-bar.active { background: var(--red); }
.trend-bar.peak   { background: var(--yellow); }
.trend-axis {
  display: flex; justify-content: space-between;
  font-size: 0.62rem; color: var(--muted); margin-top: 4px;
}

/* ── VERBINDUNGSTYP PANEL ────────────────────────────────────────────────── */
.conn-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; font-size: 0.78rem;
}
.conn-bar-wrap {
  flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.conn-bar { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.conn-bar.intern { background: var(--blue); }
.conn-bar.vpn    { background: var(--yellow); }
.conn-bar.extern { background: var(--muted); }
.conn-count { font-size: 0.72rem; color: var(--muted); min-width: 24px; text-align: right; }

/* ── SCHWELLWERTE (editierbar) ───────────────────────────────────────────── */
.threshold-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.78rem;
}
.threshold-row:last-of-type { border-bottom: none; }
.threshold-input {
  width: 90px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-family: var(--font-mono);
  font-size: 0.78rem; padding: 4px 8px; text-align: right; outline: none;
  -moz-appearance: textfield;
}
.threshold-input:focus { border-color: var(--blue); }
.threshold-input::-webkit-outer-spin-button,
.threshold-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.threshold-unit { font-size: 0.68rem; color: var(--muted); margin-left: 4px; width: 50px; }
.save-btn {
  background: var(--blue); border: none; cursor: pointer;
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 0.78rem;
  padding: 8px 14px; border-radius: 8px; transition: all 0.2s;
  width: 100%; margin-top: 10px;
}
.save-btn:hover { filter: brightness(1.15); }

/* ── STÖRUNGSVORLAGEN VERWALTUNG ─────────────────────────────────────────── */
.app-select {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-mono); font-size: 0.78rem;
  padding: 6px 10px; border-radius: 8px; width: 100%;
  outline: none; cursor: pointer; margin-bottom: 12px;
}
.template-mgmt-list { display: flex; flex-direction: column; gap: 6px; }
.template-mgmt-item {
  display: grid; grid-template-columns: auto 1fr auto auto auto;
  gap: 6px; align-items: center;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 0.78rem;
}
.template-mgmt-item.drag-over { border-color: var(--blue); }
.template-mgmt-item .tmpl-desc {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.78rem; color: var(--text); cursor: default;
}
.tmpl-drag-handle {
  cursor: grab; color: var(--muted); font-size: 1rem; user-select: none; padding: 0 4px;
}
.tmpl-drag-handle:active { cursor: grabbing; }
.tmpl-inline-input {
  background: transparent; border: none; border-bottom: 1px solid var(--blue);
  outline: none; color: var(--text); font-family: var(--font-mono);
  font-size: 0.78rem; width: 100%; padding: 1px 0;
}
.tmpl-edit-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 0.9rem; transition: color 0.2s; padding: 2px;
}
.tmpl-edit-btn:hover { color: var(--blue); }
.tmpl-del-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 0.9rem; transition: color 0.2s; padding: 2px;
}
.tmpl-del-btn:hover { color: var(--red); }
.tmpl-dis-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 0.9rem; transition: color 0.2s; padding: 2px;
}
.tmpl-dis-btn.active { color: var(--green); }
.add-tmpl-btn {
  background: var(--surface); border: 1px dashed var(--border);
  color: var(--muted); font-family: var(--font-mono); font-size: 0.75rem;
  padding: 7px; border-radius: 8px; cursor: pointer; transition: all 0.2s;
  width: 100%; margin-top: 6px;
}
.add-tmpl-btn:hover { border-color: var(--blue); color: var(--text); }

/* ── TICKER ADMIN (Panel – jetzt nur noch ein Button) ────────────────────── */
.add-ticker-btn {
  background: var(--surface); border: 1px dashed var(--border);
  color: var(--muted); font-family: var(--font-mono); font-size: 0.75rem;
  padding: 8px; border-radius: 8px; cursor: pointer; transition: all 0.2s; width: 100%;
}
.add-ticker-btn:hover { border-color: var(--blue); color: var(--text); }

/* ── TICKER MODAL ────────────────────────────────────────────────────────── */
.ticker-modal-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.ticker-modal-entry {
  display: grid; grid-template-columns: auto 1fr 2fr 1fr auto;
  gap: 6px 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; transition: opacity 0.2s;
}
.ticker-modal-entry.inactive { opacity: 0.4; }
.ticker-modal-entry.auto { border-color: #7c5cfc; box-shadow: 0 0 0 1px #7c5cfc44; }
.ticker-modal-entry.auto .ticker-active-select { color: #a78bfa; }
.ticker-modal-entry.drag-over { border-color: var(--blue); }
.ticker-drag-handle {
  cursor: grab; color: var(--muted); font-size: 1rem; user-select: none; padding: 0 4px;
}
.ticker-drag-handle:active { cursor: grabbing; }
.ticker-modal-entry textarea {
  grid-column: 1 / -1;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-family: var(--font-mono); outline: none;
  font-size: 0.78rem; resize: vertical; min-height: 36px; line-height: 1.4;
  padding: 6px 8px;
}
.ticker-modal-entry textarea:focus { border-color: var(--blue); }
.ticker-color-select, .ticker-active-select, .ticker-app-select {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-mono); font-size: 0.72rem;
  padding: 4px 6px; border-radius: 6px; outline: none; cursor: pointer; width: 100%;
}
.ticker-remove {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1rem; transition: color 0.2s; padding: 2px;
}
.ticker-remove:hover { color: var(--red); }
.ticker-link {
  color: inherit; text-decoration: underline; text-underline-offset: 2px;
  opacity: 0.85; cursor: pointer; white-space: nowrap;
}
.ticker-link:hover { opacity: 1; }
.ticker-modal-add {
  background: var(--surface); border: 1px dashed var(--border);
  color: var(--muted); font-family: var(--font-mono); font-size: 0.75rem;
  padding: 7px; border-radius: 8px; cursor: pointer; transition: all 0.2s; width: 100%;
}
.ticker-modal-add:hover { border-color: var(--blue); color: var(--text); }

/* ── TAGESREPORT ─────────────────────────────────────────────────────────── */
.report-charts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}
@media (max-width: 700px) { .report-charts { grid-template-columns: 1fr; } }
.report-chart-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px;
}
.report-chart-title {
  font-size: 0.72rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px;
}
.report-chart-wrap { position: relative; height: 220px; }
.report-export-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 0 0; margin-top: 16px;
  border-top: 1px solid var(--border);
}
.report-export-label {
  font-size: 0.72rem; color: var(--muted); margin-right: 4px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ── APP TILES ADMIN ─────────────────────────────────────────────────────── */
.app-tiles-admin-list { display: flex; flex-direction: column; gap: 6px; }
.app-tile-admin-row {
  display: grid; grid-template-columns: 1fr auto;
  gap: 8px; align-items: center;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px;
}
.app-tile-admin-info { min-width: 0; }
.app-tile-admin-name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.app-tile-admin-hint {
  font-size: 0.68rem; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.tmpl-edit-btn, .app-tile-edit-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 0.9rem; transition: color 0.2s; padding: 2px;
}
.tmpl-edit-btn:hover { color: var(--blue); }
.app-tile-edit-btn:hover { color: var(--blue); }

/* ── ADMIN MODAL INPUTS ──────────────────────────────────────────────────── */
.admin-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; color: var(--text);
  font-family: var(--font-mono); font-size: 0.85rem; outline: none;
}
.admin-input:focus { border-color: var(--blue); }
.admin-select {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; color: var(--text);
  font-family: var(--font-mono); font-size: 0.85rem; outline: none; cursor: pointer;
}
.admin-select:focus { border-color: var(--blue); }
.admin-label {
  font-size: 0.72rem; color: var(--muted); margin-bottom: 5px; display: block;
}
.admin-field { margin-bottom: 14px; }
.admin-char-hint { font-size: 0.68rem; color: var(--muted); margin-top: 4px; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end; padding: 0 24px 20px;
}
.btn-cancel {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-display); font-weight: 600; font-size: 0.8rem;
  padding: 8px 16px; border-radius: 8px; cursor: pointer; transition: all 0.2s;
}
.btn-cancel:hover { border-color: var(--muted); }

/* ── DETAIL PANEL ────────────────────────────────────────────────────────── */
.detail-panel { display: none; }
.detail-panel.show { display: block; }


/* ── VPN-BADGE (Leaflet-Control, topleft) ────────────────────────────────── */
.vpn-control-badge {
  margin-top: 8px;
  background: rgba(14,16,28,0.82); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 20px;
  font-family: var(--font-mono); font-size: 0.85rem; color: var(--text);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  backdrop-filter: blur(6px); transition: border-color 0.2s;
}
.vpn-control-badge:hover { border-color: var(--blue); }
.vpn-badge-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.vpn-badge-count {
  border-radius: 5px; padding: 2px 8px;
  font-weight: 700; font-size: 0.78rem;
}
.vpn-info-panel {
  position: absolute; display: none; z-index: 850;
  min-width: 180px; max-width: 300px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px;
  color: var(--text); font-family: var(--font-mono); font-size: 0.75rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

/* ── BUNDESLAND-HAUPTSTÄDTE (dezente Karten-Label) ──────────────────────── */
.capital-icon { background: transparent !important; border: none !important; }
.capital-label {
  font-family: var(--font-mono);
  font-size: 0.5rem; letter-spacing: 0.06em;
  color: rgba(160,175,210,0.38);
  white-space: nowrap; pointer-events: none;
  text-transform: uppercase; font-weight: 500;
}

/* ── MARKER SPRECHBLASEN-LABEL ───────────────────────────────────────────── */
.marker-outer { overflow: visible !important; }
.marker-inner { position: relative; display: inline-block; }
.marker-dot   { border-radius: 50%; cursor: pointer; transition: transform 0.15s, filter 0.15s; }
.marker-hover .marker-dot { transform: scale(1.5); filter: brightness(1.4); }
@keyframes marker-pulse {
  0%, 100% { box-shadow: 0 0 0 2px currentColor; opacity: 1; }
  50%       { box-shadow: 0 0 0 8px transparent; opacity: 0.75; }
}
.marker-dot.pulse { animation: marker-pulse 1.8s ease-in-out infinite; }
.marker-label {
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: rgba(14,16,28,0.30); color: #fff;
  font-size: 0.6rem; font-weight: 700; white-space: nowrap;
  padding: 2px 6px; border-radius: 4px;
  pointer-events: none; font-family: var(--font-mono);
  /* font-size wird per inline-style beim Rendern per Zoom gesetzt */
}
.marker-label::after {
  content: ''; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(14,16,28,0.30);
}

/* ── LEAFLET POPUP (ted-popup) ───────────────────────────────────────────── */
.ted-popup .leaflet-popup-content-wrapper {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-family: var(--font-mono);
  font-size: 0.75rem; box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.ted-popup .leaflet-popup-tip { background: var(--surface2); }
.ted-popup .leaflet-popup-close-button { color: var(--muted); }
.popup-inner { padding: 2px; }
.popup-title { font-weight: 700; font-size: 0.82rem; margin-bottom: 2px; }
.popup-city  { font-size: 0.68rem; color: var(--muted); margin-bottom: 8px; }
.popup-app-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.72rem; padding: 2px 0;
}
.popup-divider { border: none; border-top: 1px solid var(--border); margin: 6px 0; }
.popup-total-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.75rem; font-weight: 700; padding: 2px 0; margin-bottom: 3px;
}
.popup-tmpl-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.7rem; padding: 1px 0; color: var(--muted);
}
.popup-tmpl-row span:last-child { font-weight: 600; color: var(--text); white-space: nowrap; }

/* ── GRUPPEN-DIALOG ──────────────────────────────────────────────────────── */
.groups-mgmt-item {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 6px;
}
.groups-mgmt-item.drag-over { border-color: var(--blue); }
.group-drag-handle {
  cursor: grab; color: var(--muted); font-size: 1rem;
  user-select: none; padding: 0 4px;
}
.group-drag-handle:active { cursor: grabbing; }
.group-name-input {
  background: transparent; border: none; border-bottom: 1px solid transparent;
  color: var(--text); font-family: var(--font-mono); font-size: 0.82rem;
  outline: none; padding: 2px 4px; width: 100%; cursor: text;
}
.group-name-input:focus { border-bottom-color: var(--blue); background: var(--surface); border-radius: 4px 4px 0 0; }

/* ── APPS MODAL ──────────────────────────────────────────────────────────── */
.app-modal-entry {
  display: grid; grid-template-columns: auto 1fr 2fr auto;
  gap: 6px 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.app-modal-entry.drag-over { border-color: var(--blue); }
.app-drag-handle {
  cursor: grab; color: var(--muted); font-size: 1rem; padding: 0 4px; user-select: none;
}
.app-drag-handle:active { cursor: grabbing; }
.app-modal-entry input[type=text] {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-mono); font-size: 0.78rem;
  padding: 4px 8px; border-radius: 6px; outline: none; width: 100%; box-sizing: border-box;
}
.app-modal-entry input[type=text]:focus { border-color: var(--blue); }
.app-modal-entry textarea {
  grid-column: 1 / -1;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-family: var(--font-mono); outline: none;
  font-size: 0.78rem; resize: vertical; min-height: 48px; line-height: 1.4;
  padding: 6px 8px; width: 100%; box-sizing: border-box;
}
.app-modal-entry textarea:focus { border-color: var(--blue); }
.app-modal-group-select {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-mono); font-size: 0.72rem;
  padding: 4px 6px; border-radius: 6px; outline: none; cursor: pointer; width: 100%;
}

/* ── LOADING OVERLAY ─────────────────────────────────────────────────────── */
#loading {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
}
#loading.hidden { display: none; }
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--blue); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
