/* ---------- Assistente IA ---------- */
.ia-app {
  display: grid; grid-template-columns: minmax(0, 1fr) 312px; gap: 16px;
  height: calc(100dvh - var(--topbar-h) - 48px); min-height: 560px; margin-bottom: -28px;
}
.ia-main {
  position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
  border: 1px solid var(--line-2); border-radius: var(--r-xl);
  background: radial-gradient(90% 60% at 50% -10%, rgba(225, 6, 0, .16), transparent 60%), linear-gradient(180deg, var(--s2), var(--s1));
  box-shadow: var(--shadow-2);
}

/* Cabeçalho */
.ia-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: rgba(11, 10, 12, .35); backdrop-filter: blur(10px); }
.ia-head__id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ia-head h1 { font-size: var(--fs-lg); letter-spacing: -.01em; }
.ia-head small { display: flex; align-items: center; gap: 7px; font-size: var(--fs-2xs); color: var(--tx-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ia-head__act { display: flex; align-items: center; gap: 8px; flex: none; }
.ia-ro { background: var(--s3); color: var(--tx-2); }

/* Orbe da IA */
.ia-orb {
  position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 34% 28%, #FF8A70 0%, #E10600 42%, #5A0000 100%);
  box-shadow: 0 0 0 1px rgba(255, 90, 70, .5), 0 8px 24px -6px rgba(225, 6, 0, .8);
}
.ia-orb > svg.lucide { width: 17px; height: 17px; position: relative; z-index: 1; }
.ia-orb::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; padding: 1.5px;
  background: conic-gradient(from 0deg, transparent 0 55%, rgba(255, 120, 100, .95) 80%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: ia-spin 3.2s linear infinite; opacity: .8;
}
.ia-orb.busy::before { animation-duration: .9s; opacity: 1; }
.ia-orb.busy { animation: ia-breathe 1.6s var(--ease-io) infinite; }
.ia-orb.sm { width: 34px; height: 34px; }
.ia-orb.lg { width: 76px; height: 76px; box-shadow: 0 0 0 1px rgba(255, 90, 70, .55), 0 0 60px -6px rgba(225, 6, 0, .9), 0 20px 50px -20px rgba(225, 6, 0, 1); }
.ia-orb.lg > svg.lucide { width: 32px; height: 32px; animation: twinkle 2.8s ease-in-out infinite; }
.ia-orb.lg::before { inset: -7px; padding: 2px; }
.ia-orb__stitch { position: absolute; inset: -22px; width: calc(100% + 44px); height: calc(100% + 44px); animation: ia-spin 26s linear infinite reverse; }
.ia-orb__stitch circle { fill: none; stroke: var(--red-line); stroke-width: 1.2; stroke-dasharray: 5 5; }
@keyframes ia-spin { to { transform: rotate(360deg); } }
@keyframes ia-breathe { 50% { box-shadow: 0 0 0 1px rgba(255, 90, 70, .7), 0 0 26px -2px rgba(225, 6, 0, .95); } }

/* Área rolável */
.ia-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.ia-thread { max-width: 860px; margin: 0 auto; padding: 22px 24px 28px; display: grid; gap: 22px; }

/* Estado inicial */
.ia-welcome { display: grid; gap: 24px; padding-top: 6px; transition: opacity .26s var(--ease), transform .26s var(--ease), filter .26s; }
.ia-welcome.out { opacity: 0; transform: translateY(-10px) scale(.985); filter: blur(4px); }
.ia-hero { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 16px 0 2px; }
.ia-hero .ia-orb { margin-bottom: 18px; animation: rise .8s var(--ease) both; }
.ia-hero h2 { font-size: clamp(24px, 2.6vw, 32px); letter-spacing: -.025em; animation: rise .8s var(--ease) .08s both; }
.ia-hero p { color: var(--tx-2); max-width: 54ch; font-size: var(--fs-md); animation: rise .8s var(--ease) .14s both; }
.ia-seal {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 6px 14px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); color: var(--tx-2); background: rgba(11, 10, 12, .5); border: 1px solid var(--line-2); animation: rise .8s var(--ease) .2s both;
}
.ia-seal svg { width: 15px; height: 15px; color: var(--ok); }

.ia-sugs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ia-sug {
  position: relative; display: grid; gap: 8px; align-content: start; text-align: left; padding: 14px 14px 12px; border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(34, 31, 36, .8), rgba(26, 23, 27, .8)); border: 1px solid var(--line-2);
  transition: transform var(--t-med) var(--ease), border-color var(--t-fast), background var(--t-fast);
  animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms + 260ms);
}
.ia-sug:hover { transform: translateY(-3px); border-color: var(--line-3); }
.ia-sug:active { transform: translateY(-1px) scale(.99); }
.ia-sug b { font-size: var(--fs-sm); font-weight: 500; line-height: 1.4; color: var(--tx); }
.ia-sug code, .ia-chip code, .ia-steps code { font-family: var(--mono); font-size: 10.5px; color: var(--tx-4); overflow-wrap: anywhere; }
.ia-sug__top { display: flex; align-items: center; gap: 8px; }
.ia-sug__ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--s4); color: var(--tx-2); transition: background var(--t-fast), color var(--t-fast); }
.ia-sug__ic svg { width: 15px; height: 15px; }
.ia-sug:hover .ia-sug__ic { background: var(--red-soft); color: var(--red-tx); }
.ia-sug__cat { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--tx-3); }
.ia-sug__go { margin-left: auto; color: var(--tx-4); transition: color var(--t-fast), transform var(--t-fast) var(--ease); }
.ia-sug__go svg { width: 16px; height: 16px; display: block; }
.ia-sug:hover .ia-sug__go { color: var(--red-tx); transform: translate(2px, -2px); }

