:root {
  --base-spacing: 24px;
  --equal-spacing: var(--base-spacing);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: #f7f9fb;
  color: #333;
  font-size: 14px;
  overflow: hidden;
}

#chat-wrapper {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

#top-buttons {
  position: absolute;
  top: var(--base-spacing);
  left: var(--base-spacing);
  z-index: 10000;
}

#chat-layout {
  display: flex;
  flex-direction: row;
  height: 100%;
  overflow: hidden;
  position: relative;
  padding-left: calc(var(--base-spacing) + 48px); /* ширина кнопок + отступ */
}

#session-sidebar {
  width: 300px;
  background: #f7f9fb !important;
  border-right: none !important;
  padding: var(--base-spacing) 16px 16px var(--base-spacing);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow: hidden;
}

#session-sidebar h3 {
  margin: 0;
  padding-top: 0;
  height: 40px; /* Высота как у кнопки */
  display: flex;
  align-items: center;
}

#session-list {
  list-style: none;
  margin: 0 0 12px;
  flex: 1;
  overflow-y: auto;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
  margin-top: 0;
}

#session-list::-webkit-scrollbar {
  width: 8px;
}

#session-list::-webkit-scrollbar-track {
  background: transparent;
}

#session-list::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

#session-list::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.3);
}

#session-list li {
  padding: 12px 16px;
  background: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
  margin-bottom: 8px;
  color: #1a2c60;
}

#session-list li:first-child {
  margin-top: 0;
}

#session-list li:hover {
  background: #f0f3fb;
}

#session-list li.active {
  background: #e2e6f5;
  font-weight: 500;
}

#new-session {
  padding: 8px 12px;
  font-size: 14px;
  background: #f5f7fd;
  color: #1a2c60;
  border: 1px solid #d0d8ef;
  border-radius: 6px;
  cursor: pointer;
  font-weight: normal;
  margin-top: 8px;
  transition: background 0.2s, color 0.2s;
}

#new-session:hover {
  background: #e2e6f5;
  color: #152050;
}

#chat-widget {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
  padding-left: var(--base-spacing);
}

#chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
}

#chat-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  width: 100%;
}

#messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: var(--base-spacing) 0 180px 0;
  margin: 0;
  box-sizing: border-box;
  max-width: 96%;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
  margin-left: auto;
  margin-right: 0;
}

/* Стили для Webkit (Chrome, Safari, новые версии Edge) */
#messages::-webkit-scrollbar {
  width: 8px;
}

#messages::-webkit-scrollbar-track {
  background: transparent;
}

#messages::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

#messages::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.3);
}

#messages::-webkit-scrollbar-button {
  display: none;
}

.message {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 92%;
  border-radius: 16px;
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  background: #f0f4ff;
  animation: fadeInGrow 0.4s ease forwards;
}

.message.user {
  background: #e0f7e9;
  align-self: flex-end;
  text-align: left;
}

.message.assistant {
  background: #eef1ff;
  align-self: flex-start;
  text-align: left;
}

.message.assistant.wide-message {
  max-width: 100%;
  width: 100%;
  align-self: center;
  padding: 0;
  background: #f5f7fd;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: visible;
  border: 1px solid #d0d8ef;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.message.assistant.wide-message .content-container {
  padding: 0;
  margin: 0;
}

.message.assistant.wide-message iframe {
  display: block;
  width: 100%;
  min-height: 60vh;
  height: 700px;
  max-height: 90vh;
  border: none;
  margin: 0;
  flex-shrink: 0;
}

.text-block {
  display: flex;
  flex-direction: column;
}

.sender {
  font-weight: bold;
  margin-bottom: 4px;
}

.content {
  font-size: 15px;
  line-height: 1.6;
  color: #1a1a1a;
  padding: 0;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
  box-sizing: border-box;
}

.content h3,
.content h2,
.content h1 {
  font-size: 16px;
  font-weight: 700;
  margin: 24px 0 10px;
  color: #1a2c60;
}

