@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117;
  --bg-card: #161e2d;
  --bg-sidebar: #0f1620;
  --border: #2a3a4a;
  --orange: #FF9900;
  --muted: #8b9ab1;
  --very-muted: #4a5568;
}

body {
  background: var(--bg);
  color: #fff;
  font-family: 'Inter', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.logo-white  { color: #fff; font-weight: 800; }
.logo-orange { color: var(--orange); font-weight: 800; }

/* ── AUTH ── */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
}

.auth-logo {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 2rem;
  text-align: center;
}

.auth-title {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
  text-align: center;
}

.auth-sub {
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
  margin-bottom: 2rem;
}

.auth-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.form-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #fff;
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.2s;
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--orange);
}
.form-input::placeholder { color: var(--very-muted); }

.btn-auth {
  background: var(--orange);
  color: #000;
  font-weight: 700;
  font-size: 0.9375rem;
  padding: 0.875rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  margin-top: 0.5rem;
  transition: background 0.2s;
}
.btn-auth:hover { background: #e8890a; }

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.auth-footer a {
  color: var(--orange);
  text-decoration: none;
  font-weight: 600;
}
.auth-footer a:hover { text-decoration: underline; }

/* ── APP LAYOUT ── */
.app-body {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 800;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--very-muted);
  padding: 0 0.75rem;
  margin-bottom: 0.25rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.sidebar-item:hover:not(.disabled) { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar-item.active { background: rgba(255,153,0,0.1); color: var(--orange); }
.sidebar-item.disabled { opacity: 0.45; cursor: not-allowed; }

.sidebar-icon { font-size: 1rem; width: 1.25rem; text-align: center; }

.sidebar-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  color: var(--very-muted);
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--orange);
  color: #000;
  font-weight: 800;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name  { font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: 0.7rem; color: var(--very-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-plan-label { font-size: 0.65rem; font-weight: 700; color: var(--orange); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-logout {
  color: var(--very-muted);
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.2s;
  flex-shrink: 0;
}
.sidebar-logout:hover { color: #f87171; }

/* Main */
.app-main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  padding: 2rem 2.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header-title { font-size: 1.375rem; font-weight: 700; }
.app-header-sub   { color: var(--muted); font-size: 0.875rem; margin-top: 0.125rem; }

.app-content { padding: 2rem 2.5rem; }

/* Setup banner */
.setup-banner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: rgba(255,153,0,0.06);
  border: 1px solid rgba(255,153,0,0.2);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.setup-banner-icon { font-size: 1.5rem; }

.setup-banner-text { flex: 1; }
.setup-banner-text strong { font-size: 0.9375rem; font-weight: 600; }
.setup-banner-text p { color: var(--muted); font-size: 0.8125rem; margin-top: 0.25rem; }

.btn-setup {
  background: var(--orange);
  color: #000;
  font-weight: 700;
  font-size: 0.8125rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-setup:hover { background: #e8890a; }

/* Agents grid */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  transition: border-color 0.2s;
}
.agent-card:hover { border-color: rgba(255,153,0,0.15); }

.agent-card-top {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.agent-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.agent-card-icon.cost     { background: rgba(16,185,129,0.1); }
.agent-card-icon.security { background: rgba(239,68,68,0.1); }
.agent-card-icon.ops      { background: rgba(139,92,246,0.1); }
.agent-card-icon.gov      { background: rgba(255,153,0,0.1); }

.agent-card-info { flex: 1; }
.agent-card-info h3 { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.375rem; }
.agent-card-info p  { font-size: 0.8125rem; color: var(--muted); line-height: 1.5; }

.agent-card-status {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
.agent-card-status.building {
  background: rgba(255,153,0,0.1);
  color: var(--orange);
  border: 1px solid rgba(255,153,0,0.2);
}
.agent-card-status.soon {
  background: rgba(255,255,255,0.04);
  color: var(--very-muted);
  border: 1px solid var(--border);
}

/* ── AWS Connect ── */
.aws-flash {
  padding: 0.875rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}
.aws-flash-ok  { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25); color: #6ee7b7; }
.aws-flash-err { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.25);  color: #fca5a5; }

.aws-connected-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.aws-connected-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(16,185,129,0.15); color: #34d399;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; flex-shrink: 0;
}
.aws-connected-info { flex: 1; }
.aws-connected-label  { font-size: 0.875rem; font-weight: 700; color: #34d399; margin-bottom: 0.25rem; }
.aws-connected-arn    { font-size: 0.8rem; color: var(--muted); font-family: monospace; word-break: break-all; }
.aws-connected-region { font-size: 0.75rem; color: var(--very-muted); margin-top: 0.2rem; }
.btn-disconnect {
  background: transparent; border: 1px solid rgba(239,68,68,0.3);
  color: #f87171; font-size: 0.8rem; font-weight: 600;
  padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer;
  font-family: inherit; transition: background 0.2s;
}
.btn-disconnect:hover { background: rgba(239,68,68,0.1); }

.aws-instructions {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.75rem; margin-bottom: 1.5rem;
}
.aws-instructions h2 { font-size: 1rem; font-weight: 700; margin-bottom: 1.25rem; }
.aws-steps { display: flex; flex-direction: column; gap: 1rem; }
.aws-step {
  display: flex; gap: 1rem; align-items: flex-start;
  font-size: 0.875rem;
}
.aws-step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,153,0,0.15); color: var(--orange);
  font-size: 0.75rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.aws-step strong { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.aws-step p { color: var(--muted); line-height: 1.5; }
.aws-step code {
  background: rgba(255,255,255,0.06); padding: 0.1rem 0.4rem;
  border-radius: 4px; font-size: 0.8rem; color: var(--orange);
}

.aws-form-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.75rem;
}
.aws-form-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1.25rem; }
.aws-form { display: flex; flex-direction: column; gap: 1.25rem; }

/* ── CHAT HOME (3-panel layout) ── */
.chat-home {
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

/* Info panel (middle) */
.info-panel {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-section {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.info-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--very-muted);
  margin-bottom: 0.75rem;
}

.aws-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.875rem;
  border-radius: 99px;
  text-decoration: none;
}
.aws-status-badge.ok      { background: rgba(16,185,129,0.1); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.aws-status-badge.pending { background: rgba(255,153,0,0.08); color: var(--orange); border: 1px solid rgba(255,153,0,0.2); }

.agent-shortcut-list { display: flex; flex-direction: column; gap: 0.35rem; }

.agent-shortcut {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s;
  width: 100%;
}
.agent-shortcut.active-agent { background: rgba(16,185,129,0.06); border-color: rgba(16,185,129,0.15); }
.agent-shortcut.active-agent:hover { background: rgba(16,185,129,0.1); }
.agent-shortcut.disabled { opacity: 0.4; cursor: not-allowed; }

.agent-shortcut-icon { font-size: 1.1rem; width: 1.5rem; text-align: center; flex-shrink: 0; }
.agent-shortcut-name { font-size: 0.8125rem; font-weight: 600; color: #fff; }
.agent-shortcut-desc { font-size: 0.7rem; color: var(--very-muted); margin-top: 0.1rem; }

.quick-action-list { display: flex; flex-direction: column; gap: 0.35rem; }

.quick-action {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  line-height: 1.4;
  transition: all 0.15s;
}
.quick-action:hover { border-color: rgba(255,153,0,0.3); color: #fff; background: rgba(255,153,0,0.04); }

/* KPI rows */
.kpi-stack { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.625rem; }
.kpi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
}
.kpi-row-label { font-size: 0.75rem; color: var(--muted); }
.kpi-row-value { font-size: 1rem; font-weight: 800; color: var(--very-muted); letter-spacing: -0.02em; }
.kpi-row-value.green { color: #34d399; }
.kpi-cta {
  display: block;
  font-size: 0.7rem;
  color: var(--orange);
  text-decoration: none;
  text-align: center;
  margin-top: 0.25rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.kpi-cta:hover { opacity: 1; }

/* ── DASHBOARD INDEX ── */
.header-aws-status { display: flex; align-items: center; }
.header-aws-ok {
  font-size: 0.8rem; font-weight: 600;
  color: #34d399;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  padding: 0.35rem 0.875rem;
  border-radius: 99px;
}
.header-aws-pending {
  font-size: 0.8rem; font-weight: 600;
  color: var(--orange);
  background: rgba(255,153,0,0.08);
  border: 1px solid rgba(255,153,0,0.2);
  padding: 0.35rem 0.875rem;
  border-radius: 99px;
  text-decoration: none;
  transition: background 0.2s;
}
.header-aws-pending:hover { background: rgba(255,153,0,0.14); }

.dash-metrics {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}
.dash-metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.375rem 1.5rem;
}
.dash-metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.dash-metric-detail {
  font-size: 0.7rem;
  color: var(--orange);
  text-decoration: none;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.dash-metric-detail:hover { opacity: 1; }
.dash-metric-label { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
.dash-metric-value {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--very-muted);
  margin-bottom: 0.25rem;
}
.dash-metric-value.green { color: #34d399; }
.dash-metric-sub { font-size: 0.7rem; color: var(--very-muted); }

.dash-section-header {
  display: flex;
  align-items: baseline;
  gap: 0.875rem;
  margin-bottom: 1rem;
}
.dash-section-title { font-size: 1rem; font-weight: 700; }
.dash-section-sub   { font-size: 0.75rem; color: var(--very-muted); }
.dash-section-link  { font-size: 0.75rem; color: var(--orange); text-decoration: none; margin-left: auto; }
.dash-section-link:hover { text-decoration: underline; }

.agent-card-link { text-decoration: none; color: inherit; cursor: pointer; }
.agent-card-link:hover { border-color: rgba(16,185,129,0.3); }

.agent-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
}
.agent-card-arrow { color: var(--orange); font-size: 0.875rem; }

.recent-list { display: flex; flex-direction: column; gap: 0.35rem; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}
.recent-item:hover { border-color: rgba(255,153,0,0.2); }
.recent-item-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.recent-item-dot.cost { background: #34d399; }
.recent-item-info { flex: 1; min-width: 0; }
.recent-item-title { font-size: 0.875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item-meta  { font-size: 0.7rem; color: var(--very-muted); margin-top: 0.15rem; }
.recent-item-arrow { color: var(--very-muted); font-size: 0.875rem; flex-shrink: 0; }

.recent-empty {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}
.recent-empty a { color: var(--orange); text-decoration: none; }
.recent-empty a:hover { text-decoration: underline; }

.dash-empty-state {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
}
.dash-empty-icon { font-size: 2rem; opacity: 0.2; margin-bottom: 1rem; }
.dash-empty-state h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; }
.dash-empty-state p  { font-size: 0.875rem; color: var(--muted); max-width: 360px; margin: 0 auto; line-height: 1.6; }

.dash-metric-card.main { grid-column: span 1; }


/* Agent live dot */
.agent-live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #34d399;
  margin-left: auto;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(52,211,153,0.5);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Chat empty home (capacidades) */
.chat-empty-home {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.chat-empty-hero {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}
.chat-empty-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(16,185,129,0.1);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.2);
  padding: 0.3rem 0.875rem;
  border-radius: 99px;
  margin-bottom: 1rem;
}
.chat-empty-hero h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}
.chat-empty-hero p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
  max-width: 440px;
  margin: 0 auto;
}
.btn-start-chat {
  background: var(--orange);
  color: #000;
  font-weight: 700;
  font-size: 0.9375rem;
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.btn-start-chat:hover { background: #e8890a; }
.btn-start-chat.security { background: rgba(96,165,250,0.15); border: 1px solid rgba(96,165,250,0.3); color: #60a5fa; font-weight: 700; }
.btn-start-chat.security:hover { background: rgba(96,165,250,0.25); }

/* Agent tabs */
.agent-tabs {
  display: flex;
  gap: 0.375rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.3rem;
  width: fit-content;
  margin: 0 auto;
}
.agent-tab {
  padding: 0.45rem 1.1rem;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.agent-tab:hover { color: #fff; }
.agent-tab.active { background: rgba(255,255,255,0.07); color: #fff; }
.agent-tab.active.security { color: #60a5fa; }
.agent-tab.active.grc { color: #818cf8; }

.capability-card.security:hover { border-color: rgba(96,165,250,0.15); }

.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}
.capability-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.125rem;
  transition: border-color 0.2s;
}
.capability-card:hover { border-color: rgba(255,153,0,0.15); }
.capability-icon  { font-size: 1.25rem; margin-bottom: 0.5rem; }
.capability-title { font-size: 0.8125rem; font-weight: 700; margin-bottom: 0.375rem; }
.capability-desc  { font-size: 0.75rem; color: var(--muted); line-height: 1.5; }

/* Markdown inside assistant bubbles */
.chat-bubble.markdown { line-height: 1.65; }
.chat-bubble.markdown p  { margin-bottom: 0.625rem; }
.chat-bubble.markdown p:last-child { margin-bottom: 0; }
.chat-bubble.markdown h1,
.chat-bubble.markdown h2,
.chat-bubble.markdown h3 { font-size: 0.9375rem; font-weight: 700; margin: 0.875rem 0 0.375rem; }
.chat-bubble.markdown h2 { font-size: 0.875rem; }
.chat-bubble.markdown h3 { font-size: 0.8125rem; }
.chat-bubble.markdown ul,
.chat-bubble.markdown ol  { padding-left: 1.25rem; margin-bottom: 0.625rem; }
.chat-bubble.markdown li  { margin-bottom: 0.25rem; }
.chat-bubble.markdown strong { font-weight: 700; color: #fff; }
.chat-bubble.markdown em     { font-style: italic; color: #cbd5e1; }
.chat-bubble.markdown code {
  background: rgba(0,0,0,0.25);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-family: 'Fira Code', monospace;
}
.chat-bubble.markdown pre {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 0.875rem 1rem;
  overflow-x: auto;
  margin: 0.625rem 0;
}
.chat-bubble.markdown pre code { background: none; padding: 0; }
.chat-bubble.markdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  margin: 0.625rem 0;
}
.chat-bubble.markdown th,
.chat-bubble.markdown td {
  padding: 0.4rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.1);
  text-align: left;
}
.chat-bubble.markdown th { background: rgba(255,255,255,0.05); font-weight: 700; }
.chat-bubble.markdown blockquote {
  border-left: 3px solid rgba(255,153,0,0.4);
  padding-left: 0.875rem;
  color: var(--muted);
  margin: 0.5rem 0;
}
.chat-bubble.markdown hr { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 0.75rem 0; }

/* Message timestamps */
.chat-msg-body { display: flex; flex-direction: column; max-width: 70%; }
.chat-msg.user .chat-msg-body { align-items: flex-end; }
.chat-msg.assistant .chat-msg-body { align-items: flex-start; }
.chat-msg.user .chat-bubble { max-width: 100%; }
.chat-msg.assistant .chat-bubble { max-width: 100%; }
.chat-ts {
  font-size: 0.65rem;
  color: var(--very-muted);
  margin-top: 0.25rem;
  padding: 0 0.25rem;
}

/* Chat panel */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

/* ── CHAT (legacy single-column) ── */
.chat-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-info { display: flex; flex-direction: column; gap: 0.25rem; }
.chat-agent-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  display: inline-block;
  width: fit-content;
}
.chat-agent-badge.cost {
  background: rgba(16,185,129,0.1);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.2);
}
.chat-agent-badge.security {
  background: rgba(96,165,250,0.1);
  color: #60a5fa;
  border: 1px solid rgba(96,165,250,0.2);
}
.chat-agent-badge.grc {
  background: rgba(129,140,248,0.1);
  color: #818cf8;
  border: 1px solid rgba(129,140,248,0.2);
}
.btn-grc-report {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(129,140,248,0.12);
  border: 1px solid rgba(129,140,248,0.25);
  color: #818cf8;
  padding: 0.65rem 1.5rem;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-grc-report:hover,
.btn-grc-report:active { background: rgba(129,140,248,0.22); }
.chat-header-title { font-size: 1rem; font-weight: 600; }

.btn-delete-conv {
  background: transparent;
  border: 1px solid rgba(239,68,68,0.25);
  color: var(--very-muted);
  font-size: 0.8rem;
  padding: 0.4rem 0.875rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-delete-conv:hover { border-color: rgba(239,68,68,0.5); color: #f87171; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 3rem 1.5rem;
}
.chat-welcome-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.chat-welcome h3   { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.5rem; }
.chat-welcome p    { color: var(--muted); font-size: 0.875rem; max-width: 380px; line-height: 1.6; }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.5rem;
}
.chat-suggestion {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
  padding: 0.5rem 1rem;
  border-radius: 99px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.chat-suggestion:hover { border-color: var(--orange); color: #fff; }

.chat-msg {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.chat-msg.user { flex-direction: row-reverse; }

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-avatar.user      { background: var(--orange); color: #000; }
.chat-avatar.assistant { background: rgba(255,153,0,0.1); color: var(--orange); border: 1px solid rgba(255,153,0,0.2); }

.chat-bubble {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-msg.user      .chat-bubble { background: var(--orange); color: #000; font-weight: 500; border-radius: 12px 12px 4px 12px; }
.chat-msg.assistant .chat-bubble { background: var(--bg-card); border: 1px solid var(--border); color: #fff; border-radius: 12px 12px 12px 4px; }

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0.25rem 0;
}
.typing-dots span {
  width: 6px; height: 6px;
  background: var(--muted);
  border-radius: 50%;
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%            { transform: translateY(-4px); opacity: 1; }
}
.hidden { display: none !important; }

.chat-input-area {
  padding: 1rem 1.75rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  transition: border-color 0.2s;
}
.chat-input-wrapper:focus-within { border-color: var(--orange); }

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.9375rem;
  font-family: inherit;
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}
.chat-input::placeholder { color: var(--very-muted); }

.chat-send {
  width: 36px;
  height: 36px;
  background: var(--orange);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  flex-shrink: 0;
  transition: background 0.2s;
}
.chat-send:hover    { background: #e8890a; }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Detail choice buttons */
.detail-choice {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.25rem 0;
  flex-wrap: wrap;
}
.detail-choice-label {
  font-size: 0.75rem;
  color: var(--muted);
  width: 100%;
  margin-bottom: 0.125rem;
}
.detail-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.75rem 1.125rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s;
  flex: 1;
  min-width: 160px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
}
.detail-btn span {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
}
.detail-btn.summary:hover { border-color: rgba(255,153,0,0.4); background: rgba(255,153,0,0.06); }
.detail-btn.full:hover    { border-color: rgba(99,179,237,0.4); background: rgba(99,179,237,0.06); }
.detail-btn.full          { border-color: rgba(99,179,237,0.2); }

.chat-disclaimer {
  font-size: 0.7rem;
  color: var(--very-muted);
  text-align: center;
  margin-top: 0.5rem;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 3rem 1.5rem;
  gap: 0.75rem;
}
.chat-empty-icon { font-size: 3rem; opacity: 0.25; }
.chat-empty h2   { font-size: 1.125rem; font-weight: 700; }
.chat-empty p    { color: var(--muted); font-size: 0.875rem; max-width: 320px; line-height: 1.6; }

/* Conversation list in sidebar */
.btn-new-chat {
  width: 100%;
  background: rgba(255,153,0,0.08);
  border: 1px dashed rgba(255,153,0,0.3);
  color: var(--orange);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 0.5rem;
  transition: background 0.2s;
}
.btn-new-chat:hover { background: rgba(255,153,0,0.14); }

.conv-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow-y: auto;
  max-height: 240px;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8125rem;
  transition: background 0.15s, color 0.15s;
}
.conv-item:hover  { background: rgba(255,255,255,0.05); color: #fff; }
.conv-item.active { background: rgba(255,153,0,0.08); color: #fff; }

.conv-agent-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.conv-agent-dot.cost     { background: #34d399; }
.conv-agent-dot.security { background: #60a5fa; }
.conv-agent-dot.grc      { background: #818cf8; }
.conv-agent-dot.finops   { background: #34d399; }
.conv-agent-dot.infra    { background: #60a5fa; }

.conv-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-empty {
  font-size: 0.75rem;
  color: var(--very-muted);
  padding: 0.25rem 0.75rem;
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .app-main { margin-left: 0 !important; }
  .agents-grid { grid-template-columns: 1fr; }
  .app-content { padding: 1rem; }
  .dash-wrap  { padding: 1.25rem 1rem !important; }
  .kpi-grid   { grid-template-columns: repeat(2, 1fr) !important; }
  .section-row{ grid-template-columns: 1fr !important; }
  .history-main { padding: 1.25rem 1rem !important; }
  .budget-wrap { padding: 1.25rem 1rem !important; }
  .trend-bars  { gap: 2px !important; }
  .chat-home   { flex-direction: column !important; }
  .info-panel  { width: 100% !important; max-width: 100% !important; border-right: none !important; border-bottom: 1px solid var(--border); }
  .chat-panel  { flex: 1 !important; min-height: 60vh; }
}
