/* ═══════════════════════════════════════════════════════════════
   ai-assistant.css  —  BlueLedger AI Financial Workspace
   Redesigned to match Image 1 (target reference)
   ═══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   VARIABLES
   ══════════════════════════════════════════════════════════════ */
.aia-page {
  --sb-w: 220px;
  --sb-col-w: 0px;
  --bg: #0c0e1a;
  --bg2: #111322;
  --bg3: rgba(255, 255, 255, 0.035);
  --bg4: rgba(255, 255, 255, 0.055);
  --brd: rgba(255, 255, 255, 0.07);
  --brd2: rgba(255, 255, 255, 0.13);
  --t1: #e8eaf6;
  --t2: #8f94b0;
  --t3: #555e7a;
  --acc: #818cf8;
  --acc-d: #6366f1;
  --inc: #34d399;
  --exp: #f87171;
  --r: 14px;
  --r-sm: 10px;
}

[data-theme="light"] .aia-page {
  --bg: #f0f4ff;
  --bg2: #ffffff;
  --bg3: rgba(0, 0, 0, 0.025);
  --bg4: rgba(0, 0, 0, 0.04);
  --brd: rgba(0, 0, 0, 0.08);
  --brd2: rgba(0, 0, 0, 0.14);
  --t1: #191c1e;
  --t2: #464555;
  --t3: #9094b0;
  --acc: #4f46e5;
  --acc-d: #3525cd;
  --inc: #059669;
  --exp: #ba1a1a;
}

/* ══════════════════════════════════════════════════════════════
   PAGE & SHELL
   ══════════════════════════════════════════════════════════════ */
.aia-page {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: var(--bg);
  display: flex;
  font-family: "Inter", "DM Sans", system-ui, sans-serif;
  overflow: hidden;
}

.aia-shell {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR — always expanded by default, matches Image 1
   ══════════════════════════════════════════════════════════════ */
.aia-sidebar {
  width: var(--sb-w);
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--brd);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 2;
}

.aia-sb--col {
  width: var(--sb-col-w) !important;
}

/* Collapsed state — hide all text content */
.aia-shell--col .aia-sb-text,
.aia-shell--col .aia-sb-section,
.aia-shell--col .aia-sb-list {
  display: none !important;
}
.aia-shell--col .aia-sb-brand {
  justify-content: center;
  padding: 0.75rem 0.5rem;
}
.aia-shell--col .aia-sb-collapse-btn {
  position: static;
  margin: 0;
}
.aia-shell--col .aia-sb-new-btn {
  width: 36px;
  min-width: 36px;
  padding: 0;
  justify-content: center;
  margin: 0.3rem auto;
}

/* ── Brand bar ── */
.aia-sb-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.9rem 0.9rem 0.75rem;
  flex-shrink: 0;
}

.aia-sb-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--acc-d), var(--acc));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.32);
}

.aia-sb-brand-label {
  flex: 1;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--t1);
  letter-spacing: -0.01em;
}

.aia-sb-collapse-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--t3);
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 0.14s,
    color 0.14s;
}
.aia-sb-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--t2);
}

/* ── Search bar ── */
.aia-sb-search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0.7rem 0.65rem;
  padding: 0.42rem 0.65rem;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: 9px;
  flex-shrink: 0;
}
.aia-sb-search i {
  font-size: 0.75rem;
  color: var(--t3);
  flex-shrink: 0;
}
.aia-sb-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.75rem;
  color: var(--t1);
  font-family: inherit;
}
.aia-sb-search-input::placeholder {
  color: var(--t3);
}

/* ── New Analysis button ── */
.aia-sb-new-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0.7rem 0.8rem;
  padding: 0.55rem 0.85rem;
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.16),
    rgba(129, 140, 248, 0.08)
  );
  border: 1px solid rgba(129, 140, 248, 0.25);
  border-radius: 10px;
  color: var(--acc);
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  transition:
    background 0.14s,
    transform 0.1s;
  font-family: inherit;
}
.aia-sb-new-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.24),
    rgba(129, 140, 248, 0.14)
  );
  transform: translateY(-1px);
}

/* ── Section labels ── */
.aia-sb-section {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 0.55rem 0.9rem 0.25rem;
  flex-shrink: 0;
}

