/* Фарма Лорд — общий слой всех страниц, редакция 3 «Modern Medical Commerce».
   Принципы: бумажный фон, тонкие линии вместо коробок, один гротеск, моноширинные артикулы,
   цены крупно и табличными цифрами, бренд-цвет — только для действий. Поверх bundle.css (классы am-*). */

/* ---------- Основа ---------- */
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + var(--space-6)); }
body { background: var(--paper); color: var(--ink); font-feature-settings: "tnum" 0; }
.wrap { max-width: var(--container-max); margin: 0 auto; padding-left: var(--container-pad); padding-right: var(--container-pad); }
.skip { position: absolute; left: var(--space-4); top: -60px; z-index: var(--z-toast); background: var(--ink); color: var(--surface); padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); }
.skip:focus { top: var(--space-2); }
[hidden] { display: none !important; }
::selection { background: var(--brand-100); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.am-display, .am-h1, .am-h2 { font-family: var(--font-sans); font-weight: 600; }
.am-h1 { font-size: clamp(30px, 2.2vw + 14px, 48px); line-height: 1.06; letter-spacing: -0.028em; }
.am-h2 { font-size: clamp(24px, 0.9vw + 16px, 32px); line-height: 1.12; letter-spacing: -0.02em; }
.sku { font-family: var(--font-mono); font-size: 0.9em; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

/* Заглушки данных, которых пока нет */
.todo { background: var(--warning-soft); color: var(--warning); border-bottom: 1px dashed var(--warning); border-radius: 3px; padding: 0 4px; cursor: help; white-space: nowrap; }
.todo-note { align-self: flex-start; font-size: 13px; line-height: 18px; color: var(--warning); background: var(--warning-soft); border-radius: var(--radius-sm); padding: 2px var(--space-2); }

/* Фото: ровный тёплый фон, пока грузится, затем плавное появление */
.ph { position: relative; margin: 0; overflow: hidden; background: var(--surface-sunken); }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 360ms var(--ease-out), transform 600ms var(--ease-out); }
.ph.loaded img { opacity: 1; }

/* ---------- Кнопки, поля, бейджи — поверх bundle ---------- */
.am-btn { font-weight: 500; letter-spacing: -0.005em; transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast) var(--ease-out); }
.am-btn-primary { background: var(--action); }
.am-btn-primary:hover:not([disabled]):not([aria-disabled="true"]) { background: var(--action-hover); box-shadow: 0 4px 12px rgba(14, 90, 80, .22); }
.am-btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.am-btn-secondary:hover:not([disabled]):not([aria-disabled="true"]) { background: var(--surface); border-color: var(--ink); }
.am-btn-secondary:active:not([disabled]) { background: var(--surface-sunken); }
.am-btn-done { background: var(--brand-800); }
.am-link { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.am-input, .am-select { border-color: var(--line-strong); background-color: var(--surface); }
.am-input:hover, .am-select:hover { border-color: var(--control-border); }
.am-qty { border-color: var(--line-strong); }
.am-qty button:first-child { border-radius: 9px 0 0 9px; }
.am-qty button:last-child { border-radius: 0 9px 9px 0; }
.am-qty input { font-variant-numeric: tabular-nums; }
.am-badge { border-radius: var(--radius-sm); font-weight: 500; }
.am-badge-info { background: var(--brand-50); color: var(--brand-700); }
.am-badge-neutral { background: var(--surface); }
.am-check input { border-radius: 4px; }
.am-meter { height: 4px; background: var(--line); }
.am-meter span { background: var(--action); }
.am-meter-done span { background: var(--success); }

/* Наличие: точка + текст (цвет не единственный признак) */
.am-stock { gap: var(--space-2); font-size: 13px; line-height: 18px; font-weight: 500; }
.am-stock .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.am-stock-order .dot { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.am-stock-out .dot { border-radius: 1px; }

/* ---------- Шапка: одна компактная строка ---------- */
.am-header { background: var(--surface); border-bottom: 1px solid var(--line); transition: box-shadow var(--dur-base); }
.is-scrolled .am-header { box-shadow: 0 8px 24px rgba(27, 31, 29, .07); }
.am-header-in { height: var(--header-h); gap: var(--space-3); max-width: var(--container-max); }
.am-logo { gap: var(--space-2); font: 650 21px/1 var(--font-sans); letter-spacing: -0.03em; color: var(--ink); margin-right: var(--space-2); }
.logo-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--brand-600); position: relative; flex: none; }
.logo-mark::after { content: ""; position: absolute; left: 5px; right: 5px; top: 9.5px; height: 3px; border-radius: 2px; background: var(--paper); }
.am-catalog-btn { --btn-h: 44px; padding: 0 var(--space-4); }
.am-header .am-search { flex: 1; max-width: 560px; position: relative; }
.am-search-box { height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--paper); transition: border-color var(--dur-fast), background-color var(--dur-fast), box-shadow var(--dur-fast); }
.am-search-box:hover { border-color: var(--control-border); }
.am-search-box:focus-within { border-color: var(--action); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-100); }
.am-search-box .am-btn { --btn-h: 36px; margin-right: 3px; border-radius: var(--radius-inner); }
.hd-nav { display: flex; gap: var(--space-5); margin-left: auto; font-size: 14px; white-space: nowrap; }
.hd-nav a { position: relative; color: var(--ink-muted); text-decoration: none; padding: var(--space-2) 0; }
.hd-nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform var(--dur-base) var(--ease-out); }
.hd-nav a:hover { color: var(--ink); }
.hd-nav a:hover::after { transform: scaleX(1); }
.am-header-actions { gap: 0; }
.am-hbtn { min-width: 60px; font-size: 12px; color: var(--ink); }
.am-hbtn:hover, .am-hbtn:focus-visible { background: var(--surface-sunken); }
.am-hbtn-count { background: var(--action); right: var(--space-2); transition: transform var(--dur-base) var(--ease-out); }
.hd-cart.bump .am-ico { animation: bump 460ms var(--ease-out); }
.hd-cart.bump .am-hbtn-count { animation: pop 460ms var(--ease-out); }
@keyframes bump { 30% { transform: translateY(-3px) rotate(-6deg); } 60% { transform: translateY(1px); } }
@keyframes pop { 35% { transform: scale(1.35); } }
.am-hbtn .am-meter { width: 64px; height: 3px; }
@media (max-width: 1279px) { .hd-nav { display: none; } .am-header .am-search { max-width: none; } }
@media (max-width: 1023px) {
  .am-header-in { padding-top: var(--space-2); padding-bottom: var(--space-2); }
  .am-header .am-search { order: 3; flex-basis: 100%; }
  .am-logo { margin-right: auto; order: 0; }
  .am-catalog-btn { order: -1; }
}
@media (max-width: 479px) {
  .am-catalog-btn { width: 44px; padding: 0; }
  .am-catalog-btn .cat-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Подсказки поиска */
.am-search .am-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: var(--z-dropdown); margin: 0; padding: var(--space-2) 0; border-radius: var(--radius-lg); border-color: var(--line); max-height: min(70vh, 480px); overflow-y: auto; animation: drop var(--dur-base) var(--ease-out); }
.am-suggest-title { font-weight: 500; color: var(--ink-subtle); }
.am-suggest-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: var(--space-3); }
.am-suggest-item .am-row-thumb { width: 36px; height: 36px; position: relative; }
.am-suggest-item .sg-name { display: grid; line-height: 18px; }
.am-suggest-item .sku { color: var(--ink-subtle); font-size: 12px; }
.am-suggest-item mark { background: var(--brand-100); color: var(--ink); font-weight: 600; border-radius: 2px; }
.am-suggest-item[aria-selected="true"], .am-suggest-item:hover { background: var(--brand-50); }
.am-suggest-all { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); margin-top: var(--space-1); padding-top: var(--space-3); color: var(--action); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* Строка разделов — под шапкой, прокручивается со страницей */
.catbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.catbar-in { display: flex; align-items: center; gap: var(--space-6); }
.catbar-links { display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.catbar-links::-webkit-scrollbar { display: none; }
.catbar-links a { position: relative; flex: none; padding: var(--space-3) var(--space-2); font-size: 13.5px; line-height: 20px; color: var(--ink-muted); text-decoration: none; white-space: nowrap; }
.catbar-links a:first-child { padding-left: 0; }
.catbar-links a::after { content: ""; position: absolute; left: var(--space-2); right: var(--space-2); bottom: -1px; height: 2px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform var(--dur-base) var(--ease-out); }
.catbar-links a:first-child::after { left: 0; }
.catbar-links a:hover { color: var(--ink); }
.catbar-links a:hover::after, .catbar-links a[aria-current]::after { transform: scaleX(1); }
.catbar-links a[aria-current] { color: var(--ink); font-weight: 500; }
.catbar-links a.sale { color: var(--accent-ink); }
.catbar-links a.sale::after { background: var(--accent); }
.catbar-phone { display: inline-flex; gap: var(--space-2); align-items: center; font-size: 13.5px; color: var(--ink); text-decoration: none; white-space: nowrap; }
@media (max-width: 1023px) { .catbar { display: none; } }

/* Мега-меню */
.mega { position: absolute; left: 0; right: 0; top: 100%; z-index: var(--z-dropdown); background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: drop var(--dur-base) var(--ease-out); }
.mega-in { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--space-8); padding-top: var(--space-6); padding-bottom: var(--space-8); }
.mega-top, .mega-info { display: none; }
.mega-groups { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--line); }
.mega-groups button { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-2); border: 0; border-bottom: 1px solid var(--line); background: none; font: 500 15px/22px var(--font-sans); color: var(--ink); text-align: left; cursor: pointer; transition: background-color var(--dur-fast), padding var(--dur-base) var(--ease-out); }
.mega-groups button::after { content: "→"; color: var(--ink-subtle); opacity: 0; transition: opacity var(--dur-fast); }
.mega-groups button:hover, .mega-groups button[aria-selected="true"] { background: var(--brand-50); color: var(--brand-800); padding-left: var(--space-3); }
.mega-groups button[aria-selected="true"]::after { opacity: 1; }
.mega-panel { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--space-8); align-items: start; }
.mega-panel h3 { margin: 0 0 var(--space-3); font: 600 22px/28px var(--font-sans); letter-spacing: -0.02em; }
.mega-panel ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: var(--space-8); }
.mega-panel li { break-inside: avoid; border-bottom: 1px solid var(--line); }
.mega-panel a { display: block; padding: var(--space-2) 0; color: var(--ink); text-decoration: none; font-size: 15px; }
.mega-panel a:hover { color: var(--action); }
.mega-panel .ph { aspect-ratio: 4 / 3; border-radius: var(--radius-lg); }
.mega-foot { display: flex; gap: var(--space-6); margin-top: var(--space-5); }
.mega-foot .am-link { font-size: 14px; }
@media (max-width: 1023px) {
  .mega { position: fixed; inset: 0; overflow: auto; z-index: var(--z-modal); box-shadow: none; animation: sheet var(--dur-slow) var(--ease-out); }
  @keyframes sheet { from { opacity: 0; transform: translateY(12px); } }
  .mega-in { grid-template-columns: 1fr; gap: var(--space-4); padding-top: var(--space-4); }
  .mega-top { display: flex; align-items: center; justify-content: space-between; font-size: 20px; }
  .mega-panel { grid-template-columns: 1fr; } .mega-panel .ph { display: none; } .mega-panel ul { columns: 1; }
  .mega-info { display: grid; border-top: 1px solid var(--ink); padding-top: var(--space-2); }
  .mega-info a { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
}

/* ---------- Секции: заголовок над тонкой графитовой линейкой ---------- */
.sec { padding: var(--space-16) 0; }
.sec-sunken { background: var(--surface-sunken); }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-3) var(--space-6); padding-top: var(--space-4); margin-bottom: var(--space-6); border-top: 1px solid var(--ink); }
.sec-head .am-h2 { max-width: 28ch; }
.sec-head p { margin: 0; color: var(--ink-muted); max-width: 52ch; font-size: 15px; line-height: 22px; }
.sec-head .am-link { font-size: 15px; }
.lead { color: var(--ink-muted); font-size: 17px; line-height: 26px; margin: var(--space-3) 0 var(--space-6); max-width: 560px; }

