:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #253b37;
  background: #fafbf8;
  font-synthesis: none;
  --green: #245c4e;
  --border: #e2e6df;
  --muted: #7c8982
}

* {
  box-sizing: border-box
}

body {
  margin: 0
}

button,
input,
select,
textarea {
  font: inherit
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent
}

button {
  cursor: pointer
}

button:disabled {
  opacity: .45;
  cursor: not-allowed
}

a {
  color: inherit
}

button {
  color: inherit
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid #2e806a;
  outline-offset: 3px
}

[hidden] {
  display: none !important
}

.layout {
  display: flex;
  height: 100dvh;
  min-height: 400px
}

.sidebar {
  width: 286px;
  flex-shrink: 0;
  padding: 29px 18px 0;
  background: #eef1ea;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  padding: 0 8px;
  white-space: nowrap
}

.brand-mark {
  font-family: Georgia, serif;
  font-size: 28px;
  line-height: 1;
  color: var(--green)
}

.pilot {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: .08em;
  border: 1px solid #ccd5ca;
  border-radius: 4px;
  padding: 3px 5px;
  color: #73816f
}

.new-chat {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 12px 13px;
  margin-top: 31px;
  background: #fafbf8;
  border: 1px solid #d8dfd3;
  border-radius: 9px;
  text-align: left;
  font-size: 13px;
  font-weight: 550
}

.new-chat>span {
  font-size: 22px;
  font-weight: 350
}

kbd {
  font: 10px inherit;
  color: #9ca799;
  margin-left: auto
}

.search {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 15px 8px 12px;
  color: #85917e
}

.search>span {
  font-size: 23px
}

.search input {
  background: transparent;
  border: 0;
  outline: 0;
  width: 100%;
  font-size: 12px;
  color: #435340
}

.history-label {
  font-size: 9px;
  letter-spacing: .12em;
  color: #8a9586;
  padding: 20px 10px 9px;
  font-weight: 600
}

.history {
  overflow: auto;
  flex: 1
}

.history button {
  display: block;
  border: 0;
  background: transparent;
  width: 100%;
  padding: 12px 11px;
  border-radius: 7px;
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #5a6856;
  margin-bottom: 3px
}

.history button:hover,
.history button.active {
  background: #e0e7dc;
  color: #264b3d
}

.history-empty {
  font-size: 12px;
  color: #849080;
  padding: 10px;
  line-height: 1.6
}

.sidebar-bottom {
  padding: 17px 6px 20px;
  border-top: 1px solid #dbe2d6
}

.text-button {
  background: none;
  border: 0;
  font-size: 12px;
  padding: 8px;
  color: #637467;
  border-radius: 6px
}

.text-button:hover {
  background: #e8ede5;
  color: #244d3d
}

.local-profile {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 19px
}

.avatar {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e5ece1;
  color: #477148;
  border-radius: 9px;
  font-size: 17px;
  font-family: Georgia, serif;
  flex-shrink: 0
}

.avatar.small {
  width: 32px;
  height: 32px;
  font: 12px inherit;
  border-radius: 50%;
  background: #dbe5d5
}

.local-profile strong {
  font-size: 11px;
  font-weight: 550;
  display: block
}

.local-profile>div {
  min-width: 0;
}

.local-profile strong,
.local-profile small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 430px;
  padding: 42px 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  text-align: center;
  box-shadow: 0 15px 70px #253b3708;
}

.login-card h1 {
  font: 32px Georgia, serif;
  margin: 18px 0;
}

.login-card p {
  color: #788774;
  font-size: 13px;
  line-height: 1.9;
}

.login-card small {
  display: block;
  color: #95a08f;
  font-size: 10px;
  margin-top: 24px;
}

.google-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
  padding: 13px;
  border: 1px solid #d8e1d1;
  border-radius: 9px;
  text-decoration: none;
  font-size: 14px;
}

.google-login:hover {
  background: #f2f6ee;
}

.google-login span {
  font-weight: 700;
  font-size: 20px;
  color: #4265a3;
}