/* ── Lists ── */
.aia-sb-list {
  overflow-y: auto;
  flex-shrink: 1;
  min-height: 0;
  padding: 0 0.45rem;
  scrollbar-width: none;
}
.aia-sb-list::-webkit-scrollbar {
  display: none;
}

.aia-sb-empty {
  font-size: 0.7rem;
  color: var(--t3);
  padding: 0.4rem 0.5rem;
  font-style: italic;
  line-height: 1.5;
}

/* ── Report rows ── */
.aia-sb-report {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 9px;
  margin-bottom: 0.1rem;
  cursor: pointer;
  transition: background 0.12s;
}
.aia-sb-report:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Dot indicator */
.aia-sb-report::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fbbf24;
  flex-shrink: 0;
  margin-left: 2px;
}

.aia-sb-report-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
}
.aia-sb-report-title {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.aia-sb-report-meta {
  display: none !important;
}
.aia-sb-report-score {
  display: none !important;
}
.aia-sb-report-ts {
  display: none !important;
}
.aia-sb-badge {
  display: none !important;
}

/* ── Delete buttons ── */
.aia-sb-del {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  color: var(--t3);
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition:
    opacity 0.14s,
    background 0.12s,
    color 0.12s;
}
.aia-sb-report:hover .aia-sb-del,
.aia-sb-pin:hover .aia-sb-del {
  opacity: 1;
}
.aia-sb-del:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

/* ── Pin rows ── */
.aia-sb-pin {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.55rem;
  border-radius: 9px;
  margin-bottom: 0.1rem;
  cursor: default;
  transition: background 0.12s;
}
.aia-sb-pin:hover {
  background: rgba(255, 255, 255, 0.04);
}
.aia-sb-pin-icon {
  font-size: 0.68rem;
  color: var(--t3);
  flex-shrink: 0;
}
.aia-sb-pin-text {
  font-size: 0.71rem;
  color: var(--t3);
  line-height: 1.4;
  flex: 1;
}

/* ── Bottom bar ── */
.aia-sb-bottom {
  margin-top: auto;
  border-top: 1px solid var(--brd);
  padding: 0.55rem 0.45rem;
  flex-shrink: 0;
}
.aia-sb-bottom-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.48rem 0.6rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--t3);
  background: none;
  border: none;
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
  font-family: inherit;
}
.aia-sb-bottom-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--t2);
}

.aia-sb-scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}
.aia-sb-scroll-area::-webkit-scrollbar {
  display: none;
}

/* ══════════════════════════════════════════════════════════════
   MAIN AREA
   ══════════════════════════════════════════════════════════════ */
.aia-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ══════════════════════════════════════════════════════════════
   TOPBAR — matches Image 1: hamburger | title || tabs | gear | avatar
   ══════════════════════════════════════════════════════════════ */
.aia-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 52px;
  border-bottom: 1px solid var(--brd);
  background: var(--bg2);
  flex-shrink: 0;
  gap: 0.75rem;
}
.aia-topbar-l {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.aia-topbar-r {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}
.aia-topbar-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--t1);
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aia-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84rem;
  color: var(--t2);
  background: none;
  border: none;
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
}
.aia-icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--t1);
}

/* Settings gear icon — circle style from Image 1 */
.aia-icon-btn.aia-settings-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--brd);
  border-radius: 50%;
  width: 34px;
  height: 34px;
}
.aia-icon-btn.aia-settings-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Avatar circle — matches Image 1 */
.aia-avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--acc-d), var(--acc));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  border: none;
  cursor: default;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

/* Tab buttons — underline style from Image 1 */
.aia-tab-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.85rem;
  border-radius: 0;
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--t3);
  background: none;
  border: none;
  cursor: pointer;
  height: 52px;
  transition: color 0.15s;
  font-family: inherit;
}
.aia-tab-btn i {
  font-size: 0.82rem;
}
.aia-tab-btn:hover {
  color: var(--t1);
}
.aia-tab-btn.active {
  color: var(--acc);
  font-weight: 600;
}
.aia-tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--acc);
}

/* ── Views ── */
.aia-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ══════════════════════════════════════════════════════════════
   ANALYSIS SCROLL & CARDS
   ══════════════════════════════════════════════════════════════ */
