:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --border: #e2dfd8;
  --text: #1b1c1e;
  --muted: #6b6e73;
  --accent: #d97706;
  --accent-soft: #fdf1dc;
  --accent-text: #ffffff;
  --wa: #1fae55;
  --wa-soft: #e3f6ea;
  --danger: #c2372d;
  --danger-soft: #fbe6e3;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 8px 24px rgb(0 0 0 / 0.06);
  --st-lead: #2f6fdb;
  --st-negociacao: #7c4dd6;
  --st-cliente: #1a9a50;
  --st-recorrente: #c77a06;
  --st-inativo: #7a7d82;
  --st-perdido: #c2372d;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1012;
    --surface: #17181b;
    --surface-2: #1f2124;
    --border: #2b2d31;
    --text: #ebe9e4;
    --muted: #979aa0;
    --accent: #f59e0b;
    --accent-soft: #3a2a0c;
    --accent-text: #1a1204;
    --wa: #25d366;
    --wa-soft: #10301c;
    --danger: #ef5b4f;
    --danger-soft: #3a1714;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px rgb(0 0 0 / 0.35);
    --st-lead: #6a9cf5;
    --st-negociacao: #a888f0;
    --st-cliente: #3ecf7a;
    --st-recorrente: #f5a524;
    --st-inativo: #9a9da3;
    --st-perdido: #ef5b4f;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 24px;
}
h2 {
  font-size: 15px;
}
h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}
.sub {
  color: var(--muted);
  font-size: 12px;
}
.error {
  color: var(--danger);
}

svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: none;
}

/* ---------- controles ---------- */

input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  width: 100%;
  min-width: 0;
}
textarea {
  resize: vertical;
  min-height: 90px;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}
input[type='checkbox'] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  padding: 0;
}

label.field {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
  font-size: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-weight: 600;
  border-radius: 9px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-2);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn.primary:hover {
  filter: brightness(1.06);
}
.btn.wa {
  background: var(--wa);
  border-color: var(--wa);
  color: #fff;
}
.btn.wa:hover {
  filter: brightness(1.06);
}
.btn.danger {
  color: var(--danger);
}
.btn.ghost {
  background: transparent;
}
.btn.small {
  padding: 5px 10px;
  font-size: 12px;
}
.btn.big {
  padding: 13px 20px;
  font-size: 15px;
}
.btn.block {
  width: 100%;
}

.btn-wa {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--wa-soft);
  color: var(--wa);
  cursor: pointer;
  flex: none;
}
.btn-wa:hover {
  background: var(--wa);
  color: #fff;
}
.btn-wa.disabled {
  opacity: 0.35;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: var(--c);
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.st-lead { --c: var(--st-lead); }
.st-negociacao { --c: var(--st-negociacao); }
.st-cliente { --c: var(--st-cliente); }
.st-recorrente { --c: var(--st-recorrente); }
.st-inativo { --c: var(--st-inativo); }
.st-perdido { --c: var(--st-perdido); }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  margin-right: 4px;
}