.ia-sug--feat {
  grid-column: 1 / -1; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 16px 18px;
  border-color: rgba(255, 60, 40, .3); background: radial-gradient(120% 180% at 0% 0%, rgba(225, 6, 0, .2), transparent 55%), linear-gradient(180deg, rgba(34, 31, 36, .9), rgba(26, 23, 27, .9));
}
.ia-sug--feat .ia-sug__ic { width: 42px; height: 42px; border-radius: 13px; background: var(--grad-red); color: #fff; box-shadow: var(--glow-red); }
.ia-sug--feat .ia-sug__ic svg { width: 20px; height: 20px; }
.ia-sug--feat:hover .ia-sug__ic { background: var(--grad-red); color: #fff; }
.ia-sug__body { display: grid; gap: 3px; min-width: 0; }
.ia-sug__body .ia-sug__cat { color: var(--red-tx); }
.ia-sug--feat b { font-size: var(--fs-md); }
.ia-sug__peek { display: flex; gap: 8px; }
.ia-sug__peek > span { display: grid; padding: 6px 12px; border-radius: var(--r-sm); background: rgba(11, 10, 12, .5); border: 1px solid var(--line); font-size: var(--fs-2xs); color: var(--tx-3); white-space: nowrap; }
.ia-sug__peek b { font-size: var(--fs-md); font-weight: 600; color: var(--tx); }

/* Mensagens */
.ia-msg { display: flex; gap: 12px; min-width: 0; }
.ia-msg--user { flex-direction: column; align-items: flex-end; gap: 4px; animation: msg-pop .45s var(--ease) both; }
.ia-bubble {
  max-width: min(80%, 560px); padding: 10px 14px; border-radius: 16px 16px 4px 16px; font-size: var(--fs-md); line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap;
  background: linear-gradient(180deg, #4A1414, #3A0E0F); border: 1px solid rgba(255, 70, 50, .2); box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .9);
}
.ia-msg--user small { font-size: var(--fs-2xs); color: var(--tx-4); }
.ia-msg--ai { align-items: flex-start; animation: rise .5s var(--ease) both; }
.ia-ans { flex: 1; min-width: 0; display: grid; gap: 12px; padding-top: 4px; }

/* Raciocínio */
.ia-think { border: 1px solid var(--line-2); border-radius: var(--r-md); background: rgba(11, 10, 12, .4); overflow: hidden; max-width: 560px; }
.ia-think__h { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; font-size: var(--fs-sm); color: var(--tx-2); text-align: left; }
.ia-think__h:hover { background: rgba(255, 255, 255, .02); }
.ia-think__spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 90, 70, .25); border-top-color: var(--red-tx); animation: spin .8s linear infinite; flex: none; }
.ia-think.done .ia-think__spin { animation: none; border: 0; width: 8px; height: 8px; margin: 0 3px; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.ia-think__t { margin-left: auto; font-size: var(--fs-2xs); color: var(--tx-4); font-family: var(--mono); }
.ia-think__chev { width: 15px; height: 15px; color: var(--tx-4); transition: transform var(--t-med) var(--ease); }
.ia-think.open .ia-think__chev { transform: rotate(180deg); }
.ia-think__body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t-slow) var(--ease); }
.ia-think.open .ia-think__body { grid-template-rows: 1fr; }
.ia-steps { list-style: none; margin: 0; padding: 0 12px; min-height: 0; overflow: hidden; display: grid; gap: 7px; }
.ia-think.open .ia-steps { padding-bottom: 12px; }
.ia-steps li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: var(--fs-xs); color: var(--tx-2); animation: rise .4s var(--ease) both; }
.ia-steps li.run { color: var(--tx); }
.ia-steps__st { width: 16px; height: 16px; border-radius: 50%; flex: none; display: grid; place-items: center; }
.ia-steps li.run .ia-steps__st { border: 2px solid var(--line-3); border-top-color: var(--red-tx); animation: spin .7s linear infinite; }
.ia-steps li.done .ia-steps__st { background: var(--ok-soft); color: var(--ok); }
.ia-steps__st svg { width: 11px; height: 11px; stroke-width: 3; }
.ia-steps code { padding: 1px 6px; border-radius: 5px; background: var(--s3); }
.ia-shimmer {
  background: linear-gradient(90deg, var(--tx-3) 0%, var(--tx) 40%, var(--red-tx) 50%, var(--tx) 60%, var(--tx-3) 100%); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: ia-shine 1.8s linear infinite;
}
@keyframes ia-shine { from { background-position: 100% 0; } to { background-position: -150% 0; } }

