@font-face {
  font-family: 'Orbitron';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(webfonts/Orbitron.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(webfonts/Inter.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter2';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(webfonts/Inter2.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Neural grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
}

/* Ambient purple glow top-right */
body::after {
  content: '';
  position: fixed;
  top: -150px; right: -80px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.07) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* Header top accent line */
#header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0.7;
}

/* Make z-index correct so content sits above grid */
#app { position: relative; z-index: 1; }
#header { position: relative; z-index: 100; }

/* Fix #btn-send to use purple gradient */
#btn-send {
  color: #fff !important;
  background: linear-gradient(135deg, #81a8f8 0%, #003070 100%);
}
#btn-send:hover {
  background: linear-gradient(135deg, #81a8f8 0%, #00193a 100%) !important;
}

/* msg-avatar-ai purple tint */
.msg-avatar-ai {
  background: rgb(255 255 255) !important;
  border-color: rgb(255 255 255 / 11%) !important;
  color: #000000 !important;
}

/* msg-ai name color */
.msg-ai .msg-name {color: #ffffff !important;}
.msg-user .msg-name {color: #e0e2f9 !important;}

/* Source tag hover */
.source-tag:hover {
  border-color: #818cf8 !important;
  color: #818cf8 !important;
  background: rgba(99,102,241,0.06) !important;
}

/* Chunk expand btn open */
.chunk-expand-btn:hover, .chunk-expand-btn.open {
  color: #ffffff !important;
  /* border-color: #ffffff24 !important; */
}

.btn-view-doc:hover {
  color: #000000 !important;
  background: rgb(255 255 255) !important;
}

/* Docs tab active */
.docs-tab.active {color: #ffffff !important;border-bottom-color: #ffffff75 !important;}
.docs-tab.active .tab-badge {background: rgb(255 255 255 / 47%) !important;color: #000000 !important;padding: 1px 4px 1px 3px;font-size: 10px;}

/* Typing dots - purple cascade */
.typing-dot { background: #6366f1 !important; }
.typing-dot:nth-child(2) { background: #818cf8 !important; }
.typing-dot:nth-child(3) { background: #22d3ee !important; }


/* Input focus purple */
#msg-input:focus { border-color: #ffffff73 !important; box-shadow: 0 0 0 2px rgb(0 0 0 / 57%) !important; }

/* Chip active */
.chip-scope:hover, .chip-scope.active {
  border-color: #ffffff00 !important;
  color: #ffffff !important;
  background: #860000 !important;
}

 :root {
    --bg:        #0d1118;
    --surface:   #141a28;
    --surface2:  #1b2235;
    --surface3:  #222840;
    --border:    #1e2d4a;
    --border2:   #2a3d5e;
    --gold:      #818cf8;
    --gold-dim:  #4f56c0;
    --text:      #e8e3d9;
    --text-dim:  #d7d7d7;
    --text-faint:#c4c4c4;
    --accent:    #22d3ee;
    --accent2:   #0c2a36;
    --red:       #8b2020;
    --radius: 10px;
    --shadow:    0 4px 24px rgba(0,0,0,.5);
    --font-serif: 'Inter',Georgia, 'Times New Roman', 'PT Serif', serif;
    --font-mono: 'Inter','Courier New', 'Lucida Console', 'Consolas', monospace;
    --font-ui: 'Inter2',-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue',                   Arial, 'Liberation Sans', sans-serif;
  }
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  #scope-picker-list{min-height:100px;}
  html, body {
    height: 100%;
    width: 100%;
    background-size: 10px 10px, 10px 10px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    /* background-size: 4px 4px, 4px 4px, 100% 100%, 100% 100%, 100% 100%, 100% 100%; */
    background-position: 0 0;
    background-repeat: repeat;
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px), radial-gradient(circle at 20% 80%, rgb(220 0 0 / 51%) 0%, transparent 50%), radial-gradient(circle at 80% 20%, rgb(33 255 0 / 30%) 0%, transparent 50%), radial-gradient(circle at 40% 40%, rgb(255 255 255 / 20%) 0%, transparent 50%), linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
  }

  #header {
    height: 52px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    position: relative;
    z-index: 100;
    flex-shrink: 0;
  }

  .logo {
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    font-family: 'Orbitron', monospace !important;
    font-size: 17px !important;
    letter-spacing: 0.12em !important;
    text-shadow: 0 0 16px rgb(0 0 0 / 50%);
  }

  .logo-sep {
    width: 1px;
    height: 20px;
    background: var(--border2);
  }

  .logo-sub {
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 400;
    color: #ffffffb0;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .header-spacer { flex: 1; }

  #status-indicator {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--text-dim);
  }

  .status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-faint);
    transition: background .3s;
  }
  .status-dot.connected { background: #4ade80; box-shadow: 0 0 6px #4ade8080; }
  .status-dot.loading   { background: var(--gold); animation: pulse-dot 1s infinite; }
  .status-dot.error     { background: #f87171; }

  @keyframes pulse-dot {
    0%,100% { opacity:1; } 50% { opacity:.3; }
  }

  #btn-settings {
    width: 34px;
    height: 34px;
   }
  #btn-settings:hover { background: #000000;}

  #app {
    display: flex;
    height: calc(100vh - 52px);
    overflow: hidden;
  }
#btn-settings{
    width: 34px;
    /* height: 34px; */
    border-radius: var(--radius);
    border: 1px solid #ffffff00;
    background: #00000052;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    font-size: 15px;
    padding: 1px 0px 0px 0px;
}
  #chat-col {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    /* border-right: 1px solid var(--border); */
    /* background: var(--bg); */
  }

  #chat-toolbar {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 10px;
    /* border-bottom: 1px solid var(--border); */
    /* background: var(--surface); */
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: #000000;
    /* box-shadow: 0px -3px 19px rgb(0 0 0 / 53%); */
    background-color: #000;
    /* border-bottom: 1px solid rgba(255, 255, 255, 0.1); */
  }

  .toolbar-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-dim);
  }

  .toolbar-sep { flex: 1; }

  .chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
  }

  .chip-scope {
    border-color: #ffffff00;
    color: #ffffff;
    background: #383838 !important;
  }

  .btn-icon-sm {
    width: 28px;
    height: 26px;
    border-radius: 25px;
    border: 1px solid #ffffff00;
    background: #ffffff1f;
    color: #ffffff70;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all .2s;
  }
  .btn-icon-sm:hover { background: var(--surface2); color: var(--text); }

  #messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    scroll-behavior: smooth;
    box-shadow: rgb(0 0 0) 0px 4px 28px inset;
  }
  #messages::-webkit-scrollbar { width: 4px; }
  #messages::-webkit-scrollbar-track { background: #000000; }
  #messages::-webkit-scrollbar-thumb { background: #ffffff; border-radius: 2px; }

  #empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    padding: 40px;
    text-align: center;
  }

  .empty-icon {
    font-size: 64px;
    opacity: .6;
  }
  .empty-icon i{
    font-size: 64px;
    opacity: 0.4;
    color: #b9b9b9;
  }
  [data-theme="light"] .empty-icon i{color: #000000;}
  .empty-title {
    /* font-size: 22px; */
    /* color: var(--text-dim); */
    /* font-family: 'LocalSerif', Georgia, serif; */
    font-size: 26px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
  }

  .empty-desc {
    /* font-size: 13px; */
    /* color: var(--text-faint); */
    /* max-width: 320px; */
    line-height: 1.7;
    font-size: 14px;
    color: var(--text-dim);
    max-width: 400px;
    margin-bottom: 30px;
  }

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 750px;
  }

  .suggestion-btn {
    padding: 10px 16px;
    border-radius: var(--radius);
    border: 1px solid #ffffff00;
    background: #0000004f;
    color: #ffffffad;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
  }
