:root {
  --ink: #141414;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --surface: #ffffff;
  --bg: #f6f6f6;
  --radius: 10px;
  --font: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────── gate ─────────────────────────────── */
.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.gate-card {
  width: 100%;
  max-width: 22rem;
  padding: 2rem 1.75rem;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  text-align: center;
}
.gate-card h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
.gate-sub { margin: 0.25rem 0 1.4rem; color: var(--muted); font-size: 0.9rem; }
.gate-or {
  position: relative;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.gate-or::before {
  content: '';
  position: absolute;
  inset: 50% 0 auto;
  border-top: 1px solid var(--line);
}
.gate-or span { position: relative; background: var(--surface); padding: 0 0.6rem; }
#login-form { display: flex; flex-direction: column; gap: 0.55rem; }
.gate-error { margin: 0; color: #c0392b; font-size: 0.85rem; min-height: 1.1em; }

input[type=text], input[type=password], input[type=file], select {
  width: 100%;
  padding: 0.7rem 0.75rem;
  font: inherit;
  /* 16px minimum: below it iOS zooms the page in on focus and never zooms back. */
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.btn-primary, .btn-ghost {
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius);
  cursor: pointer;
}
.btn-primary { border: none; background: var(--ink); color: #fff; }
.btn-ghost { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.btn-ghost.small { padding: 0.4rem 0.7rem; font-size: 0.82rem; font-weight: 600; }

/* ─────────────────────────────── shell ─────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar .back {
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
  padding: 0.2rem 0.4rem;
}
.topbar-title { margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; }
.venue-tag {
  margin-right: auto;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* ─────────────────────────── tool layout ─────────────────────────── */
.tool {
  display: grid;
  grid-template-columns: 20rem 1fr;
  height: calc(100dvh - 3.4rem);
}
@media (max-width: 860px) {
  .tool { grid-template-columns: 1fr; height: auto; }
}
.panel {
  padding: 1rem;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.panel section { margin-bottom: 1.4rem; }
.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.stack { display: block; margin-bottom: 0.5rem; font-size: 0.82rem; color: var(--muted); }
.stack input { margin-top: 0.25rem; }
.opt { font-weight: 400; text-transform: none; letter-spacing: 0; }
.hint { margin: 0.4rem 0; font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.check { display: flex; align-items: center; gap: 0.45rem; font-size: 0.88rem; }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.chip:hover { border-color: var(--ink); }
.chip-on { background: var(--ink); border-color: var(--ink); color: #fff; }

.preview-wrap {
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow: auto;
  background: var(--bg);
}
.preview-scale { transform-origin: top left; }

/* ──────────────────────────── the sheet ────────────────────────────
   Built at true A3 millimetres so the preview is the artwork: printing
   needs no second layout, and nothing can drift between the two. */
.sheet {
  --brand: #8A184B;
  position: relative;
  background: #fff;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.14);
}
.sheet[data-orient='portrait'] { width: 297mm; height: 420mm; }
.sheet[data-orient='landscape'] { width: 420mm; height: 297mm; }

.sheet-inner {
  position: absolute;
  inset: 10mm;
  border: 4mm solid var(--brand);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12mm 14mm;
}
.sheet-customer-logo {
  max-height: 38mm;
  max-width: 60%;
  object-fit: contain;
  margin-bottom: auto;
}
.sheet-middle {
  margin: auto 0;
  text-align: center;
  width: 100%;
}
.sheet-text {
  margin: 0;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--brand);
  overflow-wrap: break-word;
}
.sheet-sub {
  margin: 6mm 0 0;
  font-size: 11mm;
  font-weight: 600;
  color: var(--brand);
}
.sheet-arrow {
  width: 70mm;
  height: 28mm;
  margin: 8mm auto 0;
  color: var(--brand);
}
.sheet-venue {
  margin-top: auto;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.sheet-venue img { max-height: 30mm; max-width: 55%; object-fit: contain; }
.sheet-wordmark {
  font-size: 9mm;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--brand);
}

/* ──────────────────────────── printing ──────────────────────────── */
@page { size: A3; margin: 0; }

@media print {
  body { background: #fff; }
  [data-no-print], .panel, .topbar, .gate { display: none !important; }
  .preview-wrap { padding: 0; overflow: visible; display: block; }
  /* Undo the on-screen fitting so the sheet prints at its real size. */
  .preview-scale { transform: none !important; width: auto !important; height: auto !important; }
  .sheet { box-shadow: none; }
}
