/* ==========================================================================
   Koechat — Design System
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  --brand-50:  #EEF3FF;
  --brand-100: #DCE6FF;
  --brand-200: #B9CDFF;
  --brand-300: #8AACFF;
  --brand-400: #5583FF;
  --brand-500: #1F5EFF;
  --brand-600: #1749CC;
  --brand-700: #12379B;

  --green-50:  #E7F8F1;  --green-500: #0E9F6E;  --green-600: #0B7D57;
  --amber-50:  #FEF6E7;  --amber-500: #E3A008;  --amber-600: #B47C06;
  --red-50:    #FDECEC;  --red-500:   #E02424;  --red-600:   #B41C1C;
  --violet-50: #F3EEFE;  --violet-500:#7C3AED;
  --cyan-50:   #E6F6FA;  --cyan-500:  #0891B2;
  --pink-500:  #DB2777;

  --bg:            #F4F6FB;
  --surface:       #FFFFFF;
  --surface-2:     #FAFBFD;
  --surface-3:     #F1F4F9;
  --sidebar-bg:    #0B1220;
  --sidebar-fg:    #94A3B8;
  --sidebar-fg-active: #FFFFFF;
  --sidebar-hover: rgba(255, 255, 255, .06);

  --ink:      #0F172A;
  --ink-2:    #334155;
  --muted:    #64748B;
  --muted-2:  #94A3B8;
  --border:   #E4E9F2;
  --border-2: #EEF1F7;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow:    0 4px 16px rgba(15, 23, 42, .07);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .12);
  --shadow-brand: 0 6px 18px rgba(31, 94, 255, .28);

  --sidebar-w: 252px;
  --topbar-h: 64px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --t-fast: 120ms cubic-bezier(.4, 0, .2, 1);
  --t: 200ms cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
  --bg:        #0A0F1A;
  --surface:   #111827;
  --surface-2: #0F1623;
  --surface-3: #1A2233;
  --sidebar-bg:#070B14;

  --ink:      #F1F5F9;
  --ink-2:    #CBD5E1;
  --muted:    #94A3B8;
  --muted-2:  #64748B;
  --border:   #1E2939;
  --border-2: #182233;

  --brand-50:  #10203F;
  --brand-100: #16294F;
  --green-50:  #0C2A20;
  --amber-50:  #2E2306;
  --red-50:    #33130F;
  --violet-50: #221540;
  --cyan-50:   #06252E;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow:    0 4px 16px rgba(0, 0, 0, .45);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
}

/* ----------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }

/* Ícone nunca estica: dentro de flex, um SVG sem dimensão ocupa o espaço
   inteiro. O helper icon() já emite width/height; isto é a rede de segurança
   para qualquer ícone colado à mão. Regras específicas continuam vencendo. */
svg[viewBox="0 0 24 24"] { flex: 0 0 auto; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 4px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: content-box; }

