:root {
  --paper: #f8f3ea;
  --surface: #fffaf2;
  --panel: #ffffff;
  --ink: #211d1b;
  --muted: #6e6259;
  --line: #dfd1c2;
  --red: #8f1d2c;
  --red-dark: #681322;
  --green: #1f4f43;
  --green-soft: #dce9df;
  --gold: #b88a4a;
  --shadow: 0 16px 42px rgba(39, 28, 20, 0.14);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(16px, 3vw, 38px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.96);
}

.brand-block {
  display: grid;
  gap: 2px;
}

.brand-kicker {
  margin: 0;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 2.35rem);
  line-height: 1.06;
  letter-spacing: 0;
}

.status-cluster {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.mode-badge,
.access-badge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  background: var(--panel);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.access-badge.is-live {
  border-color: rgba(31, 79, 67, 0.28);
  color: var(--green);
  background: var(--green-soft);
}

.workspace {
  width: 100%;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(0, 1fr);
  gap: 0;
}

.controls {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: clamp(16px, 2.4vw, 28px);
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.trust-strip span {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(31, 79, 67, 0.18);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 840;
  text-align: center;
  line-height: 1.15;
}

.policy-lock-notice {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(143, 29, 44, 0.28);
  border-radius: 8px;
  background: #fff3f2;
}

.policy-lock-notice b {
  color: var(--red-dark);
}

.policy-lock-notice span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.generator-form {
  display: grid;
  gap: 18px;
}

.control-section {
  display: grid;
  gap: 10px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.section-title strong {
  color: var(--red);
}

.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label,
.field-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  min-height: 44px;
}

textarea {
  resize: vertical;
  min-height: 82px;
  line-height: 1.42;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 79, 67, 0.13);
}

.package-grid {
  display: grid;
  gap: 8px;
}

.package-option {
  position: relative;
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
}

.package-option input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--red);
}

.package-option b,
.package-option small {
  display: block;
}

.package-option b {
  font-size: 0.95rem;
}

.package-option small {
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.25;
}

.package-option:has(input:checked) {
  border-color: rgba(143, 29, 44, 0.45);
  background: #fff3f2;
}

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

.segmented label {
  display: block;
}

.segmented input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.segmented input:checked + span {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.payment-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(143, 29, 44, 0.28);
  border-radius: 8px;
  background: #fff3f2;
}

.payment-panel div {
  display: grid;
  gap: 6px;
}

.payment-panel b {
  color: var(--red-dark);
}

.payment-panel span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.payment-status {
  display: block;
  color: var(--red-dark) !important;
  font-weight: 760;
}

.consent-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 680;
  line-height: 1.35;
}

.consent-check input {
  width: 16px;
  min-height: 16px;
  margin-top: 2px;
  padding: 0;
  accent-color: var(--red);
}

.consent-check span {
  font-size: inherit;
  line-height: inherit;
}

.action-row,
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-button,
.ghost-button,
.tool-button,
.tab {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 820;
  letter-spacing: 0;
}

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

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

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.ghost-button,
.tool-button,
.tab {
  border-color: var(--line);
  background: #fffdf8;
  color: var(--ink);
}

.ghost-button:hover,
.tool-button:hover,
.tab:hover {
  border-color: var(--gold);
}

.output-area {
  min-width: 0;
  display: grid;
  grid-template-rows: 230px auto minmax(0, 1fr);
  background: #fdf7ee;
}

.visual-strip {
  background-image: linear-gradient(90deg, rgba(33, 29, 27, 0.18), rgba(33, 29, 27, 0.02)), url("assets/brand-photo.png");
  background-size: cover;
  background-position: center 54%;
  border-bottom: 1px solid var(--line);
}

.output-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 14px clamp(16px, 2.4vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.96);
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab {
  white-space: nowrap;
  min-width: 90px;
}

.tab[aria-selected="true"] {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.result-sheet {
  width: min(880px, calc(100% - 32px));
  align-self: start;
  justify-self: center;
  margin: clamp(16px, 3vw, 36px) 0;
  padding: clamp(24px, 4vw, 54px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.sheet-header {
  display: grid;
  gap: 6px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.sheet-header p {
  margin: 0;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sheet-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 3vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.result-content {
  padding-top: 24px;
  color: #2c2622;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.03rem, 1.8vw, 1.22rem);
  line-height: 1.72;
}

.result-content p {
  margin: 0 0 1em;
}

.result-content ul,
.result-content ol {
  margin: 0;
  padding-left: 1.25em;
}

.result-content li + li {
  margin-top: 0.55em;
}

.locked .result-sheet {
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 3vw, 38px);
  border-top: 1px solid var(--line);
  background: #fffdf8;
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

a {
  color: var(--red);
  font-weight: 780;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.simple-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.simple-card {
  width: min(720px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: var(--shadow);
  padding: clamp(28px, 5vw, 56px);
}

.simple-card h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.simple-card p {
  margin: 0;
  color: #2c2622;
  font-size: 1.02rem;
  line-height: 1.65;
}

.primary-link {
  width: fit-content;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--red);
  color: white;
  padding: 11px 16px;
  font-weight: 850;
}

.primary-link:hover {
  background: var(--red-dark);
  text-decoration: none;
}

.legal-copy {
  align-content: start;
}

.policy-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(33, 29, 27, 0.58);
}

.policy-dialog {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 24px 70px rgba(18, 12, 8, 0.35);
  padding: clamp(22px, 4vw, 42px);
}

.policy-dialog h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.06;
  letter-spacing: 0;
}

.policy-dialog p {
  margin: 0;
  color: #2c2622;
  font-size: 1rem;
  line-height: 1.58;
}

.policy-dialog ul {
  margin: 0;
  padding-left: 1.2em;
  color: #2c2622;
  line-height: 1.55;
}

.policy-dialog li + li {
  margin-top: 0.58em;
}

.policy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.policy-fineprint {
  color: var(--muted) !important;
  font-size: 0.86rem !important;
}

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

  .controls {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .output-area {
    grid-template-rows: 190px auto minmax(0, 1fr);
  }
}

@media (max-width: 680px) {
  .topbar,
  .output-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .status-cluster,
  .toolbar-actions {
    justify-content: flex-start;
  }

  .two-columns,
  .segmented {
    grid-template-columns: 1fr;
  }

  .trust-strip {
    grid-template-columns: 1fr;
  }

  .payment-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .output-area,
  .visual-strip,
  .output-toolbar {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .tabs,
  .toolbar-actions {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .tab {
    min-width: 0;
    flex: 1 1 calc(50% - 4px);
  }

  .action-row > *,
  .toolbar-actions > * {
    flex: 1 1 auto;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer nav {
    justify-content: flex-start;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .controls,
  .visual-strip,
  .output-toolbar {
    display: none !important;
  }

  .workspace,
  .output-area {
    display: block;
  }

  .result-sheet {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .result-content {
    font-size: 12pt;
  }
}

.test-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(31, 79, 67, 0.24);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  padding: 7px 11px;
  font-size: 0.78rem;
  font-weight: 850;
}

.checkout-summary {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.checkout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
}

.checkout-row strong {
  color: var(--ink);
}

.checkout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
