/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark:   #2d7a3c;
  --green:        #3a9e50;
  --green-light:  #e8f5e9;
  --amber:        #f57c00;
  --amber-light:  #fff8e1;
  --red:          #c62828;
  --red-light:    #ffebee;
  --blue:         #1565c0;
  --blue-light:   #e3f2fd;
  --text:         #1a1a1a;
  --text-muted:   #666;
  --border:       #ddd;
  --bg:           #f4f6f4;
  --card-bg:      #ffffff;
  --nav-bg:       #1c4d27;
  --radius:       8px;
  --shadow:       0 1px 4px rgba(0,0,0,0.10);
}

html { font-size: 16px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
       color: var(--text); background: var(--bg); line-height: 1.5; }

a { color: var(--green-dark); }
a:hover { color: var(--green); }

/* ── Typography helpers ──────────────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 0.85rem; }
.text-warning { color: var(--amber); }
.required     { color: var(--red); }
.optional     { color: var(--text-muted); font-size: 0.85em; font-weight: 400; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.2rem;
  min-height: 44px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary  { background: var(--green-dark); color: white; border-color: var(--green-dark); }
.btn-primary:hover { background: var(--green); border-color: var(--green); color: white; }

.btn-success  { background: #1b5e20; color: white; border-color: #1b5e20; }
.btn-success:hover { background: var(--green-dark); border-color: var(--green-dark); color: white; }

.btn-outline  { background: transparent; color: var(--green-dark); border-color: var(--green-dark); }
.btn-outline:hover { background: var(--green-light); }

.btn-ghost    { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: #eee; }

.btn-danger   { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { background: #b71c1c; }

.btn-sm  { padding: 0.3rem 0.75rem; font-size: 0.85rem; }
/* Staff UI: allow compact buttons in table rows */
.staff-body .btn-sm { min-height: auto; height: 30px; padding-top: 0; padding-bottom: 0; }
.btn-large { padding: 0.8rem 2rem; font-size: 1.1rem; width: 100%; }

.btn-link { background: none; border: none; padding: 0; font: inherit; cursor: pointer;
            color: rgba(255,255,255,0.8); text-decoration: underline; }
.btn-link:hover { color: white; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { padding: 0.85rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.95rem; }
.alert ul { margin-left: 1.2rem; }
.alert-error   { background: var(--red-light);  color: var(--red);  border-left: 4px solid var(--red); }
.alert-success { background: var(--green-light); color: var(--green-dark); border-left: 4px solid var(--green-dark); }
.alert-info    { background: var(--blue-light);  color: var(--blue); border-left: 4px solid var(--blue); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.form-row   { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }

label { font-weight: 600; font-size: 0.9rem; }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=date], input[type=number], select, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  min-height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;      /* 16px minimum — prevents iOS auto-zoom on focus */
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45,122,60,0.15);
}
textarea { resize: vertical; min-height: 100px; }
select { cursor: pointer; }

.form-check { flex-direction: row; align-items: center; }
.check-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 400;
  min-height: 44px;           /* entire label row is the tap target */
  padding: 0.25rem 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.check-label input[type=checkbox] {
  width: 1.5rem;
  height: 1.5rem;
  min-width: 1.5rem;          /* prevent flex shrink */
  cursor: pointer;
  accent-color: var(--green-dark);
  flex-shrink: 0;
}

.form-actions { display: flex; gap: 1rem; margin-top: 0.5rem; }
.form-submit  { margin-top: 1.5rem; text-align: center; }
.submit-note  { margin-top: 0.5rem; color: var(--text-muted); font-size: 0.85rem; }

/* ── Status & Diff badges ────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-unreviewed { background: var(--amber-light); color: var(--amber); }
.status-reviewed   { background: var(--green-light);  color: var(--green-dark); }
.status-active     { background: var(--green-light);  color: var(--green-dark); }
.status-rejected   { background: var(--red-light);    color: var(--red); }

.diff-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
}
.diff-easy         { background: var(--green-light); color: var(--green-dark); }
.diff-intermediate { background: var(--amber-light); color: var(--amber); }
.diff-hard         { background: var(--red-light);   color: var(--red); }

.count-badge {
  display: inline-block;
  background: var(--border);
  color: var(--text-muted);
  border-radius: 99px;
  padding: 0.1rem 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
}
.badge-alert { background: var(--amber); color: white; }

/* ── Outcome badges ──────────────────────────────────────────────────────── */
.outcome-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
}
.outcome-fixed                    { background: var(--green-light); color: var(--green-dark); }
.outcome-not-fixed                { background: var(--red-light);   color: var(--red); }
.outcome-returned-with-instructions { background: var(--blue-light); color: var(--blue); }

