:root{
  --ai-bg:#ffffff;
  --ai-header:#0b2f57;                /* on-brand navy */
  --ai-border:#d7dee9;
  --ai-shadow:0 18px 48px rgba(2,18,41,.25);
  --ai-user:#e9f2ff;                  /* user bubble */
  --ai-bot:#f6f8fb;                   /* bot bubble */
  --ai-accent:#0d6efd;                /* buttons/links */
  --ai-radius:14px;
}

/* Container ---------------------------------------------------- */
.ai-chat{
  width: clamp(340px, 36vw, 520px);
  height: min(68vh, 640px);
  background: var(--ai-bg);
  border: 1px solid var(--ai-border);
  border-radius: var(--ai-radius);
  box-shadow: var(--ai-shadow);
  overflow: hidden;                   /* keep rounded corners */
  transform-origin: bottom right;
  transition: transform .16s ease, opacity .16s ease;
}

/* Header ------------------------------------------------------- */
.ai-chat__header{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:10px 12px;
  background: var(--ai-header);
  color:#fff; border-bottom:1px solid rgba(255,255,255,.1);
}
.ai-chat__title{ font-weight:600; letter-spacing:.2px; display:flex; align-items:center; }
.ai-chat__actions{ display:flex; gap:6px; }
.ai-iconbtn{
  display:inline-flex; align-items:center; justify-content:center;
  width:32px; height:32px; border-radius:10px;
  border:0; background:transparent; color:#fff; opacity:.9; cursor:pointer;
}
.ai-iconbtn:hover{ opacity:1; background: rgba(255,255,255,.12); }

/* Body + messages area ---------------------------------------- */
.ai-chat__body{
  display:flex; flex-direction:column;
  height: calc(100% - 48px);           /* header is ~48px tall */
  background: linear-gradient(#fafbfe, #fff);
}

/* Make the embedded chat fill and feel native */
#chat-component, #chat-component > div{
  height: 100% !important; width: 100% !important;
}

/* Try generic selectors to reach common chat UIs */
.ai-chat__body textarea{
  width:100%;
  min-height:44px; max-height:160px;
  resize:none;
  border:1px solid var(--ai-border);
  border-radius:12px;
  padding:10px 12px;
  outline:none;
}
.ai-chat__body textarea:focus{
  border-color: var(--ai-accent);
  box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}

/* Common bubble look (fallback if the component uses simple divs) */
.ai-chat__body .msg{
  max-width: 80%;
  padding: 10px 12px;
  margin: 8px 12px;
  border-radius: 12px; line-height: 1.38;
  box-shadow: 0 1px 0 rgba(2,18,41,.04);
}
.ai-chat__body .msg.bot{
  background: var(--ai-bot);
  border-top-left-radius: 6px;
}
.ai-chat__body .msg.user{
  background: var(--ai-user);
  margin-left:auto;
  border-top-right-radius: 6px;
}

/* Typing indicator -------------------------------------------- */
.ai-typing{
  display:flex; align-items:center; padding: 8px 12px 12px; gap:6px;
  color:#3b4958; font-size:.92rem;
}
.ai-typing .dot{
  width:6px; height:6px; border-radius:50%; background:#93a4b7;
  display:inline-block; animation: bounce 1s infinite ease-in-out;
}
.ai-typing .dot:nth-child(2){ animation-delay: .15s; }
.ai-typing .dot:nth-child(3){ animation-delay: .3s; }
@keyframes bounce{
  0%,80%,100%{ transform: translateY(0); opacity:.6; }
  40%{ transform: translateY(-5px); opacity:1; }
}

/* FAB (toggle) consistency ------------------------------------ */
#toggle-chat-btn{
  width:56px; height:56px; border-radius:50%;
  box-shadow: 0 8px 24px rgba(2,18,41,.25);
}
#toggle-chat-btn:focus{ outline: none; box-shadow: 0 0 0 4px rgba(13,110,253,.25); }

/* Responsive: make it a sheet on small screens ---------------- */
@media (max-width: 768px){
  .ai-chat{
    right: 0 !important; left: 0 !important; bottom: 0 !important;
    width: 100vw; height: 70vh; border-radius: 16px 16px 0 0;
  }
}

/* was: #chat-component, #chat-component > div { height:100% !important } */
.ai-chat__body { display:flex; flex-direction:column; }
#chat-component { flex: 1 1 auto; min-height: 0; }   /* grow, but allow shrinking */
#chat-component > div { height: 100%; }              /* inner engine can scroll */

/* message list padding (keeps last bubble close to the input) */
.ai-chat__body [class*="message-list"],
.ai-chat__body [class*="messages"]{
  padding: 8px 12px !important;
}

/* bubble density */
.ai-chat__body [class*="message"], .ai-chat__body .msg{
  margin: 6px 12px !important;
  padding: 8px 12px !important;
  line-height: 1.32;
  white-space: normal;              /* don't inherit pre-wrap */
}

/* remove default margins inside bubbles */
.ai-chat__body [class*="message"] p,
.ai-chat__body .msg p{
  margin: 0;                        /* <- fixes tall bubbles */
}

