:root {
  --bg: #141210;
  --bg-2: #1c1916;
  --panel: #221e1a;
  --line: #3a322b;
  --line-strong: #5a4c3f;
  --text: #f2ebe1;
  --muted: #9a8d7d;
  --gold: #d4a35c;
  --gold-dim: #a67c3d;
  --ok: #6f9f72;
  --warn: #c9893a;
  --bad: #c45b4a;
  --bad-bg: rgba(196, 91, 74, 0.18);
  --ok-bg: rgba(111, 159, 114, 0.14);
  --radius: 14px;
  --font: "IBM Plex Sans", sans-serif;
  --mono: "IBM Plex Mono", monospace;
  --tap: 48px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 480px at 0% -10%, #2a2118 0%, transparent 55%),
    radial-gradient(700px 420px at 100% 0%, #1a2420 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

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

body {
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(20, 18, 16, 0.94);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + var(--safe-t)) 16px 12px;
}

.brand-mark {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--gold);
  line-height: 1;
}
.brand-sub {
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 0 4px var(--safe-b);
  background: rgba(20, 18, 16, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.bottom-nav button {
  min-height: var(--nav-h);
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.bottom-nav button.active { color: var(--gold); }
.nav-icon {
  font-size: 16px;
  line-height: 1;
  opacity: 0.9;
}

main {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 14px 28px;
}

h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.lede {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.venue-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.venue-card {
  min-height: 72px;
  text-align: left;
  background: linear-gradient(180deg, #2a241e, var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px;
  cursor: pointer;
  transition: border-color .15s, transform .12s;
}
.venue-card:active { transform: scale(0.985); border-color: var(--gold-dim); }
.venue-card .name {
  font-family: var(--mono);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  color: var(--gold);
}
.venue-card .meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.bar .spacer { flex: 1; }

.btn {
  min-height: var(--tap);
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: var(--gold);
  color: #1a140e;
  border-color: var(--gold);
}
.btn.ghost { background: transparent; }
.btn.danger {
  background: var(--bad-bg);
  border-color: var(--bad);
  color: #f0c2ba;
}
.btn.block { width: 100%; }
.btn.small {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field textarea {
  min-height: var(--tap);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px; /* prevents iOS zoom */
  outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--gold-dim); }

.progress {
  height: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin: 4px 0 14px;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  width: 0%;
  transition: width .2s;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.stat .v {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gold);
}
.stat .k {
  margin-top: 2px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.cat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--panel);
}
.cat-head {
  width: 100%;
  min-height: var(--tap);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 14px 14px;
  background: #2a241e;
  border: none;
  cursor: pointer;
  text-align: left;
}
.cat-head .title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cat-head .count {
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--mono);
}
.cat-body { display: none; }
.cat.open .cat-body { display: block; }

/* Mobile-first item card (stacked), not a cramped 4-column table */
.item-card {
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(58, 50, 43, 0.75);
}
.item-card:last-child { border-bottom: none; }
.item-card.done { background: rgba(111, 159, 114, 0.06); }
.item-card.short { background: rgba(196, 91, 74, 0.07); }

.item-name {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 10px;
}

.item-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.chip {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: var(--bg);
}
.chip .label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.chip .value {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 600;
}
.chip.short .value { color: #f0c2ba; }
.chip.ok .value { color: var(--ok); }

.counter {
  display: grid;
  grid-template-columns: var(--tap) 1fr var(--tap);
  gap: 8px;
  align-items: center;
}
.counter button {
  width: var(--tap);
  height: var(--tap);
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #2a241e;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.counter button:active { background: #3a322b; }
.counter input {
  width: 100%;
  height: var(--tap);
  text-align: center;
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 600;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  outline: none;
}
.counter input:focus { border-color: var(--gold); }

.quick-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.sticky-actions {
  position: sticky;
  bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
  z-index: 15;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  padding: 10px;
  margin: 16px -4px 0;
  background: rgba(20, 18, 16, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  backdrop-filter: blur(10px);
}
.sticky-actions .btn { width: 100%; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  min-height: 64px;
}
.card .title-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.card .title-row strong {
  font-family: var(--mono);
  letter-spacing: 0.06em;
  font-size: 1.05rem;
}
.card .meta { color: var(--muted); font-size: 0.85rem; margin-top: 6px; line-height: 1.35; }
.badge {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge.open { color: var(--warn); border-color: var(--warn); }
.badge.done { color: var(--ok); border-color: var(--ok); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: #2f281f;
  border: 1px solid var(--gold-dim);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.import-box {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  background: rgba(34, 30, 26, 0.7);
}
.import-box input[type=file] {
  margin-top: 14px;
  width: 100%;
  min-height: var(--tap);
}
.hint { color: var(--muted); font-size: 0.9rem; line-height: 1.45; }

/* Wider phones / tablets: still keep single-column stocktake for thumb reach */
@media (min-width: 640px) {
  .venue-grid { grid-template-columns: 1fr 1fr; }
  main { max-width: 720px; padding: 20px 20px 36px; }
  .brand-mark { font-size: 30px; }
}