/* Ferramentas */
.ia-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ia-tools__k { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-2xs); color: var(--tx-4); letter-spacing: .06em; text-transform: uppercase; margin-right: 2px; }
.ia-tools__k svg { width: 13px; height: 13px; }
.ia-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 24px; padding: 0 9px; border-radius: var(--r-pill); background: var(--s3); border: 1px solid var(--line-2); animation: msg-pop .35s var(--ease) both; }
.ia-chip svg { width: 12px; height: 12px; color: var(--ok); flex: none; }
.ia-chip code { color: var(--tx-2); }
.ia-chip.run { border-color: var(--red-line); }
.ia-chip.run svg { color: var(--red-tx); animation: blink .8s steps(1) infinite; }

/* Texto da resposta */
.ia-text { display: grid; gap: 10px; font-size: var(--fs-md); line-height: 1.65; color: var(--tx-2); max-width: 70ch; }
.ia-text:empty { display: none; }
.ia-text b { color: var(--tx); font-weight: 600; }
.ia-hl { color: var(--red-tx); font-size: .9em; }
.ia-blocks { display: grid; gap: 12px; min-width: 0; }
.ia-blocks:empty { display: none; }
.ia-in { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 110ms); }

.ia-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ia-stat { display: grid; gap: 1px; padding: 12px 14px; border-radius: var(--r-md); background: rgba(11, 10, 12, .45); border: 1px solid var(--line); min-width: 0; }
.ia-stat span { font-size: var(--fs-2xs); color: var(--tx-3); }
.ia-stat b { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ia-stat small { font-size: var(--fs-2xs); color: var(--tx-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ia-stat.red { border-color: rgba(255, 60, 40, .3); background: linear-gradient(180deg, rgba(225, 6, 0, .14), rgba(11, 10, 12, .45)); }
.ia-stat.red b { color: #fff; }
.ia-stat.crit b { color: var(--crit); } .ia-stat.warn b { color: var(--warn); } .ia-stat.ok b { color: var(--ok); }

.ia-block { border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(11, 10, 12, .35); overflow: hidden; min-width: 0; }
.ia-block__head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 12px 14px 8px; font-size: var(--fs-sm); }
.ia-block__head svg { width: 15px; height: 15px; color: var(--tx-3); }
.ia-block__head b { font-weight: 500; }
.ia-block__head small { font-size: var(--fs-2xs); color: var(--tx-4); }
.ia-block .table-wrap { padding: 0 6px 4px; }
.ia-tbl td { padding: 10px; }
.ia-tbl th { padding: 8px 10px; }
.ia-tbl .cell-cli { min-width: 0; }
.ia-tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line-2); color: var(--tx); }
.ia-tr-muted td { color: var(--tx-3); }
.ia-strong { font-weight: 500; color: var(--tx); }
.ia-chart { padding: 4px 12px 8px; }
.ia-note { display: flex; align-items: center; gap: 6px; padding: 2px 14px 12px; font-size: var(--fs-2xs); color: var(--tx-4); }
.ia-note svg { width: 13px; height: 13px; }

.ia-days { position: relative; width: 96px; height: 4px; margin-top: 6px; border-radius: 4px; background: var(--s4); }
.ia-days i { position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 4px; background: var(--grad-red); transform-origin: left; animation: grow-x 1s var(--ease) .3s both; }
.ia-days__mark { position: absolute; top: -3px; bottom: -3px; left: 36%; width: 2px; border-radius: 2px; background: var(--tx); opacity: .7; }

.ia-stock { min-width: 120px; }
.ia-stock .progress { margin-top: 6px; max-width: 160px; }

.ia-overdue { display: grid; }
.ia-od { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.ia-od > div { flex: 1; min-width: 0; display: grid; }
.ia-od > div b { font-weight: 500; }
.ia-od small { font-size: var(--fs-2xs); color: var(--warn); }
.ia-od > b { font-weight: 600; white-space: nowrap; }

.ia-load { padding: 6px 14px 14px; display: grid; gap: 11px; }
.ia-load__row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 48px; gap: 12px; align-items: center; }
.ia-load__row > b { text-align: right; font-weight: 600; font-size: var(--fs-sm); }
.ia-load__ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--s3); color: var(--tx-2); }
.ia-load__ic svg { width: 15px; height: 15px; }
.ia-load__top { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); margin-bottom: 5px; }
.ia-load__top b { font-weight: 500; }
.ia-load .cap__fill { animation-delay: inherit; }