#login-error {
  color: #a35e49;
  background: #fbf0e7;
  padding: 12px;
  border-radius: 8px;
}

.local-profile small {
  display: block;
  font-size: 9px;
  color: #8a9586;
  margin-top: 3px
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative
}

.topbar {
  height: 86px;
  padding: 20px 35px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid #edf0e9;
  flex-shrink: 0
}

.model-picker {
  min-width: 0;
  max-width: 440px
}

.model-picker label {
  display: block;
  font-size: 8px;
  letter-spacing: .13em;
  color: #8c988b;
  margin-bottom: 4px
}

.model-picker select {
  background: transparent;
  border: 0;
  color: #334d3c;
  font-size: 13px;
  font-weight: 600;
  max-width: 100%;
  padding: 2px 18px 2px 0;
  outline-color: #568d71;
  cursor: pointer
}

.connection {
  font-size: 10px;
  color: #6e836e;
  white-space: nowrap;
  border-radius: 20px;
  padding: 5px 8px;
  background: #f0f4ec
}

.connection.offline {
  background: #faf0dc;
  color: #9d7634
}

.connection:before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  margin-right: 6px
}

.top-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: auto
}

.icon-button {
  border: 0;
  background: transparent;
  font-size: 20px;
  padding: 5px 8px;
  color: #71846e;
  border-radius: 7px
}

.icon-button:hover {
  background: #edf1e9
}

.mobile-menu {
  display: none
}

.conversation-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 35px;
  border-bottom: 1px solid #edf0e9;
  min-height: 45px
}

.conversation-bar>span {
  margin-right: auto;
  font-size: 12px;
  color: #788474;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.danger {
  color: #a16255
}

.shared-banner {
  padding: 14px 30px;
  background: #eaf0e6;
  font-size: 12px;
  color: #536b4c
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth
}

.welcome {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(35px, 8vh, 90px) 35px 30px;
  text-align: center
}

.welcome-symbol {
  display: flex;
  width: 59px;
  height: 64px;
  align-items: center;
  justify-content: center;
  margin: 0 auto 23px;
  color: #2f624f;
  border: 1px solid #dfe7d7;
  border-radius: 18px;
  background: linear-gradient(135deg, #edf2e7, #f9faf6);
  font: 37px Georgia, serif
}

.eyebrow {
  font-size: 9px;
  letter-spacing: .15em;
  color: #91a086;
  font-weight: 600
}

.welcome h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(30px, 3.5vw, 43px);
  letter-spacing: -.03em;
  line-height: 1.2;
  margin: 17px 0;
  color: #2f4b3b
}

.welcome p {
  color: #889480;
  font-size: 13px;
  line-height: 1.9;
  margin: 0
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 34px
}

.suggestions button {
  background: #f8faf4;
  border: 1px solid #e1e7d9;
  border-radius: 11px;
  padding: 18px 17px;
  text-align: left;
  font-size: 12px;
  line-height: 1.6;
  color: #586e4d;
  min-height: 106px;
  transition: border-color .15s, transform .15s
}

.suggestions button:before {
  content: "↗";
  display: block;
  color: #94a78a;
  font-size: 16px;
  margin-bottom: 10px
}

.suggestions button:hover {
  border-color: #a0b699;
  transform: translateY(-2px)
}

.workspace-note {
  margin-top: 28px;
  color: #9aa692;
  font-size: 10px
}

.dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #739969;
  vertical-align: middle;
  margin-right: 7px
}

.messages {
  max-width: 860px;
  margin: 0 auto;
  padding: 26px 35px 40px
}

.message {
  margin-bottom: 30px
}

.message.user {
  display: flex;
  justify-content: flex-end
}

.user .message-content {
  background: #edf1e7;
  border: 1px solid #e4eade;
  border-radius: 18px 18px 4px 18px;
  padding: 13px 20px;
  max-width: 85%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.75;
  color: #3b5039
}

.assistant-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600
}

