/* ZELLIX — личный кабинет */
:root{
  --brand-950:#1B0B33;--brand-900:#2A0F52;--brand-800:#361168;--brand-700:#4B1D8F;
  --brand-600:#5B21B6;--brand-500:#7C3AED;--brand-400:#9F67F5;--brand-300:#C4B5FD;
  --brand-100:#EFE7FF;--brand-50:#F7F2FF;--lav:#F4EEFF;--lav-2:#E9DFFB;
  --ink:#17121F;--ink-2:#3D3648;--muted:#6C6579;--muted-2:#6B6478;
  --bg:#F6F4FB;--white:#fff;--line:#E9E3F4;--line-2:#DED5EE;
  --green:#12A66A;--red:#E5484D;--amber:#F5A524;
  --font:'Manrope','Segoe UI',system-ui,-apple-system,sans-serif;
  --shadow-sm:0 1px 2px rgba(30,10,60,.06);
  --shadow-md:0 14px 34px -16px rgba(45,15,90,.22);
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;font-family:var(--font);background:var(--bg);color:var(--ink);font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased}
h1,h2,h3,h4{margin:0;line-height:1.2;letter-spacing:-.02em}
p{margin:0}
a{color:var(--brand-600);text-decoration:none}
button{font-family:inherit}
.mono{font-family:'Cascadia Code',Consolas,monospace}

/* ─── Оболочка ────────────────────────────────────────────────────────── */
.app-shell{display:grid;grid-template-columns:256px 1fr;min-height:100vh}
.sidebar{background:#fff;border-right:1px solid var(--line);padding:22px 16px;display:flex;flex-direction:column;position:sticky;top:0;height:100vh;z-index:20}
.sb-logo{display:flex;align-items:center;gap:10px;padding:0 8px 22px;border-bottom:1px solid var(--line);margin-bottom:18px}
.sb-logo b{font-size:17px;letter-spacing:.04em}
.sb-logo span{display:block;font-size:9px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted-2);margin-top:2px}
.sb-nav{display:flex;flex-direction:column;gap:3px;flex:1}
.sb-nav a{display:flex;align-items:center;gap:10px;padding:11px 12px;border-radius:11px;font-size:14px;font-weight:600;color:var(--ink-2)}
.sb-nav a:hover{background:var(--brand-50);color:var(--brand-700)}
.sb-nav a.is-active{background:var(--brand-100);color:var(--brand-800)}
.sb-nav svg{width:18px;height:18px;flex:none;opacity:.8}
.sb-nav .sb-label{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--muted-2);padding:16px 12px 6px}
.sb-user{border-top:1px solid var(--line);padding-top:14px;font-size:12.5px;color:var(--muted)}
.sb-user b{display:block;color:var(--ink);font-size:13.5px;word-break:break-word}
.sb-user form{margin-top:10px}
.sb-user button{width:100%;border:1px solid var(--line-2);background:#fff;border-radius:9px;padding:8px;font-size:12.5px;font-weight:600;cursor:pointer;color:var(--muted)}
.sb-user button:hover{border-color:var(--brand-300);color:var(--brand-700)}

.app-main{padding:28px 38px 60px;min-width:0}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:26px;flex-wrap:wrap}
.topbar h1{font-size:25px}
.topbar p{font-size:13px;color:var(--muted);margin-top:4px}
.top-actions{display:flex;gap:10px;flex-wrap:wrap}