.ia-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; height: 220px; padding: 6px 18px 14px; }
.ia-col { display: grid; grid-template-rows: 1fr auto; gap: 8px; height: 100%; text-align: center; min-width: 0; }
.ia-col__bar { position: relative; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line-2); background: repeating-linear-gradient(0deg, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%); }
.ia-col__stack { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(100%, 76px); }
.ia-col__stack b { font-size: var(--fs-xs); font-weight: 600; color: var(--tx-2); white-space: nowrap; animation: rise .6s var(--ease) .5s both; }
.ia-col.top .ia-col__stack b { color: var(--tx); }
.ia-col__stack i { display: block; flex: 1; width: 100%; border-radius: 10px 10px 3px 3px; background: linear-gradient(180deg, var(--s4), var(--s3)); border: 1px solid var(--line-2); border-bottom: 0; transform-origin: bottom; animation: grow-y .9s var(--ease) both; }
.ia-col.top .ia-col__stack i { background: var(--grad-red); border-color: rgba(255, 60, 40, .5); box-shadow: 0 0 30px -8px rgba(225, 6, 0, .9); }
.ia-col.part .ia-col__stack i { background: repeating-linear-gradient(135deg, var(--s4) 0 6px, var(--s3) 6px 12px); border-style: dashed; }
.ia-col > span { font-size: var(--fs-2xs); color: var(--tx-3); display: grid; line-height: 1.3; }
.ia-col > span small { color: var(--tx-4); font-size: 10px; }

.ia-donut { padding: 6px 16px 16px; }

/* Perguntas sugeridas dentro da resposta */
.ia-try { display: grid; gap: 6px; }
.ia-try__b { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: var(--r-sm); background: rgba(11, 10, 12, .4); border: 1px solid var(--line); font-size: var(--fs-sm); color: var(--tx-2); text-align: left; transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast); }
.ia-try__b span { flex: 1; min-width: 0; }
.ia-try__b svg { width: 15px; height: 15px; color: var(--tx-3); flex: none; }
.ia-try__b:hover { border-color: var(--red-line); color: var(--tx); background: var(--red-soft); }
.ia-try__b:hover svg { color: var(--red-tx); }

