:root {
  --cream: #F7F2EA;
  --cream-surface: #FFFDF9;
  --ink: #2B2420;
  --ink-muted: #7A6D64;
  --rose: #B76E79;
  --rose-deep: #7A4753;
  --mauve: #8E6B76;
  --line: #E7DED2;
  --ok: #6E8C6F;
  --ok-bg: #E7EFE3;
  --danger: #A65656;
  --danger-bg: #F3E4E1;
  --radius: 10px;
  --font-ui: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar + Ticker (Signature-Element) ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: var(--ink);
  color: var(--cream);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-mark { color: var(--rose); }

.ticker {
  flex: 1;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}

.ticker-track {
  display: flex;
  gap: 32px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 13px;
  animation: scroll-ticker 30s linear infinite;
}

.ticker-track:empty::before {
  content: "Noch keine Daten – füg ein Produkt hinzu, damit hier Live-Status läuft.";
  opacity: 0.6;
}

@keyframes scroll-ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker-item { display: inline-flex; gap: 8px; align-items: center; }
.ticker-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.ticker-dot.up { background: var(--ok); }
.ticker-dot.down { background: var(--danger); }

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.add-panel { grid-row: 1 / 3; }
.list-panel { grid-column: 2; grid-row: 1; }
.trend-panel { grid-column: 2; grid-row: 2; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .add-panel, .list-panel, .trend-panel { grid-column: 1; grid-row: auto; }
}

.panel {
  background: var(--cream-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.count {
  font-family: var(--font-mono);
  background: var(--rose);
  color: var(--cream-surface);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
}

.badge-soon {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}

.hint {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 4px 0 14px;
  line-height: 1.5;
}

/* ---------- Form ---------- */

.add-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

.add-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-muted);
}

.add-form .optional { font-weight: 400; opacity: 0.8; }

.add-form input {
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
  color: var(--ink);
}

.add-form input:focus-visible,
.add-form button:focus-visible {
  outline: 2px solid var(--rose-deep);
  outline-offset: 2px;
}

.scrape-config {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scrape-config legend {
  font-size: 12px;
  font-weight: 600;
  padding: 0 6px;
}

.add-form button {
  margin-top: 4px;
  padding: 11px 16px;
  background: var(--rose-deep);
  color: var(--cream-surface);
  border: none;
  border-radius: 8px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.add-form button:hover { background: var(--mauve); }

.form-status {
  font-size: 13px;
  min-height: 18px;
  margin-top: 10px;
}
.form-status.error { color: var(--danger); }
.form-status.success { color: var(--ok); }

/* ---------- Product list ---------- */

.empty-state {
  color: var(--ink-muted);
  font-size: 14px;
}

.product-card {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
}

.mode-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.status-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-chip.available { background: var(--ok-bg); color: var(--ok); }
.status-chip.sold_out { background: var(--danger-bg); color: var(--danger); }
.status-chip.pending { background: var(--line); color: var(--ink-muted); }

.product-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.product-name { font-weight: 600; }
.product-name a { color: inherit; text-decoration: none; }
.product-name a:hover { text-decoration: underline; }
.product-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price {
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
}

.sparkline { display: block; }

.remove-btn {
  background: none;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
}
.remove-btn:hover { color: var(--danger); }
