:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --text: #e8eaed;
  --text-dim: #9aa1ab;
  --accent: #4da3ff;
  --up: #3ddc84;
  --down: #ff5a5a;
  --warn: #e0c23d;
  --border: #2a2f3a;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 16px;
  max-width: 720px;
  margin-inline: auto;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

h1 { font-size: 1.3rem; margin: 0; }
.header-right { display: flex; align-items: center; gap: 8px; }
.version { color: var(--text-dim); font-size: 0.8rem; }
.led-age { color: var(--text-dim); font-size: 0.75rem; }

/* Ruhezustand: unauffaelliger grauer Punkt (nicht dauerhaft gruen - gruen ist reserviert fuer
   das kurze Aufblinken bei neu eingetroffenen Kursen). Gelb (led-yellow) bleibt dagegen dauerhaft
   an, solange der letzte Kurs aelter als 5 Minuten ist. */
.led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: var(--text-dim);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}
.led.led-yellow { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.led.led-blink { animation: led-blink-anim 1s ease-out; }
@keyframes led-blink-anim {
  0% { background: var(--up); box-shadow: 0 0 8px var(--up); transform: scale(2.2); }
  100% { background: var(--text-dim); box-shadow: 0 0 4px rgba(0, 0, 0, 0.4); transform: scale(1); }
}

.quote-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.quote-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.quote-card:hover { background: var(--surface-2); }
.quote-card.selected { border-color: var(--accent); }

.quote-card .label { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 4px; }
.quote-card .bid { font-size: 1.4rem; font-weight: 600; }
.quote-card .change { font-size: 0.8rem; font-weight: 500; }
.quote-card .holding-value { color: var(--text-dim); font-size: 0.85rem; margin-top: 6px; }
.quote-card .holding-pl { font-size: 0.8rem; font-weight: 500; }
.quote-card .stale { color: var(--down); font-size: 0.75rem; }

section.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

section.card h2 { margin: 0; font-size: 1rem; color: var(--text-dim); }

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.range-switch { display: flex; gap: 4px; flex-wrap: wrap; }
.range-switch button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
}
.range-switch button.active { color: var(--text); border-color: var(--accent); background: #1c2a3d; }

/* Vorher 200px - Nutzerwunsch 2026-11-26: "Chart-Höhe etwas vergrößern". */
#chart { width: 100%; height: 260px; display: block; cursor: crosshair; }

#holdings { overflow-x: auto; }
table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
.pos { color: var(--up); }
.neg { color: var(--down); }

.error-banner {
  background: #3a1a1a;
  border: 1px solid var(--down);
  color: #ffb4b4;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: none;
}
.error-banner.visible { display: block; }

.empty { color: var(--text-dim); font-size: 0.9rem; padding: 8px 0; }

.widget-download {
  display: block;
  text-align: center;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 24px;
}
.widget-download:hover { color: var(--text); border-color: var(--accent); }

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.login-overlay.hidden { display: none; }

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 320px;
  text-align: center;
}
.login-box h2 { margin: 0 0 8px; font-size: 1.1rem; }
.login-box p { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 16px; }
.login-box input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
  margin-bottom: 12px;
}
.login-box button {
  width: 100%;
  background: var(--accent);
  border: none;
  color: #0b1420;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
  cursor: pointer;
}
.login-error { color: var(--down); font-size: 0.85rem; margin-top: 10px; min-height: 1.2em; }
