:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-alt: #1d2129;
  --border: #2a2e37;
  --text: #e6e8ec;
  --muted: #8b91a0;
  --accent: #4f8cff;
  --danger: #ff5c5c;
  --ok: #37c98a;
}

* { box-sizing: border-box; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
}

/* ---------- Topbar + Tabs ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px 0;
}

.topbar .brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  font-size: 17px;
  flex: 1;
}

.refresh-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.refresh-btn:hover { color: var(--text); border-color: var(--muted); }
.refresh-btn:active { transform: scale(0.97); }
.refresh-btn:disabled { opacity: 0.5; cursor: default; }

.tabs {
  display: flex;
  gap: 4px;
  max-width: 1100px;
  margin: 10px auto 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
.tabs a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 14px;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.status-line {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 20px 0;
  font-size: 12px;
  color: var(--muted);
}

.flash {
  max-width: 1100px;
  margin: 8px auto 0;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
}
.flash-error { background: rgba(255, 92, 92, 0.15); color: var(--danger); }

/* ---------- Layout ---------- */
.container { max-width: 1100px; margin: 24px auto; padding: 0 20px 40px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 15px; color: var(--muted); font-weight: 500; margin: 28px 0 10px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
}

.muted { color: var(--muted); font-size: 13px; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 20px 32px;
}

/* ---------- Angebote ---------- */
.angebote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.begriff-panel { padding: 0; }

.begriff-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-alt);
}

.begriff-head .name {
  font-weight: 600;
  font-size: 14px;
}

.begriff-head .count {
  font-size: 12px;
  color: var(--muted);
}

.angebot-row {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
.angebot-row:last-child { border-bottom: none; }

.angebot-row .row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.angebot-row .haendler {
  color: var(--muted);
  font-weight: 500;
}

.angebot-row .preis {
  color: var(--ok);
  font-weight: 600;
  white-space: nowrap;
}

.angebot-row .titel {
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.angebot-row .zeitraum {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.empty-hint {
  color: var(--muted);
  font-size: 14px;
  padding: 12px 2px;
}

/* ---------- Liste ---------- */
.hint-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 16px;
}

table.liste { width: 100%; border-collapse: collapse; font-size: 14px; }
table.liste th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border);
}
table.liste td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.liste tr.neu-row td { border-top: 1px dashed var(--accent); }
table.liste tr:last-child td { border-bottom: none; }

table.liste input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 14px;
}
table.liste input[type="text"]:focus,
table.liste input[type="checkbox"]:focus {
  outline: 1px solid var(--accent);
}

.col-exakt { text-align: center; width: 70px; }
.col-aktion { width: 110px; text-align: right; }

table.liste input[type="checkbox"] { width: 18px; height: 18px; }

button, a.button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}
button.danger { background: var(--danger); }
button.danger.confirm-armed {
  background: #b3261e;
  box-shadow: 0 0 0 2px rgba(255, 92, 92, 0.5);
}
button:disabled { opacity: 0.6; cursor: default; }
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
button.ghost:hover { color: var(--text); }
button:active { transform: scale(0.97); }

/* ---------- Login ---------- */
.login-container { max-width: 380px; }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.login-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 14px;
}
.login-form input:focus { outline: 1px solid var(--accent); }
.login-form button { margin-top: 4px; }

.user-badge {
  color: var(--muted);
  font-size: 13px;
}

.logout-form { display: inline-flex; }

/* Mobile: Tabelle wird zur gestapelten Karte */
@media (max-width: 680px) {
  .container { padding: 0 12px 40px; }
  .topbar-inner { padding: 12px 12px 0; }
  .tabs { padding: 0 12px; }
  .status-line { padding: 8px 12px 0; }

  table.liste, table.liste thead, table.liste tbody, table.liste th, table.liste td, table.liste tr {
    display: block;
  }
  table.liste thead { display: none; }
  table.liste tr {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
  }
  table.liste tr.neu-row { border-top: 1px dashed var(--accent); }
  table.liste td {
    border-bottom: none;
    padding: 5px 0;
  }
  table.liste td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 3px;
  }
  .col-exakt, .col-aktion { text-align: left; width: auto; }
  .col-aktion button { width: 100%; }
}
