/* =============================================================================
   Client website — one stylesheet, dark theme, warm accent.
   Sections: 1 tokens · 2 reset/base · 3 layout · 4 header/footer · 5 buttons/forms
             6 cards & badges · 7 catalogue · 8 product page · 9 cart · 10 cabinet
             11 orders & chat · 12 auth · 13 misc (toasts, pager, empty, tables)
             14 responsive
   ========================================================================== */

/* 1. Tokens ------------------------------------------------------------- */
:root {
  --bg: #0f1116;
  --bg-2: #141720;
  --surface: #191d27;
  --surface-2: #202533;
  --line: #2a3040;
  --text: #eef0f5;
  --muted: #9aa3b5;
  --accent: #f5a524;
  --accent-2: #2dd4bf;
  --accent-grad: linear-gradient(135deg, #f5a524 0%, #f27b3d 45%, #2dd4bf 100%);
  --ok: #3ddc97;
  --err: #ff6b6b;
  --warn: #f5a524;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 1px 0 rgba(255, 255, 255, .03) inset;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1120px;
}

/* 2. Reset / base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  background-image: radial-gradient(900px 500px at 10% -10%, rgba(245, 165, 36, .10), transparent 60%),
                    radial-gradient(800px 500px at 100% 0%, rgba(45, 212, 191, .08), transparent 60%);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.8rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
code, pre { font-family: var(--mono); }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ok { color: var(--ok); } .err { color: var(--err); }
.link { color: var(--accent-2); }
.link:hover { text-decoration: underline; }
.grow { flex: 1 1 auto; }

/* 3. Layout ------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.main { flex: 1 0 auto; padding-top: 20px; padding-bottom: 48px; }
.section { margin-top: 36px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap-row { flex-wrap: wrap; }
.crumbs { color: var(--muted); font-size: .85rem; margin-bottom: 12px; }
.crumbs a:hover { color: var(--text); }

/* 4. Header / footer ---------------------------------------------------- */
.hdr {
  position: sticky; top: 0; z-index: 20;
  background: rgba(15, 17, 22, .78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.hdr__in { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.brand__mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-grad); position: relative; }
.brand__mark::after { content: ""; position: absolute; inset: 7px 9px; clip-path: polygon(60% 0, 0 60%, 45% 60%, 35% 100%, 100% 35%, 55% 35%); background: #0f1116; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav__a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; color: var(--muted); position: relative; }
.nav__a:hover, .nav__a.is-active { color: var(--text); background: var(--surface-2); }
.badge-count { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #1a1200; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-grad); color: #1a1200; font-weight: 700; font-size: .8rem; display: grid; place-items: center; }
.ftr { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 18px 0; }
.ftr__in { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ftr__links { display: flex; gap: 16px; }
.ftr a:hover { color: var(--text); }

/* 5. Buttons / forms ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .08s ease, filter .15s ease, background .15s ease; white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn--primary { background: var(--accent-grad); color: #1a1200; border-color: transparent; }
.btn--ghost { background: transparent; }
.btn--sm { padding: 8px 12px; font-size: .85rem; min-height: 36px; }
.btn--lg { padding: 13px 22px; font-size: 1.05rem; }
.btn--block { width: 100%; }
.input, textarea.input, select.input {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font: inherit; outline: none; min-width: 0;
}
.input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(45, 212, 191, .15); }
.input--lg { font-size: 1.2rem; text-align: center; letter-spacing: .08em; text-transform: uppercase; }
textarea.input { resize: vertical; }
.label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--muted); }
.label .input { color: var(--text); }
form.is-disabled { opacity: .55; }
.note { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: .92rem; margin: 8px 0; }
.note--err { border-color: rgba(255, 107, 107, .4); background: rgba(255, 107, 107, .08); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 18px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 6. Cards & badges ----------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.badge--instant { background: rgba(45, 212, 191, .15); color: var(--accent-2); }
.badge--manual { background: rgba(245, 165, 36, .15); color: var(--accent); }
.badge--out { background: rgba(255, 107, 107, .15); color: var(--err); }
.badge--sale { background: rgba(255, 107, 107, .2); color: #ff9b9b; }
.price__old { color: var(--muted); font-weight: 400; margin-right: 6px; }
.price__now { font-size: 1.15rem; }
.price__cur { color: var(--muted); font-size: .9rem; }
.stars { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.star { color: #3a4050; } .star.is-on { color: var(--accent); }
.stars__num { margin-left: 4px; }
.status { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.status--new { background: rgba(96, 165, 250, .15); color: #8ec0ff; }
.status--in_progress { background: rgba(245, 165, 36, .15); color: var(--accent); }
.status--done { background: rgba(61, 220, 151, .15); color: var(--ok); }
.status--cancelled { background: rgba(154, 163, 181, .15); color: var(--muted); }

/* 7. Catalogue ---------------------------------------------------------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center; padding: 28px 0 8px; }
.hero__title { font-size: clamp(2rem, 5vw, 3.2rem); background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__tagline { font-size: 1.1rem; color: var(--muted); max-width: 46ch; }
.hero__actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.hero__stats { display: flex; gap: 22px; color: var(--muted); font-size: .85rem; }
.hero__stats b { display: block; color: var(--text); font-size: 1.3rem; }
.hero__art { position: relative; height: 240px; }
.hero__art span { position: absolute; border-radius: 26px; background: var(--accent-grad); opacity: .85; box-shadow: var(--shadow); animation: float 6s ease-in-out infinite; }
.hero__art span:nth-child(1) { width: 140px; height: 140px; right: 20%; top: 10%; }
.hero__art span:nth-child(2) { width: 90px; height: 90px; right: 5%; top: 55%; opacity: .55; animation-delay: -2s; }
.hero__art span:nth-child(3) { width: 60px; height: 60px; right: 45%; top: 62%; opacity: .4; animation-delay: -4s; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(8deg); } 50% { transform: translateY(-12px) rotate(2deg); } }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.how__item { display: flex; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.how__item p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.how__icon { font-size: 1.5rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.tile__name { font-weight: 700; }
.tile__count { color: var(--muted); font-size: .8rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.product { display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .15s; }
.product:hover { border-color: var(--accent); transform: translateY(-2px); }
.product.is-out { opacity: .7; }
.product__top { display: flex; gap: 6px; flex-wrap: wrap; }
.product__name { margin: 4px 0 0; }
.product__cat { color: var(--muted); font-size: .8rem; }
.product__desc { color: var(--muted); font-size: .9rem; margin: 0; flex: 1; }
.product__bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.search { display: flex; gap: 8px; flex: 1 1 320px; max-width: 460px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .9rem; color: var(--muted); }
.chip:hover { color: var(--text); }
.chip.is-on { color: #1a1200; background: var(--accent); border-color: transparent; font-weight: 600; }
.chip__n { font-size: .75rem; opacity: .8; }

/* 8. Product page ------------------------------------------------------- */
.product-page { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.product-page__title { font-size: 1.7rem; }
.product-page__desc { white-space: pre-wrap; margin: 14px 0; }
.facts { display: grid; gap: 8px; margin: 12px 0 0; }
.facts div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.buybox { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 10px; }
.buybox__price .price__now { font-size: 1.6rem; }
.promo-box summary { cursor: pointer; color: var(--accent-2); font-size: .92rem; }
.promo-box .row { margin-top: 8px; }
.review-form { margin-bottom: 14px; }
.reviews { display: grid; gap: 10px; }
.review__head { display: flex; justify-content: space-between; gap: 10px; }
.review__text { margin: 6px 0 0; }

/* 9. Cart --------------------------------------------------------------- */
.cart { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.cart__lines { display: flex; flex-direction: column; gap: 10px; }
.line { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.line__main { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; }
.line__name { font-weight: 700; }
.line__name:hover { color: var(--accent); }
.line__ctl { display: flex; align-items: center; gap: 10px; }
.line__promo { flex-basis: 100%; font-size: .9rem; }
.line__promo summary { cursor: pointer; color: var(--muted); }
.line__promo .row { margin-top: 8px; max-width: 360px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.qty__btn { width: 36px; height: 34px; border: 0; background: var(--surface-2); color: var(--text); font-size: 1.1rem; cursor: pointer; }
.qty__btn:hover { background: var(--line); }
.qty__n { min-width: 36px; text-align: center; font-weight: 700; }
.summary { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 10px; }
.summary__row { display: flex; justify-content: space-between; }
.summary__total { font-size: 1.2rem; padding-top: 8px; border-top: 1px solid var(--line); }
.result { max-width: 760px; margin: 0 auto; }
.result__head { text-align: center; margin: 10px 0 20px; }
.result__icon { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.value-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.code { margin: 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px dashed var(--line); white-space: pre-wrap; word-break: break-all; font-size: .95rem; cursor: copy; }
.code-inline { padding: 2px 6px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); word-break: break-all; cursor: copy; }

/* 10. Cabinet ----------------------------------------------------------- */
.cab { display: grid; gap: 14px; }
.cab__balance { display: flex; flex-direction: column; gap: 10px; background: linear-gradient(160deg, var(--surface) 0%, #1f2131 100%); }
.cab__amount { font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; }
.cab__tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile-link { display: flex; flex-direction: column; gap: 2px; transition: border-color .15s; }
.tile-link:hover { border-color: var(--accent-2); }
.tile-link b { font-size: 1.5rem; }
.tile-link span { color: var(--muted); font-size: .85rem; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table .num { text-align: right; white-space: nowrap; }
.topup { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.invoice { margin-bottom: 14px; border-color: rgba(245, 165, 36, .5); }

/* 11. Orders & chat ----------------------------------------------------- */
.order { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.timeline { list-style: none; display: flex; gap: 0; padding: 0; margin: 14px 0; }
.timeline__step { flex: 1; position: relative; padding-top: 18px; font-size: .85rem; color: var(--muted); text-align: center; }
.timeline__step::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--line); }
.timeline__dot { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; background: var(--line); border: 2px solid var(--surface); }
.timeline__step.is-done { color: var(--text); }
.timeline__step.is-done::before, .timeline__step.is-done .timeline__dot { background: var(--accent-2); }
.timeline__step.is-current { color: var(--accent); font-weight: 700; }
.timeline__step.is-current .timeline__dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(245, 165, 36, .2); }
.timeline__step.is-cancelled { color: var(--err); font-weight: 700; }
.timeline__step.is-cancelled .timeline__dot { background: var(--err); }
.chat { display: flex; flex-direction: column; gap: 10px; }
.chat__log { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding: 4px; }
.chat__form { display: flex; gap: 8px; align-items: flex-end; }
.msg { display: flex; }
.msg--client { justify-content: flex-end; }
.msg--system { justify-content: center; }
.msg__bubble { max-width: 82%; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); }
.msg--client .msg__bubble { background: rgba(45, 212, 191, .14); border-bottom-right-radius: 4px; }
.msg--staff .msg__bubble { border-bottom-left-radius: 4px; }
.msg__meta { font-size: .75rem; color: var(--muted); margin-bottom: 2px; }
.msg__text { white-space: pre-wrap; word-break: break-word; }
.msg__sys { font-size: .78rem; color: var(--muted); font-style: italic; }

/* 12. Auth -------------------------------------------------------------- */
.auth { display: grid; place-items: center; padding: 20px 0; }
.auth__card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 8px; }
.steps { padding-left: 20px; color: var(--muted); }
.steps li { margin-bottom: 4px; }
.wait { display: flex; align-items: center; gap: 10px; color: var(--muted); margin-top: 6px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tg-widget { display: flex; justify-content: center; min-height: 40px; }

/* 13. Misc: toasts, pager, empty ---------------------------------------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(92vw, 380px); }
.toast { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .92rem; animation: toast-in .25s ease; cursor: pointer; }
.toast--ok { border-left: 4px solid var(--ok); }
.toast--err { border-left: 4px solid var(--err); }
.toast.is-hiding { opacity: 0; transform: translateY(8px); transition: .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; }
.pager__a { padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.pager__a.is-off { opacity: .4; }
.pager__num { color: var(--muted); }
.empty { text-align: center; padding: 40px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty__icon { font-size: 2.6rem; }
.empty .row { justify-content: center; }
[hidden] { display: none !important; }

/* 14. Responsive -------------------------------------------------------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero__art { display: none; }
  .how { grid-template-columns: 1fr; }
  .product-page, .cart, .order { grid-template-columns: 1fr; }
  .buybox, .summary { position: static; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .nav__label { display: none; }
  .nav__a { padding: 8px 10px; }
  .facts div { grid-template-columns: 1fr; gap: 2px; }
  .chat__form { flex-direction: column; align-items: stretch; }
  .toasts { left: 16px; right: 16px; max-width: none; }
  .hero__stats { gap: 14px; }
  /* Touch targets: 44px is the comfortable minimum for a thumb. */
  .btn, .qty__btn, .pager__a, .chip { min-height: 44px; }
  .btn--sm { padding: 10px 14px; }
}
