:root {
  --bg: #eef3f7;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #d0d7e2;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --secondary: #e5edf3;
  --secondary-text: #12212f;
  --danger: #b42318;
  --danger-bg: #fde8e8;
  --warning-bg: #fff7d6;
  --warning-text: #92400e;
  --success-bg: #e9f9ef;
  --success-text: #166534;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 32%),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
  color: var(--text);
  line-height: 1.5;
}

.minimal-page {
  min-height: 100vh;
}

a {
  color: inherit;
}

.site-header {
  background: linear-gradient(135deg, #0f172a, #134e4a);
  color: #f8fafc;
  padding: 24px 18px;
}

.header-inner,
.page-shell,
.print-sheet {
  max-width: 1120px;
  margin: 0 auto;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.brand {
  color: white;
  text-decoration: none;
  font-size: 1.4rem;
  font-weight: 800;
}

.brand-subtitle {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.72);
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.site-nav a {
  color: white;
  text-decoration: none;
  font-weight: 700;
}

.page-shell {
  padding: 28px 16px 48px;
}

.site-footer {
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  padding: 18px 16px 28px;
  color: var(--muted);
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
}

.hero {
  padding: 8px 4px 20px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3rem);
}

.hero p {
  max-width: 760px;
  color: #374151;
  margin: 0;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 22px;
}

.narrow-card {
  max-width: 520px;
}

.admin-card {
  border: 1px solid rgba(15, 118, 110, 0.22);
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.section-title h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.section-title small,
.hint,
.muted-text {
  color: var(--muted);
}

.admin-notice {
  margin-bottom: 16px;
  background: var(--warning-bg);
  color: var(--warning-text);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.field {
  grid-column: span 12;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.half {
  grid-column: span 6;
}

.field.third {
  grid-column: span 4;
}

.field.quarter {
  grid-column: span 3;
}

label {
  font-weight: 700;
  font-size: 0.92rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: white;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(15, 118, 110, 0.12);
}

.repeatable-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.repeatable-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: #f8fbfc;
}

.repeatable-actions,
.actions,
.toolbar,
.toolbar-actions,
.row-actions,
.stack-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.repeatable-actions,
.actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.split-actions {
  justify-content: flex-start;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

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

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

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-text);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-small {
  padding: 8px 14px;
  font-size: 0.9rem;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  font-weight: 600;
}

.checkbox-option input {
  width: auto;
  margin: 0;
}

.flash {
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 700;
  margin-bottom: 18px;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.flash-error,
.error-card {
  background: #fff1f2;
  color: #9f1239;
}

.error-list {
  margin: 0;
  padding-left: 18px;
}

.info-list p,
.empty-state {
  margin: 0 0 10px;
}

.inline-form,
.stack-form {
  margin: 0;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.toolbar {
  align-items: flex-end;
}

.search-field {
  flex: 1 1 320px;
}

.select-field {
  width: 190px;
}

.toolbar-actions {
  align-items: center;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 14px 10px;
  vertical-align: top;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: capitalize;
}

.status-active {
  background: #dcfce7;
  color: #166534;
}

.status-archived {
  background: #fef3c7;
  color: #92400e;
}

.status-deleted {
  background: #fee2e2;
  color: #991b1b;
}

.print-page {
  background: white;
}

.print-sheet {
  max-width: 210mm;
  margin: 0 auto;
  padding: 10mm 10mm 8mm;
  color: #0f172a;
  font-size: 11px;
  line-height: 1.25;
}

.print-header,
.print-section {
  margin-bottom: 10px;
}

.print-header {
  text-align: center;
  border-bottom: 1.5px solid #111827;
  padding-bottom: 8px;
}

.print-company {
  margin: 0 0 4px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 10px;
}

.print-header h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.1;
}

.print-meta {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: #475569;
  font-size: 9.5px;
}

.print-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.print-section h2,
.print-subsection h3 {
  margin: 0 0 7px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.print-section {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.print-section-wide {
  grid-column: 1 / -1;
}

.print-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
}

.print-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.print-grid-compact div {
  min-width: 0;
}

.print-span-all {
  grid-column: 1 / -1;
}

.print-list {
  margin: 0;
  padding-left: 15px;
}

.print-list-compact li + li {
  margin-top: 3px;
}

.print-paragraph {
  margin: 0;
  white-space: normal;
}

.print-inline-note {
  margin: 0;
  color: #475569;
}

.print-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.print-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 2px 8px;
  background: #f8fafc;
  font-size: 10px;
}

.print-signatures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px;
  margin-top: 34px;
  padding-top: 18px;
}

.signature-card {
  text-align: center;
  font-size: 10px;
}

.signature-card p {
  margin: 3px 0;
}

.signature-line {
  border-top: 1px solid #111827;
  margin-bottom: 8px;
  padding-top: 4px;
}

.thanks-stage {
  position: relative;
  min-height: 68vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.thanks-message {
  position: relative;
  z-index: 1;
  padding: 48px 56px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  text-align: center;
}

.thanks-message h1 {
  margin: 0;
  font-size: clamp(2.6rem, 8vw, 5rem);
}

.confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@media (max-width: 760px) {
  .header-inner,
  .section-title,
  .toolbar,
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .field.half,
  .field.third,
  .field.quarter,
  .select-field {
    grid-column: span 12;
    width: 100%;
  }

  .actions,
  .toolbar-actions,
  .row-actions,
  .stack-inline {
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .print-grid,
  .print-grid-compact,
  .print-layout,
  .print-signatures {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4;
    margin: 8mm;
  }

  .site-header,
  .btn,
  .actions,
  .stack-inline {
    display: none !important;
  }

  body,
  .print-page {
    background: white;
  }

  .print-sheet {
    max-width: none;
    padding: 0;
    font-size: 10.5px;
  }

  .print-section {
    box-shadow: none;
  }
}
