:root {
  --primary: #049cdb;
  --primary-dark: #0378a8;
  --primary-soft: rgba(4, 156, 219, 0.12);
  --navy: #15405c;
  --bg: #f3f5f7;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --danger: #991b1b;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-soft: #fee2e2;
  --danger-fill: #b91c1c;
  --success: #166534;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --success-soft: #dcfce7;
  --warn: #713f12;
  --warn-bg: #fffbeb;
  --warn-border: #fde68a;
  --warn-soft: rgba(250, 204, 21, 0.28);
  --warn-fill: #facc15;
  --warn-fill-hover: #eab308;
  --ok: #036e9b;
  --ok-bg: #e6f6fc;
  --font: "Segoe UI", system-ui, sans-serif;
  --tap: 44px;
  --sidebar: 256px;
  --rail: 72px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html:has(.layout),
body:has(.layout) {
  height: 100%;
  overflow: hidden;
}
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary-dark); }
a:hover { color: var(--primary); }
button, input, select, textarea { font: inherit; }

.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 24px 16px;
}
.auth-shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 13.6px;
  padding: 32px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
.auth-foot {
  margin: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  line-height: 1.7;
}
.auth-foot a {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  text-decoration: none;
}
.auth-foot a:hover { color: #fff; }
.brand {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--primary);
  font-size: 12px;
  margin: 0;
}
.auth-card h1 { margin: 8px 0 4px; font-size: clamp(22px, 5vw, 28px); }
.lead { color: var(--muted); margin: 0 0 24px; }
.auth-card h2 { margin: 0 0 16px; font-size: 18px; }

label { display: block; font-size: 14px; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 8.5px;
  padding: 10px 12px;
  background: #fff;
}
select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%2364748b' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-color: #fff;
}
.form .card > select {
  width: max-content;
  max-width: 100%;
  min-width: min(100%, 280px);
}
textarea { min-height: 120px; }
.auth-card form .btn.full { margin-top: 20px; }
.pw-field { position: relative; }
.pw-field input { padding-right: 46px; }
.pw-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  min-width: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 0 8.5px 8.5px 0;
  cursor: pointer;
}
.pw-toggle:hover { color: var(--primary); }
.pw-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8.5px;
  padding: 10px 16px;
  min-height: var(--tap);
  cursor: pointer;
  text-decoration: none;
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn.secondary { background: #e2e8f0; color: var(--text); }
.btn.secondary:hover { background: #cbd5e1; color: var(--text); }
.btn.ghost { background: transparent; color: var(--primary-dark); }
.btn.ghost:hover { background: var(--primary-soft); color: var(--primary-dark); }
.btn.ghost.logs { background: var(--warn-bg); color: var(--warn); }
.btn.ghost.logs:hover,
.btn.ghost.logs:active { background: var(--warn-soft); color: var(--warn); }
.record > .btn.logs { margin-top: 12px; }
.btn.ghost.action-icon { color: var(--muted); }
.btn.ghost.action-icon:hover,
.btn.ghost.action-icon:active { background: var(--primary-soft); color: var(--primary-dark); }
.btn.action-icon { padding: 8px; width: 36px; }
.btn.warn { background: var(--warn-fill); color: var(--warn); }
.btn.warn:hover { background: var(--warn-fill-hover); color: var(--warn); }
.btn.danger { background: var(--danger-fill); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.sm { padding: 8px 12px; font-size: 13px; min-height: 36px; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn.full { width: 100%; }

.alert { border-radius: 8.5px; padding: 10px 12px; font-size: 14px; margin-bottom: 16px; }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
body:has(.layout) .toasts { top: 80px; }
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 10px 12px 14px;
  border-radius: 10.2px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ok);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  animation: toast-in 0.2s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn-fill); }
.toast p { margin: 0; flex: 1; font-size: 14px; line-height: 1.4; }
.toast-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6.8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.toast-close:hover { background: var(--bg); color: var(--text); }
.toast-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.toast.leaving { animation: toast-out 0.18s ease forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(12px); }
}

.layout {
  display: flex;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}