/* Стили для нумерованных списков */
.content ol {
  list-style: decimal;
  padding-left: 2em;
  margin: 0.5em 0 1em;
}

/* Стили для маркированных списков */
.content ul {
  list-style: disc;
  padding-left: 2em;
  margin: 0.5em 0 1em;
}

/* Стили для элементов списка */
.content li {
  margin: 0.5em 0;
  padding-left: 0.5em;
}

/* Стили для вложенных списков */
.content li > ul {
  margin: 0.5em 0;
  list-style-type: circle;
}

.content li > ul > li > ul {
  list-style-type: square;
}

/* Стили для вложенных нумерованных списков */
.content li > ol {
  margin: 0.5em 0;
  list-style-type: lower-alpha;
}

.content li > ol > li > ol {
  list-style-type: lower-roman;
}

/* Убираем отступ сверху у первого вложенного списка */
.content li > ul:first-child,
.content li > ol:first-child {
  margin-top: 0;
}

/* Убираем отступ снизу у последнего вложенного списка */
.content li > ul:last-child,
.content li > ol:last-child {
  margin-bottom: 0;
}

.content strong {
  font-weight: 600;
  color: #000;
}

.content em {
  font-style: normal;
  font-weight: 600;
  color: #2a3b7d;
}

.content p {
  margin: 10px 0;
}

/* Стили для таблиц в сообщениях */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  background: white;
  table-layout: fixed;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.content table th,
.content table td {
  padding: 8px;
  border: 1px solid #ccc;
  vertical-align: top;
}

.content table th {
  font-weight: bold;
  background: #f5f7fd;
}

.content table tr td[style*="background"] {
  padding: 12px;
}

#input-area {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  padding: 8px 0;
  background: rgba(255,255,255,0.1);
  border-top: none;
  box-shadow: none !important;
  max-width: 720px;
  width: calc(100% - var(--base-spacing) * 2);
  max-height: 40vh;
  display: flex;
  flex-direction: column;
}

#input-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 0 0 1px #ccc;
  padding: 6px 14px;
  position: relative;
  min-height: 56px;
  box-sizing: border-box;
}

#user-input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 8px 6px;
  border: none;
  outline: none;
  font-size: 14px;
  line-height: 20px;
  background: transparent;
  resize: none;
  height: 40px;
  min-height: 40px;
  max-height: calc(40vh - 80px);
  overflow-y: hidden;
  transition: height 0.15s;
  box-sizing: border-box;
  display: block;
  white-space: pre-wrap;
  word-wrap: break-word;
}

#user-input::placeholder {
  color: #888;
  opacity: 1;
}

#user-input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#top-buttons button {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 18px;
  font-weight: bold;
  background: #ffffff;
  border: 1px solid #d0d8ef;
  border-radius: 8px;
  cursor: pointer;
  color: #1a2c60;
  box-shadow: none;
  transition: background 0.2s ease;
}

#top-buttons button:hover {
  background: #f0f3fb;
}

#toggle-sessions-button {
  margin-bottom: 0;
}

#buttons {
  display: flex;
  flex-direction: row;
  gap: 5px;
  align-items: center;
  padding: 4px 0;
}

#buttons button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  background: transparent;
  box-shadow: none;
  transition: all 0.2s ease;
  color: #1a2c60;
}

#buttons button:hover {
  background: #f0f3fb;
}

#buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#send-button {
  background: transparent !important;
  color: #000 !important;
  transform: none;
  border: none !important;
  position: relative;
  width: 48px !important;
  height: 48px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
}

#send-button:hover {
  background: #f0f3fb !important;
}

#send-button svg {
  width: 48px;
  height: 48px;
  fill: currentColor;
  transform: rotate(90deg);
}

#send-button:hover svg {
  opacity: 0.8;
}

#file-upload-button svg {
  width: 18px !important;
  height: 18px !important;
  stroke: currentColor;
}

