:root {
  color-scheme: light;
  --bg: #edf3f5;
  --panel: #ffffff;
  --ink: #182326;
  --muted: #647275;
  --line: #d9e1e3;
  --brand: #07506d;
  --brand-dark: #043e56;
  --accent: #0b6a8d;
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--brand);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(380px, 520px);
  align-items: start;
  gap: 20px;
  min-height: 100vh;
  padding: 20px;
}

.workspace,
.preview-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(4, 62, 86, 0.08);
}

.workspace {
  padding: 22px;
  overflow: hidden;
}

.topbar,
.section-title,
.search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo-crop {
  width: 196px;
  height: 62px;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
}

.logo-crop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.42);
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.actions {
  display: flex;
  gap: 10px;
}

.quote-meta {
  display: grid;
  grid-template-columns: 1fr 1fr 140px 1.4fr;
  gap: 12px;
  margin: 22px 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(22, 129, 137, 0.2);
  border-color: var(--brand);
}

select {
  appearance: none;
}

textarea {
  min-height: 74px;
  padding: 8px 10px;
  resize: vertical;
}

.comments-field {
  grid-column: 3 / span 2;
}

.insurance-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.insurance-field legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.insurance-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.insurance-field input {
  width: auto;
  min-height: auto;
  padding: 0;
}

.catalog,
.selected {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}

.custom-product {
  display: grid;
  grid-template-columns: 110px minmax(180px, 1fr) 120px auto;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px dashed #9bb6c1;
  border-radius: 10px;
  background: #f7fafb;
}

.search-row label {
  flex: 1;
}

#resultCount {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.data-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.action-status {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--brand-dark);
  font-size: 12px;
  text-align: right;
}

.results,
.selected-items {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 340px;
  overflow: auto;
  padding-right: 4px;
}

.selected-items {
  height: 340px;
}

.product-row,
.selected-row {
  display: grid;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.product-row {
  grid-template-columns: 1fr auto auto;
}

.selected-row {
  grid-template-columns: 1fr 82px 118px 108px 40px;
}

.name {
  font-weight: 700;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.price,
#grandTotal {
  color: var(--brand-dark);
}

.remove {
  width: 36px;
  padding: 0;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 18px;
  overflow: auto;
}

.preview-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 12px;
}

.preview-controls button {
  min-height: 34px;
  padding: 0 12px;
}

.preview-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

#pageIndicator {
  min-width: 96px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

canvas {
  align-self: center;
  width: 100%;
  max-width: 480px;
  height: auto;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(24, 35, 38, 0.12);
}

.app-credit {
  position: fixed;
  right: 14px;
  bottom: 10px;
  z-index: 10;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(217, 225, 227, 0.9);
  border-radius: 6px;
  padding: 5px 8px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .quote-meta {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-title,
  .search-row {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .actions button {
    flex: 1;
  }

  .action-status {
    text-align: left;
  }
}
