/* MVP v1.0 — минимальный аккуратный стиль (без усложнений) */

:root{
  --border:#E5E7EB;
  --text:#111827;
  --muted:#6B7280;
  --bg:#F6F7FB;
  --card:#FFFFFF;
  --accent:#2563EB;
  --accentHover:#1D4ED8;
  --success:#16A34A;
  --danger:#DC2626;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

button, input, select{
  font: inherit;
}

hr{
  border:none;
  border-top:1px solid #eee;
  margin:12px 0;
}

#app-root{ padding:0; }

.k-wrap{
  display:flex;
  gap:16px;
  align-items:flex-start;
}

.k-left{
  width:280px;
  border:1px solid var(--border);
  background:var(--card);
  border-radius:12px;
  padding:12px;
}

.k-left h3{
  margin:0 0 10px 0;
  font-size:16px;
}

.k-btnrow{
  display:flex;
  gap:8px;
}

.k-btn{
  padding:10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#fff;
  cursor:pointer;
}
.k-btn:hover{ filter:brightness(0.98); }

.k-btn-primary{
  border:1px solid #111;
  background:#111;
  color:#fff;
}

.k-btn-danger{
  border:1px solid var(--danger);
  background:#fff;
  color:var(--danger);
}
.k-btn-danger:hover{ filter:brightness(0.98); }

/* link-like small action */
.k-link{
  background:transparent;
  border:none;
  padding:0;
  color:var(--accent);
  cursor:pointer;
  text-decoration:underline;
  font-size:14px;
}

.k-icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  border:none;
  background:transparent;
  padding:6px;
  border-radius:10px;
  cursor:pointer;
}
.k-icon-btn:hover{ background:rgba(17,24,39,0.06); }
.k-icon-danger{ color:#dc2626; background:rgba(220,38,38,0.06); border:1px solid rgba(220,38,38,0.22); }
.k-icon-danger:hover{ background:rgba(220,38,38,0.12); }
.k-icon-btn svg{ fill:currentColor; }
.k-link:hover{ filter:brightness(0.95); }

.k-main{
  flex:1;
  min-width:560px;
}

.k-top{
  border:1px solid var(--border);
  background:var(--card);
  border-radius:12px;
  padding:12px;
  margin-bottom:12px;
}

.k-topgrid{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:end;
}

.k-field label{
  display:block;
  font-size:12px;
  color:#555;
  margin-bottom:4px;
}

.k-field input, .k-field select{
  padding:8px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#fff;
}

.k-field input[type="text"]{ width:100%; }

.k-actions{
  margin-left:auto;
  display:flex;
  gap:8px;
}

.k-sheet{
  border:1px solid var(--border);
  background:var(--card);
  border-radius:12px;
  padding:14px;
}

.k-sheet-header{
  border-bottom:1px solid #eee;
  padding-bottom:10px;
  margin-bottom:10px;
}

.k-empty{
  color:var(--muted);
  padding:12px;
}

.ws-block{
  border:1px solid var(--border);
  border-radius:10px;
  padding:10px;
  background:#fff;
}

.ws-block-top{
  display:flex;
  gap:8px;
  align-items:flex-start;
  margin-bottom:6px;
}

.ws-title{
  flex:1;
  font-weight:800;
  font-size:16px;
  outline:none;
}

.ws-instruction{
  font-size:13px;
  color:#333;
  margin-bottom:8px;
  outline:none;
}

.ws-table{
  width:100%;
  border-collapse:collapse;
  table-layout:fixed;
}

.ws-table th, .ws-table td{
  border:1px solid #000;
  padding:6px;
  vertical-align:top;
}

.ws-table th{
  font-weight:800;
}

.ws-line{
  border-bottom:1px solid #000;
  height:18px;
}

.ws-lines{
  margin-top:6px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.ws-checks{
  list-style:none;
  padding:0;
  margin:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.ws-check{
  display:flex;
  gap:8px;
  align-items:flex-start;
}

.ws-checkbox{
  width:14px;
  height:14px;
  border:1px solid #000;
  margin-top:3px;
  flex:0 0 auto;
}

.ws-section{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.ws-label{
  font-weight:800;
  outline:none;
}

.ws-boxarea{
  border:1px solid #000;
  width:100%;
  min-height:80px;
}

.k-brand{display:flex;align-items:center;gap:10px;padding:10px 12px;margin-bottom:12px;}
.k-logo{width:34px;height:34px;border-radius:10px;border:1px solid #111;display:flex;align-items:center;justify-content:center;font-weight:900;}
.k-brand-title{font-weight:900;font-size:16px;line-height:1.1;}
.k-brand-sub{color:var(--muted);font-size:12px;margin-top:2px;}
.k-beta{font-size:11px;padding:2px 6px;border:1px solid var(--border);border-radius:999px;margin-left:6px;font-weight:700;}
.k-help{font-size:12px;color:#333;}
.k-help-title{font-weight:800;margin-bottom:6px;}
.k-help-list{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:6px;color:#333;}
.k-input{padding:8px;border-radius:10px;border:1px solid var(--border);background:#fff;}

.ws-row-controls{
  display:flex;
  gap:8px;
  align-items:center;
  margin: 8px 0 10px 0;
}
.k-btn-small{padding:6px 10px;font-size:14px;border-radius:12px;}
.ws-row-hint{font-size:13px;color:var(--muted);}
.ws-image-preview{
  width:100%;
  max-height:320px;
  object-fit:contain;
  border:1px solid #000;
  border-radius:10px;
  margin-top:10px;
}

.ws-textarea{
  padding:10px;
  border:0;
  background:transparent;
  min-height:44px;
  font-size:16px;
  line-height:1.35;
  outline:none;
}

/* Crossword block */
.cw-wrap{display:flex;flex-direction:column;gap:10px}
.cw-help{font-size:13px;color:var(--muted)}
.cw-input{width:100%;min-height:130px;resize:vertical;border:1px solid #000;border-radius:12px;padding:10px;font-size:14px;line-height:1.35;background:#fff}
.cw-preview{overflow:auto;border:1px solid #000;border-radius:12px;padding:10px;background:#fff}
.cw-grid{border-collapse:collapse;margin:0 auto}
.cw-cell{width:22px;height:22px;border:1px solid #000;position:relative;background:#fff}
.cw-empty{background:#f3f3f3;border-color:#e0e0e0}
.cw-num{position:absolute;top:1px;left:2px;font-size:10px;line-height:1;color:#000}
.cw-lists{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.cw-coltitle{font-weight:600;margin-bottom:6px}
.cw-col ol{margin:0;padding-left:18px}
.cw-col li{margin:0 0 4px 0;font-size:14px}
.cw-msg{font-size:13px;color:var(--muted)}

.cw-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.cw-bglabel{font-size:13px;color:var(--muted)}
.cw-select{border:1px solid #000;border-radius:10px;padding:8px 10px;background:#fff;font-size:14px}
.cw-generate{white-space:nowrap}
.cw-imgwrap{display:flex;align-items:flex-start;gap:8px;justify-content:center}
.cw-previewimg{max-width:100%;height:auto;border:1px solid #000;border-radius:10px;background:#fff}
.cw-trash{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:10px;border:1px solid #ffb3b3;background:#fff;color:#d11a2a;cursor:pointer}
.cw-trash:hover{background:#fff0f0}

@media (max-width: 640px){
  .cw-lists{grid-template-columns:1fr}
  .cw-cell{width:20px;height:20px}
}

@media (max-width: 900px){
  .app{
    grid-template-columns: 1fr;
  }
  .sidebar{
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg);
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .blocks-list{
    display:flex;
    gap:10px;
    overflow-x:auto;
    padding-bottom: 8px;
  }
  .blocks-list .block-item{
    min-width: 220px;
    flex: 0 0 auto;
  }
  .main{
    padding: 12px;
  }
  .topbar{
    flex-wrap: wrap;
    gap: 10px;
  }
  .topbar .k-btn{
    flex: 1 1 auto;
  }
  .worksheet{
    padding: 12px;
  }
}
@media (max-width: 480px){
  .blocks-list .block-item{ min-width: 200px; }
  .worksheet-title{ font-size: 22px; }
}

html, body { max-width: 100%; overflow-x: hidden; }
img { max-width: 100%; height: auto; }
.ws-table{ width:100%; table-layout: fixed; }
.ws-table th, .ws-table td{ word-break: break-word; }

@media (max-width: 900px){
  .app{ grid-template-columns: 1fr !important; }
  .sidebar{ border-right:0 !important; border-bottom:1px solid var(--border) !important; }
  .blocks-list{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .blocks-list .block-item{ min-width: 170px !important; max-width: 85vw !important; }
  .k-input{ min-width: 0 !important; width: 100% !important; }
}

.ws-list-controls{display:flex;gap:8px;align-items:center;margin:8px 0 10px 0;}

/* --- Responsive (safe overrides) v2.2 --- */
html, body { max-width:100%; overflow-x:hidden; }
@media (max-width: 900px){
  #app-root{ padding:10px; }
  .k-wrap{ flex-direction:column; gap:10px; }
  .k-left{ width:auto; position:static; }
  .k-main{ min-width:0; width:100%; }
  .k-topgrid{ flex-direction:column; }
  .k-field{ width:100% !important; min-width:0 !important; }
  .k-actions{ width:100%; display:flex; gap:10px; }
  .k-actions .k-btn{ flex:1; }
  .worksheet{ padding:12px; }
  .ws-table{ width:100%; table-layout:fixed; }
  .ws-table th, .ws-table td{ word-break:break-word; }
}

/* Next-prep: support/feedback buttons */
.k-btn-accent{ border:1px solid var(--border); background:#fff; font-weight:700; }
.k-actions{ display:flex; flex-wrap:wrap; gap:10px; }

/* DOCX interstitial */
.docx-interstitial{
  position:fixed; inset:0; background:#fff;
  z-index:9999; display:flex; flex-direction:column;
  align-items:center; justify-content:flex-start;
  padding:22px 14px; overflow:auto;
}
.docx-card{

  width:min(720px, 100%); border:1px solid var(--border); border-radius:16px;
  background:#fff; padding:18px; box-shadow:0 10px 30px rgba(0,0,0,0.08);
}
.docx-title{ font-size:20px; font-weight:800; margin:0 0 8px 0; }
.docx-timer{ font-size:44px; font-weight:900; letter-spacing:1px; margin:10px 0; }
.docx-sub{ color:var(--muted); margin:0 0 12px 0; }
.docx-link{ font-weight:800; }
.docx-ad{
  width:min(960px, 100%);
  margin-top:18px;
  padding-top:10px;
}


/* v0.2 header actions */
.k-topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:12px;}
.k-topbar .k-brand{margin-bottom:0;}
.k-top-actions{display:flex;gap:8px;flex-wrap:wrap;}

/* Mobile: keep header buttons usable */
@media (max-width: 640px){
  .k-top-actions{width:100%;}
  .k-top-actions .k-btn{flex:1;min-width:140px;}
}

.k-logo svg{width:18px;height:18px;}

/* Footer */
.k-footer{
  border-top:1px solid rgba(0,0,0,0.08);
  padding:14px 16px;
  font-size:13px;
  color:rgba(0,0,0,0.65);
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
}
.k-footer-links{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}
.k-footer a{ color:inherit; text-decoration:none; }
.k-footer a:hover{ text-decoration:underline; }

/* Top actions: keep on one line on desktop, wrap nicely on mobile */
.k-top-actions{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
@media (max-width: 520px){
  .k-top-actions{ justify-content:flex-start; }
  .k-top-actions .k-btn{ flex:1 1 auto; }
}

/* Footer (simple, below content) */
.k-footer{
  border-top:1px solid rgba(0,0,0,0.08);
  margin-top:24px;
  padding:16px 12px;
  text-align:center;
  font-size:13px;
  color:rgba(0,0,0,0.65);
}
.k-footer-inner{
  max-width:900px;
  margin:0 auto;
}
.k-footer-links{
  margin-top:6px;
}
.k-footer a{
  color:inherit;
  text-decoration:none;
}
.k-footer a:hover{
  text-decoration:underline;
}

/* Footer override (centered, no layout impact) */
.k-footer{ display:block !important; text-align:center !important; }
.k-footer-links{ justify-content:center !important; }

/* Bottom footer (non-intrusive) */
.k-footer{
  margin-top: 32px;
  padding: 16px 8px 24px;
  text-align: center;
  font-size: 14px;
  color: #666;
}
.k-footer-links{
  margin-top: 6px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
@media (max-width: 640px){
  .k-footer{
    font-size: 13px;
    padding-bottom: 16px;
  }
}

/* Ensure original layout width */
.k-app, .k-main, .k-layout {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}


/* AI button in blocks */



/* --- AI modal --- */
.ai-modal.hidden{display:none;}
.ai-modal{position:fixed;inset:0;z-index:9999;}
.ai-modal__backdrop{position:absolute;inset:0;background:rgba(0,0,0,.45);}
.ai-modal__panel{position:relative;margin:24px auto;max-width:720px;width:calc(100% - 24px);background:#fff;border-radius:14px;box-shadow:0 12px 40px rgba(0,0,0,.22);overflow:hidden;}
.ai-modal__header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid #eee;}
.ai-modal__title{font-weight:700;}
.ai-modal__close{border:none;background:transparent;font-size:22px;line-height:1;cursor:pointer;padding:4px 8px;border-radius:10px;}
.ai-modal__close:hover{background:rgba(0,0,0,.06);}
.ai-modal__body{padding:12px 16px;}
.ai-modal__hint{font-size:13px;color:#333;margin-bottom:10px;}
.ai-modal__preview{max-height:52vh;overflow:auto;background:#fafafa;border:1px solid #eee;border-radius:12px;padding:12px;font-size:12px;white-space:pre-wrap;}
.ai-modal__note{margin-top:8px;font-size:12px;color:#555;}
.ai-modal__footer{display:flex;gap:10px;justify-content:flex-end;padding:12px 16px;border-top:1px solid #eee;}
@media (max-width:520px){
  .ai-modal__panel{margin:12px auto;}
  .ai-modal__preview{max-height:56vh;}
}



/* ===== Wizard UI (v2) ===== */

.k-shell{min-height:100vh; display:flex; flex-direction:column;}
.k-container{width:100%; max-width:1280px; margin:0 auto; padding:16px 20px;}
.k-header{background:rgba(255,255,255,.9); backdrop-filter:saturate(120%) blur(8px); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:50;}
.k-header__inner{display:flex; align-items:center; justify-content:space-between; gap:14px;}
.k-brand{display:flex; align-items:center; gap:12px; margin:0; padding:0;}
.k-logo{width:32px; height:32px; border-radius:10px; background:rgba(37,99,235,.10); color:var(--accent); display:flex; align-items:center; justify-content:center; border:1px solid rgba(37,99,235,.18);}
.k-logo svg{width:18px; height:18px;}
.k-brandtext{display:flex; flex-direction:column; gap:2px;}
.k-brandtitle{font-weight:900; font-size:16px; line-height:1.1; color:var(--text);}
.k-brandsub{font-size:12px; color:var(--muted); line-height:1.25;}
.k-badge{display:inline-flex; align-items:center; padding:2px 8px; margin-left:8px; border-radius:999px; font-size:11px; font-weight:800; color:var(--accent); background:rgba(37,99,235,.12); border:1px solid rgba(37,99,235,.18); vertical-align:middle;}

.k-save{font-size:12px; color:var(--muted); padding:6px 10px; border-radius:999px; background:rgba(17,24,39,.04); border:1px solid rgba(17,24,39,.06);}
.k-save--saving{color:var(--accent); background:rgba(37,99,235,.10); border-color:rgba(37,99,235,.18);}

.k-mainwrap{flex:1;}
.k-steps{margin:16px 0 14px 0;}
.k-stepsrow{display:flex; align-items:center; gap:10px; flex-wrap:wrap;}
.k-stepline{flex:1; height:1px; background:var(--border); min-width:24px; opacity:.9;}
.k-stepbtn{display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:14px; border:1px solid var(--border); background:#fff; cursor:pointer; transition:transform .06s ease, border-color .12s ease, background .12s ease;}
.k-stepbtn:hover{transform:translateY(-1px); border-color:rgba(37,99,235,.25);}
.k-stepbtn--active{border-color:rgba(37,99,235,.35); box-shadow:0 6px 18px rgba(17,24,39,.06);}
.k-stepbtn--disabled{opacity:.55; cursor:not-allowed;}
.k-stepnum{width:26px; height:26px; border-radius:999px; display:flex; align-items:center; justify-content:center; font-weight:900; background:rgba(17,24,39,.06); color:var(--text);}
.k-stepbtn--active .k-stepnum{background:rgba(37,99,235,.12); color:var(--accent);}
.k-steptitle{font-weight:800; font-size:13px; color:var(--text);}

.k-step{padding-bottom:28px;}

.k-card{border:1px solid var(--border); background:var(--card); border-radius:18px; padding:16px; box-shadow:0 10px 30px rgba(17,24,39,.06);}
.k-cardtitle{font-weight:900; font-size:16px; margin:0 0 12px 0;}
.k-grid{display:grid; grid-template-columns:repeat(12, 1fr); gap:12px;}
.k-field{grid-column:span 3;}
.k-field--wide{grid-column:span 6;}
.k-field label{display:block; font-size:12px; color:var(--muted); margin:0 0 6px 0;}
.k-field input, .k-field select{width:100%; padding:10px 12px; border-radius:12px; border:1px solid var(--border); background:#fff;}
.k-field input:focus, .k-field select:focus{outline:none; border-color:rgba(37,99,235,.4); box-shadow:0 0 0 3px rgba(37,99,235,.10);}

.k-alert{margin-top:12px; border-radius:14px; padding:10px 12px; font-size:13px; line-height:1.35;}
.k-alert--muted{background:rgba(17,24,39,.04); border:1px solid rgba(17,24,39,.06); color:var(--muted);}

.k-nav{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:14px;}
.k-nav--split{justify-content:space-between;}

.k-btn{padding:10px 12px; border-radius:12px; border:1px solid var(--border); background:#fff; cursor:pointer;}
.k-btn:hover{border-color:rgba(37,99,235,.25);}
.k-btn-primary{border-color:rgba(37,99,235,.45); background:var(--accent); color:#fff;}
.k-btn-primary:hover{background:var(--accentHover); border-color:rgba(37,99,235,.55);}

.k-builder{display:grid; grid-template-columns:360px 1fr; gap:14px; align-items:start;}
.k-side{position:sticky; top:92px; align-self:start;}
.k-sidecard{border:1px solid var(--border); background:var(--card); border-radius:18px; padding:14px; box-shadow:0 10px 30px rgba(17,24,39,.06);}
.k-sidehead{margin-bottom:10px;}
.k-side-title{font-weight:900; font-size:14px;}
.k-side-sub{font-size:12px; color:var(--muted); margin-top:2px;}
.k-blockbuttons{display:flex; flex-direction:column; gap:8px;}
.k-helpmini{margin-top:12px;}
.k-helpmini-title{font-weight:900; font-size:13px; margin-bottom:6px;}
.k-helpmini-list{margin:0; padding-left:18px; display:flex; flex-direction:column; gap:6px; color:var(--muted); font-size:12px;}

.k-work{min-width:0;}
.k-workcard{border:1px solid var(--border); background:var(--card); border-radius:18px; padding:14px; box-shadow:0 10px 30px rgba(17,24,39,.06);}
.k-blocklist{display:flex; flex-direction:column; gap:10px;}

.k-summary{display:flex; flex-direction:column; gap:8px; margin:10px 0 6px 0;}
.k-summaryrow{display:flex; gap:10px; align-items:baseline;}
.k-slabel{min-width:110px; color:var(--muted); font-size:12px;}
.k-svalue{font-weight:800; font-size:13px; color:var(--text);}

@media (max-width: 980px){
  .k-builder{grid-template-columns:1fr;}
  .k-side{position:static;}
  .k-field{grid-column:span 6;}
  .k-field--wide{grid-column:span 12;}
}
@media (max-width: 560px){
  .k-container{padding:14px 14px;}
  .k-field{grid-column:span 12;}
}

/* Уменьшаем контраст рамок блоков на экране (печать/Docx не затрагиваем) */
.ws-block{border-radius:14px; background:#fff; box-shadow:0 8px 22px rgba(17,24,39,.06);}
.ws-block-top .k-btn{padding:8px 10px; border-radius:10px;}

/* Подсказки и ограничения */
.k-hint{
  font-size:13px;
  color:#6B7280;
  background:#F3F4F6;
  border:1px solid #E5E7EB;
  padding:10px 12px;
  border-radius:14px;
  line-height:1.35;
  margin-bottom:10px;
}


/* required mark + label hint link */
.k-req{
  color: var(--danger);
  font-weight: 700;
}
.k-label-hint{
  margin-left: 10px;
  font-size: 13px;
  color: var(--accent);
  text-decoration: underline;
  font-weight: 500;
}
.k-label-hint:hover{ color: var(--accentHover); }


.ws-sheet-headerbar{position:relative;}
.ws-sheet-new{position:absolute; right:0; top:0;}


.k-hstack{display:flex;gap:10px;justify-content:flex-end;align-items:center;}


/* UI tweaks fix42 */
.k-brand{ text-decoration:none; }
.k-brand:hover .k-brandtitle{ text-decoration:none; }
.k-save{cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center;}
.k-save:hover{ text-decoration:none; }
.k-btn-accent{border-color:rgba(217,119,6,.35); background:#f59e0b; color:#111827;}
.k-btn-accent:hover{background:#d97706; color:#fff; border-color:rgba(217,119,6,.45);}
.k-btn-fill{border-color:rgba(22,163,74,.35); background:#16a34a; color:#fff;}
.k-btn-fill:hover{background:#15803d; border-color:rgba(21,128,61,.45);}
.k-helpmini{display:none !important;}


/* UI tweaks fix43 */
.k-save{color:var(--accent); background:rgba(37,99,235,.12); border-color:rgba(37,99,235,.18); font-weight:700;}
.k-save:hover{background:rgba(37,99,235,.18); text-decoration:none;}
.k-btn-accent{border-color:rgba(22,163,74,.32); background:#22c55e; color:#ffffff;}
.k-btn-accent:hover{background:#16a34a; color:#fff; border-color:rgba(21,128,61,.42);}
.ws-sheet-headerbar{position:relative;}
.ws-sheet-topline{display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:8px; flex-wrap:wrap;}
.ws-sheet-title{text-align:center; font-weight:800; font-size:18px; outline:none; flex:1 1 280px; min-width:0;}
.ws-sheet-new{position:static; flex:0 0 auto;}
@media (max-width: 980px){
  .k-header__inner{align-items:flex-start; flex-wrap:wrap;}
  .k-save{margin-left:auto;}
}
@media (max-width: 640px){
  .k-container{padding:12px;}
  .k-header__inner{gap:10px;}
  .k-brand{gap:10px; align-items:flex-start; flex:1 1 100%; min-width:0;}
  .k-brandtext{min-width:0;}
  .k-brandtitle{font-size:15px; line-height:1.15; word-break:break-word;}
  .k-brandsub{font-size:11px;}
  .k-save{padding:6px 10px; font-size:12px;}
  .k-stepsrow{gap:8px;}
  .k-stepbtn{width:100%; justify-content:flex-start;}
  .k-stepline{display:none;}
  .k-nav{flex-wrap:wrap;}
  .k-nav .k-btn{flex:1 1 calc(50% - 6px); min-width:120px;}
  .ws-block-top{flex-wrap:wrap; gap:8px;}
  .ws-block-top .ws-title{width:100%; margin-right:0;}
  .ws-sheet-topline{align-items:stretch;}
  .ws-sheet-title{flex-basis:100%; text-align:left; margin-bottom:0;}
  .ws-sheet-new{align-self:flex-start;}
}
@media (max-width: 420px){
  .k-nav .k-btn{flex:1 1 100%;}
  .k-hstack{justify-content:stretch;}
  .k-hstack .k-btn{width:100%;}
  .ws-sheet-new{width:100%;}
}


.k-tabs{
  display:flex;
  gap:6px;
  margin-bottom:10px;
}

.k-tab{
  padding:8px 14px;
  border:1px solid #d0d7de;
  background:#f5f7fb;
  cursor:pointer;
  border-radius:8px;
  font:inherit;
}

.k-tab.active{
  background:#2f6df6;
  color:#fff;
  border-color:#2f6df6;
}

.k-tab-panel{
  margin-top:8px;
}

.cookie-banner{
  position:fixed;
  left:20px;
  bottom:20px;
  z-index:9999;
  max-width:520px;
  background:#f3f4f6;
  color:#5a667d;
  border-radius:28px;
  padding:26px 24px 20px;
  box-shadow:0 10px 28px rgba(0,0,0,.12);
}

.cookie-banner__text p{
  margin:0 0 18px 0;
  font-size:18px;
  line-height:1.45;
}

.cookie-banner__btn{
  border:0;
  border-radius:18px;
  background:#3f6be8;
  color:#fff;
  font-size:18px;
  font-weight:600;
  padding:14px 24px;
  cursor:pointer;
}

.cookie-banner__btn:hover,
.cookie-banner__btn:focus{
  opacity:.95;
}

@media (max-width:640px){
  .cookie-banner{
    left:12px;
    right:12px;
    bottom:12px;
    max-width:none;
    border-radius:22px;
    padding:20px 18px 18px;
  }

  .cookie-banner__text p{
    font-size:16px;
    margin-bottom:14px;
  }

  .cookie-banner__btn{
    font-size:17px;
    padding:12px 20px;
  }
}


/* --- AI chat --- */
.k-ai-chat-shell{
  background: linear-gradient(180deg, #101427 0%, #11162b 100%);
  border: 1px solid #222946;
  border-radius: 22px;
  padding: 18px;
  color: #eef2ff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.k-ai-chat-topbar{
  display:flex;
  justify-content:space-between;
  gap:16px;
  color:#c5cbe0;
  font-size:14px;
  margin-bottom:14px;
}
.k-ai-chat-feed{
  min-height:360px;
  max-height:520px;
  overflow:auto;
  padding:4px 0 10px;
}
.k-ai-empty{
  display:flex;
  align-items:flex-end;
  gap:14px;
  padding:20px 8px 8px;
}
.k-ai-badge{
  width:42px;
  height:42px;
  border-radius:14px;
  background:#f08a00;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  font-size:22px;
  box-shadow:0 10px 25px rgba(240,138,0,.2);
  flex:0 0 auto;
}
.k-ai-empty-bubble{
  background:#f08a00;
  color:#fff;
  border-radius:18px;
  padding:16px 20px;
  min-width:260px;
  max-width:70%;
  box-shadow:0 10px 25px rgba(240,138,0,.18);
}
.k-ai-empty-title{
  font-size:16px;
  line-height:1.4;
}
.k-ai-msg{
  max-width:78%;
  border-radius:20px;
  padding:14px 18px;
  margin:0 0 14px 0;
  box-shadow:0 8px 24px rgba(0,0,0,.16);
}
.k-ai-msg--assistant{
  background:#171d33;
  border:1px solid #262f52;
  color:#f2f5ff;
}
.k-ai-msg--user{
  background:#cddaf0;
  border:1px solid #9fb6eb;
  color:#18253f;
  margin-left:auto;
}
.k-ai-msg__title{
  font-weight:700;
  margin-bottom:8px;
}
.k-ai-msg__body{
  line-height:1.55;
  white-space:normal;
  word-break:break-word;
}
.k-ai-msg-files{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-bottom:10px;
}
.k-ai-filetag{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  background:rgba(255,255,255,.08);
  color:inherit;
  font-size:12px;
}
.k-ai-attachments{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:8px 0 12px;
}
.k-ai-attach-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  background:#1a2140;
  border:1px solid #2a335a;
  color:#dce3ff;
  font-size:12px;
}
.k-ai-attach-chip__del{
  border:0;
  background:transparent;
  color:#dce3ff;
  cursor:pointer;
  font-size:16px;
  line-height:1;
  padding:0;
}
.k-ai-chat-inputbar{
  display:flex;
  align-items:center;
  gap:12px;
  border-radius:20px;
  background:#0b0f1f;
  border:1px solid #262f52;
  padding:12px 14px;
}
.k-ai-attach-btn,
.k-ai-send-btn{
  width:52px;
  height:52px;
  border:0;
  border-radius:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:transform .15s ease, opacity .15s ease;
}
.k-ai-attach-btn{
  background:transparent;
  color:#cfd6ef;
  flex:0 0 auto;
}
.k-ai-attach-btn svg{
  width:26px;
  height:26px;
}
.k-ai-send-btn{
  background:#3f46c7;
  color:#fff;
  box-shadow:0 10px 24px rgba(63,70,199,.28);
  flex:0 0 auto;
}
.k-ai-send-btn svg{
  width:26px;
  height:26px;
  margin-left:2px;
}
.k-ai-chat-input{
  flex:1 1 auto;
  min-height:52px;
  max-height:120px;
  resize:vertical;
  border:0;
  background:transparent;
  color:#f2f5ff;
  font:inherit;
  line-height:1.45;
  outline:none;
}
.k-ai-chat-input::placeholder{
  color:#8892b8;
}
.k-ai-attach-btn:hover,
.k-ai-send-btn:hover{
  transform:translateY(-1px);
}
.k-ai-attach-btn:disabled,
.k-ai-send-btn:disabled{
  opacity:.6;
  cursor:default;
  transform:none;
}
.k-ai-chat-shell.is-loading .k-ai-chat-feed{
  opacity:.96;
}
@media (max-width: 760px){
  .k-ai-chat-shell{
    padding:14px;
    border-radius:18px;
  }
  .k-ai-chat-topbar{
    flex-direction:column;
    gap:6px;
  }
  .k-ai-chat-feed{
    min-height:300px;
  }
  .k-ai-msg{
    max-width:90%;
  }
  .k-ai-chat-inputbar{
    gap:8px;
    padding:10px 12px;
  }
  .k-ai-attach-btn,
  .k-ai-send-btn{
    width:46px;
    height:46px;
    border-radius:16px;
  }
}


/* =========================
   РЕКЛАМНЫЙ БЛОК В ШАПКЕ
   ========================= */
.k-header__inner{
  display:flex;
  align-items:center;
  gap:16px;
}
.k-brand{
  flex:0 0 auto;
}
.k-admin-ad-slot{
  flex:1 1 auto;
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  min-height:44px;
}
.k-admin-ad-slot:empty{
  display:none;
}
.k-admin-ad-slot > *{
  max-width:100%;
}
.k-admin-ad-slot a{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:10px 16px;
  border-radius:12px;
  background:#eef4ff;
  border:1px solid #cfe0ff;
  color:#1f3b8f;
  font-weight:600;
  font-size:13px;
  line-height:1.3;
  text-decoration:none;
  max-width:420px;
  width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  transition:all .15s ease;
  box-sizing:border-box;
}
.k-admin-ad-slot a:hover{
  background:#e0ecff;
  border-color:#b6d0ff;
}
.k-admin-ad-slot--saving{
  opacity:.98;
}
@media (max-width: 900px){
  .k-header__inner{
    flex-direction:column;
    align-items:stretch;
  }
  .k-admin-ad-slot{
    width:100%;
    justify-content:stretch;
  }
  .k-admin-ad-slot a{
    max-width:100%;
  }
}



/* Финальная правка рекламного слота: без рамки, без сжатия баннера, без визуального изменения шапки */
.k-admin-ad-slot{
  flex:1 1 auto;
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  min-height:0;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  padding:0 !important;
}

.k-admin-ad-slot:empty{
  display:none;
}

.k-admin-ad-slot > *{
  max-width:100%;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}

.k-admin-ad-slot a{
  display:block;
  width:auto !important;
  max-width:100% !important;
  padding:0 !important;
  margin:0 !important;
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  box-shadow:none !important;
  overflow:visible !important;
  white-space:normal !important;
  text-overflow:clip !important;
  line-height:normal;
}

.k-admin-ad-slot img,
.k-admin-ad-slot iframe,
.k-admin-ad-slot svg,
.k-admin-ad-slot canvas{
  max-width:100%;
  height:auto;
  display:block;
  border:0;
}

.k-admin-ad-slot--saving{
  opacity:1 !important;
}

@media (max-width: 900px){
  .k-admin-ad-slot{
    width:100%;
    justify-content:flex-start;
  }
}



/* Финальная балансировка шапки: логотип и заголовок крупнее, баннер компактнее */
.k-header .k-container.k-header__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:28px;
  padding-top:18px;
  padding-bottom:18px;
}

.k-brand{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:16px;
  min-width:0;
}

.k-logo{
  width:48px;
  height:48px;
  border-radius:14px;
}

.k-logo svg{
  width:24px;
  height:24px;
}

.k-brandtitle{
  font-size:18px;
  line-height:1.15;
}

.k-brandsub{
  font-size:13px;
  line-height:1.35;
}

.k-admin-ad-slot{
  flex:0 1 520px;
  width:min(520px, 36vw);
  min-width:320px;
  margin-left:auto;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  min-height:0;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  padding:0 !important;
}

.k-admin-ad-slot > *{
  width:100%;
  max-width:100%;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}

.k-admin-ad-slot a,
.k-admin-ad-slot iframe,
.k-admin-ad-slot img{
  display:block;
  width:100% !important;
  max-width:100% !important;
  height:auto;
  margin:0;
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  box-shadow:none !important;
}

@media (max-width: 1100px){
  .k-header .k-container.k-header__inner{
    gap:18px;
  }

  .k-admin-ad-slot{
    flex-basis:420px;
    width:min(420px, 34vw);
    min-width:260px;
  }

  .k-brandtitle{
    font-size:17px;
  }
}

@media (max-width: 900px){
  .k-header .k-container.k-header__inner{
    flex-direction:column;
    align-items:stretch;
    gap:14px;
  }

  .k-brand{
    width:100%;
  }

  .k-admin-ad-slot{
    width:100%;
    min-width:0;
    flex:0 0 auto;
    justify-content:flex-start;
  }
}


/* Рекламный блок над футером */

.k-ai-chat-note{margin-top:8px;padding:0 4px;font-size:12px;line-height:1.4;color:rgba(255,255,255,0.65);} 



/* ===== Верхнее меню под названием, баннер справа ===== */
.k-header .k-container.k-header__inner{
  align-items:flex-start;
}

.k-brandwrap{
  flex:1 1 auto;
  min-width:0;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:10px;
}

.k-brand{
  max-width:100%;
}

.k-topmenu{
  width:100%;
}

.k-topmenu__desktop{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}

.k-topmenu__link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.28);
  background:#ffffff;
  color:#334155;
  text-decoration:none;
  font-size:13px;
  font-weight:600;
  line-height:1;
  transition:background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
  box-shadow:0 2px 8px rgba(15,23,42,.04);
}

.k-topmenu__link:hover,
.k-topmenu__link:focus{
  background:#f8fafc;
  border-color:rgba(37,99,235,.22);
  color:#2563eb;
  transform:translateY(-1px);
  box-shadow:0 5px 14px rgba(15,23,42,.08);
}

.k-topmenu__mobile{
  display:none;
  width:100%;
  max-width:240px;
  border:1px solid rgba(148,163,184,.28);
  border-radius:14px;
  background:#ffffff;
  box-shadow:0 6px 20px rgba(15,23,42,.06);
  overflow:hidden;
}

.k-topmenu__summary{
  list-style:none;
  cursor:pointer;
  padding:11px 14px;
  font-size:14px;
  font-weight:700;
  color:#0f172a;
  user-select:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.k-topmenu__summary::-webkit-details-marker{
  display:none;
}

.k-topmenu__summary::after{
  content:"▾";
  font-size:14px;
  color:#64748b;
  transition:transform .15s ease;
}

.k-topmenu__mobile[open] .k-topmenu__summary::after{
  transform:rotate(180deg);
}

.k-topmenu__panel{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:0 12px 12px;
}

.k-topmenu__mobile .k-topmenu__link{
  width:100%;
  justify-content:flex-start;
  min-height:40px;
  border-radius:12px;
  box-shadow:none;
}

@media (max-width: 900px){
  .k-brandwrap{
    width:100%;
  }

  .k-topmenu__desktop{
    display:none;
  }

  .k-topmenu__mobile{
    display:block;
  }

  .k-admin-ad-slot{
    width:100%;
    min-width:0;
    justify-content:flex-start;
  }
}



/* ===== Переключатель темы ===== */
.k-topmenu__row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.k-theme-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:36px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.28);
  background:#ffffff;
  color:#334155;
  cursor:pointer;
  font-size:13px;
  font-weight:700;
  line-height:1;
  box-shadow:0 2px 8px rgba(15,23,42,.04);
  transition:background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.k-theme-toggle:hover,
.k-theme-toggle:focus{
  background:#f8fafc;
  border-color:rgba(37,99,235,.22);
  color:#2563eb;
  transform:translateY(-1px);
  box-shadow:0 5px 14px rgba(15,23,42,.08);
}

.k-theme-toggle__icon{
  font-size:16px;
  line-height:1;
}

@media (max-width: 900px){
  .k-topmenu__row{
    width:100%;
    justify-content:space-between;
  }

  .k-theme-toggle{
    margin-left:auto;
  }
}

/* ===== Тёмная тема: комфорт для глаз ===== */
body[data-theme="dark"]{
  --border:#334155;
  --text:#E5E7EB;
  --muted:#94A3B8;
  --bg:#0B1220;
  --card:#111827;
  --accent:#60A5FA;
  --accentHover:#93C5FD;
  --success:#22C55E;
  --danger:#F87171;
  color-scheme:dark;
}

body[data-theme="dark"]{
  background:var(--bg);
  color:var(--text);
}

body[data-theme="dark"] .k-header{
  background:#0f172a;
  border-bottom:1px solid rgba(148,163,184,.14);
}

body[data-theme="dark"] .k-card,
body[data-theme="dark"] .k-sidecard,
body[data-theme="dark"] .k-workcard,
body[data-theme="dark"] .k-sheet,
body[data-theme="dark"] .ws-block,
body[data-theme="dark"] .k-topmenu__link,
body[data-theme="dark"] .k-topmenu__mobile,
body[data-theme="dark"] .k-theme-toggle,
body[data-theme="dark"] .k-admin-ad-slot a,
body[data-theme="dark"] .k-helpmini{
  background:#111827 !important;
  color:#E5E7EB;
  border-color:#334155 !important;
  box-shadow:none;
}

body[data-theme="dark"] .k-brandtitle,
body[data-theme="dark"] .k-cardtitle,
body[data-theme="dark"] .k-side-title,
body[data-theme="dark"] .ws-title,
body[data-theme="dark"] .ws-label{
  color:#F8FAFC;
}

body[data-theme="dark"] .k-brandsub,
body[data-theme="dark"] .k-side-sub,
body[data-theme="dark"] .k-empty,
body[data-theme="dark"] .k-helpmini-title,
body[data-theme="dark"] .k-helpmini-list,
body[data-theme="dark"] .k-field label,
body[data-theme="dark"] .k-alert,
body[data-theme="dark"] .ws-instruction,
body[data-theme="dark"] .k-topmenu__summary,
body[data-theme="dark"] .k-topmenu__summary::after,
body[data-theme="dark"] .k-theme-toggle,
body[data-theme="dark"] .k-label-hint{
  color:#CBD5E1 !important;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea{
  background:#0F172A;
  color:#E5E7EB;
  border-color:#334155;
}

body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder{
  color:#64748B;
}

body[data-theme="dark"] .k-btn{
  background:#0F172A;
  color:#E5E7EB;
  border-color:#334155;
}

body[data-theme="dark"] .k-btn:hover{
  background:#162033;
}

body[data-theme="dark"] .k-btn-primary{
  background:#2563EB;
  color:#ffffff;
  border-color:#2563EB;
}

body[data-theme="dark"] .k-btn-primary:hover{
  background:#1D4ED8;
}

body[data-theme="dark"] .k-btn-danger{
  background:transparent;
  color:#FCA5A5;
  border-color:#EF4444;
}

body[data-theme="dark"] .k-link{
  color:#93C5FD;
}

body[data-theme="dark"] .k-stepbtn{
  background:#111827;
  border-color:#334155;
  color:#CBD5E1;
}

body[data-theme="dark"] .k-stepbtn--active{
  background:#1D4ED8;
  border-color:#1D4ED8;
  color:#ffffff;
}

body[data-theme="dark"] .k-stepline{
  background:rgba(148,163,184,.24);
}

body[data-theme="dark"] .k-stepnum{
  background:rgba(255,255,255,.08);
  color:inherit;
}

body[data-theme="dark"] .k-stepbtn--active .k-stepnum{
  background:rgba(255,255,255,.18);
  color:#ffffff;
}

body[data-theme="dark"] .k-topmenu__link:hover,
body[data-theme="dark"] .k-topmenu__link:focus,
body[data-theme="dark"] .k-theme-toggle:hover,
body[data-theme="dark"] .k-theme-toggle:focus{
  background:#0F172A;
  border-color:#475569;
  color:#93C5FD;
}

body[data-theme="dark"] .k-alert,
body[data-theme="dark"] .k-alert--muted{
  background:#0F172A;
  border-color:#334155;
  color:#CBD5E1;
}

body[data-theme="dark"] .k-workcard,
body[data-theme="dark"] .k-sidecard,
body[data-theme="dark"] .k-card{
  box-shadow:0 12px 28px rgba(0,0,0,.18);
}

body[data-theme="dark"] .ws-table th,
body[data-theme="dark"] .ws-table td,
body[data-theme="dark"] .ws-line,
body[data-theme="dark"] .ws-checkbox,
body[data-theme="dark"] .ws-boxarea{
  border-color:#64748B;
}

body[data-theme="dark"] .ws-table th{
  background:#0F172A;
}

body[data-theme="dark"] .k-admin-ad-slot{
  filter:saturate(.95) brightness(.95);
}

body[data-theme="dark"] .k-logo{
  background:#ffffff;
}

body[data-theme="dark"] .k-topmenu__mobile .k-topmenu__link{
  background:#0F172A !important;
}




/* ===== Доработка переключателя темы ===== */
.k-theme-toggle{
  min-width:40px;
  width:40px;
  padding:0;
  border-radius:999px;
}
.k-theme-toggle__label{
  display:none !important;
}
.k-theme-toggle__icon{
  font-size:17px;
}

/* ===== Более мягкая тёмная тема ===== */
body[data-theme="dark"]{
  --bg:#10141c;
  --card:#171c26;
  --card2:#1c2330;
  --line:#2c3647;
  --text:#e7edf7;
  --muted:#b2bfd3;
  --soft:#8ea1bb;
  --accent:#5b8cff;
  --accentHover:#7ea5ff;
  background:linear-gradient(180deg,#0f141d 0%, #121823 100%);
  color:var(--text);
}

body[data-theme="dark"] .k-header{
  background:rgba(15,20,29,.96);
  backdrop-filter:saturate(120%) blur(10px);
  border-bottom:1px solid rgba(122,138,163,.16);
}

body[data-theme="dark"] .k-card,
body[data-theme="dark"] .k-sidecard,
body[data-theme="dark"] .k-workcard,
body[data-theme="dark"] .k-sheet,
body[data-theme="dark"] .ws-block,
body[data-theme="dark"] .k-helpmini,
body[data-theme="dark"] .k-topmenu__link,
body[data-theme="dark"] .k-topmenu__mobile,
body[data-theme="dark"] .k-theme-toggle{
  background:var(--card) !important;
  color:var(--text) !important;
  border-color:var(--line) !important;
}

body[data-theme="dark"] .k-workcard,
body[data-theme="dark"] .k-sidecard,
body[data-theme="dark"] .k-card{
  box-shadow:0 12px 30px rgba(0,0,0,.22);
}

body[data-theme="dark"] .k-brandsub,
body[data-theme="dark"] .k-side-sub,
body[data-theme="dark"] .k-empty,
body[data-theme="dark"] .k-helpmini-title,
body[data-theme="dark"] .k-helpmini-list,
body[data-theme="dark"] .k-field label,
body[data-theme="dark"] .k-alert,
body[data-theme="dark"] .ws-instruction,
body[data-theme="dark"] .k-topmenu__summary,
body[data-theme="dark"] .k-topmenu__summary::after,
body[data-theme="dark"] .k-label-hint{
  color:var(--muted) !important;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea{
  background:#121926;
  color:var(--text);
  border-color:var(--line);
}

body[data-theme="dark"] input:focus,
body[data-theme="dark"] select:focus,
body[data-theme="dark"] textarea:focus{
  border-color:rgba(91,140,255,.55);
  box-shadow:0 0 0 3px rgba(91,140,255,.14);
}

body[data-theme="dark"] .k-btn{
  background:#1a2230;
  color:var(--text);
  border-color:var(--line);
}
body[data-theme="dark"] .k-btn:hover{
  background:#202a3a;
}
body[data-theme="dark"] .k-btn-primary{
  background:var(--accent);
  color:#fff;
  border-color:var(--accent);
}
body[data-theme="dark"] .k-btn-primary:hover{
  background:#4c7af0;
}
body[data-theme="dark"] .k-btn-fill{
  background:#1f8f53;
  color:#fff;
  border-color:#1f8f53;
}
body[data-theme="dark"] .k-btn-fill:hover{
  background:#187445;
  border-color:#187445;
}

body[data-theme="dark"] .k-stepbtn{
  background:#18202c;
  border-color:var(--line);
  color:var(--muted);
}
body[data-theme="dark"] .k-stepbtn--active{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
}
body[data-theme="dark"] .k-stepbtn:hover{
  color:#fff;
  border-color:#4d5d77;
}

body[data-theme="dark"] .k-stepline{
  background:rgba(142,161,187,.22);
}

body[data-theme="dark"] .k-topmenu__link:hover,
body[data-theme="dark"] .k-topmenu__link:focus,
body[data-theme="dark"] .k-theme-toggle:hover,
body[data-theme="dark"] .k-theme-toggle:focus{
  background:#212b3a !important;
  border-color:#4a5c78 !important;
  color:#dfe9ff !important;
}

/* ===== Чат ИИ: не сливается ни в одной теме ===== */
.k-chat-shell,
.k-ai-chat,
.k-chat-panel,
.k-chat-wrap,
.k-chat-box,
.k-chat-tabs,
.k-chat-tabbar{
  border-radius:18px;
}

body:not([data-theme="dark"]) .k-chat-shell,
body:not([data-theme="dark"]) .k-ai-chat,
body:not([data-theme="dark"]) .k-chat-panel,
body:not([data-theme="dark"]) .k-chat-wrap,
body:not([data-theme="dark"]) .k-chat-box{
  background:#f8fbff !important;
  border:1px solid rgba(37,99,235,.12) !important;
  box-shadow:0 10px 28px rgba(37,99,235,.06);
}

body[data-theme="dark"] .k-chat-shell,
body[data-theme="dark"] .k-ai-chat,
body[data-theme="dark"] .k-chat-panel,
body[data-theme="dark"] .k-chat-wrap,
body[data-theme="dark"] .k-chat-box{
  background:linear-gradient(180deg,#0f1726 0%, #111b2b 100%) !important;
  border:1px solid rgba(91,140,255,.16) !important;
  box-shadow:0 14px 34px rgba(0,0,0,.28);
}

/* Вкладки чата / заполнения */
body:not([data-theme="dark"]) .k-tab,
body:not([data-theme="dark"]) .k-chat-tab,
body:not([data-theme="dark"]) .tab-btn,
body:not([data-theme="dark"]) .chat-tab-btn{
  background:#eef4ff !important;
  color:#37506f !important;
  border:1px solid rgba(55,80,111,.12) !important;
}

body:not([data-theme="dark"]) .k-tab.is-active,
body:not([data-theme="dark"]) .k-chat-tab.is-active,
body:not([data-theme="dark"]) .tab-btn.active,
body:not([data-theme="dark"]) .chat-tab-btn.active{
  background:#3b82f6 !important;
  color:#fff !important;
  border-color:#3b82f6 !important;
}

body[data-theme="dark"] .k-tab,
body[data-theme="dark"] .k-chat-tab,
body[data-theme="dark"] .tab-btn,
body[data-theme="dark"] .chat-tab-btn{
  background:#202938 !important;
  color:#d4deee !important;
  border:1px solid rgba(122,138,163,.22) !important;
  box-shadow:none !important;
}

body[data-theme="dark"] .k-tab.is-active,
body[data-theme="dark"] .k-chat-tab.is-active,
body[data-theme="dark"] .tab-btn.active,
body[data-theme="dark"] .chat-tab-btn.active{
  background:#3b82f6 !important;
  color:#ffffff !important;
  border-color:#3b82f6 !important;
}

body[data-theme="dark"] .k-tab:hover,
body[data-theme="dark"] .k-chat-tab:hover,
body[data-theme="dark"] .tab-btn:hover,
body[data-theme="dark"] .chat-tab-btn:hover{
  background:#263246 !important;
  color:#ffffff !important;
}

/* Внутренний текст в чате */
body[data-theme="dark"] .k-chat-shell,
body[data-theme="dark"] .k-ai-chat,
body[data-theme="dark"] .k-chat-panel,
body[data-theme="dark"] .k-chat-wrap,
body[data-theme="dark"] .k-chat-box,
body[data-theme="dark"] .k-chat-shell *,
body[data-theme="dark"] .k-ai-chat *,
body[data-theme="dark"] .k-chat-panel *,
body[data-theme="dark"] .k-chat-wrap *,
body[data-theme="dark"] .k-chat-box *{
  color:#e6edf8;
}

body[data-theme="dark"] .k-chat-shell a,
body[data-theme="dark"] .k-ai-chat a,
body[data-theme="dark"] .k-chat-panel a,
body[data-theme="dark"] .k-chat-wrap a,
body[data-theme="dark"] .k-chat-box a{
  color:#8cb4ff !important;
}
