:root {
  /* TrendAI Security palette — light theme, electric cyan/blue accent */
  --cyan: #00c2de;
  --cyan-bright: #12d7f0;
  --blue: #1466ff;
  --blue-deep: #0b3ea8;
  --navy: #0a1122;
  --navy-2: #101c33;
  --bg: #f5f8fb;
  --panel: #ffffff;
  --ink: #0f1729;
  --muted: #667085;
  --line: #e5eaf1;
  --block: #dc2626;
  --block-bg: #fff5f5;
  --allow: #0e9f6e;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  font-family: "Aptos", "Aptos Display", "Segoe UI", -apple-system,
    BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Top bar (dark navy with cyan accent) ── */
.topbar {
  background: linear-gradient(120deg, var(--navy), var(--navy-2));
  color: #fff;
  padding: 15px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--cyan), var(--blue)) 1;
  box-shadow: 0 4px 18px rgba(10, 17, 34, 0.18);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.shield {
  font-size: 32px;
  filter: drop-shadow(0 0 10px rgba(0, 194, 222, 0.55));
}
.topbar h1 {
  font-size: 20px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar .accent {
  background: linear-gradient(90deg, var(--cyan-bright), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}
.sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: #9fb0c8;
}
.controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(0, 194, 222, 0.14);
  border: 1px solid rgba(0, 194, 222, 0.5);
  color: var(--cyan-bright);
}
.badge-live {
  background: rgba(14, 159, 110, 0.16);
  border-color: #10b981;
  color: #34d399;
}

/* ── Toggle ── */
.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.toggle input {
  display: none;
}
.slider {
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
}
.slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .slider {
  background: linear-gradient(90deg, var(--cyan), var(--blue));
}
.toggle input:checked + .slider::after {
  transform: translateX(20px);
}
.toggle-label {
  font-size: 13px;
  font-weight: 600;
}

/* ── Chat area ── */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}
.msg {
  display: flex;
}
.msg.user {
  justify-content: flex-end;
}
.bubble {
  max-width: 76%;
  padding: 11px 15px;
  border-radius: 16px;
  line-height: 1.55;
  font-size: 15px;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(15, 23, 41, 0.06);
}
.msg.user .bubble {
  background: linear-gradient(120deg, var(--cyan), var(--blue));
  color: #fff;
  border-bottom-right-radius: 5px;
}
.msg.bot .bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.bubble code {
  background: rgba(20, 102, 255, 0.09);
  color: var(--blue-deep);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 13px;
}

/* ── Blocked card ── */
.blocked {
  border: 1px solid #f7caca;
  background: var(--block-bg);
  border-left: 5px solid var(--block);
  max-width: 76%;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.12);
}
.blocked .b-head {
  font-weight: 800;
  color: var(--block);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.blocked .b-reason {
  font-size: 13px;
  color: #991b1b;
  margin: 6px 0 10px;
}
.detections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.det {
  background: #fff;
  border: 1px solid #f3d3d3;
  border-radius: 8px;
  padding: 8px 10px;
}
.det-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #991b1b;
}
.det-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.conf-bar {
  height: 6px;
  background: #fbe0e0;
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
}
.conf-fill {
  height: 100%;
  background: var(--block);
  border-radius: 999px;
}
.conf-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--block);
}

/* ── Guard note under bot reply ── */
.guard-note {
  font-size: 11px;
  color: var(--allow);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}
.guard-note.off {
  color: var(--muted);
}

/* ── Composer ── */
.composer {
  display: flex;
  gap: 10px;
  padding: 14px 24px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}
#input {
  flex: 1;
  resize: none;
  border: 1px solid #d3dbe6;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  max-height: 160px;
  color: var(--ink);
}
#input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 194, 222, 0.18);
}
#send {
  background: linear-gradient(120deg, var(--cyan), var(--blue));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s;
}
#send:hover {
  filter: brightness(1.07);
}
#send:active {
  transform: translateY(1px);
}
#send:disabled {
  opacity: 0.5;
  cursor: default;
  filter: none;
}

.typing {
  font-style: italic;
  color: var(--muted);
}
