*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a202c;
  --border: #2d3748;
  --muted: #718096;
  --text: #e2e8f0;
  --primary: #48bb78;
  --primary-dark: #38a169;
  --danger: #fc8181;
  --error: #fc8181;
  --success: #68d391;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Login Screen ─── */
#login-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 1.5rem;
  padding: 2rem;
  text-align: center;
}
#login-screen h1 { font-size: 1.8rem; color: var(--primary); }
#login-screen p { color: var(--muted); }

/* ── App Shell ─── */
#app { display: none; flex-direction: column; min-height: 100vh; }

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header h1 { font-size: 1.1rem; color: var(--primary); }
#user-email { font-size: 0.75rem; color: var(--muted); }
#btn-logout { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.8rem; }
#btn-logout:hover { color: var(--danger); }

/* ── Tabs ─── */
.tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.75rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { display: none; padding: 1rem; }
.tab-panel.active { display: block; }

/* ── Makros ─── */
.macros {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.macro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.5rem;
  text-align: center;
}
.macro-val { font-size: 1.3rem; font-weight: bold; color: var(--primary); }
.macro-label { font-size: 0.7rem; color: var(--muted); margin-top: 0.2rem; }

/* ── Log Entries ─── */
.log-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.log-info { flex: 1; }
.log-info strong { display: block; font-size: 0.9rem; }
.log-kcal { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.btn-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.25rem;
}
.btn-delete:hover { color: var(--danger); }

/* ── Scanner ─── */
#scanner-video {
  width: 100%;
  border-radius: 10px;
  display: none;
  margin-bottom: 1rem;
  background: #000;
}

/* ── Product Form ─── */
.product-form h3 { margin-bottom: 0.25rem; }
.form-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
}
.form-row label { min-width: 80px; color: var(--muted); font-size: 0.9rem; }
.form-row input, .form-row select {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
}

/* ── Buttons ─── */
.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 1rem;
  cursor: pointer;
}

/* ── Search ─── */
.search-row { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.search-row input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
}
.search-row button {
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
}
.product-card:hover { border-color: var(--primary); }

/* ── Utils ─── */
.muted { color: var(--muted); font-size: 0.85rem; }
.error { color: var(--error); font-size: 0.9rem; }
.success { color: var(--success); font-size: 1rem; font-weight: 600; }
section-title { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; display: block; }

/* ── Einstellungen ─── */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}
.settings-card h2 { font-size: 1rem; margin-bottom: 0.4rem; }
.settings-card .muted { margin-bottom: 1rem; }
#garmin-status { margin-top: 0.75rem; min-height: 1.5rem; }

/* ── MCP Token Box ─── */
.token-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--primary);
  word-break: break-all;
  margin-bottom: 0.5rem;
}
.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
  margin-bottom: 0.75rem;
}
.btn-copy {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  margin-bottom: 1rem;
}
.btn-copy:hover { border-color: var(--primary); color: var(--primary); }
.mcp-section-title {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1rem 0 0.4rem;
}