.suggestion-btn:hover{background-color:#00000087;}
  .msg {
    display: flex;
    gap: 12px;
    padding: 10px 20px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    animation: msg-in .25s ease;
  }

  @keyframes msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .msg-user { flex-direction: row-reverse; }

  .msg-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
  }

  .msg-avatar-user {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    background: #ededed;
    color: #000000;
  }

  .msg-avatar-ai {
    border: 1px solid #ffffff;
    font-size: 14px;
  }

  .msg-body { flex: 1; min-width: 0; }

  .msg-user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }

  .msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
  }

  .msg-name {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  .msg-time {
    font-size: 11px;
    color: var(--text-faint);
  }

  .msg-bubble {
    padding: 12px 15px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.7;
    max-width: 100%;
    word-break: break-word;
  }

  .msg-user .msg-bubble {
    background: #000000;
    /* border: 1px solid var(--border2); */
    border-top-right-radius: 2px;
    color: var(--text);
    box-shadow: rgb(0 0 0) 0px 2px 24px;
  }

  .msg-ai .msg-bubble {
    background: #000000;
    border-top-left-radius: 2px;
    color: #ffffff;
    width: 100%;
    box-shadow: rgb(0 0 0) 0px 8px 32px;
  }

  .msg-bubble p { margin-bottom: 8px; }
  .msg-bubble p:last-child { margin-bottom: 0; }
  .msg-bubble strong {color: #fff280;font-weight: 600;}
  .msg-bubble ul li strong {color: #00ff8c;font-weight: 200;}
  .msg-bubble ol li strong {color: #00dbff;font-weight: 200;}
  
  .msg-bubble ul ol li strong {color: #9000ff;font-weight: 200;}
  .msg-bubble ol ul li strong {color: #ff9800;font-weight: 200;}

  .msg-bubble a{color:#009eff}
  .msg-bubble em { color: var(--text-dim); }
  .msg-bubble code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--surface3);
    padding: 2px 6px;
    border-radius: 3px;
    color: #a7f3d0;
  }
  .msg-bubble ul, .msg-bubble ol {
    padding-left: 20px;
    margin: 6px 0;
  }
  .msg-bubble li {margin-bottom: 3px;margin-left: 17px;}
  .msg-bubble h3, .msg-bubble h4 {
    color: #00ffe7;
    margin: 10px 0 5px;
  }
.msg-bubble h3 strong, .msg-bubble h4  strong{color: #ff00a3;}
  .msg-bubble blockquote {
    border-left: 2px solid var(--gold-dim);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-dim);
    font-style: italic;
  }

  .msg-sources {
    margin-top: 19px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .source-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    border-radius: 20px;
    font-size: 11px;
    border: 0px solid #ffffff00;
    color: #ffffff;
    cursor: pointer;
    /* transition: all .2s; */
    max-width: 220px;
    background: rgb(69 69 69 / 36%);
    box-shadow: 0px 0px 14px #000000 inset;
  }

  .source-tag:hover {
    border-color: #00000047 !important;
    color: #fff !important;
    background: rgb(0 0 0 / 36%) !important;
  }

  .source-tag .src-icon { font-size: 10px; }
  .source-tag .src-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .source-tag .src-pct {
    color: #ffffff;
    flex-shrink: 0;
  }

  .typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 4px 0;
  }
  .typing-dot {
    margin: 0px 3px 0px 0px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-faint);
    animation: typing 1.2s infinite;
  }
  .typing-dot:nth-child(2) { animation-delay: .2s; }
  .typing-dot:nth-child(3) { animation-delay: .4s; }
  @keyframes typing {
    0%,60%,100% { opacity: .3; transform: translateY(0); }
    30%  { opacity: 1; transform: translateY(-4px); }
  }

  #input-area {
    /* border-top: 1px solid var(--border); */
    padding: 14px 16px 4px 16px;
    background: #000000;
    flex-shrink: 0;
  }

  #input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    /* max-width: 900px; */
    margin: 0 auto;
  }

  #input-wrap {
    flex: 1;
    position: relative;
  }

  #msg-input {
    height: auto !important;
    width: 100%;
    min-height: 44px;
    max-height: 180px;
    padding: 11px 44px 11px 14px;
    background: #2d2d2d;
    border: 1px solid #ffffff14;
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color .2s;
    overflow-y: auto;
    line-height: 1.5;
  }
  #msg-input:focus { border-color:#fff; }
  #msg-input::placeholder { color: #fff; }
  #msg-input::-webkit-scrollbar { width: 3px; }
  #msg-input::-webkit-scrollbar-thumb { background: #000000; border-radius: 2px; }

  #btn-send {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    border: none;
    color: #1a1200;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    font-weight: 700;
    margin: -7px 0 6px 0px;
  }
  #btn-send:hover { background: #dbb85a; transform: translateY(-1px); }
  #btn-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }

  .input-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    max-width: 900px;
    margin: 8px auto 0;
  }

  .input-hint {
    font-size: 11px;
    color: var(--text-faint);
    flex: 1;
  }

  #docs-col {
    width: 42%;
    min-width: 260px;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    /* background: var(--surface); */
    flex-shrink: 0;
    position: relative;
  }

  #docs-col.animate {
    transition: width .3s ease, min-width .3s ease;
  }

  #docs-col.collapsed {
    width: 0 !important;
    min-width: 0;
    overflow: hidden;
  }

  #docs-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    cursor: col-resize;
    z-index: 10;
    width: 6px;
    cursor: col-resize;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: linear-gradient(179deg, #ffffff 0px, transparent 0px, transparent 0px), linear-gradient(#66666657 1px, transparent 0px, transparent 0px);
    background-size: 2px 100%, 100% 3px;
    background-repeat: repeat-y;
  }
  #docs-toolbar {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 10px;
    /* border-bottom: 1px solid var(--border); */
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: #000000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    /* border-radius: 19px; */
    box-shadow: 0px -3px 19px rgb(0 0 0 / 53%);
    background-color: #000;
  }

  .docs-title {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-dim);
    flex: 1;
  }

  #docs-tabs {
    display: flex;
    /* border-bottom: 1px solid var(--border); */
    flex-shrink: 0;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: #000000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    /* border-radius: 19px; */
    /* box-shadow: 0px -3px 19px rgb(0 0 0 / 53%); */
    background-color: #000;
  }
  #docs-tabs::-webkit-scrollbar { height: 2px; }
  #docs-tabs::-webkit-scrollbar-thumb { background: #ffffff; }

  .docs-tab {
    padding: 9px 14px;
    font-size: 12px;
    color: #959595;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .15s;
    background: transparent;
    border-left: none;
    border-right: none;
    border-top: none;
    font-family: var(--font-ui);
    flex-shrink: 0;
  }
  .docs-tab:hover { color: var(--text-dim); }
  .docs-tab .tab-badge {
    background: var(--surface3);
    color: #ffffff;
    font-size: 10px;
    padding: 2px 4px 0px 3px;
    border-radius: 8px;
  }
  #docs-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: #000000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0px 0px 10px 0px;
    /* border-radius: 19px; */
    /* box-shadow: 0px -3px 19px rgb(0 0 0 / 53%); */
  }
  #docs-content::-webkit-scrollbar { width: 4px; }
  #docs-content::-webkit-scrollbar-track { background: #00000000; }
  #docs-content::-webkit-scrollbar-thumb { background: #ffffff; border-radius: 2px; }

  #docs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    padding: 40px;
    text-align: center;
  }
  #docs-empty .empty-icon { font-size: 32px; opacity: .2; }
  #docs-empty .empty-title {font-size: 14px;font-weight: 100;color: #ffffffa8;}

  #chunks-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; }

  .chunk-card {
    overflow: hidden;
    transition: border-color .2s;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    /* border: 1px solid rgba(255, 255, 255, 0.1); */
    border-radius: 16px;
    background-color: #000000;
  }
  .chunk-card:hover {border-color: #ffffff61;}
  .chunk-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #ffffff00;
    cursor: pointer;
  }

  .chunk-relevance {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    padding: 0px 7px 0px 7px;
    border-radius: 9px;
    background: var(--surface3);
    margin-top: 1px;
  }
  .chunk-relevance.high {color: #000000;background: rgb(0 255 163);}
  .chunk-relevance.med  {color: #000000;background: rgb(255 232 111);}
  .chunk-relevance.low  { color: var(--text-dim); }

  .chunk-meta { flex: 1; min-width: 0; }

  .chunk-docname {
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Inter';
  }

  .chunk-info {
    display: flex;
    gap: 8px;
    margin-top: 3px;
    flex-wrap: wrap;
  }

  .chunk-badge {
    font-size: 11px;
    padding: 2px 6px 0px 6px;
    border-radius: 11px;
    background: var(--surface3);
    color: #ffffff;
    white-space: nowrap;
  }
  .chunk-badge.page {color: #ffffff;background: rgb(45 45 45);}
  .chunk-badge.type {color: #ffffff;background: rgb(0 70 197);}
  .chunk-badge.source {color: #ffffff;background: rgb(183 52 2);}

  .chunk-expand-btn {
    width: 22px;
    height: 22px;
    border-radius: 15px;
    border: 1px solid #ffffff00;
    background: #0000002e;
    color: var(--text-faint);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all .15s;
    flex-shrink: 0;
    margin-top: 0px;
    padding: 0px 0px 3px 0px;
  }
  .chunk-body {
    display: none;
    padding: 12px;
    font-size: 14px;
    line-height: 1.7;
    color: #000000;
    background: #ffffff;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: var(--font-ui);
  }
  .chunk-body.open { display: block; }
  .chunk-body::-webkit-scrollbar { width: 3px; background: #d1d1d1}
  .chunk-body::-webkit-scrollbar-thumb { background: #000000; }

  .chunk-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
  }

  .btn-view-doc {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 13px;
    border: 1px solid #ffffff00;
    background: #2f2f2f;
    color: #ffffff;
    font-size: 11px;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all .2s;
    margin: 0px 0px 0px -5px;
    text-decoration: none;
  }
a.btn-view-doc{padding: 1px 10px;}
.btn-view-doc .fa-solid{margin: -4px 0px -2px 0px;font-size: 10px;}
  #doc-viewer {
    display: none;
    flex-direction: column;
    height: 100%;
  }
  #doc-viewer.active { display: flex; }

  #doc-viewer-header {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    background: #860000;
  }

  .doc-viewer-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #doc-viewer-frame {
    flex: 1;
    border: none;
    background: #fff;
    width: 100%;
  }

  #doc-viewer-md {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-size: 13px;
    line-height: 1.8;
    color: #000000;
    white-space: pre-wrap;
    font-family: var(--font-ui);
    background: #ffffff;
  }
  #doc-viewer-md::-webkit-scrollbar { width: 4px; }
  #doc-viewer-md::-webkit-scrollbar-thumb { background: #fff; }

  .highlight-chunk {
    background: rgba(201,168,76,.12) !important;
    border-left: 2px solid var(--gold) !important;
    padding-left: 10px;
  }

  #settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
  }
  #settings-overlay.open { display: flex; }

  #settings-panel {
    width: 480px;
    max-width: 95vw;
    max-height: 85vh;
    background: #1e1e1e;
    /* border: 1px solid #ffffff24; */
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    animation: slide-in .2s ease;
  }

  @keyframes slide-in {
    from { opacity: 0; transform: translateY(-16px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }

  #settings-header {
    padding: 16px 20px;
    border-bottom: 1px solid #ffffff36;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .settings-title {
    font-size: 17px;
    flex: 1;
    color: #fdf187;
  }

  #settings-body {
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  #settings-body::-webkit-scrollbar { width: 4px; }
  #settings-body::-webkit-scrollbar-thumb { background: #fff; }

  .settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .settings-section-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #ffffff;
    padding-bottom: 6px;
    border-bottom: 1px solid #ffffff2e;
  }

  .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .field label {
    font-size: 13px;
    font-weight: 500;
    color: #ffffffad;
  }

  .field input, .field textarea, .field select {
    background: #393939;
    border: 1px solid #ffffff00;
    border-radius: var(--radius);
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 9px 12px;
    outline: none;
    transition: border-color .2s;
    width: 100%;
  }
  .field input:focus, .field textarea:focus, .field select:focus {
    border-color: #ffffff1f;
  }
  .field textarea {min-height: 70px;resize: vertical;font-family: var(--font-ui);font-size: 14px;}
  .field select option {background: #000;border: none;}
  .field input::placeholder { color: var(--text-faint); }

  .field-hint {
    font-size: 12px;
    color: #c3c3c3;
  }

  .field-row {
    display: flex;
    gap: 10px;
  }
  .field-row .field { flex: 1; }

  #settings-footer {
    padding: 14px 20px;
    border-top: 1px solid #ffffff24;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
  }

  .btn-secondary {
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid #ffffff00;
    background: #ffffff1f;
    color: var(--text-dim);
    font-family: var(--font-ui);
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
  }
  .btn-secondary:hover { background: var(--surface2); color: var(--text); }

  .btn-primary {
    padding: 8px 20px;
    border-radius: var(--radius);
    border: none;
    color: #1a1200;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
  }
  .btn-primary:hover { background: #ffffff; }

  #toggle-docs-btn {
    display: none;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    border: 1px solid #ffffff00;
    background: #00000052;
    color: #ffffff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    font-size: 15px;
    padding: 2px 0px 0px 0px;
  }
  #toggle-docs-btn:hover { color: var(--gold); border-color: var(--gold-dim); }
  #btn-theme{display:none !important;}
  #btn-docs-float {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 16px;
    z-index: 250;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #ffffff40;
    background: #000000;
    color: #ffffff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: var(--shadow);
    transition: all .2s;
  }
  #btn-docs-float:hover { background: var(--surface3); transform: scale(1.08); }

  @media (max-width: 900px) {
    #docs-col {
      position: fixed;
      right: 0; top: 52px; bottom: 0;
      z-index: 200;
      width: 95vw !important;
      max-width: 95vw;
      min-width: 0;
      box-shadow: -4px 0 24px rgba(0,0,0,.5);
    }
    .notlf,#btn-show-sources{display:none !important;}
    #msg-input{font-size:12px}
    #docs-col.animate {
      transition: transform .3s ease !important;
    }
    #docs-col.collapsed {
      transform: translateX(100%);
      width: 95vw !important;
      overflow: visible; 
    }
    #docs-resize-handle { display: none; }
    #toggle-docs-btn { display: flex; }
    #btn-docs-float { display: flex; }
    #app { position: relative; }
  }

  @media (max-width: 600px) {
    .msg { padding: 8px 12px; }
    #input-area { padding: 10px 12px; }
    .logo-sub { display: none; }
    .logo-sep { display: none; }
  }

  .meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #000000;
    padding: 2px 7px 0px 7px;
    background: #fff9c2;
    border: 1px solid #ffffff00;
    border-radius: 14px;
  }