/* ---------- Карточка товара: без коробки, данные строками ---------- */
.am-card.pcard { border: 0; border-radius: 0; background: transparent; padding: 0 var(--space-4) var(--space-2); gap: var(--space-1); box-shadow: none; }
.am-card.pcard:hover, .am-card.pcard:focus-within { transform: none; box-shadow: none; }
.pcard .am-card-media { margin: 0 0 var(--space-3); aspect-ratio: 1 / 1; border-radius: var(--radius-lg); background: var(--surface); }
.pcard .am-card-media img { object-fit: cover; transition: transform 600ms var(--ease-out), opacity 360ms var(--ease-out); }
.pcard:hover .am-card-media img { transform: scale(1.03); }
.pcard-meta { display: flex; justify-content: space-between; gap: var(--space-2); font-size: 12.5px; line-height: 18px; color: var(--ink-subtle); }
.pcard .am-card-title { font: 500 15px/21px var(--font-sans); min-height: 63px; color: var(--ink); }
.pcard .am-card-title:hover { color: var(--action); text-decoration: underline; text-underline-offset: 3px; }
.pcard-pack { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.pcard .am-card-foot { gap: var(--space-3); padding-top: var(--space-3); }
.am-price { gap: 2px var(--space-2); }
.am-price-now { font-size: 20px; line-height: 26px; letter-spacing: -0.01em; }
.am-price-old { font-size: 13px; }
.am-price-sale .am-price-now { color: var(--ink); }
.price-off { font: 600 13px/18px var(--font-sans); color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.am-price-unit { font-size: 12.5px; }
.pcard .am-btn { --btn-h: 40px; font-size: 15px; }
.cmp { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 28px; font-size: 13px; color: var(--ink-subtle); cursor: pointer; user-select: none; }
.cmp input { appearance: none; width: 16px; height: 16px; margin: 0; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface) center/11px no-repeat; cursor: pointer; transition: background-color var(--dur-fast), border-color var(--dur-fast); }
.cmp input:checked { background-color: var(--ink); border-color: var(--ink); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5'/%3E%3C/svg%3E"); }
.cmp input:disabled { opacity: .4; cursor: not-allowed; }
.cmp:hover { color: var(--ink); }
.cmp input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.slot { display: grid; }
.slot > * { animation: fadein var(--dur-base) var(--ease-out); }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } }

/* Лента товаров: колонки через тонкие вертикальные линии */
.shelf-nav { display: flex; align-items: center; gap: var(--space-2); }
.shelf-nav .am-link { margin-right: var(--space-3); }
.shelf-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; transition: border-color var(--dur-fast), opacity var(--dur-fast); }
.shelf-btn:hover:not(:disabled) { border-color: var(--ink); }
.shelf-btn:disabled { opacity: .35; cursor: default; }
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 25%; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding-bottom: var(--space-2); scrollbar-width: none; margin: 0 calc(var(--space-4) * -1); }
.shelf::-webkit-scrollbar { display: none; }
.shelf > * { scroll-snap-align: start; border-left: 1px solid var(--line); }
.shelf > :first-child { border-left-color: transparent; }
.shelf:focus-visible { outline-offset: 4px; }
@media (max-width: 1023px) { .shelf { grid-auto-columns: 42%; scrollbar-width: thin; } .shelf-btn { display: none; } }
@media (max-width: 599px) { .shelf { grid-auto-columns: 72%; } }

/* ---------- Подвал ---------- */
.ft { background: var(--ink); color: #c4c9c6; padding: var(--space-16) 0 var(--space-8); font-size: 14px; line-height: 20px; }
.ft-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-8); }
.ft h2 { margin: 0 0 var(--space-4); padding-bottom: var(--space-3); border-bottom: 1px solid rgba(255,255,255,.18); font: 600 14px/20px var(--font-sans); color: var(--surface); }
.ft ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.ft a { color: #c4c9c6; text-decoration: none; }
.ft a:hover { color: var(--surface); text-decoration: underline; text-underline-offset: 3px; }
.ft .todo { background: transparent; color: var(--surface); border-color: #8f9692; }
.ft-bottom { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); justify-content: space-between; margin-top: var(--space-12); padding-top: var(--space-6); border-top: 1px solid rgba(255,255,255,.18); font-size: 13px; }
.ft-demo { margin: var(--space-4) 0 0; font-size: 12px; line-height: 18px; color: #a7ada9; }
.credits { margin-top: var(--space-2); font-size: 12px; line-height: 18px; color: #a7ada9; }
.credits summary { cursor: pointer; }
.credits ol { margin: var(--space-2) 0 0; padding-left: var(--space-5); columns: 2; column-gap: var(--space-8); }
@media (max-width: 1023px) { .ft-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) { .ft-cols { grid-template-columns: 1fr; gap: var(--space-6); } .credits ol { columns: 1; } }

/* ---------- Уведомления ---------- */
.toasts { position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: var(--z-toast); display: grid; gap: var(--space-2); }
.has-cmp .toasts { bottom: 96px; }
.am-toast { background: var(--ink); border-radius: var(--radius-md); }
.am-toast .am-ico { color: var(--brand-200); }
.toasts .am-toast { animation: toast-in var(--dur-slow) var(--ease-out); }
.toasts .am-toast.out { animation: toast-out 160ms ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
.am-toast a, .am-toast .toast-act { color: var(--brand-200); }
.am-toast .toast-act { margin-left: auto; border: 0; background: none; padding: var(--space-1) 0; font: 600 15px/22px var(--font-sans); white-space: nowrap; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.am-toast .toast-act:hover { color: var(--surface); }
@media (max-width: 599px) { .toasts { left: var(--space-4); right: var(--space-4); bottom: var(--space-4); } }

/* ---------- Сравнение ---------- */
.cmp-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky); background: var(--surface); border-top: 1px solid var(--ink); box-shadow: 0 -12px 32px rgba(27, 31, 29, .08); animation: rise var(--dur-slow) var(--ease-out); }
@keyframes rise { from { transform: translateY(100%); } }
.cmp-bar-in { display: flex; align-items: center; gap: var(--space-4); min-height: 68px; padding-top: var(--space-2); padding-bottom: var(--space-2); }
.cmp-bar-in > b { font-size: 14px; white-space: nowrap; }
.cmp-bar-in ul { display: flex; gap: var(--space-2); list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; overflow-x: auto; }
.cmp-bar-in li { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-1) var(--space-1) var(--space-1); border: 1px solid var(--line); border-radius: var(--radius-md); max-width: 240px; flex: none; }
.cmp-bar-in .am-row-thumb { width: 36px; height: 36px; position: relative; }
.cmp-name { font-size: 13px; line-height: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cmp-bar-in li button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; border-radius: var(--radius-inner); color: var(--ink-subtle); cursor: pointer; flex: none; }
.cmp-bar-in li button:hover { background: var(--surface-sunken); color: var(--ink); }
body.has-cmp { padding-bottom: 72px; }
@media (max-width: 767px) { .cmp-bar-in ul { display: none; } .cmp-bar-in { justify-content: space-between; } }

.cmp-dlg { width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); color: var(--ink); }
.cmp-dlg[open] { display: flex; flex-direction: column; animation: dlg var(--dur-slow) var(--ease-out); }
@keyframes dlg { from { opacity: 0; transform: translateY(10px) scale(.99); } }
.cmp-dlg::backdrop { background: var(--overlay); }
.cmp-dlg-head { display: flex; justify-content: space-between; align-items: center; padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--line); }
.cmp-dlg-head h2 { margin: 0; font: 600 20px/26px var(--font-sans); }
.cmp-scroll { overflow: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.cmp-table th, .cmp-table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; min-width: 190px; }
.cmp-table thead th { vertical-align: bottom; font-weight: 500; }
.cmp-table thead th a { display: block; margin-top: var(--space-2); color: var(--ink); text-decoration: none; }
.cmp-table thead th a:hover { color: var(--action); text-decoration: underline; }
.cmp-table thead .am-row-thumb { width: 64px; height: 64px; position: relative; }
.cmp-table tbody th { color: var(--ink-subtle); font-weight: 400; min-width: 150px; position: sticky; left: 0; background: var(--surface); }
.cmp-table tr.differs td { background: var(--brand-50); }
.cmp-table tr.differs th { color: var(--ink); font-weight: 500; }
.cmp-table small { color: var(--ink-subtle); }
.cmp-dlg .am-help { padding: var(--space-3) var(--space-6); margin: 0; }

