:root {
  color-scheme: light;
  --bg: #fbf5f3;
  --panel: #fffaf7;
  --panel-strong: #ffffff;
  --ink: #241924;
  --muted: #7d6771;
  --line: #ead9d8;
  --strong-line: #cfb5b7;
  --accent: #b94367;
  --accent-dark: #963052;
  --accent-soft: #f8dfe6;
  --blush: #fdecef;
  --ivory: #fffaf2;
  --sage: #315f3d;
  --danger: #a83d35;
  --warning: #8a551f;
  --focus: #7f2144;
  --pattern: #fffdf7;
  --shadow: 0 22px 70px rgba(86, 50, 60, 0.12);
  --soft-shadow: 0 14px 34px rgba(86, 50, 60, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 250, 247, 0.94) 0%, rgba(253, 236, 239, 0.64) 42%, rgba(248, 244, 239, 0.92) 100%),
    var(--bg);
  color: var(--ink);
  font-family:
    Aptos, Candara, "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

.app-shell {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  max-width: 1440px;
  margin: 0 auto;
}

.view-section[hidden] {
  display: none !important;
}

.hero-banner {
  position: relative;
  min-height: 350px;
  overflow: hidden;
  border: 1px solid rgba(207, 181, 183, 0.8);
  border-radius: 8px;
  background: var(--ivory);
  box-shadow: var(--shadow);
  isolation: isolate;
  margin-bottom: 22px;
}

.hero-banner::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, rgba(255, 250, 247, 0.97) 0%, rgba(255, 250, 247, 0.86) 35%, rgba(255, 250, 247, 0.28) 63%, rgba(255, 250, 247, 0.04) 100%);
  content: "";
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  max-width: 560px;
  min-height: 350px;
  flex-direction: column;
  justify-content: center;
  padding: 42px 48px;
}

.hero-copy .eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-banner h1 {
  margin: 0 0 12px;
  max-width: 460px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-banner p {
  max-width: 490px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-start {
  text-decoration: none;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.trust-strip span {
  border: 1px solid rgba(185, 67, 103, 0.18);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 250, 247, 0.72);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.catalog-panel {
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 250, 247, 0.88);
  box-shadow: var(--soft-shadow);
}

.catalog-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.catalog-heading .eyebrow {
  margin: 0 0 5px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.catalog-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0;
}

.catalog-heading p:last-child {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.catalog-card {
  display: flex;
  min-width: 0;
  min-height: 228px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fffefe;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.catalog-card:hover {
  border-color: rgba(185, 67, 103, 0.46);
  box-shadow: 0 14px 28px rgba(86, 50, 60, 0.09);
  transform: translateY(-1px);
}

.catalog-card.is-active {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(253, 236, 239, 0.74), rgba(255, 250, 247, 0.98)),
    #fffefe;
}

.catalog-card.is-planned {
  background: rgba(255, 250, 247, 0.62);
}

.catalog-card-status {
  align-self: flex-start;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--blush);
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.catalog-card.is-planned .catalog-card-status {
  background: #fff7e8;
  color: var(--warning);
}

.catalog-card strong {
  display: block;
  margin-top: 10px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.15;
}

.catalog-card em {
  display: block;
  margin-top: 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.3;
}

.catalog-card p {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.catalog-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
}

.catalog-card-meta span {
  border: 1px solid rgba(207, 181, 183, 0.65);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.catalog-card small {
  display: block;
  margin-top: 8px;
  color: #8a6b77;
  font-size: 11px;
  line-height: 1.35;
}

.product-detail,
.builder-heading,
.account-dashboard {
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 247, 0.92);
  box-shadow: var(--soft-shadow);
}

.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  padding: 22px;
}

.product-detail-copy .eyebrow,
.builder-heading .eyebrow,
.account-dashboard-header .eyebrow {
  margin: 0 0 7px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-detail h2,
.builder-heading h2,
.account-dashboard h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 500;
  line-height: 1.05;
}

.product-detail-copy p,
.account-dashboard-header p {
  max-width: 590px;
  color: var(--muted);
  line-height: 1.55;
}

.product-detail-actions,
.account-dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.product-detail-actions a,
.account-dashboard-actions a,
.dashboard-panel-heading a,
.builder-heading a {
  text-decoration: none;
}

.product-detail-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.product-detail-facts article,
.dashboard-panel,
.dashboard-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefe;
}

.product-detail-facts article {
  padding: 14px;
}

.product-detail-facts span,
.dashboard-card span {
  display: block;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.product-detail-facts strong,
.dashboard-card strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 15px;
}

.product-detail-facts p,
.dashboard-card p,
.dashboard-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.builder-heading,
.account-dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
}

