/* Lenna Chat — painel do atendente. CSS nativo, prefixo cx-. Tokens alinhados à marca Lenna. */
:root {
  --cx-brand: #3636B8;
  --cx-brand-dark: #020024;
  --cx-brand-soft: #ECECFB;
  --cx-accent: #F2A007;
  --cx-bg: #FFFFFF;
  --cx-bg-2: #F3F3FC;
  --cx-line: #E3E3F1;
  --cx-text: #020024;
  --cx-text-2: #2D2D66;
  --cx-text-3: #5E5E88;
  --cx-ok: #12805C;
  --cx-warn: #B45309;
  --cx-danger: #C0362C;
  --cx-note: #FFF7E3;
  --cx-radius: 12px;
  --cx-radius-sm: 8px;
  --cx-font-title: 'Ubuntu', system-ui, sans-serif;
  --cx-font-body: 'Manrope', system-ui, sans-serif;
  --cx-t: 160ms ease;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
.cx-body { margin: 0; font-family: var(--cx-font-body); font-size: 14px; color: var(--cx-text); background: var(--cx-bg-2); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--cx-font-title); margin: 0; color: var(--cx-brand-dark); }
h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--cx-text-3); margin-bottom: 10px; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
.cx-muted { color: var(--cx-text-3); }
.cx-small { font-size: 12px; }
.cx-break { word-break: break-all; }
.cx-pre { white-space: pre-wrap; }
.cx-link { color: var(--cx-brand); font-weight: 600; text-decoration: none; }
.cx-error { color: var(--cx-danger); font-size: 12px; margin: 6px 0 0; }
.cx-empty { padding: 24px; text-align: center; color: var(--cx-text-3); list-style: none; }