.assistant-heading small {
  flex-shrink: 0;
  margin-left: auto;
  font-weight: 400;
  color: #8b9784;
  font-size: 10px
}

.response-model {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant .message-content {
  padding-left: 40px;
  font-size: 14px;
  line-height: 1.9;
  color: #43513e;
  overflow-wrap: anywhere
}

.message-content p {
  margin: 0 0 14px;
  white-space: pre-wrap
}

.message-content p:last-child {
  margin-bottom: 0
}

.message-content h2,
.message-content h3,
.message-content h4 {
  font-size: 16px;
  color: #334d36;
  line-height: 1.5;
  margin: 22px 0 9px
}

.message-content ul,
.message-content ol {
  padding-left: 23px
}

.message-content li {
  padding-left: 3px;
  margin-bottom: 5px
}

.message-content pre,
details pre {
  background: #eef1e9;
  border: 1px solid #dfe6d8;
  padding: 14px;
  border-radius: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.7;
  max-height: 420px;
  overflow: auto
}

.message-content code {
  font-size: 12px;
  background: #eef1e9;
  border-radius: 3px;
  padding: 2px 4px
}

.message-content pre code {
  padding: 0;
  background: none
}

.message-content blockquote {
  border-left: 3px solid #bacbb0;
  padding: 3px 15px;
  color: #7a8a6f;
  margin-left: 0
}

.message-content a {
  color: #2d755b
}

.message-actions {
  display: flex;
  gap: 5px;
  margin: 12px 0 0 32px;
  align-items: center;
  flex-wrap: wrap
}

.message-actions .text-button {
  font-size: 10px
}

.message-actions details {
  font-size: 10px;
  color: #86917e;
  max-width: 100%
}

.message-actions summary {
  cursor: pointer;
  padding: 7px
}

.message-actions pre {
  max-width: 680px
}

.generation-error {
  margin: 5px 0 24px 40px;
  padding: 14px;
  background: #faf1e8;
  border: 1px solid #ead6bd;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.8;
  color: #946a47
}

.generation-error button {
  margin-top: 7px;
  display: block
}

.typing {
  color: #a3b29b;
  padding: 6px 0;
  letter-spacing: 4px
}

.composer-area {
  max-width: 860px;
  width: 100%;
  align-self: center;
  padding: 0 35px 16px;
  flex-shrink: 0
}

.composer {
  border: 1px solid #dbe2d3;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 3px 16px #31432206;
  padding: 16px 17px 11px
}

.composer:focus-within {
  border-color: #98b08c;
  box-shadow: 0 0 0 3px #7094690b
}

.composer textarea {
  display: block;
  border: 0;
  outline: 0;
  resize: none;
  max-height: 180px;
  min-height: 30px;
  line-height: 1.65;
  width: 100%;
  color: #3d5038;
  font-size: 13px;
  background: transparent
}

.composer textarea::placeholder {
  color: #a3ae9c
}

.composer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 9px
}

.composer-bottom>span {
  font-size: 10px;
  color: #8a9980
}

.composer-bottom>div {
  display: flex;
  gap: 15px;
  align-items: center
}

.composer-bottom small {
  font-size: 9px;
  color: #b0b8a9
}

.composer-bottom button {
  border: 0;
  border-radius: 9px;
  width: 33px;
  height: 33px;
  background: #2c634e;
  color: #fff;
  font-size: 20px;
  transition: background .15s
}

.composer-bottom button:hover {
  background: #1f4e3d
}

.composer-bottom button#stop-button {
  font-size: 12px;
  background: #756746
}

.notice {
  text-align: center;
  color: #a2ac99;
  font-size: 9px;
  line-height: 1.6;
  padding: 0 10px;
  margin: 11px 0 0
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0
}

dialog {
  border: 1px solid #dbe3d3;
  border-radius: 18px;
  padding: 28px;
  max-width: 580px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 100px #26362430;
  background: #fafbf7;
  color: #3e5538
}