/* Sugestão de ação */
.ia-action {
  position: relative; display: grid; gap: 12px; padding: 16px; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid rgba(255, 60, 40, .35); background: radial-gradient(120% 140% at 0% 0%, rgba(225, 6, 0, .2), transparent 55%), linear-gradient(180deg, var(--s3), var(--s2));
  box-shadow: var(--shadow-1); transition: border-color var(--t-med), background var(--t-med), opacity var(--t-med);
}
.ia-action::before {
  content: ""; position: absolute; inset: 6px; border-radius: 15px; pointer-events: none; padding: 1px; opacity: .45;
  background: repeating-linear-gradient(90deg, rgba(255, 90, 70, .6) 0 6px, transparent 6px 11px); background-size: 11px 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: stitch-run 1.4s linear infinite;
}
.ia-action__h { display: flex; gap: 12px; align-items: center; }
.ia-action__h small { display: block; font-size: var(--fs-2xs); letter-spacing: .07em; text-transform: uppercase; color: var(--red-tx); }
.ia-action__h b { font-size: var(--fs-md); font-weight: 600; }
.ia-action__ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--red-soft); color: var(--red-tx); border: 1px solid var(--red-line); }
.ia-action__ic svg { width: 18px; height: 18px; }
.ia-action__d { font-size: var(--fs-sm); color: var(--tx-2); line-height: 1.55; }
.ia-action__d b { color: var(--tx); }
.ia-action__f { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.ia-action__f > div { padding: 9px 12px; border-radius: var(--r-sm); background: rgba(11, 10, 12, .45); border: 1px solid var(--line); min-width: 0; }
.ia-action__f dt { font-size: var(--fs-2xs); color: var(--tx-3); }
.ia-action__f dd { margin: 0; font-size: var(--fs-sm); font-weight: 500; color: var(--tx); overflow-wrap: anywhere; }
.ia-action__b { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 2px; }
.ia-action__note { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-2xs); color: var(--tx-3); }
.ia-action__note svg, .ia-action__aud svg, .ia-action__done svg { width: 14px; height: 14px; flex: none; }
.ia-action__done { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--ok); font-weight: 500; margin-right: auto; }
.ia-action__aud { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--tx-3); }
.ia-action__aud .mono { color: var(--tx-2); }
.ia-action.confirmed { border-color: rgba(52, 209, 127, .35); background: radial-gradient(120% 140% at 0% 0%, rgba(52, 209, 127, .12), transparent 55%), linear-gradient(180deg, var(--s3), var(--s2)); }
.ia-action.confirmed::before, .ia-action.ignored::before { display: none; }
.ia-action.confirmed .ia-action__ic { background: var(--ok-soft); color: var(--ok); border-color: rgba(52, 209, 127, .35); }
.ia-action.confirmed .ia-action__h small { color: var(--ok); }
.ia-action.ignored { opacity: .6; border-color: var(--line-2); background: linear-gradient(180deg, var(--s2), var(--s1)); }
.ia-action.ignored .ia-action__ic { background: var(--s3); color: var(--tx-3); border-color: var(--line-2); }
.ia-action.ignored .ia-action__h small { color: var(--tx-3); }
.ia-action.ignored .ia-action__f { display: none; }

/* Rodapé da resposta */
.ia-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; animation: rise .5s var(--ease) both; }
.ia-src { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-2xs); color: var(--tx-3); min-width: 0; flex: 1; }
.ia-src svg { width: 13px; height: 13px; flex: none; }
.ia-fb { display: flex; gap: 2px; }
.ia-ib { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--tx-3); transition: background var(--t-fast), color var(--t-fast); }
.ia-ib svg { width: 15px; height: 15px; }
.ia-ib:hover { background: var(--s3); color: var(--tx); }
.ia-ib.on { color: var(--red-tx); background: var(--red-soft); }
.ia-next { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ia-next > span { font-size: var(--fs-2xs); color: var(--tx-4); margin-right: 2px; }
.ia-next__b { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-height: 30px; padding: 5px 12px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: rgba(11, 10, 12, .4); font-size: var(--fs-xs); color: var(--tx-2); text-align: left; transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast); }
.ia-next__b svg { width: 13px; height: 13px; flex: none; color: var(--tx-3); }
.ia-next__b:hover { border-color: var(--red-line); color: var(--tx); background: var(--red-soft); }

