/* ================================================================================================
   Atendimento — design system (a marca de cada ambiente vem do /brand.css, gerado do brand.json)
   Camadas: 1) fontes  2) tokens (primitivos → semânticos, claro/escuro)  3) base
            4) componentes  5) layout da caixa de entrada  6) telas avulsas (login)  7) responsivo
   Documentação: docs/design-system.md
   ================================================================================================ */

/* ---- 1. Fontes --------------------------------------------------------------------------------- */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- 2. Tokens ----------------------------------------------------------------------------------- */
:root {
  /* primitivos da marca (padrão neutro; o /brand.css de cada ambiente sobrescreve --p-* e --ink) */
  --p-50: #EFF6FF; --p-100: #DBEAFE; --p-200: #BFDBFE; --p-300: #93C5FD; --p-400: #60A5FA;
  --p-500: #3B82F6; --p-600: #2563EB; --p-700: #1D4ED8; --p-800: #1E40AF; --p-900: #1E3A8A;
  --ink: #0F172A;

  /* tipografia */
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --fs-2xs: 11px; --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 18px; --fs-2xl: 22px;
  --lh-tight: 1.25; --lh: 1.45;
  --fw-regular: 450; --fw-medium: 550; --fw-semibold: 650; --fw-bold: 750;

  /* espaçamento (grade de 4 px) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* raios */
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;

  /* movimento */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;

  /* camadas */
  --z-panel: 10; --z-pop: 20; --z-modal: 40; --z-toast: 50;

  /* medidas */
  --topbar-h: 60px; --sidebar-w: 360px; --lead-w: 320px; --control-h: 38px;

  /* semânticos — tema claro */
  /* superfícies claras levemente tingidas pela cor da marca */
  --bg: color-mix(in srgb, var(--p-500) 3%, #FFFFFF);
  --surface: #FFFFFF;
  --surface-2: color-mix(in srgb, var(--p-500) 4%, #FFFFFF);
  --surface-3: color-mix(in srgb, var(--p-500) 8%, #FFFFFF);
  --surface-sunken: color-mix(in srgb, var(--p-500) 5%, #FFFFFF);
  --border: color-mix(in srgb, var(--p-700) 11%, #FFFFFF);
  --border-strong: color-mix(in srgb, var(--p-700) 17%, #FFFFFF);
  --text: var(--ink);
  --text-muted: color-mix(in srgb, var(--ink) 66%, #FFFFFF);
  --text-subtle: color-mix(in srgb, var(--ink) 46%, #FFFFFF);
  --brand: var(--p-600);
  --brand-hover: var(--p-700);
  --brand-soft: var(--p-50);
  --brand-soft-2: var(--p-100);
  --brand-text: var(--p-700);
  --on-brand: #FFFFFF;
  --success: #15803D; --success-soft: #DCFCE7;
  --warning: #B45309; --warning-soft: #FEF3C7;
  --violet: #6D28D9;  --violet-soft: #EDE9FE;
  --info: #1D4ED8;    --info-soft: #DBEAFE;
  --neutral-soft: color-mix(in srgb, var(--ink) 6%, #FFFFFF);
  --chat-bg: color-mix(in srgb, var(--p-500) 5%, #FFFFFF);
  --bubble-in: #FFFFFF;
  --bubble-out: color-mix(in srgb, var(--p-100) 75%, #FFFFFF);
  --bubble-out-border: var(--p-200);
  --focus: 0 0 0 3px color-mix(in srgb, var(--p-600) 28%, transparent);
  --shadow-xs: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent);
  --shadow-sm: 0 1px 3px color-mix(in srgb, var(--ink) 8%, transparent), 0 1px 2px color-mix(in srgb, var(--ink) 4%, transparent);
  --shadow-md: 0 8px 24px -6px color-mix(in srgb, var(--ink) 14%, transparent), 0 2px 6px color-mix(in srgb, var(--ink) 5%, transparent);
  --shadow-lg: 0 24px 60px -12px color-mix(in srgb, var(--ink) 28%, transparent);
  --scrim: color-mix(in srgb, var(--ink) 42%, transparent);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* tema escuro neutro: preto e grafite, sem tom avermelhado nem azulado */
    --bg: #0A0A0A;
    --surface: #121212;
    --surface-2: #181818;
    --surface-3: #202020;
    --surface-sunken: #0E0E0E;
    --border: #232323;
    --border-strong: #2E2E2E;
    --text: #EDEDED;
    --text-muted: #A3A3A3;
    --text-subtle: #737373;
    --brand: var(--p-600);
    --brand-hover: var(--p-500);
    --brand-soft: #1E1E1E;
    --brand-soft-2: #262626;
    --brand-text: var(--p-400);
    --success: #4ADE80; --success-soft: #16261B;
    --warning: #FBBF24; --warning-soft: #2A2214;
    --violet: #C4B5FD;  --violet-soft: #221D2E;
    --info: #93C5FD;    --info-soft: #172131;
    --neutral-soft: #1F1F1F;
    --chat-bg: #0D0D0D;
    --bubble-in: #1A1A1A;
    --bubble-out: #262626;
    --bubble-out-border: #303030;
    --focus: 0 0 0 3px color-mix(in srgb, var(--p-500) 26%, transparent);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
    --shadow-md: 0 10px 28px -8px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .4);
    --shadow-lg: 0 28px 70px -14px rgba(0, 0, 0, .85);
    --scrim: rgba(0, 0, 0, .62);
    color-scheme: dark;
  }
}

/* ---- 3. Base ------------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: var(--fw-regular);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-text); text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: var(--lh-tight); font-weight: var(--fw-bold); letter-spacing: -.01em; }
::selection { background: color-mix(in srgb, var(--p-600) 22%, transparent); }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: var(--r-sm); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ---- 4. Componentes ------------------------------------------------------------------------------ */

/* ícones (SVG em linha, herdam a cor do texto) */
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: middle; }
.i-sm { width: 14px; height: 14px; }
.i-lg { width: 22px; height: 22px; }

/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: var(--control-h); padding: 0 var(--sp-4);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); text-decoration: none; white-space: nowrap;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-xs); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--brand-text); }
.btn.danger:hover { background: var(--brand-soft); border-color: var(--brand-soft-2); }
.btn.sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-xs); border-radius: var(--r-xs); }
.btn.block { width: 100%; }

.icon-btn {
  width: var(--control-h); height: var(--control-h); flex: none;
  display: inline-grid; place-items: center;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-muted);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; background: transparent; }
