/* =============================================================================
   opt.css — оптовый раздел kusmartkz.com/opt
   Фирменный стиль птицефабрики «Қазгер-Құс» (kazgerkus.kz):
   палитра и пара шрифтов взяты из их themes/demo/assets/css/theme.css.
   Тема светлая — осознанно: раздел живёт внутри корпоративного лендинга
   kusmartkz.com, который тоже светлый.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Фирменные цвета */
  --blue:        #3353A0;
  --blue-deep:   #26407E;
  --blue-pale:   #BDCBEE;
  --blue-wash:   #EEF2FB;

  /* Нейтрали — уведены в синеву фирстиля, а не чистый серый */
  --ink:         #151515;
  --ink-soft:    #3C4250;
  --mute:        #666B76;
  --line:        #DCDCDC;
  --line-soft:   #ECEEF2;
  --ground:      #F5F6F8;
  --card:        #FFFFFF;

  /* Семантика статусов — отдельно от акцента */
  --ok:          #2E7D4F;
  --ok-wash:     #E9F4EE;
  --warn:        #B4771A;
  --warn-wash:   #FBF2E3;
  --danger:      #B3261E;
  --danger-wash: #FBEBEA;
  --yolk:        #E8A33D;

  --radius:      10px;
  --radius-lg:   16px;
  --shadow:      0 1px 2px rgba(21,21,21,.06), 0 8px 24px rgba(38,64,126,.07);
  --shadow-lift: 0 4px 12px rgba(21,21,21,.08), 0 18px 40px rgba(38,64,126,.12);

  --header-h:    68px;
  --maxw:        1240px;

  --display: "M PLUS Rounded 1c", "Commissioner", system-ui, sans-serif;
  --body:    "Commissioner", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-deep); }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

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

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.tnum { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ── Шапка ───────────────────────────────────────────────────────────────── */

.hdr {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.hdr__in {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; gap: 28px;
}

.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--blue); color: #fff;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 17px;
}
.brand__name {
  font-family: var(--display); font-weight: 800; font-size: 17px;
  color: var(--ink); letter-spacing: -.02em; line-height: 1.1;
}
.brand__sub {
  display: block; font-family: var(--body); font-weight: 500;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--mute);
}

.hdr__nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.hdr__nav a {
  font-size: 14px; font-weight: 500; color: var(--ink-soft);
  padding: 6px 0; border-bottom: 2px solid transparent;
}
.hdr__nav a:hover { color: var(--blue); }
.hdr__nav a[aria-current="page"] { color: var(--blue); border-bottom-color: var(--blue); }

.hdr__actions { display: flex; align-items: center; gap: 10px; }

/* ── Кнопки ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--body); font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  transition: background .16s, border-color .16s, color .16s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover:not([disabled]) { background: var(--blue-deep); color: #fff; }

.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover:not([disabled]) { border-color: var(--blue); color: var(--blue); }

.btn--quiet { background: transparent; color: var(--mute); padding: 8px 10px; }
.btn--quiet:hover:not([disabled]) { color: var(--danger); }

.btn--sm { padding: 7px 13px; font-size: 13px; }
.btn--block { width: 100%; }

.btn--cart { position: relative; }
.btn--cart__count {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--yolk); color: #21160A;
  font-size: 11px; font-weight: 800; line-height: 20px; text-align: center;
}
.btn--cart__count[hidden] { display: none; }

/* ── Герой ───────────────────────────────────────────────────────────────── */

.hero {
  background:
    linear-gradient(105deg, var(--blue-deep) 0%, var(--blue) 58%, #4468B8 100%);
  color: #fff;
  padding: 56px 0 60px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: auto -80px -180px auto;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.10), transparent 68%);
}
.hero__in { position: relative; z-index: 1; max-width: 720px; }
.hero__eyebrow {
  display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--blue-pale); margin-bottom: 14px;
}
.hero h1 { font-size: clamp(28px, 4.2vw, 44px); line-height: 1.1; }
.hero p {
  margin: 16px 0 0; font-size: 17px; line-height: 1.5;
  color: rgba(255,255,255,.86); max-width: 56ch;
}
.hero__stats {
  display: flex; flex-wrap: wrap; gap: 36px; margin-top: 32px;
  padding-top: 26px; border-top: 1px solid rgba(255,255,255,.2);
}
.hero__stat b {
  display: block; font-family: var(--display); font-size: 26px;
  font-weight: 800; line-height: 1.1;
}
.hero__stat span { font-size: 13px; color: rgba(255,255,255,.75); }