.copy-button {
  position: absolute;
  right: -11px;
  bottom: -11px;
  width: 26px;
  height: 26px;
  background: #fff;
  border-radius: 50%;
  border: 1.5px solid #e0e4f1;
  box-shadow: 0 1px 8px 0 rgba(50,50,90,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.19s, background 0.13s, box-shadow 0.14s;
  z-index: 9;
  padding: 0;
}

.copy-button:hover {
  background: #eaf0fb;
  opacity: 1;
  box-shadow: 0 2px 12px 0 rgba(50,60,120,0.18);
}

.copy-button svg {
  width: 15px;
  height: 15px;
  color: #6c6c80;
  pointer-events: none;
}

.message:hover .copy-button {
  opacity: 0.75;
}

.iframe-button-block {
  margin: 8px 0;
}

.open-iframe-btn {
  display: inline-block;
  width: auto;
  min-width: 200px;
  padding: 8px 16px;
  font-size: 14px;
  background: #e2e6f5;
  border: 1px solid #b3bedf;
  border-radius: 8px;
  cursor: pointer;
  color: #1a2c60;
  font-weight: 500;
  text-align: left;
  margin: 0;
  transition: background 0.2s, color 0.2s;
}

.open-iframe-btn:hover {
  background: #d5dbee;
}

.open-iframe-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Специальные стили для кнопок в списках */
.content li .iframe-button-block {
  margin: 4px 0;
}

.content li .open-iframe-btn {
  width: 100%;
  display: block;
}

#file-list {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  margin: 0;
  min-height: 28px;
  max-width: 100%;
  flex-wrap: wrap;
  padding: 0 0 4px 4px;
  overflow-y: auto;
  max-height: 80px;
}

.uploaded-file {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #e2e6f5;
  border-radius: 7px;
  padding: 3px 10px 3px 8px;
  font-size: 13px;
  color: #1a2c60;
  max-width: 180px;
  overflow: hidden;
}

.uploaded-file .file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
}

.remove-file-btn {
  background: none;
  border: none;
  color: #F44336;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  margin-left: 2px;
  transition: color 0.12s;
}

.remove-file-btn:hover {
  color: #b60000;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes fadeInGrow {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 768px) {
  #chat-layout {
    flex-direction: column;
  }

  #session-sidebar {
    display: none;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    border-right: none;
    border-bottom: none !important;
  }

  #chat-widget {
    border-radius: 0 !important;
    width: 100%;
    z-index: 1;
    height: calc(100dvh - 44px);
    padding-left: 0;
  }

  #chat-inner {
    padding: 0 12px;
  }

  #messages {
    max-width: 100%;
    padding: var(--base-spacing) var(--base-spacing) 180px var(--base-spacing);
    margin: 0;
  }

  .message {
    max-width: 100% !important;
  }

  .message.user {
    margin-left: auto;
    margin-right: 0;
  }

  .message.assistant {
    margin-left: 0;
    margin-right: auto;
  }

  #input-area {
    padding: 8px var(--base-spacing);
  }

  #user-input {
    font-size: 13px;
  }

  #buttons button {
    min-width: 48px !important;
    min-height: 48px !important;
  }

  #buttons svg {
    width: 48px !important;
    height: 48px !important;
  }

  #file-upload-button svg {
    width: 24px !important;
    height: 24px !important;
  }

  #chat-layout {
    padding-left: 0;
  }

  #chat-container {
    width: 100%;
    max-width: none;
  }
}

#session-sidebar.hidden {
  display: none !important;
}

#session-sidebar.hidden ~ #chat-widget {
  padding-left: var(--base-spacing);
}

#session-sidebar.hidden + #chat-widget #messages {
  padding-left: var(--base-spacing);
}

/* Улучшенные стили когда сайдбар скрыт */
#session-sidebar.hidden ~ #chat-widget #chat-container {
  max-width: 1600px;
}

#session-sidebar.hidden ~ #chat-widget #messages {
  max-width: 98%;
}

#session-sidebar.hidden ~ #chat-widget .message {
  max-width: 95%;
}