.icon-btn.active { color: var(--brand-text); background: var(--brand-soft); }

/* campos */
.input, .select, .textarea, .field input, .field select, .field textarea, .modal input, .modal textarea, .modal select {
  width: 100%; min-height: var(--control-h);
  padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.textarea, .field textarea, .modal textarea { resize: vertical; line-height: var(--lh); }
.input::placeholder, textarea::placeholder, input::placeholder { color: var(--text-subtle); }
.input:focus, .select:focus, .textarea:focus, .field :is(input, select, textarea):focus,
.modal :is(input, select, textarea):focus { border-color: var(--brand); box-shadow: var(--focus); border-radius: var(--r-sm); }
.field { display: block; margin-bottom: var(--sp-4); }
.field > span, .label {
  display: block; margin-bottom: 6px;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted);
}
.hint { color: var(--text-muted); font-size: var(--fs-xs); line-height: var(--lh); }

.search-box { position: relative; }
.search-box .i { position: absolute; left: 12px; top: calc(var(--control-h) / 2); transform: translateY(-50%); color: var(--text-subtle); pointer-events: none; }
.search-box input { padding-left: 38px; background: var(--surface-2); border-color: transparent; }
.search-box input:focus { background: var(--surface); }

/* controle segmentado */
.seg {
  display: inline-flex; padding: 3px; gap: 2px; width: 100%;
  background: var(--surface-3); border-radius: var(--r-sm);
}
.seg button {
  flex: 1; min-width: 0; height: 30px; padding: 0 var(--sp-2);
  border: 0; border-radius: var(--r-xs); background: transparent; color: var(--text-muted);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg .n { color: var(--text-subtle); font-weight: var(--fw-medium); }

/* chips de filtro (rolagem horizontal) */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
  mask-image: linear-gradient(90deg, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); }
.chips:hover { mask-image: none; -webkit-mask-image: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--r-pill); background: transparent; color: var(--text-muted);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  transition: all var(--dur-1) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--text-subtle); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip .n { opacity: .7; font-weight: var(--fw-medium); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; }

