:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #1c1a17;
  --muted: #6b6560;
  --accent: #7a3b2e;
  --accent-ink: #ffffff;
  --line: #e3ded7;
  --line-strong: #cdc5ba;
  --ok-bg: #e8f1e8;
  --ok-ink: #2f5d3a;
  --err-bg: #f9e9e6;
  --err-ink: #8c3121;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap { max-width: 1240px; margin: 0 auto; }  /* wide enough for the category line */
.wrap.narrow { max-width: 640px; }

.site-header {
  padding: 2.25rem 0 1.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}
.site-header h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; }
.tagline { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.95rem; }

.card {
  margin-bottom: 1.25rem;
  padding: 1.35rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card > h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* --- fields --- */
.grid { display: grid; gap: 0.9rem 1.1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.field .req { color: var(--accent); }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"] {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: var(--ink);
  width: 100%;
}
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
input:disabled { background: #f2efea; color: #a9a29a; }

/* --- bottle table --- */
.table-scroll { overflow-x: auto; margin: 0 -0.25rem; }
table.bottles { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 760px; }
table.bottles th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  padding: 0 0.4rem 0.5rem;
  white-space: nowrap;
}
table.bottles td { padding: 0.2rem 0.4rem; vertical-align: middle; }
table.bottles input[type="text"], table.bottles input[type="number"] { padding: 0.4rem 0.5rem; }
.col-num { width: 2.5rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; font-size: 0.8rem; }
.col-item { width: 9rem; }
.col-check { width: 5.5rem; text-align: center; }
.col-price { width: 8rem; }
.col-x { width: 2.2rem; }
table.bottles td.col-check { text-align: center; }
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); cursor: pointer; }
.price-input { display: flex; align-items: center; }
.price-input .currency { padding: 0 0.35rem 0 0; color: var(--muted); }
.price-input input { min-width: 0; }

.row-remove {
  border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 1.1rem; line-height: 1;
  padding: 0.25rem 0.4rem; border-radius: 4px;
}
.row-remove:hover { background: var(--err-bg); color: var(--err-ink); }

/* --- buttons --- */
.actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
button, .btn {
  font: inherit;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
button.primary:hover, .btn.primary:hover { background: #632f24; color: #fff; }
button:disabled { opacity: 0.55; cursor: default; }
.hint { color: var(--muted); font-size: 0.85rem; }

/* --- messages --- */
.msg { padding: 0.7rem 0.9rem; border-radius: 6px; font-size: 0.92rem; margin-bottom: 1rem; }
.msg.ok { background: var(--ok-bg); color: var(--ok-ink); }
.msg.error { background: var(--err-bg); color: var(--err-ink); }
.msg[hidden] { display: none; }

/* --- admin --- */
table.list { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.list th {
  text-align: left; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); font-weight: 600;
  padding: 0 0.5rem 0.5rem; border-bottom: 1px solid var(--line);
}
table.list td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pill {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 99px;
  font-size: 0.75rem; font-weight: 600;
}
.pill.waiting { background: #f0ece5; color: var(--muted); }
.pill.done { background: var(--ok-bg); color: var(--ok-ink); }
code.link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem; color: var(--muted); word-break: break-all;
}
.empty { padding: 2rem 0; text-align: center; color: var(--muted); }

/* --- save-your-link / resume cards --- */
.card.savelink { border-color: var(--accent); border-width: 2px; }
.card.savelink h2 { color: var(--accent); }
.card.resume { background: #fbf7f0; }
.linkrow { display: flex; gap: 0.5rem; margin-top: 0.9rem; }
.linkrow input {
  flex: 1 1 auto; min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  background: #fff;
}
.linkrow button { flex: 0 0 auto; }
.card[hidden], .msg[hidden] { display: none; }
.pill.dupe { background: #fbeee0; color: #8a5a1c; }

/* --- section subheadings and per-field help --- */
.optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-size: 0.85em;
}
.subhead {
  margin: -0.5rem 0 1.15rem;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 62ch;
}
.subhead a { color: var(--accent); }

dl.fieldhelp {
  margin: 0 0 1.35rem;
  padding: 0.95rem 1.1rem;
  background: #faf9f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.88rem;
  max-width: 74ch;
}
dl.fieldhelp dt {
  font-weight: 700;
  color: var(--ink);
  margin-top: 0.7rem;
}
dl.fieldhelp dt:first-child { margin-top: 0; }
dl.fieldhelp dd {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

/* hidden inputs (e.g. unicorn price on a non-unicorn row) must actually vanish */
[hidden] { display: none !important; }

/* --- per-bottle category line --- */
tbody.bottle { border-bottom: 1px solid var(--line); }
tbody.bottle:last-child { border-bottom: none; }
tbody.bottle:nth-of-type(even) { background: #faf9f7; }
table.bottles tbody.bottle tr.brow td { padding-top: 0.5rem; }
table.bottles tbody.bottle tr.crow td { padding-bottom: 0.6rem; }

td.cats { padding-left: 0.4rem; white-space: nowrap; }
.catlabel {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.6rem;
  white-space: nowrap;
}
label.cat {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-right: 0.7rem;
  font-size: 0.82rem;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.9;
}
label.cat:last-child { margin-right: 0; }
label.cat input[type="checkbox"] { width: 0.95rem; height: 0.95rem; }

/* --- Rumcast Fantasy Draft modal --- */
dialog#draftmodal {
  width: min(640px, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(28, 26, 23, 0.22);
}
dialog#draftmodal::backdrop { background: rgba(28, 26, 23, 0.45); }

.modalhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.modalhead h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.modalclose {
  border: none; background: none; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: var(--muted);
  padding: 0 0.2rem; border-radius: 4px;
}
.modalclose:hover { background: var(--err-bg); color: var(--err-ink); }

.modalbody {
  padding: 0.4rem 1.35rem 0.25rem;
  max-height: min(60vh, 30rem);
  overflow-y: auto;
  font-size: 0.92rem;
}
.modalbody p { margin: 0 0 0.85rem; }

.modalfoot {
  padding: 0.85rem 1.35rem 1.15rem;
  display: flex;
  justify-content: flex-end;
}

dl.fieldhelp a { color: var(--accent); font-weight: 600; }

/* --- access code gate --- */
.card.gate { border-color: var(--accent); border-width: 2px; max-width: 34rem; }
.card.gate h2 { color: var(--accent); }
.card.gate .msg { margin: 0.9rem 0 0; }
