/* Парфюм-Лидер · рабочее место консультанта */
:root {
  --bg: #f6f5f8;
  --card: #ffffff;
  --ink: #221c2b;
  --muted: #7d7689;
  --line: #e7e3ee;
  --brand: #7b2d8b;
  --brand-dark: #5e2069;
  --brand-soft: #f3e8f6;
  --accent: #c9a24b;
  --ok: #1d8a4e;
  --ok-soft: #e3f4ea;
  --warn: #b7791f;
  --warn-soft: #fdf1dc;
  --danger: #c0392b;
  --danger-soft: #fdeceb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(34, 28, 43, .08), 0 8px 24px rgba(34, 28, 43, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

#root { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }

/* ------------------------------------------------------------------ header */
.header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.logo { font-weight: 800; font-size: 19px; color: var(--brand); white-space: nowrap; }
.logo span { color: var(--ink); font-weight: 600; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  padding: 7px 13px; border-radius: 10px; font-weight: 600; font-size: 14px;
  color: var(--muted);
}
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.active { background: var(--brand-soft); color: var(--brand-dark); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.customer-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--ok-soft); color: var(--ok);
  border: 1px solid #bfe4cd; border-radius: 999px;
  padding: 5px 6px 5px 13px; font-size: 13px; font-weight: 700;
}
.customer-chip .timer { font-weight: 600; opacity: .75; }
.customer-chip button {
  border: 0; background: #fff; color: var(--ok); border-radius: 999px;
  width: 24px; height: 24px; font-size: 13px; line-height: 1;
}
.icon-btn {
  position: relative; border: 0; background: transparent; padding: 8px; border-radius: 10px;
  display: inline-flex;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: var(--ink); stroke-width: 1.8; }
.badge {
  position: absolute; top: 2px; right: 0;
  background: var(--brand); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; min-width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.consultant-box { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.consultant-box .who { text-align: right; line-height: 1.25; }
.consultant-box .who b { display: block; font-size: 13px; }
.consultant-box .store-link { font-size: 12px; color: var(--muted); }
.consultant-box .store-link:hover { color: var(--brand); }
.store-pick-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.store-pick-row:hover b { color: var(--brand); }
.store-pick-row:last-child { border-bottom: 0; }
.city-header {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 16px 0 4px;
}
.consultant-box .logout {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 6px 11px; font-size: 13px; font-weight: 600; color: var(--muted);
}
.consultant-box .logout:hover { color: var(--danger); border-color: var(--danger); }

.footer { padding: 18px 24px; border-top: 1px solid var(--line); background: var(--card); font-size: 13px; }

/* --------------------------------------------------------------- primitives */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 11px; padding: 11px 20px;
  font-weight: 700; font-size: 14px;
  background: var(--brand); color: #fff;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--brand-soft); color: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--ink); }
.btn.small { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: #fff; outline: none; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }

.page-title { font-size: 24px; font-weight: 800; margin: 6px 0 18px; }
.section-title { font-size: 17px; font-weight: 800; margin: 0 0 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }

.pill {
  display: inline-block; border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 700;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.neutral { background: var(--bg); color: var(--muted); }

/* ------------------------------------------------------------------- login */
.login-wrap { max-width: 420px; margin: 8vh auto 0; }
.login-logo { text-align: center; font-size: 28px; font-weight: 800; color: var(--brand); margin-bottom: 6px; }
.login-logo span { color: var(--ink); font-weight: 600; }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 22px; }
.login-hint {
  margin-top: 14px; padding: 11px 14px; border-radius: 10px;
  background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600;
}

/* --------------------------------------------------------- customer screen */
.attach-steps { max-width: 460px; margin: 0 auto; }
.customer-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; flex: none;
}
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 18px 0; }
.stat {
  flex: 1; min-width: 140px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 18px;
}
.stat .v { font-size: 22px; font-weight: 800; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ----------------------------------------------------------------- catalog */
.catalog-layout { display: grid; grid-template-columns: 230px 1fr; gap: 20px; }
@media (max-width: 900px) { .catalog-layout { grid-template-columns: 1fr; } }
.cat-list { display: flex; flex-direction: column; gap: 2px; }
.cat-list a { padding: 7px 11px; border-radius: 9px; font-size: 14px; color: var(--muted); font-weight: 600; }
.cat-list a:hover { background: var(--card); color: var(--ink); }
.cat-list a.active { background: var(--brand-soft); color: var(--brand-dark); }
.cat-list .sub { padding-left: 22px; font-weight: 500; font-size: 13px; }

.search-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.search-bar input {
  flex: 1; border: 1.5px solid var(--line); border-radius: 11px; padding: 11px 14px; outline: none;
}
.search-bar input:focus { border-color: var(--brand); }

.products-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px;
}
.product-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 8px; position: relative;
}
.product-card img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 8px; }
.product-card .name { font-size: 13px; font-weight: 600; min-height: 3.6em; }
.product-card .vendor { font-size: 12px; color: var(--muted); }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.price { font-weight: 800; font-size: 16px; }
.old-price { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.oos { color: var(--danger); font-size: 12px; font-weight: 700; }

.qty-ctrl { display: flex; align-items: center; gap: 8px; }
.qty-ctrl button {
  width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--line);
  background: #fff; font-size: 16px; font-weight: 700;
}
.qty-ctrl b { min-width: 22px; text-align: center; }