/* Campo de pergunta */
.ia-composer { padding: 10px 18px 12px; border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(20, 18, 21, .5), rgba(11, 10, 12, .7)); }
.ia-box {
  max-width: 860px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 16px; border-radius: 18px;
  background: var(--bg-2); border: 1px solid var(--line-2); transition: border-color var(--t-fast), box-shadow var(--t-med);
}
.ia-box:focus-within { border-color: var(--red-line); box-shadow: 0 0 0 4px rgba(225, 6, 0, .12), 0 16px 40px -20px rgba(225, 6, 0, .7); }
.ia-box textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: none; padding: 7px 0; max-height: 160px; font-size: var(--fs-md); line-height: 1.5; }
.ia-box textarea::placeholder { color: var(--tx-4); }
.ia-box__act { display: flex; gap: 6px; flex: none; }
.ia-mic, .ia-send { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-med); }
.ia-mic { color: var(--tx-3); }
.ia-mic:hover { background: var(--s3); color: var(--tx); }
.ia-mic.on { color: var(--red-tx); background: var(--red-soft); animation: pulse-btn 1.2s infinite; }
.ia-send { background: var(--grad-red); color: #fff; box-shadow: 0 0 0 1px rgba(255, 60, 40, .5) inset, 0 8px 20px -8px rgba(225, 6, 0, .9); }
.ia-send:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(255, 90, 70, .8) inset, 0 12px 26px -8px rgba(225, 6, 0, 1); }
.ia-send:active { transform: scale(.94); }
.ia-mic svg, .ia-send svg { width: 18px; height: 18px; }
.ia-composer.busy .ia-send { background: var(--s4); box-shadow: 0 0 0 1px var(--line-3) inset; }
.ia-composer.busy .ia-send svg { width: 13px; height: 13px; fill: currentColor; }
.ia-disc { max-width: 860px; margin: 7px auto 0; text-align: center; font-size: var(--fs-2xs); color: var(--tx-4); }
.ia-disc kbd { font-size: 9.5px; padding: 1px 5px; }

/* Painel lateral */
.ia-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.ia-panel { border: 1px solid var(--line); border-radius: var(--r-lg); background: linear-gradient(180deg, var(--s2), var(--s1)); padding: 14px; box-shadow: var(--shadow-1); }
.ia-panel__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ia-panel__h h3 { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 500; }
.ia-panel__h h3 svg { width: 15px; height: 15px; color: var(--tx-3); flex: none; }
.ia-panel__foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: var(--fs-2xs); color: var(--tx-4); }
.ia-panel__foot svg { width: 12px; height: 12px; }