/* ── Каталог ─────────────────────────────────────────────────────────────── */

.catalog { padding: 36px 0 72px; }

.catalog__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 22px;
}
.catalog__head h2 { font-size: 26px; }
.catalog__head p { margin: 5px 0 0; color: var(--mute); font-size: 14px; }

.catalog__body {
  display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 28px;
  align-items: start;
}

.filters {
  position: sticky; top: calc(var(--header-h) + 20px);
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 18px;
  display: flex; flex-direction: column; gap: 20px;
}
.filters__group { display: flex; flex-direction: column; gap: 8px; }
.filters__label {
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--mute);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--body); font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  cursor: pointer; transition: background .14s, border-color .14s, color .14s;
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip[aria-pressed="true"] {
  background: var(--blue); border-color: var(--blue); color: #fff;
}

.field {
  display: flex; flex-direction: column; gap: 6px;
}
.field > label,
.filters__label + input { font-size: 13px; }
.field label {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
}
.field input, .field select, .field textarea {
  font-family: var(--body); font-size: 14px; color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-wash);
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.field__hint { font-size: 12px; color: var(--mute); }
.field__err { font-size: 12px; color: var(--danger); }

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

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.card:hover {
  border-color: var(--blue-pale); box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}
.card__media {
  aspect-ratio: 4 / 3; background: var(--blue-wash);
  display: grid; place-items: center; position: relative;
  border-bottom: 1px solid var(--line-soft);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__media svg { width: 62px; height: 62px; opacity: .55; }

.card__grade {
  position: absolute; top: 10px; left: 10px;
  background: var(--blue); color: #fff;
  font-family: var(--display); font-weight: 800; font-size: 12px;
  padding: 4px 9px; border-radius: 6px; letter-spacing: .01em;
}
.card__stock {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.94); border-radius: 999px;
  padding: 4px 9px; font-size: 11px; font-weight: 600; color: var(--ink-soft);
}
.card__stock::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--yolk);
}
.card__stock--out { color: var(--danger); }
.card__stock--out::before { background: var(--danger); }

.card__body { padding: 14px 15px 15px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card__name { font-family: var(--display); font-size: 15px; font-weight: 700; line-height: 1.3; }
.card__meta { font-size: 12.5px; color: var(--mute); display: flex; flex-wrap: wrap; gap: 4px 10px; }

.card__price { display: flex; align-items: baseline; gap: 7px; margin-top: auto; }
.card__price b { font-family: var(--display); font-size: 21px; font-weight: 800; }
.card__price span { font-size: 12.5px; color: var(--mute); }
.card__price-own {
  font-size: 11px; font-weight: 700; color: var(--ok);
  background: var(--ok-wash); padding: 2px 7px; border-radius: 5px;
}

.qty { display: flex; gap: 8px; }
.qty__unit { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.qty__unit label {
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--mute);
}
.qty__unit input {
  font-family: var(--body); font-size: 14px; font-variant-numeric: tabular-nums;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  width: 100%; text-align: center;
}
.qty__unit input:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-wash);
}

/* ── Корзина (выезжает справа) ───────────────────────────────────────────── */

.scrim {
  position: fixed; inset: 0; background: rgba(21,21,21,.42);
  opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 60;
}
.scrim[data-open="true"] { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(440px, 100%); background: var(--ground);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
  box-shadow: -12px 0 40px rgba(21,21,21,.16);
}
.drawer[data-open="true"] { transform: none; }

.drawer__head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px; background: #fff; border-bottom: 1px solid var(--line);
}
.drawer__head h2 { font-size: 18px; margin-right: auto; }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.drawer__foot { padding: 16px 20px 20px; background: #fff; border-top: 1px solid var(--line); }

.line {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 13px; display: flex; flex-direction: column; gap: 6px;
}
.line__top { display: flex; gap: 10px; align-items: flex-start; }
.line__name { font-size: 14px; font-weight: 600; line-height: 1.35; flex: 1; }
.line__meta { font-size: 12.5px; color: var(--mute); }
.line__sum {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 14px;
}
.line__sum b { font-family: var(--display); font-size: 16px; }

.total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
}
.total span { font-size: 14px; color: var(--mute); }
.total b { font-family: var(--display); font-size: 25px; font-weight: 800; }