/* Стили для широких экранов когда сайдбар скрыт */
@media (min-width: 1440px) {
  #session-sidebar.hidden ~ #chat-widget #chat-container {
    max-width: 1800px;
  }
  
  #session-sidebar.hidden ~ #chat-widget #messages {
    max-width: 98%;
  }
  
  #session-sidebar.hidden ~ #chat-widget .message {
    max-width: 96%;
  }
}

@media (min-width: 2560px) {
  #session-sidebar.hidden ~ #chat-widget #chat-container {
    max-width: 2200px;
  }
  
  #session-sidebar.hidden ~ #chat-widget #messages {
    max-width: 98%;
  }
  
  #session-sidebar.hidden ~ #chat-widget .message {
    max-width: 97%;
  }
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #90959f;
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.4s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes typing {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.message table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 16px 0 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    background: #fff !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e0e4f1 !important;
}

.message table tbody {
    display: table-row-group !important;
}

.message table tr {
    display: table-row !important;
}

.message table tr:first-child {
    background: #f5f7fd !important;
}

.message table tr:first-child th {
    color: #1a2c60 !important;
    font-weight: 600 !important;
    padding: 12px 16px !important;
    text-align: left !important;
    border-bottom: 2px solid #e0e4f1 !important;
    white-space: normal !important;
    display: table-cell !important;
    background: #f5f7fd !important;
}

.message table td {
    padding: 12px 16px !important;
    border-bottom: 1px solid #e0e4f1 !important;
    color: #333 !important;
    vertical-align: top !important;
    display: table-cell !important;
    white-space: normal !important;
    word-wrap: break-word !important;
}

.message table tr:last-child td {
    border-bottom: none !important;
}

.message table tbody tr:not(:first-child):nth-child(even) {
    background: #f8faff !important;
}

.message table tbody tr:not(:first-child):hover {
    background: #f0f3fb !important;
}

.message table tr:first-child th:first-child,
.message table td:first-child {
    padding-left: 24px !important;
}

.message table tr:first-child th:last-child,
.message table td:last-child {
    padding-right: 24px !important;
}

/* Стили для мобильных устройств */
@media (max-width: 768px) {
    .message table {
        margin: 12px -12px !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }

    .message table tr:first-child th,
    .message table td {
        padding: 10px 12px !important;
        font-size: 13px !important;
    }

    .message table tr:first-child th:first-child,
    .message table td:first-child {
        padding-left: 16px !important;
    }

    .message table tr:first-child th:last-child,
    .message table td:last-child {
        padding-right: 16px !important;
    }
}

/* Стили для двухколоночных таблиц */
.message .table-wrapper table.two-columns {
    table-layout: fixed !important;
}

.message .table-wrapper table.two-columns th,
.message .table-wrapper table.two-columns td {
    width: 50% !important;
}

@media (min-width: 1440px) {
  #chat-container {
    max-width: 1600px;
  }
  
  #messages {
    max-width: 98%;
    padding: var(--base-spacing) 0 180px 0;
  }
  
  #input-area {
    max-width: 1200px;
    margin: 0 auto;
  }
  
  .message {
    max-width: 95%;
  }
  
  .content {
    font-size: 15px;
    line-height: 1.6;
  }
}

@media (min-width: 2560px) {
  #chat-wrapper {
    max-width: 1800px;
    margin: 0 auto;
    justify-content: center;
  }

  #chat-layout {
    max-width: 1800px;
    margin: 0 auto;
    justify-content: center;
  }

  #chat-widget {
    display: flex;
    justify-content: center;
    max-width: 1500px;
    margin: 0 auto;
  }

  #chat-container {
    max-width: 1500px;
    width: 100%;
    margin: 0 auto;
  }

  #messages {
    max-width: 98%;
    margin: 0 auto;
  }

  #input-area {
    left: 50%;
    transform: translateX(-50%);
    max-width: 1000px;
  }

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

/* Дополнительные стили для ультраширких экранов */
@media (min-width: 3440px) {
  #chat-wrapper {
    max-width: 2400px;
  }

  #chat-layout {
    max-width: 2400px;
  }

  #chat-widget {
    max-width: 2100px;
  }

  #chat-container {
    max-width: 2100px;
  }

  #messages {
    max-width: 98%;
  }

  #input-area {
    max-width: 1400px;
  }

  .message {
    max-width: 96%;
  }
}

