/* Compact visual density layer for the public storefront. */
:root {
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 8px;
  --shadow: 0 12px 28px rgba(53, 69, 53, .10);
  --public-header-control-height: 44px;
  --public-header-link-height: 34px;
  --public-cart-badge-size: 22px;
  --public-account-menu-width: 320px;
  --public-account-menu-offset: 12px;
}

.container {
  width: min(1180px, calc(100% - 28px));
}

.nav-wrap {
  min-height: 62px;
  gap: 12px;
}

.topbar .brand b,
.topbar .nav a,
.topbar .btn {
  font-size: 15px;
  line-height: 1.25;
}

.topbar .brand b {
  font-size: 16px;
}

.brand {
  flex: 0 0 auto;
}

.brand small {
  display: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
}

.nav a,
.btn,
.eyebrow,
.cart-toggle span {
  border-radius: var(--radius-md);
}

.nav a {
  min-height: var(--public-header-link-height);
  padding: 7px 10px;
}

.btn {
  min-height: var(--public-header-control-height);
  padding: 10px 15px;
}

.btn-small {
  min-height: 36px;
  padding: 8px 11px;
}

.hero-actions,
.checkout-actions,
.cart-checkout-actions,
.account-order-actions,
.product-actions {
  align-items: stretch;
}

.hero-actions .btn,
.checkout-actions .btn,
.cart-checkout-actions .btn,
.account-order-actions .btn,
.cart-checkout-actions button,
.account-order-actions button {
  min-height: 46px;
}

.hero {
  padding: 46px 0 34px;
}

.hero:before { content: none; }

.hero-grid,
.two-col {
  gap: 24px;
}

.eyebrow {
  padding: 5px 10px;
  margin-bottom: 12px;
}

h1 {
  font-size: 52px;
  letter-spacing: 0;
  margin-bottom: 14px;
}

h2 {
  font-size: 34px;
  letter-spacing: 0;
}

h3 {
  font-size: 19px;
}

.lead {
  font-size: 18px;
}

.hero-actions {
  margin-top: 18px;
  gap: 10px;
}

.hero-actions .btn {
  min-width: 160px;
}

.hero-actions form,
.checkout-actions form,
.cart-checkout-actions form,
.account-order-actions form {
  display: inline-flex;
  align-items: stretch;
  margin: 0;
}

.hero-actions form .btn,
.checkout-actions form .btn,
.cart-checkout-actions form .btn,
.account-order-actions form .btn {
  width: 100%;
}

.account-order-actions .payment-provider-form {
  display: grid;
  gap: 12px;
  width: min(100%, 520px);
}

.payment-provider-choice {
  display: grid;
  gap: 8px;
  width: 100%;
}

.payment-provider-choice .muted {
  margin: 0;
}

.payment-provider-option {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--paper);
}

.payment-provider-option input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--green);
}

.payment-provider-option span {
  display: grid;
  gap: 2px;
}

.payment-provider-option small {
  color: var(--muted);
  line-height: 1.35;
}

.section-head > .btn {
  align-self: center;
  min-width: 150px;
}

.hero-card,
.hero-service-panel,
.catalog-hero-panel,
.cart-hero-panel,
.card,
.product-card,
.info-card,
.form-card,
.checkout-panel,
.cart-panel,
.category-card,
.filter-bar,
.notice,
.step,
.checkout-product,
.cart-summary,
.account-dropdown {
  border-radius: var(--radius-lg);
}

.account-box {
  max-width: min(220px, 28vw);
}

