:root {
  --feuerrot: #C1121F;
  --feuerrot-d: #8E0D17;
  --ink: #1B1815;
  --muted: #756B5E;
  --paper: #FAF8F3;
  --surface: #FFFFFF;
  --line: #E7E1D6;
  --ok: #2E7D4F;
  --radius: 12px;
  --tap: 58px;
  --maxw: 540px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font: inherit; }

.app { max-width: var(--maxw); margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }

.label {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 800;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---- Kopfzeile ---- */
.topbar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  background: var(--ink); color: var(--paper);
  position: sticky; top: 0; z-index: 5;
}
.topbar .brand { font-weight: 800; letter-spacing: 0.05em; }
.topbar .brand small {
  display: block; font-weight: 600; font-size: 0.62rem;
  letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.65;
}
.topbar .spacer { flex: 1; }
.topbar button {
  color: var(--paper); border: 1px solid rgba(255,255,255,0.28);
  padding: 0.45rem 0.7rem; border-radius: 8px; font-size: 0.82rem; font-weight: 600;
}
.topbar button:active { background: rgba(255,255,255,0.12); }

/* ---- Inhalt ---- */
.view { flex: 1; padding: 1.1rem; display: none; }
.view.active { display: block; }

.screen-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 0.2rem; }
.screen-sub { color: var(--muted); margin-bottom: 1.2rem; font-size: 0.95rem; }

/* ---- Anmeldung ---- */
#screen-login { display: none; flex-direction: column; justify-content: center; flex: 1; padding: 2rem 1.4rem; text-align: center; }
#screen-login.active { display: flex; }
.hero-marks { margin: 0 auto 1.4rem; max-width: 260px; }
.hero-marks svg { width: 100%; height: auto; }
.wordmark { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.wordmark .dot { color: var(--feuerrot); }
.brigade { margin-top: 0.35rem; }
.login-form { margin-top: 2rem; display: flex; flex-direction: column; gap: 0.7rem; text-align: left; }

.field { display: block; }
.field span { display: block; margin-bottom: 0.3rem; }
.input {
  width: 100%; padding: 0.85rem 0.9rem; border: 1.5px solid var(--line);
  border-radius: 10px; background: var(--surface);
}
.input:focus { outline: none; border-color: var(--feuerrot); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--tap); padding: 0 1.1rem; border-radius: 10px;
  background: var(--feuerrot); color: #fff; font-weight: 800;
  letter-spacing: 0.02em; width: 100%;
}
.btn:active { background: var(--feuerrot-d); }
.btn.ghost { background: transparent; color: var(--feuerrot); min-height: 44px; font-weight: 700; }
.btn.ghost:active { background: rgba(193,18,31,0.07); }
.btn.dark { background: var(--ink); }
.btn.dark:active { background: #000; }

.msg { min-height: 1.3rem; font-size: 0.88rem; color: var(--feuerrot); font-weight: 600; }
.msg.ok { color: var(--ok); }

/* ---- Mitgliederauswahl ---- */
.member-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.member-grid button {
  min-height: var(--tap); border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--surface); font-weight: 700; padding: 0.6rem;
}
.member-grid button:active { border-color: var(--feuerrot); background: #fff; }
.filter { margin-bottom: 0.9rem; }

/* ---- Getränkekarten ---- */
.drink-list { display: flex; flex-direction: column; gap: 0.7rem; }
.drink {
  position: relative; display: grid;
  grid-template-columns: 1fr auto; align-items: center; gap: 0.4rem 0.8rem;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 0.85rem 0.95rem;
  transition: transform 0.06s ease, border-color 0.12s ease;
}
.drink:active { transform: scale(0.985); border-color: var(--feuerrot); }
.drink .name { font-size: 1.1rem; font-weight: 800; }
.drink .price { color: var(--muted); font-size: 0.85rem; }
.drink .count {
  grid-column: 2; grid-row: 1 / span 2;
  font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums;
  min-width: 2ch; text-align: right;
}
.drink .count.pulse { animation: pulse 0.3s ease; }
.drink .tally { grid-column: 1 / -1; min-height: 30px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.drink .tally:empty::before { content: "noch keine"; color: var(--muted); font-size: 0.82rem; font-style: italic; }
.drink .undo {
  position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; border-radius: 50%;
  color: var(--muted); font-size: 1.2rem; line-height: 1; display: none;
}
.drink.has-count .undo { display: grid; place-items: center; }
.drink .undo:active { background: var(--line); color: var(--ink); }

/* Strichlisten-Glyphen */
.tally svg { display: block; height: 28px; width: auto; }
.tally .stroke { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.tally .fifth { stroke: var(--feuerrot); stroke-width: 2.6; stroke-linecap: round; }
.tally .draw { animation: draw 0.32s ease forwards; }

/* schwebendes +1 */
.plusone {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ok); font-weight: 800; font-size: 1.1rem; pointer-events: none;
  animation: floatUp 0.6s ease forwards;
}

/* ---- Admin ---- */
.tabs { display: flex; gap: 0.4rem; margin-bottom: 1.1rem; border-bottom: 1.5px solid var(--line); }
.tabs button {
  padding: 0.6rem 0.2rem; font-weight: 700; color: var(--muted);
  border-bottom: 2.5px solid transparent; flex: 1;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--feuerrot); }

.row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 0.5rem; align-items: center;
  padding: 0.7rem 0; border-bottom: 1px solid var(--line);
}
.row input[type=text] { width: 100%; padding: 0.55rem 0.6rem; border: 1.5px solid var(--line); border-radius: 8px; }
.row .price-in { width: 84px; }
.row .price-in input { width: 100%; padding: 0.55rem 0.4rem; border: 1.5px solid var(--line); border-radius: 8px; text-align: right; }
.row .save { background: var(--ink); color: #fff; border-radius: 8px; padding: 0.5rem 0.7rem; font-weight: 700; font-size: 0.85rem; min-height: 40px; }
.row .save:active { background: #000; }
.row .toggle { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; color: var(--muted); }
.row.inactive { opacity: 0.5; }

.add-row { margin-top: 1rem; }
.export-field { margin-bottom: 1rem; }
.export-dates { display: flex; gap: 0.7rem; }
.export-dates .field { flex: 1; }
.export-dates input { width: 100%; padding: 0.7rem 0.6rem; border: 1.5px solid var(--line); border-radius: 8px; }

.hint { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--feuerrot); border-radius: 8px; padding: 0.7rem 0.85rem; font-size: 0.85rem; color: var(--muted); margin-top: 1rem; }

@keyframes pulse { 0% { transform: scale(1); } 40% { transform: scale(1.28); color: var(--ok); } 100% { transform: scale(1); } }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(-50%); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-160%); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .drink, .plusone, .tally .draw, .count.pulse { animation: none !important; transition: none !important; }
}
