:root {
  --bg: #f7f5f0;
  --card: #ffffff;
  --ink: #232323;
  --muted: #6f6a60;
  --accent: #9a1f40;      /* deep charity red */
  --accent-ink: #ffffff;
  --gold: #b98a2f;
  --line: #e4dfd5;
  --ok: #1e7f4f;
  --warn: #b3541e;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans TC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 640px; margin: 0 auto; padding: 12px 14px 90px; }

header.appbar {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 14px 16px;
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
}
header.appbar h1 { font-size: 1.05rem; margin: 0; font-weight: 600; letter-spacing: .02em; }
header.appbar .who { font-size: .8rem; opacity: .9; }

nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
}
nav.tabs a {
  flex: 1; text-align: center; padding: 12px 4px 14px;
  text-decoration: none; color: var(--muted); font-size: .8rem; font-weight: 600;
}
nav.tabs a.active { color: var(--accent); }
nav.tabs a .ico { display: block; font-size: 1.25rem; line-height: 1.2; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin: 12px 0;
}
.card h2 { margin: 0 0 6px; font-size: 1.1rem; }
.card h3 { margin: 0 0 4px; font-size: 1rem; }
.muted { color: var(--muted); font-size: .85rem; }
.big { font-size: 1.6rem; font-weight: 700; }
.gold { color: var(--gold); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }

.lot-row { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.lot-row img {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 10px; flex-shrink: 0; background: var(--line);
}
.lot-row .info { flex: 1; min-width: 0; }
.lot-row .price { text-align: right; white-space: nowrap; }
.lot-photo {
  width: 100%; max-height: 260px; object-fit: cover;
  border-radius: var(--radius); background: var(--line);
}

button, .btn {
  appearance: none; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 1rem; font-weight: 600; padding: 13px 18px;
  width: 100%; cursor: pointer; display: block; text-align: center;
  text-decoration: none;
}
button.secondary, .btn.secondary {
  background: transparent; color: var(--accent);
  border: 1.5px solid var(--accent);
}
button.small { width: auto; padding: 8px 14px; font-size: .85rem; }
button:disabled { opacity: .45; }
.btnrow { display: flex; gap: 10px; }
.btnrow > * { flex: 1; }

input, select, textarea {
  width: 100%; font-size: 1rem; padding: 12px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font-family: inherit;
}
label { display: block; font-size: .85rem; font-weight: 600; margin: 12px 0 4px; }
.checkline { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.checkline input { width: auto; }

.presets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0; }
.presets button { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.presets button.sel { border-color: var(--accent); color: var(--accent); }

.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }
.closing { color: var(--warn); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: .55; } }

.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: .9rem; z-index: 50;
  box-shadow: 0 4px 18px rgba(0,0,0,.25); max-width: 90%;
  opacity: 0; transition: opacity .25s;
}
.toast.show { opacity: 1; }

.qrbox { text-align: center; padding: 8px 0; }
.qrbox svg { width: min(70vw, 280px); height: auto; }

.badge {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; vertical-align: middle;
}
.badge.open   { background: #e3f2e9; color: var(--ok); }
.badge.closed { background: #eee9e0; color: var(--muted); }
.badge.pledged{ background: #fdf1e3; color: var(--warn); }
.badge.paid   { background: #e3f2e9; color: var(--ok); }
.badge.voided { background: #f6e3e3; color: #a33; }

table.grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.grid th, table.grid td {
  text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.grid th { font-size: .75rem; text-transform: uppercase; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.center { text-align: center; }
.mt0 { margin-top: 0; }
.hidden { display: none !important; }
