:root {
    --brand: #b2406b;
    --brand-2: #6d3fd1;
    --ink: #1f2430;
    --muted: #6b7280;
    --bg: #faf9fb;
    --card: #ffffff;
    --line: #e9e6ef;
    --ok: #16a34a;
    --warn: #d97706;
    --err: #dc2626;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(31, 36, 48, .08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: "Montserrat", -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- Лендинг ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.logo-mark {
    display: inline-grid; place-items: center;
    width: 30px; height: 30px; margin-right: 8px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff; border-radius: 9px; font-size: 16px; vertical-align: middle;
}
.logo-text { vertical-align: middle; }
.logo-dot { color: var(--brand); }
.main-nav { display: flex; gap: 22px; align-items: center; }
.main-nav a { font-size: 14px; font-weight: 600; color: #4b5563; }
.main-nav a:hover { color: var(--brand); }
.nav-admin { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 7px 13px; }
.nav-admin:hover { border-color: var(--brand); color: var(--brand); }

.nav-toggle {
    display: none;
    flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 42px; padding: 10px;
    background: none; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.nav-toggle span {
    display: block; height: 2px; width: 100%;
    background: var(--ink); border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.hero {
    background:
        radial-gradient(1000px 500px at 85% -10%, rgba(109,63,209,.18), transparent 60%),
        radial-gradient(800px 420px at -10% 10%, rgba(178,64,107,.16), transparent 55%),
        #fff;
    border-bottom: 1px solid var(--line);
    padding: 84px 0 72px;
}
.hero-inner { max-width: 760px; }
.hero h1 { font-size: 44px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
.hero h1 .grad { background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { margin-top: 18px; font-size: 18px; color: #4b5563; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.badge { font-size: 13px; font-weight: 600; color: #374151; background: #f3f0f8; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; }
.hero-cta { display: flex; gap: 14px; margin-top: 30px; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 14px 26px; border-radius: 12px; font-weight: 700; font-size: 15px;
    cursor: pointer; border: none; font-family: inherit; transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 12px 26px rgba(178,64,107,.28); }
.btn-ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }

.section { padding: 76px 0; }
.section-head { max-width: 680px; margin-bottom: 40px; }
.section-head h2 { font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.section-head p { color: var(--muted); margin-top: 10px; font-size: 16px; }
.kicker { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin-bottom: 10px; }

.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 14.5px; }
.card .icon {
    display: grid; place-items: center; width: 44px; height: 44px;
    border-radius: 12px; font-size: 21px; margin-bottom: 14px;
    background: #f6f2fb; color: var(--brand-2);
}
.check-list { list-style: none; display: grid; gap: 12px; }
.check-list li { position: relative; padding-left: 30px; font-size: 15px; color: #374151; }
.check-list li::before {
    content: "✓"; position: absolute; left: 0; top: 0;
    width: 20px; height: 20px; border-radius: 6px; background: #eaf7ee; color: var(--ok);
    display: grid; place-items: center; font-size: 12px; font-weight: 800;
}

.buy-section { background: linear-gradient(135deg, #b2406b 0%, #6d3fd1 100%); color: #fff; }
.buy-section .section-head p { color: rgba(255,255,255,.85); }
.buy-section .kicker { color: #fbd9e5; }
.buy-card {
    background: #fff; color: var(--ink); border-radius: 20px;
    max-width: 520px; margin: 0 auto; padding: 36px;
    box-shadow: 0 30px 70px rgba(0,0,0,.28);
}
.buy-card h3 { font-size: 22px; font-weight: 800; }
.price { font-size: 36px; font-weight: 800; color: var(--brand); margin: 10px 0 2px; }
.term { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.buy-card label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 14px; color: #374151; }
.buy-card input {
    width: 100%; margin-top: 6px; padding: 12px 14px;
    border: 1.5px solid #e5e7eb; border-radius: 10px; font-size: 15px; font-family: inherit; outline: none;
}
.buy-card input:focus { border-color: var(--brand); }
.buy-card .hint { font-size: 12px; color: #9ca3af; margin-top: 5px; font-weight: 400; }
.buy-card button { width: 100%; margin-top: 10px; }
.error {
    background: #fee2e2; color: #b91c1c; border-radius: 10px;
    padding: 10px 14px; font-size: 13.5px; margin-bottom: 18px;
}
.foot-note { text-align: center; margin-top: 18px; font-size: 12px; color: #9ca3af; }

.tariffs { display: grid; gap: 10px; margin-bottom: 20px; }
.tariff-option {
    display: flex; align-items: center; gap: 12px;
    border: 1.5px solid var(--line); border-radius: 12px;
    padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s;
}
.tariff-option:hover { border-color: #c9b8e8; }
.tariff-option.selected { border-color: var(--brand); background: #fdf5f9; }
.tariff-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.t-radio {
    width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
    border: 2px solid #cbd5e1; display: inline-block; position: relative;
}
.tariff-option.selected .t-radio { border-color: var(--brand); }
.tariff-option.selected .t-radio::after {
    content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--brand);
}
.t-body { flex: 1; display: flex; flex-direction: column; }
.t-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.t-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.t-price { font-weight: 800; font-size: 17px; color: var(--brand); white-space: nowrap; }

.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 40px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }

/* ---------- Демо-доступ ---------- */
.demo-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.demo-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
    transition: border-color .15s, transform .12s;
}
.demo-card:hover { border-color: var(--brand); transform: translateY(-3px); }
.demo-card .icon { font-size: 26px; }
.demo-card h3 { font-size: 18px; font-weight: 700; }
.demo-card p { color: var(--muted); font-size: 14.5px; }
.demo-card code {
    font-family: ui-monospace, "Cascadia Code", monospace; background: #f3f0f8;
    border-radius: 6px; padding: 2px 7px; color: var(--ink); font-weight: 600;
}
.demo-cta { font-weight: 700; color: var(--brand); font-size: 14.5px; }
.demo-note { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- Мини-чат ---------- */
.chat-fab {
    position: fixed; right: 20px; bottom: 20px; z-index: 60;
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff; font-size: 24px; border: none; cursor: pointer;
    box-shadow: 0 10px 26px rgba(178, 64, 107, .35);
    display: grid; place-items: center;
    transition: transform .15s;
}
.chat-fab:hover { transform: scale(1.06); }
.chat-widget {
    position: fixed; right: 20px; bottom: 88px; z-index: 60;
    width: 340px; max-width: calc(100vw - 40px);
    background: #fff; border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 20px 50px rgba(31, 36, 48, .25);
    overflow: hidden;
}
.chat-widget[hidden] { display: none; }
.chat-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
}
.chat-head strong { font-size: 15px; }
.chat-close { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; line-height: 1; }
.chat-body { padding: 16px; }
.chat-hint { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.chat-body label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; color: #374151; }
.chat-body input, .chat-body textarea {
    width: 100%; margin-top: 6px; padding: 11px 13px;
    border: 1.5px solid #e5e7eb; border-radius: 10px;
    font-size: 14px; font-family: inherit; outline: none;
}
.chat-body input:focus, .chat-body textarea:focus { border-color: var(--brand); }
.chat-body textarea { resize: vertical; min-height: 70px; }
.chat-body .btn { width: 100%; }
.chat-status { font-size: 13px; margin-top: 10px; text-align: center; }
.chat-status.ok { color: var(--ok); }
.chat-status.err { color: var(--err); }

.chat-messages {
    max-height: 240px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 8px;
    margin-bottom: 12px; min-height: 40px;
}
.chat-msg { max-width: 85%; display: flex; }
.chat-msg span {
    padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45;
    white-space: pre-wrap; word-break: break-word;
}
.chat-msg.me { align-self: flex-end; }
.chat-msg.me span {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff; border-bottom-right-radius: 4px;
}
.chat-msg.them { align-self: flex-start; }
.chat-msg.them span { background: #f1eef6; color: var(--ink); border-bottom-left-radius: 4px; }
.chat-msg.system { align-self: center; max-width: 100%; }
.chat-msg.system span {
    background: transparent; color: var(--muted);
    font-size: 12.5px; padding: 2px 6px;
}
.chat-close-session {
    display: block; margin: 10px auto 0;
    background: none; border: none; cursor: pointer;
    color: var(--muted); font-size: 12.5px; text-decoration: underline; font-family: inherit;
}
.chat-close-session:hover { color: var(--err); }
.chat-send-row { display: flex; gap: 8px; }
.chat-send-row input { flex: 1; min-width: 0; }
.chat-send-row button {
    width: 44px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
    border: none; border-radius: 10px; font-size: 18px; cursor: pointer;
}
.chat-send-row button:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Админка ---------- */
.admin-body { background: #f4f2f7; }
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px; flex-shrink: 0; background: #1f2430; color: #cfd6e4;
    display: flex; flex-direction: column; padding: 20px 14px;
}
.admin-logo { font-size: 18px; font-weight: 800; color: #fff; padding: 6px 12px 22px; }
.admin-logo .logo-mark { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav a {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px;
    border-radius: 10px; font-size: 14px; font-weight: 600; color: #cfd6e4;
}
.admin-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-nav a.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.admin-sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.admin-sidebar-foot a { padding: 10px 12px; border-radius: 10px; font-size: 13.5px; color: #cfd6e4; }
.admin-sidebar-foot a:hover { background: rgba(255,255,255,.07); }
.admin-main { flex: 1; padding: 28px 32px; max-width: 1200px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.admin-head h1 { font-size: 24px; font-weight: 800; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat .num { font-size: 28px; font-weight: 800; }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #faf8fc; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; }
tr:last-child td { border-bottom: none; }
code.key {
    font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12px;
    background: #f3f0f8; border-radius: 6px; padding: 3px 7px; word-break: break-all;
}
.pill { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 11px; white-space: nowrap; }
.pill.paid { background: #eaf7ee; color: var(--ok); }
.pill.revoked, .pill.expired { background: #fee2e2; color: var(--err); }
.pill.pending { background: #f3f4f6; color: #6b7280; }
.pill.canceled { background: #fef3c7; color: var(--warn); }
.mini-btn {
    font-size: 12.5px; font-weight: 700; border: none; border-radius: 8px;
    padding: 7px 12px; cursor: pointer; font-family: inherit; transition: filter .12s;
}
.mini-btn:hover { filter: brightness(1.06); }
.mini-btn.danger { background: #fee2e2; color: var(--err); }
.mini-btn.ok { background: #eaf7ee; color: var(--ok); }
.muted { color: var(--muted); font-size: 12.5px; }

/* Формы в карточках админки (создание лицензий, тарифы) */
.card label { font-size: 13px; font-weight: 600; color: #374151; }
.card input, .card select {
    width: 100%; margin-top: 6px; padding: 11px 13px;
    border: 1.5px solid #e5e7eb; border-radius: 10px;
    font-size: 14px; font-family: inherit; outline: none; background: #fff;
}
.card input:focus, .card select:focus { border-color: var(--brand); }
.card input[type="checkbox"] { width: auto; margin-top: 0; }

/* Пагинация */
.pagination { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination span {
    display: inline-grid; place-items: center; min-width: 34px; height: 34px;
    padding: 0 8px; border-radius: 9px; font-size: 14px; font-weight: 600;
    border: 1px solid var(--line); color: #374151; background: #fff;
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination a.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }
.pagination span { color: var(--muted); border-color: transparent; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #b2406b 0%, #6d3fd1 100%); }
.login-card { background: #fff; border-radius: 18px; padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: 0 30px 70px rgba(0,0,0,.28); }
.login-card h1 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 14px; color: #374151; }
.login-card input {
    width: 100%; margin-top: 6px; padding: 12px 14px;
    border: 1.5px solid #e5e7eb; border-radius: 10px; font-size: 15px; font-family: inherit; outline: none;
}
.login-card input:focus { border-color: var(--brand); }
.login-card button { width: 100%; margin-top: 6px; }
.update-bar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; box-shadow: var(--shadow); }
.update-bar .info { font-size: 13px; color: var(--muted); }

@media (max-width: 900px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .demo-cards { grid-template-columns: 1fr; }
    .hero h1 { font-size: 32px; }
    .hero-cta { justify-content: center; }
    .hero-badges { justify-content: center; }
    .header-inner { flex-wrap: wrap; height: auto; padding-top: 16px; padding-bottom: 16px; }
    .nav-toggle { display: flex; margin-left: auto; }
    .main-nav {
        display: none; flex-basis: 100%; flex-direction: column;
        gap: 0; padding-top: 8px;
    }
    .main-nav.open { display: flex; }
    .main-nav a { padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
    .main-nav .nav-admin { border: none; padding: 12px 2px; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .admin-nav { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 560px) {
    .grid-3 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr; }
    .hero { padding: 56px 0 48px; }
    .hero h1 { font-size: 28px; }
}
