:root {
  color-scheme: light;
  --ink: #1b1b18;
  --muted: #6d6a61;
  --line: #dfd9cb;
  --paper: #fbf7ed;
  --panel: #fffdf7;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #b42318;
  --claimed: #316b2f;
  --pending: #9a5b00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(15,118,110,.10), transparent 40%),
    repeating-linear-gradient(0deg, rgba(27,27,24,.03), rgba(27,27,24,.03) 1px, transparent 1px, transparent 18px),
    var(--paper);
  color: var(--ink);
  font-family: ui-serif, Georgia, "Songti SC", "Noto Serif CJK SC", serif;
}

button, input, textarea {
  font: inherit;
}

.app-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
}

.hidden { display: none !important; }

.panel, .result-card, .dialog-card {
  background: rgba(255,253,247,.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 42px rgba(27, 27, 24, .08);
}

.auth-panel {
  margin-top: 10vh;
  padding: 20px;
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
  font-weight: 800;
  letter-spacing: .04em;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 25px; line-height: 1.15; }
p { color: var(--muted); }

.stack { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 14px 13px;
  font-size: 17px;
  outline: none;
}
textarea { min-height: 78px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,118,110,.14); }

.primary, .danger, .ghost {
  min-height: 46px;
  border-radius: 8px;
  border: 0;
  padding: 0 16px;
  font-weight: 800;
}
.primary { background: var(--accent); color: white; }
.primary:active { background: var(--accent-dark); }
.danger { background: #fff1ef; color: var(--danger); border: 1px solid #f1c4bd; }
.ghost {
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  text-decoration: none;
}
.error { color: var(--danger); min-height: 20px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.stats div {
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  padding: 13px;
}
.stats strong { display: block; font-size: 28px; line-height: 1; }
.stats span { display: block; margin-top: 5px; color: rgba(251,247,237,.72); font-size: 13px; }

.search-box {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 0 12px;
  background: linear-gradient(to bottom, var(--paper) 85%, transparent);
}
.search-box input { font-size: 20px; padding: 16px 14px; }

.results {
  display: grid;
  gap: 10px;
  padding-bottom: 80px;
}

.result-card {
  width: 100%;
  text-align: left;
  padding: 13px;
  border-color: var(--line);
}
.result-card h3 { font-size: 18px; line-height: 1.25; margin: 6px 0; }
.booth-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.badge {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.badge.pending { background: #fff4d6; color: var(--pending); }
.badge.claimed { background: #e8f4e6; color: var(--claimed); }
.company { font-size: 13px; line-height: 1.45; }
.claim-meta { margin-top: 8px; font-size: 12px; color: var(--claimed); }

dialog {
  width: min(720px, calc(100% - 18px));
  border: 0;
  padding: 0;
  background: transparent;
}
dialog::backdrop { background: rgba(27,27,24,.42); }
.dialog-card {
  padding: 16px;
  position: relative;
}
.close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  font-size: 30px;
  line-height: 1;
}
.detail-title { padding-right: 40px; margin-bottom: 12px; }
.detail-title h2 { font-size: 23px; margin: 4px 0; }
.detail-grid { display: grid; gap: 12px; }
.photo-preview {
  display: none;
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: #eee8db;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.full { grid-column: 1 / -1; }

@media (max-width: 420px) {
  .actions { grid-template-columns: 1fr; }
  h1 { font-size: 23px; }
}
