/* Cavazonne · protótipo da caixa de entrada
   Paleta inspirada no atacado têxtil: algodão cru, índigo de jeans e linha de costura. */
:root {
  --cotton: #eef0ec;      /* fundo: algodão cru acinzentado */
  --sheet: #fbfbf9;       /* painéis */
  --ink: #1d2433;         /* texto principal */
  --muted: #5b6475;       /* texto secundário */
  --line: #d6d9d2;        /* divisórias */
  --indigo: #0e7c63;      /* índigo de jeans: ação principal */
  --indigo-soft: #e3f3ed;
  --wa: #1d7a50;          /* WhatsApp (verde sóbrio) */
  --wa-soft: #dcefe5;
  --ig: #a12d6c;          /* Instagram (magenta sóbrio) */
  --ig-soft: #f5e1ec;
  --amber: #8a5a00;
  --amber-soft: #fbecc8;
  --warn-bg: #fff4d6;
  --warn-line: #e3b54a;
  --radius-s: 6px;
  --radius-m: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--cotton);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .9rem; margin-top: 1.25rem; margin-bottom: .5rem; color: var(--muted); font-weight: 600; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
[hidden] { display: none !important; }

/* Aviso permanente de demonstração. */
.demo-banner {
  flex: none;
  padding: .45rem 1rem;
  font-size: .85rem;
  text-align: center;
  color: #4a3500;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-line);
}

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .6rem 1rem;
  background: var(--indigo);
  color: #fff;
}
.brand { font-weight: 800; font-size: 1.05rem; }
.topbar-right { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }
.topbar-btn {
  background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .55);
  border-radius: var(--radius-s); padding: .3rem .6rem; cursor: pointer; font-size: .85rem;
}
.topbar-btn:hover { background: rgba(255, 255, 255, .12); }

