* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: #f6f8fb;
  color: #0f172a;
  font-size: 13px;
}

.app {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  height: 100vh;
}

.header {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
  -ms-flex-pack: justify;
  justify-content: space-between;
  padding: 10px 12px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.header-left {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
}

.header-actions {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
}

.header-actions .icon-btn {
  margin-left: 6px;
}

.logo {
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 7px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  margin-right: 8px;
}

.header h1 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  color: #0f172a;
}

.status {
  font-size: 11px;
  color: #64748b;
}

.status.ready {
  color: #16a34a;
}

.status.error {
  color: #991b1b;
}

.icon-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.icon-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.warning {
  background: #fef3c7;
  color: #92400e;
  padding: 8px 12px;
  font-size: 12px;
  border-bottom: 1px solid #fde68a;
}

.key-row {
  display: -ms-flexbox;
  display: flex;
  margin-top: 6px;
}

.key-row input {
  -ms-flex: 1;
  flex: 1;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  background: #ffffff;
  color: #0f172a;
  margin-right: 6px;
}

.hidden {
  display: none;
}

.quick-actions {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  padding: 8px 12px 4px 12px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.chip {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 14px;
  padding: 4px 9px;
  font-size: 11px;
  cursor: pointer;
  margin-right: 6px;
  margin-bottom: 4px;
}

.chip:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.chat-log {
  -ms-flex: 1;
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.msg {
  margin-bottom: 10px;
  max-width: 92%;
}

.msg.user {
  margin-left: auto;
  text-align: right;
}

.msg.assistant {
  margin-right: auto;
}

.msg-body {
  display: inline-block;
  text-align: left;
  padding: 8px 11px;
  border-radius: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg.user .msg-body {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 3px;
}

.msg.assistant .msg-body {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 3px;
}

.msg.error .msg-body {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.tool-pills {
  margin-bottom: 4px;
}

.tool-pill {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  margin-right: 4px;
  margin-bottom: 2px;
}

.tool-pill.fail {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.composer {
  display: -ms-flexbox;
  display: flex;
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  -ms-flex-align: end;
  align-items: flex-end;
}

#prompt-input {
  -ms-flex: 1;
  flex: 1;
  resize: none;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  max-height: 110px;
  margin-right: 8px;
  color: #0f172a;
  background: #ffffff;
}

#prompt-input:focus {
  border-color: #2563eb;
}

.send-btn {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  height: 36px;
}

.send-btn:hover {
  background: #1d4ed8;
}

.send-btn:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}