/* selos */
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--brand); color: var(--on-brand);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); display: inline-grid; place-items: center;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold); white-space: nowrap;
  background: var(--neutral-soft); color: var(--text-muted);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--success); background: var(--success-soft); }

/* avatar com marca do canal */
.avatar {
  --av: var(--p-700);
  position: relative; width: 44px; height: 44px; flex: none; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: var(--av);
  font-weight: var(--fw-bold); font-size: var(--fs-sm); letter-spacing: .02em;
}
.avatar.c0 { --av: var(--p-600); } .avatar.c1 { --av: var(--p-700); } .avatar.c2 { --av: var(--p-900); }
.avatar.c3 { --av: #44403C; } .avatar.c4 { --av: #57534E; } .avatar.c5 { --av: var(--p-800); }
.avatar.sm { width: 36px; height: 36px; font-size: var(--fs-xs); }
.avatar .ch {
  position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); color: var(--text-muted);
  box-shadow: 0 0 0 2px var(--surface);
}
.avatar .ch .i { width: 12px; height: 12px; stroke-width: 2.4; }
.avatar .ch.instagram { color: var(--brand-text); }

/* cartões e listas de definição */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.section { padding: var(--sp-5) var(--sp-5) var(--sp-4); border-bottom: 1px solid var(--border); }
.section:last-child { border-bottom: 0; }
.section-title {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: .08em; text-transform: uppercase; color: var(--text-subtle);
}
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--sp-3); margin: 0; font-size: var(--fs-sm); }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-weight: var(--fw-medium); }

/* estado vazio */
.empty-state { margin: auto; max-width: 340px; padding: var(--sp-8); text-align: center; color: var(--text-muted); }
.empty-state .art {
  width: 64px; height: 64px; margin: 0 auto var(--sp-4); border-radius: var(--r-lg);
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text);
}
.empty-state .art .i { width: 28px; height: 28px; }
.empty-state h3 { color: var(--text); font-size: var(--fs-lg); margin-bottom: 6px; }
.empty-state p { margin: 0; font-size: var(--fs-sm); }

/* esqueleto de carregamento */
.skel { border-radius: var(--r-xs); background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: grid; place-items: center; padding: var(--sp-4);
  background: var(--scrim); backdrop-filter: blur(3px);
  animation: fade var(--dur-2) var(--ease);
}
.modal {
  width: min(600px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: pop var(--dur-3) var(--ease);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-5) var(--sp-5) var(--sp-3) var(--sp-6); }
.modal-head h2 { font-size: var(--fs-xl); }
.modal-body { padding: var(--sp-2) var(--sp-6) var(--sp-5); overflow-y: auto; }
.modal-body > p { margin: 0 0 var(--sp-3); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.modal-foot:empty { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* avisos */
.toasts { position: fixed; bottom: var(--sp-6); left: 50%; transform: translateX(-50%); z-index: var(--z-toast);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: var(--sp-3);
  max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px 10px 12px;
  background: var(--text); color: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-md);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  animation: rise var(--dur-3) var(--ease);
}
.toast .i { flex: none; }
.toast.ok .i { color: #4ADE80; }
.toast.error { background: var(--brand); color: #fff; }
.toast .btn { height: 28px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* menu suspenso (respostas rápidas) */
.popover {
  position: absolute; z-index: var(--z-pop);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md);
  overflow: hidden; animation: rise var(--dur-2) var(--ease);
}
.popover-head { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: .06em; text-transform: uppercase; color: var(--text-subtle); }
.kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px;
  font-family: var(--mono); font-size: 10px; color: var(--text-muted); text-transform: none; letter-spacing: 0; }

/* ---- 5. Caixa de entrada ------------------------------------------------------------------------- */
.app {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  grid-template-areas: "top top top" "side chat lead";
}
.app > * { min-width: 0; }

/* topo */
.topbar {
  grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: 0 var(--sp-4) 0 var(--sp-5);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: block; object-fit: cover; box-shadow: var(--shadow-sm); }
.brand-name { font-weight: var(--fw-bold); font-size: var(--fs-lg); letter-spacing: -.01em; white-space: nowrap; }
.brand-sub { color: var(--text-subtle); font-weight: var(--fw-medium); }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-1); }
.live {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; margin-right: var(--sp-2);
  border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-muted);
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold);
}
.live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-subtle); }
.live.on .dot { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent); animation: pulse 2.4s infinite; }
.live.off { color: var(--brand-text); background: var(--brand-soft); }
.live.off .dot { background: var(--brand); }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 6%, transparent); } }
.sep { width: 1px; height: 22px; background: var(--border); margin: 0 var(--sp-2); }

