/* ───── Chat (Nora-style) ───── */
.chat {
  background: #0a0a0a;
  border-radius: var(--radius-lg);
  padding: 0;
  color: #e4e4e7;
  box-shadow: var(--shadow-lg);
  border: 1px solid #1f1f23;
  display: flex;
  flex-direction: column;
  min-height: 460px;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid #1f1f23;
}

.chat-header .dots {
  display: flex;
  gap: 6px;
}
.chat-header .dots span {
  width: 10px; height: 10px; border-radius: 50%; background: #27272a;
}
.chat-header .dots span:nth-child(1) { background: #278288; }
.chat-header .dots span:nth-child(2) { background: #f59e0b; }
.chat-header .dots span:nth-child(3) { background: #10b981; }

.chat-header-title {
  margin-left: 8px;
  font-size: 0.85rem;
  color: #a1a1aa;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-title::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  animation: msg-in 0.25s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.bot {
  align-self: flex-start;
  background: #18181b;
  color: #e4e4e7;
  border: 1px solid #27272a;
  border-bottom-left-radius: 4px;
}

.msg.bot::before {
  content: "biMessenger";
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #78b7ab;
  margin-bottom: 6px;
  font-weight: 600;
}

.typing {
  display: inline-flex;
  gap: 4px;
  padding: 10px 16px;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #52525b;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 20px 10px;
}

.chip {
  padding: 7px 12px;
  border: 1px solid #27272a;
  border-radius: 999px;
  background: #18181b;
  color: #d4d4d8;
  font-size: 0.8rem;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip:hover {
  border-color: var(--accent-2);
  color: #fff;
  background: #27272a;
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 4px 14px 14px 20px;
  margin: 0;
}

.chat-input input {
  flex: 1;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 10px;
  padding: 10px 14px;
  outline: none;
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  min-width: 0;
  transition: border-color 0.15s ease;
}

.chat-input input:focus {
  border-color: var(--accent-2);
}

.chat-input input::placeholder { color: #71717a; }

.chat-send {
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s ease;
}

.chat-send:hover:not(:disabled) { background: var(--accent-2); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ───── Charts (SVG) ───── */
.chart {
  width: 100%;
  height: auto;
  display: block;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
}

.donut-legend .row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
}

.donut-legend .swatch {
  width: 10px; height: 10px;
  border-radius: 3px;
}

.donut-legend .value {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 24px;
}

.chart-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.chart-meta .big {
  font-size: 2rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.chart-meta .delta {
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.delta.up { background: #ecfdf5; color: #047857; }
.delta.down { background: #fef2f2; color: #b91c1c; }

.bar-row {
  display: grid;
  grid-template-columns: 64px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.bar-row .label { color: var(--fg-muted); }
.bar-row .value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.bar-track {
  height: 8px;
  background: var(--bg-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
  transition: width 0.6s ease;
}

/* ───── Code snippet card ───── */
.code-card {
  background: #0a0a0a;
  color: #e4e4e7;
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
  border: 1px solid #1f1f23;
  box-shadow: var(--shadow-lg);
}

.code-card .card-title {
  padding: 18px 22px;
  border-bottom: 1px solid #1f1f23;
  margin: 0;
}

.code-card .card-title h3 { color: #fff; }

.code-card .card-title .pill {
  background: rgba(39, 130, 136, 0.18);
  color: #78b7ab;
}

.code-card pre {
  margin: 0;
  padding: 22px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
}

.code-card .code-footer {
  padding: 14px 22px;
  border-top: 1px solid #1f1f23;
  display: flex;
  justify-content: space-between;
  color: #71717a;
  font-size: 0.82rem;
}

.code-card .code-footer strong { color: #10b981; font-variant-numeric: tabular-nums; }

.tok-kw { color: #f472b6; }
.tok-fn { color: #60a5fa; }
.tok-str { color: #fcd34d; }
.tok-num { color: #fbbf24; }
.tok-com { color: #52525b; font-style: italic; }

/* ───── Live feed ───── */
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
  animation: live-pulse 1.6s ease-in-out infinite;
  vertical-align: middle;
  margin-right: 4px;
}

@keyframes live-pulse {
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

.feed {
  height: 250px;
  overflow: hidden !important;
  padding: 18px 22px !important;
  font-size: 0.82rem !important;
  line-height: 1.85 !important;
  white-space: normal;
  mask-image: linear-gradient(180deg, transparent 0%, #000 14%, #000 82%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 14%, #000 82%, transparent 100%);
}

.feed .row .msg {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.feed .row {
  display: grid;
  grid-template-columns: 68px 86px 1fr;
  gap: 12px;
  opacity: 0;
  transform: translateY(6px);
  animation: feed-in 0.4s ease forwards;
}

@keyframes feed-in {
  to { opacity: 1; transform: translateY(0); }
}

.feed .ts { color: #52525b; }
.feed .tag { font-weight: 600; letter-spacing: 0.02em; }
.feed .tag.gate { color: #60a5fa; }
.feed .tag.class { color: #78b7ab; }
.feed .tag.canteen { color: #fcd34d; }
.feed .tag.heat { color: #fb923c; }
.feed .tag.ai { color: #c4b5fd; }
.feed .tag.alert { color: #f87171; }
.feed .msg { color: #d4d4d8; }
.feed .msg b { color: #fff; font-weight: 600; }
