/* Next CRM - identidade NextWeb */
:root {
  --primary: #1400FF;
  --primary-600: #1000CC;
  --blue: #006DFF;
  --accent: #91B8FF;
  --dark: #0E0E12;
  --dark-2: #1E1E21;
  --bg: #F4F5FA;
  --surface: #FFFFFF;
  --border: #E4E6EF;
  --text: #16161D;
  --muted: #6B6F80;
  --ok: #0E9F6E;
  --warn: #D97706;
  --danger: #DC2626;
  --whats: #25D366;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 16, 40, .04), 0 4px 16px rgba(16, 16, 40, .05);
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 700; }
h4 { font-size: 13px; margin: 18px 0 8px; }
code { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.ic { flex-shrink: 0; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  display: flex; flex-direction: column; padding: 22px 14px;
  background: radial-gradient(120% 60% at 0% 0%, rgba(20, 0, 255, .35), transparent 60%), var(--dark);
  color: #C9CBDA;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 26px; }
.brand:hover { text-decoration: none; }
.brand img { height: 22px; width: auto; }
.brand-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(145, 184, 255, .35); border-radius: 999px; padding: 2px 8px;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a, .nav-logout {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #C9CBDA; font-weight: 600;
}
.nav a:hover, .nav-logout:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
/* Sair e "Voltar ao admin" são formulários POST; os botões mantêm a aparência de link. */
.logout-form { margin: 0; }
/* "Abrir painel do cliente" também é POST: o formulário não interfere no alinhamento do botão. */
.form-inline { display: inline-flex; margin: 0; }
button.btn { font: inherit; cursor: pointer; }
.historico { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
button.nav-logout { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.nav a.active { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(20, 0, 255, .35); }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 14px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 10px 10px; }
.me-info { min-width: 0; }
.me-info strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-info small { display: block; color: #8B8EA3; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 16px 32px; background: rgba(244, 245, 250, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 16px; font-weight: 700; }
.menu-btn { display: none; }
.content { padding: 28px 32px 48px; max-width: 1440px; }
.impersonate {
  display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
  padding: 8px 16px; background: var(--primary); color: #fff; font-size: 13px;
}
.impersonate a, .impersonate-back { color: #fff; font-weight: 700; display: inline-flex; gap: 4px; align-items: center; }
.impersonate-back { border: 0; background: none; padding: 0; font: inherit; cursor: pointer; }
.impersonate-back:hover { text-decoration: underline; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { margin: 0 0 4px; color: var(--blue); font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- Componentes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head.wrap { flex-wrap: wrap; }
.card-head p { margin: 6px 0 0; }
.card-highlight { border-color: rgba(20, 0, 255, .25); background: linear-gradient(135deg, #F3F2FF, #fff 60%); }
.card-highlight h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; color: var(--primary); }
.narrow { max-width: 640px; }
.narrow-lg { max-width: 860px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.stack-lg > .card { margin-bottom: 0; }
.grid-charts { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
.grid-charts > .card { margin-bottom: 20px; }
.chart-box { position: relative; height: 260px; }
.count { display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 999px; background: #EEF0F8; color: var(--muted); font-size: 12px; font-weight: 700; }
.link { font-weight: 600; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi {
  display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.kpi small { display: block; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.kpi strong { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.kpi em { display: block; font-style: normal; color: var(--muted); font-size: 12px; }
.kpi-sub { font-size: 14px; font-weight: 700; color: var(--ok); }
.kpi-ic {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: #ECEBFF; color: var(--primary);
}
.kpi-ic.ic-form { background: #E6F0FF; color: var(--blue); }
.kpi-ic.ic-whats { background: #E3F9EC; color: #11A84E; }
.kpi-ic.ic-win { background: #FFF4DE; color: #C27803; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; transition: .15s;
}
.btn:hover { text-decoration: none; border-color: #C9CCDC; background: #FAFAFD; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn.disabled { pointer-events: none; opacity: .45; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: #EEF0F8; color: var(--text); text-decoration: none; }
.icon-btn.danger:hover { background: #FDECEC; color: var(--danger); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  background: #EEF0F8; color: var(--muted); font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge-ok { background: #E3F7EE; color: var(--ok); }
.badge-warn { background: #FEF3E2; color: var(--warn); }
.badge-off { background: #FDECEC; color: var(--danger); }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; border: 1px solid transparent; }
.alert-sucesso { background: #E8F8F0; border-color: #BFEBD6; color: #05603A; }
.alert-erro { background: #FDECEC; border-color: #F7C6C6; color: #991B1B; }
.alert-aviso { background: #FFF6E5; border-color: #FBDFAE; color: #92400E; }

.avatar {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--blue)); color: #fff; font-weight: 700; font-size: 13px;
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }

/* ---------- Formulários ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
input, select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; min-height: 40px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 109, 255, .15); }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--primary); }
input[type="color"] { padding: 3px; width: 44px; height: 40px; cursor: pointer; }
.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.err { color: var(--danger); font-weight: 500; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.inline-form { display: flex; gap: 8px; margin: 12px 0; }
.inline-form input { flex: 1; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.field-copy {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; margin-bottom: 14px;
  padding: 10px 12px; border: 1px dashed #CDD1E3; border-radius: 10px; background: #FAFBFE;
}
.field-copy small { grid-column: span 2; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.field-copy code { word-break: break-all; }
.cred-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }

.search {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 0 12px; min-width: 320px; color: var(--muted);
}
.search input { border: 0; box-shadow: none !important; padding-left: 0; }
.search.sm { min-width: 200px; }
.search.sm input { min-height: 34px; padding: 4px 0; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters select { width: auto; min-height: 36px; padding: 5px 10px; }

.period { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  padding: 7px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--border);
  color: var(--text); font-weight: 600; font-size: 12.5px;
}
.chip:hover { text-decoration: none; border-color: var(--blue); }
.chip.active { background: var(--dark-2); color: #fff; border-color: var(--dark-2); }
.period-custom { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font-size: 12px; color: var(--muted); }
.period-custom.active { border-color: var(--dark-2); }
.period-custom input { border: 0; min-height: 30px; padding: 2px; width: 128px; font-size: 12.5px; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #FAFBFD; white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid #EFF0F5; vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table tbody tr:hover { background: #FAFBFF; }
.table tr.is-off { opacity: .55; }
.table .num { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.cell-user, .cell-lead { display: flex; align-items: center; gap: 10px; }
.cell-user strong, .cell-lead strong { display: block; }
.cell-user small, .cell-lead small { display: block; }
.cell-stack { display: flex; flex-direction: column; }
.truncate { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.tipo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; }
.tipo-formulario { background: #E6F0FF; color: var(--blue); }
.tipo-whatsapp { background: #E3F9EC; color: #11A84E; }
.wa-link { color: #11A84E; display: inline-flex; vertical-align: -2px; }
.origem { font-weight: 600; }

.etapa-select {
  --etapa: #9CA3AF;
  width: auto; min-width: 160px; min-height: 34px; padding: 5px 30px 5px 12px; border-radius: 999px; font-weight: 700; font-size: 12.5px;
  color: var(--etapa); border-color: color-mix(in srgb, var(--etapa) 40%, transparent);
  background-color: color-mix(in srgb, var(--etapa) 10%, #fff); cursor: pointer;
}
.valor-input { width: 110px; min-height: 34px; padding: 5px 10px; font-size: 13px; text-align: right; }
.saved { animation: saved 1.2s ease; }
@keyframes saved { 0% { box-shadow: 0 0 0 3px rgba(14, 159, 110, .35); } 100% { box-shadow: 0 0 0 0 rgba(14, 159, 110, 0); } }

.pager { display: flex; justify-content: center; align-items: center; gap: 14px; padding-top: 16px; color: var(--muted); font-size: 13px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty p { margin: 0 0 14px; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bars-label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 5px; }
.bars-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars-track { height: 8px; border-radius: 999px; background: #EEF0F8; overflow: hidden; }
.bars-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--blue)); }

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.mini-stats div { background: #F6F7FB; border-radius: 10px; padding: 12px; text-align: center; }
.mini-stats strong { display: block; font-size: 22px; font-weight: 800; }
.mini-stats small { color: var(--muted); font-weight: 600; }

.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 18px; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; font-weight: 600; word-break: break-word; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 8px; align-items: flex-start; }
.checklist .ic { color: var(--ok); margin-top: 3px; }
.profile-head { display: flex; gap: 14px; align-items: center; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.profile-head p { margin: 2px 0 0; }

.danger-zone summary { cursor: pointer; font-weight: 700; color: var(--danger); }
.danger-zone[open] summary { margin-bottom: 8px; }

/* Etapas do funil */
.etapas { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.etapa-row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) 220px auto auto; gap: 10px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: #FCFCFE;
}
.etapa-row.is-removed { opacity: .4; text-decoration: line-through; }
.etapa-row.is-new { border-style: dashed; }
.etapa-move { display: flex; flex-direction: column; }
.etapa-move .icon-btn { width: 24px; height: 18px; }
.etapa-row label.icon-btn { display: inline-grid; }

/* Modal */
.modal { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(10, 10, 30, .25); color: var(--text); }
.modal::backdrop { background: rgba(10, 10, 25, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); margin: 0; }
.modal-body { padding: 18px 22px; max-height: 55vh; overflow: auto; }
.modal-foot { padding: 16px 22px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.modal-foot label { width: 100%; }
.modal .dl { margin-bottom: 0; }
.modal h4:first-child { margin-top: 0; }
.msg-box { white-space: pre-wrap; background: #F6F7FB; border-radius: 10px; padding: 10px 12px; margin: 0; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--dark-2); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 600; z-index: 100;
  transition: .2s; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.erro { background: var(--danger); }

/* ---------- Login ---------- */
body.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background: #140A3A;
}
.auth-wrap { width: 100%; max-width: 980px; }
.auth-card {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 12px;
  background: #fff; border-radius: 24px; padding: 14px; min-height: 560px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .45);
}
.auth-art {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  border-radius: 16px; padding: 30px 28px; overflow: hidden;
  background-color: #0B0A14; background-size: cover; background-position: 20% center;
}
.auth-art::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8, 6, 20, .55) 0%, rgba(8, 6, 20, 0) 45%);
}
.auth-art > * { position: relative; }
.auth-art-title { margin: 0; max-width: 280px; color: #fff; font-size: 28px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }
.auth-art-logo { height: 18px; width: auto; align-self: flex-start; opacity: .9; }

.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 40px 56px 24px; color: var(--text); }
.auth-mark { display: block; width: 34px; height: 34px; margin-bottom: 18px; }
.auth-form h2 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-form > .muted {
  margin: 0 0 24px; padding-bottom: 22px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.auth-form label { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.auth-form input { min-height: 44px; border-color: #DADDE8; }
.auth-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(20, 0, 255, .12); }
.auth-form .btn-primary { height: 46px; margin-top: 4px; }
.auth-form .stack { gap: 16px; }
.auth-form .alert { font-size: 13px; }
.auth-foot { margin: auto 0 0; padding-top: 28px; text-align: center; color: var(--muted); font-size: 12px; }

@media (max-width: 820px) {
  .auth-card { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth-art { min-height: 180px; padding: 22px; }
  .auth-art-title { font-size: 22px; }
  .auth-form { padding: 28px 14px 12px; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1200px) {
  .grid-charts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid-charts > .card:first-child { grid-column: span 2; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; }
  .content { padding: 20px 16px 40px; }
  .grid-2, .grid-charts { grid-template-columns: minmax(0, 1fr); }
  .grid-charts > .card:first-child { grid-column: auto; }
  .search { min-width: 0; width: 100%; }
}
@media (max-width: 700px) {
  /* Tabelas viram cartões empilhados */
  .table-wrap { margin: 0; overflow: visible; }
  .table.cards, .table.cards tbody { display: block; }
  .table.cards thead { display: none; }
  .table.cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid #EFF0F5; }
  .table.cards tr:last-child { border-bottom: 0; }
  .table.cards tbody tr:hover { background: transparent; }
  .table.cards td { display: block; padding: 0 !important; border: 0; min-width: 0; }
  .table.cards td.td-main { grid-row: 1; grid-column: 1; }
  .table.cards td.actions { grid-row: 1; grid-column: 2; }
  .table.cards td[data-label] {
    grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    text-align: right; font-size: 13px;
  }
  .table.cards td[data-label]::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-size: 12px; text-align: left; flex-shrink: 0; }
  .table.cards td[data-label] > * { min-width: 0; overflow-wrap: anywhere; }
  .table.cards .cell-stack { align-items: flex-end; }
  .table.cards .truncate { max-width: 200px; }
  .table.cards td.td-etapa .etapa-select { width: 100%; min-width: 0; }
  .table.cards td.td-valor .valor-input { width: 120px; }

  .period { width: 100%; }
  .period-custom { width: 100%; border-radius: 12px; }
  .period-custom input { flex: 1; min-width: 0; width: auto; }
  .card-head.wrap { flex-direction: column; align-items: stretch; }
  .filters .search.sm { flex: 1 1 100%; }
  .filters select { flex: 1; }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .kpi-ic { width: 36px; height: 36px; border-radius: 10px; }
  .kpi strong { font-size: 22px; }
  .page-head h2 { font-size: 20px; }
  .form-grid, .cred-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .card { padding: 16px; }
  .etapa-row { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .etapa-row .etapa-move { grid-row: 1 / span 2; }
  .etapa-row .danger { grid-row: 1; grid-column: 4; }
  .etapa-row select { grid-row: 2; grid-column: 2 / -1; }
  .etapa-row > span { display: none; }
  .inline-form { flex-direction: column; }
}