/* --------------------------------------------------------------- layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  transition: transform var(--t);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 20px;
  flex: 0 0 var(--topbar-h);
}

.sidebar__logo {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  display: grid; place-items: center;
  box-shadow: var(--shadow-brand);
  flex: 0 0 auto;
}
.sidebar__logo svg { width: 18px; height: 18px; }

.sidebar__name { color: #fff; font-weight: 700; font-size: 15.5px; letter-spacing: -.2px; }
.sidebar__name span { color: var(--brand-300); }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); background-clip: content-box; }

.nav-group { margin-top: 18px; }
.nav-group:first-child { margin-top: 4px; }
.nav-group__label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: #475569; padding: 0 10px 8px;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--sidebar-fg); font-weight: 500; font-size: 13.5px;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #E2E8F0; }
.nav-item.is-active { background: var(--brand-500); color: #fff; box-shadow: var(--shadow-brand); }
.nav-item.is-active svg { opacity: 1; }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .75; }
.nav-item__badge {
  margin-left: auto; background: var(--red-500); color: #fff;
  font-size: 10.5px; font-weight: 700; min-width: 19px; height: 19px;
  border-radius: 99px; display: grid; place-items: center; padding: 0 5px;
}
.nav-item.is-active .nav-item__badge { background: rgba(255,255,255,.24); }

.sidebar__foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar__user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm);
  transition: background var(--t-fast);
}
.sidebar__user:hover { background: var(--sidebar-hover); }
.sidebar__user-info { min-width: 0; flex: 1; }
.sidebar__user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-role { font-size: 11.5px; color: #64748B; }

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 40;
}
.topbar__title { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.topbar__sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search {
  position: relative; width: 300px; max-width: 34vw;
}
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-3); transition: var(--t-fast);
}
.search input:focus { background: var(--surface); border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-50); outline: none; }
.search svg { position: absolute; left: 11px; top: 10px; width: 17px; height: 17px; color: var(--muted-2); }

.page { padding: 24px; flex: 1; min-width: 0; }

/* Páginas "flush" (inbox) ocupam exatamente a viewport e rolam internamente. */
.page--flush {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* flex:0 0 auto para que a altura fixa vença o flex-grow herdado de .page */
  flex: 0 0 auto;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h)); /* respeita a barra de endereço no mobile */
  min-height: 0;
}

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head__text h2 { font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.page-head__text p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.page-head__actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- utils */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4{margin-top:4px}.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}
.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}.mb-24{margin-bottom:24px}
.ml-auto { margin-left: auto; }
.flex-1 { flex: 1; min-width: 0; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-lg { font-size: 16px; }
.text-bold { font-weight: 600; }
.text-strong { font-weight: 700; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.pos-up { color: var(--green-500); } .pos-down { color: var(--red-500); }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card__head {
  padding: 16px 18px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; gap: 12px;
}
.card__title { font-size: 14.5px; font-weight: 650; letter-spacing: -.2px; }
.card__sub { font-size: 12.5px; color: var(--muted); }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--border-2); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ------------------------------------------------------------- kpi cards */
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  position: relative; overflow: hidden;
  transition: transform var(--t), box-shadow var(--t);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi__icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; margin-bottom: 14px;
}
.kpi__icon svg { width: 19px; height: 19px; }
.kpi__label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi__value { font-size: 25px; font-weight: 700; letter-spacing: -.8px; margin-top: 3px; line-height: 1.15; }
.kpi__delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-top: 8px; }
.kpi__spark { position: absolute; right: 0; bottom: 0; opacity: .5; pointer-events: none; }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  background: var(--surface-3); color: var(--ink-2);
  transition: var(--t-fast); white-space: nowrap;
}
.btn:hover { background: var(--border-2); }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--brand-500); color: #fff; box-shadow: var(--shadow-brand); }
.btn--primary:hover { background: var(--brand-600); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); border-color: var(--muted-2); }
.btn--success { background: var(--green-500); color: #fff; }
.btn--success:hover { background: var(--green-600); }
.btn--danger { background: var(--red-50); color: var(--red-500); }
.btn--danger:hover { background: var(--red-500); color: #fff; }
.btn--sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: var(--radius-xs); }
.btn--lg { height: 44px; padding: 0 22px; font-size: 14.5px; }
.btn--block { width: 100%; }
.btn--icon { width: 38px; padding: 0; }
.btn--icon.btn--sm { width: 32px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; transition: var(--t-fast);
  position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn__dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--red-500); border: 2px solid var(--surface); }