/* Empresa: sempre visível no topo. */
.company-switch { display: flex; gap: .4rem; }
.company-switch button {
  display: inline-flex; align-items: center; gap: .45rem;
  background: rgba(255, 255, 255, .1); color: #fff;
  border: 1px solid rgba(255, 255, 255, .4); border-radius: 999px;
  padding: .3rem .4rem .3rem .85rem; cursor: pointer; font-weight: 600;
}
.company-switch button[aria-pressed="true"] { background: #fff; color: var(--indigo); border-color: #fff; }
.company-count {
  min-width: 1.5rem; padding: 0 .4rem; border-radius: 999px; font-size: .78rem; text-align: center;
  background: rgba(255, 255, 255, .25);
}
.company-switch button[aria-pressed="true"] .company-count { background: var(--indigo); color: #fff; }

/* Telas */
.screen { display: none; }
body[data-screen="start"] .start { display: block; }
body[data-screen="inbox"] .app { display: grid; }
body[data-screen="connect"] .connect { display: block; }
body[data-screen="bills"] #bills, body[data-screen="reminders"] #reminders, body[data-screen="deliveries"] #deliveries,
body[data-screen="contacts"] #contacts-area, body[data-screen="labels"] #labels, body[data-screen="results"] #results { display: block; }
body[data-screen="start"] .mainnav { display: none; }

/* Navegação entre áreas */
.mainnav {
  flex: none; display: flex; flex-wrap: wrap; gap: .25rem; padding: .35rem 1rem;
  background: var(--sheet); border-bottom: 1px solid var(--line);
}
.mainnav button {
  border: 0; background: transparent; cursor: pointer; padding: .35rem .7rem;
  border-radius: var(--radius-s); color: var(--muted); font-weight: 600;
}
.mainnav button:hover { background: #f2f3ef; color: var(--ink); }
.mainnav button[aria-current="page"] { background: var(--indigo-soft); color: var(--indigo); }

/* Contas a pagar e Lembretes */
.area { flex: 1; overflow-y: auto; padding: 2rem 1rem; }
.area > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.area h1 { font-size: 1.5rem; }
.area-company { color: var(--muted); margin: .25rem auto 1.25rem; }
.empty-state {
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 1.5rem; display: grid; gap: .5rem; justify-items: start;
}
.empty-state h2 { font-size: 1.1rem; }
.empty-state p { margin: 0; color: var(--muted); }
.primary:disabled { opacity: .5; cursor: not-allowed; }
.pending-note { font-size: .85rem; color: var(--amber) !important; }
.proposal {
  margin-top: 1rem; padding: 1.25rem; border: 1px dashed var(--warn-line);
  border-radius: var(--radius-m); background: var(--warn-bg);
}
.proposal h2 { font-size: 1rem; color: #4a3500; }
.proposal p, .proposal li { font-size: .92rem; }
.proposal ul { margin: .25rem 0 .75rem; padding-left: 1.25rem; }
.proposal summary { cursor: pointer; font-weight: 700; color: #4a3500; }
#bills > * { max-width: 1040px; }

/* Calendário */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 1rem; align-items: start; }
.calendar, .day-panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.cal-head h2 { font-size: 1.05rem; text-transform: capitalize; text-align: center; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
.cal-weekdays span { font-size: .78rem; color: var(--muted); text-align: center; font-weight: 600; }
.cal-day {
  min-height: 3.6rem; display: grid; align-content: start; justify-items: start; gap: .15rem;
  padding: .35rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; cursor: pointer;
  text-align: left; min-width: 0;
}
.cal-day:hover { border-color: var(--indigo); }
.cal-day.is-today .cal-num { background: var(--indigo); color: #fff; border-radius: 999px; padding: 0 .4rem; }
.cal-day[aria-pressed="true"] { outline: 2px solid var(--indigo); outline-offset: -2px; background: var(--indigo-soft); }
.cal-num { font-weight: 700; font-size: .9rem; }
.cal-count { font-size: .7rem; font-weight: 700; color: var(--amber); background: var(--amber-soft); border-radius: 4px; padding: 0 .3rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-panel h2 { font-size: 1.05rem; margin-bottom: .5rem; }
.day-list, .reminder-list { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .5rem; }
.bill-item { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .6rem .75rem; background: #fff; display: grid; gap: .3rem; justify-items: start; }
.bill-text { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.bill-meta { margin: 0; font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.sim-tag { font-size: .72rem; font-weight: 700; color: var(--amber); background: var(--amber-soft); border-radius: 999px; padding: .05rem .5rem; }
.no-alert { font-size: .72rem; color: var(--muted); }
.day-empty { color: var(--muted); font-size: .9rem; }
.bill-form { display: grid; gap: .6rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.check { display: flex; align-items: center; gap: .45rem; font-size: .9rem; }
.check input { width: 1.1rem; height: 1.1rem; }
.bill-form .primary { justify-self: start; }
.reminder-list { max-width: 760px; }

/* Contatos: grupos de clientes */
#contacts-area > * { max-width: 1100px; }
.ct-layout { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.ct-groups { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem; display: grid; gap: .75rem; }
.ct-groups h2, .ct-main h2 { font-size: 1.05rem; }
.ct-main h2 { margin-bottom: .5rem; }
.ct-group-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.ct-group {
  width: 100%; display: flex; justify-content: space-between; gap: .5rem; text-align: left;
  border: 0; background: transparent; border-radius: var(--radius-s); padding: .45rem .6rem; cursor: pointer;
}
.ct-group:hover { background: #f2f3ef; }
.ct-group[aria-pressed="true"] { background: var(--indigo-soft); color: var(--indigo); font-weight: 700; }
.ct-count { font-size: .8rem; color: var(--muted); }
.ct-new-group { display: grid; gap: .4rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.ct-new-group .small { justify-self: start; }
.ct-tools, .ct-inline-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.ct-inline { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .75rem; margin-bottom: .75rem; display: grid; gap: .5rem; max-width: 520px; }
.ct-inline .ct-inline-actions { margin-bottom: 0; }
.ct-confirm { border-color: #c98b8b; background: #fdf3f3; }
.ct-confirm p { margin: 0; }
.small.danger { color: #8f2424; border-color: #8f2424; }
.delivery-table td.nowrap { white-space: nowrap; }
.ct-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.ct-chip { white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; background: var(--indigo-soft); color: var(--indigo); border-radius: 999px; padding: .1rem .5rem; }
.delivery-table select { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .3rem .4rem; background: #fff; max-width: 100%; }

/* Importação de contatos e duplicados */
.ct-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.imp, .dup { background: var(--sheet); border: 1px solid var(--indigo); border-radius: var(--radius-m); padding: 1rem; margin-bottom: 1rem; display: grid; gap: .75rem; }
.imp-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.imp-head h2 { font-size: 1.1rem; }
.imp h3 { font-size: .95rem; margin: .25rem 0 0; color: var(--ink); }
.dropzone {
  border: 2px dashed var(--indigo); border-radius: var(--radius-m); padding: 1.5rem 1rem; text-align: center;
  background: #fff; cursor: pointer;
}
.dropzone p { margin: .25rem 0; color: var(--muted); }
.dropzone .dropzone-main { color: var(--ink); font-size: 1.05rem; }
.dropzone .dropzone-link { color: var(--indigo); font-weight: 700; text-decoration: underline; }
.dropzone.is-over { background: var(--indigo-soft); border-style: solid; }
.imp-format, .imp-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; align-items: end; }
.imp-header { align-self: center; }
.imp-detected, .imp-file-name { margin: 0; font-size: .9rem; }
.imp-summary { margin: 0; font-weight: 600; }
.imp-status { display: block; font-size: .82rem; font-weight: 600; }
.imp-new { color: var(--wa); }
.imp-exists { color: var(--indigo); }
.imp-dup { color: var(--amber); }
.imp-refused { color: #a12d2d; }
.imp-warn { display: block; font-size: .78rem; color: var(--amber); }
.imp-group { max-width: 520px; }
.imp-indent { margin-left: 1.6rem; max-width: 360px; }
.imp-result ul { margin: 0; padding-left: 1.2rem; }
.imp .primary { justify-self: start; }
.dup-badge { display: inline-block; margin-left: .4rem; font-size: .7rem; font-weight: 700; color: var(--amber); background: var(--amber-soft); border-radius: 999px; padding: 0 .45rem; }
.dup-set { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .75rem; background: #fff; display: grid; gap: .5rem; margin-bottom: .5rem; }
.dup-set-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.dup-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.dup-item { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .25rem .75rem; align-items: center; font-size: .88rem; border-top: 1px solid var(--line); padding-top: .5rem; }
.dup-item:first-child { border-top: 0; padding-top: 0; }
.dup-name { font-weight: 700; }
.dup-item .nowrap { white-space: nowrap; }
.dup-item .small { justify-self: start; }
.dup-names summary { cursor: pointer; color: var(--indigo); font-weight: 600; }

/* Entregas das facções */
#deliveries > * { max-width: 1040px; }
.delivery-form { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem; display: grid; gap: .75rem; }
.delivery-form h2, .list-title { font-size: 1.05rem; }
.list-title { margin-top: 1.25rem; margin-bottom: .5rem; }
.delivery-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.delivery-form .primary { justify-self: start; }
.workshop-fields { display: grid; gap: .75rem; }
#dv-accessories { width: 100%; min-height: 7rem; resize: vertical; box-sizing: border-box; padding: .65rem; border: 1px solid var(--line); border-radius: var(--radius-s); font: inherit; background: #fff; }
.delivery-accessories { white-space: pre-wrap; min-width: 12rem; max-width: 24rem; overflow-wrap: anywhere; }
.field-error { color: #a12d2d; font-size: .78rem; min-height: 1em; }
.field input[aria-invalid="true"] { border-color: #a12d2d; }
.delivery-table-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m); }
.delivery-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.delivery-table th, .delivery-table td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); }
.delivery-table th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.delivery-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.delivery-table tr:last-child td { border-bottom: 0; }
.checked-cell .check { font-size: .85rem; white-space: nowrap; color: var(--muted); cursor: pointer; }
.checked-cell .check.is-checked { color: var(--wa); font-weight: 700; }

/* Alerta simulado (dentro da página) */
.sim-alert {
  position: fixed; left: 50%; top: 7rem; transform: translateX(-50%); z-index: 20;
  width: min(440px, calc(100vw - 2rem)); background: #fff; border: 2px solid var(--warn-line);
  border-radius: var(--radius-m); box-shadow: 0 12px 36px rgba(29, 36, 51, .25); padding: 1rem 1.1rem;
}
.sim-alert p { margin: 0 0 .5rem; overflow-wrap: anywhere; }
.sim-alert-title { font-weight: 800; color: #4a3500; }
.sim-alert-note { font-size: .82rem; color: var(--amber); }
.sim-alert-main, .sim-alert-channel { display: block; }
.sim-alert-channel { font-size: .88rem; color: var(--muted); margin-top: .2rem; }
.alert-box { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .6rem .75rem; display: grid; gap: .5rem; margin: 0; }
.alert-box legend { font-weight: 700; font-size: .9rem; padding: 0 .25rem; }
.alert-options { display: grid; gap: .5rem; }
.alert-channels { margin: 0; padding-left: 1.1rem; font-size: .82rem; color: var(--ink); }

/* Painel inicial */
.start, .connect { flex: 1; overflow-y: auto; padding: 2rem 1rem; }
.start > *, .connect > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.start h1, .connect h1 { font-size: 1.5rem; }
.start-hint { color: var(--muted); margin: .5rem auto 1.5rem; }
.company-cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.company-card {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; gap: .3rem; padding: 1.25rem;
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.company-card:hover { border-color: var(--indigo); }
.company-card-name { font-size: 1.35rem; font-weight: 800; }
.company-card-about { color: var(--muted); }
.company-card-count { font-size: 1.05rem; font-weight: 600; margin-top: .5rem; }
.company-card-go { color: var(--indigo); font-weight: 600; text-decoration: underline; margin-top: .25rem; }

/* Conectar números */
.connect-head { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.connect-note { color: var(--muted); font-size: .9rem; }
.number-list { list-style: none; padding: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-m); }
.number-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: .75rem; padding: .75rem 1rem; }
.number-row + .number-row { border-top: 1px solid var(--line); }
.number-info { display: grid; }
.number-info span { color: var(--muted); font-size: .88rem; }
.number-later { color: var(--muted); font-size: .8rem; }
.status { font-size: .8rem; font-weight: 600; border-radius: 999px; padding: .1rem .55rem; white-space: nowrap; }
.status.is-on { background: var(--wa-soft); color: var(--wa); }
.status.is-off { background: #eceef1; color: var(--muted); }
.connect-box {
  margin-top: 1.25rem; padding: 1.25rem; background: var(--sheet);
  border: 1px solid var(--indigo); border-radius: var(--radius-m); display: grid; gap: 1rem;
}
.segmented.two { grid-template-columns: repeat(2, 1fr); }
.steps { margin: 0; padding-left: 1.25rem; display: grid; gap: .3rem; }
.fake-qr {
  width: 180px; height: 180px; margin-top: .75rem; display: grid; place-items: center; text-align: center;
  border: 2px dashed var(--muted); border-radius: var(--radius-s); color: var(--muted); font-weight: 600;
  background: repeating-conic-gradient(#d9dce3 0 25%, #f4f5f7 0 50%) 0 0 / 24px 24px;
}
.fake-qr span { background: var(--sheet); padding: .3rem .6rem; border-radius: var(--radius-s); }
.connect-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.current-user { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.current-user select {
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .45);
  color: #fff;
  border-radius: var(--radius-s);
  padding: .3rem .5rem;
}
.current-user option { color: var(--ink); }
#rename-dialog { max-width: min(28rem, 90vw); padding: 1.5rem; border: 1px solid #aaa; border-radius: .5rem; }
#rename-dialog::backdrop { background: rgba(0,0,0,.35); }
#rename-dialog input { display: block; width: 100%; margin: .5rem 0; padding: .6rem; box-sizing: border-box; }
#rename-dialog button { padding: .5rem; margin-right: .5rem; }
#rename-user { color: #24327f; background: #fff; border: 1px solid #fff; border-radius: .35rem; padding: .5rem .75rem; font: inherit; font-weight: 600; cursor: pointer; }
#rename-user:hover { color: #17235f; background: #eef0ff; }
#rename-user:focus-visible { outline: 3px solid #ffdf66; outline-offset: 3px; }

/* Layout em três colunas */
.app {
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
}
.pane { min-height: 0; min-width: 0; background: var(--sheet); display: flex; flex-direction: column; }
.pane-list { border-right: 1px solid var(--line); }
/* Ficha do contato: detalhe secundário, abre sob demanda sobre a conversa. */
.pane-contact {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 100vw);
  padding: 1rem; overflow-y: auto; z-index: 8;
  border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(29, 36, 51, .2);
  transform: translateX(100%); visibility: hidden; transition: transform .2s ease, visibility .2s;
}
.app[data-view="contact"] .pane-contact { transform: none; visibility: visible; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pane-list .pane-head { padding: 1rem 1rem .5rem; }
.count { font-size: .85rem; color: var(--muted); }

/* Filtros */
.filters { padding: 0 1rem .75rem; display: grid; gap: .6rem; border-bottom: 1px solid var(--line); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.segmented button {
  border: 0; background: transparent; padding: .4rem .3rem; cursor: pointer; font-size: .9rem;
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--indigo); color: #fff; font-weight: 600; }
.field { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); }
.field select, .field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: #fff;
  padding: .4rem .5rem;
  color: var(--ink);
}

/* Lista de conversas */
.conv-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.conv {
  width: 100%;
  display: flex;
  gap: .7rem;
  text-align: left;
  padding: .75rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}
.conv:hover { background: #f2f3ef; }
.conv.is-selected { background: var(--indigo-soft); box-shadow: inset 4px 0 0 var(--indigo); }
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
.avatar-whatsapp { background: var(--wa-soft); color: var(--wa); }
.avatar-instagram { background: var(--ig-soft); color: var(--ig); }
.conv-main { min-width: 0; flex: 1; display: grid; gap: .1rem; }
.conv-top { display: flex; justify-content: space-between; gap: .5rem; }
.conv-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.is-unread .conv-name { font-weight: 800; }
.conv-time { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.conv-store { font-size: .8rem; color: var(--muted); }
.conv-last { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.is-unread .conv-last { color: var(--ink); }
.conv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .3rem; }

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .1rem .5rem;
}
.badge-sub { font-weight: 500; opacity: .85; }
.badge-whatsapp { background: var(--wa-soft); color: var(--wa); }
.badge-instagram { background: var(--ig-soft); color: var(--ig); }
.assignee-chip { font-size: .72rem; border: 1px solid var(--line); border-radius: 999px; padding: .05rem .45rem; background: #fff; }
.group-chip { font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .05rem .45rem; background: #e4e7ec; color: #3d4656; }
.msg-author { display: block; font-size: .78rem; font-weight: 700; color: var(--indigo); margin-bottom: .1rem; }
.assignee-chip.is-done { background: #eceef1; color: var(--muted); }
.assignee-chip.is-none { border-style: dashed; color: var(--muted); }
.unread {
  margin-left: auto; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem;
  border-radius: 999px; background: var(--indigo); color: #fff;
  font-size: .72rem; font-weight: 700; display: grid; place-items: center;
}
.empty, .chat-empty { color: var(--muted); padding: 1.5rem 1rem; }
.chat-empty { display: grid; place-items: center; flex: 1; text-align: center; }

/* Conversa */
.chat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat-head { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.chat-who { min-width: 0; flex: 1; }
.chat-who h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.origin { margin: .2rem 0 0; font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.back { display: none; }

.assignee-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .5rem 1rem; font-size: .88rem; border-bottom: 1px solid var(--line);
}
.assignee-bar.is-none { background: #f4f5f2; }
.assignee-bar.is-me { background: var(--indigo-soft); }
.assignee-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.assignee-bar.is-done { background: #eceef1; }
.small:disabled { opacity: .45; cursor: not-allowed; }
.assignee-bar.is-other { background: var(--warn-bg); border-bottom-color: var(--warn-line); }
.provisional { display: block; font-size: .75rem; color: var(--amber); margin-top: .1rem; }

.messages {
  list-style: none; margin: 0; padding: 1rem; overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: .5rem;
  background: var(--cotton);
}
.msg { max-width: min(560px, 82%); padding: .5rem .7rem; border-radius: var(--radius-m); background: #fff; border: 1px solid var(--line); }
.msg-in { align-self: flex-start; border-bottom-left-radius: 2px; }
.msg-out { align-self: flex-end; background: var(--indigo-soft); border-color: #c8cfec; border-bottom-right-radius: 2px; }
.msg.is-simulated { border-style: dashed; border-color: var(--indigo); }
.msg-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-meta { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.sim-flag { color: var(--indigo); font-weight: 700; }

/* Campo de mensagem */
.lock-note {
  margin: 0; padding: .5rem 1rem; font-size: .9rem;
  background: var(--warn-bg); border-top: 1px solid var(--warn-line); color: #4a3500;
}
.number-owner { color: var(--ink) !important; font-weight: 600; }
.owner-field { max-width: 280px; }
.send-via {
  margin: 0; padding: .5rem 1rem 0; font-size: .85rem; color: var(--muted);
  border-top: 1px solid var(--line); background: var(--sheet);
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem;
}
.composer {
  position: relative;
  display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: .5rem;
  padding: .5rem 1rem .75rem; background: var(--sheet);
}
.composer.is-locked textarea { background: #eceef1; color: var(--muted); cursor: not-allowed; }
.composer button:disabled { opacity: .5; cursor: not-allowed; }
.composer textarea {
  width: 100%; resize: vertical; min-height: 2.6rem; max-height: 10rem;
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: .5rem .6rem; background: #fff;
}
.primary, .ghost, .small {
  border-radius: var(--radius-s); cursor: pointer; padding: .5rem .8rem; white-space: nowrap;
}
.primary { background: var(--indigo); color: #fff; border: 1px solid var(--indigo); font-weight: 600; }
.primary:hover { background: #24337a; }
.ghost { background: transparent; border: 1px solid var(--line); }
.ghost:hover { background: #f2f3ef; }
.small { background: #fff; border: 1px solid var(--indigo); color: var(--indigo); font-size: .82rem; padding: .3rem .6rem; font-weight: 600; }

.quick-wrap { position: static; }
.quick-panel {
  position: absolute; left: 1rem; right: 1rem; bottom: calc(100% + .25rem);
  max-height: min(420px, 60vh); display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: 0 10px 30px rgba(29, 36, 51, .16);
  z-index: 5;
}
.quick-head { padding: .6rem; border-bottom: 1px solid var(--line); }
.quick-head input { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-s); padding: .4rem .5rem; }
.quick-list { list-style: none; margin: 0; padding: .25rem; overflow-y: auto; }
.quick-item {
  width: 100%; text-align: left; display: grid; gap: .1rem; padding: .5rem .6rem;
  border: 0; background: transparent; border-radius: var(--radius-s); cursor: pointer;
}
.quick-item:hover, .quick-item:focus-visible { background: var(--indigo-soft); }
.quick-short { font-weight: 700; color: var(--indigo); font-size: .85rem; }
.quick-text { font-size: .85rem; color: var(--muted); }
.quick-empty { padding: .6rem; color: var(--muted); font-size: .85rem; }
.quick-group { padding: .5rem .6rem .2rem; font-size: .75rem; font-weight: 700; color: var(--muted); }
.quick-owner { font-weight: 500; color: var(--muted); }
.quick-new { border-top: 1px solid var(--line); padding: .5rem .6rem; font-size: .88rem; }
.quick-new summary { cursor: pointer; color: var(--indigo); font-weight: 600; }
.quick-form { display: grid; gap: .5rem; margin-top: .5rem; }
.quick-form .small { justify-self: start; }

/* Ficha */
.facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem .75rem; margin: 1rem 0 0; font-size: .88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* Etiquetas em formato de tag de roupa: o elemento marcante do protótipo. */
.tags { list-style: none; margin: 0 0 .75rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.tags-empty { color: var(--muted); font-size: .85rem; }
.hangtag {
  position: relative;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .45rem .3rem 1.35rem;
  font-size: .8rem; font-weight: 600;
  clip-path: polygon(.7rem 0, 100% 0, 100% 100%, .7rem 100%, 0 50%);
  border-radius: 0 4px 4px 0;
}
.hangtag::before { /* furinho do cordão */
  content: ""; position: absolute; left: .55rem; top: 50%;
  width: .4rem; height: .4rem; margin-top: -.2rem; border-radius: 50%;
  background: var(--sheet);
}
.hangtag-remove {
  border: 0; border-left: 1px solid currentColor; background: transparent; cursor: pointer;
  font-size: .75rem; padding: 0 0 0 .4rem; color: inherit; text-decoration: underline;
}
.tone-indigo { background: var(--indigo-soft); color: var(--indigo); }
.tone-green { background: var(--wa-soft); color: var(--wa); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-rose { background: var(--ig-soft); color: var(--ig); }
.tone-slate { background: #e4e7ec; color: #3d4656; }

.toast {
  position: fixed; right: 1rem; bottom: 8rem;
  background: var(--ink); color: #fff; padding: .55rem .9rem; border-radius: var(--radius-s);
  font-size: .88rem; z-index: 10; max-width: calc(100vw - 2rem);
}

/* Celular: uma tela por vez. */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .pane-list, .pane-chat { grid-row: 1; grid-column: 1; border: 0; }
  .app[data-view="list"] .pane-chat { display: none; }
  .app[data-view="chat"] .pane-list,
  .app[data-view="contact"] .pane-list { display: none; }
  .back { display: inline-block; padding: .4rem .5rem; }
  .chat-head { flex-wrap: wrap; }
  .chat-who { order: 3; flex-basis: 100%; }
  .topbar { flex-wrap: wrap; gap: .5rem; }
  .brand { display: none; }
  .company-switch { order: 3; flex-basis: 100%; }
  .company-switch button { flex: 1; justify-content: space-between; }
  .current-user > span { display: none; }
  .number-row { grid-template-columns: 1fr auto; }
  .number-row > :last-child { grid-column: 1 / -1; justify-self: start; }
  .demo-banner { font-size: .78rem; padding: .35rem .75rem; }
  .composer { grid-template-columns: 1fr auto; }
  .quick-wrap { grid-column: 1 / -1; }
  .msg { max-width: 92%; }
  .toast { left: 1rem; right: 1rem; bottom: 10rem; text-align: center; }
  .cal-layout, .ct-layout { grid-template-columns: minmax(0, 1fr); }
  .cal-day { min-height: 2.8rem; padding: .25rem; }
  .cal-count { font-size: .62rem; }
  .cal-head .ghost { padding: .4rem .5rem; font-size: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Filtros e atalhos dos contatos. */
#channel-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.extra-filter { margin: 0 1rem .75rem; }
.contact-actions { min-width: 210px; }
.contact-actions input { width: 190px; }
.contact-link { display: block; color: #26357d; font-weight: 600; margin: .4rem 0; }
.badge-tiktok { background: #e6e8ee; color: #172034; }

/* Integração: o sino pertence ao cabeçalho, sem cobrir os controles da ficha. */
.topbar-right .crmn-root { position: relative; top: auto; right: auto; flex-shrink: 0; }
.topbar-right .crmn-panel { position: absolute; top: calc(100% + 8px); right: 0; }
/* Canais com botões individuais: divisão visível nas duas linhas. */
#channel-filter { border: 0; gap: 8px; overflow: visible; }
#channel-filter button { border: 1px solid #a6afc4; border-radius: 8px; min-height: 44px; background: #fff; color: #182349; }
#channel-filter button[aria-pressed="true"] { background: var(--indigo); color: #fff; border-color: var(--indigo); }
#channel-filter button:focus-visible { outline: 3px solid #7380c9; outline-offset: 2px; }
#channel-filter button[data-channel="all"] { grid-column: 1 / -1; justify-self: start; width: auto; min-height: 30px; padding: 3px 14px; font-size: .8rem; border-radius: 16px; border-color: #c5cbd2; background: #f0f2f4; color: #46515d; }
#channel-filter button[data-channel="all"][aria-pressed="true"] { background: #dfe4e8; border-color: #74818e; color: #26333f; font-weight: 600; }
#channel-filter button { position: relative; font-weight: 650; transition: background .15s, box-shadow .15s, transform .15s; box-shadow: 0 2px 5px #15213a12; }
#channel-filter button:hover { transform: translateY(-1px); box-shadow: 0 3px 8px #15213a26; }
#channel-filter button[data-channel="whatsapp"] { border-color: #289b73; background: #edf9f3; color: #146447; }
#channel-filter button[data-channel="whatsapp"][aria-pressed="true"] { background: #147958; color: white; }
#channel-filter button[data-channel="instagram"] { border-color: #b64a86; background: #fff0f7; color: #953367; }
#channel-filter button[data-channel="instagram"][aria-pressed="true"] { background: linear-gradient(120deg,#833ab4,#bb286d,#c44733); color: white; }
#channel-filter button[data-channel="tiktok"] { border-color: #4c5364; background: #f0f2f6; color: #242a38; }
#channel-filter button[data-channel="tiktok"][aria-pressed="true"] { background: #232938; color: white; box-shadow: inset 3px 0 #26d9df; }
.channel-new-badge { position: absolute; top: -7px; right: -5px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 12px; border: 2px solid white; background: #c5233a; color: white; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; line-height: 1; box-shadow: 0 1px 4px #0003; }
.channel-new-badge[hidden] { display: none; }
.inbox-filter-menu { margin: 0 14px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet, #fff); }
.inbox-filter-menu > summary { position: relative; cursor: pointer; padding: 10px 14px; font-weight: 650; color: var(--ink); }
.inbox-filter-menu[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.inbox-filter-menu > .filters { padding: 10px 12px; }
.inbox-filter-menu .extra-filter { margin-left: 12px; margin-right: 12px; }
#workspace-save-status { margin: 4px 14px; font-size: 12px; color: #20613d; }
#workspace-save-status.save-error { color: #9b1c2d; font-weight: 700; }
body[data-loading-workspace] .screen, body[data-loading-workspace] .mainnav { pointer-events: none; opacity: .6; }

/* Avisos breves no fluxo da página: nunca sobrepõem botões. */
.toast { position: static; inset: auto; transform: none; flex: none; width: 100%; max-width: none; margin: 0; border-radius: 0; padding: 8px 16px; background: #e8ecf1; color: #334155; border-bottom: 1px solid #cbd5e1; box-shadow: none; text-align: center; font-size: 14px; z-index: auto; }

.pane-list { overflow-y: auto; }
.pane-list > * { flex-shrink: 0; }
.pane-list .conv-list { flex: 1 0 180px; }
.advanced-filters { padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-s); }
.advanced-filters .field { margin-top: 10px; }

/* Telas pequenas: menu em uma linha e conversa sempre rolável. */
@media(max-width:760px) {
  .mainnav { flex-wrap: nowrap; overflow-x: auto; padding: 4px 8px; }
  .mainnav button { flex: 0 0 auto; white-space: nowrap; }
  .topbar-right { gap: 5px; justify-content: space-between; width: 100%; }
  .topbar-right select { max-width: 100px; }
  .topbar-right #rename-user { padding: 6px; font-size: 12px; }
  .topbar-right .crmn-toggle { padding: 5px 7px; font-size: 12px; }
  .pane-chat { overflow-y: auto; }
  .messages { min-height: 80px; }
}

.conversation-media {padding: .5rem 1rem; display:flex; gap:.5rem; flex-wrap:wrap; align-items:center; border-top:1px solid #d9dcdf;}
.audio-recorder {display:flex; align-items:center;gap:.5rem;flex-wrap:wrap;}
.audio-recorder span {font-size:.85rem;}
.media-preview {display:flex; gap:.5rem;flex-wrap:wrap;align-items:center;width:100%;}
.media-preview img,.media-preview video,.msg img,.msg video {max-width:280px;max-height:190px;border-radius:8px;}
.media-preview audio,.msg audio {max-width:100%;}

/* Anexar e gravar: botões redondos só com ícone, dentro da caixa de mensagem (canto direito). */
.message-box { position: relative; min-width: 0; }
.message-box textarea { display: block; padding-right: 5.6rem; }
.message-tools { position: absolute; right: .4rem; bottom: .4rem; display: flex; gap: .3rem; align-items: center; }
.message-tools .audio-recorder { display: contents; }
.icon-tool {
  width: 2.1rem; height: 2.1rem; padding: 0; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--indigo); display: inline-grid; place-items: center; cursor: pointer;
}
.icon-tool svg { width: 1.15rem; height: 1.15rem; }
.icon-tool:hover:not(:disabled) { background: #eef0fa; }
.icon-tool:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.icon-tool.is-recording { background: #c62828; border-color: #c62828; color: #fff; animation: rec-pulse 1.2s ease-in-out infinite; }
@keyframes rec-pulse { 50% { box-shadow: 0 0 0 .3rem rgba(198, 40, 40, .25); } }
@media (prefers-reduced-motion: reduce) { .icon-tool.is-recording { animation: none; } }
.conversation-media:not(:has(.media-preview)):not(:has(.audio-status:not(:empty))) { display: none; }
.conversation-media .audio-status:empty { display: none; }

/* Aviso de atualização (update-check.js). */
.update-bar {
  position: static; display: flex; align-items: center; justify-content: center; gap: .75rem; flex-wrap: wrap;
  padding: .45rem 1rem; background: #fff4c2; border-bottom: 1px solid #e0b100; font-weight: 600; color: #4a3b00;
}
.update-bar .primary { padding: .3rem .9rem; }

/* Senha da tela Contas a pagar. */
.bills-lock-tools { margin: .25rem 0 1rem; }
.lock-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.lock-state { color: var(--muted); font-size: .9rem; }
.lock-form { display: grid; gap: .5rem; max-width: 22rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius-m, 10px); background: var(--sheet, #fff); }
.lock-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
.lock-form .lock-actions { justify-content: flex-start; }
.lock-dialog { border: 1px solid var(--line); border-radius: var(--radius-m, 10px); padding: 1.25rem; width: min(22rem, 92vw); }
.lock-dialog::backdrop { background: rgba(15, 20, 35, .45); }
.lock-dialog h2 { margin: 0 0 .75rem; font-size: 1.15rem; }
.lock-dialog .field input { width: 100%; }
.field-error { color: #a12b2b; min-height: 1.2em; margin: .25rem 0; font-size: .9rem; }

/* Cabeçalho da conversa: adicionar a grupo + ficha do contato. */
.chat-head-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.chat-group-select { max-width: 14rem; padding: .45rem .5rem; border: 1px solid var(--button-bg, var(--indigo)); border-radius: var(--radius-s); color: var(--button-bg, var(--indigo)); background: var(--sheet, #fff); font-weight: 600; cursor: pointer; }
.chat-group-select:disabled { opacity: .55; cursor: default; }

/* Nome do contato com o botão Excluir logo abaixo (visível sem rolar a tabela). */
.ct-name-cell { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; }
.ct-name-cell .ct-confirm { max-width: 18rem; }

/* Etiquetas coloridas (cor vem de --lc, definida pelo JS). */
.label-chip { display: inline-flex; align-items: center; gap: .25rem; max-width: 100%; padding: .1rem .55rem; border-radius: 999px;
  background: color-mix(in srgb, var(--lc, #455a64) 14%, #fff); color: var(--lc, #455a64);
  border: 1px solid color-mix(in srgb, var(--lc, #455a64) 45%, #fff); font-size: .8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-chip.is-small { font-size: .72rem; padding: 0 .45rem; }
.label-chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .1rem; }
.chat-labels { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.chat-labels:empty { display: none; }
.label-new { display: grid; gap: .75rem; max-width: 40rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-m, 10px); background: var(--sheet, #fff); margin-top: .5rem; margin-bottom: 1.25rem; }
.label-new-end { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.label-palette { display: flex; flex-wrap: wrap; gap: .35rem; }
.swatch { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid #fff; background: var(--lc); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.is-on { box-shadow: 0 0 0 2px var(--lc); outline: 2px solid #fff; outline-offset: -4px; }
.label-list { list-style: none; margin-top: 0; margin-bottom: 0; padding: 0; display: grid; gap: .5rem; }
.label-row { display: grid; grid-template-columns: minmax(7rem, max-content) minmax(8rem, 14rem) 1fr auto auto auto; align-items: center; gap: .6rem;
  padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-m, 10px); background: var(--sheet, #fff); }
.label-row input { min-width: 0; }
.label-count { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.label-confirm { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .85rem; }
@media (max-width: 760px) { .label-row { grid-template-columns: 1fr; justify-items: start; } }

/* Cabeçalho da conversa enxuto: ícones redondos + painelzinho. */
.chat-head-actions { position: relative; display: flex; gap: .35rem; align-items: center; flex-wrap: nowrap; }
.head-tool { width: 2.15rem; height: 2.15rem; position: relative; }
.head-tool[aria-expanded="true"] { background: var(--indigo-soft, #e3f3ed); }
.head-tool.has-mark::after { content: ""; position: absolute; top: 2px; right: 2px; width: .5rem; height: .5rem; border-radius: 50%; background: #1f8a5b; border: 1.5px solid #fff; }
.head-pop { position: absolute; top: calc(100% + .4rem); right: 0; z-index: 30; width: min(19rem, 86vw); padding: .75rem;
  background: var(--sheet, #fff); border: 1px solid var(--line); border-radius: var(--radius-m, 10px); box-shadow: 0 8px 28px rgba(20, 30, 60, .18); }
.head-pop-title { margin: 0 0 .5rem; font-weight: 700; }
.head-pop-note { margin: .25rem 0 .5rem; color: var(--muted); font-size: .82rem; }
.head-pop-list { display: flex; flex-wrap: wrap; gap: .35rem; max-height: 14rem; overflow: auto; }
.head-pop-list.is-column { flex-direction: column; flex-wrap: nowrap; }
button.head-pop-chip { border: 0; background: transparent; padding: 0; cursor: pointer; }
button.head-pop-item { text-align: left; width: 100%; }
button.head-pop-link { margin-top: .6rem; border: 0; background: transparent; color: var(--indigo); cursor: pointer; padding: .2rem 0; font-weight: 600; }
.head-pop-form { display: grid; gap: .45rem; }
.head-pop-form .field input { width: 100%; }
.head-pop-new { display: flex; gap: .35rem; }
.head-pop-new input { flex: 1; min-width: 0; }
.head-pop-consent { display: flex; gap: .4rem; align-items: flex-start; margin-top: .6rem; font-size: .82rem; color: var(--muted); cursor: pointer; }
/* Cartão do contato no topo da conversa (estilo WhatsApp, 17/11) */
.contact-card { list-style: none; align-self: center; width: min(26rem, 92%); margin: .5rem auto 1rem; padding: 1rem 1rem .9rem;
  background: var(--surface, #fff); border-radius: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); text-align: center; display: grid; justify-items: center; gap: .2rem; }
.contact-card .contact-card-avatar { width: 4.5rem; height: 4.5rem; font-size: 1.4rem; margin-bottom: .35rem; }
.contact-card-phone { margin: 0; font-weight: 700; font-size: 1.1rem; }
.contact-card-name { margin: 0; color: var(--muted); }
.contact-card-facts { margin: .3rem 0 .6rem; font-size: .85rem; color: var(--muted); line-height: 1.4; }
.contact-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; width: 100%; }
.contact-card-btn { border: 1px solid var(--line, #d9dee3); background: transparent; border-radius: 999px; padding: .55rem .8rem; font-weight: 600; cursor: pointer; }
.contact-card-btn.is-danger { color: #c62828; }
.contact-card-btn.is-add { color: #128c4a; }
.contact-card-btn:hover { background: rgba(0,0,0,.04); }
.chat-who h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Resultados. */
.res-period { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.res-period button.small[aria-pressed="true"]:not(.x) { background: var(--button-bg, var(--indigo)); color: var(--button-text, #fff); }
.res-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.res-kpi { display: flex; flex-direction: column; gap: .15rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-m, 10px); background: var(--sheet, #fff); }
.res-kpi span { color: var(--muted); font-size: .85rem; }
.res-kpi strong { font-size: 1.5rem; }
.res-kpi small { color: var(--muted); }
.res-h2 { font-size: 1.1rem; margin-top: 1.25rem; margin-bottom: .35rem; }
.res-help { color: var(--muted); font-size: .88rem; margin-top: 0; margin-bottom: .6rem; }
.res-table { width: 100%; border-collapse: collapse; background: var(--sheet, #fff); border: 1px solid var(--line); border-radius: var(--radius-m, 10px); overflow: hidden; }
.res-table th, .res-table td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: left; font-size: .9rem; }
.res-table th { color: var(--muted); font-weight: 600; background: #f6f7f4; }
.res-rate { min-width: 9rem; }
.res-bar { display: block; height: .45rem; margin-top: .25rem; border-radius: 999px; background: linear-gradient(90deg, #1f8a5b var(--w, 0%), #e6e9ec var(--w, 0%)); }
.table-wrap { overflow-x: auto; }

#results > *, #labels > * { max-width: 1040px; }
#imp-confirm { margin: .75rem 0 1.25rem; } .imp-config .imp-group { margin-top: .5rem; }

/* Entregas das facções com visual profissional e foto do modelo (pedido do Lucas, 11/11). */
.delivery-form { padding: 1.25rem !important; box-shadow: 0 2px 10px rgba(15,23,42,.06); border-radius: 14px !important; }
.dv-title { display: flex; align-items: center; gap: .6rem; margin: 0 0 .25rem; }
.dv-title::before, .dv-f > span::before, .dv-ico { content: ""; display: inline-block; flex: none; width: 1.6rem; height: 1.6rem; border-radius: .5rem;
  background-repeat: no-repeat; background-position: center; background-size: 62% 62%, 100% 100%;
  box-shadow: 0 3px 6px rgba(15,23,42,.25), inset 0 1px 0 rgba(255,255,255,.45), inset 0 -2px 0 rgba(0,0,0,.18); }
.dv-title::before { width: 2.2rem; height: 2.2rem; border-radius: .7rem; }
.dv-f > span { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--ink); }
.dv-layout { display: grid; grid-template-columns: 210px minmax(0,1fr); gap: 1.25rem; align-items: start; }
.dv-photo-col { display: grid; gap: .35rem; }
.dv-photo { position: relative; aspect-ratio: 3/4; display: grid; place-items: center; align-content: center; gap: .35rem; text-align: center; cursor: pointer;
  border: 2px dashed #c9cfe0; border-radius: 14px; background: #f6f7fb; color: var(--muted); overflow: hidden; }
.dv-photo:hover, .dv-photo.is-over, .dv-photo:focus-visible { border-color: var(--indigo); background: #eef1fd; outline: none; }
.dv-photo strong { color: var(--ink); }
.dv-photo small { font-size: .78rem; }
.dv-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dv-photo .dv-ico { width: 2.6rem; height: 2.6rem; border-radius: .8rem; }
.dv-photo-x { position: absolute; top: 6px; right: 6px; width: 1.8rem; height: 1.8rem; border-radius: 50% !important; border: 0 !important; padding: 0 !important;
  background: rgba(15,23,42,.7) !important; color: #fff !important; font-size: 1.1rem; display: grid; place-items: center; cursor: pointer; }
.delivery-form > .primary { justify-self: end !important; padding: .6rem 1.4rem !important; }
.dv-thumb { width: 44px; height: 58px; object-fit: cover; border-radius: 6px; vertical-align: middle; margin-right: .5rem; box-shadow: 0 1px 4px rgba(15,23,42,.2); }
.dv-model-cell { display: flex; align-items: center; }
.dv-send-btn { display: inline-flex !important; align-items: center; gap: .4rem; border-radius: 999px !important; padding: .3rem .75rem .3rem .3rem !important; white-space: nowrap; }
.dv-send-btn .dv-ico { width: 1.3rem; height: 1.3rem; border-radius: 50%; }
.dv-share-row > td { background: #f7f8fb; padding: 1rem !important; }
.dv-share { display: grid; gap: .6rem; max-width: 640px; }
.dv-share textarea { min-height: 11rem; }
@media (max-width: 760px) { .dv-layout { grid-template-columns: minmax(0,1fr); } .dv-photo-col { max-width: 210px; } }
.dv-f[data-i="model"] > span::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M9%203h6l1%203%204%202-2%204-2-1v10H8V11l-2%201-2-4%204-2z%22/%3E%3C/svg%3E"), linear-gradient(150deg, #e8508f, #ad1f5c); }
.dv-f[data-i="size"] > span::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%208h18v8H3zM7%208v3M11%208v4M15%208v3M19%208v4%22/%3E%3C/svg%3E"), linear-gradient(150deg, #9b6bdc, #6534b0); }
.dv-f[data-i="qty"] > span::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%207h16M4%2012h16M4%2017h10%22/%3E%3C/svg%3E"), linear-gradient(150deg, #4f6bed, #0e7c63); }
.dv-f[data-i="workshop"] > span::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%2021V10l5%203V10l5%203V7l8%204v10z%22/%3E%3C/svg%3E"), linear-gradient(150deg, #b98552, #7d5428); }
.dv-f[data-i="acc"] > span::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%229%22%20cy%3D%229%22%20r%3D%225%22/%3E%3Ccircle%20cx%3D%229%22%20cy%3D%229%22%20r%3D%221%22/%3E%3Cpath%20d%3D%22m13%2013%207%207%22/%3E%3C/svg%3E"), linear-gradient(150deg, #f2b632, #c78400); }
.dv-f[data-i="date"] > span::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%224%22%20y%3D%225%22%20width%3D%2216%22%20height%3D%2215%22%20rx%3D%222%22/%3E%3Cpath%20d%3D%22M8%203v4M16%203v4M4%2010h16%22/%3E%3C/svg%3E"), linear-gradient(150deg, #e2544e, #a8241f); }
.dv-ico-photo { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%226%22%20width%3D%2218%22%20height%3D%2214%22%20rx%3D%222%22/%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2213%22%20r%3D%223.5%22/%3E%3Cpath%20d%3D%22M8%206l1.5-2h5L16%206%22/%3E%3C/svg%3E"), linear-gradient(150deg, #d65fd0, #9b2c96); }
.dv-title::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%207.5%2012%203l9%204.5v9L12%2021l-9-4.5z%22/%3E%3Cpath%20d%3D%22M3%207.5%2012%2012l9-4.5M12%2012v9%22/%3E%3C/svg%3E"), linear-gradient(150deg, #b98552, #7d5428); }
.dv-ico-chat { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%205h16v11H8l-4%204z%22/%3E%3C/svg%3E"), linear-gradient(150deg, #34c27a, #128c4e); }
/* Grade das entregas: Modelo | Tamanho | Quantidade | Data; depois Facção | Aviamentos. */
.dv-layout .delivery-fields { grid-template-columns: 2fr 1fr 1fr 1.3fr !important; align-items: start; gap: .9rem 1rem; }
.dv-layout .workshop-fields { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: 1fr 1.4fr; gap: 1rem; align-items: start; }
.dv-layout .delivery-fields input, .dv-layout .delivery-fields textarea { width: 100%; margin-top: .35rem; }
.dv-layout .delivery-fields .field { align-self: start; }
.dv-layout .delivery-fields textarea { min-height: 5.5rem; }
@media (max-width: 900px) { .dv-layout .delivery-fields { grid-template-columns: 1fr 1fr !important; } .dv-layout .workshop-fields { grid-template-columns: 1fr; } }

/* Selecionar conversas para salvar os contatos num grupo. */
.pane-head { display: flex; align-items: center; gap: .5rem; }
.pane-head .count { margin-left: auto; }
.list-select-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .5rem 1rem; background: #eef1fd; border-bottom: 1px solid var(--line); font-weight: 600; font-size: .88rem; }
.list-select-bar select { flex: 1; min-width: 8rem; }
.conv-check { width: 1.35rem; height: 1.35rem; flex: none; align-self: center; border-radius: .4rem; border: 2px solid #b5bdd6; background: #fff;
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: .85rem; }
.conv-check.is-on { background: var(--indigo); border-color: var(--indigo); }
.conv[aria-pressed="true"] { background: #eef1fd; }

/* Entregas: cor, conferência e prévia no celular. */
.dv-f[data-i="color"] > span::before { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%203a9%209%200%201%200%200%2018c1.2%200%201.8-.9%201.4-1.9-.5-1.2.3-2.1%201.5-2.1H17a4%204%200%200%200%204-4c0-5.5-4-10-9-10z%22/%3E%3Ccircle%20cx%3D%227.5%22%20cy%3D%2211%22%20r%3D%221.2%22/%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%227%22%20r%3D%221.2%22/%3E%3Ccircle%20cx%3D%2215%22%20cy%3D%227.5%22%20r%3D%221.2%22/%3E%3C/svg%3E"), linear-gradient(150deg, #d65fd0, #9b2c96); }
.dv-layout .delivery-fields { grid-template-columns: 2fr 1fr 1.3fr 1fr 1.3fr !important; }
.dv-check-form { display: flex; gap: .35rem; align-items: center; }
.dv-check-form input { width: 6.5rem; }
.dv-check { font-weight: 700; font-size: .86rem; white-space: nowrap; }
.dv-check.is-ok { color: #1f7a5b; }
.dv-check.is-bad { color: #a12b2b; }
.dv-check-wrap { display: grid; gap: .3rem; justify-items: start; }
.link-btn { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; font-size: .8rem; }
.dv-share-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }
.dv-share-title { margin: 0 0 .25rem; font-size: 1.05rem; }
.dv-note { color: var(--muted); font-size: .8rem; margin: 0; }
.dv-preview-title { margin: 0 0 .4rem; font-weight: 700; color: var(--muted); font-size: .85rem; }
.dv-phone .wa-body { min-height: 300px; }
@media (max-width: 900px) { .dv-share-grid { grid-template-columns: minmax(0, 1fr); } .dv-layout .delivery-fields { grid-template-columns: 1fr 1fr !important; } }
/* O painel de envio fica dentro da largura visível mesmo com a tabela rolando para o lado. */
.dv-share-row .dv-share-grid { position: sticky; left: 0; width: min(1000px, calc(100vw - 5rem)); }

/* Entregas: formulário e fotografia em duas colunas. */
#deliveries > .delivery-workspace { max-width:1600px;display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr);gap:24px;align-items:start; }
.delivery-workspace .delivery-form { margin:0;min-width:0; }
.delivery-hero { width:100%;height:auto;aspect-ratio:4/3;object-fit:contain;border-radius:18px; }
@media (min-width:1101px) { .delivery-workspace .dv-layout { grid-template-columns:170px minmax(0,1fr); } .delivery-workspace .delivery-fields { grid-template-columns:repeat(2,minmax(0,1fr)); } .delivery-workspace .workshop-fields { grid-column:1/-1; } }
@media (max-width:1100px) { #deliveries > .delivery-workspace { grid-template-columns:minmax(0,1fr);max-width:1040px; } .delivery-hero { max-height:400px; } }

/* Canais de atendimento: leitura ampliada e ações consistentes. */
#connect { width:100%;max-width:1240px;margin:0 auto;padding:32px 28px 48px;overflow-y:auto; }
#connect .connect-head { justify-content:space-between;gap:16px;margin-bottom:18px; }
#connect .connect-head h1 { order:-1;margin:0;font-size:30px;line-height:1.25; }
#connect .connect-note { font-size:17px;line-height:1.6;margin:0 0 24px;max-width:850px; }
#connect .number-list { margin:0;border-radius:16px;overflow:hidden;background:#fff; }
#connect .number-row { padding:25px 28px;gap:24px;min-height:116px; }
#connect .number-info { gap:6px;min-width:0; }
#connect .number-info strong { font-size:20px;line-height:1.35; }
#connect .number-info span { font-size:16px;line-height:1.45;overflow-wrap:anywhere; }
#connect .status { font-size:14px;padding:7px 12px;background:#eaf5f0;color:#17654f; }
#connect button.small,#connect #close-connect,#connect .connect-box a.primary { min-height:46px;padding:11px 18px;border-radius:10px;font-size:16px;font-weight:650;text-decoration:none; }
#connect button.small { background:#087d65;border:1px solid #087d65;color:white; }
#connect button.small:hover { background:#065f4d;border-color:#065f4d; }
#connect #close-connect { background:white;border:1px solid #bbd4cc;color:#086950; }
#connect button:focus-visible,#connect a:focus-visible { outline:3px solid #f6a344;outline-offset:3px; }
@media(max-width:760px) { #connect { padding:24px 16px; } #connect .connect-head h1 { font-size:25px; } #connect .number-row { grid-template-columns:minmax(0,1fr);gap:14px;padding:22px; } #connect .status { justify-self:start;white-space:normal; } #connect button.small { justify-self:start; } }

#connect > * { max-width:none; }
#connect .status.is-off { background:#eef0f3;color:#586474; }
