:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #657180;
  --soft: #eef1f3;
  --paper: #fbfaf7;
  --card: #ffffff;
  --line: #dfe4e8;
  --navy: #182537;
  --navy-2: #22334a;
  --sand: #c9a977;
  --sage: #7e947d;
  --terracotta: #b46d4c;
  --success: #1c7c54;
  --warning: #a36200;
  --danger: #a73535;
  --shadow: 0 18px 50px rgba(23, 32, 42, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(201, 169, 119, 0.18), transparent 35%),
    linear-gradient(135deg, #f3f0ea 0%, #f8f7f4 44%, #eef2f0 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  align-self: start;
  background: linear-gradient(180deg, var(--navy), #111a27);
  color: #fff;
  padding: 34px 28px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

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

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--sand), #e5d0a5);
  color: #1d2633;
  font-weight: 900;
  letter-spacing: -0.04em;
  box-shadow: inset 0 -8px 18px rgba(0, 0, 0, 0.12);
}

.brand-lockup h1,
.hero h2,
.section-heading h3,
.quality-grid h3,
.catalogue-card h3 {
  margin: 0;
  letter-spacing: -0.035em;
}

.brand-lockup h1 {
  font-size: 1.45rem;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--sand);
  text-transform: uppercase;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.sidebar-copy {
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.55;
}

.status-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
}

.status-card strong,
.status-card span {
  display: block;
}

.status-card span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.9rem;
  margin-top: 3px;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #75d49a;
  margin-top: 5px;
  box-shadow: 0 0 0 6px rgba(117, 212, 154, 0.12);
}

.side-nav {
  display: grid;
  gap: 7px;
  margin-top: auto;
}

.side-nav a {
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 12px;
  transition: 150ms ease;
}

.side-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

main {
  padding: 36px;
  display: grid;
  gap: 26px;
}

.hero,
.composer-card,
.offer-preview-card,
.email-card,
.quality-grid > article,
.catalogue-card {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 24px;
  padding: 34px;
  overflow: hidden;
}

.hero h2 {
  max-width: 860px;
  font-size: clamp(2.2rem, 4.2vw, 4.55rem);
  line-height: 0.95;
}

.hero p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 1.04rem;
}

.hero-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 300px;
  border-radius: 24px;
  padding: 24px;
  color: #fff;
  background:
    linear-gradient(rgba(24, 37, 55, 0.12), rgba(24, 37, 55, 0.9)),
    radial-gradient(circle at 30% 20%, rgba(201, 169, 119, 0.9), transparent 18%),
    radial-gradient(circle at 72% 36%, rgba(126, 148, 125, 0.95), transparent 22%),
    linear-gradient(135deg, var(--navy), var(--navy-2));
  overflow: hidden;
}

.hero-panel::before,
.hero-panel::after {
  content: "";
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px 999px 70px 70px;
  transform: rotate(-8deg);
}

.hero-panel::before {
  width: 170px;
  height: 190px;
  right: -20px;
  top: 18px;
}

.hero-panel::after {
  width: 115px;
  height: 130px;
  right: 112px;
  top: 75px;
}

.hero-panel span,
.hero-panel strong {
  position: relative;
  z-index: 1;
}

.hero-panel span {
  color: rgba(255, 255, 255, 0.68);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.13em;
  font-weight: 800;
  margin-bottom: 10px;
}

.hero-panel strong {
  font-size: 1.18rem;
  line-height: 1.45;
}

.composer-card,
.catalogue-card,
.offer-preview-card,
.email-card,
.quality-grid > article {
  padding: 28px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

.section-heading.compact {
  margin-bottom: 18px;
}

.section-heading h3,
.quality-grid h3,
.catalogue-card h3 {
  font-size: 1.55rem;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
}

select,
input[type="search"],
.qty-input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
  transition: 140ms ease;
}

select:focus,
input[type="search"]:focus,
.qty-input:focus {
  border-color: var(--sand);
  box-shadow: 0 0 0 4px rgba(201, 169, 119, 0.16);
}

.product-picker {
  margin-top: 22px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.primary-button,
.ghost-button,
.search-row button {
  border: 0;
  border-radius: 14px;
  font-weight: 850;
  padding: 13px 18px;
}

.primary-button {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff;
  box-shadow: 0 12px 26px rgba(24, 37, 55, 0.22);
}

.ghost-button,
.search-row button {
  background: #f4f1ea;
  color: var(--navy);
  border: 1px solid #e4dac9;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.suggestion-card,
.catalogue-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: #fff;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.suggestion-card {
  cursor: pointer;
  transition: 140ms ease;
}

.suggestion-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(23, 32, 42, 0.09);
}

