:root {
  --bg: #f5efe4;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #fffdfa;
  --ink: #1f1b19;
  --muted: #6c655f;
  --line: #e7dccd;
  --accent: #b70f1d;
  --shadow: 0 22px 48px rgba(62, 42, 23, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Avenir Next", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 231, 208, 0.8), transparent 28%),
    radial-gradient(circle at top right, rgba(237, 233, 248, 0.72), transparent 24%),
    linear-gradient(180deg, #fbf8f4 0%, #f3ebdf 54%, #efe2d1 100%);
}

body {
  padding: 24px;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
}

.sidebar,
.panel,
.topbar {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border-radius: 28px;
}

.brand h1,
.topbar h2 {
  margin: 0;
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
}

.muted,
.helper {
  color: var(--muted);
}

.helper {
  font-size: 0.9rem;
  line-height: 1.5;
}

.panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius);
}

.panel h2,
.panel h3 {
  margin: 0 0 14px;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-link,
.btn {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.nav-link {
  padding: 12px 16px;
  text-align: left;
  background: #f7f0e7;
  color: var(--ink);
}

.nav-link.active {
  background: linear-gradient(135deg, #c71922, #96111a);
  color: #fff;
}

.content {
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  padding: 20px 22px;
  border-radius: 28px;
}

.topbar-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.meta-chip {
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--surface-strong);
}

.meta-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.view {
  display: none;
  margin-top: 18px;
}

.view.active {
  display: block;
}

.stats-grid,
.layout-two {
  display: grid;
  gap: 18px;
}

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

.layout-two {
  grid-template-columns: 1.05fr 0.95fr;
  margin-top: 18px;
}

.stat-card {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 2rem;
}

.section-head,
.action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.action-row {
  margin-top: 14px;
}

.address-copy-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 18px;
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.btn-primary {
  background: linear-gradient(135deg, #c71922, #96111a);
  color: #fff;
}

.btn-ghost {
  background: #f7f0e7;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.stack {
  display: grid;
}

.gap-sm {
  gap: 10px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label span {
  font-size: 0.82rem;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid #dbcdbd;
  background: #fffdfa;
  color: var(--ink);
}

.is-readonly,
input[readonly],
textarea[readonly] {
  background: #f5efe6;
  color: var(--muted);
  cursor: not-allowed;
}

textarea {
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.logo-helper {
  padding: 14px 16px;
  border-radius: 18px;
  background: #f8f1e8;
  border: 1px dashed var(--line);
}

.search {
  max-width: 260px;
}

.equipment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.equipment-grid.compact {
  max-height: 240px;
  overflow: auto;
}

.equipment-card,
.list-item,
.quote-item-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-strong);
}

.equipment-card {
  overflow: hidden;
}

.equipment-card img,
.equipment-fallback {
  width: 100%;
  height: 144px;
  object-fit: cover;
}

.equipment-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2a2420, #4d453f);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
}

.equipment-card-body {
  padding: 14px;
}

.equipment-card h4 {
  margin: 0 0 6px;
}

.meta,
.list-item small {
  color: var(--muted);
}

.equipment-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.list-stack {
  display: grid;
  gap: 12px;
}

.list-item {
  padding: 16px;
}

.list-item h4 {
  margin: 0 0 6px;
}

.quote-item-card {
  padding: 14px;
}

.quote-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.quote-item-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.quote-line-rule {
  padding: 10px 12px;
  border-radius: 16px;
  background: #f8f1e8;
  border: 1px solid var(--line);
}

.approval-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #fff3e4;
  border: 1px solid #efc997;
}

.approval-chip {
  display: inline-flex;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #c71922;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 600;
}

.compact-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.summary-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  background: #f8f1e8;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
}

.summary-row.total {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 2px solid #211d1b;
}

.quote-detail-sheet {
  display: grid;
  gap: 22px;
  padding: 10px 18px 24px;
  border-radius: 0;
  background: #fff;
  border: 0;
  box-shadow: none;
}