/* lista */
.sidebar { grid-area: side; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.sidebar-head { padding: var(--sp-4) var(--sp-4) var(--sp-3); display: grid; gap: var(--sp-3); border-bottom: 1px solid var(--border); }
.conv-list { list-style: none; margin: 0; padding: var(--sp-2); overflow-y: auto; flex: 1; }
.conv {
  position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: var(--sp-3); align-items: center;
  padding: 10px var(--sp-3); border-radius: var(--r-md); cursor: pointer;
  transition: background var(--dur-1) var(--ease);
}
.conv:hover { background: var(--surface-2); }
.conv[aria-current="true"] { background: var(--brand-soft); }
.conv[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--brand); }
.conv-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.conv-name { font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.unread .conv-name { font-weight: var(--fw-bold); }
.conv-time { flex: none; font-size: var(--fs-2xs); color: var(--text-subtle); font-weight: var(--fw-medium); }
.conv.unread .conv-time { color: var(--brand-text); font-weight: var(--fw-bold); }
.conv-bottom { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: 2px; }
.conv-prev { min-width: 0; color: var(--text-muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.conv-prev .i { width: 14px; height: 14px; flex: none; color: var(--text-subtle); }
.conv.unread .conv-prev { color: var(--text); }
.conv-meta { display: flex; align-items: center; gap: 6px; flex: none; }
.conv-skel { display: grid; grid-template-columns: 44px 1fr; gap: var(--sp-3); align-items: center; padding: 10px var(--sp-3); }
.conv-skel .skel.av { width: 44px; height: 44px; border-radius: 50%; }

/* conversa */
.chat { grid-area: chat; display: flex; min-height: 0; background: var(--chat-bg); position: relative; }
.chat-inner { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.chat-head {
  position: relative; display: flex; align-items: center; gap: var(--sp-3);
  min-height: 68px; padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-5);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.chat-title { flex: 1; min-width: 0; }
.chat-name { font-weight: var(--fw-bold); font-size: var(--fs-lg); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub { display: flex; align-items: center; gap: 6px; margin-top: 1px; color: var(--text-muted); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; }
.chat-sub .i { width: 13px; height: 13px; }
.chat-actions { display: flex; align-items: center; gap: var(--sp-2); }

/* janela de resposta */
.window {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  background: var(--success-soft); color: var(--success);
}
.window.closing { background: var(--warning-soft); color: var(--warning); }
.window.closed { background: var(--brand-soft); color: var(--brand-text); }
.window .i { width: 14px; height: 14px; }
.window-bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
.window-bar span { display: block; height: 100%; background: var(--success); transition: width var(--dur-3) var(--ease); }
.window-bar.closing span { background: var(--warning); }
.free-note { font-size: var(--fs-2xs); color: var(--text-muted); font-weight: var(--fw-medium); }

.ad-banner {
  display: flex; align-items: center; gap: var(--sp-2); padding: 8px var(--sp-5);
  background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.ad-banner .i { color: var(--brand-text); }
.ad-banner strong { color: var(--text); font-weight: var(--fw-semibold); }
.ad-banner a { margin-left: auto; font-weight: var(--fw-semibold); font-size: var(--fs-xs); }

/* mensagens */
.messages { flex: 1; overflow-y: auto; padding: var(--sp-5) clamp(16px, 6%, 80px) var(--sp-4); display: flex; flex-direction: column; }
.day {
  position: sticky; top: 0; z-index: 1; align-self: center; margin: var(--sp-3) 0;
  padding: 3px 12px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); color: var(--text-muted);
}
.event {
  align-self: center; display: inline-flex; align-items: center; gap: 6px; max-width: 90%;
  margin: var(--sp-2) 0; padding: 4px 12px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px dashed var(--border-strong);
  font-size: var(--fs-xs); color: var(--text-muted); text-align: center;
}
.event .i { width: 14px; height: 14px; color: var(--brand-text); }
.event strong { color: var(--text); font-weight: var(--fw-semibold); }
.more { align-self: center; margin-bottom: var(--sp-3); }

.msg { display: flex; flex-direction: column; max-width: min(72%, 580px); margin-top: var(--sp-3); }
.msg.cont { margin-top: 3px; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.bubble {
  position: relative; padding: 8px 12px 6px; border-radius: 16px;
  background: var(--bubble-in); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  overflow-wrap: anywhere; animation: bubble var(--dur-2) var(--ease);
}
@keyframes bubble { from { opacity: 0; transform: translateY(4px); } }
.msg.in .bubble { border-bottom-left-radius: 6px; }
.msg.out .bubble { background: var(--bubble-out); border-color: var(--bubble-out-border); border-bottom-right-radius: 6px; }
.msg.in.cont-next .bubble { border-bottom-left-radius: 16px; }
.msg.in.cont .bubble { border-top-left-radius: 6px; }
.msg.out.cont-next .bubble { border-bottom-right-radius: 16px; }
.msg.out.cont .bubble { border-top-right-radius: 6px; }
.text { white-space: pre-wrap; line-height: 1.5; }
.meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 2px; font-size: var(--fs-2xs); color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.tick { display: inline-flex; color: var(--text-subtle); }
.tick .i { width: 15px; height: 15px; stroke-width: 2.2; }
.tick.read { color: var(--brand); }
.tick.failed { color: var(--brand-text); }
.err { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: var(--fs-xs); color: var(--brand-text); font-weight: var(--fw-medium); }
.err .i { width: 14px; height: 14px; }
.label-sm { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; font-size: var(--fs-2xs); font-weight: var(--fw-bold); color: var(--text-muted); letter-spacing: .02em; }
.label-sm .i { width: 13px; height: 13px; }
.msg-tag { margin-bottom: 4px; padding: 0 4px; font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--text-subtle); display: flex; align-items: center; gap: 4px; }
.msg-tag .i { width: 12px; height: 12px; }
.msg-tag.ad { color: var(--brand-text); }

.media-img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin: 2px 0 6px; cursor: zoom-in; background: var(--surface-3); }
.media-audio { width: 280px; max-width: 100%; display: block; margin: 2px 0 2px; }
.media-video { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; }
.attach {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 240px; padding: 10px; margin: 2px 0 6px;
  border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border);
}
.msg.out .attach { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.attach .file-ic { width: 38px; height: 38px; flex: none; border-radius: var(--r-xs); display: grid; place-items: center; background: var(--brand-soft-2); color: var(--brand-text); }
.attach .name { font-weight: var(--fw-semibold); font-size: var(--fs-sm); overflow-wrap: anywhere; line-height: var(--lh-tight); }
.attach .size { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: 2px; }
.attach .grow { flex: 1; min-width: 0; }
.media-note { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-muted); font-style: italic; padding: 2px 0 4px; }
.coords { font-family: var(--mono); font-size: var(--fs-2xs); color: var(--text-muted); margin-top: 2px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--brand-text); font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
.link-btn:hover { text-decoration: underline; }

/* envio */
.composer { position: relative; padding: var(--sp-3) var(--sp-4) var(--sp-4); background: transparent; }
.composer-box {
  display: flex; align-items: flex-end; gap: var(--sp-1);
  padding: 6px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.composer-box:focus-within { border-color: color-mix(in srgb, var(--brand) 45%, var(--border-strong)); box-shadow: var(--shadow-sm), 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent); }
.composer textarea {
  flex: 1; resize: none; min-height: 38px; max-height: 180px; padding: 9px 6px;
  border: 0; background: transparent; line-height: 1.4;
}
.composer textarea:focus-visible { box-shadow: none; }
.composer textarea:disabled { cursor: not-allowed; }
.send-btn {
  width: 38px; height: 38px; flex: none; border: 0; border-radius: var(--r-md);
  display: grid; place-items: center; background: var(--brand); color: #fff;
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), opacity var(--dur-1);
}
.send-btn:hover { background: var(--brand-hover); }
.send-btn:active { transform: scale(.95); }
.send-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.composer-hint { display: flex; justify-content: space-between; gap: var(--sp-3); margin-top: 6px; padding: 0 var(--sp-2); font-size: var(--fs-2xs); color: var(--text-subtle); }
.closed-note {
  display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2);
  padding: 10px 12px; border-radius: var(--r-md);
  background: var(--brand-soft); border: 1px solid var(--brand-soft-2); color: var(--brand-text);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
}
.closed-note span { flex: 1; }
.qr-popup { left: var(--sp-4); right: var(--sp-4); bottom: calc(100% - 4px); max-height: 320px; display: flex; flex-direction: column; }
.qr-list { overflow-y: auto; padding: 6px; }
.qr-item { padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; }
.qr-item[aria-selected="true"], .qr-item:hover { background: var(--brand-soft); }
.qr-title { font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.qr-body { color: var(--text-muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.qr-empty { padding: var(--sp-4); color: var(--text-muted); font-size: var(--fs-sm); }

/* painel do contato */
.lead { grid-area: lead; width: var(--lead-w); display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--border); }
.lead-head { display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 0 var(--sp-3) 0 var(--sp-5); border-bottom: 1px solid var(--border); }
.lead-head h2 { font-size: var(--fs-lg); }
.lead-body { overflow-y: auto; flex: 1; }
.lead-profile { display: flex; align-items: center; gap: var(--sp-3); }
.lead-profile .who { min-width: 0; }
.lead-profile .who strong { display: block; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-profile .who span { font-size: var(--fs-xs); color: var(--text-muted); }
.saved { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-2xs); color: var(--success); font-weight: var(--fw-semibold); text-transform: none; letter-spacing: 0; opacity: 0; transition: opacity var(--dur-2); }
.saved.show { opacity: 1; }
.origin { padding: var(--sp-3); border-radius: var(--r-md); background: var(--brand-soft); border: 1px solid var(--brand-soft-2); font-size: var(--fs-sm); }
.origin .t { display: flex; align-items: center; gap: 6px; font-weight: var(--fw-bold); color: var(--brand-text); margin-bottom: 4px; }
.origin .h { font-weight: var(--fw-semibold); color: var(--text); }
.origin .m { color: var(--text-muted); font-size: var(--fs-xs); margin-top: 4px; }

/* conteúdo dos modais */
.qr-edit { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3); margin-bottom: var(--sp-3); background: var(--surface); }
.qr-edit.new { border-style: dashed; background: var(--surface-2); }
.qr-edit textarea { min-height: 84px; margin-top: var(--sp-2); }
.qr-edit-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: var(--sp-2); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-3) 0; }
.switch-row .txt strong { display: block; font-size: var(--fs-md); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background var(--dur-2) var(--ease); pointer-events: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-2) var(--ease); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }
.settings-section { border-top: 1px solid var(--border); margin-top: var(--sp-5); padding-top: var(--sp-4); }
.settings-section h3 { font-size: var(--fs-md); margin-bottom: 4px; }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.tpl-list { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.tpl-option {
  display: flex; align-items: center; gap: var(--sp-3); text-align: left; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface);
  transition: all var(--dur-1) var(--ease);
}
.tpl-option:hover { border-color: var(--text-subtle); }
.tpl-option[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--focus); }
.tpl-option:disabled { cursor: not-allowed; opacity: .5; }
.tpl-option .file-ic { width: 34px; height: 34px; flex: none; border-radius: var(--r-xs); display: grid; place-items: center; background: var(--brand-soft-2); color: var(--brand-text); }
.tpl-option strong { display: block; font-size: var(--fs-sm); }
.tpl-option small { display: block; color: var(--text-muted); font-size: var(--fs-2xs); margin-top: 1px; }
.tpl-preview { white-space: pre-wrap; padding: 12px 14px; margin-bottom: var(--sp-4); border-radius: 16px 16px 6px 16px;
  background: var(--bubble-out); border: 1px solid var(--bubble-out-border); line-height: 1.5; font-size: var(--fs-sm); }
