:root {
  --bg: #0b1220;
  --panel: #121a2b;
  --panel-2: #0e1626;
  --ink: #eaf0fb;
  --muted: #8ea0bf;
  --line: #1f2c44;
  --accent: #25d366;      /* WhatsApp green */
  --accent-deep: #128c7e; /* WhatsApp teal */
  --bubble-them: #1d2840;
  --bubble-zivo: #075e54; /* WhatsApp sent-bubble dark teal */
  --warn: #f0a93b;
  --bad: #ef5f6b;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #16243d 0%, var(--bg) 55%);
  color: var(--ink);
  min-height: 100vh;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.logo {
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--accent), #6fe3a5);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tag { color: var(--muted); font-size: 14px; }
.mode {
  font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
}
.mode.gateway { color: var(--accent); border-color: var(--accent-deep); }

.layout {
  display: grid; grid-template-columns: 380px 1fr; gap: 20px;
  max-width: 1100px; margin: 24px auto; padding: 0 24px;
}
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.config h2 { margin: 0 0 8px; font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }
.config label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
.config input, .config select, .config textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 14px;
  font-family: inherit; resize: vertical;
}
.config input:focus, .config select:focus, .config textarea:focus {
  outline: none; border-color: var(--accent-deep);
}
.price { margin: 8px 0 0; }
button {
  cursor: pointer; border: none; border-radius: 10px; font-weight: 700;
  font-size: 14px; padding: 10px 16px;
}
button.ghost {
  width: 100%; margin-top: 18px; background: transparent;
  border: 1px solid var(--line); color: var(--muted);
}
button.ghost:hover { border-color: var(--accent-deep); color: var(--ink); }

/* chat */
.chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-deep); color: #fff; font-weight: 800; font-size: 18px;
}
.chat-name { font-weight: 700; }
.chat-status { color: var(--accent); font-size: 12px; }
.thread {
  flex: 1; min-height: 360px; max-height: 52vh; overflow-y: auto;
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
  background:
    linear-gradient(0deg, rgba(7,94,84,0.04), rgba(7,94,84,0.04)),
    var(--panel-2);
}
.bubble {
  max-width: 78%; padding: 9px 13px; border-radius: 12px; font-size: 14px;
  line-height: 1.45; white-space: pre-wrap; word-wrap: break-word;
}
.bubble.them { align-self: flex-end; background: var(--bubble-zivo); color: #eafff7; border-bottom-right-radius: 4px; }
.bubble.cust { align-self: flex-start; background: var(--bubble-them); border-bottom-left-radius: 4px; }
.bubble .who { display: block; font-size: 11px; opacity: 0.7; margin-bottom: 2px; }
.bubble.typing { align-self: flex-end; background: var(--bubble-zivo); color: #bdeede; font-style: italic; }

.composer { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--panel-2); }
.composer input {
  flex: 1; background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 11px 16px; font-size: 14px;
}
.composer input:focus { outline: none; border-color: var(--accent-deep); }
.composer button { background: var(--accent); color: #062b1c; }
.composer button:disabled { opacity: 0.5; cursor: default; }

.analysis {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px;
  border-top: 1px solid var(--line); min-height: 20px; font-size: 12px;
}
.chip {
  padding: 5px 10px; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--line); color: var(--muted); font-weight: 600;
}
.chip b { color: var(--ink); font-weight: 700; }
.chip.high { border-color: var(--accent-deep); color: var(--accent); }
.chip.warn { border-color: var(--warn); color: var(--warn); }
.chip.bad { border-color: var(--bad); color: var(--bad); }

.foot { max-width: 1100px; margin: 8px auto 40px; padding: 0 24px; }
.foot p { color: var(--muted); font-size: 12px; line-height: 1.6; }