.meta-badge:hover{cursor:auto;}

  .divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
  }

  #rag-opts-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    padding-bottom: 0;
  }
  #rag-opts-overlay.open {display: flex;}

  #rag-opts-panel {
    width: 100%;
    max-width: 720px;
    border-radius: 14px;
    padding: 0 0 24px;
    box-shadow: 0 -8px 40px rgb(0 0 0 / 40%);
    animation: panel-up .22s cubic-bezier(.22,.8,.4,1);
    overflow: hidden;
    background: rgb(0 0 0 / 38%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  @keyframes panel-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
  }

  #rag-opts-header {
    display: flex;
    align-items: center;
    padding: 14px 20px 12px;
    border-bottom: 1px solid #ffffff1f;
    margin-bottom: 4px;
  }
  #rag-opts-header .panel-title {
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--text);
    flex: 1;
  }
  #rag-opts-close {
    width: 28px;
    height: 27px;
    border-radius: 50%;
    border: 1px solid #ffffff36;
    background: transparent;
    color: #ffffff94;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all .15s;
  }
  #rag-opts-close:hover { background: var(--surface2); color: var(--text); }

  .rag-opts-body {
    padding: 12px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .rag-opts-row {
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .rag-opts-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    min-width: 88px;
    flex-shrink: 0;
  }

  .range-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #454545;
    /* border: 1px solid #ffffff38; */
    border-radius: 8px;
    padding: 10px 14px;
  }

  input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ffffff2e;
    outline: none;
    cursor: pointer;
    transition: background .2s;
  }
  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff, #ffffff);
    cursor: pointer;
    border: 1px solid #808080;
    box-shadow: 0 1px 6px rgba(0,0,0,.3);
    transition: transform .15s;
  }
  input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
  }
  input[type="range"]::-moz-range-thumb {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    cursor: pointer;
    border: 3px solid var(--surface);
    box-shadow: 0 1px 6px rgba(0,0,0,.3);
  }
  input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(201,168,76,.25);
  }

  .range-val {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: #d5c959;
    min-width: 28px;
    text-align: center;
    background: rgb(255 255 255 / 18%);
    /* border: 1px solid rgba(201,168,76,.2); */
    border-radius: 5px;
    padding: 4px 6px 1px 6px;
    flex-shrink: 0;
  }

  .rag-opts-select {
    flex: 1;
    background: #454545;
    border: 1px solid #ffffff00;
    border-radius: 8px;
    color: #d3d3d3;
    font-family: var(--font-ui);
    font-size: 13px;
    padding: 10px 14px;
    outline: none;
    cursor: pointer;
    transition: border-color .2s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8278' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
  }
  .rag-opts-select:focus { border-color: #ffffff33; }
  .rag-opts-select option { background: #000000; }

  .rag-opts-input {
    flex: 1;
    background: #454545;
    border: 1px solid #ffffff00;
    border-radius: 8px;
    color: #ffffff;
    font-family: var(--font-ui);
    font-size: 13px;
    padding: 10px 14px;
    outline: none;
    transition: border-color .2s;
  }
  .rag-opts-input:focus { border-color: #ffffff38; }
  .rag-opts-input::placeholder { color: var(--text-faint); }

  .hl-keyword {
  color: #e53935;
  font-weight: 600;
  background: rgba(229, 57, 53, 0.08);
  border-radius: 2px;
  padding: 0 1px;
}



.msg-bubble h1, .msg-bubble h2 {
  margin: 10px 0 5px 0;
  color: #E91E63;
  font-size: 1.2em;
}

.msg-bubble ul, .msg-bubble ol {
  margin-left: 20px;
  margin-bottom: 10px;
}

.msg-bubble li {
  margin-bottom: 4px;
}

.msg-bubble hr {
  border: 0;
  border-top: 1px solid #ffffff29;
  margin: 15px 0;
}


#scope-picker-search{width:100%;background: #ffffff;border: 1px solid #ffffff00;border-radius:var(--radius);color: #000000;font-family:var(--font-ui);font-size:13px;padding:8px 12px;outline:none;}
#scope-picker-list{overflow-y:auto;flex:1;padding:8px;}
#scope-picker-overlay{display:none;position:fixed;inset:0;z-index:450;background:rgba(0,0,0,.55);backdrop-filter:blur(4px);align-items:center;justify-content:center;}
#scope-picker-panel{
                    width:460px;
                    max-width:95vw;
                    max-height:70vh;
                    background: #2d2d2d;
                    border: 1px solid #ffffff1f;
                    border-radius:10px;
                    overflow:hidden;
                    display:flex;
                    flex-direction:column;
                    box-shadow:var(--shadow);
                    animation: slide-in .2s ease;
                    color: #ffffff;
                    }
#debug-content{padding:12px;font-family:var(--font-mono);font-size: 13px !important;color: var(--text-dim) !important;line-height:1.6;}
#debug-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;height:200px;gap:8px;padding:20px;text-align:center;color: #ffffff5c;}
#doc-viewer-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:12px;padding:40px;text-align:center;color: #ffffff6b;}
#cfg-bd-id-select{flex:1;padding:9px 12px;font-family:var(--font-mono);font-size:12px;outline:none;border: 1px solid #ffffff00;}
#cfg-doc-id-select{flex:1;padding:9px 12px;background: #393939;border-radius:var(--radius);color:var(--text);font-family:var(--font-mono);font-size:12px;outline:none;}
#btn-show-sources{display: flex;gap: 5px;width: auto;padding: 0px 10px;font-size: 12px;color: #ffffff;border-color: #ffffff00;background: #2f5030;display: none;}
.dvchnk1,.dvchnk5{padding: 0px 0 5px;border-bottom: 1px solid #0000001f;margin-bottom: -25px;font-size: 11px;color: #000000;letter-spacing:.06em;text-transform:uppercase;}
.dvchnk2{padding: 1px 12px 1px 12px;}
.dvchnk3{font-size:10px;color: #ffffff;text-transform:uppercase;letter-spacing:.07em;background-color: #2f2f2f;padding: 4px 0px 4px 8px;border-radius: 13px;text-align: center;margin: 0px 0px -30px 0px;}
.dvchnk4{font-size:13px;line-height:1.75;color: #000000;}
.llm{color: #ffe500;font-size: 18px;text-transform:uppercase;letter-spacing:.1em;margin-bottom:8px;}
#tab-content-chunks{background-color:#00000000;}
.pk1{padding:20px;text-align:center;}
.pk1 div{color:var(--text-faint);font-size:12px;margin-bottom:12px;}
#manual-scope-id{width:100%;background:var(--surface2);border:1px solid var(--border2);border-radius:var(--radius);color:var(--text);font-family:var(--font-ui);font-size:13px;padding:9px 12px;outline:none;margin-bottom:8px;}
.pk2{padding:24px;text-align:center;color:var(--text-faint);font-size:12px;}
.spp1{padding:14px 18px;border-bottom: 1px solid #ffffff24;display:flex;align-items:center;gap:10px;}
#scope-picker-title{font-family:var(--font-serif);font-size:15px;flex:1;}
.spp2{padding:10px 14px;border-bottom: 1px solid #ffffff24;}
.spp3{padding:10px 14px;border-top: 1px solid #ffffff24;display:flex;gap:8px;justify-content:flex-end;}
.ffldr{flex-shrink:0; color:#FFF;}
.xigf:hover,.dzifv:hover{background-color: #000;}
.clrrzd{padding:6px 12px 2px;font-size: 14px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color: #ffe500;display:flex;align-items:center;gap:6px;margin-top:4px;}
.nopap{padding:6px 12px 2px;font-size:10px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--text-faint);margin-top:4px;}



.msg-user { cursor: grab; }
.msg-user:active { cursor: grabbing; }

#msg-input.drag-target {
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.6) !important;
  border-color: #6366f1 !important;
  transform: scale(1.02);
  background: rgba(99, 102, 241, 0.1) !important;
  transition: all 0.2s ease;
}

.msg {
  position: relative;
  transition: transform 0.3s ease, opacity 0.3s ease;
  will-change: transform, opacity;
}

.fly-out {
  transform: translateX(-150%) rotate(-10deg) !important;
  opacity: 0 !important;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.collapsed {
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  transition: all 0.3s ease;
}



.typing-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-faint);
    font-style: italic;
}


.debug-log-container {
  margin-top: 10px;
}

.debug-log-row {
  display: flex;
  gap: 14px;
  margin-bottom: 0px;
}

.debug-log-time {
  color: #ffe500;
  flex-shrink: 0;
}

.debug-log-step {
  flex-shrink: 0;
  min-width: 60px;
}

.debug-log-step.status-normal {color: #6ae8ff;}
.debug-log-step.status-warn   { color: #fbbf24; } 
.debug-log-step.status-error  { color: #f87171; } 

.debug-log-msg {
  color: #ffffff;
  word-break: break-all;
}

.typing-wrap {
  display: inline-flex;
  margin-right: 8px;
}

.status-text {
  font-size: 14px;
  color: #ffffffc2;
  font-style: normal;
}

.user-meta {
  flex-direction: row-reverse;
}
.kv1{display:flex;gap:8px;margin-bottom:4px;}
.kv2{color: #ffffff;min-width:110px;flex-shrink:0;}
.kv3{color: #FFEB3B;}
.kv4{color:#f87171}
.kv5{border-color:#8b2020;background:rgba(139,32,32,.1)}
.kv6{color:#f87171}
.kv7{color:var(--text-faint);font-size:11px;}
.kv8{margin-bottom:16px;}
.kv9{flex:1;min-width:0;}
.kv10,.kv14{font-size:13px;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.kv10 span,.kv14 span{color:var(--gold);font-size:10px;}
.kv11,.kv15{font-size:10px;color:var(--text-faint);font-family:var(--font-mono);}
.kv12{font-size:9px;}
.kv13{flex:1;min-width:0;}


/* ── Граф знаний ─────────────────────────────── */
#knowledge-graph canvas {
  /* border-radius: var(--radius); */
  background-position: 0 0;
  background: radial-gradient(circle at 0% 0%, #000000 0%, transparent 50%), radial-gradient(circle at 100% 100%, #000000 0%, transparent 50%), radial-gradient(circle at 50% 50%, #3c8d57 0%, transparent 70%), linear-gradient(145deg, #000000 0%, #2f6e6f 100%);
}
#tab-content-graph {
  background: #0d1117;
  border-radius: 0 0 var(--radius) var(--radius);
}
/* vis-network tooltip */
.vis-tooltip {
  background: #1a2535 !important;
  border: 1px solid var(--border2) !important;
  color: #ccc !important;
  font-size: 11px !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  max-width: 240px !important;
  white-space: pre-wrap !important;
}