/* ── Ticket number display ───────────────────────────────────────────────── */
.ticket-num {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 700;
  background: #f0f0f0;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
}
a.ticket-num:hover { background: var(--green-light); }
.ticket-num-lg {
  font-size: 1.3rem;
  padding: 0.2rem 0.65rem;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.items-table-wrapper { overflow-x: auto; }
.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.items-table th, .items-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.items-table th {
  background: #f8f8f8;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}
.items-table tr:last-child td { border-bottom: none; }
.items-table tr:hover td { background: #fafafa; }
.row-reviewed td { color: var(--text-muted); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-icon  { font-size: 3rem; margin-bottom: 1rem; }

/* ── Stats grid ──────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-num   { font-size: 2.2rem; font-weight: 900; line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; white-space: nowrap; }
.stat-fixed     .stat-num { color: var(--green-dark); }
.stat-notfixed  .stat-num { color: var(--red); }
.stat-rwi       .stat-num { color: var(--blue); }

.stat-weight {
  background: var(--green-light);
  border-color: var(--green-dark);
}
.stat-weight .stat-num   { color: var(--green-dark); font-size: 2.6rem; }
.stat-weight .stat-unit  { font-size: 1.1rem; font-weight: 700; }
.stat-weight .stat-label { color: var(--green-dark); font-weight: 600; }

/* ── Staff nav ───────────────────────────────────────────────────────────── */
.staff-nav {
  background: var(--nav-bg);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.staff-nav-brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1rem; }
.nav-logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
}
.staff-nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-link {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.12); color: white; }

/* ── Staff layout ────────────────────────────────────────────────────────── */
.staff-body { background: var(--bg); }
.staff-main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.staff-main-wide { max-width: 1500px; }

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 800; }
.page-sub { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.2rem; }
.section-heading { font-size: 1rem; font-weight: 700; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.back-link { display: inline-block; margin-bottom: 0.5rem; font-size: 0.9rem; }

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-card { padding: 1rem 1.5rem; }
.search-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 220px; }

/* ── Submission item card ────────────────────────────────────────────────── */
.item-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}
.review-action-card { border-left: 4px solid var(--green-dark); }

/* ── Visitor-facing layout ───────────────────────────────────────────────── */
.visitor-body { background: var(--bg); min-height: 100vh; }
.visitor-container { max-width: 640px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.brand-header { text-align: center; margin-bottom: 1.5rem; }
.brand-logo-img {
  max-height: 90px;
  max-width: 240px;
  width: auto;
  margin-bottom: 0.5rem;
  object-fit: contain;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.brand-header h1 { font-size: 1.8rem; font-weight: 900; color: var(--green-dark); }
.brand-sub    { color: var(--text-muted); font-size: 0.95rem; }

.event-badge {
  background: var(--green-light);
  border: 1px solid #b2dfbd;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 1.25rem;
  color: var(--green-dark);
}

.form-section { margin-bottom: 0; }
.section-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; color: var(--green-dark); }

#add-item2-wrapper { margin-bottom: 1.25rem; }

/* ── Confirmation page ───────────────────────────────────────────────────── */
.confirmation-card { text-align: center; }
.confirm-check {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--green-dark); color: white;
  font-size: 1.8rem; line-height: 60px;
  margin: 0 auto 1rem;
}
.confirm-sub { color: var(--text-muted); margin-bottom: 1.5rem; }

.ticket-display { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.ticket-item {
  border: 2px solid var(--green-dark);
  border-radius: var(--radius);
  padding: 1rem;
}
.ticket-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.ticket-number { font-size: 3rem; font-weight: 900; font-family: monospace; color: var(--green-dark); line-height: 1; }

.barcode-block {
  display: flex;
  justify-content: center;
  margin: 1rem 0 0.5rem;
}
.barcode-block svg { max-width: 100%; }

.confirm-instructions { color: var(--text-muted); font-size: 0.9rem; }
.confirm-instructions p + p { margin-top: 0.4rem; }

/* ── Closed page ─────────────────────────────────────────────────────────── */
.closed-card { text-align: center; }
.closed-icon { font-size: 3rem; margin-bottom: 1rem; }
.closed-card h2 { margin-bottom: 0.5rem; }
.closed-card p  { color: var(--text-muted); margin-bottom: 0.5rem; }

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { width: 100%; max-width: 400px; padding: 1rem; }
.login-card h2 { margin-bottom: 1rem; }

/* ── Outcome page ────────────────────────────────────────────────────────── */
.outcome-item-info { color: var(--text-muted); margin-bottom: 1rem; font-size: 0.9rem; }
.outcome-choices { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.4rem; }
.outcome-choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}
.outcome-choice:hover { border-color: var(--green); background: var(--green-light); }
.outcome-choice.selected { border-color: var(--green-dark); background: var(--green-light); }
.outcome-choice-disabled { opacity: 0.5; cursor: default; pointer-events: none; }
.outcome-choice-disabled.selected { background: #f0f0f0; border-color: #aaa; }

.outcome-choice input[type=radio] {
  width: 1.4rem;
  height: 1.4rem;
  min-width: 1.4rem;
  accent-color: var(--green-dark);
  flex-shrink: 0;
}
.choice-icon { font-size: 1.3rem; }

.outcome-summary { text-align: left; margin: 1rem 0; }
.outcome-row { display: flex; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.outcome-row:last-child { border-bottom: none; }
.outcome-row > span:first-child { min-width: 80px; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Staff nav */
  .staff-nav-brand span:last-child { display: none; }
  .nav-link { padding: 0.4rem 0.5rem; font-size: 0.85rem; }

  /* Staff layout */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-label { white-space: normal; }
  .ticket-number { font-size: 2.4rem; }

  /* Visitor form — always stack name fields on phone */
  .form-row { flex-direction: column; }

  /* Reduce hero height on small screens */
  .brand-logo-img { max-height: 70px; }
  .brand-header h1 { font-size: 1.5rem; }
  .visitor-container { padding: 1rem 0.875rem 3rem; }

  /* Bigger submit button on phone */
  .btn-large { font-size: 1.05rem; min-height: 52px; }

  /* Outcome choices full-width comfortable tap */
  .outcome-choice { padding: 1rem; }
}

@media print {
  body { background: white; }
}