.account-toggle {
  min-height: var(--public-header-control-height);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-card,
.hero-service-panel,
.catalog-hero-panel,
.cart-hero-panel,
.card,
.info-card,
.form-card {
  padding: 18px;
}

.hero-card,
.hero-service-panel,
.catalog-hero-panel,
.cart-hero-panel {
  width: min(100%, 560px);
  justify-self: end;
}

.hero-card p,
.hero-service-panel p,
.catalog-hero-panel p,
.cart-hero-panel p {
  margin-bottom: 0;
}

.hero-service-panel {
  padding: 20px;
}

.hero-service-summary {
  padding: 14px;
}

.hero-service-summary b {
  font-size: 22px;
}

.hero-service-row b {
  font-size: 17px;
}

.hero-card h2,
.catalog-hero-panel h2,
.cart-hero-panel h2,
.card h2,
.info-card h2,
.form-card h2,
.checkout-panel h2,
.cart-panel h2 {
  font-size: 23px;
  line-height: 1.18;
}

.hero-card ul {
  margin-top: 12px;
}

.hero-card li {
  margin: 6px 0;
}

.section {
  padding: 38px 0;
}

.hero + .section {
  padding-top: 34px;
}

.section-head {
  margin-bottom: 18px;
  gap: 16px;
}

.grid-3,
.products-grid,
.category-grid {
  gap: 14px;
}

.catalog-flow-strip {
  gap: 10px;
}

.catalog-flow-strip .info-card {
  padding: 14px;
}

.product-shelf-footer {
  border-radius: var(--radius-lg);
  min-height: 44px;
  align-items: center;
}

.trust-grid .card,
.grid-3 .info-card,
.category-card {
  box-shadow: none;
}

.category-card {
  min-height: 150px;
  padding: 18px;
}

.category-card span {
  font-size: inherit;
}

.category-card .category-icon {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  text-transform: none;
}

.quick-flow article,
.faq-list details {
  border-radius: var(--radius-lg);
}

.filter-bar {
  padding: 14px;
  gap: 10px;
}

input,
select,
textarea {
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.two-col > .form-card {
  width: min(100%, 640px);
  justify-self: end;
}

.form-grid {
  gap: 10px;
}

.product-image {
  aspect-ratio: auto;
  height: clamp(132px, 15vw, 176px);
  min-height: 0;
  padding: 14px;
  position: relative;
}

.product-image img {
  width: min(116px, 42%);
  max-height: 132px;
}

.product-image-empty {
  background: linear-gradient(135deg, #f6f3ea, #edf4ed);
}

.product-image-empty img {
  opacity: .34;
  filter: saturate(.75);
}

.product-image-empty span {
  position: absolute;
  left: 12px;
  bottom: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .86);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.product-body {
  padding: 14px 16px 16px;
  gap: 9px;
}

.product-body h3 {
  font-size: 20px;
  line-height: 1.2;
}

.product-body p {
  font-size: 15px;
  line-height: 1.4;
}

.product-meta {
  font-size: 12px;
}

.product-card .product-status-chip {
  color: var(--green-dark);
  border-color: #c9e2cf;
}

.product-card.product-status-today .product-status-chip {
  background: #e8f3ea;
}

.product-card.product-status-stock .product-status-chip {
  background: #eef5ee;
}

.product-card.product-status-order .product-status-chip {
  background: #fff3d6;
  color: #7a4b12;
  border-color: #f0d49a;
}

.product-card.product-status-muted .product-status-chip {
  background: #eef1ed;
  color: var(--muted);
  border-color: #d9ded8;
}

.chips span {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 4px 7px;
  font-size: 11px;
  line-height: 1.25;
}

.product-foot {
  gap: 8px;
}

.product-price b {
  font-size: 22px;
}

.product-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.product-actions .btn {
  min-height: 38px;
  padding: 8px 9px;
  font-size: 13px;
}

.product-actions a.btn,
.product-actions button.btn,
.cart-checkout-actions a.btn,
.cart-checkout-actions button.btn,
.account-order-actions a.btn,
.account-order-actions button.btn,
.hero-actions a.btn,
.hero-actions button.btn {
  height: auto;
  align-self: stretch;
}

.checkout-panel,
.cart-panel {
  padding: 20px;
}

.checkout-panel {
  width: min(640px, calc(100vw - 28px));
}

.checkout-form .form-grid,
.public-cart-checkout .form-grid {
  grid-template-columns: 1fr;
}

.public-cart-layout {
  gap: 14px;
}

.public-cart-checkout {
  position: sticky;
  top: 78px;
  padding: 14px;
  box-shadow: none;
}

.public-cart-checkout textarea {
  min-height: 92px;
}

.checkout-close {
  border-radius: var(--radius-md);
}

.cart-item {
  grid-template-columns: 62px 1fr;
  gap: 10px;
}

.cart-item-image {
  width: 62px;
  height: 62px;
  border-radius: var(--radius-md);
}

.footer {
  padding: 34px 0;
}

.footer p {
  margin: 8px 0 0;
}

.footer a {
  overflow-wrap: anywhere;
}

@media (max-width: 1460px) {
  .nav {
    top: 62px;
    border-radius: var(--radius-lg);
  }

  .nav-wrap {
    gap: 8px;
  }

  .brand small {
    display: none;
  }

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

  .filter-bar label,
  .filter-bar select,
  .filter-bar input {
    min-width: 0;
    width: 100%;
  }

  .account-table {
    min-width: 560px;
  }

  .info-card:has(.account-table),
  .form-card:has(.account-table) {
    overflow-x: auto;
  }
}

@media (max-width: 620px) {
  .container {
    width: min(100% - 18px, 1180px);
  }

  .nav-wrap {
    min-height: 56px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand b {
    font-size: 14px;
    max-width: 92px;
  }

  .account-box {
    max-width: min(176px, 34vw);
  }

  .hero {
    padding-top: 28px;
    padding-bottom: 24px;
  }

  h1 {
    font-size: 32px;
    letter-spacing: 0;
  }

  h2 {
    font-size: 26px;
  }

  .lead {
    font-size: 16px;
  }

  .section {
    padding: 26px 0;
  }

  .hero-actions .btn,
  .checkout-actions .btn,
  .cart-checkout-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .product-foot .btn,
  .product-cart-form .btn,
  .nav-wrap > .btn,
  .account-box .btn {
    width: auto;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .product-image {
    height: 110px;
  }

  .product-image img {
    width: min(92px, 42%);
    max-height: 96px;
  }

  .product-body {
    padding: 13px;
  }

  .product-foot {
    align-items: stretch;
  }

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

  .product-actions .product-cart-form {
    grid-column: 1 / -1;
  }

  .product-foot > .btn,
  .product-cart-form > .btn {
    width: 100%;
    min-width: 0;
  }

  .form-card,
  .public-cart-checkout,
  .account-profile-form {
    width: 100%;
    min-width: 0;
  }

  .form-grid label,
  .cart-form label,
  .account-profile-form label {
    min-width: 0;
  }

  input,
  select,
  textarea {
    width: 100%;
    min-width: 0;
  }

  .hero-card,
  .hero-service-panel,
  .catalog-hero-panel,
  .cart-hero-panel,
  .card,
  .info-card,
  .form-card {
    padding: 14px;
  }

  .hero-card,
  .hero-service-panel,
  .catalog-hero-panel,
  .cart-hero-panel,
  .two-col > .form-card {
    width: 100%;
    justify-self: stretch;
  }

  .account-order-actions,
  .cart-checkout-actions {
    gap: 8px;
  }

  .checkout-panel {
    width: min(100%, calc(100vw - 18px));
    max-height: min(92vh, 760px);
  }

  .checkout-product {
    margin: 8px 0 12px;
  }

  .public-cart-checkout {
    position: static;
  }
}

@media (max-width: 620px) {
  .account-mobile-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-mobile-nav a {
    min-width: 0;
    text-align: center;
  }

  .cart-mobile-summary {
    display: flex;
  }

  .info-card:has(.account-table),
  .form-card:has(.account-table) {
    overflow: visible;
  }

  .account-table {
    display: block;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .account-table thead {
    display: none;
  }

  .account-table tbody {
    display: grid;
    gap: 10px;
  }

  .account-table tr {
    display: grid;
    gap: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
  }

  .account-table td {
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    min-width: 0;
    padding: 8px 0;
    border-bottom: 1px solid rgba(231, 220, 203, .8);
    text-align: right;
    overflow-wrap: anywhere;
  }

  .account-table td:first-child {
    padding-top: 0;
  }

  .account-table td:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .account-table td::before {
    content: attr(data-label);
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-align: left;
    text-transform: uppercase;
  }

  .account-table td[data-label="Товар"],
  .account-table td[data-label="Позиция"] {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .account-table td[data-label="Товар"]::before,
  .account-table td[data-label="Позиция"]::before {
    margin-bottom: 2px;
  }

  .account-table .account-table-empty {
    display: block;
    text-align: left;
  }

  .account-table .account-table-empty::before {
    content: none;
  }

  .account-table td[data-label="Кол-во"] .cart-qty-form {
    display: grid;
    grid-template-columns: minmax(72px, 96px) auto;
    justify-content: end;
    gap: 8px;
  }

  .account-table td[data-label="Кол-во"] .cart-qty-form .btn {
    width: auto;
  }

  .account-table td[data-label="Действие"] .btn {
    width: 100%;
  }

  .account-table td[data-label="Кол-во"] .cart-qty-input {
    width: 100%;
    min-width: 0;
  }

  .account-table td[data-label="Действие"] form {
    margin: 0;
  }

  .cart-checkout-actions {
    position: sticky;
    bottom: 8px;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    margin: 16px -2px -2px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 10px 26px rgba(53, 69, 53, .16);
  }

  .cart-checkout-actions form {
    width: 100%;
  }

  .cart-checkout-actions .account-order-total {
    margin: 0;
    text-align: left;
  }

  .public-cart-checkout .cart-checkout-actions {
    margin-top: 10px;
  }

  .account-order-actions:not(.cart-checkout-actions) {
    display: grid;
  }

  .account-order-actions:not(.cart-checkout-actions) .btn {
    width: 100%;
  }

  .account-order-head {
    display: grid;
    gap: 8px;
  }

  .account-order-head .account-order-total {
    margin: 0;
  }

  .cart-form label,
  .cart-form input,
  .cart-form select,
  .cart-form textarea {
    min-width: 0;
    width: 100%;
  }

  .checkout-product {
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .account-table td {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .account-table td::before {
    margin-bottom: 2px;
  }

  .account-table td[data-label="Кол-во"] .cart-qty-form {
    grid-template-columns: 1fr auto;
    justify-content: stretch;
  }
}

@media (max-width: 900px) {
  .product-detail-grid,
  .category-content-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .product-detail-media {
    min-height: 300px;
  }

  .product-variant-grid,
  .product-confidence-grid,
  .product-detail-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .product-detail-copy h1 {
    font-size: 32px;
  }

  .product-detail-media {
    min-height: 230px;
    padding: 20px;
  }

  .product-detail-media img {
    max-height: 250px;
  }

  .product-variant-heading {
    align-items: center;
  }

  .product-variant-card .product-actions {
    grid-template-columns: 1fr;
  }
}
