:root {
  --bg: #F0ECDE;
  --cream: #FBF8EF;
  --sage: #E7ECE0;
  --tan: #EAE6D4;
  --forest: #25392D;
  --forest-soft: #3A5346;
  --ink: #1F1F1F;
  --soft-ink: #4A4A4A;
  --muted: #8A8A8A;
  --rule: rgba(31,31,31,0.12);
  --rule-soft: rgba(31,31,31,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--ink); }
body {
  font-family: "Inter", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* === TOPBAR === */
.topbar { background: var(--forest); color: white; border-bottom: 1px solid rgba(255,255,255,0.08); }
.topbar-inner {
  max-width: 1480px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-brand {
  font-family: "Cormorant Garamond", serif; font-size: 22px; font-weight: 500;
}
.topbar-brand span {
  font-family: "Inter", sans-serif; font-size: 12px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--tan); font-weight: 500; margin-left: 8px;
}
.quote-btn {
  position: relative; background: var(--tan); color: var(--forest);
  border: none; padding: 10px 18px; border-radius: 6px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; font-size: 14px;
}
.quote-icon { font-size: 16px; line-height: 1; }
.quote-count {
  background: var(--forest); color: white; min-width: 22px; height: 22px;
  border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; padding: 0 6px;
}

/* === VIEWER LAYOUT === */
.viewer {
  max-width: 1480px; margin: 0 auto; padding: 24px;
  display: grid; grid-template-columns: 1fr 380px; gap: 24px;
}

/* === PAGE AREA === */
.page-area {
  background: var(--cream); border: 1px solid var(--rule); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden;
}
.page-nav {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--rule-soft);
}
.nav-btn {
  background: var(--forest); color: white; border: none;
  padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500;
}
.nav-btn:hover { background: var(--forest-soft); }
.page-info { font-size: 13px; color: var(--soft-ink); }
.page-input {
  width: 56px; padding: 4px 8px; border: 1px solid var(--rule);
  border-radius: 6px; text-align: center;
}
.section-jump {
  margin-left: auto; padding: 6px 10px; border: 1px solid var(--rule);
  border-radius: 6px; background: white; min-width: 200px;
}
.page-img-wrap {
  flex: 1; padding: 18px 24px; display: flex; align-items: center; justify-content: center;
  min-height: 0;
}
.page-img-wrap img {
  max-width: 100%; max-height: calc(100vh - 200px);
  width: auto; height: auto; object-fit: contain;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* === SIDEBAR === */
.sidebar {
  background: var(--cream); border: 1px solid var(--rule); border-radius: 16px;
  padding: 18px; max-height: calc(100vh - 96px); overflow-y: auto;
}
.sidebar-title {
  font-family: "Cormorant Garamond", serif; font-size: 22px; font-weight: 600;
  color: var(--forest); margin-bottom: 10px;
}
.sidebar-help {
  font-size: 13px; color: var(--soft-ink); line-height: 1.55;
  padding-bottom: 14px; border-bottom: 1px solid var(--rule); margin-bottom: 14px;
}
.sidebar-help strong { color: var(--forest); }
.sidebar-empty { color: var(--muted); font-style: italic; font-size: 14px; }
.product-card {
  background: white; border: 1px solid var(--rule); border-radius: 10px;
  padding: 14px; margin-bottom: 12px;
}
.product-name {
  font-family: "Cormorant Garamond", serif; font-size: 17px; font-weight: 500;
  color: var(--forest); line-height: 1.25; margin-bottom: 4px;
}
.product-sku {
  font-family: "Inter", sans-serif; font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--forest-soft); font-weight: 600; margin-bottom: 10px;
}
.pricing-table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 12px; }
.pricing-table th, .pricing-table td {
  padding: 4px 8px; text-align: right; border-bottom: 1px solid var(--rule-soft);
}
.pricing-table th { color: var(--muted); font-weight: 500; font-size: 11px; }
.pricing-table th:first-child, .pricing-table td:first-child {
  text-align: left; font-weight: 600;
}
.pricing-empty { font-size: 12px; color: var(--muted); font-style: italic; margin-bottom: 10px; }
.add-btn {
  width: 100%; background: var(--forest); color: white; border: none;
  padding: 8px 12px; border-radius: 6px; font-size: 13px; font-weight: 500;
  margin-top: 6px;
}
.add-btn:hover { background: var(--forest-soft); }
.add-btn.added { background: #2d8259; }

/* === QUOTE-REQUEST DRAWER === */
.quote-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100vw;
  background: white; box-shadow: -8px 0 24px rgba(0,0,0,0.18);
  transform: translateX(100%); transition: transform 0.25s ease;
  z-index: 1000; display: flex; flex-direction: column;
}
.quote-drawer.open { transform: translateX(0); }
.quote-drawer-inner {
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 0; height: 100%;
}
.quote-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--rule);
}
.quote-drawer-head h2 {
  font-family: "Cormorant Garamond", serif; font-size: 22px; color: var(--forest);
}
.quote-close, .modal-close {
  background: none; border: none; font-size: 24px; color: var(--muted);
  width: 32px; height: 32px; line-height: 1;
}
.quote-items { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px; }
.quote-item {
  display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule-soft);
}
.quote-item-body { flex: 1; }
.quote-item-name { font-weight: 500; color: var(--forest); margin-bottom: 2px; }
.quote-item-sku { font-size: 11px; color: var(--muted); letter-spacing: 0.12em; }
.quote-item-remove {
  background: none; border: none; color: var(--muted); font-size: 12px;
  text-decoration: underline; padding: 0; margin-top: 8px;
}
.quote-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.quote-drawer-foot { padding: 18px 22px; border-top: 1px solid var(--rule); }
.submit-btn {
  width: 100%; background: var(--forest); color: white; border: none;
  padding: 14px 18px; border-radius: 6px; font-size: 15px; font-weight: 500;
}
.submit-btn:disabled { background: var(--muted); cursor: not-allowed; }
.submit-btn:not(:disabled):hover { background: var(--forest-soft); }

