/* ============================================================
   AKPP CRM — единая публичная тема (сайт, магазин, личный кабинет)
   Палитра повторяет админ-панель (VS Code Dark+): строгий тёмный UI.
   ============================================================ */

:root {
    --bg: #1e1e1e;
    --surface: #252526;
    --surface-2: #2d2d30;
    --surface-3: #333337;
    --border: #3c3c3c;
    --border-strong: #4b4b4b;

    --text: #e7e7e7;
    --text-strong: #ffffff;
    --muted: #a9a9a9;
    --faint: #858585;

    --accent: #3794ff;
    --accent-hover: #4aa3ff;
    --accent-soft: rgba(55, 148, 255, 0.14);
    --success: #4ec9b0;
    --success-soft: rgba(78, 201, 176, 0.14);
    --danger: #f48771;
    --danger-soft: rgba(244, 135, 113, 0.14);
    --warning: #dcdcaa;
    --warning-soft: rgba(220, 220, 170, 0.14);
    --violet: #c586c0;

    /* Совместимость со старыми классами. */
    --primary: var(--accent);
    --card-bg: var(--surface);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 6px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --font-size: 14px;
    --shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--font-size);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 {
    color: var(--text-strong);
    line-height: 1.25;
    margin: 0 0 14px;
    font-weight: 650;
}

h1 { font-size: clamp(22px, 2.6vw, 30px); }
h2 { font-size: clamp(18px, 2vw, 22px); }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

p { margin: 0 0 12px; }

small { color: var(--muted); }

code, kbd, pre, .ui-mono {
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.92em;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ---------- Каркас страницы ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(37, 37, 38, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.site-header-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: nowrap;
}

.site-brand {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
}

.site-brand b {
    color: var(--text-strong);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.site-brand b span { color: var(--accent); }

.site-brand small {
    color: var(--faint);
    font-size: 11px;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
    margin-left: auto;
    min-width: 0;
}

.site-nav > * { flex: 0 0 auto; }

.site-nav > a:not(.site-cart):not(.site-crm-cta):not(.site-profile-btn) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.site-nav > a:not(.site-cart):not(.site-crm-cta):not(.site-profile-btn):hover {
    color: var(--text-strong);
    background: var(--surface-2);
    border-color: var(--border);
}

.site-nav > a:not(.site-cart):not(.site-crm-cta):not(.site-profile-btn).active {
    color: var(--text-strong);
    background: var(--surface-3);
    border-color: var(--border-strong);
}

.site-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    background: var(--accent-soft);
    border: 1px solid rgba(55, 148, 255, 0.4);
    border-radius: 8px;
    color: var(--text-strong) !important;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.site-cart:hover { background: rgba(55, 148, 255, 0.24); }

.site-cart-badge {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.site-cart-badge[data-empty="1"] { display: none; }

/* ---------- Профиль в шапке и CTA «Хочу такую CRM» ---------- */

.site-profile { position: relative; }

.site-profile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.site-profile-btn:hover {
    color: var(--text-strong);
    background: var(--surface-2);
    border-color: var(--border);
}

.site-profile.open .site-profile-btn {
    color: var(--text-strong);
    background: var(--surface-3);
    border-color: var(--border-strong);
}

.site-profile-btn svg { flex: 0 0 auto; }

.site-profile-badge {
    display: inline-grid;
    place-items: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
}

.site-profile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 1100;
    min-width: 224px;
    padding: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: none;
}

.site-profile.open .site-profile-menu { display: block; }

.site-profile-name {
    padding: 8px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
    color: var(--text-strong);
    font-size: 12.5px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-profile-menu a {
    display: block;
    padding: 8px 10px;
    border-radius: 5px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.site-profile-menu a:hover { background: var(--surface-3); color: var(--text-strong); }
.site-profile-menu a.danger { color: var(--danger); }
.site-profile-menu a.danger:hover { background: var(--danger-soft); color: var(--danger); }

.site-profile-sep { height: 1px; margin: 4px 6px; background: var(--border); }

.site-crm-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(197, 134, 192, 0.55);
    border-radius: 8px;
    background: rgba(197, 134, 192, 0.14);
    color: #e9d3e7;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.site-crm-cta::before {
    content: '✦';
    color: var(--violet);
    font-size: 12px;
    line-height: 1;
}

.site-crm-cta:hover {
    background: rgba(197, 134, 192, 0.26);
    border-color: rgba(197, 134, 192, 0.85);
    color: #ffffff;
}

.site-main { min-height: calc(100vh - 220px); }

.site-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: clamp(22px, 3.2vw, 36px) clamp(14px, 3vw, 24px) clamp(48px, 6vw, 72px);
}

.site-container.narrow { max-width: 760px; }

.site-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.4;
}
.site-breadcrumbs a { color: var(--muted); text-decoration: none; }
.site-breadcrumbs a:hover { color: var(--primary); text-decoration: underline; }
.site-breadcrumbs [itemprop="name"] { color: var(--text); }
.site-breadcrumb-sep { color: var(--muted); opacity: .65; }

.site-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

.site-page-head h1 { margin: 0; }

.site-subtitle {
    color: var(--muted);
    font-size: 13.5px;
    margin: 6px 0 0;
}

.site-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 28px 20px 22px;
    margin-top: 40px;
    color: var(--muted);
    font-size: 13px;
}

