:root {
  --bg: #0f1117;
  --panel: #1a1d27;
  --panel-2: #232735;
  --accent: #25d0a5;
  --accent-dark: #17a583;
  --text: #eef1f7;
  --text-dim: #9aa3b5;
  --bubble-bot: #232735;
  --bubble-user: #25d0a5;
  --danger: #ff6b6b;
  --warn: #ffb74d;
  --radius: 16px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  background: var(--bg);
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid #2a2f3f;
  flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.bot-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #25d0a5, #1a8fe3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.bot-name { font-weight: 700; font-size: 15px; }
.bot-status { font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; display: inline-block; }
.lang-switch { display: flex; gap: 4px; }
.lang-switch button {
  background: var(--panel-2);
  color: var(--text-dim);
  border: 1px solid #2a2f3f;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}
.lang-switch button.active {
  background: var(--accent);
  color: #06251c;
  border-color: var(--accent);
  font-weight: 700;
}

/* Body */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.msg { display: flex; max-width: 88%; animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.bot { align-self: flex-start; }
.msg.user { align-self: flex-end; }
.bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.bot .bubble { background: var(--bubble-bot); border-bottom-left-radius: 4px; }
.msg.user .bubble { background: var(--bubble-user); color: #06251c; font-weight: 500; border-bottom-right-radius: 4px; }

/* Cards */
.card {
  background: var(--panel-2);
  border: 1px solid #2f3547;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  max-width: 88%;
  align-self: flex-start;
  animation: pop .18s ease-out;
}
.card h4 { font-size: 14px; margin-bottom: 8px; color: var(--accent); }
.card .row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed #313749; }
.card .row:last-child { border-bottom: none; }
.card .row .k { color: var(--text-dim); }
.card .row .v { font-weight: 600; text-align: right; }
.card .price-big {
  font-size: 20px; font-weight: 800; color: var(--accent);
  margin: 6px 0 2px;
}
.card .note { font-size: 11px; color: var(--text-dim); margin-top: 8px; line-height: 1.45; }
.card .warn { color: var(--warn); font-size: 12px; margin-top: 6px; line-height: 1.45; }
.card .danger { color: var(--danger); }
.badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #17352e; color: var(--accent);
  margin-left: 6px;
  vertical-align: middle;
}
.badge.out { background: #3a2020; color: var(--danger); }
.badge.low { background: #3a3020; color: var(--warn); }

/* Quick actions */
.quick-actions {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.quick-actions::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  background: var(--panel-2);
  border: 1px solid #343b50;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.chip:active { background: var(--accent-dark); }
.chip.primary { background: var(--accent); color: #06251c; font-weight: 700; border-color: var(--accent); }

/* Input */
.chat-input {
  display: flex;
  gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid #2a2f3f;
  flex-shrink: 0;
}
.chat-input input {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid #343b50;
  color: var(--text);
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 14px;
  outline: none;
}
.chat-input input:focus { border-color: var(--accent); }
.chat-input button {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #06251c;
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-input button:active { background: var(--accent-dark); }

/* typing indicator */
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i {
  width: 6px; height: 6px; background: var(--text-dim); border-radius: 50%;
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 70%, 100% { opacity: .25; } 35% { opacity: 1; } }

@media (min-width: 521px) {
  #app { border-left: 1px solid #232735; border-right: 1px solid #232735; }
}