/* === MODAL === */
.modal {
  position: fixed; inset: 0; background: rgba(37, 57, 45, 0.55);
  display: none; align-items: center; justify-content: center;
  z-index: 1100; padding: 20px;
}
.modal.open { display: flex; }
.modal-card {
  background: var(--cream); border-radius: 18px; max-width: 540px; width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px; border-bottom: 1px solid var(--rule);
}
.modal-head h2 {
  font-family: "Cormorant Garamond", serif; font-size: 24px; color: var(--forest);
}
.modal-intro {
  padding: 18px 26px 0; font-size: 14px; color: var(--soft-ink); line-height: 1.6;
}
#submit-form { padding: 18px 26px 22px; display: flex; flex-direction: column; gap: 14px; }
#submit-form label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--soft-ink); font-weight: 500;
}
#submit-form input, #submit-form textarea {
  padding: 10px 12px; border: 1px solid var(--rule); border-radius: 6px;
  font-size: 14px; text-transform: none; letter-spacing: 0;
}
.submit-actions { display: flex; gap: 10px; margin-top: 4px; }
.submit-actions .submit-btn { flex: 1; }
.submit-btn-secondary {
  background: white; color: var(--forest); border: 1px solid var(--forest);
}
.submit-btn-secondary:hover { background: var(--cream); color: var(--forest); }
@media (max-width: 540px) {
  .submit-actions { flex-direction: column; }
}
.modal-foot-note {
  padding: 0 26px 22px; font-size: 12px; color: var(--muted); font-style: italic;
}

/* === FOOTER === */
.page-footer {
  max-width: 1480px; margin: 0 auto; padding: 0 24px 32px;
  font-size: 12px; color: var(--muted); font-style: italic;
  line-height: 1.55; text-align: center;
}
.page-footer p { max-width: 720px; margin: 0 auto; }

/* === RESPONSIVE === */
@media (max-width: 960px) {
  .viewer { grid-template-columns: 1fr; }
  .sidebar { max-height: none; }
  .quote-drawer { width: 100vw; }
}
@media (max-width: 600px) {
  .topbar-brand span { display: none; }
  .quote-btn span:nth-child(2) { display: none; }
  .page-nav { flex-wrap: wrap; }
  .section-jump { width: 100%; margin-left: 0; }
}
