:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --pos: #047857;
  --neg: #b91c1c;
  --warn: #92400e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: #111827;
  color: #fff;
}
.topbar a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.topbar nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.who { color: #9ca3af; }

main { max-width: 1080px; margin: 0 auto; padding: 24px; }
h1 { margin: 8px 0 18px; font-size: 28px; }
h2 { margin: 24px 0 12px; font-size: 20px; }
h3 { margin: 18px 0 8px; font-size: 15px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.warn { color: var(--warn); }

.flash {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.flash.warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}
.card h2:first-child, .card h1:first-child { margin-top: 0; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 10px 0 20px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat b { font-size: 18px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin: 8px 0 18px;
}
th, td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}
th { background: #f9fafb; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
tr:last-child td { border-bottom: none; }
td.pos { color: var(--pos); font-weight: 600; }
td.neg { color: var(--neg); font-weight: 600; }

form.stack { display: flex; flex-direction: column; gap: 10px; }
form.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.row.compact input { min-width: 130px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
label.checkline { flex-direction: row; align-items: center; gap: 8px; }
input, select, button, textarea {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
}
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--accent); }

button, .button {
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-block;
}
button.primary, .button.primary {
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 9px;
}
button.primary:hover { background: var(--accent-dark); }
button.ghost, .button.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 9px;
}
button.danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--neg);
  padding: 9px 14px;
  border-radius: 9px;
}
button.icon {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 15px;
}
button.icon:hover { color: var(--neg); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.spaced { margin-top: 14px; }
.danger-zone { margin-top: 24px; }

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
}
.badge.open { background: #ecfdf5; color: #047857; }
.badge.closed { background: #f3f4f6; color: #4b5563; }
.badge.alcohol { background: #fff7ed; color: #c2410c; }

.transfers { padding-left: 20px; }
.transfers li { margin: 6px 0; }
.transfers span { margin-left: 8px; font-weight: 600; }

.narrow { max-width: 460px; margin: 20px auto; }
.login-code {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  text-align: center;
}
.login-code .label { color: var(--muted); font-size: 13px; }
.login-code .code {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 8px;
  margin: 8px 0 14px;
}
pre {
  background: #f3f4f6;
  padding: 10px 14px;
  border-radius: 9px;
  overflow-x: auto;
}

.families input[type=number] { width: 90px; }
.examples { max-width: 360px; color: var(--muted); font-size: 13px; }

textarea {
  width: 100%;
  resize: vertical;
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.poster-item {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.poster-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #f3f4f6;
}
.poster-item figcaption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

@media (max-width: 640px) {
  main { padding: 14px; }
  .topbar { padding: 12px 14px; }
  .topbar nav { gap: 10px; }
  th, td { padding: 8px; }
  h1 { font-size: 23px; }
}
