:root {
  --ink: #111827;
  --ink-muted: #596273;
  --night: #07111f;
  --night-2: #132238;
  --steel: #d9e1ec;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --line: #d8dde6;
  --line-strong: #b8c2d2;
  --field: #f8fafc;
  --accent: #f1b434;
  --accent-dark: #b7790b;
  --danger: #b42318;
  --success: #0f7b57;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-display: "Barlow Condensed", sans-serif;
  --font-body: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(241, 180, 52, 0.18), transparent 34rem),
    linear-gradient(135deg, rgba(7, 17, 31, 0.06) 25%, transparent 25%) 0 0 / 28px 28px,
    var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
}

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

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 2.4vw, 34px);
}

.quote-header {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(300px, auto) minmax(320px, 1fr);
  gap: clamp(18px, 3vw, 42px);
  align-items: center;
  min-height: 150px;
  padding: clamp(18px, 2.3vw, 30px);
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(241, 180, 52, 0.2), transparent 38%),
    linear-gradient(120deg, var(--night), var(--night-2));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.quote-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(90deg, black, transparent 75%);
}

.quote-header > * {
  position: relative;
  z-index: 1;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 24px);
  flex-wrap: wrap;
}

.brand-logo {
  max-height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.2));
}

.ezclick-logo {
  width: min(210px, 42vw);
}

.dakota-logo {
  width: min(190px, 42vw);
}

.brand-divider {
  width: 1px;
  align-self: stretch;
  min-height: 64px;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.44), transparent);
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
}

.hero-copy h1,
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 0.95;
  text-transform: uppercase;
}

.hero-copy h1 {
  max-width: 760px;
  font-size: clamp(2.4rem, 4.4vw, 4.7rem);
}

.hero-note {
  max-width: 710px;
  margin: 1rem 0 0;
  color: rgba(255, 255, 255, 0.8);
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 170px;
}

.button,
.icon-button {
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.78rem 1.15rem;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(241, 180, 52, 0.42);
  outline-offset: 2px;
}

.button-primary {
  color: #111827;
  background: var(--accent);
  box-shadow: 0 12px 28px rgba(241, 180, 52, 0.28);
}

.button-primary:hover {
  background: #ffd16a;
}