/* --------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.badge--info    { background: var(--brand-50);  color: var(--brand-500); }
.badge--success { background: var(--green-50);  color: var(--green-500); }
.badge--warning { background: var(--amber-50);  color: var(--amber-600); }
.badge--danger  { background: var(--red-50);    color: var(--red-500); }
.badge--violet  { background: var(--violet-50); color: var(--violet-500); }
.badge--neutral { background: var(--surface-3); color: var(--muted); }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--lg { height: 26px; font-size: 12px; padding: 0 11px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: 7px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--border);
}

/* -------------------------------------------------------------- avatars */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; flex: 0 0 auto;
  color: #fff; font-size: 12.5px; font-weight: 650; letter-spacing: -.2px;
  position: relative; user-select: none;
}
.avatar--sm { width: 28px; height: 28px; font-size: 10.5px; }
.avatar--xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar--lg { width: 52px; height: 52px; font-size: 17px; }
.avatar--xl { width: 72px; height: 72px; font-size: 24px; border-radius: 20px; }
.avatar__presence {
  position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--surface); background: var(--muted-2);
}
.avatar__presence--online { background: var(--green-500); }
.avatar__presence--busy { background: var(--amber-500); }
.avatar__channel {
  position: absolute; right: -3px; bottom: -3px;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--surface);
  display: grid; place-items: center;
}
.avatar__channel svg { width: 9px; height: 9px; color: #fff; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
  padding: 11px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th:first-child { border-radius: 0; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table--clickable tbody tr { cursor: pointer; }

/* --------------------------------------------------------------- inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 11.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: var(--t-fast);
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-50);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px;
}
.input--error { border-color: var(--red-500); }
.error-text { font-size: 11.5px; color: var(--red-500); }
.input-group { position: relative; }
.input-group__prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.input-group .input { padding-left: 40px; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track {
  position: absolute; inset: 0; background: var(--border); border-radius: 99px;
  cursor: pointer; transition: var(--t-fast);
}
.switch__track::before {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  transition: var(--t-fast); box-shadow: var(--shadow-xs);
}
.switch input:checked + .switch__track { background: var(--brand-500); }
.switch input:checked + .switch__track::before { transform: translateX(18px); }

/* --------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
  transition: var(--t-fast); white-space: nowrap;
}
.tab:hover { color: var(--ink-2); }
.tab.is-active { color: var(--brand-500); border-bottom-color: var(--brand-500); }

.segment { display: inline-flex; background: var(--surface-3); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segment a, .segment button {
  padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); border: 0; background: transparent; cursor: pointer; transition: var(--t-fast);
}
.segment a.is-active, .segment button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }

/* ------------------------------------------------------------- dropdown */
.dropdown { position: relative; }
.dropdown__menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  min-width: 200px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: var(--t-fast);
}
.dropdown.is-open .dropdown__menu { opacity: 1; visibility: visible; transform: none; }
.dropdown__menu--left { right: auto; left: 0; }
.dropdown__item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-xs);
  font-size: 13px; color: var(--ink-2); cursor: pointer; width: 100%;
  background: transparent; border: 0; text-align: left; transition: var(--t-fast);
}
.dropdown__item:hover { background: var(--surface-3); }
.dropdown__item svg { width: 16px; height: 16px; color: var(--muted); }
.dropdown__item--danger { color: var(--red-500); }
.dropdown__item--danger svg { color: var(--red-500); }
.dropdown__sep { height: 1px; background: var(--border-2); margin: 5px 0; }
.dropdown__label { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2); padding: 7px 10px 4px; }

/* ---------------------------------------------------------------- inbox */
.inbox { display: flex; flex: 1; min-height: 0; overflow: hidden; }

.inbox__list {
  width: 340px; flex: 0 0 340px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column; min-height: 0;
}
.inbox__filters { padding: 12px 14px; border-bottom: 1px solid var(--border-2); display: flex; flex-direction: column; gap: 10px; }
.inbox__scroll { overflow-y: auto; flex: 1; }

