/* Shared design tokens + common components for all Tenne drink tools. */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #2d6cdf;
  --accent-ink: #ffffff;
  --ok: #1e8e4e;
  --storno: #c0392b;
  --storno-bg: #fdecea;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Top bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 { font-size: 1.25rem; margin: 0; }

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 120px;
}

/* Forms */
select, button, input[type="text"], input[type="date"], input[type="number"] {
  font: inherit;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}

button {
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

button.secondary {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
}

button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 24px;
}

h2 { font-size: 1.05rem; margin: 0 0 10px; }

/* KPI cards */
.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  display: grid;
  gap: 6px;
}

.kpi-value { font-size: 1.7rem; font-weight: 700; }

.kpi-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.data-table thead th {
  background: #fafbfc;
  font-weight: 600;
  color: var(--muted);
}

.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.data-table tr.storno { color: var(--storno); background: var(--storno-bg); }

.empty { text-align: center; color: var(--muted); padding: 20px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--storno); }

/* Offline / pending-queue badge */
.offline-badge {
  position: fixed;
  bottom: 16px;
  left: 16px;
  background: #b8860b;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 40;
}
.offline-badge[hidden] { display: none; }

/* Auth login overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 36, 48, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  display: grid;
  gap: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.auth-card h2 { margin: 0; }
.auth-card label { display: grid; gap: 6px; font-size: 0.9rem; }
.auth-card input { width: 100%; }
.auth-error { color: var(--storno); font-size: 0.85rem; margin: 0; min-height: 1em; }

/* Logged-in chip (bottom-right) */
.auth-chip {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  z-index: 40;
}
.auth-chip button { padding: 4px 10px; font-size: 0.8rem; }

/* Quick-pick (Schnellwahl) modal */
.qp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 36, 48, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 80;
}
.qp-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.qp-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.qp-grid button {
  padding: 12px 0;
  font-size: 1.05rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}
.qp-grid button.cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.qp-cancel { width: 100%; }

/* Blink hints (legacy): pulse the commit button while items are selected,
   and the empty event field as a start-of-day reminder. */
@keyframes tenne-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.blinking { animation: tenne-blink 1.4s ease-in-out infinite; }
@keyframes tenne-blink-field { 0%, 100% { background: var(--card); } 50% { background: #fff6c8; } }
.blink-field { animation: tenne-blink-field 1.2s ease-in-out infinite; }

@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
}
