:root {
  color-scheme: light;
  --ink: #252329;
  --muted: #77727b;
  --line: #e8e3e8;
  --surface: #fff;
  --soft: #faf7f9;
  --accent: #9c4168;
  --accent-dark: #7e2f51;
  --dark: #29242a;
  --good: #2f8f5b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font: 15px/1.45 Arial, sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 5vw;
  color: #fff;
  background: #29242a;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 40px; width: auto; display: block; }
.topbar strong { margin-right: 16px; letter-spacing: .08em; }
.topbar span { color: #d8cbd2; }
.role { font-size: 13px; }
.profile-summary { font-size: 13px; white-space: nowrap; }
.topbar-links { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(340px, .85fr);
  gap: 28px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 42px 5vw;
}

.page-heading { margin-bottom: 28px; }
.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 32px; }
h2 { margin-bottom: 6px; font-size: 20px; }
.page-heading p:last-child, .config p:last-child { color: var(--muted); }

.filters {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
}
label { display: grid; gap: 7px; flex: 1; color: var(--muted); font-size: 13px; font-weight: 700; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--surface);
}

.design-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.special-product {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed #d7b9c7;
  border-radius: 12px;
  background: #fffafd;
}
.special-product h2 { margin-bottom: 8px; }
.product-photo { max-width: 220px; max-height: 220px; border-radius: 10px; display: block; margin: 10px 0; object-fit: cover; }
.product-card, .order-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.design-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.design-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px #f0d8e2; }
.design-image { display: grid; place-items: center; height: 180px; color: #a4969f; background: #eee9ec; font-size: 12px; overflow: hidden; }
.design-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.color-swatch { display: block; width: 100%; height: 100%; border: 1px solid rgba(0,0,0,0.08); }
.design-info { padding: 12px; }
.design-info h3 { margin: 0 0 3px; font-size: 15px; }
.product-meta { color: var(--muted); font-size: 13px; }

.button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
}
.button.primary { color: #fff; background: var(--accent); }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { color: var(--ink); background: #f1edf0; }
.button.dark { color: #fff; background: var(--dark); }
.button.dark:hover { background: #3a333c; }
.button:disabled { cursor: not-allowed; opacity: .45; }
.modal-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; background: rgba(37, 35, 41, .6); overflow-y: auto; }
.modal-overlay[hidden] { display: none; }
.modal-card { width: 100%; max-width: 720px; background: var(--surface); border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); padding: 28px; }
.modal-topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 16px; }

.order-panel {
  position: sticky;
  top: 20px;
  align-self: start;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
}
.config, .cart { padding: 22px; }
.config { min-height: 245px; border-bottom: 1px solid var(--line); }
.config.empty { display: flex; flex-direction: column; justify-content: center; }
.config form { display: grid; gap: 14px; margin-top: 20px; }
.selected-design { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.sku-preview { color: var(--accent); font-size: 13px; font-weight: 700; }
.cart-heading { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.cart-heading > span { color: var(--muted); font-size: 12px; text-align: right; }
.cart-list { display: grid; gap: 10px; margin: 18px 0; }
.cart-row { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cart-row strong { display: block; font-size: 14px; }
.cart-row small { color: var(--muted); }
.cart-row .remove { border: 0; color: var(--accent); background: none; font-size: 12px; }
.muted { color: var(--muted); }
.cart-total { display: grid; gap: 5px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.cart-total strong { font-size: 18px; }
.order-status { min-height: 20px; margin: 14px 0 0; color: var(--accent-dark); font-size: 13px; font-weight: 700; }
.actions { display: flex; gap: 8px; margin-top: 20px; }
.actions .button { flex: 1; }
.export-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.history { padding: 22px; border-top: 1px solid var(--line); }
.order-history { display: grid; gap: 9px; margin-top: 14px; }
.history-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.history-row strong, .history-row small { display: block; }
.history-row small { color: var(--muted); }
.print-only-header { display: none; }
table { width: 100%; margin-top: 12px; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.design-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.muted-thumb { color: var(--muted); font-size: 12px; }
.approval-panel { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.approval-status { margin: 0; font-size: 13px; color: var(--muted); }
.approval-status-done { color: var(--good); font-weight: 700; }

@media print {
  .topbar { display: none !important; }
  .layout { display: block; padding: 0; max-width: none; }
  .catalog { display: none !important; }
  .order-panel { position: static; box-shadow: none; max-height: none; overflow: visible; }
  .order-panel > *:not(.history) { display: none !important; }
  .history { border-top: 0; padding: 0; }
  .history > *:not(#order-detail) { display: none !important; }
  #order-detail { display: block !important; position: static !important; padding: 0 !important; background: none !important; }
  #order-detail .modal-card { box-shadow: none; border-radius: 0; padding: 0; max-width: none; }
  .print-only-header { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
  .print-only-header .brand-logo { height: 36px; }
  .print-only-header h1 { font-size: 24px; }
  #order-detail .modal-topbar { display: none !important; }
  tr { break-inside: avoid; }
}

@media (max-width: 850px) {
  .layout { grid-template-columns: 1fr; }
  .order-panel {
    position: sticky;
    top: 10px;
    z-index: 10;
    order: -1;
    max-height: 48vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(41, 36, 42, .12);
  }
}
@media (max-width: 560px) {
  .filters { flex-direction: column; }
  .topbar { padding: 10px 20px; }
  .topbar-links { gap: 10px; }
  .profile-summary { display: none; }
}
