:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --ink: #1a1214;
  --muted: #6b5d61;
  --line: #e8e4e1;
  --accent: #5c2432;
  --accent-hover: #451c28;
  --focus: rgba(92, 36, 50, 0.12);
  --radius: 2px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "Cormorant Garamond", Georgia, serif;
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.brand .logo {
  display: block;
  height: 36px;
  width: auto;
  object-fit: contain;
  object-position: left;
}

.tagline {
  margin: 0.5rem 0 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--muted);
}

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

/* Buttons */
.btn {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--muted);
}

.btn-wa {
  background: #25d366;
  color: #fff;
}

.btn-wa:hover:not(:disabled) {
  background: #1da851;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1rem;
}

.section-label {
  margin: 0 0 1.25rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent);
}

/* Layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.grid {
  display: grid;
  gap: 1rem 1.25rem;
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.measure-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem 1.25rem;
}

.measure-grid-2 {
  grid-template-columns: 1fr;
}

.stack-fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Fabric card T.B.D toggle */
.fabric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.fabric-head .section-label {
  margin-bottom: 0;
}

.tbd-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
}

.tbd-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tbd-toggle-ui {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  transition: all 0.15s;
}

.tbd-toggle-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: 1px solid var(--muted);
  background: transparent;
  transition: all 0.15s;
}

.tbd-toggle-label em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: inherit;
}

.tbd-toggle:hover .tbd-toggle-ui {
  color: var(--accent);
  border-color: var(--accent);
}

.tbd-toggle input:checked ~ .tbd-toggle-ui {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.tbd-toggle input:checked ~ .tbd-toggle-ui .tbd-toggle-dot {
  background: #fff;
  border-color: #fff;
}

/* Fabric T.B.D stamp (replaces the table when checked) */
.fabric-stamp {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 3rem 1.5rem 3.25rem;
  margin-top: 0.75rem;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(
      135deg,
      rgba(92, 36, 50, 0.02) 0,
      rgba(92, 36, 50, 0.02) 8px,
      transparent 8px,
      transparent 16px
    );
  text-align: center;
}

.fabric-stamp-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.fabric-stamp-brand {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
  line-height: 1;
}

.fabric-card.is-tbd .table-wrap {
  display: none;
}

.fabric-card.is-tbd .fabric-stamp {
  display: flex;
}

.field > span {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field textarea,
.fabric-table input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0;
  border-radius: 0;
  transition: border-color 0.15s;
}

.field input:focus,
.field textarea:focus,
.fabric-table input:focus {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: 0 1px 0 0 var(--accent);
}

.field textarea {
  resize: vertical;
  min-height: 5rem;
  line-height: 1.55;
}

.field-notes textarea {
  border: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
}

.field-notes textarea:focus {
  border-color: var(--accent);
  box-shadow: none;
}

/* Pads toggle */
.pads-toggle {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.15rem;
}

.radio-pill {
  cursor: pointer;
}

.radio-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-pill span {
  display: inline-block;
  font-size: 0.8125rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  transition: all 0.15s;
}

.radio-pill input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Fabric table */
.table-wrap {
  overflow-x: auto;
}

.fabric-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.fabric-table th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0 0.75rem;
  border-bottom: 1px solid var(--line);
}

.fabric-table td {
  padding: 0.65rem 0.5rem 0.65rem 0;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.fabric-table td:first-child {
  padding-left: 0;
  width: 7rem;
}

.row-label {
  font-size: 0.8125rem;
  color: var(--ink);
}

.fabric-table input {
  font-size: 0.875rem;
  padding: 0.25rem 0;
}

/* Footer */
.export-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.export-footer .dot {
  opacity: 0.4;
}

.hint {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 1.5rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: #fff;
  font-size: 0.8125rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  pointer-events: none;
  z-index: 100;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive */
@media (max-width: 900px) {
  .two-col {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 520px) {
  .page {
    padding: 1.5rem 1rem 3rem;
  }

  .grid-4,
  .measure-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    justify-content: stretch;
  }

  .header-actions .btn {
    flex: 1;
  }
}

/* Export capture */
.export-capturing .no-print {
  display: none !important;
}

.export-capturing .site-header {
  border-bottom: none;
  margin-bottom: 1rem;
  padding-bottom: 0;
}

.export-capturing .card {
  break-inside: avoid;
}

@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .card {
    border-color: #ddd;
  }
}