.aia-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(129, 140, 248, 0.18) transparent;
}
.aia-scroll::-webkit-scrollbar {
  width: 4px;
}
.aia-scroll::-webkit-scrollbar-thumb {
  background: rgba(129, 140, 248, 0.18);
  border-radius: 4px;
}

.aia-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 960px;
  margin: 0 auto;
}

.aia-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── Glass card ── */
.aia-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--brd);
  border-radius: var(--r);
  padding: 1.15rem 1.25rem;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
  position: relative;
  overflow: hidden;
}
.aia-card:hover {
  border-color: var(--brd2);
}

.aia-card--score {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.05),
    rgba(129, 140, 248, 0.02)
  );
  border-color: rgba(99, 102, 241, 0.14);
}

.aia-card-hdr {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}
.aia-card-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  flex-shrink: 0;
}
.aia-card-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--t1);
  flex: 1;
  letter-spacing: -0.01em;
}
.aia-card-desc {
  font-size: 0.76rem;
  color: var(--t2);
  line-height: 1.65;
  margin-bottom: 0.85rem;
}

/* ══════════════════════════════════════════════════════════════
   SCORE RING
   ══════════════════════════════════════════════════════════════ */
.aia-score-body {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.aia-ring-wrap {
  position: relative;
  flex-shrink: 0;
}
.aia-ring-arc {
  transition: stroke-dashoffset 1.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.aia-ring-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  line-height: 1;
  pointer-events: none;
}
.aia-ring-num {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
}
.aia-ring-den {
  font-size: 0.6rem;
  color: var(--t3);
  margin-top: 0.1rem;
}

.aia-score-info {
  flex: 1;
  min-width: 0;
}
.aia-score-grade {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.aia-score-sub {
  font-size: 0.6rem;
  color: var(--t3);
  margin: 0.08rem 0 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.aia-factors {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.aia-factor {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  font-size: 0.68rem;
  line-height: 1.4;
  padding: 0.04rem 0;
}
.aia-factor i {
  font-size: 0.68rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}
.aia-factor--pos {
  color: var(--inc);
}
.aia-factor--neg {
  color: var(--exp);
}
.aia-factor--neu {
  color: var(--t3);
}

/* ══════════════════════════════════════════════════════════════
   PREDICTION CARD
   ══════════════════════════════════════════════════════════════ */
.aia-pred-amt {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0.15rem 0 0.45rem;
  line-height: 1;
}
.aia-pred-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.7rem;
  color: var(--t2);
  margin-bottom: 0.65rem;
}
.aia-pred-meta span {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

/* ON TRACK badge */
.aia-pred-ontrack {
  display: inline-flex;
  align-items: center;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--inc);
  background: rgba(78, 222, 163, 0.1);
  border: 1px solid rgba(78, 222, 163, 0.3);
  border-radius: 50px;
  padding: 0.22rem 0.65rem;
  margin-left: auto;
  white-space: nowrap;
}

/* Savings target progress */
.aia-pred-savings-row {
  margin-bottom: 0.6rem;
}
.aia-pred-savings-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.3rem;
}
.aia-pred-savings-label span:last-child {
  color: var(--inc);
}
.aia-pred-progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  overflow: hidden;
}
.aia-pred-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--inc), rgba(78, 222, 163, 0.5));
  border-radius: 6px;
  transition: width 1s ease;
}

.aia-pred-warn,
.aia-pred-savings {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  margin-top: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.38rem 0.65rem;
  border-radius: 9px;
}
.aia-pred-warn {
  color: var(--exp);
  background: rgba(255, 107, 107, 0.07);
  border: 1px solid rgba(255, 107, 107, 0.18);
}
.aia-pred-savings {
  color: var(--inc);
  background: rgba(78, 222, 163, 0.07);
  border: 1px solid rgba(78, 222, 163, 0.2);
}

/* ══════════════════════════════════════════════════════════════
   SPENDING BEHAVIOUR — 2-col stat boxes like Image 1
   ══════════════════════════════════════════════════════════════ */
.aia-behav-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.aia-bstat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--brd);
  border-radius: 11px;
  padding: 0.7rem 0.85rem;
}
.aia-bstat-em {
  display: none;
}
.aia-bstat-icon {
  display: none;
}
.aia-bstat--warn {
  border-color: rgba(251, 191, 36, 0.18);
}

