/* ─── Reset & Base ──────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #fafaf8;
  --color-surface: #ffffff;
  --color-surface-alt: #f4f3f0;
  --color-border: #e2e0db;
  --color-border-focus: #6b8f71;
  --color-text: #1a1a18;
  --color-text-muted: #6b6b66;
  --color-text-hint: #9c9a92;
  --color-accent: #4a7c59;
  --color-accent-hover: #3d6649;
  --color-accent-light: #e8f0ea;
  --color-error: #c53030;
  --color-error-bg: #fef2f2;
  --color-success: #2f7d3e;
  --color-success-bg: #f0faf1;
  --color-warning-bg: #fffbeb;
  --color-warning-border: #d4a017;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --max-width: 640px;
  --transition: 0.2s ease;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ────────────────────────────────────────────────────────────── */

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.page-wide {
  max-width: 960px;
}

/* ─── Header ────────────────────────────────────────────────────────────── */

.header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.header .subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.header .meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.header .meta span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ─── Info Banner ───────────────────────────────────────────────────────── */

.info-banner {
  background: var(--color-accent-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--color-text);
}

.closed-banner {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.closed-banner p {
  font-size: 1rem;
  font-weight: 500;
}

.counter {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.counter strong {
  color: var(--color-text);
}

/* ─── Form Sections ─────────────────────────────────────────────────────── */

.form-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.form-section h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

/* ─── Form Fields ───────────────────────────────────────────────────────── */

.field {
  margin-bottom: 1rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: var(--color-text);
}

.field label .required {
  color: var(--color-error);
  margin-left: 2px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="date"],
.field textarea,
.field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition);
  outline: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(107, 143, 113, 0.15);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

.field .hint {
  font-size: 0.78rem;
  color: var(--color-text-hint);
  margin-top: 0.25rem;
}

/* Radio group */

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.3rem;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  font-size: 0.9rem;
  cursor: pointer;
}

.radio-group input[type="radio"] {
  accent-color: var(--color-accent);
}

/* Checkbox */

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.checkbox-field input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--color-accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.checkbox-field label {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.5;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .row {
    grid-template-columns: 1fr;
  }
}

/* ─── Button ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  width: 100%;
  background: var(--color-accent);
  color: #fff;
  padding: 0.85rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
}

.btn-primary:disabled {
  background: var(--color-text-hint);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface-alt);
}

.btn-small {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}

/* ─── Errors ────────────────────────────────────────────────────────────── */

.error-box {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
  color: var(--color-error);
  font-size: 0.9rem;
}

.error-box ul {
  margin: 0.25rem 0 0 1.25rem;
}

/* ─── Success / Thank you ───────────────────────────────────────────────── */

.success-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.success-card .icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.success-card h2 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}

.success-card .message {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.code-display {
  background: var(--color-surface-alt);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 1.25rem 0;
}

.code-display .label {
  font-size: 0.78rem;
  color: var(--color-text-hint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.code-display .code {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  user-select: all;
}

.code-display .link {
  margin-top: 0.5rem;
  font-size: 0.82rem;
}

.code-display .link a {
  color: var(--color-accent);
  text-decoration: underline;
  word-break: break-all;
}

.payment-info {
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.5rem;
  text-align: left;
  font-size: 0.9rem;
  white-space: pre-line;
  line-height: 1.7;
}

.payment-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* ─── Status Page ───────────────────────────────────────────────────────── */

.status-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.status-section {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.status-section:last-child {
  border-bottom: none;
}

.status-section h3 {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-hint);
  margin-bottom: 0.75rem;
}

.status-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.status-row .label {
  color: var(--color-text-muted);
}

.status-row .value {
  font-weight: 500;
  text-align: right;
}

.contact-hint {
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
}

.contact-hint a {
  color: var(--color-accent);
  font-weight: 500;
}

/* ─── Code Lookup Form ──────────────────────────────────────────────────── */

.lookup-form {
  display: flex;
  gap: 0.5rem;
  max-width: 400px;
  margin: 0 auto 2rem;
}

.lookup-form input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
}

.lookup-form input:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(107, 143, 113, 0.15);
}

/* ─── Admin ─────────────────────────────────────────────────────────────── */

.login-card {
  max-width: 360px;
  margin: 4rem auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.login-card h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
}

.admin-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-bar h2 {
  font-size: 1.1rem;
}

.admin-actions {
  display: flex;
  gap: 0.5rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

th {
  background: var(--color-surface-alt);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  position: sticky;
  top: 0;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--color-surface-alt);
}

/* ─── Loading ───────────────────────────────────────────────────────────── */

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-hint);
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Footer ────────────────────────────────────────────────────────────── */

.footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-hint);
}