.sidebar {
  width: var(--sidebar);
  background: #fff;
  border-right: 1px solid var(--line);
  color: var(--text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  overflow: hidden;
  transition: width 0.22s ease;
}
.sidebar-foot { flex-shrink: 0; }
/* Faixa de 64px, igual à topbar, para a divisória dos dois cabeçalhos formar uma linha só. */
.sidebar-brand {
  flex-shrink: 0;
  position: relative;
  height: 64px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.sidebar-logo { display: flex; align-items: center; min-width: 0; flex: 1; }
.sidebar-logo img { display: block; width: auto; max-width: 100%; max-height: 32px; }
.nav-icon { display: inline-flex; flex-shrink: 0; width: 20px; height: 20px; }
.nav-icon svg { display: block; width: 20px; height: 20px; }
.auth-card .auth-logo { margin: 4px 0 18px; line-height: 0; }
.auth-logo img { display: block; width: min(50%, 150px); height: auto; margin: 0 auto; }
.auth-logo + .lead { text-align: center; margin-bottom: 28px; }
nav { padding: 20px 12px; flex: 1; overflow-y: auto; }
.nav-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 12px;
  margin: 16px 0 8px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  min-height: var(--tap);
  color: var(--text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8.5px;
  margin-bottom: 4px;
}
.nav-link:hover,
.nav-link.active { background: var(--primary-soft); color: var(--primary-dark); }
.nav-tip {
  position: fixed;
  z-index: 60;
  padding: 6px 10px;
  border-radius: 6.8px;
  background: var(--text);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}
.nav-tip[hidden] { display: none; }
.nav-tip::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -4px;
  width: 8px;
  height: 8px;
  background: var(--text);
  transform: translateY(-50%) rotate(45deg);
}
.sidebar-foot { border-top: 1px solid var(--line); padding: 12px; }
.sidebar-foot .btn.full {
  margin-top: 0;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  color: var(--text);
}
.sidebar-foot .btn.full:hover { background: var(--primary-soft); color: var(--primary-dark); }
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 51, 0.45);
  z-index: 15;
  border: 0;
  cursor: pointer;
}
.content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: 64px;
  min-height: 64px;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-copy { min-width: 0; flex: 1; }
