/* ── Main area ────────────────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── Topbar ───────────────────────────────────────────────────── */
#topbar {
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
  background: var(--surface);
}

#session-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  cursor: text;
}

#session-title:focus {
  color: var(--accent);
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent2);
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border: 1px solid var(--accent2);
  border-radius: 20px;
  opacity: 0.7;
}

/* ── Chat ─────────────────────────────────────────────────────── */
#chat {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.welcome {
  margin: auto;
  text-align: center;
  color: var(--text-dim);
  padding: 40px 20px;
  max-width: 340px;
}

.welcome-icon {
  font-size: 36px;
  margin-bottom: 16px;
  display: block;
}

.welcome h2 {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.welcome p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
}

/* ── Wiadomości ───────────────────────────────────────────────── */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  animation: fadeUp 0.2s ease forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-role {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 5px;
  color: var(--text-dim);
}

.msg.user .msg-role { color: var(--accent); }
.msg.assistant .msg-role { color: var(--accent2); }

.msg-bubble {
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg.user .msg-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}

.msg.assistant .msg-bubble {
  background: rgba(80, 208, 255, 0.05);
  border: 1px solid rgba(80, 208, 255, 0.15);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* Typing indicator */
.typing {
  display: flex;
  gap: 5px;
  padding: 14px 16px;
  align-items: center;
}

.typing span {
  width: 6px; height: 6px;
  background: var(--accent2);
  border-radius: 50%;
  animation: blink 1.2s ease-in-out infinite;
}

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

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* ── Input area ───────────────────────────────────────────────── */
#input-area {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

#input-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color var(--trans);
}

#input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(232, 255, 80, 0.08);
}

#msg-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  resize: none;
  min-height: 22px;
  max-height: 140px;
  line-height: 1.5;
  overflow-y: auto;
}

#msg-input::placeholder { color: var(--muted); }
#msg-input:disabled { opacity: 0.5; }

#btn-send {
  background: var(--accent);
  border: none;
  border-radius: 4px;
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--trans);
  color: #0d0f10;
}

#btn-send:hover:not(:disabled) { filter: brightness(1.15); }
#btn-send:disabled { opacity: 0.35; cursor: default; }

#btn-send svg { width: 16px; height: 16px; }

.hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 7px;
  font-family: var(--font-mono);
}

/* ── Puste miejsce ────────────────────────────────────────────── */
#no-session {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-dim);
}

#no-session .big { font-size: 48px; }
#no-session h2 {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
}

#no-session p { font-size: 12px; color: var(--muted); }

#mode-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.mode-tab { background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 12px; color: var(--text-dim);
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.08em; cursor: pointer; transition: var(--trans); }
.mode-tab.active { background: var(--accent); color: #0d0f10; border-color: var(--accent); }
#url-inputs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.url-row { display: flex; gap: 6px; align-items: center; }
.url-row input { flex: 1; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px; color: var(--text);
  font-size: 13px; outline: none; }
.url-row input:focus { border-color: var(--accent); }
.url-row .btn-remove-url { background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 4px; line-height: 1; }
.url-row .btn-remove-url:hover { color: var(--danger); }
#btn-add-url-row { background: none; border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 6px; color: var(--text-dim);
  font-family: var(--font-mono); font-size: 10px; cursor: pointer; width: 100%;
  transition: var(--trans); }
#btn-add-url-row:hover { border-color: var(--accent); color: var(--accent); }