.quote-doc-kicker {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.quote-doc-kicker p:first-child {
  justify-self: start;
}

.quote-doc-kicker p:nth-child(2) {
  justify-self: center;
}

.quote-doc-kicker p:last-child {
  justify-self: end;
}

.quote-detail-header,
.quote-detail-footer,
.quote-title-row,
.quote-parties-grid,
.quote-ship-row {
  display: grid;
  gap: 18px;
}

.quote-detail-header {
  grid-template-columns: 1.1fr 1fr;
  align-items: start;
}

.quote-brand-block {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.quote-logo-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.quote-company-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  background: #fff;
  border: 0;
  border-bottom: 2px solid #7d7d7d;
  border-right: 2px solid #7d7d7d;
  border-radius: 0;
  padding: 0 12px 12px 0;
}

.quote-logo-caption {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: #4d4d4d;
  text-align: center;
}

.quote-company-block {
  text-align: right;
}

.quote-company-block h2 {
  font-size: 2rem;
}

.quote-company-block p {
  line-height: 1.5;
}

.quote-divider {
  height: 4px;
  background: var(--accent);
  margin-top: -2px;
}

.quote-title-row {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.quote-title-block h1 {
  margin: 0;
  font-size: 3.3rem;
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  color: #b1b1b1;
}

.quote-title-subtitle {
  margin: 6px 0 0;
  font-size: 0.96rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: #444;
}

.quote-info-mini {
  min-width: 300px;
}

.quote-info-mini p,
.quote-sales-meta p {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  margin: 0 0 8px;
  text-align: right;
}

.quote-info-mini span,
.quote-sales-meta span {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #555;
  font-size: 0.82rem;
}

.quote-info-mini strong,
.quote-sales-meta strong {
  font-size: 1rem;
}

.quote-parties-grid {
  grid-template-columns: 0.95fr 1.05fr;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.quote-ship-row {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.quote-party-block h4 {
  margin: 10px 0 8px;
  font-size: 1.1rem;
}

.quote-party-block p {
  max-width: 460px;
}

.ship-to-block {
  padding-top: 2px;
}

.quote-table-shell {
  padding-top: 2px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  margin: 6px 0 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f7f0e7;
  color: var(--ink);
  font-weight: 600;
}

.approval-banner {
  background: #fff3e4;
  border-color: #efc997;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
}

.quote-summary-shell h4,
.quote-summary-shell p,
.quote-party-block p,
.quote-party-block h4 {
  margin: 0 0 8px;
}

.quote-summary-shell p,
.quote-party-block p {
  line-height: 1.55;
}

.quote-detail-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.quote-detail-table th,
.quote-detail-table td {
  padding: 18px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.quote-detail-table thead th {
  padding-top: 0;
  padding-bottom: 10px;
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #5a5a5a;
  border-bottom: 3px solid #252525;
}

.quote-detail-table th:nth-child(1),
.quote-detail-table td:nth-child(1) {
  width: 48%;
}

.quote-detail-table th:nth-child(2),
.quote-detail-table td:nth-child(2) {
  width: 12%;
}

.quote-detail-table th:nth-child(3),
.quote-detail-table td:nth-child(3) {
  width: 6%;
}

.quote-detail-table th:nth-child(4),
.quote-detail-table td:nth-child(4) {
  width: 12%;
}

.quote-detail-table th:nth-child(5),
.quote-detail-table td:nth-child(5) {
  width: 8%;
}

.quote-detail-table th:nth-child(6),
.quote-detail-table td:nth-child(6) {
  width: 14%;
}

.quote-detail-table th:nth-child(3),
.quote-detail-table td:nth-child(3),
.quote-detail-table th:nth-child(4),
.quote-detail-table td:nth-child(4),
.quote-detail-table th:nth-child(5),
.quote-detail-table td:nth-child(5),
.quote-detail-table th:nth-child(6),
.quote-detail-table td:nth-child(6) {
  text-align: right;
  white-space: nowrap;
}

.quote-detail-table.hide-discount-column th:nth-child(5),
.quote-detail-table.hide-discount-column td:nth-child(5) {
  display: none;
}

.detail-item-title {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.25;
}

.detail-item-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.detail-item-copy {
  min-width: 0;
}

.detail-item-thumb {
  width: 72px;
  min-width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 0;
  border: 0;
  background: transparent;
}

.detail-item-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2a2420, #4d453f);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

.detail-item-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.detail-item-specs {
  margin-top: 8px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.93rem;
  line-height: 1.5;
}

.detail-item-specs strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

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

.quote-summary-shell {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.totals-card p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.grand-total {
  margin-top: 10px !important;
  padding-top: 10px;
  border-top: 2px solid #211d1b;
  font-size: 1.05rem;
}

.no-print {
  margin-bottom: 14px;
}

.bullets,
.steps {
  margin: 0;
  padding-left: 18px;
  line-height: 1.65;
}

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

  .sidebar {
    position: static;
    max-height: none;
  }

  .stats-grid,
  .layout-two,
  .quote-detail-header,
  .quote-detail-footer,
  .quote-title-row,
  .quote-parties-grid,
  .quote-ship-row,
  .equipment-grid,
  .quote-item-fields,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .quote-company-block {
    text-align: left;
  }

  .quote-info-mini {
    min-width: 0;
  }

  .quote-info-mini p,
  .quote-sales-meta p {
    text-align: left;
  }

  .detail-item-main {
    flex-direction: column;
  }
}

@media (max-width: 900px) {
  .quote-detail-meta {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    padding: 0;
    background: #fff;
  }

  .sidebar,
  .topbar,
  .no-print,
  #view-dashboard,
  #view-equipment,
  #view-quotes,
  #view-builder,
  #view-setup {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .content {
    width: 100%;
  }

  #view-quote-detail {
    display: block !important;
    margin-top: 0;
  }

  .quote-detail-sheet {
    box-shadow: none;
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .quote-detail-header {
    grid-template-columns: 1.1fr 1fr !important;
  }

  .quote-title-row {
    grid-template-columns: 1fr auto !important;
  }

  .quote-parties-grid {
    grid-template-columns: 0.95fr 1.05fr !important;
  }

  .quote-ship-row {
    grid-template-columns: 1fr auto !important;
  }

  .quote-detail-table {
    table-layout: fixed;
    font-size: 11px;
  }

  .quote-detail-table th,
  .quote-detail-table td {
    padding: 8px 6px;
  }

  .quote-detail-table th:nth-child(1),
  .quote-detail-table td:nth-child(1) {
    width: 44%;
  }

  .quote-detail-table th:nth-child(2),
  .quote-detail-table td:nth-child(2) {
    width: 11%;
  }

  .quote-detail-table th:nth-child(3),
  .quote-detail-table td:nth-child(3) {
    width: 6%;
  }

  .quote-detail-table th:nth-child(4),
  .quote-detail-table td:nth-child(4) {
    width: 13%;
  }

  .quote-detail-table th:nth-child(5),
  .quote-detail-table td:nth-child(5) {
    width: 8%;
  }

  .quote-detail-table th:nth-child(6),
  .quote-detail-table td:nth-child(6) {
    width: 18%;
    white-space: nowrap;
  }

  .detail-item-main {
    flex-direction: row !important;
    gap: 8px;
  }

  .detail-item-thumb {
    width: 56px;
    min-width: 56px;
    height: 56px;
  }

  .detail-item-title {
    font-size: 0.98rem;
  }

  .detail-item-specs {
    margin-top: 6px;
    font-size: 0.8rem;
    line-height: 1.4;
  }

  .quote-company-logo {
    width: 72px;
    height: 72px;
  }
}
