* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #17212b;
  color: #e6ecf2;
}
.hidden { display: none !important; }

/* ---------- логин ---------- */
.login-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: #1e2a37;
  padding: 40px;
  border-radius: 12px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
.login-box h1 { margin: 0 0 10px; font-size: 20px; text-align: center; }
.login-box input {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #2b3947;
  background: #17212b;
  color: #e6ecf2;
  font-size: 15px;
}
.login-box button {
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #2ea6ff;
  color: white;
  font-size: 15px;
  cursor: pointer;
}
.login-box button:hover { background: #4ab3ff; }
.error-text { color: #ff6b6b; font-size: 13px; min-height: 16px; }

/* ---------- приложение ---------- */
.app {
  display: flex;
  height: 100vh;
}
.sidebar {
  width: 260px;
  background: #1e2a37;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #0f1620;
  flex-shrink: 0;
}
.sidebar-header {
  padding: 20px;
  font-size: 17px;
  font-weight: 600;
  border-bottom: 1px solid #0f1620;
}
.sidebar nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 4px;
  overflow-y: auto;
}
.nav-btn {
  text-align: left;
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #b8c6d4;
  font-size: 14px;
  cursor: pointer;
}
.nav-btn:hover { background: #26333f; }
.nav-btn.active { background: #2ea6ff; color: white; }
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid #0f1620;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #8296a8;
}
.sidebar-footer button {
  background: none;
  border: 1px solid #3a4a5a;
  color: #b8c6d4;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

.content {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
}
.tab { display: none; height: 100%; flex-direction: column; }
.tab.active { display: flex; }
.tab h2 { margin-top: 0; }

/* ---------- чат ---------- */
.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 16px;
}
.msg {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.45;
}
.msg-user { align-self: flex-end; background: #2b5278; }
.msg-assistant { align-self: flex-start; background: #232e3c; }
.msg-error { align-self: flex-start; background: #4a2020; }
.msg-meta { font-size: 11px; color: #8296a8; margin-top: 6px; }
.msg-pending { align-self: flex-start; background: #232e3c; opacity: .6; font-style: italic; }

.chat-input-row {
  display: flex;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #232e3c;
}
.chat-input-row textarea {
  flex: 1;
  resize: none;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #2b3947;
  background: #1e2a37;
  color: #e6ecf2;
  font-size: 14px;
  font-family: inherit;
}
.chat-input-row button {
  padding: 0 24px;
  border: none;
  border-radius: 8px;
  background: #2ea6ff;
  color: white;
  cursor: pointer;
  font-size: 14px;
}
.chat-input-row button:disabled { background: #3a4a5a; cursor: not-allowed; }

/* ---------- карточки/списки ---------- */
.card {
  background: #1e2a37;
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 16px;
  line-height: 1.8;
}
.list-item {
  background: #1e2a37;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.list-item .meta { font-size: 12px; color: #8296a8; margin-top: 4px; }
.list-item button {
  background: #4a2020;
  border: none;
  color: #ff9b9b;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.pre-box {
  background: #1e2a37;
  border-radius: 10px;
  padding: 18px 22px;
  white-space: pre-wrap;
  line-height: 1.6;
  font-family: inherit;
  font-size: 14px;
}

.btn {
  align-self: flex-start;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: #2b3947;
  color: #e6ecf2;
  cursor: pointer;
  margin-top: 10px;
  margin-right: 10px;
  font-size: 13px;
}
.btn:hover { background: #34465a; }

.form-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.form-row input[type=text], .form-row input[type=password], .form-row input[type=number] {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2b3947;
  background: #1e2a37;
  color: #e6ecf2;
  font-size: 13px;
}
.form-row button {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: #2ea6ff;
  color: white;
  cursor: pointer;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  margin-left: 6px;
}
.badge-ok { background: #1f4a2e; color: #6fd98a; }
.badge-bad { background: #4a2020; color: #ff9b9b; }