.button-ghost {
  color: inherit;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.panel .button-ghost {
  color: var(--ink);
  background: #f5f7fb;
  border-color: var(--line);
}

.button-danger {
  color: #ffffff;
  background: rgba(180, 35, 24, 0.9);
}

.quote-form,
.panel {
  margin-top: clamp(18px, 2vw, 28px);
}

.panel {
  padding: clamp(18px, 2.5vw, 32px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(184, 194, 210, 0.72);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.35rem;
}

.section-head h2 {
  color: var(--night);
  font-size: clamp(2rem, 3vw, 3.4rem);
}

.section-copy {
  max-width: 460px;
  margin: 0;
  color: var(--ink-muted);
  text-align: right;
}

.section-head-with-actions {
  align-items: center;
}

.quote-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
}

.form-grid,
.catalog-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.catalog-tools {
  grid-template-columns: minmax(260px, 1fr) 210px 210px;
  align-items: end;
}

.field {
  display: grid;
  gap: 0.42rem;
}

.field > span {
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea,
.quote-table input,
.quote-table select,
.quote-table textarea {
  width: 100%;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.field input,
.field select,
.quote-table input,
.quote-table select {
  min-height: 46px;
  padding: 0.68rem 0.78rem;
}

.field textarea,
.quote-table textarea {
  padding: 0.72rem 0.78rem;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.quote-table input:hover,
.quote-table select:hover,
.quote-table textarea:hover {
  border-color: var(--line-strong);
}

.field-note,
.row-hint {
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.row-hint {
  display: block;
  min-height: 1.05rem;
  margin-top: 0.35rem;
  color: var(--accent-dark);
}

.span-2 {
  grid-column: span 2;
}

.span-4 {
  grid-column: span 4;
}

.tariff-note {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  color: #573b02;
  background: #fff5d8;
  border: 1px solid #f6daa1;
  border-left: 7px solid var(--accent);
  border-radius: var(--radius-lg);
}

.table-wrap,
.catalog-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
}

.quote-table,
.catalog-table {
  width: 100%;
  border-collapse: collapse;
}

.quote-table {
  min-width: 1120px;
}

.catalog-table {
  min-width: 980px;
}

.quote-table th,
.quote-table td,
.catalog-table th,
.catalog-table td {
  padding: 0.78rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.quote-table th,
.catalog-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #ffffff;
  background: var(--night-2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.quote-table th:nth-child(1) {
  width: 86px;
}

.quote-table th:nth-child(2) {
  width: 160px;
}

.quote-table th:nth-child(3),
.quote-table th:nth-child(4) {
  width: 150px;
}

.quote-table th:nth-child(5) {
  width: 330px;
}

.quote-table th:nth-child(6),
.quote-table th:nth-child(7) {
  width: 140px;
}

.quote-table th:nth-child(8) {
  width: 64px;
}

.quote-table tbody tr:last-child td,
.catalog-table tbody tr:last-child td {
  border-bottom: 0;
}

.quote-table tbody tr.needs-attention {
  background: #fffaf0;
}

.quote-table textarea {
  min-height: 70px;
}

.unit-price-output,
.line-total-output,
.description-output {
  color: #293548;
  background: #f1f5f9 !important;
}

.remove-cell {
  text-align: center;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #ffffff;
  background: var(--danger);
  font-size: 1.4rem;
  line-height: 1;
}

.line-footer {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  justify-content: space-between;
  margin-top: 1.15rem;
}

.pricing-note {
  max-width: 620px;
  margin: 0;
  color: var(--ink-muted);
}

.totals-card {
  display: grid;
  grid-template-columns: repeat(3, auto);
  min-width: min(100%, 520px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
}

.totals-card > div {
  display: grid;
  gap: 0.2rem;
  min-width: 130px;
  padding: 0.9rem 1rem;
  border-right: 1px solid var(--line);
}

.totals-card > div:last-child {
  border-right: 0;
}

.totals-card span {
  color: var(--ink-muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.totals-card strong {
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1;
}

.totals-card .grand-total {
  color: #ffffff;
  background: var(--night-2);
}

.totals-card .grand-total span {
  color: rgba(255, 255, 255, 0.72);
}

.catalog-count {
  margin: 0 0 0.8rem;
  color: var(--ink-muted);
  font-weight: 700;
}

.catalog-table-wrap {
  max-height: 560px;
}

.catalog-table td {
  color: #2f3a4c;
  font-size: 0.92rem;
}

.catalog-table td:nth-child(1),
.catalog-table td:nth-child(5),
.catalog-table td:nth-child(6) {
  font-weight: 800;
  white-space: nowrap;
}

.catalog-table td:nth-child(7) {
  text-align: right;
}

.small-add-button {
  min-height: 34px;
  padding: 0.45rem 0.78rem;
  color: var(--night);
  background: #ffe2a0;
  border: 1px solid #f2c76b;
  border-radius: 999px;
  font-weight: 800;
}

.pdf-frame {
  display: block;
  width: 100%;
  min-height: 760px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #f8fafc;
}

.pdf-fallback {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 2rem;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .quote-header {
    grid-template-columns: 1fr;
  }

  .header-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

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

  .span-4 {
    grid-column: span 2;
  }

  .catalog-tools {
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    grid-column: span 2;
  }

  .line-footer {
    flex-direction: column;
  }

  .totals-card {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px;
  }

  .quote-header,
  .panel {
    border-radius: 20px;
  }

  .brand-divider {
    display: none;
  }

  .hero-copy h1 {
    font-size: 2.55rem;
  }

  .section-head,
  .section-head-with-actions {
    flex-direction: column;
    align-items: stretch;
  }

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

  .section-copy {
    text-align: left;
  }

  .form-grid,
  .catalog-tools {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-4,
  .search-field {
    grid-column: auto;
  }

  .header-actions,
  .line-footer,
  .totals-card {
    display: grid;
    grid-template-columns: 1fr;
  }

  .totals-card > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .totals-card > div:last-child {
    border-bottom: 0;
  }

  .pdf-frame {
    min-height: 520px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  :root {
    --shadow: none;
    --shadow-soft: none;
  }

  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body {
    background: #ffffff;
    font-size: 11px;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .quote-header {
    min-height: 0;
    padding: 18px;
    border-radius: 0;
    box-shadow: none;
    grid-template-columns: 1fr 1.4fr;
  }

  .hero-copy h1 {
    font-size: 2.4rem;
  }

  .hero-note,
  .header-actions,
  .quote-actions,
  #add-line,
  .remove-cell,
  .catalog-panel,
  .brochure-panel {
    display: none !important;
  }

  .panel {
    padding: 14px;
    margin-top: 12px;
    border-radius: 0;
    box-shadow: none;
    break-inside: avoid;
  }

  .section-head {
    margin-bottom: 10px;
  }

  .section-head h2 {
    font-size: 1.8rem;
  }

  .form-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .span-2 {
    grid-column: span 2;
  }

  .span-4 {
    grid-column: span 4;
  }

  .field input,
  .field select,
  .field textarea,
  .quote-table input,
  .quote-table select,
  .quote-table textarea {
    min-height: 0;
    padding: 4px;
    background: #ffffff !important;
    border-color: #cbd5e1;
    border-radius: 0;
  }

  .field textarea,
  .quote-table textarea {
    resize: none;
  }

  .tariff-note {
    padding: 8px;
    margin-top: 10px;
  }

  .table-wrap {
    overflow: visible;
  }

  .quote-table {
    min-width: 0;
    table-layout: fixed;
  }

  .quote-table th,
  .quote-table td {
    padding: 5px;
  }

  .quote-table th:nth-child(8),
  .quote-table td:nth-child(8) {
    display: none;
  }

  .quote-table textarea {
    min-height: 42px;
  }

  .row-hint,
  .pricing-note {
    display: none;
  }

  .line-footer {
    justify-content: flex-end;
  }

  .totals-card {
    min-width: 360px;
  }

  @page {
    margin: 0.35in;
  }
}
