/* ==========================================================================
   JFV Söhre – gemeinsames Design-System
   Mobile-first, große Touch-Ziele, funktioniert genauso im Desktop-Browser.
   ========================================================================== */

:root {
  --grün: #1b6e3c;
  --grün-dunkel: #145a30;
  --grün-hell: #e6f4ea;
  --blau: #2b579a;
  --rot: #b00020;
  --gelb: #a86a00;
  --gelb-hell: #fff8e6;
  --text: #1f2328;
  --text-mute: #666;
  --border: #e0e0e0;
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 20px 16px 60px;
  line-height: 1.4;
}

.page {
  max-width: 480px;
  margin: 0 auto;
}
.page-wide {
  max-width: 1000px;
  margin: 0 auto;
}

@media (min-width: 760px) {
  body { padding: 32px 24px 80px; }
}

.logo-wrap { text-align: center; margin-bottom: 8px; }
.logo-wrap img { width: 84px; height: auto; }

h1 { font-size: 1.35rem; text-align: center; margin: 4px 0 18px; }
h2 { font-size: 1.05rem; color: var(--grün); margin: 28px 0 10px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
h3 { font-size: .95rem; margin: 16px 0 6px; }

.subtitle { text-align: center; font-size: .85rem; color: var(--text-mute); margin-top: -8px; margin-bottom: 16px; }

/* ---------- Karten ---------- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card.muted { opacity: .55; }
.card.warn { background: var(--gelb-hell); border: 1px solid #e6c568; box-shadow: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter .1s ease;
  line-height: 1.1;
}
.btn:active { filter: brightness(.92); }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 1.05rem; padding: 14px 20px; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: .78rem; }

.btn-primary { background: var(--grün); color: #fff; }
.btn-secondary { background: var(--blau); color: #fff; }
.btn-danger { background: var(--rot); color: #fff; }
.btn-warning { background: var(--gelb); color: #fff; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline-primary { background: #fff; color: var(--grün); border: 2px solid var(--grün); }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 600; font-size: .85rem; margin-top: 14px; margin-bottom: 4px; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-top: 10px; }
label.inline input[type=checkbox], label.inline input[type=radio] { width: auto; }

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=file], input[type=date], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--grün);
  box-shadow: 0 0 0 3px var(--grün-hell);
}

.form-row { display: flex; flex-wrap: wrap; gap: 12px; }
.form-row > div { flex: 1; min-width: 140px; }
/* Erzwingt genau zwei Spalten nebeneinander, auch auf schmalen Handy-Bildschirmen */
.form-row-2up { display: flex; gap: 12px; }
.form-row-2up > div { flex: 1 1 0; min-width: 0; }

.hint { font-size: .78rem; color: var(--text-mute); margin-top: 4px; }

.error-box { background: #fdecea; color: var(--rot); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .9rem; }
.success-box { background: var(--grün-hell); color: var(--grün-dunkel); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .9rem; }

/* ---------- Navigation / Kachel-Menü ---------- */
.nav-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0;
}
@media (min-width: 560px) {
  .nav-tiles { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 760px) {
  .nav-tiles { grid-template-columns: repeat(4, 1fr); }
}
.nav-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 8px;
  text-decoration: none;
  color: var(--text);
  font-size: .8rem;
  font-weight: 600;
  text-align: center;
  min-height: 76px;
}
.nav-tile .emoji { font-size: 1.5rem; }
.nav-tile:active { filter: brightness(.95); }

.tabs { display: flex; gap: 8px; margin: 16px 0; }
.tab {
  flex: 1;
  text-align: center;
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 700;
  font-size: .95rem;
  border: 2px solid var(--border);
  color: var(--text);
  background: #fff;
}
.tab.active { background: var(--grün); color: #fff; border-color: var(--grün); }

/* ---------- Admin-Leiste (angemeldet als ...) ---------- */
.adminbar {
  text-align: center;
  font-size: .78rem;
  color: var(--text-mute);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.adminbar a { color: var(--grün); text-decoration: none; font-weight: 600; }
.adminbar .role-badge { background: var(--grün-hell); color: var(--grün-dunkel); padding: 2px 8px; border-radius: 20px; font-weight: 700; font-size: .72rem; }
.adminbar .logout-btn { background: none; border: none; color: var(--rot); cursor: pointer; padding: 0; font-size: .78rem; font-weight: 600; text-decoration: underline; }
.adminbar .sep { color: #ccc; margin: 0 2px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 20px; border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; background: #fff; font-size: .82rem; }
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; white-space: nowrap; }
th { background: #f0f1f3; font-weight: 700; }
td.wrap, th.wrap { white-space: normal; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: .7rem; font-weight: 700; }
.badge-green { background: var(--grün-hell); color: var(--grün-dunkel); }
.badge-blue { background: #e8eefc; color: var(--blau); }
.badge-grey { background: #eee; color: #555; }
.badge-warn { background: var(--gelb-hell); color: var(--gelb); }
.badge-red { background: #fdecea; color: var(--rot); }

/* ---------- Filter-Leiste ---------- */
.filter-bar {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin: 16px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.filter-bar select { width: auto; flex: 1; min-width: 160px; }

/* ---------- Produkt-/Artikelzeilen im öffentlichen Formular ---------- */
.product-row { border-top: 1px solid var(--border); padding: 14px 0; }
.product-row:first-of-type { border-top: none; }
.product-image { max-width: 84px; max-height: 84px; border-radius: var(--radius-sm); display: block; margin-bottom: 8px; object-fit: cover; }
.product-details { display: flex; gap: 8px; margin-top: 8px; margin-left: 2px; flex-wrap: wrap; }
.product-details select { flex: 1; min-width: 120px; }
.product-details input[type=number] { width: 76px; }
.extra-hint { font-size: .8rem; color: var(--text-mute); margin: 6px 0 0; }
.extra-text { margin-top: 6px; }
.total-line { text-align: right; font-weight: 700; margin-top: 18px; font-size: 1.05rem; background: var(--grün-hell); padding: 12px 16px; border-radius: var(--radius-sm); }

/* ---------- Sonstiges ---------- */
.stack { display: flex; flex-direction: column; gap: 10px; }
.flex-wrap-gap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
a.link { color: var(--grün); }
