:root {
  color-scheme: light;
  --ink: #1b2420;
  --muted: #5c675f;
  --paper: #f3f0e8;
  --card: #fffdf8;
  --line: #e3dccf;
  --green: #0e6b4f;
  --green-deep: #0b3d30;
  --ok: #157a45;
  --ok-bg: #e6f6ec;
  --no: #a12636;
  --no-bg: #fdecef;
  --maybe: #8d5b10;
  --maybe-bg: #fff3dc;
  --shadow: 0 12px 32px rgba(28, 36, 32, 0.06);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 320px at 0% -10%, #d7eee3, transparent 55%),
    var(--paper);
}

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

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

[hidden] { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: var(--green-deep);
  color: #f6faf7;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand span {
  margin-left: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.72;
}

main {
  width: min(1080px, calc(100% - 28px));
  margin: 22px auto 56px;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.15;
}

h2 { margin: 0 0 14px; font-size: 1.15rem; }

form, .stack { display: grid; gap: 12px; }

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.btn {
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.btn:disabled { opacity: 0.55; cursor: default; }

.btn.secondary, .btn.danger, .btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

a.btn { text-decoration: none; }

.btn.google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 16px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.account {
  margin: 0 auto 0 12px;
  font-size: 0.85rem;
  opacity: 0.85;
}

.btn.danger { color: var(--no); border-color: #f0c4ca; }

.topbar .btn.secondary {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: transparent;
}

.hint { color: var(--muted); font-size: 0.92rem; margin: 12px 0 0; }

.message {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
}

.message.ok { background: var(--ok-bg); color: var(--ok); }
.message.warn { background: var(--maybe-bg); color: var(--maybe); }
.message.error { background: var(--no-bg); color: var(--no); }

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.summary li {
  min-width: 128px;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f6f3ec;
}

.summary strong { font-size: 1.35rem; line-height: 1; }
.summary span { color: var(--muted); font-size: 0.85rem; }

.grid-scroll { overflow-x: auto; margin: 0 -6px; padding: 0 6px 4px; }

.avail {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.avail th, .avail td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  background: var(--card);
}

.avail thead th {
  color: var(--muted);
  font-size: 0.85rem;
}

.avail .totals th, .avail .totals td {
  color: var(--green);
  font-weight: 800;
}

.avail th:first-child, .avail td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
}

.avail thead th:first-child { z-index: 2; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-no { background: var(--no-bg); color: var(--no); }
.pill-maybe { background: var(--maybe-bg); color: var(--maybe); }

fieldset {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

legend { margin-bottom: 8px; font-weight: 800; }

.seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.seg button {
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-weight: 700;
}

.seg button[aria-pressed="true"][data-value="OK"] {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok);
}

.seg button[aria-pressed="true"][data-value="NO"] {
  background: var(--no-bg);
  color: var(--no);
  border-color: var(--no);
}

.seg button[aria-pressed="true"][data-value="MAYBE"] {
  background: var(--maybe-bg);
  color: var(--maybe);
  border-color: var(--maybe);
}

.seg button:disabled:not([aria-pressed="true"]) { opacity: 0.5; }

.admin-layout { display: grid; gap: 16px; }

.editor {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.stack-list, .poll-list, .chips, .vote-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.player-row, .poll-row, .vote-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.player-row.is-hidden { opacity: 0.62; }

.row-actions, .inline-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.row-actions .btn, .inline-actions .btn, .chip button {
  min-height: 40px;
  padding: 0 10px;
  font-size: 0.92rem;
}

.chips { display: flex; flex-wrap: wrap; }

.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 12px;
  border-radius: 999px;
  background: #f6f3ec;
}

.chip button {
  width: 36px;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 800;
}

.date-add {
  display: grid;
  gap: 8px;
}

.code {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f6f3ec;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.tag {
  justify-self: start;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--maybe-bg);
  color: var(--maybe);
  font-size: 0.78rem;
  font-weight: 800;
}

@media (min-width: 720px) {
  .card { padding: 22px; }
  .date-add { grid-template-columns: 1fr auto; align-items: end; }
  .player-row { grid-template-columns: 1fr auto; align-items: center; }
}

@media (min-width: 960px) {
  .admin-layout { grid-template-columns: 340px 1fr; align-items: start; }
}