.pager { display: flex; gap: 8px; justify-content: center; margin-top: 20px; align-items: center; }

/* ----------------------------------------------------------------- product */
.product-page { display: grid; grid-template-columns: 380px 1fr; gap: 26px; }
@media (max-width: 800px) { .product-page { grid-template-columns: 1fr; } }
.product-page img.main { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); }
.params-tbl td { padding: 5px 12px 5px 0; font-size: 13px; }
.params-tbl td:first-child { color: var(--muted); }
.store-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.store-row:last-child { border-bottom: 0; }

/* -------------------------------------------------------------------- cart */
.cart-item { display: flex; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line); align-items: center; }
.cart-item:last-child { border-bottom: 0; }
.cart-item img { width: 58px; height: 58px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--line); flex: none; }
.cart-item .info { flex: 1; min-width: 0; }
.cart-item .info .name { font-size: 13px; font-weight: 600; }
.cart-item .remove { border: 0; background: none; color: var(--muted); font-size: 18px; }
.cart-item .remove:hover { color: var(--danger); }

.summary-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.summary-row.total { font-size: 17px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; }

.pay-option, .dlv-option {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 11px; margin-bottom: 9px; cursor: pointer;
}
.pay-option.sel, .dlv-option.sel { border-color: var(--brand); background: var(--brand-soft); }
.pay-option b, .dlv-option b { display: block; font-size: 14px; }
.pay-option .d, .dlv-option .d { font-size: 12.5px; color: var(--muted); }

/* --------------------------------------------------------------------- sbp */
.sbp-wrap { max-width: 430px; margin: 0 auto; text-align: center; }
.sbp-qr { margin: 18px auto; width: 220px; height: 220px; border-radius: 14px; border: 1px solid var(--line); background: #fff; padding: 14px; }
.sbp-qr svg { width: 100%; height: 100%; display: block; }
.sbp-amount { font-size: 30px; font-weight: 800; }
.demo-tag {
  display: inline-block; background: var(--warn-soft); color: var(--warn);
  border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700; margin: 8px 0;
}

/* ------------------------------------------------------------------ toasts */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--ink); color: #fff; border-radius: 11px; padding: 12px 17px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  animation: toast-in .2s ease;
  max-width: 340px;
}
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ------------------------------------------------------------------- modal */
#modal-root .overlay {
  position: fixed; inset: 0; background: rgba(20, 15, 28, .45); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--card); border-radius: 16px; padding: 24px; width: 100%;
  max-width: 470px; max-height: 88vh; overflow: auto; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 14px; font-size: 18px; }

.spinner {
  margin: 40px auto; width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* кружочек внутри кнопки на время запроса */
.btn-spin {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