.file-preview { max-width: 100%; max-height: 320px; display: block; margin: 0 auto var(--sp-4); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.img-full { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto; border-radius: var(--r-md); }

/* ---- 5b. Atendimento (filas, equipe, notas) ------------------------------------------------------- */
/* abas da lista e indicadores */
.views .n.hot { color: var(--on-brand); background: var(--brand); border-radius: var(--r-pill); padding: 0 6px; min-width: 18px; line-height: 16px; text-align: center; }
.conv-tags { display: flex; align-items: center; gap: 6px; margin-top: 5px; min-height: 0; }
.conv-tags:empty { display: none; }
.qtag { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 140px; height: 20px; padding: 0 8px; border-radius: var(--r-pill);
  background: var(--neutral-soft); color: var(--text-muted); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qtag .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--text-subtle); }
.wait, .who-tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wait { background: var(--success-soft); color: var(--success); }
.wait.late { background: var(--warning-soft); color: var(--warning); }
.who-tag { background: var(--info-soft); color: var(--info); }
.wait .i, .who-tag .i { width: 12px; height: 12px; }
.pill.state-aguardando { color: var(--warning); background: var(--warning-soft); }
.pill.state-em_atendimento { color: var(--info); background: var(--info-soft); }
.pill.state-finalizado { color: var(--text-muted); background: var(--neutral-soft); }
.chat-sub .pill { height: 18px; padding: 0 7px; }
.chat-sub .qtag { height: 18px; }