.site-footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.site-footer-contacts {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--muted);
}

.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text-strong); }

.site-footer-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.site-footer-links a { font-size: 12px; color: var(--faint); }

.site-copyright { color: var(--faint); font-size: 12px; margin: 0; }

.site-footer-crm {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 18px;
    margin: 4px 0 10px;
    background: linear-gradient(120deg, rgba(197, 134, 192, 0.12), rgba(55, 148, 255, 0.10));
    border: 1px solid var(--border);
    border-radius: 10px;
}

.site-footer-crm-text strong {
    display: block;
    color: var(--text-strong);
    font-size: 14px;
    font-weight: 650;
}

.site-footer-crm-text span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.site-footer-crm .ui-btn-primary,
.site-footer-crm .ui-btn-primary:hover { color: #ffffff; }

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

.ui-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    min-height: 36px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.ui-btn:hover { background: var(--surface-3); color: var(--text-strong); }
.ui-btn:disabled, .ui-btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.ui-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.ui-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #ffffff; }

.ui-btn-success {
    background: rgba(78, 201, 176, 0.16);
    border-color: rgba(78, 201, 176, 0.5);
    color: var(--success);
}

.ui-btn-success:hover { background: rgba(78, 201, 176, 0.26); color: var(--success); }

.ui-btn-danger {
    background: var(--danger-soft);
    border-color: rgba(244, 135, 113, 0.5);
    color: var(--danger);
}

.ui-btn-danger:hover { background: rgba(244, 135, 113, 0.24); color: var(--danger); }

.ui-btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.ui-btn-ghost:hover { color: var(--text-strong); border-color: var(--border-strong); }

.ui-btn-sm { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.ui-btn-block { width: 100%; }

/* ---------- Карточки ---------- */

.ui-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.ui-card + .ui-card { margin-top: 18px; }

.ui-card-h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 650;
    color: var(--text-strong);
}

.ui-card-h a { font-size: 12px; font-weight: 600; text-decoration: none; }

.ui-grid { display: grid; gap: 18px; }
.ui-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ui-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ui-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 860px) {
    .ui-grid-2, .ui-grid-3, .ui-grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Метрики ---------- */

.ui-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.ui-metric {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.ui-metric-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-strong);
    line-height: 1.2;
}

.ui-metric-label {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--faint);
}

.ui-metric.success { border-left-color: var(--success); }
.ui-metric.warning { border-left-color: var(--warning); }
.ui-metric.danger { border-left-color: var(--danger); }

/* ---------- Формы ---------- */

.ui-form { display: block; }

.ui-field { margin-bottom: 16px; }

.ui-field > label {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
}