.aia-bstat-label {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 0.28rem;
  display: block;
}
.aia-bstat-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--t1);
  line-height: 1.2;
}
.aia-bstat-lbl {
  font-size: 0.6rem;
  color: var(--t3);
  margin-top: 0.1rem;
}

/* Day-of-week chart */
.aia-dow-chart {
  display: flex;
  align-items: flex-end;
  gap: 0;
  height: 56px;
  padding: 0 0.1rem;
}
.aia-dow-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
  flex: 1;
}
.aia-dow-bar {
  width: 60%;
  max-width: 22px;
  border-radius: 4px 4px 0 0;
  background: rgba(129, 140, 248, 0.15);
  transition: height 0.5s ease;
  min-height: 3px;
}
.aia-dow-bar--top {
  background: #818cf8;
  box-shadow: 0 0 14px rgba(129, 140, 248, 0.35);
}
.aia-dow-lbl {
  font-size: 0.56rem;
  color: var(--t3);
  letter-spacing: 0.01em;
}

/* ══════════════════════════════════════════════════════════════
   SMART INSIGHTS — icon rows like Image 1
   ══════════════════════════════════════════════════════════════ */
.aia-pin-btn {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  margin-left: 0.5rem;
  font-size: 0.67rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  border-radius: 7px;
  border: 1px solid rgba(129, 140, 248, 0.22);
  color: var(--acc);
  background: rgba(129, 140, 248, 0.08);
  cursor: pointer;
  transition: background 0.12s;
  font-family: inherit;
}
.aia-pin-btn:hover {
  background: rgba(129, 140, 248, 0.15);
}

/* View All link */
.aia-ins-view-all {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--acc);
  cursor: pointer;
  margin-left: auto;
  background: none;
  border: none;
  font-family: inherit;
  transition: opacity 0.14s;
}
.aia-ins-view-all:hover {
  opacity: 0.7;
}

.aia-ins-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Insight row with left icon like Image 1 */
.aia-ins-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--brd);
  transition: border-color 0.15s;
}
.aia-ins-row:hover {
  border-color: var(--brd2);
}

/* Remove old left-border style — use icon instead */
.aia-ins-row--positive {
  border-color: var(--brd);
}
.aia-ins-row--warn {
  border-color: var(--brd);
}
.aia-ins-row--danger {
  border-color: var(--brd);
  background: rgba(255, 107, 107, 0.03);
}
.aia-ins-row--info {
  border-color: var(--brd);
}

/* Icon circle — matches Image 1 style */
.aia-ins-em {
  display: none;
}

/* We inject a CSS icon circle via the icon container span */
.aia-ins-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.aia-ins-row--positive .aia-ins-ico {
  background: rgba(78, 222, 163, 0.12);
  color: var(--inc);
}
.aia-ins-row--warn .aia-ins-ico {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}
.aia-ins-row--danger .aia-ins-ico {
  background: rgba(255, 107, 107, 0.12);
  color: var(--exp);
}
.aia-ins-row--info .aia-ins-ico {
  background: rgba(129, 140, 248, 0.12);
  color: var(--acc);
}

.aia-ins-title {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--t1);
  line-height: 1.35;
}
.aia-ins-body {
  font-size: 0.7rem;
  color: var(--t2);
  line-height: 1.5;
  margin-top: 0.15rem;
}

/* ══════════════════════════════════════════════════════════════
   BUDGET RECOMMENDATIONS
   ══════════════════════════════════════════════════════════════ */
.aia-recs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.aia-rec {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid var(--brd);
}
.aia-rec-icon {
  display: none;
}
.aia-rec-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--t1);
}
.aia-rec-body {
  font-size: 0.69rem;
  color: var(--t2);
  line-height: 1.55;
  margin-top: 0.1rem;
}

/* ══════════════════════════════════════════════════════════════
   DEEP ANALYSIS
   ══════════════════════════════════════════════════════════════ */
#acDeep {
  border-color: rgba(129, 140, 248, 0.14);
}

.aia-deep-btn {
  width: 100%;
  padding: 0.72rem 1rem;
  border-radius: 11px;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  font-size: 0.81rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  transition:
    opacity 0.18s,
    transform 0.12s;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.25);
  font-family: inherit;
}
.aia-deep-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.aia-deep-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.aia-deep-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.77rem;
  color: var(--t2);
  margin-top: 0.75rem;
  padding: 0.5rem 0;
}