.ia-alerts { display: grid; gap: 6px; }
.ia-alert { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px; border-radius: var(--r-sm); text-align: left; background: rgba(11, 10, 12, .35); border: 1px solid var(--line); transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast) var(--ease); }
.ia-alert:hover { border-color: var(--line-3); background: var(--s3); transform: translateX(2px); }
.ia-alert__ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.ia-alert__ic svg { width: 15px; height: 15px; }
.ia-alert.crit .ia-alert__ic { background: var(--crit-soft); color: var(--crit); }
.ia-alert.warn .ia-alert__ic { background: var(--warn-soft); color: var(--warn); }
.ia-alert__tx { flex: 1; min-width: 0; display: grid; gap: 1px; }
.ia-alert__tx b { font-size: var(--fs-xs); font-weight: 500; line-height: 1.35; }
.ia-alert__tx small { font-size: var(--fs-2xs); color: var(--tx-3); }
.ia-alert__bar { position: relative; display: block; height: 4px; margin-top: 6px; border-radius: 4px; background: var(--s4); }
.ia-alert__bar i { position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 4px; background: repeating-linear-gradient(135deg, var(--crit) 0 5px, #D93547 5px 10px); transform-origin: left; animation: grow-x 1.2s var(--ease) .5s both; }
.ia-alert__bar em { position: absolute; top: -3px; bottom: -3px; left: calc(100 / 130 * 100%); width: 2px; border-radius: 2px; background: var(--tx); opacity: .7; }
.ia-alert__go { color: var(--tx-4); opacity: 0; transition: opacity var(--t-fast), color var(--t-fast); align-self: center; }
.ia-alert__go svg { width: 15px; height: 15px; display: block; }
.ia-alert:hover .ia-alert__go { opacity: 1; color: var(--red-tx); }

.ia-hist { display: grid; gap: 2px; }
.ia-hist__i { display: grid; gap: 1px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); text-align: left; transition: background var(--t-fast); }
.ia-hist__i:hover { background: var(--s3); }
.ia-hist__i b { font-size: var(--fs-xs); font-weight: 400; color: var(--tx-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ia-hist__d { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--tx-4); }
.ia-hist__i.on { background: linear-gradient(90deg, rgba(225, 6, 0, .16), rgba(225, 6, 0, .02)); }
.ia-hist__i.on b { color: var(--tx); font-weight: 500; }
.ia-hist__i .pulse-dot { width: 6px; height: 6px; }

.ia-perm p { font-size: var(--fs-xs); color: var(--tx-3); line-height: 1.55; }
.ia-perm p b { color: var(--tx-2); font-weight: 500; }
.ia-perm__chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.ia-perm__chips .pill { height: 22px; font-size: 10.5px; padding: 0 8px; }
.ia-perm__chips .pill svg { width: 11px; height: 11px; color: var(--ok); }

/* ---------- Responsivo ---------- */
@media (max-width: 1240px) {
  .ia-app { grid-template-columns: minmax(0, 1fr) 272px; }
  .ia-sug__peek { display: none; }
}
@media (max-width: 1000px) {
  .ia-app { grid-template-columns: minmax(0, 1fr); }
  .ia-side { display: none; }
}
@media (max-width: 760px) {
  .ia-sugs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .ia-app { height: calc(100dvh - var(--topbar-h) - 32px); min-height: 480px; margin: -4px -8px -28px; }
  .ia-main { border-radius: var(--r-lg); }
  .ia-head { padding: 10px 12px; }
  .ia-head small { display: none; }
  .ia-head__act .btn span, .ia-ro { display: none; }
  .ia-head__act .btn { width: 34px; padding: 0; }
  .ia-thread { padding: 16px 12px 22px; gap: 18px; }
  .ia-hero { padding-top: 6px; }
  .ia-orb.lg { width: 60px; height: 60px; }
  .ia-hero .ia-orb { margin-bottom: 12px; }
  .ia-hero p { font-size: var(--fs-sm); }
  .ia-seal { font-size: var(--fs-2xs); padding: 6px 12px; text-align: left; }
  .ia-sugs { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .ia-sug--feat { grid-template-columns: auto minmax(0, 1fr); padding: 14px; }
  .ia-sug--feat .ia-sug__go { display: none; }
  .ia-sug code { display: none; }
  .ia-msg { gap: 8px; }
  .ia-msg--ai > .ia-orb { width: 28px; height: 28px; }
  .ia-msg--ai > .ia-orb svg.lucide { width: 14px; height: 14px; }
  .ia-bubble { max-width: 88%; }
  .ia-text { font-size: var(--fs-sm); }
  .ia-stats { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .ia-stat { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 0 10px; padding: 9px 12px; }
  .ia-stat b { font-size: var(--fs-lg); grid-row: span 2; grid-column: 2; grid-row-start: 1; }
  .ia-hide-sm { display: none; }
  .ia-cols { gap: 8px; padding: 8px 10px 12px; height: 190px; }
  .ia-action { padding: 14px; }
  .ia-action__b .btn { flex: 1; }
  .ia-action__note { flex-basis: 100%; }
  .ia-composer { padding: 8px 10px 10px; }
  .ia-box { padding-left: 12px; border-radius: 16px; }
  .ia-box textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ia-orb::before, .ia-orb__stitch, .ia-orb.lg > svg.lucide, .ia-action::before, .ia-shimmer { animation: none !important; }
  .ia-shimmer { color: var(--tx); background: none; }
  .ia-welcome { transition: none; }
}
@media (max-width: 640px) {
  .ia-think__t { display: none; }
  .ia-box textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