.conv {
  display: flex; gap: 11px; padding: 13px 14px;
  border-bottom: 1px solid var(--border-2); cursor: pointer;
  transition: background var(--t-fast); position: relative;
}
.conv:hover { background: var(--surface-2); }
.conv.is-active { background: var(--brand-50); }
.conv.is-active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand-500); }
.conv__body { min-width: 0; flex: 1; }
.conv__top { display: flex; align-items: baseline; gap: 8px; }
.conv__name { font-weight: 650; font-size: 13.5px; }
.conv__time { margin-left: auto; font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.conv__preview { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.conv__meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.conv__unread {
  min-width: 18px; height: 18px; border-radius: 99px; background: var(--brand-500);
  color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 5px;
}

.thread { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--surface-2); }
.thread__head {
  height: 66px; flex: 0 0 66px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 18px;
}
.thread__back { display: none; margin-left: -6px; }
.thread__scroll { flex: 1; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 3px; }
.thread__daysep { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.thread__daysep::before, .thread__daysep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.thread__daysep span { font-size: 11.5px; color: var(--muted); font-weight: 600; }

.bubble-row { display: flex; margin-bottom: 10px; }
.bubble-row--out { justify-content: flex-end; }
.bubble-row--note { justify-content: center; }

/* O balão NÃO usa white-space: pre-wrap — só o texto usa.
   Com pre-wrap no balão, toda a indentação do template PHP virava espaço
   literal e um "ok" de uma linha ocupava 160px de altura. */
.bubble {
  max-width: min(560px, 74%); padding: 10px 13px;
  border-radius: 14px; font-size: 13.5px; line-height: 1.5;
  box-shadow: var(--shadow-xs); overflow-wrap: anywhere;
}
.bubble__text { white-space: pre-wrap; }
.bubble--media { padding: 5px 5px 6px; }
.bubble--media .bubble__text { padding: 4px 8px 0; }
.bubble--media .bubble__meta { padding: 0 8px; }
.bubble--media .bubble__author { padding: 5px 8px 0; }

/* ---------------------------------------------------------- mídia no balão */
.bubble__image { display: block; border-radius: 10px; overflow: hidden; line-height: 0; }
.bubble__image img {
  width: 100%; max-width: 320px; max-height: 340px;
  object-fit: cover; cursor: zoom-in;
  transition: opacity var(--t-fast);
}
.bubble__image:hover img { opacity: .9; }

.bubble__audio { min-width: 260px; }
.bubble__audio audio { width: 100%; height: 38px; display: block; }
.bubble__audio-meta {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; opacity: .75; margin-top: 4px; padding: 0 2px;
}
.bubble--out .bubble__audio audio,
.bubble--ai .bubble__audio audio { filter: invert(1) hue-rotate(180deg); }

.bubble__video video { width: 100%; max-width: 320px; border-radius: 10px; display: block; }

.bubble__file {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 10px;
  background: rgba(127, 127, 127, .12);
  min-width: 220px; transition: background var(--t-fast);
}
.bubble__file:hover { background: rgba(127, 127, 127, .2); }
.bubble__file-icon { display: grid; place-items: center; flex: 0 0 auto; opacity: .8; }
.bubble__file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bubble__file-name { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble__file-size { font-size: 11px; opacity: .7; }

/* Visualizador de imagem em tela cheia */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(2, 6, 16, .92);
  display: grid; place-items: center; padding: 32px;
  animation: fade-in 140ms ease;
}
.lightbox img { max-width: 100%; max-height: 88vh; border-radius: 10px; }
.lightbox__bar {
  position: absolute; top: 16px; left: 20px; right: 20px;
  display: flex; align-items: center; gap: 12px; color: #fff;
}
.lightbox__name { font-size: 13.5px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox__actions { margin-left: auto; display: flex; gap: 8px; }
.lightbox__actions a, .lightbox__actions button {
  width: 38px; height: 38px; border-radius: 10px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff;
  display: grid; place-items: center; transition: background var(--t-fast);
}
.lightbox__actions a:hover, .lightbox__actions button:hover { background: rgba(255, 255, 255, .26); }
.bubble--in { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble--out { background: var(--brand-500); color: #fff; border-bottom-right-radius: 4px; }
.bubble--note { background: var(--amber-50); border: 1px dashed var(--amber-500); color: var(--amber-600); max-width: 620px; }
.bubble__meta { display: flex; align-items: center; gap: 5px; font-size: 10.5px; margin-top: 5px; opacity: .75; }
.bubble--out .bubble__meta { justify-content: flex-end; }
.bubble__author { font-size: 11px; font-weight: 650; margin-bottom: 3px; opacity: .85; }

/* Faixa de status do assistente, acima da thread. */
.ai-banner {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 18px; font-size: 13px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.ai-banner svg { width: 17px; height: 17px; flex: 0 0 17px; }
.ai-banner .text-xs { display: block; opacity: .8; margin-top: 1px; }

/* Bolha gerada por IA: mesma família da resposta humana, tom distinto. */
.bubble--ai {
  background: linear-gradient(135deg, #7C3AED, #6D28D9);
  color: #fff;
}
.bubble--ai .bubble__author { opacity: .9; }

.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 12px 18px 14px; }
.composer__tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.composer__tab {
  padding: 5px 11px; border-radius: 7px; font-size: 12px; font-weight: 650;
  color: var(--muted); cursor: pointer; border: 0; background: transparent; transition: var(--t-fast);
}
.composer__tab.is-active { background: var(--brand-50); color: var(--brand-500); }
.composer__tab.is-active[data-mode="note"] { background: var(--amber-50); color: var(--amber-600); }
.composer__box {
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: var(--t-fast); background: var(--surface);
}
.composer__box:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-50); }
.composer.is-note .composer__box:focus-within { border-color: var(--amber-500); box-shadow: 0 0 0 3px var(--amber-50); }
.composer textarea {
  width: 100%; border: 0; background: transparent; resize: none;
  padding: 11px 13px; min-height: 62px; max-height: 200px; outline: none; line-height: 1.55;
}
.composer__bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px 8px; }

.context-panel {
  width: 320px; flex: 0 0 320px; background: var(--surface);
  border-left: 1px solid var(--border); overflow-y: auto;
}
.context-panel__section { padding: 16px 18px; border-bottom: 1px solid var(--border-2); }
.context-panel__title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: 11px; display: flex; align-items: center; gap: 8px;
}
.datalist { display: flex; flex-direction: column; gap: 9px; }
.datalist__row { display: flex; gap: 10px; font-size: 12.5px; align-items: flex-start; }
.datalist__key { color: var(--muted); width: 82px; flex: 0 0 82px; }
.datalist__val { flex: 1; min-width: 0; font-weight: 500; word-break: break-word; }

/* --------------------------------------------------------------- kanban */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.kcol {
  width: 296px; flex: 0 0 296px;
  background: var(--surface-3); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; max-height: calc(100vh - 230px);
}
.kcol__head { padding: 13px 14px 10px; display: flex; align-items: center; gap: 8px; }
.kcol__dot { width: 8px; height: 8px; border-radius: 50%; }
.kcol__name { font-size: 13px; font-weight: 650; }
.kcol__count { font-size: 11.5px; color: var(--muted); background: var(--surface); padding: 1px 7px; border-radius: 99px; font-weight: 600; }
.kcol__total { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); }
.kcol__body { padding: 0 10px 10px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 9px; min-height: 70px; }
.kcol.is-over .kcol__body { outline: 2px dashed var(--brand-400); outline-offset: -4px; border-radius: var(--radius); }

.kcard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; cursor: grab;
  box-shadow: var(--shadow-xs); transition: box-shadow var(--t), transform var(--t);
}
.kcard:hover { box-shadow: var(--shadow); }
.kcard.is-dragging { opacity: .45; transform: rotate(1.5deg); }
.kcard__title { font-size: 13px; font-weight: 650; line-height: 1.35; }
.kcard__contact { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kcard__foot { display: flex; align-items: center; gap: 8px; margin-top: 11px; }
.kcard__value { font-size: 13.5px; font-weight: 700; letter-spacing: -.2px; }

/* ------------------------------------------------------------- timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item__dot {
  position: absolute; left: -22px; top: 3px; width: 10px; height: 10px;
  border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--border);
}
.tl-item__title { font-size: 13.5px; font-weight: 600; }
.tl-item__meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tl-item__body { font-size: 13px; color: var(--ink-2); margin-top: 6px; background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); }

/* ------------------------------------------------------------- progress */
.progress { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress__bar { height: 100%; border-radius: 99px; background: var(--brand-500); transition: width var(--t); }
.progress--lg { height: 10px; }

.meter { display: flex; height: 9px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.meter span { height: 100%; }

/* --------------------------------------------------------------- alerts */
.alert {
  display: flex; gap: 11px; padding: 13px 15px;
  border-radius: var(--radius); font-size: 13px; align-items: flex-start;
  border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.alert--info { background: var(--brand-50); color: var(--brand-600); border-color: var(--brand-100); }
.alert--success { background: var(--green-50); color: var(--green-600); }
.alert--warning { background: var(--amber-50); color: var(--amber-600); }
.alert--danger { background: var(--red-50); color: var(--red-600); }

/* --------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 13px 15px; min-width: 290px; max-width: 380px; font-size: 13px;
  animation: toast-in 260ms cubic-bezier(.2, .9, .3, 1.2);
}
.toast__bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 3px 0 0 3px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.96); } }

/* --------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(3px); z-index: 100;
  display: grid; place-items: center; padding: 24px;
  animation: fade-in 140ms ease;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: modal-in 220ms cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal--lg { max-width: 760px; }
.modal__head { padding: 20px 22px 0; }
.modal__title { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.modal__body { padding: 18px 22px; }
.modal__foot { padding: 16px 22px; border-top: 1px solid var(--border-2); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------------------------------------------------- empty state */
.empty { text-align: center; padding: 52px 24px; }
.empty__icon {
  width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 18px;
  background: var(--surface-3); display: grid; place-items: center; color: var(--muted-2);
}
.empty__icon svg { width: 26px; height: 26px; }
.empty__title { font-size: 15px; font-weight: 650; }
.empty__text { font-size: 13px; color: var(--muted); margin-top: 5px; max-width: 380px; margin-inline: auto; }

/* ---------------------------------------------------------------- login */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth__aside {
  background: linear-gradient(155deg, #0B1220 0%, #12379B 55%, #1F5EFF 100%);
  color: #fff; padding: 52px; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.auth__aside::after {
  content: ""; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.13), transparent 65%);
  right: -220px; bottom: -260px;
}
.auth__aside::before {
  content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(85,131,255,.28), transparent 70%);
  left: -140px; top: -120px;
}
.auth__brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 19px; position: relative; z-index: 1; }
.auth__pitch { margin-top: auto; position: relative; z-index: 1; }
.auth__pitch h1 { font-size: 34px; font-weight: 700; line-height: 1.2; letter-spacing: -1px; max-width: 15ch; }
.auth__pitch p { margin-top: 14px; color: rgba(255,255,255,.72); font-size: 15px; max-width: 44ch; line-height: 1.6; }
.auth__stats { display: flex; gap: 34px; margin-top: 38px; }
.auth__stat strong { display: block; font-size: 25px; font-weight: 700; letter-spacing: -.5px; }
.auth__stat span { font-size: 12.5px; color: rgba(255,255,255,.62); }
.auth__main { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth__form { width: 100%; max-width: 372px; }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
}

/* ---------------------------------------------------------------- misc */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); flex: 0 0 3px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--border-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-xs); }
@keyframes shimmer { to { background-position: -200% 0; } }