/* ---------- Рабочая таблица: калькулятор на главной и корзина ---------- */
.tool { background: var(--surface); color: var(--ink); border-radius: var(--radius-lg); box-shadow: 0 30px 60px rgba(0, 0, 0, .28); overflow: hidden; }
.tool-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 var(--space-6); border-bottom: 1px solid var(--line); }
.tool-pane { padding: var(--space-5) var(--space-6); background: var(--paper); border-bottom: 1px solid var(--line); animation: fadein var(--dur-base) var(--ease-out); }


.tool-table-wrap { max-height: 380px; overflow-y: auto; overscroll-behavior: contain; }
.tool-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.tool-table th { position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-subtle); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tool-table th:first-child, .tool-table td:first-child { padding-left: var(--space-6); }
.tool-table th:last-child, .tool-table td:last-child { padding-right: var(--space-5); }
.tool-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tool-table tr { transition: background-color var(--dur-base), opacity var(--dur-base); }
.tool-table tbody tr:hover { background: var(--paper); }
.tool-table tr.flash { animation: rowflash 1000ms var(--ease-out); }
@keyframes rowflash { 0%, 30% { background: var(--brand-50); } }
.tool-table tr.leaving { opacity: 0; }
.t-name { display: flex; align-items: center; gap: var(--space-3); min-width: 260px; }
.t-name .am-row-thumb { width: 40px; height: 40px; position: relative; flex: none; }
.t-name a { color: var(--ink); text-decoration: none; font-weight: 500; }
.t-name a:hover { color: var(--action); text-decoration: underline; text-underline-offset: 3px; }
.t-sku { color: var(--ink-muted); white-space: nowrap; }
.t-price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.t-price small { display: block; font-size: 12px; color: var(--ink-subtle); }
.t-sum { font-weight: 600; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.t-sum.flash { animation: sumflash 520ms var(--ease-out); }
@keyframes sumflash { 30% { color: var(--action); } }
.calc-del { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: var(--radius-inner); background: none; color: var(--ink-subtle); cursor: pointer; transition: background-color var(--dur-fast), color var(--dur-fast); }
.calc-del:hover { background: var(--danger-soft); color: var(--danger); }
.t-empty td { padding: var(--space-8) var(--space-6); color: var(--ink-muted); text-align: center; }
.t-empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: var(--space-1); }