.ui-field input[type="text"],
.ui-field input[type="email"],
.ui-field input[type="tel"],
.ui-field input[type="password"],
.ui-field input[type="number"],
.ui-field input[type="url"],
.ui-field input[type="file"],
.ui-field select,
.ui-field textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--text-strong);
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ui-field textarea { resize: vertical; min-height: 90px; }

.ui-field input:focus,
.ui-field select:focus,
.ui-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.ui-field input.error, .ui-field textarea.error, .ui-field select.error { border-color: var(--danger); }

.ui-field small, .ui-hint { display: block; margin-top: 5px; color: var(--faint); font-size: 12px; }

.ui-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    line-height: 1.5;
}

.ui-check input[type="checkbox"],
.ui-check input[type="radio"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--accent);
}

.ui-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 700px) { .ui-form-row { grid-template-columns: 1fr; } }

/* ---------- Уведомления ---------- */

.ui-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border-strong);
    border-left-width: 3px;
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
}

.ui-alert-success { border-left-color: var(--success); background: var(--success-soft); }
.ui-alert-error { border-left-color: var(--danger); background: var(--danger-soft); }
.ui-alert-warning { border-left-color: var(--warning); background: var(--warning-soft); }
.ui-alert-info { border-left-color: var(--accent); background: var(--accent-soft); }

/* ---------- Бейджи статусов ---------- */

.ui-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.ui-badge-new,
.ui-badge-payment_pending { color: var(--accent); border-color: rgba(55, 148, 255, 0.45); background: var(--accent-soft); }
.ui-badge-paid,
.ui-badge-completed,
.ui-badge-ready_pickup { color: var(--success); border-color: rgba(78, 201, 176, 0.45); background: var(--success-soft); }
.ui-badge-processing,
.ui-badge-preparing,
.ui-badge-shipped { color: var(--warning); border-color: rgba(220, 220, 170, 0.45); background: var(--warning-soft); }
.ui-badge-cancelled,
.ui-badge-rejected { color: var(--danger); border-color: rgba(244, 135, 113, 0.45); background: var(--danger-soft); }
.ui-badge-pending { color: var(--violet); border-color: rgba(197, 134, 192, 0.45); background: rgba(197, 134, 192, 0.14); }
.ui-badge-approved { color: var(--success); border-color: rgba(78, 201, 176, 0.45); background: var(--success-soft); }

/* ---------- Таблицы ---------- */

.ui-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

.ui-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ui-table th,
.ui-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.ui-table th {
    background: var(--surface-2);
    color: var(--faint);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.ui-table tr:last-child td { border-bottom: 0; }
.ui-table tbody tr:hover { background: var(--surface-2); }

/* ---------- Пустые состояния ---------- */

.ui-empty {
    padding: 44px 20px;
    text-align: center;
    color: var(--muted);
}

.ui-empty-icon { font-size: 40px; display: block; margin-bottom: 12px; opacity: 0.7; }
.ui-empty a { font-weight: 600; }

/* ---------- Личный кабинет ---------- */

.account-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.account-side {
    position: sticky;
    top: 84px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px;
}

.account-side-title {
    padding: 8px 10px 10px;
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.account-side a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.account-side a:hover { background: var(--surface-2); color: var(--text-strong); }
.account-side a.active { background: var(--accent-soft); color: var(--accent); }

.account-side .badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-grid;
    place-items: center;
}

.account-side-sep { border-top: 1px solid var(--border); margin: 6px 4px; }

@media (max-width: 860px) {
    .account-shell { grid-template-columns: 1fr; }
    .account-side { position: static; flex-direction: row; flex-wrap: wrap; }
    .account-side-title { display: none; }
}

.ui-list { list-style: none; margin: 0; padding: 0; }

.ui-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}

.ui-list li:last-child { border-bottom: 0; }

.ui-list-main { flex: 1; min-width: 0; }
.ui-list-title { color: var(--text-strong); font-weight: 600; font-size: 13.5px; }
.ui-list-meta { color: var(--faint); font-size: 12px; }
.ui-list-sum { color: var(--success); font-weight: 700; font-size: 13.5px; white-space: nowrap; }