#session-list::-webkit-scrollbar-button {
  display: none;
}

.content li .iframe-button-block {
  margin: 8px 0;
}

.content li .open-iframe-btn {
  width: auto;
  min-width: 200px;
  padding: 8px 16px;
  font-size: 14px;
  text-align: left;
}

/* Медиа-запросы для мобильных устройств - уменьшенные шрифты */
@media (max-width: 768px) {
    /* Основной размер шрифта для body */
    html, body {
        font-size: 12px; /* было 14px */
    }
    
    /* Сайдбар и сессии */
    #session-list li {
        font-size: 12px; /* было 14px */
        padding: 10px 14px; /* немного уменьшен отступ */
    }
    
    #new-session {
        font-size: 12px; /* было 14px */
        padding: 6px 10px; /* уменьшен отступ */
    }
    
    /* Контент сообщений */
    .content {
        font-size: 13px; /* было 15px */
        line-height: 1.5; /* немного уменьшена высота строки */
    }
    
    /* Заголовки в сообщениях */
    .content h3,
    .content h2,
    .content h1 {
        font-size: 14px; /* было 16px */
        margin: 16px 0 8px; /* уменьшены отступы */
    }
    
    /* Таблицы в сообщениях */
    .content table {
        font-size: 12px; /* было 14px */
        margin: 12px 0; /* уменьшены отступы */
    }
    
    .content table th,
    .content table td {
        padding: 6px; /* было 8px */
        font-size: 12px;
    }
    
    /* Поле ввода */
    #user-input {
        font-size: 12px; /* было 14px */
        line-height: 18px; /* было 20px */
        padding: 6px 4px; /* уменьшен отступ */
        height: 36px; /* было 40px */
        min-height: 36px;
    }
    
    #user-input::placeholder {
        font-size: 12px;
    }
    
    /* Кнопки */
    .open-iframe-btn {
        font-size: 12px; /* было 14px */
        padding: 6px 12px; /* было 8px 16px */
        min-width: 150px; /* было 200px */
    }
    
    /* Отправка сообщений */
    .button-group button {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    /* Адаптивность для сайдбара на мобильных */
    #session-sidebar {
        width: 250px; /* было 300px */
        padding: 16px 12px 12px 16px; /* уменьшены отступы */
    }
    
    #session-sidebar h3 {
        font-size: 14px;
        height: 36px; /* было 40px */
    }
    
    /* Отступы для области сообщений */
    #messages {
        padding: 16px 0 140px 0; /* было 24px 0 180px 0 */
        gap: 12px; /* было 16px */
    }
    
    /* Область ввода */
    #input-area {
        padding: 6px 0; /* было 8px 0 */
        max-height: 35vh; /* было 40vh */
    }
    
    #input-wrapper {
        min-height: 48px; /* было 56px */
        padding: 4px 12px; /* было 6px 14px */
        border-radius: 20px; /* было 24px */
    }
}