/* ---------- marca ---------- */

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
}
.brand-mark span {
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.brand-mark span:nth-child(1) { height: 45%; }
.brand-mark span:nth-child(2) { height: 100%; }
.brand-mark span:nth-child(3) { height: 70%; }
.brand-mark span:nth-child(4) { height: 35%; }
.brand-mark.big {
  height: 38px;
  gap: 5px;
  justify-content: center;
}
.brand-mark.big span {
  width: 7px;
  border-radius: 3px;
}

/* ---------- login ---------- */

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.login-brand {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 18px;
  padding: 56px;
  color: #fff;
  background:
    radial-gradient(90% 80% at 0% 100%, rgb(255 255 255 / 0.14), transparent 60%),
    linear-gradient(135deg, #f7b733 0%, #e2531c 100%);
}
.login-brand::after {
  content: '';
  position: absolute;
  right: -120px;
  top: -120px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  border: 60px solid rgb(255 255 255 / 0.08);
}
.login-brand-logo {
  width: 96px;
  height: 96px;
  border-radius: 26px;
  object-fit: contain;
  background: rgb(255 255 255 / 0.15);
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.18);
}
.login-brand h1 {
  font-size: 40px;
  line-height: 1.1;
  max-width: 12ch;
}
.login-brand p {
  margin: 0;
  font-size: 17px;
  max-width: 34ch;
  opacity: 0.92;
}
.login-side {
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.login-card {
  width: min(380px, 100%);
  display: grid;
  gap: 16px;
}
.login-card h2 {
  font-size: 24px;
}
.login-card p {
  margin: 4px 0 0;
}
.login-logo {
  display: none;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: contain;
}
.login-card input {
  padding: 12px 14px;
  font-size: 15px;
}
.pass-wrap {
  position: relative;
  display: block;
}
.pass-wrap input {
  padding-right: 84px;
}
.pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  border: 0;
  border-radius: 7px;
  padding: 6px 10px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}
.pass-toggle:hover {
  color: var(--text);
}
@media (max-width: 860px) {
  .login {
    grid-template-columns: 1fr;
  }
  .login-brand {
    display: none;
  }
  .login-logo {
    display: block;
  }
}

/* ---------- estrutura ---------- */

.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 12px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.sidebar a.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
  color: var(--text);
  background: none;
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  object-fit: contain;
  flex: none;
}
.brand-text {
  min-width: 0;
}
.brand-name {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
}
.brand-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  object-fit: contain;
  margin: 0 auto;
}
.sidebar a,
.sidebar .logout {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font: inherit;
  font-weight: 600;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.sidebar a:hover,
.sidebar .logout:hover {
  background: var(--surface-2);
  color: var(--text);
}
.sidebar a.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar .logout {
  margin-top: auto;
}

.view {
  padding: 28px 32px 60px;
  min-width: 0;
  max-width: 1280px;
  width: 100%;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head p {
  margin: 4px 0 0;
}
.head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 8px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.card-head a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
}
.stack {
  display: grid;
  gap: 16px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid .full {
  grid-column: 1 / -1;
}

.loading,
.empty {
  padding: 50px 20px;
  text-align: center;
  color: var(--muted);
}
.empty strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 4px;
}

/* ---------- painel ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.stat .value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}

.mini-list {
  display: grid;
}
.mini-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.mini-row:first-child {
  border-top: 0;
}
.mini-row:hover {
  background: var(--surface-2);
  border-radius: 8px;
}
.mini-row .grow {
  flex: 1;
  min-width: 0;
}
.mini-row .name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-row .right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.late {
  color: var(--danger);
  font-weight: 600;
}

.funnel {
  display: grid;
  gap: 8px;
}
.funnel-row {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.funnel-bar {
  height: 10px;
  border-radius: 5px;
  background: var(--surface-2);
  overflow: hidden;
}
.funnel-bar i {
  display: block;
  height: 100%;
  background: var(--c);
  border-radius: 5px;
}
.funnel-row .n {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- contatos ---------- */

.filters {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr) 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.bulkbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  font-weight: 600;
}
.bulkbar select {
  width: auto;
}
.bulkbar .spacer {
  flex: 1;
}

.list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.list-meta {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 8px 2px;
}
.row {
  display: grid;
  grid-template-columns: 28px minmax(180px, 2fr) 150px 150px 120px minmax(130px, 1.3fr) 100px 40px;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.row:first-child {
  border-top: 0;
}
.row:not(.head):hover {
  background: var(--surface-2);
}
.row.head {
  cursor: default;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-2);
}
.row .name {
  font-weight: 600;
}
.row .cell-main {
  min-width: 0;
}
.row .cell-main .sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .cell-total {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.row .cell-phone {
  font-variant-numeric: tabular-nums;
}

/* ---------- funil (kanban) ---------- */

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.col {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 2px solid transparent;
}
.col.over {
  border-color: var(--accent);
}
.col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px 6px;
}
.col-head .n {
  font-weight: 700;
  color: var(--muted);
}
.col-body {
  display: grid;
  gap: 8px;
  align-content: start;
  flex: 1;
}
.kcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: grab;
}
.kcard.dragging {
  opacity: 0.4;
}
.kcard .grow {
  flex: 1;
  min-width: 0;
}
.kcard .name {
  font-weight: 600;
}
.kcard .btn-wa {
  width: 30px;
  height: 30px;
}
.kcard .btn-wa svg {
  width: 15px;
  height: 15px;
}

/* ---------- disparos ---------- */

.progress {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
}
.progress i {
  display: block;
  height: 100%;
  background: var(--wa);
}
.progress i.skip {
  background: var(--st-inativo);
}

.camp-row {
  display: grid;
  grid-template-columns: 1fr 200px 110px;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  text-decoration: none;
}
.camp-row:first-child {
  border-top: 0;
}
.camp-row:hover {
  background: var(--surface-2);
}