/* Shell */
.cx-shell { display: flex; height: 100vh; }
.cx-rail { width: 64px; background: var(--cx-brand-dark); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; flex-shrink: 0; }
.cx-rail__brand { width: 38px; height: 38px; border-radius: 10px; background: var(--cx-brand); color: #fff; display: grid; place-items: center; font-family: var(--cx-font-title); font-weight: 700; text-decoration: none; margin-bottom: 14px; }
.cx-rail__item { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; color: #A9A9D6; background: none; border: 0; transition: background var(--cx-t), color var(--cx-t); }
.cx-rail__item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cx-rail__item:hover, .cx-rail__item.is-active { background: rgba(255,255,255,.1); color: #fff; }
.cx-rail__bottom { margin-top: auto; }
.cx-main { flex: 1; min-width: 0; overflow: hidden; }

/* Botões e campos */
.cx-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--cx-line); background: #fff; color: var(--cx-text-2); padding: 8px 14px; border-radius: var(--cx-radius-sm); font-weight: 600; transition: background var(--cx-t), border-color var(--cx-t); }
.cx-btn:hover { border-color: var(--cx-brand); }
.cx-btn--primary { background: var(--cx-brand); border-color: var(--cx-brand); color: #fff; }
.cx-btn--primary:hover { background: #2a2a99; }
.cx-btn--ghost { border-color: transparent; background: transparent; }
.cx-btn--sm { padding: 6px 10px; font-size: 12px; }
.cx-btn--block { width: 100%; justify-content: center; padding: 11px; }
.cx-btn[disabled] { opacity: .6; }
.cx-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.cx-field > span { font-size: 12px; font-weight: 600; color: var(--cx-text-2); }
.cx-field input, .cx-field textarea, .cx-search input, .cx-fu__add input { border: 1px solid var(--cx-line); border-radius: var(--cx-radius-sm); padding: 9px 11px; background: #fff; outline: none; transition: border-color var(--cx-t), box-shadow var(--cx-t); }
.cx-field input:focus, .cx-field textarea:focus, .cx-search input:focus, .cx-fu__add input:focus { border-color: var(--cx-brand); box-shadow: 0 0 0 3px var(--cx-brand-soft); }
.cx-field input[type=color] { padding: 2px; height: 38px; width: 70px; }
.cx-field--sm input { padding: 6px 9px; }
.cx-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--cx-text-2); margin-bottom: 10px; }

/* Pills e badges */
.cx-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--cx-bg-2); color: var(--cx-text-3); }
.cx-pill--bot { background: var(--cx-brand-soft); color: var(--cx-brand); }
.cx-pill--pending { background: #FDF0D5; color: var(--cx-warn); }
.cx-pill--human { background: #DDF3EA; color: var(--cx-ok); }
.cx-pill--ok { background: #DDF3EA; color: var(--cx-ok); }
.cx-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--cx-brand); color: #fff; font-size: 11px; }
.cx-badge--warn { background: var(--cx-accent); color: var(--cx-brand-dark); }
.cx-alert { margin: 10px 16px 0; padding: 10px 12px; border-radius: var(--cx-radius-sm); background: #FDF0D5; color: var(--cx-warn); font-size: 13px; }

/* Inbox: 3 colunas */
.cx-inbox { display: grid; grid-template-columns: 330px minmax(0, 1fr) 300px; height: 100vh; }
.cx-list { background: #fff; border-right: 1px solid var(--cx-line); display: flex; flex-direction: column; min-height: 0; }
.cx-list__head { padding: 18px 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.cx-tabs { display: flex; gap: 4px; padding: 0 12px; flex-wrap: wrap; }
.cx-tab { border: 0; background: none; padding: 6px 10px; border-radius: 99px; color: var(--cx-text-3); font-weight: 600; font-size: 12px; display: inline-flex; gap: 5px; align-items: center; }
.cx-tab.is-active { background: var(--cx-brand-soft); color: var(--cx-brand); }
.cx-search { padding: 10px 12px; }
.cx-search input { width: 100%; }
.cx-threads { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1; }
.cx-thread { width: 100%; display: flex; gap: 10px; text-align: left; border: 0; background: none; padding: 10px; border-radius: var(--cx-radius-sm); transition: background var(--cx-t); }
.cx-thread:hover { background: var(--cx-bg-2); }
.cx-thread.is-active { background: var(--cx-brand-soft); }
.cx-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--cx-brand-dark); color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.cx-thread__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cx-thread__top { display: flex; justify-content: space-between; gap: 8px; }
.cx-thread__top strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--cx-text); }
.cx-thread__top time { font-size: 11px; color: var(--cx-text-3); flex-shrink: 0; }
.cx-thread__meta { display: flex; justify-content: space-between; align-items: center; }

.cx-conv { display: flex; flex-direction: column; min-height: 0; background: var(--cx-bg-2); }
.cx-conv__empty { margin: auto; text-align: center; color: var(--cx-text-2); }
.cx-conv__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; background: #fff; border-bottom: 1px solid var(--cx-line); }
.cx-conv__head > div:first-child { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cx-conv__actions { display: flex; gap: 8px; }
.cx-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.cx-msg { max-width: 68%; padding: 10px 12px; border-radius: var(--cx-radius); background: #fff; border: 1px solid var(--cx-line); }
.cx-msg--in { align-self: flex-start; border-top-left-radius: 4px; }
.cx-msg--out { align-self: flex-end; background: var(--cx-brand); border-color: var(--cx-brand); color: #fff; border-top-right-radius: 4px; }
.cx-msg--bot { background: var(--cx-brand-soft); border-color: var(--cx-brand-soft); color: var(--cx-text); }
.cx-msg--note { background: var(--cx-note); border: 1px dashed var(--cx-accent); color: var(--cx-text); }
.cx-msg__who { font-size: 11px; opacity: .75; margin-bottom: 4px; }
.cx-msg__quote { font-size: 12px; border-left: 3px solid currentColor; padding-left: 8px; opacity: .7; margin-bottom: 6px; }
.cx-msg__text { line-height: 1.45; word-wrap: break-word; }
.cx-img { max-width: 260px; max-height: 260px; border-radius: var(--cx-radius-sm); display: block; margin-top: 6px; }
.cx-file { display: inline-block; margin-top: 6px; padding: 6px 10px; border-radius: var(--cx-radius-sm); background: rgba(0,0,0,.06); color: inherit; text-decoration: none; font-size: 13px; }
.cx-msg--out .cx-file { background: rgba(255,255,255,.18); }
.cx-msg audio { margin-top: 6px; max-width: 260px; }
.cx-event { align-self: center; font-size: 11px; color: var(--cx-text-3); background: #fff; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--cx-line); }

.cx-composer { background: #fff; border-top: 1px solid var(--cx-line); padding: 12px 16px; }
.cx-composer.is-note { background: var(--cx-note); }
.cx-composer textarea { width: 100%; border: 1px solid var(--cx-line); border-radius: var(--cx-radius-sm); padding: 10px 12px; resize: none; outline: none; background: #fff; }
.cx-composer textarea:focus { border-color: var(--cx-brand); }
.cx-composer__bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cx-composer__bar .cx-check { margin: 0; }
.cx-composer__bar .cx-btn--primary { margin-left: auto; }
.cx-composer > .cx-small { margin: 6px 0 0; }
.cx-uploads { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.cx-chip { background: var(--cx-bg-2); border-radius: 99px; padding: 4px 6px 4px 10px; font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.cx-chip button { border: 0; background: none; color: var(--cx-text-3); }

.cx-side { background: #fff; border-left: 1px solid var(--cx-line); overflow-y: auto; padding: 14px; }
.cx-card { background: #fff; border: 1px solid var(--cx-line); border-radius: var(--cx-radius); padding: 14px; margin-bottom: 12px; }
.cx-dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; font-size: 12px; }
.cx-dl dt { color: var(--cx-text-3); }
.cx-dl dd { margin: 0; }
.cx-fu { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cx-fu li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.cx-fu li small { display: block; color: var(--cx-text-3); }
.cx-fu li.is-done span { text-decoration: line-through; color: var(--cx-text-3); }
.cx-fu li.is-late small { color: var(--cx-danger); font-weight: 700; }
.cx-fu__add { display: flex; flex-direction: column; gap: 6px; }
.cx-fu__add input { padding: 6px 9px; }
.cx-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.cx-timeline li { display: flex; flex-direction: column; border-left: 2px solid var(--cx-line); padding-left: 8px; }
.cx-timeline small { color: var(--cx-text-3); }

/* Páginas */
.cx-page { padding: 24px 28px; height: 100vh; overflow-y: auto; }
.cx-page--narrow { max-width: 760px; }
.cx-page__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.cx-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--cx-radius); overflow: hidden; }
.cx-table th, .cx-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--cx-line); font-size: 13px; }
.cx-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--cx-text-3); background: var(--cx-bg-2); }
.cx-table tr.is-late td:nth-child(4) { color: var(--cx-danger); font-weight: 700; }
.cx-table tr.is-done td { color: var(--cx-text-3); }
.cx-form h3:not(:first-child) { margin-top: 18px; }
.cx-form textarea { resize: vertical; }
.cx-form__actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.cx-grid2 { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.cx-code { background: var(--cx-brand-dark); color: #E6E6FF; padding: 12px; border-radius: var(--cx-radius-sm); font-size: 12px; white-space: pre-wrap; word-break: break-all; cursor: copy; margin: 0; }
.cx-code.is-copied { outline: 2px solid var(--cx-accent); }

/* Fase 2 */
[x-cloak] { display: none !important; }
.cx-list__title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cx-alerts { border: 1px solid var(--cx-line); background: #fff; color: var(--cx-text-2); border-radius: 99px; padding: 4px 10px; font-size: 11px; font-weight: 700; }
.cx-thread__meta > span:first-child { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.cx-transfer { position: relative; }
.cx-transfer__pop { position: absolute; right: 0; top: calc(100% + 6px); width: 280px; background: #fff; border: 1px solid var(--cx-line); border-radius: var(--cx-radius); padding: 12px; box-shadow: 0 16px 40px rgba(2,0,36,.12); z-index: 20; }
.cx-transfer__pop select, .cx-field select { border: 1px solid var(--cx-line); border-radius: var(--cx-radius-sm); padding: 7px 9px; background: #fff; }
.cx-transcript { font-size: 12px; font-style: italic; margin-top: 4px; opacity: .85; max-width: 360px; }
.cx-canned-wrap { position: relative; }
.cx-canned { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); list-style: none; margin: 0; padding: 6px; background: #fff; border: 1px solid var(--cx-line); border-radius: var(--cx-radius); box-shadow: 0 16px 40px rgba(2,0,36,.12); max-height: 260px; overflow-y: auto; z-index: 20; }
.cx-canned li { padding: 7px 9px; border-radius: var(--cx-radius-sm); cursor: pointer; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-canned li b { color: var(--cx-brand); margin-right: 6px; }
.cx-canned li span { color: var(--cx-text-3); }
.cx-canned li.is-active, .cx-canned li:hover { background: var(--cx-brand-soft); }
.cx-members { list-style: none; margin: 0 0 12px; padding: 0; }
.cx-members li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--cx-line); }
.cx-members li:last-child { border-bottom: 0; }
.cx-members small { color: var(--cx-text-3); display: block; }
.cx-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.cx-inline .cx-field { margin: 0; flex: 1; min-width: 140px; }
.cx-teamgrid { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 4px; }
.cx-btn--danger { color: var(--cx-danger); }
.cx-btn--danger:hover { border-color: var(--cx-danger); }

/* Login */
.cx-login { display: grid; place-items: center; min-height: 100vh; }
.cx-login__card { width: min(380px, 92vw); background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 20px 50px rgba(2,0,36,.08); }
.cx-login__card h1 { margin-bottom: 18px; }
.cx-login__brand { display: flex; align-items: center; gap: 8px; font-family: var(--cx-font-title); font-weight: 700; margin-bottom: 18px; color: var(--cx-brand-dark); }
.cx-login__brand span { width: 30px; height: 30px; border-radius: 8px; background: var(--cx-brand); color: #fff; display: grid; place-items: center; }

@media (max-width: 1100px) {
  .cx-inbox { grid-template-columns: 290px minmax(0, 1fr); }
  .cx-side { display: none; }
}
.cx-back { display: none; border: 0; background: none; font-size: 20px; color: var(--cx-text-2); padding: 0 6px 0 0; }
@media (max-width: 720px) {
  .cx-rail { display: none; }
  .cx-inbox { grid-template-columns: 1fr; }
  .cx-inbox.has-thread .cx-list { display: none; }
  .cx-inbox:not(.has-thread) .cx-conv { display: none; }
  .cx-back { display: inline-block; }
  .cx-conv__head { flex-wrap: wrap; }
  .cx-msg { max-width: 88%; }
}
.cx-form .cx-alert, .cx-card .cx-alert { margin: 0 0 10px; }