.builder-heading nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.builder-heading nav a {
  border: 1px solid var(--strong-line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.account-dashboard {
  padding: 0;
}

.account-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 22px 22px;
}

.dashboard-panel {
  padding: 14px;
}

.dashboard-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.dashboard-panel-heading h3 {
  margin: 0;
  font-size: 16px;
}

.dashboard-panel-heading a {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.dashboard-card {
  padding: 12px;
}

.dashboard-card + .dashboard-card {
  margin-top: 10px;
}

.dashboard-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.empty-state {
  margin: 0;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.account-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(36, 25, 36, 0.42);
}

.account-gate[hidden] {
  display: none;
}

.account-gate-panel {
  position: relative;
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.account-gate-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--strong-line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}

.account-heading p {
  max-width: 520px;
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.hero-image {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right top;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(360px, 470px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.measurement-panel,
.preview-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 17px 18px;
  background: rgba(255, 250, 247, 0.78);
}

.panel-heading h2 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.panel-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.unit-toggle {
  display: grid;
  grid-template-columns: repeat(2, 42px);
  gap: 3px;
  border: 1px solid var(--strong-line);
  border-radius: 999px;
  padding: 3px;
  background: #fff;
}

.unit-button {
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
}

.unit-button.is-active {
  background: var(--accent);
  color: #fff;
}

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

.beginner-note {
  margin: 18px 18px 0;
  border: 1px solid rgba(185, 67, 103, 0.2);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--blush);
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1.4;
}

.account-panel,
.profile-panel {
  margin: 14px 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffafb;
  padding: 12px;
}

.account-heading,
.profile-heading,
.pattern-history-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.account-heading span,
.profile-heading span {
  display: block;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.account-heading strong,
.profile-heading strong,
.pattern-history-header strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.account-heading em,
.pattern-history-header em {
  align-self: flex-start;
  border-radius: 999px;
  background: var(--blush);
  color: var(--accent-dark);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  padding: 4px 8px;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.account-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.account-grid input,
.profile-actions input,
.profile-heading select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--strong-line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  min-height: 38px;
  padding: 0 10px;
}

.account-actions,
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.profile-actions input {
  flex: 1 1 190px;
}

.field {
  min-width: 0;
}

.field label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 700;
}

.field label span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--strong-line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #fffefe;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(185, 67, 103, 0.16);
  outline: none;
}

.field input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-help,
.field-error,
.field-warning {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.35;
}

.field-help {
  color: var(--muted);
}

.field-error {
  min-height: 16px;
  color: var(--danger);
  font-weight: 700;
}

.field-warning {
  color: #9a5b00;
  font-weight: 700;
}

.warning-list {
  margin: 0 18px 18px;
  border: 1px solid #e6bd82;
  border-radius: 6px;
  padding: 12px;
  background: #fff7e8;
  color: var(--warning);
  font-size: 13px;
  line-height: 1.4;
}

.warning-list strong {
  display: block;
  margin-bottom: 6px;
  color: #683b12;
}

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

.warning-list li + li {
  margin-top: 5px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 16px 18px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.compact-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 24px rgba(185, 67, 103, 0.22);
}

a.primary-button,
a.primary-button:visited {
  color: #fff;
}

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

.secondary-button {
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--strong-line);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.unit-button:focus-visible,
.package-piece:focus-visible,
.piece-picker select:focus-visible,
.field input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

#form-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.preview-panel {
  overflow: hidden;
}

.output-actions {
  display: flex;
  flex: 1 1 560px;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.piece-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.piece-picker span {
  white-space: nowrap;
}

.piece-picker select {
  height: 32px;
  min-width: 132px;
  border: 1px solid var(--strong-line);
  border-radius: 6px;
  padding: 0 28px 0 10px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.piece-picker select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(185, 67, 103, 0.16);
  outline: none;
}

.prototype-note {
  border-bottom: 1px solid var(--line);
  padding: 10px 18px;
  background: #fff7e8;
  color: var(--warning);
  font-size: 13px;
  line-height: 1.4;
}

.download-note {
  border-bottom: 1px solid rgba(185, 67, 103, 0.2);
  padding: 10px 18px;
  background: var(--blush);
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1.4;
}

.preview-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fffefe;
}

.summary-item strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 13px;
}