.aia-deep-card {
  margin-top: 0.85rem;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(129, 140, 248, 0.18);
  border-radius: var(--r);
  animation: cardIn 0.3s ease;
}
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.aia-deep-src {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.63rem;
  color: var(--t3);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--brd);
  border-radius: 20px;
  padding: 0.16rem 0.5rem;
  margin-bottom: 0.55rem;
}
.aia-deep-src--local {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.22);
}

.aia-deep-headline {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--inc);
  margin-bottom: 0.3rem;
}
.aia-deep-assess {
  font-size: 0.76rem;
  color: var(--t1);
  line-height: 1.65;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--brd);
}

.aia-deep-sec {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--t3);
  margin: 0.85rem 0 0.5rem;
}

.aia-di-list {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}
.aia-di {
  padding: 0.52rem 0.8rem;
  border-radius: 9px;
  border-left: 3px solid var(--acc);
  background: rgba(129, 140, 248, 0.04);
}
.aia-di--high {
  border-left-color: var(--exp);
  background: rgba(255, 107, 107, 0.04);
}
.aia-di--medium {
  border-left-color: #fbbf24;
  background: rgba(251, 191, 36, 0.04);
}
.aia-di--low {
  border-left-color: var(--inc);
  background: rgba(78, 222, 163, 0.04);
}
.aia-di-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--t1);
}
.aia-di-body {
  font-size: 0.69rem;
  color: var(--t2);
  margin-top: 0.14rem;
  line-height: 1.5;
}

.aia-dp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.aia-dp {
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: rgba(129, 140, 248, 0.05);
  border: 1px solid rgba(129, 140, 248, 0.12);
}
.aia-dp-lbl {
  font-size: 0.59rem;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
}
.aia-dp-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--acc);
  margin: 0.1rem 0 0.04rem;
}
.aia-dp-rsn {
  font-size: 0.65rem;
  color: var(--t2);
  line-height: 1.5;
}

.aia-da-list {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}
.aia-da {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(78, 222, 163, 0.04);
}
.aia-da-num {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(78, 222, 163, 0.14);
  color: var(--inc);
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.04rem;
}
.aia-da-step {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--t1);
}
.aia-da-impact {
  font-size: 0.67rem;
  color: var(--t2);
  margin-top: 0.1rem;
  line-height: 1.5;
}

.aia-deep-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--brd);
}
.aia-deep-dismiss,
.aia-deep-pin {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  font-family: inherit;
}
.aia-deep-dismiss {
  background: rgba(255, 255, 255, 0.05);
  color: var(--t2);
  border: 1px solid var(--brd);
}
.aia-deep-dismiss:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}
.aia-deep-pin {
  background: rgba(129, 140, 248, 0.1);
  color: var(--acc);
  border: 1px solid rgba(129, 140, 248, 0.22);
}
.aia-deep-pin:hover {
  background: rgba(129, 140, 248, 0.18);
}

/* ══════════════════════════════════════════════════════════════
   CTA BAR — "Continue with AI Assistant" button
   ══════════════════════════════════════════════════════════════ */
.aia-cta-bar {
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--brd);
  background: var(--bg2);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aia-cta-hint {
  display: none;
}
.aia-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.75rem;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--acc);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.14s,
    transform 0.1s;
  font-family: inherit;
}
.aia-cta-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════════════
   CHAT VIEW
   ══════════════════════════════════════════════════════════════ */
.aia-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(129, 140, 248, 0.18) transparent;
}
.aia-chat-msgs::-webkit-scrollbar {
  width: 4px;
}
.aia-chat-msgs::-webkit-scrollbar-thumb {
  background: rgba(129, 140, 248, 0.18);
  border-radius: 4px;
}

.aia-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 1rem 1rem;
  gap: 0.55rem;
}
.aia-welcome-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--acc-d), var(--acc));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
  margin-bottom: 0.25rem;
}
.aia-welcome-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--t1);
  letter-spacing: -0.02em;
}
.aia-welcome-sub {
  font-size: 0.78rem;
  color: var(--t2);
  max-width: 300px;
  line-height: 1.55;
}