.crumbs {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
}
.crumbs a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.crumbs a:hover { color: var(--primary-dark); }
.crumb-sep { color: var(--line); flex-shrink: 0; }
.crumbs .current {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.userchip {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  flex-shrink: 0;
}
.userchip:hover,
.userchip:active,
.userchip:focus,
.userchip:focus-visible { color: inherit; }
.userchip-text { text-align: right; min-width: 0; }
.userchip-text div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  object-fit: cover;
  flex-shrink: 0;
}
.page {
  padding: 24px 32px 32px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.page h1 { margin: 0 0 6px; font-size: clamp(22px, 3vw, 28px); }
.page-desc { color: var(--muted); margin: 0; max-width: 56ch; }
.page-head {
  display: flex;
  gap: 12px 16px;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-head > div:first-child { flex: 1 1 240px; min-width: 0; }
.page-head .btn { flex: 0 0 auto; margin-left: auto; }
.page-head .row { margin-left: auto; margin-bottom: 0; }
.page-head .row .btn { margin-left: 0; }
.page > * { flex-shrink: 0; }
.page > .card, .page > .form { margin-bottom: 16px; }
.page > .form:last-child { margin-bottom: 0; flex: 1; min-height: 0; }
.page-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 24px;
}
.page-foot-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.row .btn, .row a.btn { flex: 0 0 auto; }
.row > input, .row > select { min-width: min(100%, 220px); flex: 1 1 180px; max-width: 360px; }
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 12px;
}
.page > .filters {
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13.6px;
}
.card > .filters {
  border-bottom: 1px solid var(--line);
}
.card:has(> .filters) { overflow: hidden; }
.filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  min-width: min(100%, 200px);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8.5px;
  background: #f8fafc;
}
.filter-search:focus-within {
  background: #fff;
  border-color: var(--primary);
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.filter-search .nav-icon { color: var(--muted); flex-shrink: 0; }
.filter-search input {
  flex: 1;
  width: auto;
  min-width: 0;
  min-height: 40px;
  padding: 8px 0;
  border: 0;
  background: transparent;
}
.filter-search input:focus { outline: none; border: 0; }
.filters select {
  width: max-content;
  max-width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  min-height: 40px;
}
.filters [data-clear] { margin-left: auto; }
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 240px;
  min-width: 0;
}
.filter-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 36px;
  font-size: 13px;
  cursor: pointer;
}
.filter-pill input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  background: transparent;
}
.filter-pill:hover { border-color: var(--primary); color: var(--primary-dark); }
.filter-pill:has(input:checked) {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
}
.filter-pill:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.filter-pill.failed:has(input:checked) {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}
.filter-pill.delivered:has(input:checked) {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}
.filter-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.filter-pill:has(input:checked) .filter-count { color: inherit; }
.card > .people-list {
  gap: 0;
  padding: 0;
}
.card > .people-list .person {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--line);
}
.grid-3 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 24px;
}
#batch-live {
  align-items: stretch;
  grid-auto-rows: 1fr;
}
#batch-live .stat {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13.6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.pad { padding: 20px; }
.card.pad { padding: 20px; }
.card h2 { margin: 0 0 12px; font-size: 18px; }
.stat { position: relative; padding: 20px; text-decoration: none; color: inherit; display: block; transition: border-color 0.15s; }
.stat:has(.stat-icon) { padding-right: 56px; }
a.stat:hover { border-color: var(--primary); }
.stat span { color: var(--muted); font-size: 14px; }
.stat strong { display: block; font-size: clamp(24px, 4vw, 32px); margin-top: 8px; color: var(--text); }
.stat .stat-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--primary-dark);
}
.stat.failed { background: var(--danger-bg); border-color: var(--danger-border); }
.stat.failed span,
.stat.failed strong { color: var(--danger); }
.stat.delivered { background: var(--success-bg); border-color: var(--success-border); }
.stat.delivered span,
.stat.delivered strong { color: var(--success); }
.stat.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.stat.warn span,
.stat.warn strong { color: var(--warn); }
.stat.warn .stat-icon { color: var(--warn); }
a.stat.warn:hover { border-color: var(--warn-fill-hover); }
.card:has(> .table-wrap) { overflow: hidden; }
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; border-radius: inherit; }
.table-wrap.fit { overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
table.fit { min-width: 0; }
table.fit th, table.fit td { white-space: normal; }
table.fit td:last-child { width: 1%; white-space: nowrap; }
th, td { white-space: nowrap; }
th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  background: #f8fafc;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
tbody tr:first-child td { border-top: 0; }
td { padding: 12px 16px; border-top: 1px solid #f1f5f9; vertical-align: middle; }
td .btn, td a { margin-right: 6px; margin-bottom: 4px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #e2e8f0; }
.badge.active { background: var(--success-soft); color: var(--success); }
.badge.inactive { background: var(--danger-soft); color: var(--danger); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.completed, .badge.sent, .badge.opt_in { background: var(--ok-bg); color: var(--ok); }
.badge.draft { background: #e0e7ff; color: #3730a3; }
.badge.previewed, .badge.running, .badge.processing { background: var(--ok-bg); color: var(--primary-dark); }
.badge.cancelled, .badge.failure, .badge.failed, .badge.error, .badge.opt_out { background: var(--danger-soft); color: var(--danger); }
.badge.pending, .badge.skipped, .badge.none { background: #e2e8f0; color: #475569; }
.badge.meta_APPROVED { background: var(--ok-bg); color: var(--ok); }
.badge.meta_PENDING, .badge.meta_IN_APPEAL { background: var(--ok-bg); color: var(--primary-dark); }
.badge.meta_REJECTED, .badge.meta_DISABLED { background: var(--danger-soft); color: var(--danger); }
.badge.meta_PAUSED { background: var(--warn-soft); color: var(--warn); }
.badge.meta_none { background: #e2e8f0; color: #475569; }
.badge.admin { background: var(--warn-soft); color: var(--warn); }
.badge.scheduled { background: var(--warn-soft); color: var(--warn); }
.form { max-width: none; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.form .card > div:empty { display: none; }
.card.pad > h2:first-child { margin-bottom: 8px; }
.form > .btn { width: max-content; min-width: 140px; }
.form .row { margin-top: 8px; margin-bottom: 0; justify-content: flex-end; }
.form .page-foot { margin-top: auto; }
.form .picker .row { justify-content: stretch; }
.form-2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.empty { padding: 32px; color: var(--muted); }
.empty-state { padding: 32px 20px; text-align: center; color: var(--muted); }
.empty-state p { margin: 0 0 12px; }
.empty-state .btn { margin-top: 4px; }
input[type="checkbox"], input[type="radio"] {
  width: auto;
  min-height: 0;
  accent-color: var(--primary);
}
.check { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; }
.preview {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8.5px;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  margin: 8px 0 4px;
}

/* Cartão do corpo enviado no detalhe do lote: balão de mensagem, não campo de formulário. */
.message-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 12px;
}
.message-head h2 { margin: 0; }
.message-head .hint { margin: 0; }
.message-thread {
  background: #eef3f6;
  border-radius: 10.2px;
  padding: 16px 18px;
}
.message-bubble {
  max-width: min(100%, 440px);
  margin-left: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13.6px 13.6px 3.4px 13.6px;
  padding: 12px 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.msg-var {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 4px;
  padding: 0 4px;
}
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.preview.muted { color: var(--muted); }
.vars { background: #f8fafc; border: 1px solid var(--line); border-radius: 10.2px; padding: 14px; margin: 10px 0 4px; }
.vars-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
.vars-head span { color: var(--muted); font-size: 13px; }
.vars-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.vars-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 14px; }
.vars-list em { color: var(--muted); font-style: normal; font-size: 13px; }
.var-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  width: 132px;
  padding: 6px 12px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  cursor: pointer;
}
.var-chip:hover:not([disabled]) { background: var(--primary); color: #fff; }
.var-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.var-chip[disabled] { opacity: 0.6; cursor: default; }
.vars .alert { margin: 8px 0 0; }
.vars-label { display: block; color: var(--muted); margin-top: 12px; }
.stat.static { cursor: default; }
#batch-progress { margin-top: 24px; }
.picker { border: 1px solid var(--line); border-radius: 10.2px; margin: 8px 0 12px; overflow: hidden; }
.picker .row { margin: 0; padding: 12px; border-bottom: 1px solid var(--line); }
.picker table { min-width: 560px; }
.picker-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; font-size: 14px; }
.cell-error { color: var(--danger); white-space: normal; min-width: 200px; }
.progress { height: 8px; width: 140px; max-width: 100%; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); width: 0; }
.progress > span[data-n="0"] { width: 0%; }
.progress > span[data-n="5"] { width: 5%; }
.progress > span[data-n="10"] { width: 10%; }
.progress > span[data-n="15"] { width: 15%; }
.progress > span[data-n="20"] { width: 20%; }
.progress > span[data-n="25"] { width: 25%; }
.progress > span[data-n="30"] { width: 30%; }
.progress > span[data-n="35"] { width: 35%; }
.progress > span[data-n="40"] { width: 40%; }
.progress > span[data-n="45"] { width: 45%; }
.progress > span[data-n="50"] { width: 50%; }
.progress > span[data-n="55"] { width: 55%; }
.progress > span[data-n="60"] { width: 60%; }
.progress > span[data-n="65"] { width: 65%; }
.progress > span[data-n="70"] { width: 70%; }
.progress > span[data-n="75"] { width: 75%; }
.progress > span[data-n="80"] { width: 80%; }
.progress > span[data-n="85"] { width: 85%; }
.progress > span[data-n="90"] { width: 90%; }
.progress > span[data-n="95"] { width: 95%; }
.progress > span[data-n="100"] { width: 100%; }
.progress-label { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.queue-note { display: block; margin-top: 4px; max-width: 240px; font-size: 12px; color: var(--muted); white-space: normal; }
.skip-reasons { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.picked { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 36px;
  cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: var(--primary-dark); }
.legend { margin: 0 0 16px; }
.audience label { margin-bottom: 8px; font-weight: 600; }
#schedule-box[hidden] { display: none; }
#schedule-at {
  width: max-content;
  max-width: 100%;
}
.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 10.2px;
}
.seg {
  flex: 1 1 0;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 6.8px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}
.seg:hover:not([disabled]) { color: var(--text); }
.seg[aria-pressed="true"],
.seg[aria-current="page"] { background: #fff; color: var(--primary-dark); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15); }
.seg[disabled] { opacity: 0.5; cursor: not-allowed; }
.seg:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
a.seg { text-decoration: none; color: inherit; }
.page-head .segmented { flex: 0 0 auto; }
.picker .row > input { max-width: none; flex: 1 1 100%; }
.records, .people-list { display: grid; gap: 12px; }
.record, .person {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13.6px;
  padding: 16px 18px;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
a.record:hover { border-color: var(--primary); }
.record-main, .person-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.record-main strong, .person-head strong { font-size: 16px; }
.record time, .record-msg { color: var(--muted); font-size: 13px; }
.record-msg { margin: 8px 0 0; font-size: 14px; color: var(--text); }
.record-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.record-author { color: var(--muted); font-size: 13px; }
.record-stats { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.record-stats span { color: var(--muted); font-size: 13px; }
.record-stats strong { display: block; color: var(--text); font-size: 18px; }
.record .progress { width: 100%; margin-top: 12px; }
.record .queue-note { max-width: none; margin-top: 8px; }
.cal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13.6px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.cal-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.cal-nav h2 {
  margin: 0;
  flex: 1 1 160px;
  text-align: center;
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 700;
}
.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-weekdays {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
.cal-weekdays span {
  padding: 10px 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.cal-day {
  min-height: 124px;
  min-width: 0;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.outside { background: #f8fafc; color: var(--muted); }
.cal-day.today { background: var(--ok-bg); }
.cal-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.cal-dow {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: lowercase;
}
.cal-day time {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.cal-day.today time {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
}
.cal-events {
  display: grid;
  gap: 4px;
  min-width: 0;
  max-height: 148px;
  overflow: auto;
}
.cal-event {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 4px 6px;
  border-radius: 6px;
  background: #e2e8f0;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  line-height: 1.3;
}
.cal-event:hover { background: var(--primary-soft); color: var(--primary-dark); }
.cal-event-time { font-weight: 600; color: var(--muted); }
.cal-event-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event.scheduled { background: var(--warn-soft); color: var(--warn); }
.cal-event.scheduled .cal-event-time { color: var(--warn); }
.cal-event.processing,
.cal-event.pending { background: var(--ok-bg); color: var(--primary-dark); }
.cal-event.processing .cal-event-time,
.cal-event.pending .cal-event-time { color: var(--primary-dark); }
.cal-event.completed { background: var(--success-soft); color: var(--success); }
.cal-event.completed .cal-event-time { color: var(--success); }
.cal-event.cancelled { background: var(--danger-soft); color: var(--danger); }
.cal-event.cancelled .cal-event-time { color: var(--danger); }
#batch-calendar-wrap > .card { margin-top: 16px; }
.record-logs { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.log-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-size: 13px; }
.timeline { list-style: none; display: flex; gap: 8px; margin: 14px 0 0; padding: 0; }
.timeline li { flex: 1; min-width: 0; position: relative; padding-top: 16px; font-size: 12px; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; top: 4px; left: 0; right: 0; height: 2px; background: #e2e8f0; }
.timeline li::after { content: ""; position: absolute; top: 0; left: 0; width: 10px; height: 10px; border-radius: 50%; background: #e2e8f0; }
.timeline li.done { color: var(--ok); }
.timeline li.done::before, .timeline li.done::after { background: var(--ok); }
.timeline li.current { color: var(--primary-dark); font-weight: 600; }
.timeline li.current::after { background: var(--primary); }
.timeline li.bad { color: var(--danger); font-weight: 600; }
.timeline li.bad::after { background: var(--danger); }
.timeline time { display: block; margin-top: 2px; font-weight: 400; color: var(--muted); }
.hint.bad { color: var(--danger); }
.people { list-style: none; margin: 0; padding: 0; }
.people li { border-top: 1px solid var(--line); }
.people label { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.people label span { display: block; }
.people small { display: block; color: var(--muted); font-weight: 400; }
.menu { position: relative; display: inline-flex; }
.menu:has([aria-expanded="true"]) { z-index: 4; }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  min-width: 200px;
  padding: 6px;
  display: grid;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10.2px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.menu-pop[hidden] { display: none; }
.menu-pop.menu-floating { position: fixed; top: auto; right: auto; z-index: 40; }
.menu-pop button, .menu-pop a {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6.8px;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.menu-pop button:hover, .menu-pop a:hover { background: var(--primary-soft); color: var(--primary-dark); }
.menu-pop button.danger { color: var(--danger); }
.dialog-back {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
}
.dialog { width: min(480px, 100%); background: var(--card); border-radius: 13.6px; padding: 20px; box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2); }
.dialog h2 { margin: 0 0 12px; font-size: 20px; }
.dialog .row, .row.end { justify-content: flex-end; }
.row.end > .row-info { margin-right: auto; display: inline-flex; align-items: center; gap: 12px; }
.dialog .preview { margin-top: 8px; }
.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 16px;
  border: 1.5px dashed var(--line);
  border-radius: 10.2px;
  background: #f8fafc;
  text-align: center;
  cursor: pointer;
}
.drop.drag { border-color: var(--primary); background: var(--primary-soft); }
.drop-title { font-weight: 600; }
.drop-file { color: var(--muted); font-size: 13px; }
.drop input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; max-width: none; }
.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 8.5px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.menu-open { display: none; }
.menu-btn:hover { background: var(--primary-soft); color: var(--primary-dark); }
.menu-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 1.7px;
  background: currentColor;
  transition: transform 0.2s ease, top 0.2s ease, background 0.2s ease;
}
.menu-icon { position: relative; }
.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }
.menu-btn[aria-expanded="true"] .menu-icon { background: transparent; }
.menu-btn[aria-expanded="true"] .menu-icon::before { top: 0; transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-icon::after { top: 0; transform: rotate(-45deg); }
@media (min-width: 901px) {
  .layout.collapsed .sidebar { width: var(--rail); }
  .layout.collapsed .sidebar-brand { justify-content: center; padding: 0; }
  .layout.collapsed .sidebar-logo { display: none; }
  .layout.collapsed nav { padding: 12px 8px; }
  .layout.collapsed .nav-title { display: none; }
  .layout.collapsed .nav-link { justify-content: center; padding: 10px 0; gap: 0; }
  .layout.collapsed .nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .layout.collapsed .sidebar-foot { padding: 12px 8px; }
  .layout.collapsed .sidebar-foot .btn {
    display: flex;
    position: relative;
    width: var(--tap);
    min-width: var(--tap);
    height: var(--tap);
    margin: 0 auto;
    padding: 0;
    justify-content: center;
    gap: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .menu-icon,
  .menu-icon::before,
  .menu-icon::after { transition: none; }
  .toast,
  .toast.leaving { animation: none; }
}
#upload { display: grid; gap: 12px; justify-items: start; }

@media (max-width: 900px) {
  table.fit th:last-child,
  table.fit td:last-child {
    position: sticky;
    right: 0;
    z-index: 1;
    background: #fff;
    box-shadow: -8px 0 8px -8px rgba(15, 23, 42, 0.28);
  }
  table.fit th:last-child { background: #f8fafc; z-index: 2; }
  .overlay.open { display: block; }
  .sidebar {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    height: 100dvh;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-open { display: inline-flex; }
  .sidebar.open ~ .content .menu-open { display: none; }
  .grid-3, .form-2 { grid-template-columns: 1fr; }
  .page { padding: 16px; }
  .auth-card, .legal-card { padding: 24px 18px; }
  .userchip-text { display: none; }
  .topbar-copy small { display: none; }
  .row { align-items: stretch; }
  .row > input, .row > select, .row > .btn, .row > a.btn { width: auto; }
  .filters [data-clear] { margin-left: 0; }
}

@media (max-width: 720px) {
  .cal-weekdays { display: none; }
  .cal-grid { grid-template-columns: 1fr; }
  .cal-day.outside { display: none; }
  .cal-day {
    min-height: 0;
    flex-direction: row;
    align-items: flex-start;
    border-right: 0;
  }
  .cal-day-head {
    flex-direction: column;
    align-items: flex-start;
    min-width: 72px;
  }
  .cal-events { flex: 1 1 auto; max-height: none; }
}

@media (max-width: 560px) {
  .grid-3 { grid-template-columns: 1fr; }
  .timeline { flex-direction: column; gap: 12px; }
  .timeline li::before { left: 4px; right: auto; top: 0; bottom: 0; width: 2px; height: auto; }
  .timeline li { padding: 0 0 0 18px; }
  .row > input, .row > select, .row > .btn, .row > a.btn { max-width: none; flex: 1 1 100%; }
  .filter-search, .filters select, .filters [data-clear] { flex: 1 1 100%; }
  .page-head .btn { width: 100%; }
  .page-foot,
  .page-foot-actions { width: 100%; }
  .page-foot-actions { margin-left: 0; }
  .page-foot .btn { width: 100%; }
  table { min-width: 640px; }
}

.reason { display: block; margin-top: 4px; max-width: 280px; font-size: 12px; color: var(--danger); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.auth-links { text-align: center; margin-top: 16px; }

/* Páginas públicas legais (privacidade e termos): mesmo fundo das telas de autenticação, cartão mais largo. */
.legal-body {
  align-items: flex-start;
  padding-top: 40px;
  padding-bottom: 48px;
}
.legal-card {
  width: 100%;
  max-width: 720px;
  background: #fff;
  border-radius: 13.6px;
  padding: 32px 28px 40px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
.legal-card h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 4vw, 28px);
}
.legal-card .legal-updated {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
}
.legal-card h3 {
  margin: 28px 0 8px;
  font-size: 16px;
}
.legal-card p,
.legal-card li {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.65;
}
.legal-card ul {
  margin: 0 0 12px;
  padding-left: 20px;
}
.legal-card form { margin: 8px 0 24px; }
.legal-card form .btn.full { margin-top: 20px; }