/* ─── Компоненты ──────────────────────────────────────────────────────── */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;border:1.5px solid transparent;border-radius:999px;font-weight:700;font-size:13.5px;padding:10px 18px;cursor:pointer;transition:.15s;white-space:nowrap;text-decoration:none}
.btn-primary{background:linear-gradient(135deg,var(--brand-600),var(--brand-700));color:#fff;box-shadow:0 10px 24px -10px rgba(75,29,143,.5)}
.btn-primary:hover{color:#fff;transform:translateY(-1px)}
.btn-outline{background:#fff;border-color:var(--line-2);color:var(--ink)}
.btn-outline:hover{border-color:var(--brand-400);color:var(--brand-700)}
.btn-ghost{background:transparent;color:var(--muted)}
.btn-ghost:hover{background:var(--brand-50);color:var(--brand-700)}
.btn-sm{padding:7px 13px;font-size:12px}
.btn-block{width:100%}
.btn:disabled{opacity:.55;cursor:default;transform:none}

.badge{display:inline-flex;align-items:center;gap:5px;font-size:11px;font-weight:800;padding:4px 9px;border-radius:999px;text-transform:uppercase;letter-spacing:.04em}
.badge-green{background:#E7F9F0;color:#0B7A4B}
.badge-red{background:#FDECEC;color:#B42318}
.badge-amber{background:#FFF6E5;color:#8A5300}
.badge-purple{background:var(--brand-100);color:var(--brand-800)}

.stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:20px}
.stat-card{background:#fff;border:1px solid var(--line);border-radius:16px;padding:18px 20px}
.stat-card .lbl{font-size:11.5px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted-2);margin-bottom:8px}
.stat-card .val{font-size:26px;font-weight:800;letter-spacing:-.03em;line-height:1.1}
.stat-card .sub{font-size:11.5px;color:var(--muted);margin-top:4px}
.stat-card.is-alert .val{color:var(--red)}

.panel{background:#fff;border:1px solid var(--line);border-radius:18px;padding:22px;margin-bottom:18px}
.panel-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:16px;flex-wrap:wrap}
.panel-head h2{font-size:17px}
.panel-head p{font-size:12.5px;color:var(--muted);margin-top:3px}
.panel-hint{font-size:12.5px;color:var(--muted);line-height:1.6}

.progress{height:8px;background:var(--lav);border-radius:99px;overflow:hidden;margin:10px 0 6px}
.progress i{display:block;height:100%;background:linear-gradient(90deg,var(--brand-500),var(--brand-700));border-radius:99px;transition:width .4s}
.progress.is-full i{background:linear-gradient(90deg,#F5A524,#E5484D)}

.banner{display:flex;align-items:center;gap:14px;flex-wrap:wrap;border-radius:16px;padding:16px 20px;margin-bottom:20px;font-size:13.5px;border:1px solid}
.banner b{font-weight:800}
.banner .spacer{flex:1}
.banner-warn{background:#FFF9EC;border-color:#FFE2A8;color:#7A4A00}
.banner-danger{background:#FEF1F1;border-color:#F8C9C9;color:#8F1D1D}
.banner-ok{background:#EDFAF4;border-color:#B9EBD5;color:#0B6B44}

.two-col{display:grid;grid-template-columns:1.35fr .65fr;gap:18px;align-items:start}
.two-col > *{min-width:0}
.three-col{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}
.three-col > *{min-width:0}

/* ─── Формы ───────────────────────────────────────────────────────────── */
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.field{margin-bottom:14px}
.field.full{grid-column:1/-1}
.field label{display:block;font-size:12.5px;font-weight:700;margin-bottom:6px}
.field .hint{font-size:11.5px;color:var(--muted-2);margin-top:5px;line-height:1.45}
.field input,.field select,.field textarea{width:100%;border:1.5px solid var(--line-2);background:#FBFAFE;border-radius:10px;padding:10px 13px;font-family:inherit;font-size:13.5px;color:var(--ink);outline:none}
.field textarea{resize:vertical;line-height:1.5}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--brand-500);background:#fff;box-shadow:0 0 0 3px rgba(124,58,237,.1)}
.field input[type=color]{padding:4px;height:42px;width:72px;cursor:pointer}

/* ─── Таблицы ─────────────────────────────────────────────────────────── */
.table-wrap{overflow-x:auto}
table.tbl{width:100%;border-collapse:collapse;font-size:13px}
table.tbl th{text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted-2);padding:9px 12px;border-bottom:1px solid var(--line);white-space:nowrap}
table.tbl td{padding:11px 12px;border-bottom:1px solid var(--line);vertical-align:middle}
table.tbl tr:last-child td{border-bottom:0}
.empty{padding:30px;text-align:center;color:var(--muted-2);font-size:13px}

/* ─── Тарифы в кабинете ───────────────────────────────────────────────── */
.plan-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.plan-card{border:1.5px solid var(--line);border-radius:14px;padding:16px;background:#fff;position:relative;display:flex;flex-direction:column}
.plan-card.is-current{border-color:var(--brand-500);background:var(--brand-50)}
.plan-card h3{font-size:15px;margin-bottom:4px}
.plan-card .price{font-size:21px;font-weight:800;letter-spacing:-.02em;margin:8px 0 2px}
.plan-card .price span{font-size:11.5px;font-weight:600;color:var(--muted)}
.plan-card ul{list-style:none;margin:10px 0 14px;padding:0;font-size:11.8px;color:var(--muted);display:flex;flex-direction:column;gap:5px;flex:1}
.plan-card li::before{content:'✓ ';color:var(--brand-500);font-weight:800}
.plan-card .btn{width:100%}
.current-mark{font-size:9.5px;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:var(--brand-700);margin-bottom:4px}

/* ─── Установка ───────────────────────────────────────────────────────── */
.code-block{position:relative;background:var(--brand-950);color:#D8CCF5;border-radius:12px;padding:44px 18px 16px;font-family:'Cascadia Code',Consolas,monospace;font-size:12.5px;line-height:1.65;overflow-x:auto;white-space:pre;max-width:100%}
.copy-btn{position:absolute;top:10px;right:10px;background:rgba(255,255,255,.12);border:0;color:#fff;font-size:11px;font-weight:700;padding:5px 10px;border-radius:7px;cursor:pointer}
.copy-btn:hover{background:rgba(255,255,255,.22)}
.key-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:var(--bg);border:1px dashed var(--line-2);border-radius:10px;padding:11px 14px;font-family:'Cascadia Code',Consolas,monospace;font-size:12.5px;margin-bottom:12px}
.key-row .mono{word-break:break-all;max-width:100%}
.key-row b{font-family:var(--font);font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted-2);font-weight:700}

/* ─── Тестовый чат ────────────────────────────────────────────────────── */
.test-chat{border:1px solid var(--line);border-radius:16px;overflow:hidden;background:#fff}
.test-chat-head{display:flex;align-items:center;gap:9px;padding:11px 14px;background:linear-gradient(135deg,var(--brand-900),var(--brand-700));color:#fff;font-size:13px;font-weight:700}
.test-chat-head i{width:7px;height:7px;border-radius:50%;background:#4ADE80;display:inline-block}
.test-chat-body{height:260px;overflow-y:auto;padding:13px;display:flex;flex-direction:column;gap:8px;background:#FBFAFE}
.test-chat-body .msg{max-width:88%;font-size:12.8px;line-height:1.45;padding:9px 12px;border-radius:13px}
.test-chat-body .msg.user{align-self:flex-end;background:linear-gradient(135deg,var(--brand-600),var(--brand-700));color:#fff;border-bottom-right-radius:4px}
.test-chat-body .msg.bot{align-self:flex-start;background:var(--lav);border-bottom-left-radius:4px}
.test-chat-form{display:flex;gap:7px;padding:10px;border-top:1px solid var(--line)}
.test-chat-form input{flex:1;border:1px solid var(--line-2);border-radius:999px;padding:9px 13px;font-family:inherit;font-size:12.5px;outline:none}
.test-chat-form input:focus{border-color:var(--brand-400)}
.test-chat-form button{width:38px;height:38px;border:0;border-radius:50%;background:var(--brand-600);color:#fff;cursor:pointer;font-size:15px}

/* ─── Диалоги ─────────────────────────────────────────────────────────── */
.dlg-list{display:flex;flex-direction:column;gap:10px}
.dlg{background:#fff;border:1px solid var(--line);border-radius:13px;overflow:hidden}
.dlg summary{padding:13px 16px;cursor:pointer;display:flex;justify-content:space-between;gap:12px;font-size:13px;font-weight:600;list-style:none}
.dlg summary::-webkit-details-marker{display:none}
.dlg summary span{font-weight:500;color:var(--muted);font-size:12px}
.dlg-body{padding:0 16px 16px;display:flex;flex-direction:column;gap:7px;border-top:1px solid var(--line);padding-top:12px}
.dlg-msg{font-size:12.5px;line-height:1.5;padding:8px 11px;border-radius:10px;max-width:85%}
.dlg-msg.user{align-self:flex-end;background:var(--lav)}
.dlg-msg.assistant{align-self:flex-start;background:var(--bg)}
.dlg-msg b{display:block;font-size:9.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted-2);margin-bottom:2px}

/* ─── Оплата ──────────────────────────────────────────────────────────── */
.pay-box{background:linear-gradient(160deg,var(--brand-950),var(--brand-800));color:#fff;border-radius:18px;padding:24px}
.pay-box h3{font-size:16px;margin-bottom:4px}
.pay-box p{font-size:12px;color:rgba(255,255,255,.6);margin-bottom:13px}
.pay-box .field label{color:rgba(255,255,255,.7)}
.pay-box .field input{background:rgba(255,255,255,.1);border-color:rgba(255,255,255,.2);color:#fff}
.pay-box .field input::placeholder{color:rgba(255,255,255,.4)}
.pay-box .field input:focus{border-color:var(--brand-300);box-shadow:none}
.pay-total{display:flex;justify-content:space-between;align-items:baseline;padding:12px 0;border-top:1px solid rgba(255,255,255,.15);margin-top:6px}
.pay-total span{font-size:12px;color:rgba(255,255,255,.65)}
.pay-total b{font-size:22px;font-weight:800}
.demo-note{font-size:10.5px;color:rgba(255,255,255,.45);margin-top:10px;text-align:center}
.pay-ok{background:#EAFBF3;border:1px solid #B9EBD5;color:#0B7A4B;border-radius:10px;padding:11px 13px;font-size:12.5px;font-weight:600;margin-top:10px}

/* ─── Авторизация ─────────────────────────────────────────────────────── */
.auth-page{min-height:100vh;display:grid;grid-template-columns:1fr 1fr}
.auth-side{background:linear-gradient(150deg,var(--brand-950),var(--brand-700) 70%,var(--brand-500));color:#fff;padding:48px;display:flex;flex-direction:column;justify-content:space-between;position:relative;overflow:hidden}
.auth-side:after{content:'';position:absolute;width:420px;height:420px;border-radius:50%;background:rgba(196,181,253,.25);filter:blur(70px);right:-120px;bottom:-120px}
.auth-side h2{font-size:30px;max-width:420px;position:relative;z-index:1}
.auth-side p{color:rgba(255,255,255,.65);font-size:14px;margin-top:12px;max-width:380px;position:relative;z-index:1}
.auth-side ul{list-style:none;padding:0;margin:26px 0 0;display:flex;flex-direction:column;gap:10px;position:relative;z-index:1}
.auth-side li{font-size:13.5px;color:rgba(255,255,255,.85);padding-left:22px;position:relative}
.auth-side li:before{content:'✓';position:absolute;left:0;color:var(--brand-300);font-weight:800}
.auth-form-wrap{display:flex;align-items:center;justify-content:center;padding:40px 24px}
.auth-card{width:100%;max-width:400px}
.auth-card .logo{display:flex;align-items:center;gap:10px;margin-bottom:28px}
.auth-card .logo b{font-size:18px;letter-spacing:.04em}
.auth-card h1{font-size:27px;margin-bottom:6px}
.auth-card .sub{font-size:13px;color:var(--muted);margin-bottom:22px}
.auth-tabs{display:flex;background:var(--bg);border-radius:11px;padding:4px;margin-bottom:22px}
.auth-tabs a{flex:1;text-align:center;padding:8px;border-radius:8px;font-size:13px;font-weight:700;color:var(--muted)}
.auth-tabs a.is-active{background:#fff;color:var(--brand-800);box-shadow:var(--shadow-sm)}
.auth-error{background:#FDECEC;border:1px solid #F8C9C9;color:#B42318;border-radius:10px;padding:10px 12px;font-size:12.5px;margin-bottom:14px}
.auth-note{font-size:11px;color:var(--muted-2);text-align:center;margin-top:14px}
.auth-links{font-size:12.5px;color:var(--muted);display:flex;justify-content:space-between;margin-top:8px}

/* ─── Админка ─────────────────────────────────────────────────────────── */
.admin-grid{display:grid;grid-template-columns:340px 1fr;gap:18px;align-items:start}
.mini-stat{display:flex;gap:10px;flex-wrap:wrap}
.mini-stat div{background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px 16px;min-width:120px}
.mini-stat b{display:block;font-size:20px;font-weight:800}
.mini-stat span{font-size:11px;color:var(--muted)}
.inline-form{display:inline}
.toast{position:fixed;right:20px;bottom:20px;background:var(--brand-950);color:#fff;border-radius:12px;padding:12px 18px;font-size:13px;font-weight:600;box-shadow:var(--shadow-md);opacity:0;transform:translateY(10px);transition:.2s;z-index:100}
.toast.show{opacity:1;transform:none}

/* ─── Кастомизация ассистента ─────────────────────────────────────────── */
.form-section{margin-top:24px;padding-top:20px;border-top:1px solid var(--line)}
.form-section h3{font-size:15px;margin-bottom:4px}
.color-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.swatches{display:flex;gap:6px;flex-wrap:wrap}
.swatches button{width:24px;height:24px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px var(--line-2);cursor:pointer;background:var(--c);padding:0}
.swatches button.is-active{box-shadow:0 0 0 2px var(--brand-600)}
.avatar-picker{display:flex;gap:14px;align-items:flex-start}
.avatar-preview{width:64px;height:64px;border-radius:18px;background:linear-gradient(135deg,#5B21B6,#3B0F73);color:#fff;display:grid;place-items:center;font-weight:800;font-size:24px;overflow:hidden;flex:none;box-shadow:var(--shadow-sm)}
.avatar-preview img{width:100%;height:100%;object-fit:cover;display:block}
.avatar-side{flex:1;min-width:0}
.seg{display:inline-flex;background:var(--bg);border-radius:9px;padding:3px;gap:2px}
.seg button{border:0;background:transparent;padding:6px 10px;font-size:11.5px;font-weight:700;border-radius:7px;cursor:pointer;color:var(--muted);font-family:inherit}
.seg button.is-active{background:#fff;color:var(--brand-800);box-shadow:var(--shadow-sm)}
.avatar-presets{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.avatar-presets button{width:44px;height:44px;border-radius:50%;border:2px solid transparent;padding:0;overflow:hidden;cursor:pointer;background:#eee}
.avatar-presets button.is-active{border-color:var(--brand-500)}
.avatar-presets img{width:100%;height:100%;object-fit:cover;display:block}
.avatar-upload{margin-top:10px}
.avatar-upload input[type=file]{font-size:11.5px;max-width:100%}
.theme-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.theme-card{position:relative;cursor:pointer}
.theme-card input{position:absolute;opacity:0;pointer-events:none}
.theme-thumb{display:block;border:1.5px solid var(--line);border-radius:10px;height:64px;background:#fff;position:relative;overflow:hidden}
.theme-thumb .t-head{position:absolute;left:0;right:0;top:0;height:17px;background:#4B1D8F}
.theme-thumb .t-bot{position:absolute;left:6px;top:25px;width:60%;height:9px;border-radius:5px;background:#EFE7FF}
.theme-thumb .t-user{position:absolute;right:6px;top:40px;width:45%;height:9px;border-radius:5px;background:#5B21B6}
.theme-card b{display:block;font-size:10.5px;margin-top:5px;text-align:center;font-weight:700}
.theme-card input:checked + .theme-thumb{box-shadow:0 0 0 2px var(--brand-500);border-color:transparent}
.theme-soft .t-head{background:#F3ECFF}
.theme-dark{background:#150B28}
.theme-dark .t-head{background:#0F0720}
.theme-dark .t-bot{background:#2A1A4A}
.theme-dark .t-user{background:#7C3AED}
.theme-minimal .t-head{background:#fff;border-bottom:1px solid #E9E3F4}
.theme-minimal .t-bot{background:#F4F4F6}
.theme-minimal .t-user{background:#17121F}
.switch{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:700}
.switch input{width:16px;height:16px;accent-color:var(--brand-600)}
.contact-opts{display:flex;gap:16px;margin-top:8px;flex-wrap:wrap}
.check{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;color:var(--ink-2)}
.check input{accent-color:var(--brand-600)}
.test-chat-ava{width:26px;height:26px;border-radius:9px;background:rgba(255,255,255,.18);display:grid;place-items:center;font-size:12px;font-weight:800;overflow:hidden;flex:none}
.test-chat-ava img{width:100%;height:100%;object-fit:cover;display:block}
.test-chat-foot{padding:8px 12px 10px;text-align:center;font-size:10.5px;color:var(--muted);border-top:1px solid var(--line);background:#FBFAFE}
.test-chat-consent{padding:8px 12px 0;font-size:10.5px;line-height:1.4;color:var(--muted)}
.test-chat-consent[hidden]{display:none}
.test-chat.pv-theme-dark{background:#150B28}
.test-chat.pv-theme-dark .test-chat-body{background:#150B28}
.test-chat.pv-theme-dark .test-chat-body .msg.bot{background:#241640;color:#EDE7FA}
.test-chat.pv-theme-dark .test-chat-foot{background:#150B28;color:#8F84A8;border-color:#33224F}
.test-chat.pv-theme-dark .test-chat-consent{color:#A79BC0}
.test-chat.pv-theme-minimal .test-chat-body{background:#fff}
.test-chat.pv-theme-minimal .test-chat-body .msg.bot{background:#F4F4F6;color:#17121F}
.test-chat.pv-theme-soft .test-chat-body{background:#FBF8FF}

@media(max-width:1050px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{position:static;height:auto;flex-direction:row;align-items:center;padding:12px 16px;gap:14px;overflow-x:auto}
  .sb-logo{padding:0 10px 0 0;border:0;margin:0;flex:none}
  .sb-nav{flex-direction:row;gap:2px;flex:none}
  .sb-nav .sb-label{display:none}
  .sb-nav a{white-space:nowrap;padding:9px 11px}
  .sb-user{border:0;padding:0;display:flex;align-items:center;gap:10px;flex:none;margin-left:auto}
  .sb-user b{font-size:12px}
  .sb-user form{margin:0}
  .sb-user button{width:auto;padding:6px 10px}
  .app-main{padding:22px 20px 50px}
  .stat-grid{grid-template-columns:repeat(2,1fr)}
  .two-col{grid-template-columns:1fr}
  .plan-grid{grid-template-columns:repeat(2,1fr)}
  .auth-page{grid-template-columns:1fr}
  .auth-side{display:none}
  .admin-grid{grid-template-columns:1fr}
}
@media(max-width:600px){
  .stat-grid{grid-template-columns:1fr 1fr}
  .form-grid{grid-template-columns:1fr}
  .plan-grid{grid-template-columns:1fr}
  .three-col{grid-template-columns:1fr}
  .topbar h1{font-size:21px}
  .app-main{padding:18px 14px 40px}
}