.empty {
  text-align: center; color: var(--mute); padding: 44px 20px;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.empty svg { width: 46px; height: 46px; opacity: .3; }
.empty b { font-family: var(--display); color: var(--ink); font-size: 16px; }

/* ── Формы-страницы (вход, регистрация) ──────────────────────────────────── */

.auth {
  min-height: calc(100vh - var(--header-h));
  display: grid; place-items: center; padding: 44px 24px 64px;
}
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 30px; width: 100%;
}
.panel--auth { max-width: 440px; }
.panel--wide { max-width: none; }
.panel__head { margin-bottom: 22px; }
.panel__head h1 { font-size: 24px; }
.panel__head p { margin: 7px 0 0; color: var(--mute); font-size: 14px; }

.form { display: flex; flex-direction: column; gap: 15px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form__foot { margin-top: 4px; display: flex; flex-direction: column; gap: 12px; }
.form__alt { text-align: center; font-size: 14px; color: var(--mute); }

.alert {
  border-radius: var(--radius); padding: 11px 14px; font-size: 14px;
  border: 1px solid transparent; line-height: 1.45;
}
.alert--err  { background: var(--danger-wash); border-color: #F0C9C6; color: #8A1E17; }
.alert--ok   { background: var(--ok-wash);     border-color: #C3E2CF; color: #1E5B39; }
.alert--info { background: var(--blue-wash);   border-color: var(--blue-pale); color: var(--blue-deep); }
.alert[hidden] { display: none; }

/* ── Кабинет и админка ───────────────────────────────────────────────────── */

.page { padding: 32px 0 72px; }
.page__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 22px;
}
.page__head h1 { font-size: 27px; }
.page__head p { margin: 5px 0 0; color: var(--mute); font-size: 14px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.cols { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 24px; align-items: start; }

.tbl-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
table.tbl th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--mute);
  padding: 0 14px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tbl td {
  padding: 13px 14px; border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
table.tbl tbody tr:hover { background: var(--blue-wash); }
table.tbl td.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.pill {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--line-soft); color: var(--ink-soft);
}
.pill--new     { background: var(--blue-wash);   color: var(--blue-deep); }
.pill--work    { background: var(--warn-wash);   color: var(--warn); }
.pill--done    { background: var(--ok-wash);     color: var(--ok); }
.pill--dead    { background: var(--danger-wash); color: var(--danger); }

.order-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.order-card__top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.order-card__no { font-family: var(--display); font-size: 17px; font-weight: 800; }
.order-card__date { font-size: 13px; color: var(--mute); margin-left: auto; }
.order-card__items { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.order-card__item { display: flex; gap: 12px; }
.order-card__item span:first-child { flex: 1; }
.order-card__foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.order-card__total { font-family: var(--display); font-size: 18px; font-weight: 800; margin-left: auto; }
.order-card__note {
  background: var(--blue-wash); border-radius: 8px; padding: 9px 12px;
  font-size: 13.5px; color: var(--ink-soft);
}
.order-card__note b { font-weight: 700; }

/* ── Подвал ──────────────────────────────────────────────────────────────── */

.ftr { background: #fff; border-top: 1px solid var(--line); padding: 34px 0; }
.ftr__in {
  display: flex; gap: 26px; flex-wrap: wrap;
  justify-content: space-between; align-items: center;
  font-size: 13.5px; color: var(--mute);
}
.ftr a { color: var(--ink-soft); }
.ftr a:hover { color: var(--blue); }

/* ── Тосты ───────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 500;
  padding: 11px 18px; border-radius: var(--radius);
  box-shadow: var(--shadow-lift); animation: toast-in .2s ease-out;
  max-width: min(460px, 90vw);
}
.toast--err { background: var(--danger); }
.toast--ok  { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ── Адаптив ─────────────────────────────────────────────────────────────── */

@media (max-width: 940px) {
  .catalog__body { grid-template-columns: 1fr; }
  .filters {
    position: static; flex-direction: row; flex-wrap: wrap; gap: 14px;
  }
  .filters__group { flex: 1 1 240px; }
  .cols { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .wrap, .hdr__in { padding: 0 16px; }
  .hdr__nav { display: none; }
  .hero { padding: 40px 0 44px; }
  .hero__stats { gap: 24px; }
  .form__row { grid-template-columns: 1fr; }
  .panel { padding: 22px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
}
