/* ==================================================================
   Agentes Ética — componentes do produto
   Carregar depois de etica-app.css + etica-components.css
   ================================================================== */

/* ---------- Shell extras ---------- */
.sidebar__product { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.55); padding: 0 12px; display: block; margin: -6px 0 4px; }
.sidebar__logout { margin-left: auto; color: rgba(255,255,255,.7); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; }
.sidebar__logout:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---------- Menu lateral: expandir / recolher (desktop) ---------- */
.sidebar__symbol { display: none; width: 34px; height: 34px; border-radius: 8px; }
.app { transition: grid-template-columns 200ms ease-out; }
@media (min-width: 901px) {
  .sidebar-toggle { display: grid; }
  .sb-collapsed .app { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
  .sb-collapsed .sidebar { padding: 20px 10px 16px; overflow-x: hidden; }
  .sb-collapsed .sidebar__brand { justify-content: center; padding: 4px 0 14px; }
  .sb-collapsed .sidebar__logo,
  .sb-collapsed .sidebar__product,
  .sb-collapsed .nav-item > span:not(.badge),
  .sb-collapsed .sidebar__unit .who { display: none; }
  .sb-collapsed .sidebar__symbol { display: block; }
  .sb-collapsed .sidebar__section-label { font-size: 0; padding: 0; margin: 4px 8px 6px; border-top: 1px solid rgba(255,255,255,.12); }
  .sb-collapsed .nav-item { justify-content: center; padding: 10px 0; }
  .sb-collapsed .nav-item.is-active::before { left: -10px; }
  .sb-collapsed .nav-item .badge { position: absolute; top: 3px; right: 6px; margin: 0; padding: 0 5px; font-size: 10px; min-width: 16px; line-height: 16px; text-align: center; }
  .sb-collapsed .sidebar__unit { flex-direction: column; padding: 8px 0; gap: 6px; }
  .sb-collapsed .sidebar__logout { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .app { transition: none; } }

.gs-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 6px; z-index: 30; display: none; max-height: 360px; overflow-y: auto; }
.gs-results.is-open { display: block; }
.gs-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--fg); }
.gs-item:hover { background: var(--subtler); }
.gs-item strong { font-size: 13px; font-weight: 600; }
.gs-item small { grid-column: 1; font-size: 11.5px; color: var(--fg-secondary); }
.gs-item .unit-tag { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.gs-empty { padding: 12px; font-size: 12.5px; color: var(--fg-secondary); }

.conn-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; font-size: 12.5px; font-weight: 500; color: var(--fg-secondary); text-decoration: none; }
.conn-chip:hover { border-color: var(--border-strong); color: var(--fg); }
.conn-chip strong { color: var(--fg); font-size: 12px; }
.conn-chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(31,154,94,.15); }
.conn-chip--warn .conn-chip__dot { background: var(--warning); box-shadow: 0 0 0 3px rgba(224,155,45,.18); }
@media (max-width: 560px) { .conn-chip__txt { display: none; } }