/* ---------- Каталог и товары ---------- */

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

.product-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
}

.product-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.product-card-media {
    position: relative;
    height: 170px;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    background-size: cover;
    background-position: center;
    font-size: 42px;
    color: var(--border-strong);
}

.product-card .badge-type,
.product-card .badge-discount {
    position: absolute;
    top: 10px;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.product-card .badge-type { left: 10px; background: var(--accent); color: #fff; }
.product-card .badge-type.service { background: var(--violet); }
.product-card .badge-discount { right: 10px; background: var(--danger); color: #1e1e1e; }

.product-card-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; flex: 1; }

.product-card-cat { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }

.product-card-title {
    margin: 0;
    font-size: 14px;
    font-weight: 650;
    color: var(--text-strong);
    line-height: 1.35;
}

.product-card-title a { color: inherit; text-decoration: none; }
.product-card-title a:hover { color: var(--accent); }

.product-card-sku { color: var(--faint); font-family: Consolas, monospace; font-size: 11.5px; }

.product-card-desc {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
    margin: 0;
    flex: 1;
}

.product-card-price {
    margin-top: 4px;
    color: var(--text-strong);
    font-size: 18px;
    font-weight: 700;
}

.product-card-old {
    margin-left: 8px;
    color: var(--faint);
    font-size: 12.5px;
    font-weight: 400;
    text-decoration: line-through;
}

.product-card-crypto { color: var(--violet); font-size: 11.5px; font-family: Consolas, monospace; }

.product-card .ui-btn { margin-top: 6px; }

/* Форма-фолбэк «В корзину» (работает и без JavaScript). */
.product-card-form { margin: 0; }
.product-card-form .ui-btn { margin-top: 0; width: 100%; }

.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.cat-chip {
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
}

.cat-chip:hover { color: var(--text-strong); border-color: var(--border-strong); }
.cat-chip.active { background: var(--accent-soft); border-color: rgba(55, 148, 255, 0.5); color: var(--accent); }

.cat-subchips { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 18px; }
.cat-subchips .cat-chip { font-size: 12px; padding: 4px 10px; }

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 30px 0 16px;
    color: var(--text-strong);
    font-size: 15px;
    font-weight: 650;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ---------- Корзина / оформление ---------- */

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
    align-items: start;
}

@media (max-width: 900px) { .cart-layout { grid-template-columns: 1fr; } }

.cart-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 110px 130px 100px 34px;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

.cart-row:last-child { border-bottom: 0; }

.cart-row-media {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    font-size: 22px;
}

.cart-row-name { color: var(--text-strong); font-weight: 600; font-size: 13.5px; }
.cart-row-sku { color: var(--faint); font-size: 11.5px; font-family: Consolas, monospace; }
.cart-row-price { color: var(--text); font-weight: 600; font-size: 13.5px; }
.cart-row-price s { display: block; color: var(--faint); font-size: 11.5px; font-weight: 400; }
.cart-row-total { color: var(--text-strong); font-weight: 700; font-size: 14px; text-align: right; }

.cart-qty { display: inline-flex; align-items: center; gap: 4px; }

.cart-qty input {
    width: 48px;
    padding: 6px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    color: var(--text-strong);
    text-align: center;
    font-family: inherit;
    font-size: 13px;
}

.cart-qty .ui-btn { min-height: 28px; padding: 2px 8px; }

.cart-remove {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
}

.cart-remove:hover { border-color: var(--danger); color: var(--danger); }

.cart-summary { position: sticky; top: 84px; }

.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    color: var(--muted);
    font-size: 13px;
}

.summary-row.discount { color: var(--success); }

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--text-strong);
    font-size: 15px;
    font-weight: 650;
}

.summary-total strong { font-size: 22px; color: var(--success); }

.checkout-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
    align-items: start;
}

@media (max-width: 900px) { .checkout-layout { grid-template-columns: 1fr; } }

.payment-options { display: grid; gap: 8px; }

.payment-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.payment-option:hover { border-color: var(--border-strong); }