.steps {
  display: grid;
  gap: 16px;
}
.step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.step-num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 12px;
}
.stage-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.stage-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.recipients {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 12px;
}
.recipient {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.recipient:first-child {
  border-top: 0;
}
.recipient .grow {
  flex: 1;
  min-width: 0;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.chip {
  font: inherit;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px dashed var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.bubble {
  background: var(--wa-soft);
  border-radius: 12px 12px 12px 4px;
  padding: 12px 14px;
  white-space: pre-wrap;
  max-width: 520px;
}

.runner {
  display: grid;
  gap: 14px;
  border: 2px solid var(--wa);
}
.runner .who {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.runner .who .name {
  font-size: 18px;
  font-weight: 700;
}
.runner .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.item-row {
  display: grid;
  grid-template-columns: 24px 1fr 150px 130px;
  gap: 12px;
  align-items: center;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
}
.item-row:first-child {
  border-top: 0;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}
.dot.enviado {
  background: var(--wa);
}
.dot.pulado {
  background: var(--st-inativo);
}

/* ---------- ajustes ---------- */

.table-edit {
  display: grid;
  gap: 8px;
}
.table-edit .line {
  display: grid;
  grid-template-columns: 1fr 140px auto auto;
  gap: 8px;
  align-items: center;
}
.tpl {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

/* ---------- gaveta do contato ---------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.35);
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 22px;
  display: grid;
  grid-auto-rows: max-content;
  gap: 16px;
  align-content: start;
  animation: slide 0.18s ease-out;
}
@keyframes slide {
  from {
    transform: translateX(30px);
    opacity: 0;
  }
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.drawer-head h2 {
  font-size: 21px;
}
.drawer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.kv > div {
  background: var(--surface);
  padding: 11px 13px;
}
.kv .k {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kv .v {
  font-weight: 600;
  margin-top: 2px;
  word-break: break-word;
}
.kv select {
  margin-top: 4px;
  padding: 5px 8px;
}

details.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
details.section summary {
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
}
details.section summary::after {
  content: '+';
  color: var(--muted);
  font-weight: 400;
  font-size: 18px;
  line-height: 1;
}
details.section[open] summary::after {
  content: '–';
}
details.section form {
  padding: 0 14px 14px;
}

.timeline {
  display: grid;
}
.tl-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.tl-item:first-child {
  border-top: 0;
}
.tl-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
}
.tl-icon.whatsapp {
  background: var(--wa-soft);
  color: var(--wa);
}
.tl-icon.venda {
  background: var(--accent-soft);
  color: var(--accent);
}
.tl-icon svg {
  width: 15px;
  height: 15px;
}
.tl-item .title {
  font-weight: 600;
}
.tl-item .note {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  margin-top: 2px;
}
.unpaid {
  color: var(--danger);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- modal e avisos ---------- */

.modal {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  width: min(560px, calc(100% - 24px));
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
}
.modal::backdrop {
  background: rgb(0 0 0 / 0.45);
}
.modal form {
  display: grid;
  gap: 14px;
  padding: 22px;
}
.modal .modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal .modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 100;
  width: min(420px, calc(100% - 32px));
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: pop 0.2s ease-out;
}
.toast.error {
  background: var(--danger);
  color: #fff;
}
@keyframes pop {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  margin-bottom: 16px;
  font-size: 13px;
}

/* ---------- responsivo ---------- */

@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .filters {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .filters #f-q {
    grid-column: 1 / -1;
  }
  .row {
    grid-template-columns: 28px minmax(160px, 2fr) 140px 110px minmax(120px, 1.3fr) 40px;
  }
  .row .cell-phone,
  .row .cell-total {
    display: none;
  }
}

@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--border);
    z-index: 40;
  }
  .sidebar .brand {
    display: none;
  }
  .sidebar a,
  .sidebar .logout {
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    padding: 6px 8px;
    margin: 0;
  }
  .view {
    padding: 18px 16px 100px;
  }
  h1 {
    font-size: 21px;
  }
  .grid-2,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .row {
    grid-template-columns: 24px 1fr auto;
    gap: 10px;
  }
  .row.head {
    display: none;
  }
  .row .cell-stage,
  .row .cell-last,
  .row .cell-service {
    display: none;
  }
  .row .cell-main .sub.m {
    display: block;
  }
  .funnel-row {
    grid-template-columns: 110px 1fr 30px;
  }
  .camp-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .item-row {
    grid-template-columns: 20px 1fr auto;
  }
  .item-row .when {
    display: none;
  }
  .table-edit .line {
    grid-template-columns: 1fr 100px auto;
  }
  .table-edit .line .active-toggle {
    display: none;
  }
  .kv {
    grid-template-columns: 1fr;
  }
  .toasts {
    bottom: 90px;
  }
}

@media (min-width: 761px) {
  .sub.m {
    display: none;
  }
}
