:root {
  --bg: #faf7f5; --surface: #fff; --text: #2a2024; --muted: #7a6b70; --line: #eadfe2;
  --accent: #6d1a36; --accent-soft: #f5e8ec; --ok: #2f6b3a; --warn: #9a5b00;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17121a; --surface: #221b24; --text: #f2ecee; --muted: #a8999e; --line: #3a2f3c;
    --accent: #e0839f; --accent-soft: #3a2230; --ok: #7fc08a; --warn: #e0a54a;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--accent); text-decoration: none; }
nav { display: flex; align-items: center; gap: 16px; font-size: 15px; }
nav a { color: var(--text); text-decoration: none; }
nav form { margin: 0; }
main { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 28px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin: 12px 0;
}
.houses { display: grid; gap: 12px; margin-top: 16px; }
.houses .card { margin: 0; }
.house { display: flex; justify-content: space-between; align-items: baseline; }
.house .count { font-size: 28px; font-weight: 700; color: var(--accent); }
.house small { display: block; color: var(--muted); font-size: 14px; }
.button, button {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  padding: 12px 18px; border-radius: 10px; border: 0;
  background: var(--accent); color: #fff; text-decoration: none; min-height: 44px;
}
.button.secondary, button.secondary { background: var(--accent-soft); color: var(--accent); }
button.link { background: none; color: var(--text); padding: 0; min-height: 0; font-weight: 400; font-size: 15px; }
input, select {
  font: inherit; width: 100%; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); min-height: 44px;
}
label { display: block; font-weight: 600; margin: 12px 0 6px; }
.row { display: flex; gap: 8px; align-items: center; }
.people { list-style: none; padding: 0; margin: 0; }
.people li { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.status-ok { color: var(--ok); font-size: 14px; }
.status-wait { color: var(--warn); font-size: 14px; }
.invite-link { font-family: ui-monospace, Menlo, monospace; font-size: 14px; word-break: break-all;
  background: var(--accent-soft); padding: 12px; border-radius: 10px; margin: 8px 0 12px; }
.tg-login, .dev-login { margin: 20px 0; }
.dev-login .button { margin: 4px 4px 4px 0; }
a { color: var(--accent); }
.card > h2:first-child { margin-top: 0; }

/* Cellar screens */
a.card { display: block; color: inherit; text-decoration: none; }
a.card.house { display: flex; }
a.card:active { background: var(--accent-soft); }
.search { margin: 16px 0; }
.search input { background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%237a6b70' stroke-width='2'%3E%3Ccircle cx='9' cy='9' r='6'/%3E%3Cpath d='m14 14 4 4'/%3E%3C/svg%3E") no-repeat 12px center; padding-left: 40px; }
.crumbs { font-size: 15px; margin-bottom: 4px; }
.crumbs a { text-decoration: none; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.title-row h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 0 8px; }
.chip { flex: none; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); text-decoration: none; font-size: 15px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.lines { list-style: none; padding: 0; margin: 8px 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.lines li { border-bottom: 1px solid var(--line); }
.lines li:last-child { border-bottom: 0; }
.lines li > a, .lines.plain li { display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  color: inherit; text-decoration: none; }
.lines li > a > span:nth-child(2), .lines.plain li > span:first-child { flex: 1; min-width: 0; }
.lines small { color: var(--muted); font-size: 14px; }
.lines .qty { font-size: 20px; font-weight: 700; color: var(--accent); min-width: 2ch; text-align: right; }
.lines .where { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0 16px 12px 38px; font-size: 14px; color: var(--muted); }
.lines .where strong { color: var(--text); }
.dot { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15); vertical-align: middle; }
.dot.red { background: #8b1e3f; } .dot.white { background: #f1e3a6; } .dot.rose { background: #f4a7b9; }
.dot.orange { background: #e79a3c; } .dot.sparkling { background: #e8e2c8; box-shadow: inset 0 0 0 2px #c9b96a; }
.dot.sweet { background: #d4a017; } .dot.fortified { background: #5a1a2a; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.wtag { display: inline-block; font-size: 12px; font-weight: 600; padding: 0 7px; border-radius: 999px;
  border: 1px solid var(--accent); color: var(--accent); margin: 3px 2px 0 0; vertical-align: middle; }
.chip.tagchip { border-style: dashed; }
.notice { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; }
.notice form { margin: 0; }
button.small, .button.small { padding: 6px 12px; min-height: 36px; font-size: 15px; }
.error { color: #b3261e; font-weight: 600; }
.card.warn { border-color: var(--warn); }
.card.empty { text-align: center; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.suggest { color: var(--warn); }
.card.suggest-box { border-color: var(--warn); }
.card.suggest-box h2 { margin-top: 0; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; min-height: 44px; margin: 0; }
label.check input { width: auto; min-height: 0; }
details { margin: 16px 0 0; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; }
textarea { font: 14px/1.4 ui-monospace, Menlo, monospace; width: 100%; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
.sticky-confirm { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0;
  background: linear-gradient(transparent, var(--bg) 30%); z-index: 1; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
label.choice { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; min-height: 44px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
label.choice input { width: auto; min-height: 0; accent-color: var(--accent); }
label.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
details.card > summary { padding: 2px 0; }
details.card[open] > summary { margin-bottom: 4px; }
.notes { list-style: none; padding: 0; margin: 0; }
.notes li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.stars { color: var(--warn); letter-spacing: 1px; }
.lines li.with-action { display: flex; align-items: center; }
.lines li.with-action > a { flex: 1; min-width: 0; padding-right: 8px; }
.lines li.with-action > form { margin: 0 12px 0 0; flex: none; }
.lines li.row-line { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.lines li.row-line > span:nth-child(2) { flex: 1; min-width: 0; }
.lines li.row-line form { margin: 0; display: flex; align-items: center; gap: 6px; flex: none; }
.qty-input { width: 56px; min-height: 36px; padding: 6px; text-align: center; }
.dot.trip { background: var(--accent-soft); border-color: var(--accent); }
.actions form { margin: 0; }
.incoming { margin: 0 0 12px; }
.incoming a { display: block; padding: 10px 14px; border-radius: 12px; border: 1px dashed var(--accent); text-decoration: none; font-weight: 600; }
.history { list-style: none; padding: 0; margin: 8px 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; }
.history li { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history .h-main { flex: 1; display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.history small { font-size: 14px; }
.history li.voided .h-what { text-decoration: line-through; color: var(--muted); }
.history form { margin: 0; flex: none; }

.sticky-confirm label.check { flex-basis: 100%; }

/* Telegram photos to check (F2, F8) */
a.card.prompt { border-color: var(--accent); background: var(--accent-soft); }
a.card.prompt small { display: block; color: var(--muted); font-size: 14px; }
.card.draft { display: flex; gap: 16px; align-items: flex-start; }
.card.draft h2 { margin: 0 0 4px; font-size: 19px; }
.card.draft p { margin: 4px 0; }
.card.draft .actions { margin: 12px 0 8px; }
.card.draft .actions form { margin: 0; }
.label-photo { width: 112px; height: 150px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex: none; }
.label-photo.large { width: auto; height: auto; max-width: 100%; max-height: 420px; object-fit: contain; }
.unsure { color: var(--warn); font-size: 15px; }
@media (max-width: 420px) { .label-photo { width: 84px; height: 112px; } }