.quality-gate {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  background: #fff8f8;
}

.quality-gate:empty {
  display: none;
}

.quality-gate-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.quality-gate-header strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.quality-gate-header em {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.quality-gate-header em.passed {
  background: #e3f0e5;
  color: #315f3d;
}

.quality-gate-header em.needs-review {
  background: #fbe4e1;
  color: var(--danger);
}

.quality-check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quality-check {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.quality-check.is-passed {
  border-color: #bdd7c2;
}

.quality-check.needs-review {
  border-color: #efc6c1;
  background: #fff7f7;
}

.quality-check strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 12px;
}

.quality-check span {
  display: block;
}

.product-flow {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  background: #fffefe;
}

.product-flow:empty {
  display: none;
}

.product-flow-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.product-flow-header strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.product-flow-header em {
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--blush);
  color: var(--accent-dark);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

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

.product-flow-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fffaf7;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.product-flow-card-wide {
  grid-column: span 2;
}

.product-flow-card.is-locked {
  background: #fff7e8;
}

.product-flow-card span {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.product-flow-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 13px;
}

.product-flow-card p,
.product-flow-card ul {
  margin: 0;
}

.product-flow-card ul {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0;
  list-style: none;
}

.product-flow-card li {
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(138, 85, 31, 0.11);
  color: var(--warning);
  font-size: 11px;
  font-weight: 800;
}

.pattern-history {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  background: #fffafb;
}

.pattern-history:empty {
  display: none;
}

.pattern-history-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.pattern-history-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pattern-history-card span {
  display: block;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pattern-history-card strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.pattern-history-card p,
.pattern-history-card small {
  display: block;
  margin: 3px 0;
}

.pattern-history-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.beginner-guide {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  background: var(--panel);
}

.beginner-guide:empty {
  display: none;
}

.beginner-guide-header {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.beginner-guide-header strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.beginner-guide-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.guide-section {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fffefe;
}

.guide-section h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 13px;
}

.guide-section ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.guide-section li strong,
.guide-section li span,
.guide-section li small {
  display: block;
}

.guide-section li strong {
  color: var(--ink);
}

.guide-section li small {
  margin-top: 2px;
  color: #64748b;
}

.print-package {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  background: #fffefe;
}

.print-package-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.print-package-header strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

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

.package-piece {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fffaf7;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.package-piece:hover,
.package-piece.is-active {
  border-color: var(--accent);
  background: var(--blush);
}

.package-piece strong,
.package-piece span,
.package-piece em,
.package-piece small {
  display: block;
}

.package-piece strong {
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 13px;
}

.package-piece span {
  font-size: 13px;
  font-weight: 800;
}

.package-piece em {
  margin-top: 3px;
  color: var(--sage);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.package-piece small {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
}

.svg-frame {
  min-height: 620px;
  overflow: visible;
  background:
    linear-gradient(#eee6df 1px, transparent 1px),
    linear-gradient(90deg, #eee6df 1px, transparent 1px),
    var(--pattern);
  background-size: 24px 24px;
  padding: 18px;
}

.svg-frame:empty::before {
  display: block;
  max-width: 380px;
  margin: 180px auto 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  content: "Generated SVG pattern preview will appear here.";
}

.svg-frame svg {
  display: block;
  width: min(100%, 980px);
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: #fffefe;
}

.tiled-preview {
  overflow: visible;
  padding: 18px;
  background: #f4eceb;
}

.tiled-preview-header {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.tiled-preview-header strong {
  color: var(--ink);
  font-size: 15px;
}

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

.print-guidance div {
  border: 1px solid rgba(185, 67, 103, 0.2);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--blush);
  color: var(--accent-dark);
  font-size: 12px;
  line-height: 1.4;
}

.print-guidance strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 12px;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.tile-page {
  min-width: 0;
}

.tile-page header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
}

.tile-page header strong {
  color: var(--ink);
  font-size: 12px;
}

.tile-paper {
  position: relative;
  aspect-ratio: 21 / 29.7;
  border: 1px solid var(--strong-line);
  background: #fff;
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.1);
}

.tile-printable {
  position: absolute;
  inset: 4.76%;
  border: 1px dashed #64748b;
  background:
    linear-gradient(#dbe4f0 1px, transparent 1px),
    linear-gradient(90deg, #dbe4f0 1px, transparent 1px),
    #fffdf7;
  background-size: 18px 18px;
}

.tile-artwork {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

@media screen {
  .tile-artwork [data-piece] {
    stroke-width: 1.2;
  }

  .tile-artwork .grainline,
  .tile-artwork .mark {
    stroke-width: 0.9;
  }

  .tile-artwork .piece-title {
    font-size: 10px;
  }

  .tile-artwork .piece-meta,
  .tile-artwork .mark-label,
  .tile-artwork .scale-label,
  .tile-artwork .scale-note {
    font-size: 7px;
  }
}

.tile-origin {
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 1;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
}

.tile-overlap {
  position: absolute;
  z-index: 2;
  border: 1px solid #d97706;
  background: rgba(251, 191, 36, 0.2);
  color: #92400e;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.tile-overlap.left {
  left: 0;
  top: 0;
  bottom: 0;
  width: 18px;
  writing-mode: vertical-rl;
}

.tile-overlap.top {
  left: 0;
  right: 0;
  top: 0;
  height: 18px;
}

.tile-cross {
  position: absolute;
  width: 12px;
  height: 12px;
}

.tile-cross::before,
.tile-cross::after {
  position: absolute;
  background: #111827;
  content: "";
}

.tile-cross::before {
  left: 5px;
  top: 0;
  width: 1px;
  height: 12px;
}

.tile-cross::after {
  left: 0;
  top: 5px;
  width: 12px;
  height: 1px;
}

.tile-cross.top-left {
  left: -6px;
  top: -6px;
}

.tile-cross.top-right {
  right: -6px;
  top: -6px;
}

.tile-cross.bottom-left {
  bottom: -6px;
  left: -6px;
}

.tile-cross.bottom-right {
  bottom: -6px;
  right: -6px;
}

.tile-overflow-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.print-scale-sheet {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body {
    background: #fff;
  }

  .app-shell {
    padding: 0;
  }

  .workspace-header,
  .hero-banner,
  .catalog-panel,
  .product-detail,
  .builder-heading,
  .account-dashboard,
  .account-gate,
  .measurement-panel,
  .output-actions,
  .prototype-note,
  .download-note,
  .preview-summary,
  .tiled-preview {
    display: none;
  }

  body.print-tile-mode .preview-panel > :not(.tiled-preview) {
    display: none;
  }

  body.print-tile-mode .tiled-preview {
    display: block;
    max-height: none;
    overflow: visible;
    padding: 0;
    background: #fff;
  }

  body.print-tile-mode .tiled-preview-header {
    display: none;
  }

  body.print-tile-mode .print-guidance {
    display: none;
  }

  body.print-tile-mode .tile-grid {
    display: block;
  }

  body.print-tile-mode .tile-page {
    position: relative;
    width: 21cm;
    height: 29.7cm;
    break-after: page;
    page-break-after: always;
  }

  body.print-tile-mode .tile-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  body.print-tile-mode .tile-page header {
    position: absolute;
    z-index: 4;
    top: 0.35cm;
    right: 0.75cm;
    left: 0.75cm;
    margin: 0;
    color: #111827;
    font-family: Arial, sans-serif;
    font-size: 9pt;
  }

  body.print-tile-mode .tile-page header strong {
    font-size: 10pt;
  }

  body.print-tile-mode .tile-paper {
    width: 21cm;
    height: 29.7cm;
    border: 0;
    box-shadow: none;
  }

  body.print-tile-mode .tile-printable {
    inset: 1cm;
    border-color: #64748b;
    background-size: 1cm 1cm;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body.print-scale-test-mode .preview-panel > :not(.print-scale-sheet) {
    display: none;
  }

  body.print-scale-test-mode .print-scale-sheet {
    display: block;
    padding: 2cm;
    color: #111827;
    font-family: Arial, sans-serif;
  }

  body.print-scale-test-mode .print-scale-sheet h2 {
    margin: 0 0 0.5cm;
    font-size: 18pt;
  }

  body.print-scale-test-mode .print-scale-sheet p {
    max-width: 14cm;
    margin: 0 0 1cm;
    font-size: 11pt;
    line-height: 1.4;
  }

  body.print-scale-test-mode .css-scale-square {
    display: grid;
    width: 5cm;
    height: 5cm;
    place-items: center;
    border: 1.5pt solid #111827;
    background:
      linear-gradient(#94a3b8, #94a3b8) 50% 0 / 1pt 100% no-repeat,
      linear-gradient(90deg, #94a3b8, #94a3b8) 0 50% / 100% 1pt no-repeat;
    font-size: 10pt;
    font-weight: 700;
  }

  .workspace,
  .tool-layout,
  .preview-panel {
    display: block;
    max-width: none;
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  .panel-heading {
    border: 0;
    padding: 0 0 12px;
  }

  .svg-frame {
    max-height: none;
    min-height: 0;
    overflow: visible;
    padding: 0;
    background: #fff;
  }

  .svg-frame svg {
    width: 100%;
    border: 0;
  }
}

@media (max-width: 980px) {
  .app-shell {
    padding: 18px;
  }

  .hero-banner {
    min-height: 330px;
  }

  .hero-copy {
    max-width: 520px;
    min-height: 330px;
    padding: 34px;
  }

  .hero-banner h1 {
    max-width: 390px;
  }

  .tool-layout {
    grid-template-columns: 1fr;
  }

  .catalog-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .product-detail,
  .account-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .product-detail-facts {
    grid-template-columns: 1fr;
  }

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

  .quality-check-list {
    grid-template-columns: 1fr;
  }

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

  .beginner-guide-sections {
    grid-template-columns: 1fr;
  }

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

  .print-guidance {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 12px;
  }

  .hero-banner {
    min-height: 0;
    background:
      linear-gradient(180deg, rgba(255, 250, 247, 0.94), rgba(255, 250, 247, 0.88)),
      var(--ivory);
  }

  .hero-banner::before {
    background: rgba(255, 250, 247, 0.68);
  }

  .hero-copy {
    min-height: 300px;
    padding: 26px 22px;
  }

  .hero-banner h1 {
    max-width: 310px;
    font-size: clamp(34px, 12vw, 46px);
  }

  .hero-banner p {
    font-size: 14px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
    margin-top: 18px;
  }

  .catalog-panel {
    padding: 14px;
  }

  .catalog-heading h2 {
    font-size: 25px;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .trust-strip {
    margin-top: 18px;
  }

  .field-grid,
  .preview-summary,
  .product-flow-grid,
  .account-grid,
  .pattern-history-list,
  .product-detail,
  .product-detail-facts,
  .account-dashboard-grid,
  .quality-check-list,
  .beginner-guide-sections,
  .print-package-list {
    grid-template-columns: 1fr;
  }

  .product-flow-card-wide {
    grid-column: auto;
  }

  .quality-gate-header,
  .product-flow-header,
  .builder-heading,
  .account-dashboard-header,
  .print-package-header {
    flex-direction: column;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .output-actions {
    flex: none;
    flex-direction: column;
    justify-content: stretch;
    width: 100%;
  }

  .output-actions .compact-button {
    flex: none;
    width: 100%;
  }

  .piece-picker,
  .piece-picker select {
    width: 100%;
  }

  .piece-picker {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