.aia-qps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  margin-top: 0.5rem;
  max-width: 540px;
}
.aia-qp {
  padding: 0.36rem 0.72rem;
  border-radius: 20px;
  background: rgba(129, 140, 248, 0.08);
  border: 1px solid rgba(129, 140, 248, 0.18);
  color: var(--acc);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.13s,
    transform 0.1s;
  font-family: inherit;
}
.aia-qp:hover {
  background: rgba(129, 140, 248, 0.16);
  transform: translateY(-1px);
}

.aia-msg-ai,
.aia-msg-user {
  animation: msgIn 0.17s ease-out;
}
.aia-msg-ai {
  display: flex;
  gap: 0.55rem;
}
.aia-msg-user {
  display: flex;
  justify-content: flex-end;
}
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.aia-msg-av {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  flex-shrink: 0;
  margin-top: 0.04rem;
  background: linear-gradient(135deg, var(--acc-d), var(--acc));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: #fff;
}
.aia-msg-ai-body {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}
.aia-msg-user-body {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 75%;
}

.aia-bubble-ai,
.aia-bubble-user {
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.6;
  word-break: break-word;
}
.aia-bubble-ai {
  background: var(--bg3);
  border: 1px solid var(--brd);
  color: var(--t1);
  border-radius: 4px 12px 12px 12px;
}
.aia-bubble-user {
  background: linear-gradient(135deg, var(--acc-d), var(--acc));
  color: #fff;
  border-radius: 12px 4px 12px 12px;
}
.aia-bubble-ai strong {
  color: var(--acc);
}
.aia-bubble-ai code {
  background: rgba(129, 140, 248, 0.12);
  padding: 0.08rem 0.3rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.aia-msg-meta {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.18rem;
  padding: 0 0.08rem;
  font-size: 0.61rem;
  color: var(--t3);
}
.aia-msg-meta--r {
  justify-content: flex-end;
}
.aia-copy-btn {
  width: 19px;
  height: 19px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.57rem;
  color: var(--t3);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.14s,
    background 0.12s;
}
.aia-msg-ai:hover .aia-copy-btn {
  opacity: 1;
}
.aia-copy-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--t1);
}

.aia-typing {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  padding: 0.08rem 0;
}
.aia-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--t3);
  animation: dot 1.1s infinite;
}
.aia-typing span:nth-child(2) {
  animation-delay: 0.18s;
}
.aia-typing span:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Input bar */
.aia-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--brd);
  background: var(--bg2);
  flex-shrink: 0;
}
.aia-input-wrap {
  flex: 1;
  min-width: 0;
}
.aia-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: 11px;
  padding: 0.55rem 0.8rem;
  color: var(--t1);
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
  resize: none;
  line-height: 1.5;
  transition: border-color 0.14s;
  display: block;
  box-sizing: border-box;
  max-height: 120px;
  overflow-y: auto;
}
.aia-input:focus {
  border-color: rgba(129, 140, 248, 0.4);
}
.aia-input::placeholder {
  color: var(--t3);
}

.aia-voice-btn,
.aia-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84rem;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition:
    background 0.14s,
    transform 0.1s;
}
.aia-voice-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--t2);
}
.aia-voice-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--t1);
}
.aia-voice--on {
  background: rgba(239, 68, 68, 0.14) !important;
  color: #ef4444 !important;
  animation: vPulse 1.1s infinite;
}
@keyframes vPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(239, 68, 68, 0);
  }
}
.aia-send-btn {
  background: linear-gradient(135deg, var(--acc-d), var(--acc));
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.28);
}
.aia-send-btn:hover {
  transform: scale(1.06);
}
.aia-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ══════════════════════════════════════════════════════════════
   TRIGGER BUTTONS (main app sidebar)
   ══════════════════════════════════════════════════════════════ */
.sb-btn-aia {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.14),
    rgba(129, 140, 248, 0.07)
  ) !important;
  border: 1px solid rgba(129, 140, 248, 0.2) !important;
  color: #818cf8 !important;
}
.sb-btn-aia:hover {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.22),
    rgba(129, 140, 248, 0.14)
  ) !important;
}
.bn-tab-aia {
  color: #818cf8 !important;
}

/* ══════════════════════════════════════════════════════════════
   LIGHT THEME
   ══════════════════════════════════════════════════════════════ */