/* when there are multiple paragraphs in one bubble */
.ai-chat__body [class*="message"] p + p,
.ai-chat__body .msg p + p{
  margin-top: .5rem;
}
#toggle-chat-btn.btn-primary{
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--blue-700);
  --bs-btn-border-color: var(--blue-700);

  /* States */
  --bs-btn-hover-bg: color-mix(in srgb, var(--blue-700), #000 12%);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--blue-700), #000 16%);
  --bs-btn-active-bg: color-mix(in srgb, var(--blue-700), #000 20%);
  --bs-btn-active-border-color: color-mix(in srgb, var(--blue-700), #000 24%);
  --bs-btn-disabled-bg: var(--blue-700);
  --bs-btn-disabled-border-color: var(--blue-700);
}

/* Icon inherits currentColor; ensure white */
#toggle-chat-btn { color: #fff; }

/* ===== knobs you can tweak ===== */
:root{
  --blue-700: #0a58ca;            /* your accent (not the same as header/FAB) */
  --neutral-50: #f5f7fb;
  --neutral-300: #d7dee9;
  --ink-600: #2e3e54;

  --ai-btn-size: 44px;            /* match your textarea height */
  --ai-btn-radius: 12px;
  --ai-icon-size: 1.15rem;
  --ai-icon-nudge-y: 0px;         /* fine-tune if it looks 1px high/low */
}

/* Composer row centers children vertically */
#chat-container-div form,
#chat-container-div [class*="composer"],
#chat-container-div [class*="input"]{
  display:flex; align-items:center; gap:10px;
}

/* ── SEND: outline accent on white ─────────────────────────── */
#chat-container-div button[aria-label="Send"],
#chat-container-div button[title="Send"],
#chat-container-div button[class*="send"]{
  display:grid; place-items:center;
  inline-size:var(--ai-btn-size); block-size:var(--ai-btn-size);
  padding:0; line-height:1; border-radius:var(--ai-btn-radius);

  background:#fff;
  border:1px solid var(--blue-700);
  color:var(--blue-700);
}

#chat-container-div button[aria-label="Send"]:hover,
#chat-container-div button[title="Send"]:hover,
#chat-container-div button[class*="send"]:hover{
  background: color-mix(in srgb, var(--blue-700) 10%, #fff);
  border-color: var(--blue-700);
}
#chat-container-div button[aria-label="Send"]:active,
#chat-container-div button[title="Send"]:active,
#chat-container-div button[class*="send"]:active{
  background: color-mix(in srgb, var(--blue-700) 18%, #fff);
}

/* Disabled state (if the component toggles it) */
#chat-container-div button[aria-label="Send"]:disabled,
#chat-container-div button[title="Send"]:disabled,
#chat-container-div button[class*="send"]:disabled{
  background: var(--neutral-50);
  border-color: var(--neutral-300);
  color: #9aa7b7;
  cursor: not-allowed;
}

/* Icons inside buttons use currentColor */
#chat-container-div button[aria-label="Send"] .bi,
#chat-container-div button[title="Send"] .bi,
#chat-container-div button[class*="send"] .bi,
#chat-container-div button[aria-label="Send"] svg,
#chat-container-div button[title="Send"] svg,
#chat-container-div button[class*="send"] svg{
  display:block;
  width:var(--ai-icon-size); height:var(--ai-icon-size);
  transform: translateY(var(--ai-icon-nudge-y));
  fill: currentColor;
}

/* ── ATTACH: quiet neutral pill ────────────────────────────── */
#chat-container-div button[aria-label*="Attach"],
#chat-container-div button[title*="Attach"],
#chat-container-div button[class*="attach"]{
  display:grid; place-items:center;
  inline-size:var(--ai-btn-size); block-size:var(--ai-btn-size);
  padding:0; line-height:1; border-radius:var(--ai-btn-radius);

  background: var(--neutral-50);
  border: 1px solid var(--neutral-300);
  color: var(--ink-600);
}
#chat-container-div button[aria-label*="Attach"]:hover,
#chat-container-div button[title*="Attach"]:hover,
#chat-container-div button[class*="attach"]:hover{
  background: #eef3fa;
  border-color: var(--neutral-300);
}
#chat-container-div button[aria-label*="Attach"] svg,
#chat-container-div button[title*="Attach"] svg,
#chat-container-div button[class*="attach"] svg{
  width:var(--ai-icon-size); height:var(--ai-icon-size); fill: currentColor;
}


/* assets/table_tooltips.css */
.dash-table-tooltip,
.dash-spreadsheet-tooltip {
  background: #111827;        /* dark gray */
  color: #F9FAFB;             /* near white */
  border: 0;
  border-radius: 10px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  line-height: 1.35;
  max-width: 360px;
  white-space: normal;
  padding: 10px 12px;
}
.dash-table-tooltip strong,
.dash-spreadsheet-tooltip strong {
  font-weight: 600;
}
/* Filters header: fix Clear-all button when active filters are present */
#filters-card .clear-filters {
  position: static !important;     /* stop absolute/sticky float */
  top: auto !important;
  right: auto !important;
  transform: none !important;
  margin-left: auto;               /* let flex push it right */
  white-space: nowrap;             /* keep “Clear all” on one line */
}