.tool-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--space-4) var(--space-8); align-items: center; padding: var(--space-5) var(--space-6); background: var(--paper); border-top: 1px solid var(--line); }
.tool-min { display: grid; gap: var(--space-2); max-width: 420px; }
.tool-min .am-meter { height: 4px; }
.am-meter-label.ok { color: var(--success); }
.tool-total { display: grid; justify-items: end; }
.tool-total span { font-size: 13px; color: var(--ink-subtle); }
.tool-total b { font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tool-acts { display: grid; justify-items: center; gap: var(--space-2); }
.tool-acts .am-link { color: var(--ink-subtle); font-size: 13px; }


/* ---------- Пустые состояния: слева, над линейкой ---------- */
.am-empty { justify-items: start; text-align: left; max-width: 640px; padding: var(--space-6) 0 var(--space-8); gap: var(--space-3); }
.am-empty h3 { font: 600 24px/30px var(--font-sans); letter-spacing: -0.02em; }
.am-empty p { font-size: 16px; line-height: 24px; max-width: 54ch; }
.am-empty-actions { gap: var(--space-3) var(--space-5); }
.results .am-empty, .cart-empty .am-empty { margin: 0; justify-items: start; text-align: left; }

/* ---------- Реестр документов (главная и карточка товара) ---------- */
.doc-type { display: inline-grid; place-items: center; min-width: 40px; height: 24px; padding: 0 var(--space-1); border: 1px solid var(--ink); border-radius: var(--radius-sm); font: 600 11.5px/1 var(--font-mono); letter-spacing: 0.04em; color: var(--ink); }
.doc-registry { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.doc-registry-head { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); background: var(--paper); }
.doc-registry-head .am-row-thumb { position: relative; flex: none; width: 44px; height: 44px; }
.doc-registry-head b { display: block; font-weight: 600; font-size: 15px; }
.doc-registry-head small { font-size: 13px; color: var(--ink-subtle); }
.doc-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.doc-table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-subtle); padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--line); }
.doc-table td { padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--line); }
.doc-table tbody tr:last-child td { border-bottom: 0; }
.doc-table tbody tr { transition: background-color var(--dur-fast); }
.doc-table tbody tr:hover { background: var(--brand-50); }
.doc-table td:nth-child(4) { color: var(--ink-subtle); font-family: var(--font-mono); font-size: 12.5px; }
@media (max-width: 599px) { .doc-table th:nth-child(3), .doc-table td:nth-child(3), .doc-table th:nth-child(4), .doc-table td:nth-child(4) { display: none; } .doc-table td, .doc-table th { padding-left: var(--space-3); padding-right: var(--space-3); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .shelf { scroll-behavior: auto; }
}

.am-search-box input::placeholder, .am-input::placeholder { color: var(--ink-subtle); opacity: 1; }

/* ---------- Заголовок внутренних страниц ---------- */

.page-crumbs { padding-top: var(--space-5); }
.page-head { padding-top: var(--space-5); padding-bottom: var(--space-2); display: grid; gap: var(--space-4); }
.page-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--ink); }
.page-title .am-h1 { font-size: clamp(28px, 1.4vw + 18px, 40px); }
.page-desc { flex: 1 1 320px; margin: 0 0 0 auto; max-width: 52ch; color: var(--ink-muted); font-size: 15px; line-height: 22px; text-align: left; }
.page-count { color: var(--ink-muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.am-crumbs { font-size: 13.5px; }
.am-crumbs a { color: var(--ink-subtle); }


.am-meter span { width: 0; }

/* ---------- Упрощённая шапка оформления заказа ---------- */
.hd-min .am-header-in { gap: var(--space-6); }
.hd-min-phone { display: inline-flex; align-items: center; gap: var(--space-2); margin-left: auto; color: var(--ink); text-decoration: none; font-size: 14px; }
.hd-min-back { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 14px; color: var(--ink); }
@media (max-width: 599px) { .hd-min-phone { display: none; } .hd-min-back { margin-left: auto; } }

/* ---------- Тёмная панель итога (корзина, оформление) и подвал таблицы заказа ---------- */
.cart-sum { display: grid; gap: var(--space-4); padding: var(--space-6); border-radius: var(--radius-lg); background: var(--brand-900); color: var(--surface); }
.cart-sum h2 { margin: 0; padding-bottom: var(--space-3); border-bottom: 1px solid rgba(255, 255, 255, .5); font: 600 18px/24px var(--font-sans); }
.cart-sum-rows { margin: 0; display: grid; gap: var(--space-2); }
.cart-sum-rows div { display: flex; justify-content: space-between; gap: var(--space-4); font-size: 14px; line-height: 20px; }
.cart-sum-rows dt { color: var(--brand-100); }
.cart-sum-rows dd { margin: 0; font-variant-numeric: tabular-nums; }
.cart-sum .am-meter { background: rgba(255, 255, 255, .18); }
.cart-sum .am-meter span { background: var(--surface); }
.cart-sum .am-meter-done span { background: #8fd3a4; }
.cart-sum .am-meter-label { color: var(--surface); }
.cart-sum .am-meter-label.ok { color: #b9e6c5; }
.cart-sum-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: var(--space-4); border-top: 1px solid rgba(255, 255, 255, .18); }
.cart-sum-total span { color: var(--brand-100); font-size: 14px; }
.cart-sum-total b { font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cart-go { background: var(--surface); color: var(--brand-900); font-weight: 600; }
.cart-go:hover:not([aria-disabled="true"]) { background: var(--brand-100); }
.cart-go[aria-disabled="true"] { opacity: 1; background: rgba(255, 255, 255, .14); color: var(--brand-100); cursor: not-allowed; pointer-events: auto; }
.cart-why { margin: 0; font-size: 13px; line-height: 18px; color: var(--brand-100); }
.cart-why.nudge { color: var(--surface); animation: nudge 360ms var(--ease-out); }
@keyframes nudge { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.thanks-foot { display: flex; justify-content: flex-end; align-items: baseline; gap: var(--space-4); padding: var(--space-4) var(--space-6); background: var(--paper); border-top: 1px solid var(--line); }
.thanks-foot span { color: var(--ink-subtle); font-size: 14px; }
.thanks-foot b { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Состав заказа («Спасибо», заказ в кабинете): на телефоне строки блоками */
@media (max-width: 699px) {
  .order-table thead { display: none; }
  .order-table, .order-table tbody, .order-table tr, .order-table td { display: block; }
  .order-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
  .order-table td { padding: 0 !important; border: 0; text-align: left; }
  .order-table td.t-name { display: flex; grid-column: 1 / -1; }
  .order-table td:nth-child(2) { grid-column: 1; color: var(--ink-subtle); font-size: 13px; }
  .order-table td:nth-child(3) { grid-column: 1; font-size: 13px; }
  .order-table td.t-sum { grid-column: 2; grid-row: 2 / 4; align-self: center; text-align: right; }
}

/* поле не растягивается по высоте соседнего — подсказка под одним полем не сдвигает другое */
.am-field { align-content: start; }

/* название товара в рабочих таблицах: под ним артикул, упаковка, наличие */
.t-name > div { display: grid; gap: 2px; min-width: 0; }
.t-meta { display: flex; flex-wrap: wrap; gap: 2px var(--space-3); align-items: center; font-size: 12.5px; line-height: 18px; color: var(--ink-subtle); }
.t-meta .sku { color: var(--ink-muted); }
.t-meta .am-stock { font-size: 12.5px; }

/* Степпер в карточке: поле количества не берёт браузерную ширину по умолчанию (~200 px),
   иначе степпер шире карточки и кнопка «✓» уезжает в соседнюю */
.slot { grid-template-columns: minmax(0, 1fr); }
.slot > * { min-width: 0; }
.am-card-actions .am-qty input { width: 0; min-width: 36px; }

/* спрайт иконок: в разметке, но вне потока */
.am-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