.payment-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.payment-option input { margin-top: 3px; accent-color: var(--accent); }
.payment-option-title { display: block; color: var(--text-strong); font-size: 13px; font-weight: 600; }
.payment-option-note { display: block; color: var(--faint); font-size: 11.5px; }

.pay-panel {
    display: none;
    margin-top: 12px;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.pay-panel.active { display: block; }

.pay-panel h4 { margin: 0 0 10px; font-size: 13px; color: var(--violet); }

.wallet-address {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-family: Consolas, monospace;
    font-size: 12px;
    color: var(--text);
    word-break: break-all;
}

.wallet-address .ui-btn { flex: 0 0 auto; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.72);
}

.modal.open { display: flex; }

.modal-dialog {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 22px;
}

.modal-dialog h2 { margin: 0 0 6px; font-size: 18px; }

/* ---------- Таймлайн статусов ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
    position: relative;
    padding: 0 0 16px 22px;
    border-left: 2px solid var(--border);
}

.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }

.timeline li::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 2px solid var(--border-strong);
}

.timeline li.done::before { background: var(--success); border-color: var(--success); }
.timeline-date { color: var(--faint); font-size: 11.5px; }
.timeline-title { color: var(--text-strong); font-size: 13px; font-weight: 600; }
.timeline-comment { color: var(--muted); font-size: 12px; }

/* ---------- Юридические страницы и CRM ---------- */

.legal-page { max-width: 820px; margin: 0 auto; }
.legal-page p { color: var(--muted); font-size: 13.5px; line-height: 1.7; }