dialog::backdrop {
  background: #22321a40;
  backdrop-filter: blur(3px)
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center
}

.dialog-heading h2 {
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 400;
  margin: 8px 0 15px
}

.muted {
  font-size: 12px;
  color: #88957f;
  line-height: 1.8
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 22px
}

dialog label {
  font-size: 11px;
  color: #66795a;
  display: block
}

dialog input {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: #fff;
  border: 1px solid #dce4d4;
  border-radius: 7px;
  padding: 10px;
  font-size: 12px;
  color: #45633c;
  outline-color: #7b9970
}

.endpoint {
  padding: 16px 0;
  border-top: 1px solid #e1e7da;
  border-bottom: 1px solid #e1e7da;
  margin: 18px 0;
  font-size: 11px
}

.endpoint strong {
  display: block;
  font-weight: 500
}

.endpoint code {
  display: block;
  margin: 8px 0;
  overflow-wrap: anywhere;
  font-size: 11px;
  color: #839676
}

details summary {
  cursor: pointer;
  font-size: 12px;
  color: #69825b
}

.primary-button {
  background: #2e664e;
  color: white;
  border: 0;
  padding: 11px 19px;
  border-radius: 8px;
  font-size: 12px;
  margin-top: 20px
}

.dialog-actions {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #314a37;
  color: #fff;
  font-size: 12px;
  padding: 13px 20px;
  box-shadow: 0 5px 30px #28321d20;
  border-radius: 10px;
  z-index: 10;
  max-width: calc(100% - 30px);
  line-height: 1.6
}

.readonly .sidebar,
.readonly .model-picker,
.readonly .connection,
.readonly .top-actions,
.readonly .composer-area {
  display: none
}

.readonly .topbar:after {
  content: "ПРАВЕН АСИСТЕНТ / СПОДЕЛЕН РАЗГОВОР";
  font-size: 11px;
  letter-spacing: .08em;
  color: #778e6b
}

.readonly .messages {
  width: 100%
}

@media(min-width:1550px) {
  .welcome {
    padding-top: 13vh
  }
}

@media(max-width:1000px) {
  .sidebar {
    width: 245px
  }

  .brand {
    font-size: 12px;
    gap: 8px
  }

  .topbar {
    padding: 15px 24px;
    gap: 10px
  }

  .connection {
    font-size: 9px
  }

  .suggestions {
    gap: 8px
  }

  .suggestions button {
    padding: 13px;
    font-size: 11px
  }

  .composer-bottom small {
    display: none
  }
}

@media(max-width:760px) {
  .sidebar {
    position: fixed;
    z-index: 5;
    height: 100dvh;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .2s;
    box-shadow: 15px 0 50px #1d321814
  }

  .sidebar.open {
    transform: translateX(0)
  }

  .mobile-menu {
    display: block
  }

  .topbar {
    height: 72px;
    padding: 14px 15px;
    gap: 12px
  }

  .model-picker {
    max-width: calc(100% - 126px)
  }

  .model-picker select {
    font-size: 11px
  }

  .connection {
    position: absolute;
    top: 73px;
    right: 15px;
    z-index: 1;
    font-size: 8px;
    padding: 4px 7px
  }

  .top-actions {
    gap: 3px
  }

  .top-actions .text-button>span {
    display: none
  }

  .welcome {
    padding: 70px 24px 30px
  }

  .welcome h1 {
    font-size: 34px
  }

  .welcome p {
    font-size: 12px
  }

  .suggestions {
    grid-template-columns: 1fr;
    text-align: left;
    margin-top: 25px
  }

  .suggestions button {
    min-height: 0;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 16px;
    font-size: 12px
  }

  .suggestions button:before {
    margin-bottom: 0
  }

  .workspace-note {
    margin-top: 20px
  }

  .messages {
    padding: 30px 18px 15px
  }

  .assistant .message-content {
    padding-left: 0
  }

  .message-actions {
    margin-left: 0
  }

  .generation-error {
    margin-left: 0
  }

  .user .message-content {
    max-width: 95%;
    font-size: 13px
  }

  .composer-area {
    padding: 0 14px 12px
  }

  .composer {
    padding: 12px 14px 9px
  }

  .notice {
    font-size: 8px;
    padding: 0
  }

  .conversation-bar {
    padding: 15px 15px 8px;
    flex-wrap: wrap;
    gap: 2px
  }

  .conversation-bar>span {
    width: 100%;
    margin-bottom: 5px
  }

  .settings-grid {
    grid-template-columns: 1fr 1fr
  }

  .readonly .mobile-menu {
    display: none
  }

  .chat-scroll {
    scroll-behavior: auto
  }
}