/* ---------- Avatares ---------- */
.av { --av: #5A7A8C; position: relative; flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; font: 600 13px/1 'Inter', sans-serif; color: #fff; background: var(--av); letter-spacing: .02em; }
.av--agent { border-radius: 12px; background: linear-gradient(150deg, var(--av), color-mix(in oklab, var(--av) 70%, #0F1E26)); }
.av__bot { position: absolute; right: -3px; bottom: -3px; width: 17px; height: 17px; border-radius: 50%; background: var(--brand-laranja); border: 2px solid #fff; display: grid; place-items: center; }
.av__bot svg { width: 10px; height: 10px; color: #fff; stroke-width: 2.2; }
.av--sm { width: 30px; height: 30px; font-size: 11px; }
.av--sm.av--agent { border-radius: 9px; }
.av--sm .av__bot { width: 14px; height: 14px; right: -3px; bottom: -3px; }
.av--sm .av__bot svg { width: 8px; height: 8px; }
.av--lg { width: 64px; height: 64px; font-size: 20px; }
.av--lg.av--agent { border-radius: 18px; }
.av-stack { display: inline-flex; }
.av-stack .av { border: 2px solid #fff; margin-left: -6px; font-size: 10px; }
.av-stack .av:first-child { margin-left: 0; }
.av-more { width: 30px; height: 30px; border-radius: 50%; background: var(--subtle); border: 2px solid #fff; margin-left: -8px; display: inline-grid; place-items: center; font: 600 11px 'JetBrains Mono', monospace; color: var(--fg-secondary); }

.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { display: block; font-size: 12px; color: var(--fg-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person > div { min-width: 0; }

.handle { font: 500 12px 'JetBrains Mono', monospace; color: var(--brand-azul); }
.secret { font: 500 12.5px 'JetBrains Mono', monospace; letter-spacing: .02em; color: var(--fg); background: var(--subtle); padding: 2px 8px; border-radius: var(--radius-sm); }

/* ---------- Chat (estilo mensageiro) ---------- */
.main--chat { padding: 0; overflow: hidden; }
.chat { height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); display: grid; grid-template-columns: 340px minmax(0, 1fr) 0; background: var(--surface); transition: grid-template-columns 200ms ease-out; }
.chat.has-info { grid-template-columns: 340px minmax(0, 1fr) 320px; }

/* Lista de conversas */
.clist { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.clist__head { padding: 16px 16px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border); }
.clist__title { display: flex; align-items: center; justify-content: space-between; }
.clist__title h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.clist__search { position: relative; }
.clist__search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--fg-tertiary); }
.clist__search input { width: 100%; height: 36px; padding: 0 12px 0 34px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--subtler); font: inherit; font-size: 13px; }
.clist__search input:focus { outline: none; border-color: var(--brand-azul); background: #fff; box-shadow: var(--ring-azul); }
.clist__filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.clist__filters .chip { white-space: nowrap; }
.clist__items { overflow-y: auto; flex: 1; padding: 6px; }
.citem { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px; border-radius: var(--radius-md); cursor: pointer; border: none; background: none; width: 100%; text-align: left; font: inherit; color: inherit; align-items: center; }
.citem:hover { background: var(--subtler); }
.citem.is-active { background: var(--info-light); }
.citem .av { grid-row: 1 / span 2; }
.citem__name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.citem__name .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.citem__name .kind { flex-shrink: 0; }
.citem__name .kind { font: 600 10px 'JetBrains Mono', monospace; letter-spacing: .04em; color: var(--fg-tertiary); text-transform: uppercase; }
.citem__time { font: 500 11px 'JetBrains Mono', monospace; color: var(--fg-tertiary); justify-self: end; }
.citem__last { grid-column: 2; font-size: 12.5px; color: var(--fg-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.citem__last b { font-weight: 500; color: var(--fg); }
.citem__last .typing-inline { color: var(--success-dark); font-style: italic; }
.citem__badge { grid-column: 3; justify-self: end; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand-azul); color: #fff; font: 600 11px/20px 'JetBrains Mono', monospace; text-align: center; }
.citem.is-unread .citem__time { color: var(--brand-azul); font-weight: 600; }
.citem__err { grid-column: 3; justify-self: end; color: var(--danger); display: grid; }
.citem__err svg { width: 16px; height: 16px; }

/* Painel da conversa */
.cpane { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); position: relative; }
.cpane__head { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.cpane__back.icon-btn { display: none; }
.cpane__who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.cpane__who strong { font-size: 14.5px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cpane__who small { font-size: 12px; color: var(--fg-secondary); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.status-dot--warn { background: var(--warning); }
.status-dot--err { background: var(--danger); }
.status-dot--off { background: var(--fg-tertiary); }
.cpane__tools { display: flex; gap: 4px; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--radius-md); border: 1px solid transparent; background: transparent; display: grid; place-items: center; color: var(--fg-secondary); cursor: pointer; transition: background 120ms, color 120ms; }
.icon-btn:hover { background: var(--subtle); color: var(--fg); }
.icon-btn.is-on { background: var(--info-light); color: var(--brand-azul); }
.icon-btn svg { width: 18px; height: 18px; }

/* Busca na conversa */
.csearch { display: none; align-items: center; gap: 8px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.csearch.is-open { display: flex; }
.csearch input { flex: 1; height: 34px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0 12px; font: inherit; font-size: 13px; }
.csearch input:focus { outline: none; border-color: var(--brand-azul); box-shadow: var(--ring-azul); }
.csearch__count { font: 500 12px 'JetBrains Mono', monospace; color: var(--fg-secondary); min-width: 56px; text-align: center; }
mark.hit { background: rgba(242,128,33,.25); color: inherit; border-radius: 2px; padding: 0 1px; }
mark.hit.is-current { background: var(--brand-laranja); color: #fff; }

/* Mensagens */
.msgs { flex: 1; overflow-y: auto; padding: 20px clamp(12px, 3vw, 40px) 12px; display: flex; flex-direction: column; gap: 4px;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(32,54,104,.05) 1px, transparent 1px);
  background-size: 18px 18px; }
.day { align-self: center; margin: 12px 0 8px; padding: 4px 12px; border-radius: var(--radius-full); background: rgba(255,255,255,.9); border: 1px solid var(--border); font-size: 11.5px; font-weight: 500; color: var(--fg-secondary); }
.sysmsg { align-self: center; max-width: 520px; text-align: center; font-size: 12px; color: var(--fg-secondary); background: var(--warning-light); border: 1px solid rgba(224,155,45,.25); padding: 6px 12px; border-radius: var(--radius-md); margin: 6px 0; }
.sysmsg--info { background: var(--info-light); border-color: rgba(44,74,140,.15); }

.msg { display: flex; gap: 8px; max-width: min(680px, 86%); align-items: flex-end; margin-top: 6px; }
.msg.is-cont { margin-top: 1px; }
.msg.is-cont .msg__av { visibility: hidden; }
.msg--out { align-self: flex-end; flex-direction: row-reverse; }
.msg--out .msg__av { display: none; }
.bubble { position: relative; padding: 8px 12px 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); font-size: 13.5px; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.msg--in .bubble { border-bottom-left-radius: 4px; }
.msg--in.is-cont .bubble { border-top-left-radius: 4px; }
.msg--out .bubble { background: #E3EBF9; border-color: rgba(44,74,140,.18); border-bottom-right-radius: 4px; }
.bubble__author { display: block; font-size: 12px; font-weight: 600; margin-bottom: 2px; color: var(--author, var(--brand-azul)); }
.bubble p { margin: 0 0 6px; }
.bubble p:last-of-type { margin-bottom: 0; }
.bubble ul { margin: 4px 0 6px; padding-left: 18px; }
.bubble .mention { color: var(--brand-azul); font-weight: 600; background: rgba(44,74,140,.08); padding: 0 3px; border-radius: 3px; }
.bubble__meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 2px; font: 500 10.5px 'JetBrains Mono', monospace; color: var(--fg-tertiary); }
.bubble__meta svg { width: 14px; height: 14px; }
.bubble__meta .read { color: var(--brand-azul-claro); }
.bubble__meta .ms { color: var(--fg-tertiary); }

/* Ações sobre resposta do agente */
.msg__actions { display: none; gap: 2px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.msg:hover .msg__actions, .msg:focus-within .msg__actions, .msg.is-latest .msg__actions, .msg.is-rated .msg__actions { display: flex; }
.msg__actions button { height: 26px; padding: 0 8px; border: none; background: none; border-radius: var(--radius-sm); display: inline-flex; align-items: center; gap: 5px; color: var(--fg-tertiary); font: 500 11.5px 'Inter', sans-serif; cursor: pointer; }
.msg__actions button:hover { background: var(--subtle); color: var(--fg); }
.msg__actions button svg { width: 14px; height: 14px; }
.msg__actions button.is-on { color: var(--brand-azul); background: var(--info-light); }
.msg__actions button.is-on-bad { color: var(--danger-dark); background: var(--danger-light); }
.msg__actions .spacer { flex: 1; }

/* Cartão estruturado dentro da resposta */
.rcard { margin: 8px 0 4px; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: #fff; }
.rcard__head { padding: 8px 12px; background: var(--subtler); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--fg-secondary); text-transform: uppercase; letter-spacing: .05em; }
.rcard table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rcard th { text-align: left; padding: 7px 12px; font-size: 11px; color: var(--fg-tertiary); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.rcard td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.rcard tr:last-child td { border-bottom: none; }
.rcard__actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--subtler); }
.rcard__wrap { overflow-x: auto; }

/* Anexos */
.att { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md); background: rgba(255,255,255,.7); border: 1px solid var(--border); margin: 4px 0 6px; min-width: 220px; }
.att__ico { width: 36px; height: 36px; border-radius: 8px; background: var(--danger-light); color: var(--danger-dark); display: grid; place-items: center; flex-shrink: 0; font: 700 9.5px 'JetBrains Mono', monospace; }
.att__ico--xls { background: var(--success-light); color: var(--success-dark); }
.att__ico--doc { background: var(--info-light); color: var(--brand-azul); }
.att strong { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.att small { font: 500 11px 'JetBrains Mono', monospace; color: var(--fg-tertiary); }
.att .icon-btn { width: 30px; height: 30px; margin-left: auto; }
.img-att { display: block; width: min(300px, 100%); aspect-ratio: 4 / 3; border-radius: 10px; margin: 4px 0 6px; border: 1px solid var(--border); background:
  repeating-linear-gradient(135deg, var(--subtle) 0 10px, var(--subtler) 10px 20px); position: relative; overflow: hidden; }
.img-att span { position: absolute; left: 8px; bottom: 8px; font: 500 11px 'JetBrains Mono', monospace; background: rgba(15,30,38,.7); color: #fff; padding: 2px 6px; border-radius: 4px; }
.img-att img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Áudio */
.audio { display: flex; align-items: center; gap: 10px; min-width: 240px; padding: 2px 0 4px; }
.audio__play { width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--brand-azul); color: #fff; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.audio__play svg { width: 14px; height: 14px; fill: currentColor; }
.audio__wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; }
.audio__wave i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--border-strong); transition: background 120ms; }
.audio__wave i.is-played { background: var(--brand-azul); }
.audio__dur { font: 500 11px 'JetBrains Mono', monospace; color: var(--fg-secondary); }
.audio__tr { font-size: 12px; color: var(--fg-secondary); font-style: italic; margin-top: 2px; border-left: 2px solid var(--border-strong); padding-left: 8px; }

/* Digitando / processando */
.typing { align-self: flex-start; display: flex; gap: 8px; align-items: flex-end; margin-top: 6px; }
.typing .bubble { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.typing__dots { display: inline-flex; gap: 4px; }
.typing__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-tertiary); animation: blink 1.2s infinite ease-in-out; }
.typing__dots i:nth-child(2) { animation-delay: .15s; }
.typing__dots i:nth-child(3) { animation-delay: .3s; }
.typing__step { font-size: 12px; color: var(--fg-secondary); }
.typing__step .mono { color: var(--fg-tertiary); font-size: 11px; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .typing__dots i { animation: none; opacity: .6; } }

/* Compositor */
.composer { flex-shrink: 0; padding: 10px 16px 14px; background: var(--surface); border-top: 1px solid var(--border); }
.composer__pending { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.composer__pending:empty { display: none; }
.pend { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--subtler); font-size: 12px; }
.pend button { width: 22px; height: 22px; border-radius: 50%; border: none; background: transparent; color: var(--fg-tertiary); cursor: pointer; display: grid; place-items: center; }
.pend button:hover { background: var(--subtle); color: var(--fg); }
.pend button svg { width: 12px; height: 12px; }
.composer__row { display: flex; align-items: flex-end; gap: 8px; }
.composer__box { flex: 1; display: flex; align-items: flex-end; gap: 4px; border: 1px solid var(--border); border-radius: 22px; background: var(--subtler); padding: 4px 4px 4px 6px; transition: border 150ms, box-shadow 150ms, background 150ms; min-width: 0; }
.composer__box:focus-within { border-color: var(--brand-azul); box-shadow: var(--ring-azul); background: #fff; }
.composer textarea { flex: 1; border: none; background: transparent; resize: none; font: inherit; font-size: 14px; line-height: 1.45; padding: 7px 4px; max-height: 140px; min-height: 34px; color: var(--fg); min-width: 0; }
.composer textarea:focus { outline: none; }
.composer .icon-btn { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.send-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--brand-laranja); color: #fff; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; box-shadow: 0 1px 2px rgba(238,100,37,.3); transition: background 150ms, transform 120ms; }
.send-btn:hover { background: var(--brand-laranja-escuro); }
.send-btn:active { transform: scale(.95); }
.send-btn:focus-visible { box-shadow: var(--ring-laranja); }
.send-btn svg { width: 19px; height: 19px; }
.send-btn--mic { background: var(--brand-azul); box-shadow: none; }
.send-btn--mic:hover { background: var(--brand-azul-escuro); }
.composer__hint { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 11.5px; color: var(--fg-tertiary); padding: 0 6px; }
.composer__hint .mention-hint { color: var(--fg-secondary); }

/* Gravação */
.rec { display: none; flex: 1; align-items: center; gap: 12px; height: 44px; padding: 0 8px 0 14px; border-radius: 22px; background: var(--danger-light); border: 1px solid rgba(217,79,106,.25); color: var(--danger-dark); }
.composer.is-rec .rec { display: flex; }
.composer.is-rec .composer__box { display: none; }
.rec__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
.rec__time { font: 600 13px 'JetBrains Mono', monospace; }
.rec__wave { flex: 1; display: flex; gap: 2px; align-items: center; height: 24px; overflow: hidden; }
.rec__wave i { width: 3px; border-radius: 2px; background: rgba(156,40,64,.45); flex-shrink: 0; }

/* Menu de anexo */
.popmenu { position: absolute; bottom: calc(100% + 8px); left: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; display: none; z-index: 20; }
.popmenu.is-open { display: block; }
.popmenu button, .popmenu label { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: none; background: none; border-radius: var(--radius-sm); font: 500 13px 'Inter', sans-serif; color: var(--fg); cursor: pointer; text-align: left; }
.popmenu button:hover, .popmenu label:hover { background: var(--subtler); }
.popmenu svg { width: 16px; height: 16px; color: var(--brand-azul); }
.popmenu small { display: block; font-size: 11px; color: var(--fg-tertiary); font-weight: 400; }

/* Painel lateral de informações */
.cinfo { border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; min-width: 0; }
.chat:not(.has-info) .cinfo { visibility: hidden; }
.cinfo__head { padding: 24px 20px 16px; text-align: center; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cinfo__head h3 { margin: 6px 0 0; font-size: 16px; }
.cinfo__head p { margin: 0; font-size: 12.5px; color: var(--fg-secondary); }
.cinfo__sec { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cinfo__sec h4 { margin: 0 0 10px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-secondary); font-weight: 600; }
.cinfo__list { display: flex; flex-direction: column; gap: 10px; }
.cinfo .kv { grid-template-columns: 110px 1fr; font-size: 12.5px; }

/* Vazio do chat */
.cempty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--fg-secondary); padding: 40px; }
.cempty strong { display: block; font-size: 16px; color: var(--fg); margin: 12px 0 4px; }

/* Responsivo do chat */
@media (max-width: 1180px) {
  .chat.has-info { grid-template-columns: 300px minmax(0, 1fr) 0; }
  .chat .cinfo { position: absolute; right: 0; top: 0; bottom: 0; width: min(340px, 92vw); z-index: 25; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform 200ms; }
  .chat.has-info .cinfo { transform: none; }
  .chat { grid-template-columns: 300px minmax(0, 1fr) 0; position: relative; }
}
@media (max-width: 760px) {
  .chat, .chat.has-info { grid-template-columns: minmax(0, 1fr); }
  .chat .cpane { display: none; }
  .chat.is-open .clist { display: none; }
  .chat.is-open .cpane { display: flex; }
  .cpane__back.icon-btn { display: grid; }
  .cpane__head { padding: 0 8px; gap: 8px; }
  .msg { max-width: 92%; }
  .composer { padding: 8px 8px 10px; }
  .composer__hint { display: none; }
  .cpane__tools .hide-xs { display: none; }
}

/* ---------- Agentes (cards de conexão) ---------- */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.agent-card { display: flex; flex-direction: column; }
.agent-card__top { padding: 18px 20px 14px; display: flex; gap: 14px; align-items: flex-start; }
.agent-card__top h3 { margin: 0; font-size: 15px; font-weight: 600; }
.agent-card__top p { margin: 6px 0 0; font-size: 12.5px; color: var(--fg-secondary); line-height: 1.5; }
.agent-card__stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); }
.agent-card__stats div { padding: 12px 16px; border-right: 1px solid var(--border); }
.agent-card__stats div:last-child { border-right: none; }
.agent-card__stats small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-tertiary); font-weight: 600; }
.agent-card__stats strong { font: 600 15px 'JetBrains Mono', monospace; }
.agent-card .card__footer { margin-top: auto; gap: 8px; flex-wrap: wrap; }
.agent-card.is-err { border-color: rgba(217,79,106,.35); }

.conn-test { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.conn-test__row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 9px 12px; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.conn-test__row:last-child { border-bottom: none; }
.conn-test__row .ico { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--subtle); color: var(--fg-tertiary); }
.conn-test__row .ico svg { width: 12px; height: 12px; }
.conn-test__row.is-ok .ico { background: var(--success); color: #fff; }
.conn-test__row.is-err .ico { background: var(--danger); color: #fff; }
.conn-test__row.is-run .ico { background: var(--info-light); color: var(--brand-azul); }
.conn-test__row .mono { font-size: 11.5px; color: var(--fg-secondary); }

/* ---------- Matriz de vínculos ---------- */
.matrix-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); max-height: 70vh; }
table.matrix { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
table.matrix th, table.matrix td { border-bottom: 1px solid var(--border); padding: 10px 12px; }
table.matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--subtler); vertical-align: bottom; text-align: center; font-weight: 600; min-width: 112px; }
table.matrix thead th:first-child { left: 0; z-index: 3; text-align: left; min-width: 260px; }
table.matrix tbody th { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 500; border-right: 1px solid var(--border); }
table.matrix tbody td { text-align: center; }
table.matrix tbody tr:hover th, table.matrix tbody tr:hover td { background: var(--subtler); }
.mx-head { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; line-height: 1.25; }
.mx-head .handle { font-size: 10.5px; }
.mx-cell { width: 34px; height: 34px; border-radius: var(--radius-md); border: 1.5px dashed var(--border-strong); background: #fff; cursor: pointer; display: inline-grid; place-items: center; color: transparent; transition: all 120ms; }
.mx-cell:hover { border-color: var(--brand-azul); color: var(--fg-tertiary); }
.mx-cell svg { width: 16px; height: 16px; }
.mx-cell.is-on { border: 1.5px solid var(--brand-azul); background: var(--brand-azul); color: #fff; }
.mx-cell.is-inherited { border: 1.5px solid rgba(44,74,140,.25); background: var(--info-light); color: var(--brand-azul-claro); cursor: help; }
.mx-cell.is-disabled { opacity: .35; cursor: not-allowed; }
.mx-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--fg-secondary); align-items: center; }
.mx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mx-legend i { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.mx-dirty { position: sticky; bottom: 16px; margin-top: 16px; display: none; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--fg); color: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 5; }
.mx-dirty.is-on { display: flex; }
.mx-dirty .btn { border-color: rgba(255,255,255,.2); }

/* Seleção de permissões */
.perm-grid { display: grid; grid-template-columns: 1fr repeat(3, 96px); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; font-size: 12.5px; }
.perm-grid > div { padding: 9px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.perm-grid > div:nth-last-child(-n+4) { border-bottom: none; }
.perm-grid .h { background: var(--subtler); font-weight: 600; color: var(--fg-secondary); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; justify-content: center; }
.perm-grid .h:first-child { justify-content: flex-start; }
.perm-grid .c { justify-content: center; }
.perm-grid .c svg { width: 16px; height: 16px; color: var(--success); }
.perm-grid .c .no { width: 10px; height: 2px; background: var(--border-strong); border-radius: 2px; }
@media (max-width: 560px) { .perm-grid { grid-template-columns: 1fr repeat(3, 56px); } }

/* Lista de seleção dentro de drawer */
.pick-list { border: 1px solid var(--border); border-radius: var(--radius-md); max-height: 300px; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pick:last-child { border-bottom: none; }
.pick:hover { background: var(--subtler); }
.pick .person { flex: 1; }

.hbar .track, .hbar .fill { display: block; }

/* Sparkline simples */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.spark i { flex: 1; background: var(--brand-azul); border-radius: 3px 3px 1px 1px; opacity: .85; min-width: 4px; position: relative; }
.spark i.is-low { background: var(--brand-azul-claro); opacity: .45; }
.spark-axis { display: flex; justify-content: space-between; font: 500 11px 'JetBrains Mono', monospace; color: var(--fg-tertiary); margin-top: 6px; }

/* Detalhe de requisição (auditoria) */
.payload { font: 500 12px/1.6 'JetBrains Mono', monospace; background: #0F1E26; color: #CBD5E1; padding: 14px 16px; border-radius: var(--radius-md); overflow-x: auto; white-space: pre; margin: 0; }
.payload .k { color: #9DB7E8; }
.payload .s { color: #F6C38A; }
.payload .n { color: #8FD3B0; }

/* ---------- Ajustes de celular ---------- */
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .label { font-size: 10.5px; }
  .kpi .value { font-size: 24px; }
  .kpi .delta { font-size: 11.5px; }
  table.matrix thead th:first-child { min-width: 190px; }
  table.matrix tbody th .person small { display: none; }
  table.matrix thead th { min-width: 92px; }
}
.composer.is-drop .composer__box { border-color: var(--brand-azul); border-style: dashed; box-shadow: var(--ring-azul); }
.pend svg { width: 13px; height: 13px; color: var(--fg-tertiary); flex-shrink: 0; }
.pend .spin { width: 12px; height: 12px; border-width: 2px; color: var(--brand-azul); }
.pend__name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pend small { color: var(--fg-tertiary); }
.composer .icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.msg--out .attachments { margin-top: 8px; }