.suggestion-card strong,
.catalogue-item strong {
  display: block;
}

.suggestion-card span,
.catalogue-item span {
  color: var(--muted);
  font-size: 0.88rem;
}

.product-visual {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #f0eee9;
  overflow: hidden;
}

.product-visual.large {
  width: 88px;
  height: 88px;
  border-radius: 22px;
}

.product-visual svg {
  width: 100%;
  height: 100%;
}

.selected-products-wrap {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.table-toolbar h4 {
  margin: 0;
}

.selected-lines {
  display: grid;
}

.selected-line {
  display: grid;
  grid-template-columns: 74px minmax(0, 1.3fr) 100px 115px 42px;
  gap: 14px;
  align-items: center;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.selected-line:last-child {
  border-bottom: 0;
}

.line-meta strong,
.line-meta span {
  display: block;
}

.line-meta span {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 3px;
}

.line-chip {
  justify-self: start;
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f5f7f4;
  color: #51644f;
  font-weight: 800;
  font-size: 0.83rem;
}

.remove-line {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}

.empty-state {
  color: var(--muted);
  padding: 24px;
  border: 1px dashed #cfd6dc;
  border-radius: 18px;
  background: rgba(244, 241, 234, 0.42);
}

.action-row {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 22px;
}

.action-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.output-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
  gap: 26px;
}

.offer-document {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
}

.offer-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), #2f4058);
}

.offer-topbar h4 {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.offer-topbar p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
}

.offer-ref {
  text-align: right;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
}

.offer-body {
  padding: 24px;
}

.offer-intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.offer-box {
  padding: 16px;
  background: #f7f5f0;
  border-radius: 16px;
}

.offer-box strong,
.offer-box span {
  display: block;
}

.offer-box span {
  color: var(--muted);
  margin-top: 4px;
}

.offer-lines {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 16px;
}

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

.offer-lines th {
  background: #f3f5f6;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.offer-lines tr:last-child td {
  border-bottom: 0;
}

.product-cell {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 250px;
}

.product-cell strong,
.product-cell span {
  display: block;
}

.product-cell span {
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.45;
}

.offer-summary {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.metric {
  padding: 15px;
  background: #f7f5f0;
  border-radius: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 5px;
}

.metric strong {
  font-size: 1.2rem;
}

.email-draft {
  min-height: 520px;
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.65;
  color: #253243;
  background: #f8f7f4;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.quality-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}

.checks-panel {
  display: grid;
  gap: 10px;
}

.check-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 13px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: #fff;
}

.check-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.check-item.ok .check-icon {
  color: #fff;
  background: var(--success);
}

.check-item.warn .check-icon {
  color: #fff;
  background: var(--warning);
}

.check-item.risk .check-icon {
  color: #fff;
  background: var(--danger);
}

.check-item strong,
.check-item span {
  display: block;
}

.check-item span {
  color: var(--muted);
  margin-top: 2px;
}

.value-list {
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
  list-style: none;
}

.value-list li {
  position: relative;
  padding-left: 28px;
  color: var(--muted);
  line-height: 1.55;
}

.value-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sand);
}

.catalogue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef3ef;
  color: #4f684d;
  font-weight: 850;
  font-size: 0.86rem;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--navy);
  color: #fff;
  padding: 13px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 10;
}

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

  .sidebar {
    position: static;
    min-height: auto;
  }

  .side-nav {
    display: flex;
    flex-wrap: wrap;
    margin-top: 0;
  }

  .hero,
  .output-grid,
  .quality-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  main {
    padding: 18px;
  }

  .sidebar,
  .hero,
  .composer-card,
  .catalogue-card,
  .offer-preview-card,
  .email-card,
  .quality-grid > article {
    padding: 22px;
    border-radius: 22px;
  }

  .search-row,
  .selected-line,
  .offer-intro,
  .offer-summary,
  .offer-topbar {
    grid-template-columns: 1fr;
  }

  .selected-line {
    position: relative;
  }

  .remove-line {
    position: absolute;
    top: 12px;
    right: 12px;
  }

  .offer-lines {
    display: block;
    overflow-x: auto;
  }
}

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

  .sidebar,
  .hero,
  .composer-card,
  .email-card,
  .quality-grid,
  .catalogue-card,
  #print-offer {
    display: none !important;
  }

  .app-shell,
  main,
  .output-grid {
    display: block;
    padding: 0;
  }

  .offer-preview-card {
    box-shadow: none;
    border: 0;
    padding: 0;
  }
}