@media(prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important
  }
}

.library-button {
  text-align: left;
  margin-top: 12px;
}

.retrieval-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin: 8px 3px;
  color: #7c8a73;
  font-size: 10px;
}

.retrieval-controls label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.retrieval-controls input[type=date] {
  font: inherit;
  border: 1px solid #dfe6d8;
  border-radius: 5px;
  color: #658056;
  background: transparent;
  padding: 3px;
}

.retrieval-controls>span {
  margin-left: auto;
}

.library-dialog {
  max-width: 1050px;
  max-height: 90dvh;
}

.library-dialog > .dialog-heading {
  position: sticky;
  top: 0;
  background: #fafbf7;
  z-index: 2;
  padding-bottom: 8px;
}

#review-info, .source-panel p, .document-card {
  overflow-wrap: anywhere;
}

.library-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.library-layout h3,
#document-review h3 {
  font-size: 15px;
  font-weight: 550;
}

.library-layout form>label {
  margin-bottom: 13px;
}

.library-layout select {
  display: block;
  border: 1px solid #dce4d4;
  border-radius: 7px;
  padding: 9px;
  background: #fff;
  color: #45633c;
  width: 100%;
  margin-top: 8px;
  font-size: 12px;
}

.library-dialog textarea {
  display: block;
  width: 100%;
  border: 1px solid #dce4d4;
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.7;
  background: #fff;
  color: #3f5738;
  margin: 12px 0;
  resize: vertical;
}

.library-search {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.library-search input {
  margin: 0;
}

.document-card {
  border: 1px solid #e0e7d8;
  border-radius: 9px;
  padding: 13px;
  margin: 10px 0;
  font-size: 12px;
}

.document-card .document-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.document-card strong {
  font-weight: 550;
  line-height: 1.6;
}

.document-card small {
  display: block;
  color: #85937a;
  margin: 8px 0;
  font-size: 10px;
}

.document-card input[type=checkbox],
.review-confirm input[type=checkbox] {
  display: inline-block;
  width: auto;
  margin: 0 7px 0 0;
}

.review-confirm {
  display: flex;
  align-items: center;
  line-height: 1.8;
  margin: 15px 0;
}

#document-review {
  border-top: 1px solid #dce4d4;
  margin-top: 25px;
  padding-top: 15px;
}

.source-panel {
  margin: 16px 0 5px 40px;
  font-size: 11px;
  color: #7a8c70;
}

.source-panel summary {
  font-size: 11px;
}

.source-panel details {
  border: 1px solid #e0e7d8;
  border-radius: 8px;
  padding: 10px;
  margin: 8px 0;
}

.source-panel pre {
  white-space: pre-wrap;
  font-size: 11px;
  line-height: 1.8;
  max-height: 250px;
  overflow: auto;
  color: #48633d;
}

.source-panel .source-url {
  font-size: 10px;
  color: #557f46;
  overflow-wrap: anywhere;
}

.source-warning {
  background: #faf1e8;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 11px;
  line-height: 1.8;
  color: #946a47;
}

@media(max-width:760px) {
  .library-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .library-dialog {
    padding: 20px;
  }

  .source-panel {
    margin-left: 0;
  }

  .retrieval-controls {
    font-size: 9px;
    gap: 8px;
  }

  .retrieval-controls>span {
    display: none;
  }
}
