* {
  box-sizing: border-box;
}

:root {
  --ink: #282d2b;
  --muted: #7a737a;
  --line: #e4e7e3;
  --paper: #ffffff;
  --soft: #f5f6f3;
  --accent: #7b5776;
  --accent-dark: #614262;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent-dark);
}

.container {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
}

.logo img {
  width: 38px;
  height: 38px;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 25px;
  font-size: 14px;
}

.main-nav a {
  padding: 27px 0 24px;
  border-bottom: 3px solid transparent;
}

.main-nav a.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.hero {
  background: #f1f3ed;
  padding: 70px 0;
}

.hero-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  max-width: 650px;
  margin-bottom: 18px;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.12;
  font-weight: 700;
}

h2 {
  margin-bottom: 18px;
  font-size: 27px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.35;
}

.hero-text {
  max-width: 560px;
  margin-bottom: 26px;
  color: #665e65;
  font-size: 17px;
}

.button {
  display: inline-block;
  border: 0;
  border-radius: 4px;
  padding: 12px 20px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.button:hover {
  color: #fff;
  background: var(--accent-dark);
}

.button-outline {
  border: 1px solid var(--accent);
  color: var(--accent-dark);
  background: transparent;
}

.button-outline:hover {
  background: #e8ede3;
  color: var(--accent-dark);
}

.hero-note {
  min-width: 175px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 22px;
  border: 1px solid #dce2d6;
  border-radius: 5px;
  color: #5e665f;
  background: rgba(255,255,255,.55);
  font-size: 13px;
}

.note-number {
  color: var(--accent-dark);
  font-size: 38px;
  font-weight: 700;
}

.section {
  padding-top: 54px;
  padding-bottom: 54px;
}

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

.section-heading h2 {
  margin-bottom: 0;
}

.text-link {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
}

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

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.product-image {
  display: flex;
  height: 185px;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: #f7f8f5;
}

.product-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-info {
  padding: 16px 17px 18px;
}

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

.category {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.price {
  margin: 0;
  font-weight: 700;
}

.muted-section {
  background: var(--soft);
}

.info-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.info-strip p:not(.eyebrow) {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 20px;
  padding-bottom: 20px;
}

.page-main {
  min-height: calc(100vh - 150px);
  padding-top: 42px;
  padding-bottom: 65px;
}

.page-heading {
  margin-bottom: 28px;
}

.page-heading h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 4vw, 40px);
}

.page-heading p:last-child {
  color: var(--muted);
}

.catalog-tools {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbf9;
}

label {
  display: block;
  color: #444b45;
  font-size: 13px;
  font-weight: 600;
}

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  border: 1px solid #d9ded8;
  border-radius: 4px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 14px;
}

textarea {
  resize: vertical;
}

input:focus, select:focus, textarea:focus, a:focus, button:focus {
  outline: 2px solid #91a581;
  outline-offset: 2px;
}

.small {
  font-size: 12px;
}

.catalog-grid {
  margin-top: 22px;
}

.catalog-grid .product-image {
  height: 165px;
}

.catalog-grid h2 {
  margin-bottom: 8px;
  font-size: 17px;
}

.breadcrumbs {
  margin-bottom: 25px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumbs a {
  color: var(--accent-dark);
}

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 45px;
  align-items: center;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--line);
}

.detail-image {
  display: flex;
  min-height: 330px;
  align-items: center;
  justify-content: center;
  padding: 30px;
  border-radius: 5px;
  background: #f7f8f5;
}

.detail-image img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.detail-info h1 {
  font-size: clamp(30px, 4vw, 40px);
}

.detail-description {
  color: var(--muted);
}

.detail-price {
  margin: 20px 0 8px;
  font-size: 30px;
  font-weight: 700;
}

.detail-price span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.stock {
  margin-bottom: 22px;
  color: var(--accent-dark);
  font-size: 13px;
}

.spec-table {
  max-width: 720px;
  border-top: 1px solid var(--line);
}

.spec-table div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}

.spec-table span {
  color: var(--muted);
}

.spec-table strong {
  text-align: right;
  font-weight: 600;
}

.detail-hint {
  margin-top: 25px;
  padding: 28px;
  border-radius: 5px;
}

.detail-hint p {
  color: var(--muted);
}

.calculator-layout {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 22px;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.panel h2 {
  font-size: 21px;
}

.panel form {
  display: grid;
  gap: 16px;
}

.panel form .button {
  justify-self: start;
}

.result-panel {
  background: #f8f9f6;
}

.result-number {
  margin: 25px 0;
  color: var(--accent-dark);
  font-size: 46px;
  font-weight: 700;
}

.result-number span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
}

.compact {
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: #555e56;
  background: #f7f8f5;
  font-weight: 600;
}

tfoot td {
  font-weight: 700;
}

.contacts-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}

.contact-list > div {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.contact-list > div:last-child {
  border-bottom: 0;
}

.contact-label {
  color: var(--muted);
  font-size: 12px;
}

.contact-list p {
  margin: 4px 0 0;
}

@media (max-width: 760px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding-top: 14px;
  }

  .main-nav {
    width: 100%;
    gap: 18px;
    overflow-x: auto;
    flex-wrap: nowrap;
    font-size: 13px;
  }

  .main-nav a {
    flex: 0 0 auto;
    padding: 10px 0 12px;
  }

  .hero {
    padding: 48px 0;
  }

  .hero-content, .info-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-note {
    min-width: 0;
  }

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

  .product-image {
    height: 145px;
  }

  .product-info {
    padding: 12px;
  }

  .product-info h3, .catalog-grid h2 {
    font-size: 15px;
  }

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

  .product-detail, .calculator-layout, .contacts-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .detail-image {
    min-height: 240px;
  }

  .detail-image img {
    max-height: 210px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 5px;
  }
}

@media (max-width: 420px) {
  .container {
    width: calc(100% - 28px);
  }

  .product-grid {
    gap: 10px;
  }

  .product-image {
    height: 125px;
    padding: 10px;
  }

  .price {
    font-size: 13px;
  }

  .section {
    padding-top: 38px;
    padding-bottom: 38px;
  }

  .panel {
    padding: 17px;
  }

  .spec-table div {
    gap: 10px;
  }
}


/* Дополнения ПР 2: состояния форм, динамический каталог и внешние данные. */
[hidden] { display: none !important; }
.product-card[hidden] { display: none !important; }
.field-error, .form-error { display: block; margin: 6px 0 12px; color: #a33b32; font-size: 13px; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #a33b32; }
.success-message { margin-top: 14px; padding: 12px; border-left: 3px solid var(--accent); background: #f1f3ed; color: var(--accent-dark); font-size: 14px; }
.currency-section { padding-top: 38px; padding-bottom: 38px; }
.currency-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.currency-item { display: flex; justify-content: space-between; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.currency-item strong { white-space: nowrap; }
@media (max-width: 520px) { .currency-list { grid-template-columns: 1fr; } }

/* Дополнения ПР 3: личный кабинет и серверные состояния. */
.auth-status { margin-top: 12px; }
#profilePanel { margin-top: 24px; }
#profilePanel table { min-width: 680px; }
.main-nav a { white-space: nowrap; }
