:root {
  --bg: #111418;
  --card: #1b1f25;
  --fg: #f1f3f5;
  --muted: #8c95a0;
  --frei: #1f9d55;
  --belegt: #2563eb;
  --aus: #6b7280;
  --warn: #f59e0b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  min-height: 100vh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 16px) 16px max(env(safe-area-inset-bottom), 16px) 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

header h1 {
  font-size: 1.4rem;
  margin: 0 0 4px 0;
}

.icon-btn {
  background: var(--card);
  color: var(--fg);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
}

.icon-btn:active { transform: scale(0.95); }

.icon-btn.spinning .refresh-icon {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

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

.summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.summary.frei { color: var(--frei); font-weight: 600; }
.summary.teilweise { color: var(--belegt); font-weight: 600; }
.summary.belegt { color: var(--muted); }
.summary.ausser_betrieb { color: var(--aus); }
.summary.error { color: var(--warn); }

.connectors {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.connector {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

.dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--aus);
}

.connector.frei .dot { background: var(--frei); box-shadow: 0 0 0 3px rgba(31,157,85,0.25); }
.connector.belegt .dot { background: var(--belegt); }
.connector.aus .dot { background: var(--aus); }

.connector-meta {
  display: flex;
  flex-direction: column;
}

.connector-meta .plug {
  font-weight: 600;
}

.connector-meta .status {
  color: var(--muted);
  font-size: 0.9rem;
}

.connector.frei .status { color: var(--frei); }
.connector.belegt .status { color: var(--belegt); }

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

button {
  font: inherit;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }

.primary {
  background: var(--frei);
  color: white;
}

.primary.armed {
  background: var(--belegt);
}

.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--muted);
}

.hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.2em;
}

.hint.warn { color: var(--warn); }

footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

footer p { margin: 4px 0; }
