/* Create-from-scratch quote builder (/Package-scratch). Builds on quote-builder.css (.qb-page, .qb-input …). */

.sq-page { padding: 1rem 1rem 3rem; }

.sq-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.sq-eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.sq-title { margin: 0.2rem 0; font-size: 1.35rem; font-weight: 700; color: #163a5f; overflow-wrap: anywhere; }
.sq-sub { margin: 0; color: #5b6b7c; font-size: 0.88rem; }

.sq-header__actions,
.sq-head-actions,
.sq-summary__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.sq-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  color: #475569;
  background: #fff;
}
.sq-badge--draft { border-color: #f59e0b; color: #b45309; background: #fffbeb; }
.sq-badge--final { border-color: #16a34a; color: #15803d; background: #f0fdf4; }

.sq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #163a5f;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.sq-btn:hover { border-color: #7aa2d4; color: #163a5f; }
.sq-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.sq-btn--primary { background: #163a5f; border-color: #163a5f; color: #fff; }
.sq-btn--primary:hover { color: #fff; background: #1d4b7a; }

.sq-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  margin-bottom: 0.75rem;
  background: var(--qb-bg, #f4f6fa);
}
.sq-nav button {
  border: 1px solid #dbe5f2;
  background: #fff;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  color: #334155;
  white-space: nowrap;
  cursor: pointer;
}
.sq-nav button:hover { border-color: #7aa2d4; }

.sq-errors ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }

.sq-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1rem;
  align-items: start;
}

.sq-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.sq-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  scroll-margin-top: 3.5rem;
  min-width: 0;
}
.sq-card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.sq-card__title { margin: 0 0 0.5rem; font-size: 1.05rem; font-weight: 700; color: #1a2b3c; }
.sq-card__head .sq-card__title { margin: 0; }

.sq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
}

.sq-field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.sq-field > span { font-size: 0.78rem; font-weight: 600; color: #475569; }
.sq-field > span small { font-weight: 400; color: #94a3b8; }
.sq-field--wide { grid-column: 1 / -1; }
.sq-field--half { grid-column: span 2; }
.sq-field--narrow .qb-input { max-width: 9rem; }
.sq-field--check { flex-direction: row; align-items: center; gap: 0.4rem; padding-top: 1.2rem; font-size: 0.85rem; }
.sq-field--check > span { font-weight: 500; color: #334155; font-size: 0.85rem; }

.sq-page .qb-input,
.sq-page .qb-select { padding: 0.5rem 0.65rem; font-size: 0.88rem; }
.sq-page textarea.qb-input { resize: vertical; min-height: 2.6rem; }

.sq-internal { background: #fffbeb; border-color: #fde68a; }
.sq-internal-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  vertical-align: middle;
}

.sq-readonly {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.88rem;
  min-height: 2.35rem;
  overflow-wrap: anywhere;
}
.sq-readonly small { color: #64748b; }
.sq-strong { font-weight: 700; color: #163a5f; }

.sq-chips, .sq-checks { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.85rem; }
.sq-chip-input { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: #475569; }
.sq-chip-input input { width: 4rem; border: 1px solid #dcdfe6; border-radius: 6px; padding: 0.25rem 0.4rem; }

.sq-empty { margin: 0.25rem 0; color: #94a3b8; font-size: 0.88rem; }
.sq-hint { margin: 0.25rem 0 0.5rem; color: #64748b; font-size: 0.82rem; }

.sq-price-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem;
  margin: 0.25rem 0 0.85rem;
}
.sq-price-display__label {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}
.sq-price-display__option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
}
.sq-price-display__option:has(input:checked) { border-color: #163a5f; background: #f0f6fc; }
.sq-price-display__option input { margin-top: 0.2rem; accent-color: #163a5f; }
.sq-price-display__option strong { display: block; font-size: 0.88rem; color: #1a2b3c; }
.sq-price-display__option small { display: block; color: #64748b; font-size: 0.78rem; line-height: 1.35; }

.sq-item, .sq-line {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-top: 0.6rem;
  background: #fff;
}
.sq-item.is-open, .sq-line.is-open { border-color: #b8cbe6; box-shadow: 0 1px 6px rgba(15, 45, 90, 0.06); }
.sq-line { background: #fbfcfe; }
.sq-line.is-hidden { border-style: dashed; }

.sq-item__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
}
.sq-item__toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.6rem;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  padding: 0;
}
.sq-item__name { font-weight: 600; color: #1a2b3c; overflow-wrap: anywhere; }
.sq-item__meta { font-size: 0.78rem; color: #64748b; }
.sq-item__price { font-weight: 700; color: #163a5f; white-space: nowrap; font-size: 0.9rem; }
.sq-item__tools { display: flex; gap: 0.2rem; }
.sq-item__tools button,
.sq-gallery figcaption button {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 6px;
  width: 1.9rem;
  height: 1.9rem;
  cursor: pointer;
  color: #334155;
  line-height: 1;
}
.sq-item__tools button:disabled,
.sq-gallery figcaption button:disabled { opacity: 0.35; cursor: default; }
.sq-item__body { padding: 0.25rem 0.8rem 0.8rem; border-top: 1px solid #eef2f7; }
.sq-inline-alert { margin: 0 0.7rem 0.5rem; }

.sq-line__type {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #1d4b7a;
  background: #e8f0fb;
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
}

.sq-subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.8rem 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.sq-link {
  border: none;
  background: none;
  padding: 0;
  color: #2d6cdf;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.sq-danger { color: #b91c1c !important; }
.sq-add-select { max-width: 13rem; }

.sq-upload { position: relative; overflow: hidden; }
.sq-upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.sq-image-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.sq-thumb { width: 96px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid #e2e8f0; }

.sq-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.5rem; }
.sq-gallery figure { margin: 0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #f8fafc; }
.sq-gallery img { width: 100%; height: 84px; object-fit: cover; display: block; }
.sq-gallery figcaption { display: flex; justify-content: center; gap: 0.25rem; padding: 0.25rem; }

.sq-rooms { display: flex; flex-direction: column; gap: 0.4rem; }
.sq-room {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.8rem;
  padding: 0.45rem 0.6rem;
  background: #f8fafc;
  border: 1px dashed #dcdfe6;
  border-radius: 8px;
  font-size: 0.82rem;
}
.sq-room input[type=number] { width: 3.6rem; border: 1px solid #dcdfe6; border-radius: 6px; padding: 0.2rem 0.35rem; }
.sq-child { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; padding: 0.15rem 0.4rem; }

.sq-rate-table { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.4rem 0 0.6rem; max-width: 560px; }
.sq-rate-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr 1fr; gap: 0.4rem; align-items: center; font-size: 0.84rem; }
.sq-rate-row--head { font-size: 0.72rem; font-weight: 700; color: #64748b; text-transform: uppercase; }
.sq-rate-row input { width: 100%; border: 1px solid #dcdfe6; border-radius: 6px; padding: 0.35rem 0.45rem; font-size: 0.84rem; }
.sq-rate-row input:disabled { background: #f1f5f9; color: #475569; }
.sq-markup { align-items: end; }

.sq-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; margin-bottom: 0.6rem; }
.sq-table th, .sq-table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid #eef2f7; text-align: right; }
.sq-table th:first-child, .sq-table td:first-child { text-align: left; }
.sq-table th { font-size: 0.72rem; text-transform: uppercase; color: #64748b; }
.sq-table__total td { font-weight: 700; color: #163a5f; }

.sq-summary { position: sticky; top: 3.5rem; }
.sq-summary__card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}
.sq-summary__card h3 { margin: 0 0 0.6rem; font-size: 0.95rem; font-weight: 700; }
.sq-summary dl { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 0.5rem; margin: 0; font-size: 0.86rem; }
.sq-summary dt { font-weight: 500; color: #475569; }
.sq-summary dd { margin: 0; text-align: right; }
.sq-sum-strong { font-weight: 700 !important; color: #1a2b3c !important; }
.sq-sum-total { font-weight: 800 !important; color: #163a5f !important; font-size: 1rem; border-top: 1px solid #e2e8f0; padding-top: 0.35rem; }
.sq-summary__internal { margin-top: 0.8rem; padding: 0.6rem; border-radius: 8px; background: #fffbeb; border: 1px solid #fde68a; }
.sq-summary__internal > span { display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: #b45309; margin-bottom: 0.3rem; }
.sq-negative { color: #b91c1c; font-weight: 700; }
.sq-summary__actions { margin-top: 0.8rem; }
.sq-summary__actions .sq-btn { flex: 1; }

@media (max-width: 1100px) {
  .sq-layout { grid-template-columns: 1fr; }
  .sq-summary { position: static; order: -1; }
}

@media (max-width: 640px) {
  .sq-page { padding: 0.75rem 0.5rem 2rem; }
  .sq-field--half { grid-column: 1 / -1; }
  .sq-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .sq-item__head { flex-wrap: wrap; }
  .sq-rate-row { grid-template-columns: 1fr 1fr; }
  .sq-rate-row > :first-child { grid-column: 1 / -1; }
  .sq-rate-row--head > :first-child { display: none; }
}
