:root {
  --bg: #0f1115;
  --panel: #161a22;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --border: #262b36;
  --accent: #4f8cff;
  --btn-bg: #1b2130;
  --btn-text: #e8eaf0;
}

body.theme-light {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #0d1117;
  --muted: #57606a;
  --border: #e2e8f0;
  --accent: #1f6feb;
  --btn-bg: #e7ebf4;
  --btn-text: #0d1117;
}

* { box-sizing: border-box; padding: 0; margin: 0; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

textarea:focus-visible{outline: 2px solid var(--border); border: none;}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel);
  position: sticky; top: 0; z-index: 10;
}
.branding { font-weight: 700; }
.controls { display: flex; gap: 8px; }
#lang, #themeToggle, #saveSys, #clearBtn, #sendBtn {
  background: var(--btn-bg); color: var(--btn-text); border: 1px solid var(--border);
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
#lang { padding: 8px 12px; }

.container { max-width: 900px; margin: 0 auto; padding: 16px; display: grid; gap: 12px; }
.panel { display:none; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.panel-actions { display: flex; gap: 8px; margin-top: 8px; }

.chat { display: flex; flex-direction: column; gap: 10px; height: 78vh; overflow: auto; padding: 12px;
        background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }

.msg { display: grid; grid-template-columns: 80px 1fr; gap: 6px 10px; }
.role { color: var(--muted); font-size: 12px; padding-top: 4px; text-align: right; }
.bubble {
  background: transparent; border: 1px solid var(--border); border-radius: 10px; padding: 10px;
  white-space: pre-wrap; word-wrap: break-word;
}
.msg.user .bubble { border-color: color-mix(in oklab, var(--accent) 40%, var(--border)); }
.msg.assistant .bubble { border-color: var(--border); }
.assistant{display: flex; flex-direction: row-reverse;justify-content: start;}


.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
#input, #sysPrompt {
  width: 100%; height: 100%; background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px; resize: vertical;
}
#sendBtn { padding: 10px 14px; }
.composer-actions {
  display: flex;
  gap: 8px;
}
.input-row {
  display: flex;
  flex-direction: column; /* текстовое поле сверху */
  gap: 10px;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr ;
  gap: 10px;
}

#sendBtn, #clearBtn {
  padding: 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

::-webkit-scrollbar{
  width: 20px;
  height: 20px;
  background: var(--border);
  border-radius: 8px;

}

::-webkit-scrollbar-thumb{
  width: 100%;
   background: var(--panel);
   border-radius: 8px;
   border: 2px solid var(--border);
}

::-webkit-scrollbar-thumb:active{
   background: var(--btn-bg);
   border: 2px solid var(--border);
}

.night-mode-to-light{
  filter: invert(100%);
}

.welcome {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  max-width: 400px;
  padding: 20px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 0.95rem;
}
.welcome.hidden {
  display: none;
}

#chatList li.assistant h3{margin:6px 0 4px;font-size:16px}
#chatList li.assistant ul{margin:6px 0 10px 18px;padding:0}
#chatList li.assistant li{margin:4px 0}
#chatList li.assistant hr{border:0;border-top:1px solid #1c2128;margin:8px 0}

.bubble ul{
  margin-left: 5%;
}

.disclaimer {
  font-size: 12px;
  color: #888;
  margin-top: 6px;
  text-align: center;
}
