/* Farben: Papier und Ziegelrot, im Dunkelmodus umgekehrt. */
:root {
  --bg: #f4efe4;
  --surface: #fffdf7;
  --ink: #2b211e;
  --muted: #6e625c;
  --line: #d9d1bf;
  --accent: #a4372a;
  --accent-ink: #ffffff;
  --accent-soft: #f4ddd6;
  --danger: #a4372a;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191413;
    --surface: #231c1a;
    --ink: #efe7e1;
    --muted: #a8998f;
    --line: #3d3230;
    --accent: #ee8f7d;
    --accent-ink: #2b0e0a;
    --accent-soft: #40241f;
    --danger: #ee8f7d;
    color-scheme: dark;
  }
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

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

h1 {
  margin: 0 0 16px;
  font-size: 1.7rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

h2 {
  margin: 32px 0 8px;
  font-size: 1.25rem;
  line-height: 1.2;
}

p {
  margin: 0 0 16px;
}

a {
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* --- Rahmen --- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: #80231a;
  color: #ffffff;
}

.topbar a {
  padding: 6px 0;
  color: inherit;
  font-size: 0.9rem;
  text-decoration: none;
}

.topbar a:focus-visible {
  outline-color: #ffffff;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
}

.brand svg,
.marks svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 104px;
}

.narrow {
  max-width: 420px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-head h1 {
  margin: 0;
}

.stack {
  display: grid;
  gap: 16px;
}

/* --- Bedienelemente --- */

button,
.button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

button:hover,
.button:hover {
  border-color: var(--accent);
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.danger {
  color: var(--danger);
}

.quiet {
  border-color: transparent;
  background: none;
  color: var(--muted);
}

.quiet:hover {
  border-color: transparent;
  text-decoration: underline;
}

input,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 1rem; /* unter 16px zoomt iOS beim Antippen */
}

input[type="search"] {
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

input[type="checkbox"] {
  flex: none;
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
}

/* --- Namen und Getränke --- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.last a {
  display: inline-block;
  margin-left: 4px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.back {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 8px 0;
  color: var(--accent);
  text-decoration: none;
}

.open {
  margin: 0;
  text-align: right;
  white-space: nowrap;
}

.open small {
  display: block;
  color: var(--muted);
}

.open strong {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.drink {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2px;
  min-height: 140px;
  border-radius: var(--radius);
  text-align: left;
}

.drink-name {
  font-size: 1.1rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.drink-price {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.marks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-height: 24px;
  margin-top: auto;
  padding-top: 12px;
  box-sizing: content-box;
  color: var(--accent);
}

.drink-count {
  color: var(--muted);
  font-size: 0.9rem;
}

.pop {
  animation: pop 0.35s ease-out;
}

@keyframes pop {
  30% {
    transform: scale(0.96);
    border-color: var(--accent);
    background: var(--accent-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pop {
    animation: none;
  }
}

/* --- Hinweis am unteren Rand --- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 32px);
  min-height: 56px;
  padding: 8px 8px 8px 20px;
  border-radius: 28px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.25);
  transform: translateX(-50%);
}

.toast span:only-child {
  padding-right: 12px;
}

.toast button {
  min-height: 40px;
  border: 0;
  border-radius: 20px;
  background: var(--bg);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

/* --- Verwaltung --- */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
}

.tabs [aria-current] {
  border-bottom-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.table-wrap {
  margin-bottom: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  height: 52px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

thead th {
  color: var(--muted);
  font-size: 0.85rem;
  vertical-align: bottom;
  white-space: normal;
}

/* Die Namensspalte bleibt stehen, wenn die Tabelle seitlich scrollt. */
tr > th:first-child {
  position: sticky;
  left: 0;
  max-width: 40vw;
  overflow: hidden;
  background: var(--surface);
  text-overflow: ellipsis;
}

/* Auf der Startseite führt der Name zur Anmeldung. */
tbody th a {
  display: block;
  overflow: hidden;
  line-height: 40px;
  text-decoration: none;
  text-overflow: ellipsis;
}

/* Die eigene Zeile in der Übersicht aller Mitglieder. */
tr.mine > th:first-child,
tr.mine > td {
  background: var(--accent-soft);
}

tfoot th,
tfoot td {
  border-bottom: 0;
  font-weight: 600;
}

@media (max-width: 600px) {
  th,
  td {
    padding: 6px 8px;
  }
}

.num {
  text-align: right;
}

.small {
  min-height: 36px;
  padding: 4px 12px;
}

.minus {
  width: 28px;
  min-height: 28px;
  margin-left: 8px;
  padding: 0;
  border-radius: 50%;
  color: var(--muted);
}

.rows {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rows li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.row-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.row-form > :first-child {
  flex: 1 1 180px;
}

.row-form > .price {
  flex: 0 1 110px;
}

.user-row,
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.user-row > :first-child {
  flex: 1 1 120px;
  overflow-wrap: anywhere;
}