.stat-line { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-2); font-size: 13px; }
.stat-line:last-child { border-bottom: 0; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; }
.legend__item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend__swatch { width: 9px; height: 9px; border-radius: 3px; }

.pagination { display: flex; gap: 5px; align-items: center; }
.pagination a, .pagination span {
  min-width: 32px; height: 32px; padding: 0 9px; border-radius: var(--radius-xs);
  display: grid; place-items: center; font-size: 12.5px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border); transition: var(--t-fast);
}
.pagination a:hover { background: var(--surface-3); color: var(--ink); }
.pagination .is-active { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.pagination .is-disabled { opacity: .4; pointer-events: none; }

/* ------------------------------------------------------------ responsive */
.sidebar__toggle { display: none; }

@media (max-width: 1280px) {
  .context-panel { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  /* Grids com colunas definidas inline nas views também colapsam. */
  .page .grid[style] { grid-template-columns: minmax(0, 1fr) !important; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .sidebar__toggle { display: grid; }
  .grid-3 { grid-template-columns: 1fr; }
  .search { width: 200px; }
}
@media (max-width: 820px) {
  .inbox__list { width: 100%; flex: 1 1 auto; }
  .inbox.has-thread .inbox__list { display: none; }
  .inbox:not(.has-thread) .thread { display: none; }
  .thread__back { display: grid; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .page { padding: 16px; }
  .search { display: none; }
}

@media print {
  .sidebar, .topbar, .page-head__actions, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .card { break-inside: avoid; box-shadow: none; }
  body { background: #fff; }
}

/* Pilha de blocos de canal: a ordem visual segue o que está utilizável —
   sem app da Meta configurado, o QR Code (que funciona local) vem primeiro. */
.channel-stack { display: flex; flex-direction: column; }

/* ------------------------------------------------- fila de atendimento */
/* Os seis filtros não cabem na largura da lista. Antes a faixa rolava na
   horizontal com a barra escondida: "Pendentes" e "Resolvidas" existiam mas
   ninguém descobria. Quebrar em duas linhas custa 28px e mostra tudo. */
.inbox__tabs {
  display: flex; flex-wrap: wrap; gap: 2px;
  background: var(--surface-3); border-radius: var(--radius-sm); padding: 3px;
}
.inbox__tab {
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 5px 9px; border-radius: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  transition: var(--t-fast);
}
.inbox__tab:hover { color: var(--ink-2); }
.inbox__tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }
.inbox__tab-count {
  font-size: 10.5px; font-weight: 700; padding: 1px 5px; border-radius: 99px;
  background: var(--border); color: var(--muted);
}
.inbox__tab.is-active .inbox__tab-count { background: var(--brand-50); color: var(--brand-500); }
.inbox__tab-count.is-alert { background: var(--red-500); color: #fff; }

.inbox__control {
  display: flex; align-items: center; gap: 6px; width: 100%;
  height: 32px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--surface); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: var(--t-fast);
}
.inbox__control:hover { background: var(--surface-3); }

/* Não lida ganha peso visual: é o que não pode passar batido. */
.conv.is-unread { background: var(--brand-50); }
.conv.is-unread .conv__name { font-weight: 750; }
.conv.is-unread .conv__preview { color: var(--ink-2); font-weight: 500; }
.conv.is-unread::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--brand-500);
}
.conv.is-active.is-unread::after { background: var(--brand-600); }

.conv__preview-who { color: var(--muted-2); }
.conv__preview-media { display: inline-flex; vertical-align: -2px; margin-right: 2px; opacity: .7; }
.conv__tag {
  font-size: 10.5px; font-weight: 600; padding: 1px 6px;
  border-radius: 5px; white-space: nowrap;
}
.conv__waiting {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 700;
  color: var(--amber-600); background: var(--amber-50);
  padding: 1px 6px; border-radius: 99px;
}
.conv__waiting.is-late { color: var(--red-500); background: var(--red-50); }

/* ------------------------------------------------ anexo no composer */
.composer__attachment {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 8px;
  background: var(--surface-3); border-radius: var(--radius-sm);
}
.composer__attachment-thumb {
  width: 38px; height: 38px; border-radius: 8px; flex: 0 0 38px;
  display: grid; place-items: center; overflow: hidden;
  background: var(--surface); color: var(--muted);
}
.composer__attachment-thumb img { width: 100%; height: 100%; object-fit: cover; }
.composer__attachment-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }

/* Aviso de canal que não entrega — precede o composer. */
.composer__blocked {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 18px;
  background: var(--amber-50); color: var(--amber-600);
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.composer__blocked svg { width: 18px; height: 18px; flex: 0 0 18px; }
.composer__blocked .text-xs { opacity: .9; margin-top: 1px; }
.composer.is-blocked { border-top: 0; }
.composer.is-blocked .composer__box { border-style: dashed; }

/* Mensagem que não foi entregue não pode parecer entregue. */
.bubble--out .bubble__meta { gap: 4px; }
.bubble__meta--failed { color: #FFD9D9; font-weight: 600; }

/* Checklist de pré-requisitos de um canal. */
.channel-req { font-size: 13px; }
.channel-req summary {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-weight: 600; padding: 4px 0;
  list-style: none;
}
.channel-req summary::-webkit-details-marker { display: none; }
.channel-req summary::after {
  content: "▾"; margin-left: auto; opacity: .5; transition: transform var(--t-fast);
}
.channel-req[open] summary::after { transform: rotate(180deg); }
.channel-req__list { margin: 10px 0 0; padding-left: 20px; list-style: decimal; }
.channel-req__list li { margin-bottom: 8px; line-height: 1.5; }
.channel-req__note { margin-top: 10px; font-size: 12.5px; opacity: .85; }

/* ------------------------------------------------ indicador de canais */
/* Um resumo só, ao lado dos outros botões do topo. A versão anterior
   listava cada canal em linha: com cinco conexões a barra quebrava para
   uma segunda linha e cobria o subtítulo da página. O detalhe agora está
   no menu — o que precisa ficar visível o tempo todo é "está tudo no ar?". */
.conex {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--ink-2); font-size: 12.5px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.conex:hover { background: var(--surface-1); border-color: var(--border-1); }
.conex__num { font-weight: 700; font-variant-numeric: tabular-nums; }
.conex__rot { color: var(--ink-3); }
.conex__dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--green-500); box-shadow: 0 0 0 3px rgba(14,159,110,.16);
}
.conex__dot.is-down { background: var(--red-500); box-shadow: 0 0 0 3px rgba(224,36,36,.16); }
/* Canal fora do ar é urgente: some com a discrição do resumo. */
.conex:has(.conex__dot.is-down) { border-color: var(--red-200, #fecaca); background: var(--red-50); color: var(--red-600); }
.conex:has(.conex__dot.is-down) .conex__rot { color: var(--red-600); opacity: .8; }
@media (max-width: 900px) { .conex__rot { display: none; } }

/* ------------------------------------------------------ uso do plano */
.plano { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.07); font-size: 11.5px; }
.plano__topo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.plano__nome { font-weight: 700; color: #e2e8f0; letter-spacing: .2px; }
.plano__link { color: #64748b; text-decoration: none; font-size: 11px; }
.plano__link:hover { color: #94a3b8; }
.plano__linha { display: flex; justify-content: space-between; color: #94a3b8; margin-bottom: 3px; }
.plano__cheio { color: #f87171; font-weight: 650; }
.plano__barra { height: 3px; border-radius: 2px; background: rgba(255,255,255,.09); margin-bottom: 9px; overflow: hidden; }
.plano__barra i { display: block; height: 100%; background: #60a5fa; border-radius: 2px; }
.plano__barra i.is-full { background: #f87171; }

/* ------------------------------------------------ gravação de áudio */
/* Enquanto grava, a barra do composer vira painel de gravação: o atendente
   precisa ver que o microfone está aberto e quanto tempo já passou. */
.rec { display: flex; align-items: center; gap: 8px; flex: 1; }
.rec__dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--red-500);
  animation: rec-pulse 1.2s ease-in-out infinite; flex: none;
}
.rec__time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; color: var(--ink); }
.rec__hint { font-size: 12px; color: var(--muted); margin-right: auto; }
@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec__dot { animation: none; } }

/* --------------------------------------------- falha de entrega */
/* "Não entregue" sozinho não diz o que fazer. O motivo e o botão de reenviar
   ficam colados na mensagem que falhou, que é onde a pessoa está olhando. */
.bubble__falha {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding: 7px 9px; border-radius: 8px;
  background: var(--red-50); color: var(--red-600);
  font-size: 11.5px; line-height: 1.35;
}
.bubble--out .bubble__falha { background: rgba(255,255,255,.16); color: #fff; }
.bubble__reenviar {
  margin-left: auto; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid currentColor; background: transparent; color: inherit;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.bubble__reenviar:hover:not(:disabled) { background: rgba(255,255,255,.22); }
.bubble__reenviar:disabled { opacity: .6; cursor: default; }