/* conta no topo */
.me-btn { display: inline-flex; align-items: center; gap: var(--sp-2); height: var(--control-h); padding: 0 var(--sp-2) 0 4px;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--text-muted); font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.me-btn:hover { background: var(--surface-3); color: var(--text); }
.avatar.xs { width: 28px; height: 28px; font-size: 11px; }
.presence { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-subtle); box-shadow: 0 0 0 2px var(--surface); }
.presence.on { background: var(--success); }

/* pé da conversa: situação + ação (assumir), alternância mensagem/nota */
.handoff { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); padding: 10px 12px;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-sm); box-shadow: var(--shadow-xs); }
.handoff > span { flex: 1; min-width: 0; }
.handoff strong { color: var(--text); font-weight: var(--fw-semibold); }
.handoff > .i { color: var(--text-subtle); }
.handoff.aguardando > .i { color: var(--warning); }
.handoff.em_atendimento > .i { color: var(--info); }
.handoff .btn { flex: none; }
.seg.mode { width: auto; margin: 0 0 var(--sp-2); }
.seg.mode button { flex: none; padding: 0 var(--sp-3); }
.seg.mode button .i { width: 14px; height: 14px; }
.seg.mode #mode-note[aria-pressed="true"] { color: var(--warning); }
.composer-box.note { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 40%, var(--border-strong)); }
.composer-box.note:focus-within { box-shadow: var(--shadow-sm), 0 0 0 3px color-mix(in srgb, var(--warning) 18%, transparent); }
.composer-box.note .send-btn { background: var(--warning); }