/* Медиа-запросы для планшетов (769px - 1024px) - промежуточные размеры шрифтов */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Основной размер шрифта */
    html, body {
        font-size: 13px; /* промежуточный размер */
    }
    
    /* Сайдбар и сессии */
    #session-list li {
        font-size: 13px;
        padding: 11px 15px;
    }
    
    #new-session {
        font-size: 13px;
        padding: 7px 11px;
    }
    
    /* Контент сообщений */
    .content {
        font-size: 14px; /* промежуточный размер между мобильным и десктопным */
        line-height: 1.55;
    }
    
    /* Заголовки */
    .content h3,
    .content h2,
    .content h1 {
        font-size: 15px;
        margin: 20px 0 9px;
    }
    
    /* Таблицы */
    .content table {
        font-size: 13px;
        margin: 14px 0;
    }
    
    .content table th,
    .content table td {
        padding: 7px;
        font-size: 13px;
    }
    
    /* Поле ввода */
    #user-input {
        font-size: 13px;
        line-height: 19px;
        padding: 7px 5px;
        height: 38px;
        min-height: 38px;
    }
    
    #user-input::placeholder {
        font-size: 13px;
    }
    
    /* Кнопки */
    .open-iframe-btn {
        font-size: 13px;
        padding: 7px 14px;
        min-width: 175px;
    }
    
    /* Сайдбар планшетный */
    #session-sidebar {
        width: 280px; /* промежуточная ширина */
        padding: 20px 14px 14px 20px;
    }
    
    #session-sidebar h3 {
        font-size: 15px;
        height: 38px;
    }
    
    /* Область сообщений */
    #messages {
        padding: 20px 0 160px 0;
        gap: 14px;
    }
    
    /* Область ввода */
    #input-area {
        padding: 7px 0;
        max-height: 38vh;
    }
    
    #input-wrapper {
        min-height: 52px;
        padding: 5px 13px;
        border-radius: 22px;
    }
}

/* Стили для группировки сессий по времени */
.session-group-header {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 16px;
  margin-bottom: 8px;
  padding-left: 4px;
}

.session-group-header:first-child {
  margin-top: 0;
}

.session-group {
  display: flex;
  flex-direction: column;
}

.session-item {
  padding: 12px 16px !important;
  background: #ffffff !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: background 0.2s !important;
  font-size: 14px !important;
  margin-bottom: 8px !important;
  color: #1a2c60 !important;
  list-style: none !important;
}

.session-item:hover {
  background: #f0f3fb !important;
}

.session-item.active {
  background: #e2e6f5 !important;
  font-weight: 500 !important;
}

/* Убираем лишние отступы для первого элемента в группе */
.session-group .session-item:first-child {
  margin-top: 0;
}

/* Адаптация для мобильных устройств */
@media (max-width: 768px) {
  .session-group-header {
    font-size: 11px;
    margin-top: 12px;
    margin-bottom: 6px;
  }
  
  .session-item {
    font-size: 12px !important;
    padding: 10px 14px !important;
  }
}

/* Адаптация для планшетов */
@media (min-width: 769px) and (max-width: 1024px) {
  .session-group-header {
    font-size: 11px;
    margin-top: 14px;
    margin-bottom: 7px;
  }
  
  .session-item {
    font-size: 13px !important;
    padding: 11px 15px !important;
  }
}

.message .table-wrapper table.two-columns th,
.message .table-wrapper table.two-columns td {
  width: 50%;
}

/* Дополнительные стили для обработки переполнения */
.content a {
  word-break: break-all;
  overflow-wrap: break-word;
}

.content code {
  word-break: break-all;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.content pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow-x: auto;
}

.content ul, .content ol {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.content li {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Language Switcher Styles */
#language-switcher-wrapper {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 10000;
}

.language-switcher {
  display: inline-flex;
  gap: 4px;
  background: #ffffff;
  border: 1px solid #d0d8ef;
  border-radius: 8px;
  padding: 4px;
}

.lang-button {
  all: unset;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1a2c60;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-button:hover {
  background: #f0f3fb;
}

.lang-button.active {
  background: #e2e6f5;
  color: #152050;
}

#top-buttons {
  position: fixed;
  top: 16px;
  left: 20px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 8px;
}

#top-buttons .button-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

#toggle-sessions-button,
#reset-button {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #d0d8ef;
  border-radius: 8px;
  cursor: pointer;
  color: #1a2c60;
  transition: background 0.2s ease;
}

#toggle-sessions-button:hover,
#reset-button:hover {
  background: #f0f3fb;
}

#reset-button svg {
  display: block;
}

/* Адаптивность для переключателя языков */
@media (max-width: 768px) {
  #language-switcher-wrapper {
    top: 12px;
    right: 12px;
  }
  
  .language-switcher {
    padding: 3px;
  }
  
  .lang-button {
    padding: 5px 10px;
    font-size: 11px;
  }
} 