[data-theme="light"] .aia-sb-report:hover,
[data-theme="light"] .aia-sb-pin:hover {
  background: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .aia-sidebar {
  background: #ffffff;
  border-right: 1px solid rgba(119, 117, 135, 0.14);
}
[data-theme="light"] .aia-topbar {
  background: #ffffff;
  border-bottom: 1px solid rgba(119, 117, 135, 0.12);
}
[data-theme="light"] .aia-scroll,
[data-theme="light"] .aia-chat-msgs {
  background: #f0f4ff;
}
[data-theme="light"] .aia-card {
  background: #ffffff;
  border-color: rgba(119, 117, 135, 0.12);
  box-shadow: 0 4px 20px rgba(25, 28, 30, 0.06);
}
[data-theme="light"] .aia-card:hover {
  border-color: rgba(79, 70, 229, 0.15);
  box-shadow: 0 8px 28px rgba(25, 28, 30, 0.09);
}
[data-theme="light"] .aia-bstat {
  background: #f2f4f6;
  border-color: rgba(119, 117, 135, 0.12);
}
[data-theme="light"] .aia-ins-row {
  background: #ffffff;
  border-color: rgba(119, 117, 135, 0.1);
}
[data-theme="light"] .aia-ins-row:hover {
  background: #f7f9fb;
  border-color: rgba(79, 70, 229, 0.14);
  filter: none;
}
[data-theme="light"] .aia-input-bar,
[data-theme="light"] .aia-cta-bar {
  background: #ffffff;
  border-color: rgba(119, 117, 135, 0.12);
  box-shadow: none;
}
[data-theme="light"] .aia-input {
  background: #f2f4f6;
  border-color: rgba(119, 117, 135, 0.2);
  color: #191c1e;
}
[data-theme="light"] .aia-input:focus {
  border-color: #4f46e5;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
[data-theme="light"] .aia-bubble-ai {
  background: #ffffff;
  border-color: rgba(119, 117, 135, 0.12);
  color: #464555;
  box-shadow: 0 2px 8px rgba(25, 28, 30, 0.06);
}
[data-theme="light"] .aia-deep-card {
  background: #ffffff;
  border-color: rgba(79, 70, 229, 0.12);
  box-shadow: 0 4px 20px rgba(25, 28, 30, 0.06);
}
[data-theme="light"] .aia-deep-headline {
  color: #059669;
}
[data-theme="light"] .aia-deep-dismiss {
  background: #f2f4f6;
  border-color: rgba(119, 117, 135, 0.2);
  color: #464555;
}
[data-theme="light"] .aia-deep-btn {
  background: linear-gradient(135deg, #3525cd, #4f46e5);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.28);
}
[data-theme="light"] .aia-send-btn {
  background: linear-gradient(135deg, #3525cd, #4f46e5);
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  .aia-row-2 {
    grid-template-columns: 1fr;
  }
  .aia-dp-grid {
    grid-template-columns: 1fr;
  }
  .aia-behav-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .aia-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    transition:
      transform 0.22s ease,
      width 0.22s ease;
  }
  .aia-sb--col {
    width: 0 !important;
    transform: translateX(-100%);
    border-right: none;
  }
  .aia-scroll {
    padding: 0.75rem;
  }
  .aia-chat-msgs {
    padding: 0.75rem;
  }
  .aia-input-bar {
    padding: 0.55rem 0.75rem;
  }
  .aia-topbar {
    height: 50px;
    padding: 0 0.75rem;
  }
  .aia-tab-btn span {
    display: none;
  }
  .aia-tab-btn {
    padding: 0.38rem 0.55rem;
    height: 50px;
  }
  .aia-cta-bar {
    padding: 0.75rem 1rem;
  }
  .aia-cta-btn {
    width: 100%;
    justify-content: center;
  }
  .aia-msg-ai-body,
  .aia-msg-user-body {
    max-width: 88%;
  }
}

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.aia-card {
  animation: fadeUp 0.32s ease both;
}
.aia-row-2 > .aia-card:nth-child(2) {
  animation-delay: 0.06s;
}
.aia-col > .aia-card:nth-child(2) {
  animation-delay: 0.08s;
}
.aia-col > .aia-card:nth-child(3) {
  animation-delay: 0.12s;
}
.aia-col > .aia-card:nth-child(4) {
  animation-delay: 0.16s;
}
.aia-col > .aia-card:nth-child(5) {
  animation-delay: 0.2s;
}