/* linha do tempo: nota interna, autor e hora dos eventos */
.note { align-self: center; width: min(560px, 92%); margin: var(--sp-3) 0 0; padding: 8px 12px 10px; border-radius: var(--r-md);
  background: var(--warning-soft); border: 1px dashed color-mix(in srgb, var(--warning) 45%, transparent); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.note-head { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--warning); }
.note-head .i { width: 12px; height: 12px; }
.note-head strong { font-weight: var(--fw-bold); }
.note-head .t { margin-left: auto; color: var(--text-subtle); font-weight: var(--fw-medium); }
.event .t { color: var(--text-subtle); font-size: var(--fs-2xs); margin-left: 4px; font-variant-numeric: tabular-nums; }
.msg-tag.author { color: var(--text-muted); }

/* modais da equipe */
.label-gap { margin-top: var(--sp-4); }
.field-gap { margin-top: var(--sp-4); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-3); }
.input-row { display: flex; gap: var(--sp-2); }
.input-row input { flex: 1; font-family: var(--mono); }
.me-card { display: flex; align-items: center; gap: var(--sp-3); }
.me-card .who { flex: 1; min-width: 0; }
.me-card .who strong { display: block; }
.me-card .who span { font-size: var(--fs-xs); color: var(--text-muted); }
.team-list { display: grid; gap: var(--sp-2); margin-top: var(--sp-4); }
.team-row { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.team-row.off { opacity: .6; background: var(--surface-2); }
.team-row .grow { flex: 1; min-width: 0; }
.team-row .line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.team-row .sub { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; overflow-wrap: anywhere; }
.team-row .sub.warn { color: var(--warning); }
.team-row .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.qdot { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.check-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.check-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 8px; border: 1px solid var(--border-strong);
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted); cursor: pointer; }
.check-chip:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.check-chip input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--brand); }
.check-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--text); }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 auto; }
.seg .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pick-list { display: grid; gap: 6px; max-height: 300px; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: var(--sp-3); padding: 8px 12px; text-align: left; border: 1px solid var(--border-strong);
  border-radius: var(--r-md); background: var(--surface); transition: all var(--dur-1) var(--ease); }
