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

:root {
  --ink: #17212b;
  --muted: #5f6f7c;
  --line: #d8e1e8;
  --panel: #ffffff;
  --wash: #f4f7f9;
  --field: #f9fbfc;
  --teal: #00706b;
  --teal-dark: #005956;
  --gold: #8d6a2e;
  --red: #b4233a;
}

html {
  background: #e8eef2;
}

body {
  background:
    radial-gradient(circle at 8% 0%, rgba(0, 112, 107, 0.1), transparent 30rem),
    linear-gradient(180deg, #eef3f6 0%, #f9fbfc 48%, #e7eef2 100%);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.forms-page {
  display: grid;
  gap: 20px;
  margin: 0 auto;
  max-width: 1320px;
  min-height: 100vh;
  padding: 24px;
}

.embed-mode,
.embed-mode body {
  background:
    radial-gradient(circle at 9% 0%, rgba(0, 112, 107, 0.1), transparent 30rem),
    linear-gradient(180deg, #edf3f6 0%, #f9fbfc 52%, #e8eef2 100%);
}

.embed-mode .forms-page {
  background: rgba(255, 255, 255, 0.72);
  border-left: 1px solid rgba(216, 225, 232, 0.92);
  border-right: 1px solid rgba(216, 225, 232, 0.92);
  padding: 16px;
}

.forms-hero,
.section-head,
.workspace-actions,
.form-panel-head,
.form-actions {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.forms-hero {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.forms-hero h1,
.section-head h2,
.form-panel-head h2,
.preview-card h2,
.empty-state h2,
.loading-state p {
  margin: 0;
}

.forms-hero h1 {
  font-size: clamp(1.85rem, 3vw, 3rem);
  line-height: 1.05;
}

.forms-hero img {
  height: 58px;
  object-fit: contain;
  width: auto;
}

.eyebrow {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 5px;
  text-transform: uppercase;
}

.loading-state,
.empty-state {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  gap: 12px;
  justify-items: center;
  min-height: 220px;
  padding: 24px;
}

.loader {
  animation: spin 0.8s linear infinite;
  border: 3px solid #d8e1e8;
  border-top-color: var(--teal);
  border-radius: 999px;
  height: 34px;
  width: 34px;
}

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

.tile-view {
  display: grid;
  gap: 16px;
}

.forms-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.form-tile {
  align-items: stretch;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 12px;
  min-height: 196px;
  padding: 16px;
  text-align: left;
}

.form-tile:hover,
.form-tile:focus-visible {
  border-color: rgba(0, 112, 107, 0.55);
  box-shadow: 0 14px 28px rgba(0, 112, 107, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.brand-mark {
  align-items: center;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  height: 104px;
  justify-content: center;
  padding: 18px;
  width: 100%;
}

.brand-mark img {
  max-height: 64px;
  max-width: 100%;
  object-fit: contain;
}

.brand-mark.text-mark {
  color: #101820;
  font-size: 1.4rem;
  font-weight: 950;
  justify-content: center;
  letter-spacing: 0;
}

.brand-mark.compact {
  flex: 0 0 118px;
  height: 70px;
  padding: 12px;
  width: 118px;
}

.brand-mark.compact img {
  max-height: 42px;
}

.brand-mark.brand-glock,
.brand-mark.brand-remington {
  background: #ffffff;
}

.brand-mark.brand-hornady {
  background: #fff7f4;
}

.brand-mark.brand-federal {
  background: #f5f8fc;
}

.brand-mark.brand-admin {
  background: #ffffff;
}

.brand-mark.brand-mossberg,
.brand-mark.brand-pmc,
.brand-mark.brand-generic {
  background: linear-gradient(135deg, #101820, #293847);
  border-color: #293847;
  color: #ffffff;
}

.tile-title {
  color: #101820;
  display: block;
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1.22;
}

.tile-meta,
.form-panel-head span,
.preview-card span {
  color: var(--muted);
}

.form-workspace {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(460px, 1fr) minmax(330px, 0.54fr);
}

.workspace-actions {
  grid-column: 1 / -1;
}

.form-panel,
.preview-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.form-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.form-panel-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  justify-content: start;
  padding-bottom: 14px;
}

.selected-logo-wrap.hidden {
  display: none;
}

.ghost-action,
.template-link,
.primary-action {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 850;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  text-decoration: none;
}

.ghost-action,
.template-link {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost-action {
  cursor: pointer;
}

.customer-form,
.dynamic-fields {
  display: grid;
  gap: 14px;
}

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

.form-field,
.choice-group {
  display: grid;
  gap: 6px;
}

.form-field.full,
.choice-group.full,
.checkbox-option.full {
  grid-column: 1 / -1;
}

.form-field label,
.choice-group legend {
  color: #263440;
  font-size: 0.85rem;
  font-weight: 850;
}

.required {
  color: var(--red);
}

.form-field input,
.form-field textarea,
.form-field select {
  background: var(--field);
  border: 1px solid #c7d2dc;
  border-radius: 7px;
  min-height: 42px;
  padding: 9px 10px;
  width: 100%;
}

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

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 112, 107, 0.14);
  outline: none;
}

.choice-group {
  border: 0;
  margin: 0;
  padding: 0;
}

.choice-option,
.checkbox-option {
  align-items: start;
  background: var(--field);
  border: 1px solid #c7d2dc;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr;
  padding: 10px;
}

.choice-option small {
  color: var(--muted);
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  margin-top: 2px;
}

.form-actions {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.primary-action {
  background: var(--teal);
  border: 1px solid var(--teal);
  color: #ffffff;
  cursor: pointer;
}

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

.primary-action:disabled {
  cursor: wait;
  opacity: 0.68;
}

.form-status {
  color: var(--muted);
  flex: 1 1 auto;
  min-height: 22px;
}

.form-status[data-tone="success"] {
  color: #17633c;
  font-weight: 850;
}

.form-status[data-tone="error"] {
  color: var(--red);
  font-weight: 850;
}

.preview-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.pdf-frame {
  background: #d9e1e6;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: min(70vh, 720px);
  min-height: 420px;
  overflow: hidden;
}

.pdf-frame iframe {
  border: 0;
  height: 100%;
  width: 100%;
}

.honeypot {
  left: -10000px;
  position: absolute;
  top: auto;
}

.fatal-message {
  color: var(--red);
  font-weight: 850;
}

@media (max-width: 980px) {
  .form-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .forms-page,
  .embed-mode .forms-page {
    padding: 12px;
  }

  .forms-hero,
  .section-head,
  .workspace-actions,
  .form-actions,
  .form-panel-head {
    align-items: stretch;
    display: grid;
  }

  .forms-hero img {
    height: 46px;
  }

  .forms-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .brand-mark.compact {
    width: 100%;
  }

  .template-link,
  .primary-action,
  .ghost-action {
    width: 100%;
  }
}
