* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: #0b1220;
  color: #e8eefc;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  background: #1b2a4a;
  border: 1px solid #2f4673;
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
}

button:active {
  background: #2b4170;
}

button:disabled {
  opacity: 0.5;
}

button:focus,
input:focus,
select:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 720px;
  margin: 0 auto;
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #111c33;
  border-bottom: 1px solid #22345c;
  flex: 0 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
}

.logo {
  background: #2563eb;
  color: #fff;
  border-radius: 6px;
  padding: 2px 6px;
  margin-right: 8px;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.topbtns {
  display: flex;
}

.topbtns .iconbtn {
  margin-left: 6px;
}

.iconbtn {
  padding: 6px 9px;
  font-size: 13px;
}

#statusbar {
  display: flex;
  align-items: center;
  padding: 3px 10px;
  background: #0e1729;
  font-size: 11px;
  color: #9fb0d0;
  flex: 0 0 auto;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #eab308;
  display: inline-block;
  margin-right: 6px;
  flex: 0 0 auto;
}

.dot.ok {
  background: #22c55e;
}

#chat {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.msg {
  display: flex;
  margin-bottom: 8px;
}

.msg.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 92%;
  padding: 8px 10px;
  border-radius: 10px;
  background: #16213a;
  border: 1px solid #24365c;
}

.msg.user .bubble {
  background: #1d4ed8;
  border-color: #2563eb;
}

.text {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.acts {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
}

.pdfbtn {
  background: #0f3d2e;
  border-color: #1f7a58;
  color: #c7f9e4;
  padding: 6px 10px;
  font-size: 12px;
}

.welcome {
  background: #101b31;
  border: 1px solid #24365c;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}

.welcome h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.welcome p {
  margin: 0 0 6px;
  font-size: 12px;
  color: #a9bada;
}

.welcome b {
  color: #e8eefc;
}

.loading {
  align-self: flex-start;
  background: #16213a;
  border: 1px solid #24365c;
  border-radius: 10px;
  padding: 8px 12px;
  color: #a9bada;
  font-size: 12px;
  margin-bottom: 8px;
}

#chips {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 8px;
  background: #0b1220;
  flex: 0 0 auto;
}

.chip {
  flex: 0 0 auto;
  font-size: 12px;
  padding: 6px 9px;
  margin-right: 6px;
  white-space: nowrap;
  background: #152340;
  border-color: #2a3f68;
}

#composer {
  display: flex;
  padding: 8px;
  background: #111c33;
  border-top: 1px solid #22345c;
  flex: 0 0 auto;
}

#input {
  flex: 1 1 auto;
  min-width: 0;
  background: #0b1220;
  border: 1px solid #2f4673;
  border-radius: 8px;
  color: #e8eefc;
  padding: 9px 10px;
  outline: none;
}

#input:focus {
  border-color: #3b82f6;
}

#sendBtn {
  margin-left: 6px;
  background: #2563eb;
  border-color: #3b82f6;
  font-weight: 600;
  padding: 9px 14px;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #0b1220;
  z-index: 20;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  overflow-y: auto;
}

.panel.hidden,
.hidden {
  display: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #111c33;
  border-bottom: 1px solid #22345c;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 4px 12px 16px;
}

.panel-body label {
  display: block;
  margin: 14px 0 5px;
  font-size: 12px;
  color: #9fb0d0;
  font-weight: 600;
}

.panel-body input,
.panel-body select {
  width: 100%;
  background: #0f1a2e;
  border: 1px solid #2f4673;
  border-radius: 8px;
  color: #e8eefc;
  padding: 9px 10px;
}

.hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: #8fa3c7;
  line-height: 1.45;
}

.hint a {
  color: #7db4ff;
}

.row {
  display: flex;
  margin-top: 14px;
}

.row .primary {
  flex: 1;
}

.row .secondary {
  flex: 1;
  margin-left: 8px;
}

.primary {
  background: #2563eb;
  border-color: #3b82f6;
}

.danger {
  width: 100%;
  margin-top: 16px;
  background: #3b1111;
  border-color: #7f1d1d;
  color: #ffb4b4;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  background: #1f2f52;
  border: 1px solid #3b5b9a;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 30;
  max-width: 88%;
  text-align: center;
}

@media (max-width: 280px) {
  body {
    font-size: 13px;
  }

  #topbar {
    padding: 5px 7px;
  }

  .brand {
    font-size: 14px;
  }

  #chat {
    padding: 7px;
  }

  .bubble {
    max-width: 96%;
    padding: 7px 8px;
  }

  #sendBtn {
    padding: 9px 10px;
  }

  .chip {
    font-size: 11px;
  }
}