.pick:hover { border-color: var(--text-subtle); }
.pick[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--focus); }
.pick .grow { flex: 1; min-width: 0; }
.pick strong { display: block; font-size: var(--fs-sm); }
.pick small { display: block; font-size: var(--fs-2xs); color: var(--text-muted); }
.pick-ic { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted); }
.pick-ic .i { width: 15px; height: 15px; }

/* ---- 6. Login ------------------------------------------------------------------------------------ */
.login-page {
  display: grid; place-items: center; min-height: 100vh; padding: var(--sp-4);
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--p-600) 14%, transparent), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--p-600) 10%, transparent), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(380px, 100%); padding: var(--sp-8) var(--sp-6) var(--sp-6);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: pop var(--dur-3) var(--ease);
}
.login-card .brand-mark { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto var(--sp-4); }
.login-card h1 { text-align: center; font-size: var(--fs-2xl); }
.login-card .lead-txt { text-align: center; color: var(--text-muted); margin: 6px 0 var(--sp-6); font-size: var(--fs-sm); }
.login-card .btn { width: 100%; height: 42px; font-size: var(--fs-md); }
.login-error { display: flex; align-items: center; gap: 6px; min-height: 20px; margin: -4px 0 var(--sp-3); color: var(--brand-text); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.login-foot { margin-top: var(--sp-5); text-align: center; font-size: var(--fs-2xs); color: var(--text-subtle); display: flex; align-items: center; justify-content: center; gap: 6px; }

/* ---- 7. Responsivo ------------------------------------------------------------------------------- */
.only-mobile { display: none !important; }

@media (max-width: 1180px) {
  :root { --sidebar-w: 320px; }
  .app { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .lead { position: fixed; right: 0; top: var(--topbar-h); bottom: 0; z-index: var(--z-panel); box-shadow: var(--shadow-lg); animation: slide var(--dur-3) var(--ease); }
  @keyframes slide { from { transform: translateX(24px); opacity: 0; } }
}

@media (max-width: 760px) {
  :root { --topbar-h: 56px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "side"; }
  .app.in-chat { grid-template-areas: "top" "chat"; }
  .app.in-chat .sidebar { display: none; }
  .app:not(.in-chat) .chat { display: none; }
  .only-mobile { display: inline-grid !important; }
  .hide-mobile, .brand-sub, .label-desktop { display: none !important; }
  .topbar { padding: 0 var(--sp-2) 0 var(--sp-3); }
  .live { margin-right: 0; padding: 0 8px; }
  .live .txt { display: none; }
  .chat-head { padding: var(--sp-2) var(--sp-2); gap: var(--sp-2); min-height: 60px; }
  .chat-sub .extra { display: none; }
  .window { padding: 0 9px; }
  .messages { padding: var(--sp-3) var(--sp-3); }
  .msg { max-width: 86%; }
  .composer { padding: var(--sp-2) var(--sp-2) calc(var(--sp-2) + env(safe-area-inset-bottom)); }
  .composer-hint { display: none; }
  .chat-actions .btn.sm { padding: 0 9px; }
  .chat-head .avatar { display: none; }
  .chat-actions { gap: 4px; }
  .window .i { display: none; }
  .seg.mode { width: 100%; }
  .seg.mode button { flex: 1; }
  .handoff { flex-wrap: wrap; }
  .grid2 { grid-template-columns: 1fr; }
  .me-btn > .i { display: none; }
  .lead { width: 100%; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; }
  .modal-foot { border-radius: 0; padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(var(--sp-6) + 64px); }
}
.composer-box.disabled { background: var(--surface-2); box-shadow: none; }
.settings-section h3 + .pill { margin-bottom: 6px; }
.switch-row .hint { display: block; margin-top: 2px; }