/* Публичный лендинг продажи CRM. */
.crm-landing {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.crm-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(48px, 7vw, 88px) clamp(20px, 4vw, 48px);
    text-align: center;
    background:
        radial-gradient(120% 150% at 50% -20%, rgba(55, 148, 255, 0.22) 0%, rgba(55, 148, 255, 0) 58%),
        linear-gradient(160deg, var(--surface) 0%, var(--bg) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.crm-hero-glow {
    position: absolute;
    top: -180px;
    left: 50%;
    width: 520px;
    height: 520px;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(197, 134, 192, 0.18) 0%, rgba(197, 134, 192, 0) 68%);
    pointer-events: none;
}

.crm-hero-inner { position: relative; z-index: 1; }

.crm-hero h1 {
    max-width: 900px;
    margin: 0 auto 16px;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.08;
    letter-spacing: -0.02em;
}

.crm-hero-sub {
    max-width: 720px;
    margin: 0 auto;
    color: var(--muted);
    font-size: clamp(15px, 1.8vw, 18px);
    line-height: 1.6;
}

.crm-hero-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.crm-btn-lg {
    min-height: 50px;
    padding: 0 28px;
    border-radius: 10px;
    font-size: 15px;
}

.crm-hero-alert {
    max-width: 720px;
    margin: 24px auto 0;
    text-align: left;
}

.crm-features {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.crm-feature {
    padding: 24px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color 0.15s, transform 0.15s;
}

.crm-feature:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.crm-feature-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: 16px;
    border-radius: 11px;
    background: var(--accent-soft);
    border: 1px solid rgba(55, 148, 255, 0.35);
    color: var(--accent);
}

.crm-feature h3 {
    margin: 0 0 6px;
    font-size: 15px;
    color: var(--text-strong);
}

.crm-feature p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.crm-section-title {
    margin: 0 0 8px;
    text-align: center;
    font-size: clamp(22px, 3vw, 32px);
    letter-spacing: -0.01em;
}

.crm-section-sub {
    margin: 0 0 24px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.crm-modules {
    padding: clamp(20px, 3vw, 32px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.crm-about { margin-bottom: 20px; }
.crm-about:last-child { margin-bottom: 0; }

.crm-about p {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.75;
}

.crm-about p:last-child { margin-bottom: 0; }

.crm-check-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.crm-check-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.5;
}

.crm-check-list li::before {
    content: '✓';
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
    font-size: 12px;
    font-weight: 700;
}

.crm-cta-panel {
    padding: clamp(32px, 5vw, 56px) clamp(20px, 4vw, 48px);
    text-align: center;
    background:
        linear-gradient(135deg, rgba(55, 148, 255, 0.14), rgba(197, 134, 192, 0.12)),
        var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
}

.crm-cta-panel h2 {
    margin: 0 0 10px;
    font-size: clamp(22px, 3vw, 32px);
    letter-spacing: -0.01em;
}

.crm-cta-sub {
    max-width: 640px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.crm-contact-text {
    max-width: 680px;
    margin: 18px auto 0;
    color: var(--text);
    font-size: 14px;
    line-height: 1.65;
}

.crm-contacts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px 28px;
    flex-wrap: wrap;
    margin: 20px auto 4px;
    color: var(--muted);
    font-size: 14px;
}

.crm-contacts a {
    color: var(--text-strong);
    font-weight: 600;
    text-decoration: none;
}

.crm-contacts a:hover { color: var(--accent); }

.crm-cta-panel .crm-hero-actions { margin-top: 24px; }

.crm-cta-note {
    margin: 18px 0 0;
    color: var(--faint);
    font-size: 12px;
}

@media (max-width: 900px) {
    .crm-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .crm-features { grid-template-columns: 1fr; }
    .crm-check-list { grid-template-columns: 1fr; }
    .crm-btn-lg { width: 100%; }
    .crm-hero-actions { flex-direction: column; align-items: stretch; }
}

/* ---------- Авторизация ---------- */

.auth-wrap {
    max-width: 460px;
    margin: 48px auto;
    padding: 0 20px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
}

.auth-title { margin: 0 0 6px; font-size: 22px; text-align: center; }

.auth-sub {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    font-size: 12.5px;
}

.auth-links.center { justify-content: center; }

.auth-note {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12.5px;
    color: var(--faint);
}

/* ---------- Прочее ---------- */

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.nowrap { white-space: nowrap; }

.ui-details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 12px;
    list-style: none;
}
.ui-details summary::-webkit-details-marker { display: none; }
.ui-details summary::before { content: '▸ '; color: var(--faint); }
.ui-details[open] summary::before { content: '▾ '; }
.ui-details > div {
    margin-top: 6px;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 220px;
    overflow: auto;
}

@media (max-width: 720px) {
    .cart-row { grid-template-columns: 44px minmax(0, 1fr) 90px; row-gap: 10px; }
    .cart-row-total { grid-column: 2 / -1; text-align: left; }
    .cart-row .cart-remove { grid-column: 3; grid-row: 1; justify-self: end; }
}
/* ============================================================
   Стабильность публичной вёрстки: переполнения и мобильные
   ============================================================ */
img, video { max-width: 100%; height: auto; }
.site-profile-menu { max-width: calc(100vw - 24px); }
.wallet-address { max-width: 100%; }
.ui-btn, .site-nav a, .site-crm-cta { max-width: 100%; }
.ui-card, .ui-alert, .summary-row { overflow-wrap: anywhere; }
.site-footer-crm-text { min-width: 0; }

@media (max-width: 900px) {
    .site-header-inner { flex-wrap: wrap; gap: 10px 16px; }
    .site-nav { width: 100%; flex-wrap: wrap; justify-content: flex-start; gap: 6px; margin-left: 0; }
    .site-nav a { padding: 0 10px; }
}

@media (max-width: 640px) {
    .site-header-inner { padding: 10px 12px; gap: 8px; }
    .site-nav { gap: 6px; width: 100%; }
    .site-nav a { padding: 0 10px; min-height: 34px; }
    .site-profile-btn,
    .site-cart,
    .site-crm-cta { min-height: 34px; }
    .site-profile-menu { position: fixed; top: 64px; left: 12px; right: 12px; min-width: 0; }
    .wallet-address { flex-direction: column; align-items: stretch; }
    .wallet-address .ui-btn { width: 100%; }
    .site-footer { padding: 22px 14px 18px; }
    .site-footer-crm { padding: 14px; }
    .site-footer-links { gap: 10px 14px; }
    .checkout-layout { gap: 14px; }
    .pay-panel { padding: 12px; }
}

/* ============================================================
   Единая вертикальная сетка публичных страниц:
   карточки и кнопки не прилипают к краям и друг к другу.
   ============================================================ */

.site-container > * { min-width: 0; }

.ui-card + .ui-card,
.ui-grid + .ui-card,
.ui-card + .ui-grid,
.ui-grid + .ui-grid,
.ui-metrics + .ui-card,
.ui-alert + .ui-card,
.ui-alert + .ui-grid { margin-top: 18px; }

.site-page-head + .ui-card,
.site-page-head + .ui-grid,
.site-page-head + .ui-alert { margin-top: 0; }

.ui-card,
.ui-grid,
.ui-metrics,
.cart-row,
.product-card-body,
.ui-form-row { min-width: 0; }

/* Внутри сетки отступы задаёт gap, а не соседние карточки. */
.ui-grid > .ui-card,
.ui-grid > .ui-card + .ui-card,
.cart-layout > .ui-card + .ui-card,
.checkout-layout > .ui-card + .ui-card,
.product-grid > .ui-card + .ui-card,
.crm-features > .ui-card + .ui-card { margin-top: 0; }

@media (max-width: 640px) {
    .site-container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .ui-card { padding: 16px; }
    .ui-card-h { margin-bottom: 12px; padding-bottom: 10px; }

    .ui-grid,
    .product-grid { gap: 12px; }

    .ui-card + .ui-card,
    .ui-grid + .ui-card,
    .ui-card + .ui-grid,
    .ui-grid + .ui-grid,
    .ui-metrics + .ui-card,
    .ui-alert + .ui-card,
    .ui-alert + .ui-grid { margin-top: 12px; }

    .site-page-head { margin-bottom: 18px; gap: 12px; }
    .site-actions { gap: 8px; }
    .site-actions .ui-btn { flex: 1 1 auto; }
    .ui-alert { padding: 10px 12px; }

    .account-shell { gap: 14px; }
    .cart-layout { gap: 14px; }
    .section-title { margin: 22px 0 12px; }
    .cat-chips { margin-bottom: 16px; }
    .crm-landing { gap: 18px; }
}

/* ---------- Мои записи (личный кабинет клиента) ---------- */

.client-appointments { display: flex; flex-direction: column; }

.client-appointment {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.client-appointment:last-child { border-bottom: 0; }

.client-appointment-datetime {
    display: flex;
    flex: 0 0 82px;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}

.client-appointment-datetime strong { color: var(--text-strong); font-size: 17px; line-height: 1.2; }
.client-appointment-datetime span { color: var(--accent); font-size: 13px; font-weight: 700; }
.client-appointment-datetime small { color: var(--faint); font-size: 11px; text-transform: uppercase; }

.client-appointment-main { flex: 1; min-width: 0; }
.client-appointment-title { color: var(--text-strong); font-size: 14px; font-weight: 650; line-height: 1.35; }
.client-appointment-meta { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }

.appointment-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 3px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.appointment-status.status-new { color: #64b5ff; background: rgba(55, 148, 255, .14); border-color: rgba(55, 148, 255, .4); }
.appointment-status.status-confirmed { color: var(--violet); background: rgba(197, 134, 192, .14); border-color: rgba(197, 134, 192, .4); }
.appointment-status.status-arrived { color: var(--success); background: var(--success-soft); border-color: rgba(78, 201, 176, .4); }
.appointment-status.status-cancelled { color: var(--danger); background: var(--danger-soft); border-color: rgba(244, 135, 113, .4); }
.appointment-status.status-converted { color: var(--faint); background: var(--surface-3); border-color: var(--border); }

@media (max-width: 640px) {
    .client-appointment { flex-wrap: wrap; gap: 12px; padding: 14px; }
    .client-appointment-datetime { flex: 0 0 72px; }
    .client-appointment-main { flex: 1 1 150px; }
    .client-appointment .appointment-status { margin-left: 84px; }
}
