/* ============================================
   Zyntra - Dashboard Style
   Identidade: azul profundo, ouro e marfim
   ============================================ */

/* CSS Variables */
:root {
  --bg-primary: #fffdfa;
  --bg-secondary: #f8f2e9;
  --bg-card: rgba(255, 253, 249, 0.96);
  --bg-card-hover: #fff8ec;
  --bg-input: #fcf7ef;
  --border-color: #e4cfab;
  --border-accent: #c68a24;
  --text-primary: #071944;
  --text-secondary: #344264;
  --text-muted: #777365;
  --accent: #bd7c10;
  --accent-hover: #945a05;
  --accent-dim: rgba(189, 124, 16, 0.13);
  --success: #3e745d;
  --warning: #a96d0b;
  --danger: #a63f35;
  --danger-hover: #843028;
  --info: #153b78;
  --sidebar-width: 244px;
  --header-height: 60px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 8px 24px rgba(7, 25, 68, 0.07), 0 1px 0 rgba(198, 138, 36, 0.12);
  --shadow-lg: 0 18px 48px rgba(7, 25, 68, 0.13), 0 1px 0 rgba(198, 138, 36, 0.18);
  --shadow-sm: var(--shadow);
  --card-bg: var(--bg-card);
  --primary: var(--accent);
  --primary-color: var(--accent);
  --text: var(--text-primary);
  --transition: all 0.2s ease;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 8% 4%, rgba(216, 164, 73, 0.16), transparent 27rem),
    radial-gradient(circle at 94% 96%, rgba(7, 25, 68, 0.07), transparent 32rem),
    var(--bg-secondary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

/* Login: estilos-base mobile first. */
.login-page {
  display: block;
  background:
    radial-gradient(circle at 15% 12%, rgba(221, 175, 92, 0.28), transparent 24rem),
    radial-gradient(circle at 88% 90%, rgba(7, 25, 68, 0.13), transparent 30rem),
    linear-gradient(145deg, #fffdf8 0%, #f5ebdc 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: block;
  width: min(230px, 76%);
}

.login-brand img {
  display: block;
  width: 100%;
  height: auto;
}

.login-kicker {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-card h1 {
  margin-top: 6px;
  font-size: 28px;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.login-description {
  margin: 8px 0 24px;
  color: var(--text-secondary);
  font-size: 14px;
}

.password-field {
  position: relative;
}

.password-field .form-control {
  padding-right: 84px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  padding: 7px 9px;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.password-toggle:focus-visible,
.logout-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.login-error {
  min-height: 20px;
  margin-top: 8px;
  color: var(--danger);
  font-size: 13px;
}

.login-submit {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.login-card .form-label + .form-control,
.login-card .form-label + .password-field {
  margin-bottom: 14px;
}

.login-back-link {
  display: block;
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
}

.logout-button {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 7px 10px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.logout-button:hover {
  color: var(--danger);
}

.sidebar-user {
  display: block;
  margin: 8px 0;
  color: #fffdfa;
  font-weight: 700;
}

.sidebar-user:hover { color: #e8c37f; }

.developer-contact-button {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 10px;
  color: #071944;
  background: #e8c37f;
  border: 1px solid #bd7c10;
  border-radius: 7px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.developer-contact-button:hover { background: #fffdfa; }

.developer-memory-meter {
  --ram-color: #55b890;
  --ram-percent: 0%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 12px 0 10px;
  padding: 9px;
  color: #fffdfa;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(232, 195, 127, 0.3);
  border-radius: 10px;
  text-align: left;
}

.developer-memory-gauge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: conic-gradient(var(--ram-color) var(--ram-percent), rgba(255, 255, 255, 0.14) 0);
  border-radius: 50%;
  position: relative;
}

.developer-memory-gauge::after {
  content: '';
  position: absolute;
  width: 32px;
  height: 32px;
  background: var(--text-primary);
  border-radius: 50%;
}

.developer-memory-gauge strong {
  position: relative;
  z-index: 1;
  color: #fffdfa;
  font-size: 10px;
  line-height: 1;
}

.developer-memory-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.developer-memory-copy strong {
  color: #fffdfa;
  font-size: 11px;
}

.developer-memory-copy small {
  overflow: hidden;
  color: #e8c37f;
  font-size: 9px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.developer-memory-meter.is-warning { --ram-color: #e7b85d; }
.developer-memory-meter.is-critical { --ram-color: #e46962; }
.developer-memory-meter.is-unavailable { --ram-color: #8994ad; }

.access-user-grid {
  display: grid;
  gap: 12px;
}

.access-user-card {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
}

.access-user-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 18px;
  color: #fffdfa;
  background: linear-gradient(135deg, #071944, #143a78);
  border: 1px solid #bd7c10;
  border-radius: 12px;
}

.account-summary h2 { margin: 2px 0; color: inherit; }
.account-summary p { margin: 0; color: #dce6fb; }

.account-avatar {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #071944;
  background: #e8c37f;
  border-radius: 50%;
}

.eyebrow {
  color: #e8c37f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.account-layout { display: grid; gap: 20px; }

.form-feedback {
  min-height: 20px;
  margin-top: 10px;
  font-size: 13px;
}

.form-feedback.is-error { color: var(--danger); }
.form-feedback.is-success { color: var(--success); }

button:disabled { cursor: wait; opacity: .65; }

@media (min-width: 769px) {
  .access-user-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .account-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 640px) {
  .login-card {
    padding: 38px;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cdb78f;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: rgba(255, 253, 249, 0.97);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(-100%);
  transition: var(--transition);
  box-shadow: 14px 0 40px rgba(7, 25, 68, 0.08);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, #fffdfa 0%, #fbf4e8 100%);
}

.brand-logo {
  display: block;
  width: 100%;
  color: inherit;
}

.brand-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border-radius: 8px;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--accent-dim);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--text-primary);
  color: #f2c56d;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item .icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-group {
  margin-bottom: 2px;
}

.nav-group > summary {
  list-style: none;
}

.nav-group > summary::-webkit-details-marker {
  display: none;
}

.nav-group-toggle {
  padding-inline: 8px;
  gap: 8px;
  font-size: 12px;
}

.nav-group-chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  flex: 0 0 auto;
  transition: transform var(--transition);
}

.nav-group[open] .nav-group-chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  margin: 2px 0 6px 18px;
  padding-left: 8px;
  border-left: 1px solid var(--border-color);
}

.nav-submenu .nav-item {
  padding-block: 8px;
  font-size: 13px;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  background: var(--text-primary);
  color: #e8c37f;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  margin-left: 0;
  flex: 1;
  min-height: 100vh;
  padding: 76px 14px 24px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 28px;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-header .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: #d5ad68;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
  font-size: 18px;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 500;
  color: var(--text-primary);
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.card-body {
  padding: 4px 0;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: auto 20px 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
  font-size: 24px;
  margin-bottom: 12px;
  opacity: 0.9;
}

.stat-card .stat-value {
  font-size: 32px;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 500;
  margin-bottom: 4px;
  letter-spacing: -1px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.info .stat-value { color: var(--info); }

/* ============================================
   TABLES
   ============================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  background: #f5ead9;
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-secondary);
}

.log-row {
  cursor: pointer;
}

.log-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.log-details-hint {
  margin-left: 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.log-raw-details {
  margin-top: 16px;
}

.log-raw-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

.log-raw-details pre {
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
}

/* Message cell with "Ver" button */
.msg-cell {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

.msg-truncate {
  vertical-align: middle;
}

.msg-view-btn {
  margin-left: 4px;
  font-size: 10px;
  padding: 1px 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-link { background: var(--accent-dim); color: var(--accent-hover); }
.badge-badword { background: rgba(255, 59, 48, 0.1); color: var(--danger); }
.badge-flood { background: rgba(255, 149, 0, 0.1); color: var(--warning); }
.badge-repetition { background: rgba(255, 149, 0, 0.1); color: var(--warning); }
.badge-caps { background: rgba(255, 149, 0, 0.1); color: var(--warning); }
.badge-removed { background: rgba(255, 59, 48, 0.1); color: var(--danger); }
.badge-active { background: rgba(52, 199, 89, 0.1); color: var(--success); }
.badge-inactive { background: var(--bg-secondary); color: var(--text-muted); }
.badge-info { background: rgba(21, 59, 120, 0.1); color: var(--info); }
.badge-success { background: rgba(52, 199, 89, 0.1); color: var(--success); }
.badge-warning { background: rgba(255, 149, 0, 0.1); color: var(--warning); }
.badge-danger { background: rgba(255, 59, 48, 0.1); color: var(--danger); }

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary);
  margin: 4px;
}

.tag .word-text {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  transition: var(--transition);
}

.tag-remove:hover {
  color: var(--danger);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
}

.btn:hover {
  background: #f1e3cf;
  border-color: #d5ad68;
}

.btn-primary {
  background: linear-gradient(135deg, #e2b45d 0%, #bd7c10 100%);
  border-color: #ae700c;
  color: var(--text-primary);
  box-shadow: 0 7px 18px rgba(189, 124, 16, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #eac373 0%, #c98a1c 100%);
  border-color: var(--accent-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #2db84d;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  padding: 8px 10px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  background: #fffefa;
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e6e73' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px;
  max-height: 200px;
  overflow-y: auto;
  transition: var(--transition);
}

.checkbox-group:focus-within {
  border-color: var(--accent);
  background: var(--bg-primary);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.checkbox-item:hover {
  background: var(--bg-card-hover);
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-item label {
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  margin: 0;
  font-weight: 400;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 28px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  position: sticky;
  bottom: -28px;
  padding-bottom: 28px;
  background: var(--bg-card);
  z-index: 1;
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  min-width: 300px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
}

.toast-success {
  border-left: 4px solid var(--success);
  color: var(--success);
}

.toast-error {
  border-left: 4px solid var(--danger);
  color: var(--danger);
}

.toast-info {
  border-left: 4px solid var(--accent);
  color: var(--accent);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ============================================
   FILTERS BAR
   ============================================ */
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: end;
  flex-direction: column;
}

.filters-bar .form-group {
  margin-bottom: 0;
  min-width: 100%;
}

.filters-bar .form-group label {
  font-size: 11px;
  margin-bottom: 4px;
}

.filters-bar .form-control {
  padding: 10px 12px;
  font-size: 13px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 13px;
}

/* ============================================
   LOADING
   ============================================ */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

.loading-spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Layout-base mobile first. */
.mobile-menu-btn {
  display: block;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 101;
  padding: 10px 14px;
  color: #e7b85d;
  background: var(--text-primary);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 20px;
}

@media (min-width: 769px) {
  .sidebar {
    transform: translateX(0);
  }

  .main-content {
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
  }

  .page-header {
    align-items: center;
    flex-direction: row;
    gap: 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .filters-bar {
    flex-direction: row;
  }

  .filters-bar .form-group {
    min-width: 150px;
  }

  .mobile-menu-btn {
    display: none;
  }
}

/* ============================================
   TOGGLE SWITCH
   ============================================ */
.toggle {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border-color);
  border-radius: 16px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 27px;
  height: 27px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .toggle-slider {
  background: var(--success);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ============================================
   CONFIG LIST (Tags)
   ============================================ */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-primary);
}

.tag .tag-remove {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: var(--transition);
}

.tag .tag-remove:hover {
  color: var(--danger);
}

/* ============================================
   SCHEDULE CARD
   ============================================ */
.schedule-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  transition: var(--transition);
}

.schedule-card:hover {
  background: #e8e8ed;
}

.schedule-card .schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.schedule-card .schedule-name {
  font-weight: 600;
  font-size: 14px;
}

.schedule-card .schedule-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.schedule-card .schedule-content {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 8px 0;
  padding: 10px;
  background: var(--bg-primary);
  border-radius: 8px;
  max-height: 60px;
  overflow: hidden;
}

.schedule-card .schedule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.schedule-delivery-alert {
  margin-top: 10px;
  padding: 10px;
  color: #764c00;
  background: #fff8e8;
  border: 1px solid #f6dda8;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.schedule-delivery-alert strong {
  display: block;
  margin-bottom: 3px;
}

.schedule-delivery-targets {
  display: grid;
  gap: 3px;
  margin-top: 7px;
}

.schedule-delivery-targets span {
  display: block;
  overflow-wrap: anywhere;
}

.schedule-delivery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-fill.danger { background: var(--danger); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.success { background: var(--success); }

/* ============================================
   GROUPS PAGE
   ============================================ */
.groups-section {
  margin-bottom: 8px;
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.group-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.group-card:hover {
  background: #e8e8ed;
}

.group-card.admin {
  background: rgba(52, 199, 89, 0.08);
}

.group-card.admin:hover {
  background: rgba(52, 199, 89, 0.15);
}

.group-card .group-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-card .group-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.group-card .group-size {
  margin-left: auto;
}

.group-card.monitored {
  background: rgba(52, 199, 89, 0.08);
  border: 1px solid rgba(52, 199, 89, 0.2);
}

.group-card.monitored:hover {
  background: rgba(52, 199, 89, 0.15);
}

.group-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.group-card-header .group-name {
  margin-bottom: 0;
  flex: 1;
}

.group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color, rgba(0,0,0,0.06));
}

/* Available groups list */

/* ============================================
   SETTINGS PAGE
   ============================================ */
.settings-table {
  width: 100%;
  border-collapse: collapse;
}

.settings-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
}

.settings-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.settings-table tr:last-child td {
  border-bottom: none;
}

.settings-label-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  padding: 12px;
  white-space: nowrap;
}

.settings-label-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.settings-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.settings-flood-config {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  display: none;
}

.settings-flood-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

.settings-bulk-section {
  margin-bottom: 16px;
}

.settings-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.settings-input-row .form-control {
  flex: 1;
}

.settings-input-row textarea.form-control {
  min-height: 48px;
  resize: vertical;
}

.settings-guardian-card .card-body {
  padding: 20px;
}

@media (max-width: 768px) {
  .settings-table td {
    padding: 10px 8px;
  }
  .settings-label-cell {
    padding: 10px 8px;
    font-size: 13px;
  }
  .settings-desc {
    display: none;
  }
  .settings-input-row {
    flex-direction: column;
  }
  .settings-input-row .btn {
    width: 100%;
  }
}
.available-groups-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.available-group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: var(--transition);
}

.available-group-item:hover {
  background: #e8e8ed;
}

.available-group-info {
  flex: 1;
  min-width: 0;
}

.available-group-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.available-group-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Button variants */
.btn-primary {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger-outline:hover {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color, rgba(0,0,0,0.12));
}

.btn-outline:hover {
  background: var(--bg-secondary);
  color: var(--text);
  border-color: var(--text-muted);
}

/* ============================================
   ADMINS LIST
   ============================================ */
.admins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.admin-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 12px;
}

.admin-card .admin-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: white;
}

.admin-card .admin-info {
  flex: 1;
  min-width: 0;
}

.admin-card .admin-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-card .admin-id {
  font-size: 11px;
  color: var(--text-muted);
}

.error-state {
  text-align: center;
  padding: 20px;
  color: var(--danger);
  font-size: 14px;
}

/* ============================================
   CONNECTION MODAL
   ============================================ */
.connection-status {
  text-align: center;
  padding: 20px;
}

.connection-status .status-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.connection-status .status-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.modal-body {
  min-height: 200px;
}

#qrCode img, #qrCode canvas {
  display: block;
  margin: 0 auto;
}

/* ============================================
   INPUT GROUP
   ============================================ */
.input-group {
  display: flex;
  gap: 8px;
}

.input-group .form-control {
  flex: 1;
}

.input-group .btn {
  flex-shrink: 0;
}

/* ============================================
   LUCIDE ICONS
   ============================================ */
.nav-item .icon,
.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-item .icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

.stat-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
  stroke-width: 1.5;
  color: var(--text-secondary);
}

.stat-card.info .stat-icon { color: var(--info); }
.stat-card.success .stat-icon { color: var(--success); }
.stat-card.warning .stat-icon { color: var(--warning); }
.stat-card.danger .stat-icon { color: var(--danger); }

.mobile-menu-btn i {
  width: 20px;
  height: 20px;
}

.modal-close i {
  width: 20px;
  height: 20px;
}

.btn i {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.btn-sm i {
  width: 14px;
  height: 14px;
}

/* ============================================
   ECOSSISTEMA ZYNTRA / CRM
   ============================================ */
.crm-page {
  --crm-purple: #153b78;
  --crm-purple-soft: rgba(21, 59, 120, 0.1);
  --crm-teal: #a96d0b;
  --crm-teal-soft: rgba(189, 124, 16, 0.12);
  --crm-blue-soft: rgba(7, 25, 68, 0.08);
  --crm-shadow-soft: 0 10px 30px rgba(7, 25, 68, 0.08);
}

.crm-page .brand-logo {
  max-width: 204px;
}

.crm-skip-link {
  position: fixed;
  top: 8px;
  left: 50%;
  z-index: 4000;
  padding: 10px 16px;
  color: #fff;
  background: var(--text-primary);
  border-radius: 10px;
  transform: translate(-50%, -150%);
}

.crm-skip-link:focus {
  transform: translate(-50%, 0);
}

.crm-main {
  max-width: 1800px;
  min-width: 0;
}

.crm-page-header {
  gap: 24px;
}

.crm-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  color: var(--crm-teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crm-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.12);
}

.crm-live-dot.is-checking {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(255, 149, 0, 0.12);
}

.crm-live-dot.is-disconnected {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.12);
}

.crm-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.crm-sync-status {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.crm-sync-status.has-error {
  color: var(--danger);
}

.crm-local-notice {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -10px 0 20px;
  padding: 9px 12px;
  color: #614b0b;
  background: #fffaf0;
  border: 1px solid #f4dfad;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.45;
}

.crm-local-notice svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--warning);
}

.crm-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 24px;
  padding: 5px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  scrollbar-width: none;
}

.crm-tabs::-webkit-scrollbar {
  display: none;
}

.crm-quick-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: -10px 0 24px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.crm-quick-guide > strong {
  grid-column: 1 / -1;
  color: var(--text-secondary);
  font-size: 12px;
}

.crm-quick-guide button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--text-primary);
  text-align: left;
  background: var(--bg-soft);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.crm-quick-guide button:hover,
.crm-quick-guide button:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.crm-quick-guide svg { width: 16px; height: 16px; flex: 0 0 auto; }

.crm-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: max-content;
  padding: 9px 13px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.crm-tab svg {
  width: 16px;
  height: 16px;
}

.crm-tab:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.crm-tab.active {
  color: #fff;
  background: var(--text-primary);
  box-shadow: 0 4px 12px rgba(29, 29, 31, 0.16);
}

.crm-tab:focus-visible,
.crm-page button:focus-visible,
.crm-page a:focus-visible {
  outline: 3px solid rgba(189, 124, 16, 0.3);
  outline-offset: 2px;
}

.crm-section {
  animation: crmFadeIn 0.24s ease;
}

.crm-section[hidden] {
  display: none !important;
}

@keyframes crmFadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.crm-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
}

.crm-alert[hidden] {
  display: none;
}

.crm-alert svg {
  width: 20px;
  flex: 0 0 auto;
}

.crm-alert div {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.crm-alert-danger {
  color: #b42318;
  background: #fff3f2;
  border: 1px solid #fecdca;
}

.crm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.crm-kpi-grid.compact {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.crm-kpi {
  position: relative;
  min-width: 0;
  padding: 18px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.crm-kpi::after {
  position: absolute;
  right: -22px;
  bottom: -28px;
  width: 82px;
  height: 82px;
  background: var(--kpi-color, var(--accent));
  border-radius: 50%;
  opacity: 0.05;
  content: '';
}

.crm-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.crm-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--kpi-color, var(--accent));
  background: color-mix(in srgb, var(--kpi-color, var(--accent)) 10%, transparent);
  border-radius: 10px;
}

.crm-kpi-icon svg {
  width: 17px;
  height: 17px;
}

.crm-kpi-trend {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.crm-kpi-trend.positive { color: var(--success); }
.crm-kpi-trend.negative { color: var(--danger); }

.crm-kpi-value {
  overflow: hidden;
  color: var(--text-primary);
  font-size: clamp(23px, 2vw, 30px);
  font-weight: 720;
  letter-spacing: -0.04em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-kpi-label {
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.crm-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 0.42fr);
  gap: 18px;
}

.crm-overview-grid .card {
  min-width: 0;
  box-shadow: var(--crm-shadow-soft);
}

.crm-overview-grid .card:hover,
.crm-page .card:hover {
  transform: none;
}

.crm-span-2 {
  grid-column: 1;
}

.crm-overview-grid > .card:nth-child(3) {
  grid-column: 2;
  grid-row: 1;
}

.crm-overview-grid > .card:nth-child(4) {
  grid-column: 2;
  grid-row: 2;
}

.crm-overview-grid > .card:nth-child(5) {
  grid-row: 2 / span 2;
}

.crm-card-heading {
  align-items: flex-start;
}

.crm-card-heading p,
.crm-section-heading p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.crm-card-heading > svg {
  width: 19px;
  height: 19px;
  color: var(--text-muted);
}

.crm-funnel {
  display: grid;
  gap: 10px;
}

.crm-funnel-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.42fr) minmax(160px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  color: inherit;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.crm-funnel-label strong {
  display: block;
  font-size: 12px;
}

.crm-funnel-label span {
  color: var(--text-muted);
  font-size: 10px;
}

.crm-funnel-track {
  height: 30px;
  overflow: hidden;
  background: var(--bg-secondary);
  border-radius: 9px;
}

.crm-funnel-fill {
  display: flex;
  align-items: center;
  min-width: 38px;
  height: 100%;
  padding: 0 10px;
  color: #fff;
  background: var(--funnel-color, var(--accent));
  border-radius: inherit;
  font-size: 11px;
  font-weight: 700;
  transition: width 0.5s ease;
}

.crm-funnel-value {
  min-width: 90px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

.crm-retention-score {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 7px 0 20px;
}

.crm-ring {
  --score: 0;
  display: grid;
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
  place-items: center;
  background: conic-gradient(var(--crm-teal) calc(var(--score) * 1%), var(--bg-secondary) 0);
  border-radius: 50%;
}

.crm-ring::before {
  grid-area: 1 / 1;
  width: 70px;
  height: 70px;
  background: var(--bg-card);
  border-radius: 50%;
  content: '';
}

.crm-ring strong {
  z-index: 1;
  font-size: 20px;
}

.crm-retention-copy strong {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
}

.crm-retention-copy p {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.crm-metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
}

.crm-metric-row span { color: var(--text-secondary); }

.crm-attention-list {
  display: grid;
  gap: 9px;
}

.crm-attention-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  color: inherit;
  background: var(--bg-secondary);
  border: 0;
  border-radius: 10px;
  text-align: left;
}

button.crm-attention-item { cursor: pointer; }

.crm-attention-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--attention-color, var(--warning));
  background: var(--bg-card);
  border-radius: 9px;
}

.crm-attention-icon svg { width: 16px; height: 16px; }
.crm-attention-item div { min-width: 0; flex: 1; }
.crm-attention-item strong { display: block; font-size: 12px; }
.crm-attention-item span { display: block; margin-top: 2px; overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.crm-attention-item > b { color: var(--attention-color, var(--warning)); font-size: 18px; }

.crm-timeline {
  position: relative;
  display: grid;
  gap: 0;
}

.crm-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 11px;
  padding-bottom: 16px;
}

button.crm-timeline-item {
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  width: 100%;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}

button.crm-timeline-item:hover .crm-timeline-copy strong,
button.crm-timeline-item:focus-visible .crm-timeline-copy strong { color: var(--accent); }

.crm-timeline-arrow { align-self: center; width: 15px; height: 15px; color: var(--text-muted); }

.crm-timeline-item:not(:last-child)::after {
  position: absolute;
  top: 28px;
  bottom: 0;
  left: 13px;
  width: 1px;
  background: var(--border-color);
  content: '';
}

.crm-timeline-icon {
  z-index: 1;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--timeline-color, var(--accent));
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
}

.crm-timeline-icon svg { width: 13px; height: 13px; }
.crm-timeline-copy strong { display: block; font-size: 12px; line-height: 1.4; }
.crm-timeline-copy p { margin: 3px 0; color: var(--text-secondary); font-size: 11px; line-height: 1.45; }
.crm-timeline-copy time { color: var(--text-muted); font-size: 10px; }

.crm-order-products { display: block; min-width: 150px; max-width: 280px; line-height: 1.45; }

.crm-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 17px;
}

.crm-section-heading h2 {
  font-size: 21px;
  letter-spacing: -0.02em;
}

.crm-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.crm-toolbar label:not(.crm-check) {
  min-width: 165px;
}

.crm-search {
  position: relative;
  display: block;
  flex: 1;
  min-width: 220px !important;
}

.crm-search svg {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.crm-search .form-control {
  padding-left: 37px;
}

.crm-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: max-content;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.crm-check input { accent-color: var(--accent); }

.crm-result-count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.crm-table th,
.crm-table td {
  vertical-align: middle;
}

.crm-client-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 185px;
}

.crm-client-cell > div:last-child { min-width: 0; }
.crm-client-cell strong { display: block; overflow: hidden; max-width: 190px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.crm-client-cell span { display: block; margin-top: 2px; color: var(--text-muted); font-size: 10px; }

.crm-avatar {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--crm-purple));
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
}

.crm-avatar.large {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  font-size: 17px;
}

.crm-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.crm-tag {
  display: inline-flex;
  padding: 3px 7px;
  color: var(--crm-purple);
  background: var(--crm-purple-soft);
  border-radius: 99px;
  font-size: 9px;
  font-weight: 650;
}

.crm-stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  color: var(--stage-color, var(--accent));
  background: color-mix(in srgb, var(--stage-color, var(--accent)) 10%, transparent);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.crm-stage::before {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  content: '';
}

.crm-status-select {
  max-width: 145px;
  padding: 7px 28px 7px 9px !important;
  font-size: 11px !important;
}

.crm-money {
  font-weight: 680;
  white-space: nowrap;
}

.crm-order-payment {
  display: grid;
  gap: 8px;
  justify-items: start;
  min-width: 170px;
}

.crm-order-payment .btn {
  width: 100%;
  white-space: normal;
}

.crm-muted {
  color: var(--text-muted);
  font-size: 11px;
}

.crm-code {
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.crm-stock-level {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.crm-stock-level strong { min-width: 28px; }
.crm-stock-level .progress-bar { width: 58px; margin: 0; }

.crm-mini-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(155px, 1fr));
  gap: 12px;
  margin-bottom: 17px;
}

.crm-mini-kpi {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.crm-mini-kpi svg { width: 19px; color: var(--mini-color, var(--accent)); }
.crm-mini-kpi div { display: flex; flex-direction: column; }
.crm-mini-kpi strong { font-size: 17px; line-height: 1.15; }
.crm-mini-kpi span { margin-top: 2px; color: var(--text-muted); font-size: 10px; }

.crm-loading-state,
.crm-empty-state,
.crm-error-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  min-height: 120px;
  padding: 25px;
  color: var(--text-muted);
  text-align: center;
}

.crm-loading-state.tall { min-height: 360px; }
.crm-loading-state .loading-spinner { width: 25px; height: 25px; margin: 0; }
.crm-loading-state p,
.crm-empty-state p,
.crm-error-state p { max-width: 400px; font-size: 11px; line-height: 1.5; }
.crm-empty-state svg,
.crm-error-state svg { width: 32px; height: 32px; opacity: 0.65; }
.crm-empty-state strong,
.crm-error-state strong { color: var(--text-secondary); font-size: 13px; }
.crm-error-state { color: var(--danger); }

.crm-skeleton {
  position: relative;
  overflow: hidden;
  background: #ececf0;
}

.crm-skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
  content: '';
  animation: crmShimmer 1.35s infinite;
  transform: translateX(-100%);
}

.crm-kpi-skeleton {
  min-height: 130px;
  border-radius: 14px;
}

@keyframes crmShimmer { to { transform: translateX(100%); } }

.crm-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Cliente 360 */
.crm-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(16, 24, 40, 0.28);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.crm-drawer-overlay[hidden] { display: none; }
.crm-drawer-overlay.active { opacity: 1; }

.crm-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  width: min(720px, 94vw);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: -18px 0 50px rgba(16, 24, 40, 0.16);
  transform: translateX(105%);
  transition: transform 0.28s cubic-bezier(.2,.75,.3,1);
}

.crm-drawer.open { transform: translateX(0); }

.crm-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: 91px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
}

.crm-client-identity {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.crm-client-identity > div:last-child { min-width: 0; }
.crm-client-identity h2 { overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.crm-client-identity p { margin-top: 3px; overflow: hidden; color: var(--text-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.crm-drawer-content {
  height: calc(100vh - 91px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.crm-client-hero {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 22px;
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg-card));
}

.crm-client-stat {
  min-width: 0;
  padding: 11px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.crm-client-stat span { display: block; color: var(--text-muted); font-size: 9px; }
.crm-client-stat strong { display: block; margin-top: 5px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.crm-client-actions {
  display: flex;
  gap: 8px;
  padding: 0 22px 16px;
  overflow-x: auto;
}

.crm-client-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  gap: 2px;
  padding: 7px 16px;
  overflow-x: auto;
  background: rgba(255,255,255,0.94);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  scrollbar-width: none;
}

.crm-client-tabs::-webkit-scrollbar { display: none; }

.crm-client-tab {
  min-width: max-content;
  padding: 8px 10px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.crm-client-tab.active { color: var(--accent); background: var(--accent-dim); }

.crm-client-panel {
  padding: 20px 22px 34px;
}

.crm-client-panel[hidden] { display: none; }

.crm-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.crm-detail-block {
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: 11px;
}

.crm-detail-block.full { grid-column: 1 / -1; }
.crm-detail-block h3 { margin-bottom: 12px; font-size: 12px; }
.crm-field { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 11px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.crm-field:last-child { border-bottom: 0; }
.crm-field span { color: var(--text-muted); }
.crm-field strong { max-width: 65%; text-align: right; word-break: break-word; }

.crm-interest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
}

.crm-interest-card {
  padding: 13px;
  background: var(--bg-secondary);
  border: 1px solid transparent;
  border-radius: 11px;
}

.crm-interest-card strong { display: block; font-size: 12px; }
.crm-interest-card span { display: block; margin-top: 4px; color: var(--text-muted); font-size: 10px; }

.crm-task-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 145px 145px auto;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 11px;
}

.crm-task-list { display: grid; gap: 8px; }

.crm-task-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.crm-task-item svg { width: 15px; flex: 0 0 auto; color: var(--accent); }
.crm-task-item div { flex: 1; min-width: 0; }
.crm-task-item strong { display: block; font-size: 11px; }
.crm-task-item span { display: block; margin-top: 3px; color: var(--text-muted); font-size: 9px; }

/* Formulários e modais CRM */
.crm-modal {
  max-width: 590px;
}

.crm-modal-wide {
  max-width: 760px;
}

.crm-modal .modal-header {
  align-items: flex-start;
}

.crm-modal .modal-footer {
  bottom: -28px;
}

.crm-form-hint {
  margin: -6px 0 16px;
  padding: 9px 11px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.45;
}

.crm-form-help {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.4;
}

.crm-order-ownership,
.crm-address-grid,
.crm-account-commercial-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.crm-address-grid .form-group,
.crm-order-ownership .form-group,
.crm-account-commercial-grid .form-group {
  margin-bottom: 0;
}

.crm-form-section-title > span {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 500;
}

.crm-catalog-price[readonly] {
  color: var(--text-secondary);
  background: rgba(7, 25, 68, 0.045);
  cursor: not-allowed;
}

.crm-sale-inventory-notice {
  align-items: flex-start;
  margin: 0 0 12px;
}

@media (min-width: 600px) {
  .crm-order-ownership,
  .crm-address-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .crm-address-grid .crm-address-wide {
    grid-column: 1 / -1;
  }

  .crm-account-commercial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.crm-static-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--crm-teal);
  background: var(--crm-teal-soft);
  border-radius: var(--radius);
}

.crm-static-field svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.crm-static-field span {
  display: flex;
  flex-direction: column;
}

.crm-static-field strong {
  font-size: 11px;
}

.crm-static-field small {
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 9px;
}

.crm-form-section {
  margin-bottom: 16px;
  padding: 13px;
  background: var(--bg-secondary);
  border-radius: 12px;
}

.crm-form-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 12px;
}

.crm-sale-item {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 80px 110px 34px;
  align-items: end;
  gap: 8px;
  margin-bottom: 8px;
}

.crm-sale-item .form-group { margin: 0; }
.crm-sale-item label { font-size: 9px; }
.crm-sale-item .btn { height: 42px; align-self: end; }

.crm-sale-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
}

.crm-sale-total strong { color: var(--crm-teal); font-size: 18px; }

.crm-stock-help {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 9px;
}

.crm-inline-stage {
  display: flex;
  align-items: center;
  gap: 7px;
}

.crm-profile-footer {
  position: static;
  bottom: auto;
  margin-top: 15px;
  padding-bottom: 0;
}

.crm-dialog-open {
  overflow: hidden;
}

.crm-button-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0.75;
  animation: spin 0.7s linear infinite;
}

#refreshCrmBtn.is-loading svg {
  animation: spin 0.8s linear infinite;
}

.crm-page .modal-overlay {
  z-index: 1400;
}

.crm-page .toast {
  position: relative;
  color: var(--text-primary);
  overflow: hidden;
}

.crm-page .toast-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
}

.crm-page .toast-icon svg { width: 14px; height: 14px; }
.crm-page .toast-success .toast-icon { color: var(--success); background: rgba(52,199,89,.1); }
.crm-page .toast-error .toast-icon { color: var(--danger); background: rgba(255,59,48,.1); }
.crm-page .toast-info .toast-icon { color: var(--accent); background: var(--accent-dim); }
.crm-page .toast span { flex: 1; }
.crm-page .toast-close { padding: 3px; color: var(--text-muted); background: transparent; border: 0; cursor: pointer; }
.crm-page .toast-close svg { width: 14px; height: 14px; }

@media (max-width: 1380px) {
  .crm-kpi-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .crm-kpi-grid.compact { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
}

@media (max-width: 1100px) {
  .crm-main { padding-right: 24px; padding-left: 24px; }
  .crm-overview-grid { grid-template-columns: 1fr 1fr; }
  .crm-overview-grid > .crm-span-2 { grid-column: 1 / -1; }
  .crm-overview-grid > .card:nth-child(3),
  .crm-overview-grid > .card:nth-child(4),
  .crm-overview-grid > .card:nth-child(5) { grid-column: auto; grid-row: auto; }
  .crm-overview-grid > .card:nth-child(5) { grid-column: 1 / -1; }
  .crm-mini-kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .crm-page-header { align-items: flex-start; flex-direction: column; }
  .crm-header-actions { justify-content: flex-start; }
  .crm-sync-status { width: 100%; }
  .crm-kpi-grid.compact { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}

@media (max-width: 768px) {
  .crm-main { padding: 76px 14px 24px; }
  .crm-page-header h1 { font-size: 25px; }
  .crm-header-actions { width: 100%; }
  .crm-header-actions .btn { flex: 1; justify-content: center; min-width: 130px; }
  .crm-tabs { position: sticky; top: 12px; z-index: 20; }
  .crm-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-overview-grid { grid-template-columns: 1fr; }
  .crm-overview-grid > .card,
  .crm-overview-grid > .crm-span-2,
  .crm-overview-grid > .card:nth-child(3),
  .crm-overview-grid > .card:nth-child(4),
  .crm-overview-grid > .card:nth-child(5) { grid-column: 1; grid-row: auto; }
  .crm-section-heading { align-items: flex-start; flex-direction: column; }
  .crm-toolbar { align-items: stretch; flex-direction: column; }
  .crm-toolbar label:not(.crm-check),
  .crm-search { width: 100%; min-width: 100% !important; }
  .crm-result-count { margin-left: 0; }
  .crm-drawer { width: 100vw; }
  .crm-client-hero { grid-template-columns: repeat(2, 1fr); }
  .crm-detail-grid { grid-template-columns: 1fr; }
  .crm-detail-block.full { grid-column: 1; }
  .crm-task-form { grid-template-columns: 1fr; }
  .crm-modal { width: calc(100% - 20px); padding: 22px 18px; }
  .crm-sale-item { grid-template-columns: 1fr 75px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
  .crm-sale-item .crm-sale-product { grid-column: 1 / -1; }
  .crm-sale-item .crm-sale-remove { grid-column: 2; grid-row: 2; justify-self: end; }
}

@media (max-width: 480px) {
  .crm-kpi-grid,
  .crm-kpi-grid.compact,
  .crm-mini-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .crm-kpi { padding: 14px; }
  .crm-kpi-value { font-size: 23px; }
  .crm-mini-kpi { align-items: flex-start; padding: 11px; }
  .crm-funnel-row { grid-template-columns: 83px 1fr; gap: 8px; }
  .crm-funnel-value { display: none; }
  .crm-client-actions { padding: 0 14px 14px; }
  .crm-client-hero,
  .crm-client-panel { padding-right: 14px; padding-left: 14px; }
  .crm-drawer-header { padding-right: 14px; padding-left: 14px; }
  .crm-client-identity .crm-avatar { display: none; }
  .toast-container { top: 12px; right: 12px; left: 12px; }
  .toast { min-width: 0; width: 100%; }
}

/* Painel unificado de contas WhatsApp — mobile first */
.accounts-page section { margin-bottom: 28px; }
.account-access-card { display: flex; flex-direction: column; gap: 14px; padding: 16px; background: #eef8f1; border: 1px solid #b8dfc2; border-radius: 16px; }
.account-access-card.is-restricted { background: #fff6e8; border-color: #f0ce94; }
.account-access-card h2 { margin: 0 0 5px; font-size: 17px; }
.account-access-card p { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.accounts-access-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 13px; font-weight: 700; cursor: pointer; }
.accounts-access-toggle:has(input:disabled) { cursor: default; opacity: .78; }
.accounts-section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.accounts-section-title h2 { margin: 0 0 4px; font-size: 20px; }
.accounts-section-title p { margin: 0; color: var(--text-muted); font-size: 13px; }
.accounts-grid { display: grid; gap: 14px; }
.account-card, .account-empty-slot { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; box-shadow: var(--shadow-sm); }
.account-card-primary { border-color: rgba(189,124,16,.42); }
.account-card-head { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border-color); }
.account-card-head h3 { margin: 0 0 3px; font-size: 16px; }
.account-card-head p { margin: 0; color: var(--text-muted); font-size: 12px; }
.account-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-dim); color: var(--primary); }
.account-controls { padding: 4px 16px; }
.accounts-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border-color); cursor: pointer; }
.accounts-toggle-row:last-child { border-bottom: 0; }
.accounts-toggle-row strong, .accounts-toggle-row small { display: block; }
.accounts-toggle-row small { margin-top: 3px; color: var(--text-muted); font-size: 11px; line-height: 1.35; }
.account-context { margin: 4px 16px 16px; }
.account-context textarea { resize: vertical; min-height: 112px; }
.account-context-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; color: var(--text-muted); }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--border-color); }
.account-empty-slot { min-height: 160px; padding: 24px; color: var(--text-muted); background: transparent; border-style: dashed; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; }
.account-empty-slot:hover { color: var(--primary); border-color: var(--primary); background: rgba(189,124,16,.06); }
.account-empty-slot svg { width: 28px; height: 28px; }
.account-empty-slot span { font-size: 12px; }
.accounts-alert { position: sticky; top: 12px; z-index: 20; margin-bottom: 16px; padding: 11px 14px; color: #146c2e; background: #eaf8ee; border: 1px solid #b7e4c2; border-radius: 10px; }
.accounts-alert.is-error { color: #9c1c1c; background: #fff0f0; border-color: #f0b8b8; }
.account-connection-help { margin: 12px 16px 0; padding: 12px; color: #6f4d09; background: #fff8e8; border: 1px solid #ead197; border-radius: 10px; }
.account-connection-help.is-error { color: #861d1d; background: #fff1f1; border-color: #efb8b8; }
.account-connection-help strong { display: block; margin-bottom: 4px; }
.account-connection-help p { margin: 0; font-size: 13px; line-height: 1.45; }
.account-help-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 10px; }
.accounts-qr { text-align: center; }
.accounts-qr-content { min-height: 270px; display: grid; place-items: center; color: var(--text-muted); }
.accounts-qr-content img { width: min(280px,100%); height: auto; }
@media (min-width: 760px) { .account-access-card { flex-direction: row; align-items: center; justify-content: space-between; } .accounts-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .account-card-primary { max-width: 900px; } .account-help-actions { flex-direction: row; align-items: center; } }
@media (min-width: 1180px) { .accounts-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }

@media (prefers-reduced-motion: reduce) {
  .crm-section,
  .crm-skeleton::after,
  .crm-drawer,
  .crm-drawer-overlay { animation: none; transition: none; }
}

/* ============================================
   CRM MULTICONTAS E COPILOTO COMERCIAL
   ============================================ */
.crm-tab-count {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  place-items: center;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 99px;
  font-size: 9px;
  font-weight: 750;
}

.crm-tab.active .crm-tab-count {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.88);
}

.crm-account-notice {
  margin-top: 0;
}

.crm-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.crm-account-skeleton {
  min-height: 330px;
  border-radius: 16px;
}

.crm-account-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--crm-shadow-soft);
}

.crm-account-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--border-color);
}

.crm-account-identity {
  display: flex;
  gap: 11px;
  min-width: 0;
}

.crm-account-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #25d366, #0a8f83);
  border-radius: 12px;
}

.crm-account-icon svg {
  width: 19px;
  height: 19px;
}

.crm-account-identity > div {
  min-width: 0;
}

.crm-account-identity h3 {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-account-identity p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
}

.crm-account-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  color: var(--account-color, var(--text-muted));
  background: color-mix(in srgb, var(--account-color, var(--text-muted)) 10%, transparent);
  border-radius: 99px;
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}

.crm-account-status::before {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  content: '';
}

.crm-account-error {
  display: flex;
  gap: 8px;
  margin: 12px 18px 0;
  padding: 9px 10px;
  color: #b42318;
  background: #fff3f2;
  border-radius: 9px;
  font-size: 10px;
  line-height: 1.45;
}

.crm-account-error svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.crm-account-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 18px;
}

@media (min-width: 769px) {
  .crm-account-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.crm-account-meta-item {
  min-width: 0;
  padding: 9px 10px;
  background: var(--bg-secondary);
  border-radius: 9px;
}

.crm-account-meta-item span {
  display: block;
  color: var(--text-muted);
  font-size: 9px;
}

.crm-account-meta-item strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-account-settings {
  padding: 0 18px 15px;
}

.crm-account-settings .form-group {
  margin-bottom: 10px;
}

.crm-account-settings .form-control {
  padding: 9px 11px;
  font-size: 11px;
}

.crm-settings-fieldset {
  padding: 4px 12px;
  background: var(--bg-secondary);
  border: 0;
  border-radius: 12px;
}

.crm-settings-fieldset legend {
  padding: 0 4px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
}

.crm-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

.crm-switch-row:last-child {
  border-bottom: 0;
}

.crm-switch-row > span:first-child {
  min-width: 0;
}

.crm-switch-row strong,
.crm-switch-row small {
  display: block;
}

.crm-switch-row strong {
  font-size: 11px;
}

.crm-switch-row small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.4;
}

.crm-switch-row .toggle {
  width: 42px;
  height: 25px;
  flex: 0 0 auto;
}

.crm-switch-row .toggle-slider {
  border-radius: 13px;
}

.crm-switch-row .toggle-slider::before {
  width: 21px;
  height: 21px;
}

.crm-switch-row .toggle input:checked + .toggle-slider::before {
  transform: translateX(17px);
}

.crm-account-card .crm-switch-row {
  padding: 7px 0;
}

.crm-account-card .crm-switch-row small {
  display: none;
}

.crm-account-actions {
  display: flex;
  gap: 7px;
  padding: 13px 18px 17px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.crm-account-actions .btn {
  justify-content: center;
  flex: 1;
  min-width: 92px;
}

.crm-account-actions .btn[data-account-remove] {
  flex: 0 0 auto;
  min-width: auto;
}

.crm-account-capacity {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 10px;
}

.crm-account-capacity .progress-bar {
  width: 80px;
  margin: 0;
}

.crm-qr-modal {
  max-width: 440px;
}

.crm-qr-account {
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}

.crm-qr-frame {
  display: grid;
  min-height: 280px;
  margin-bottom: 16px;
  padding: 18px;
  place-items: center;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
}

.crm-qr-frame img {
  display: block;
  width: min(260px, 100%);
  height: auto;
  image-rendering: pixelated;
}

.crm-confirm-copy {
  padding: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
}

.crm-review-intro {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 18px;
  color: #fffdfa;
  background: linear-gradient(135deg, #071944, #143a78);
  border: 1px solid #bd7c10;
  border-radius: 16px;
}

.crm-review-intro-copy {
  max-width: 780px;
}

.crm-review-intro h2 {
  margin: 4px 0 8px;
  color: inherit;
  font-size: clamp(20px, 5vw, 30px);
  line-height: 1.15;
}

.crm-review-intro p {
  margin: 0;
  color: #dce6fb;
  font-size: 13px;
  line-height: 1.6;
}

.crm-review-intro .btn {
  width: 100%;
  justify-content: center;
  color: #071944;
  background: #e8c37f;
  border-color: #bd7c10;
}

.crm-review-steps {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.crm-review-steps li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.crm-review-steps li > span {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #fff;
  background: #071944;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.crm-review-steps div {
  display: grid;
  gap: 2px;
}

.crm-review-steps strong { font-size: 12px; }
.crm-review-steps small { color: var(--text-secondary); font-size: 11px; }

.crm-ai-guardrail {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 16px;
  padding: 13px 15px;
  color: #2d2264;
  background: #f4f1ff;
  border: 1px solid #ded7ff;
  border-radius: 12px;
}

.crm-ai-guardrail > svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: var(--crm-purple);
}

.crm-ai-guardrail div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.crm-ai-guardrail strong {
  font-size: 13px;
}

.crm-ai-guardrail span {
  font-size: 11px;
  line-height: 1.5;
}

.crm-suggestion-shell {
  padding: 0;
  overflow: hidden;
}

.crm-suggestion-toolbar {
  margin: 0;
  padding: 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.crm-suggestion-toolbar label {
  display: grid;
  flex: 1 1 180px;
  gap: 5px;
}

.crm-suggestion-toolbar label > span {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.crm-suggestion-layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 480px;
}

.crm-suggestion-list-column {
  min-width: 0;
  border-bottom: 1px solid var(--border-color);
}

.crm-suggestion-list {
  max-height: 360px;
  overflow-y: auto;
}

.crm-pagination {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border-color);
}

.crm-pagination .btn {
  width: 100%;
  min-height: 44px;
  justify-content: center;
}

.crm-pagination .btn[hidden] { display: none; }

.crm-pagination-status {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.crm-pagination-status:empty { display: none; }

.crm-suggestion-item {
  display: block;
  width: 100%;
  padding: 14px 15px;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.crm-suggestion-item:hover {
  background: var(--bg-secondary);
}

.crm-suggestion-item.active {
  background: var(--crm-purple-soft);
  box-shadow: inset 3px 0 var(--crm-purple);
}

.crm-suggestion-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.crm-suggestion-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--crm-purple);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.crm-suggestion-type svg {
  width: 13px;
  height: 13px;
}

.crm-confidence-chip {
  padding: 4px 7px;
  color: var(--confidence-color, var(--text-secondary));
  background: color-mix(in srgb, var(--confidence-color, var(--text-secondary)) 10%, transparent);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 750;
}

.crm-suggestion-item h3 {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.crm-suggestion-item p {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.crm-suggestion-reason {
  display: grid;
  gap: 2px;
  margin-top: 9px;
  padding: 8px 10px;
  background: rgba(7, 25, 68, .045);
  border-radius: 8px;
}

.crm-suggestion-reason span {
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.crm-suggestion-reason strong {
  font-size: 10px;
  line-height: 1.4;
}

.crm-suggestion-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 10px;
}

.crm-suggestion-detail {
  min-width: 0;
  max-height: none;
  padding: 16px;
  overflow-y: auto;
}

.crm-suggestion-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.crm-suggestion-detail-header h3 {
  margin: 6px 0;
  font-size: 22px;
  line-height: 1.35;
}

.crm-suggestion-detail-header p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.crm-confidence {
  min-width: 130px;
  padding: 11px;
  background: var(--bg-secondary);
  border-radius: 11px;
}

.crm-confidence > small {
  display: block;
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 9px;
}

.crm-confidence-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 10px;
}

.crm-confidence .progress-bar {
  margin: 0;
}

.crm-suggestion-block {
  margin-bottom: 15px;
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: 12px;
}

.crm-suggestion-block h4 {
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.crm-suggestion-why {
  color: #223667;
  background: #f2f6ff;
  border: 1px solid #d7e2fa;
}

.crm-suggestion-why strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.crm-suggestion-why p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.55;
}

.crm-suggestion-change {
  border: 1px solid #d9c292;
  background: #fffaf0;
}

.crm-suggestion-evidence {
  padding: 0;
  overflow: hidden;
}

.crm-suggestion-evidence summary {
  padding: 13px 14px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.crm-suggestion-evidence[open] summary {
  border-bottom: 1px solid var(--border-color);
}

.crm-suggestion-evidence .crm-evidence-grid,
.crm-suggestion-evidence > p {
  margin: 12px 14px 14px;
}

.crm-decision-guide {
  display: grid;
  gap: 3px;
  margin-top: 18px;
  padding: 12px 14px;
  color: #244c3b;
  background: #eef8f2;
  border: 1px solid #cbe7d5;
  border-radius: 10px;
}

.crm-decision-guide strong { font-size: 12px; }
.crm-decision-guide span { font-size: 10px; line-height: 1.5; }

.crm-proposed-reply {
  padding: 12px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.crm-proposal-grid,
.crm-evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.crm-proposal-field,
.crm-evidence-item {
  min-width: 0;
  padding: 9px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 9px;
}

.crm-proposal-field span,
.crm-evidence-item span {
  display: block;
  color: var(--text-muted);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.crm-proposal-field strong,
.crm-evidence-item strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 10px;
  line-height: 1.45;
}

.crm-evidence-item strong {
  font-weight: 550;
}

.crm-suggestion-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.crm-suggestion-resolved {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 10px;
  font-size: 11px;
}

.crm-suggestion-resolved svg {
  width: 18px;
  height: 18px;
}

.crm-alert-warning {
  color: #764c00;
  background: #fff8e8;
  border: 1px solid #f6dda8;
}

.crm-review-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 15px;
  padding: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.5;
}

.crm-review-customer,
.crm-review-action {
  display: grid;
  gap: 4px;
}

.crm-review-customer {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.crm-review-customer span {
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.crm-review-customer strong,
.crm-review-action > strong {
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.crm-order-move-details {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.crm-order-move-transition {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.crm-order-move-transition span {
  color: var(--text-secondary);
  font-size: 10px;
  text-transform: uppercase;
}

.crm-order-move-transition strong { font-size: 12px; }

.crm-order-move-transition svg {
  display: none;
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.crm-order-move-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.crm-order-move-meta > div {
  min-width: 0;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 9px;
}

.crm-order-move-meta span,
.crm-order-move-total span {
  display: block;
  color: var(--text-secondary);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.crm-order-move-meta strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.crm-order-move-items {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.crm-order-move-items h3 {
  margin-bottom: 8px;
  font-size: 12px;
}

.crm-order-move-items [role="list"] { display: grid; gap: 7px; }

.crm-order-move-impact {
  margin: 0;
}

.crm-order-move-impact-info {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  color: var(--text-secondary);
  background: var(--accent-dim);
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.45;
}

.crm-order-move-impact-info svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--accent);
}

.crm-order-move-item {
  display: grid;
  gap: 7px;
  padding: 10px;
  background: var(--bg-secondary);
  border-radius: 9px;
}

.crm-order-move-item strong,
.crm-order-move-item span { display: block; }
.crm-order-move-item strong { font-size: 12px; line-height: 1.4; }
.crm-order-move-item span { margin-top: 3px; color: var(--text-secondary); font-size: 10px; }
.crm-order-move-item-values { text-align: left; }

.crm-order-move-empty {
  padding: 10px;
  color: var(--danger);
  background: var(--danger-dim);
  border-radius: 9px;
  font-size: 11px;
}

.crm-order-move-financials {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.crm-order-move-financials > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 11px;
}

.crm-order-move-financials span { color: var(--text-secondary); }

.crm-order-move-progress {
  margin: 0;
  padding: 10px 12px;
  color: var(--text-secondary);
  background: var(--accent-dim);
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.45;
  outline-offset: 2px;
}

.crm-order-move-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: #244c3b;
  background: #eef8f2;
  border: 1px solid #cbe7d5;
  border-radius: 10px;
}

.crm-order-move-total strong { font-size: 15px; }

.crm-revision-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.crm-revision-fields .form-group {
  margin: 0;
}

.crm-revision-fields .form-group.crm-revision-wide {
  grid-column: 1 / -1;
}

.crm-revision-readonly {
  grid-column: 1 / -1;
  padding: 10px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: 9px;
  font-size: 10px;
}

@media (max-width: 1100px) {
  .crm-proposal-grid,
  .crm-evidence-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 700px) {
  .crm-order-move-transition {
    grid-template-columns: auto minmax(0, 1fr) auto auto minmax(0, 1fr);
  }

  .crm-order-move-transition svg { display: block; }
  .crm-order-move-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-order-move-item { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .crm-order-move-item-values { text-align: right; }
  .crm-order-move-financials { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .crm-review-intro {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 22px 24px;
  }

  .crm-review-intro .btn { width: auto; }
  .crm-review-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .crm-quick-guide {
    grid-template-columns: auto repeat(4, minmax(130px, 1fr));
    align-items: center;
  }

  .crm-quick-guide > strong { grid-column: auto; padding: 0 6px; }

  .crm-suggestion-layout {
    grid-template-columns: minmax(320px, .42fr) minmax(0, 1fr);
    min-height: 610px;
  }

  .crm-suggestion-list {
    max-height: 720px;
  }

  .crm-suggestion-list-column {
    border-right: 1px solid var(--border-color);
    border-bottom: 0;
  }

  .crm-suggestion-detail {
    max-height: 720px;
    padding: 24px;
  }
}

/* ============================================
   TERMINAL WEB — mobile first
   ============================================ */
.terminal-page {
  min-width: 0;
}

.terminal-header {
  align-items: flex-start;
  gap: 14px;
}

.terminal-actions {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.terminal-actions .btn {
  flex: 1;
  justify-content: center;
}

.terminal-actions .btn svg {
  width: 14px;
  height: 14px;
}

.terminal-card {
  overflow: hidden;
  background: #101318;
  border: 1px solid #252b34;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.terminal-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  color: #aab2bf;
  background: #171b22;
  border-bottom: 1px solid #292f39;
  font-size: 12px;
}

.terminal-toolbar .form-control {
  color: #f0f3f7;
  background: #0d1014;
  border-color: #343b47;
}

.terminal-toolbar .form-control::placeholder {
  color: #737d8c;
}

.terminal-autoscroll {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  white-space: nowrap;
}

.terminal-count {
  color: #8e98a8;
  white-space: nowrap;
}

.terminal-output {
  height: min(66vh, 720px);
  min-height: 360px;
  overflow: auto;
  padding: 12px;
  color: #d7dce3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.55;
  scrollbar-color: #4a5361 #101318;
}

.terminal-line {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

.terminal-category {
  width: max-content;
  padding: 1px 6px;
  color: #c7d0dd;
  background: #29313d;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

.terminal-category-whatsapp { color: #79e2a5; background: rgba(28, 145, 83, 0.2); }
.terminal-category-ai,
.terminal-category-guardian,
.terminal-category-commercial_ai { color: #d0b2ff; background: rgba(126, 78, 186, 0.22); }

.terminal-time {
  color: #758092;
}

.terminal-level {
  width: max-content;
  color: #8ab4f8;
  font-size: 10px;
  font-weight: 800;
}

.terminal-message {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.terminal-warn .terminal-level,
.terminal-warn .terminal-message {
  color: #ffd166;
}

.terminal-error .terminal-level,
.terminal-error .terminal-message {
  color: #ff7b72;
}

.terminal-debug .terminal-level {
  color: #b89cff;
}

.terminal-empty {
  padding: 22px 12px;
  color: #758092;
  background: #101318;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  text-align: center;
}

.terminal-empty[hidden] {
  display: none;
}

.terminal-note {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 11px;
}

@media (min-width: 700px) {
  .terminal-header {
    align-items: center;
  }

  .terminal-actions {
    width: auto;
  }

  .terminal-actions .btn {
    flex: 0 0 auto;
  }

  .terminal-toolbar {
    grid-template-columns: auto minmax(220px, 1fr) auto minmax(130px, 0.35fr) auto minmax(120px, 0.3fr) auto auto;
    align-items: center;
    padding: 12px 16px;
  }

  .terminal-output {
    padding: 16px;
    font-size: 12px;
  }

  .terminal-line {
    grid-template-columns: 170px 54px 92px minmax(0, 1fr);
    gap: 10px;
  }
}

.crm-fixed-setting {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 0;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
}

.crm-fixed-setting > svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--success);
}

.crm-fixed-setting span,
.crm-fixed-setting strong,
.crm-fixed-setting small {
  display: block;
}

.crm-fixed-setting strong {
  color: var(--text-primary);
  font-size: 10px;
}

.crm-fixed-setting small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.4;
}

.crm-revision-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 9px;
  font-size: 10px;
}

.crm-revision-item strong {
  color: var(--text-primary);
}

.crm-commerce-signal {
  margin-bottom: 15px;
  padding: 12px 14px;
  background: #f1f8ff;
  border: 1px solid #cfe7ff;
  border-radius: 12px;
}

.crm-commerce-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.crm-commerce-badges .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.crm-commerce-badges svg {
  width: 11px;
  height: 11px;
}

.crm-commerce-signal p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.5;
}

.crm-account-scan-summary {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: -3px 18px 14px;
  padding: 8px 10px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 9px;
  font-size: 9px;
  line-height: 1.45;
}

.crm-account-scan-summary svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--primary);
}

.crm-payment-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 7px;
  padding: 4px 7px;
  color: #795100;
  background: #fff7df;
  border-radius: 99px;
  font-size: 8px;
  font-weight: 700;
}

.crm-payment-link-chip svg {
  width: 10px;
  height: 10px;
}

.account-commission {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.account-commercial-heading h4,
.account-commercial-heading p {
  margin: 0;
}

.account-commercial-heading h4 {
  color: var(--text-primary);
  font-size: 0.98rem;
}

.account-commercial-heading p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.account-commercial-role {
  min-width: 0;
  padding: 13px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.account-commercial-role .form-group {
  min-width: 0;
  margin: 9px 0 0;
}

.account-commercial-role .form-group label,
.account-commercial-role .form-group small {
  display: block;
}

.account-commercial-role .form-group label {
  margin-bottom: 3px;
  color: var(--text-primary);
  font-size: 0.86rem;
}

.account-commercial-role .form-group small {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.73rem;
  line-height: 1.4;
}

.account-commercial-step {
  display: inline-flex;
  padding: 4px 8px;
  color: var(--primary);
  background: var(--accent-dim);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.account-referrer-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  cursor: pointer;
}

.account-referrer-toggle strong,
.account-referrer-toggle small {
  display: block;
}

.account-referrer-toggle strong {
  color: var(--text-primary);
  font-size: 0.86rem;
}

.account-referrer-toggle small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.73rem;
  line-height: 1.4;
}

.account-referrer-toggle .toggle {
  flex: 0 0 51px;
}

.account-referrer-toggle .toggle input:focus-visible + .toggle-slider {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.account-referral-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.account-referral-fields[hidden] {
  display: none;
}

.account-percent-control {
  position: relative;
}

.account-percent-control .form-control {
  padding-right: 42px;
}

.account-percent-control > span {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 750;
  transform: translateY(-50%);
  pointer-events: none;
}

.account-commercial-save {
  width: 100%;
  min-height: 44px;
  justify-content: center;
  color: var(--text-primary);
}

.account-commercial-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.account-commercial-summary > div {
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: 9px;
}

.account-commercial-summary > .account-commercial-heading {
  padding: 0 0 3px;
  background: transparent;
}

.account-commercial-summary span,
.account-commercial-summary strong {
  display: block;
}

.account-commercial-summary span {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.account-commercial-summary strong {
  margin-top: 3px;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.account-scan-summary {
  padding: 10px 16px;
  color: var(--text-secondary);
  background: rgba(7, 25, 68, 0.04);
  border-top: 1px solid var(--border-color);
  font-size: 0.82rem;
}

@media (max-width: 768px) {
  .crm-account-grid {
    grid-template-columns: 1fr;
  }

  .crm-suggestion-layout {
    grid-template-columns: 1fr;
  }

  .crm-suggestion-list {
    max-height: 340px;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }

  .crm-suggestion-detail {
    max-height: none;
    padding: 16px;
  }

  .crm-suggestion-detail-header {
    flex-direction: column;
  }

  .crm-confidence {
    width: 100%;
  }

  .crm-revision-fields {
    grid-template-columns: 1fr;
  }

  .crm-revision-fields .form-group.crm-revision-wide {
    grid-column: 1;
  }
}

@media (max-width: 480px) {
  .crm-account-grid {
    gap: 10px;
  }

  .crm-account-card-header,
  .crm-account-meta,
  .crm-account-settings,
  .crm-account-actions {
    padding-right: 13px;
    padding-left: 13px;
  }

  .crm-account-meta {
    grid-template-columns: 1fr;
  }

  .crm-suggestion-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

/* CRM: base mobile-first, linguagem visual legível e alvos de toque seguros */
.crm-page {
  font-size: 16px;
}

.crm-main {
  width: 100%;
  padding: 76px 12px 28px;
}

.crm-page-header,
.crm-section-heading,
.crm-toolbar,
.crm-header-actions,
.crm-suggestion-detail-header {
  align-items: stretch;
  flex-direction: column;
}

.crm-header-actions,
.crm-page-header,
.crm-section-heading { display: flex; }
.crm-header-actions .btn,
.crm-section-heading .btn { width: 100%; justify-content: center; }

.crm-quick-guide,
.crm-kpi-grid,
.crm-kpi-grid.compact,
.crm-mini-kpis,
.crm-overview-grid,
.crm-detail-grid,
.crm-client-hero,
.crm-task-form,
.crm-sale-item,
.crm-suggestion-layout,
.crm-revision-fields {
  grid-template-columns: minmax(0, 1fr);
}

.crm-overview-grid > .card,
.crm-overview-grid > .crm-span-2,
.crm-detail-block.full,
.crm-revision-fields .form-group.crm-revision-wide,
.crm-sale-item .crm-sale-product {
  grid-column: 1;
  grid-row: auto;
}

.crm-page .btn,
.crm-page .btn-sm,
.crm-page button,
.crm-page a.btn,
.crm-page .form-control,
.crm-client-tab,
.crm-tab {
  min-height: 44px;
  font-size: 14px;
}

.crm-page .btn-icon,
.crm-page .modal-close,
.crm-page .toast-close,
.crm-sale-remove {
  min-width: 44px;
  min-height: 44px;
}

.crm-page input.form-control,
.crm-page select.form-control,
.crm-page textarea.form-control {
  font-size: 16px;
}

.crm-eyebrow,
.crm-sync-status,
.crm-local-notice,
.crm-quick-guide > strong,
.crm-quick-guide button,
.crm-result-count,
.crm-check,
.crm-client-cell strong,
.crm-client-cell span,
.crm-tag,
.crm-stage,
.crm-muted,
.crm-code,
.crm-mini-kpi span,
.crm-loading-state p,
.crm-empty-state p,
.crm-error-state p,
.crm-empty-state strong,
.crm-error-state strong,
.crm-client-identity p,
.crm-client-stat span,
.crm-client-stat strong,
.crm-detail-block h3,
.crm-field,
.crm-interest-card strong,
.crm-interest-card span,
.crm-task-item strong,
.crm-task-item span,
.crm-form-hint,
.crm-form-help,
.crm-form-section-title,
.crm-form-section-title > span,
.crm-static-field strong,
.crm-static-field small,
.crm-sale-item label,
.crm-sale-total,
.crm-stock-help,
.crm-page .badge,
.crm-ai-guardrail strong,
.crm-ai-guardrail span,
.crm-suggestion-toolbar label > span,
.crm-suggestion-type,
.crm-confidence-chip,
.crm-suggestion-item p,
.crm-suggestion-reason span,
.crm-suggestion-reason strong,
.crm-suggestion-item-meta,
.crm-confidence > small,
.crm-confidence-row,
.crm-suggestion-block h4,
.crm-suggestion-why strong,
.crm-suggestion-why p,
.crm-suggestion-evidence summary,
.crm-proposed-reply,
.crm-proposal-field span,
.crm-evidence-item span,
.crm-proposal-field strong,
.crm-evidence-item strong,
.crm-order-move-transition span,
.crm-order-move-transition strong,
.crm-order-move-meta span,
.crm-order-move-meta strong,
.crm-order-move-item strong,
.crm-order-move-item span,
.crm-order-move-financials > div,
.crm-order-move-impact-info,
.crm-order-move-empty,
.crm-order-move-progress,
.crm-revision-readonly,
.crm-review-steps strong,
.crm-review-steps small,
.crm-decision-guide strong,
.crm-decision-guide span {
  font-size: 14px;
  line-height: 1.5;
}

.crm-toolbar label:not(.crm-check),
.crm-search {
  width: 100%;
  min-width: 0 !important;
}

.crm-search small {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.4;
}

.crm-tabs {
  position: sticky;
  top: 10px;
  z-index: 20;
}

.crm-drawer { width: 100vw; }
.crm-client-panel,
.crm-client-hero,
.crm-drawer-header { padding-right: 14px; padding-left: 14px; }
.crm-client-actions { padding-right: 14px; padding-left: 14px; flex-wrap: wrap; overflow: visible; }
.crm-client-actions > * { flex: 1 1 100%; }
.crm-inline-stage { align-items: stretch; flex-direction: column; }

.crm-modal {
  width: calc(100% - 16px);
  max-height: calc(100dvh - 16px);
  padding: 20px 14px;
  overflow-y: auto;
}

.crm-sale-item {
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}
.crm-sale-item .crm-sale-remove { justify-self: end; }

.crm-field-error {
  display: block;
  margin-top: 6px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}
.crm-field-error[hidden] { display: none; }
.crm-page [aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 59, 48, .12); }
.crm-form-error-summary { margin-bottom: 16px; }
.crm-form-error-summary > div { display: grid; gap: 6px; }
.crm-form-error-summary a { display: inline-flex; align-items: center; min-height: 44px; color: inherit; font-weight: 750; text-decoration: underline; }

.crm-stock-projection,
.crm-status-transition {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin: 0 0 16px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}
.crm-stock-projection span,
.crm-status-transition span { color: var(--text-secondary); font-size: 14px; }
.crm-stock-projection strong,
.crm-status-transition strong { font-size: 16px; }
.crm-stock-projection svg,
.crm-status-transition svg { display: none; width: 18px; height: 18px; }

.crm-confirm-summary {
  margin: 0 0 16px;
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.55;
}
.crm-confirm-summary:empty { display: none; }

.crm-task-filter { display: grid; gap: 6px; margin-bottom: 14px; }
.crm-task-item { align-items: stretch; flex-wrap: wrap; }
.crm-task-copy { flex: 1 1 180px; }
.crm-task-actions { display: flex; flex: 1 1 100%; gap: 8px; }
.crm-task-actions .btn { flex: 1; justify-content: center; }
.crm-task-item[hidden] { display: none; }

.crm-finance-card + .crm-finance-card { margin-top: 16px; }
.crm-link-button { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 0; color: var(--accent); background: transparent; border: 0; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* No celular, as tabelas viram cartões; a ação principal fica sempre visível. */
.crm-page .table-container { overflow: visible; }
.crm-page .crm-table,
.crm-page .crm-table tbody { display: block; width: 100%; min-width: 0; }
.crm-page .crm-table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.crm-page .crm-table tbody tr {
  display: block;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}
.crm-page .crm-table tbody td {
  display: grid;
  grid-template-columns: minmax(104px, 38%) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 40px;
  padding: 7px 0;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.crm-page .crm-table tbody td:last-child { border-bottom: 0; }
.crm-page .crm-table tbody td::before { color: var(--text-muted); font-size: 14px; font-weight: 700; }
.crm-page .crm-table tbody td[data-label]::before { content: attr(data-label) !important; }
.crm-page .crm-table tbody td[colspan] { display: block; min-height: 0; }
.crm-page .crm-table tbody td[colspan]::before { content: none !important; }
.crm-section[aria-busy="true"] { cursor: progress; }

#contactsTable td:nth-child(1)::before { content: 'Cliente'; }
#contactsTable td:nth-child(2)::before { content: 'Etapa'; }
#contactsTable td:nth-child(3)::before { content: 'Último contato'; }
#contactsTable td:nth-child(4)::before { content: 'Pedidos'; }
#contactsTable td:nth-child(5)::before { content: 'Valor total'; }
#contactsTable td:nth-child(6)::before { content: 'Próxima ação'; }
#contactsTable td:nth-child(7)::before { content: 'Abrir'; }
#inventoryTable td:nth-child(1)::before { content: 'Produto'; }
#inventoryTable td:nth-child(2)::before { content: 'Código'; }
#inventoryTable td:nth-child(3)::before { content: 'Disponível'; }
#inventoryTable td:nth-child(4)::before { content: 'Reservado'; }
#inventoryTable td:nth-child(5)::before { content: 'Mínimo'; }
#inventoryTable td:nth-child(6)::before { content: 'Custo'; }
#inventoryTable td:nth-child(7)::before { content: 'Preço'; }
#inventoryTable td:nth-child(8)::before { content: 'Situação'; }
#inventoryTable td:nth-child(9)::before { content: 'Ajustar'; }
#ordersTable td:nth-child(1)::before { content: 'Pedido'; }
#ordersTable td:nth-child(2)::before { content: 'Data'; }
#ordersTable td:nth-child(3)::before { content: 'Cliente'; }
#ordersTable td:nth-child(4)::before { content: 'Produtos'; }
#ordersTable td:nth-child(5)::before { content: 'Total'; }
#ordersTable td:nth-child(6)::before { content: 'Pagamento'; }
#ordersTable td:nth-child(7)::before { content: 'Andamento'; }
#ordersTable td:nth-child(8)::before { content: 'Vendedora'; }
#ordersTable td:nth-child(9)::before { content: 'Logística'; }
#receivablesTable td:nth-child(1)::before,
#financeTable td:nth-child(2)::before { content: 'Pedido'; }
#receivablesTable td:nth-child(2)::before,
#financeTable td:nth-child(3)::before { content: 'Cliente'; }
#receivablesTable td:nth-child(3)::before { content: 'Data'; }
#receivablesTable td:nth-child(4)::before { content: 'Saldo'; }
#receivablesTable td:nth-child(5)::before { content: 'Próximo passo'; }
#financeTable td:nth-child(1)::before { content: 'Data'; }
#financeTable td:nth-child(4)::before { content: 'Forma'; }
#financeTable td:nth-child(5)::before { content: 'Referência'; }
#financeTable td:nth-child(6)::before { content: 'Valor'; }
#financeTable td:nth-child(7)::before { content: 'Situação'; }
#financeTable td:nth-child(8)::before { content: 'Ação'; }
#shipmentsTable td:nth-child(1)::before { content: 'Entrega'; }
#shipmentsTable td:nth-child(2)::before { content: 'Pedido'; }
#shipmentsTable td:nth-child(3)::before { content: 'Cliente'; }
#shipmentsTable td:nth-child(4)::before { content: 'Transportadora'; }
#shipmentsTable td:nth-child(5)::before { content: 'Rastreio'; }
#shipmentsTable td:nth-child(6)::before { content: 'Previsão'; }
#shipmentsTable td:nth-child(7)::before { content: 'Situação'; }
#commissionsTable td:nth-child(1)::before { content: 'Vendedora'; }
#commissionsTable td:nth-child(2)::before { content: 'Indicador'; }
#commissionsTable td:nth-child(3)::before { content: 'Período'; }
#commissionsTable td:nth-child(4)::before { content: 'Vendas'; }
#commissionsTable td:nth-child(5)::before { content: 'Base'; }
#commissionsTable td:nth-child(6)::before { content: 'Taxa'; }
#commissionsTable td:nth-child(7)::before { content: 'Comissão'; }
#commissionsTable td:nth-child(8)::before { content: 'Situação'; }
#commissionsTable td:nth-child(9)::before { content: 'Próximo passo'; }

@media (min-width: 480px) {
  .crm-quick-guide,
  .crm-kpi-grid,
  .crm-kpi-grid.compact,
  .crm-mini-kpis,
  .crm-client-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 700px) {
  .crm-main { padding: 34px 24px; }
  .crm-page-header { align-items: center; flex-direction: row; }
  .crm-header-actions { align-items: center; justify-content: flex-end; flex-direction: row; }
  .crm-header-actions .btn,
  .crm-section-heading .btn { width: auto; }
  .crm-section-heading { align-items: center; flex-direction: row; }
  .crm-toolbar { align-items: center; flex-direction: row; }
  .crm-toolbar label:not(.crm-check) { width: auto; min-width: 165px; }
  .crm-search { width: auto; min-width: 220px !important; }
  .crm-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-detail-block.full { grid-column: 1 / -1; }
  .crm-task-form { grid-template-columns: minmax(180px, 1fr) 170px; }
  .crm-sale-item { grid-template-columns: minmax(190px, 1fr) 100px 130px 44px; align-items: end; }
  .crm-sale-item .crm-sale-product { grid-column: auto; }
  .crm-suggestion-layout { grid-template-columns: minmax(300px, .42fr) minmax(0, 1fr); }
  .crm-suggestion-list-column { border-right: 1px solid var(--border-color); border-bottom: 0; }
  .crm-pagination { align-items: center; }
  .crm-pagination .btn { width: auto; min-width: 220px; }
  .crm-revision-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-revision-fields .form-group.crm-revision-wide { grid-column: 1 / -1; }
  .crm-drawer { width: min(720px, 94vw); }
  .crm-stock-projection,
  .crm-status-transition { grid-template-columns: auto minmax(0, 1fr) auto auto minmax(0, 1fr); }
  .crm-stock-projection svg,
  .crm-status-transition svg { display: block; }

}

@media (min-width: 900px) {
  .crm-page .table-container { overflow-x: auto; }
  .crm-page .crm-table { display: table; min-width: 760px; }
  .crm-page .crm-table thead { position: static; display: table-header-group; width: auto; height: auto; clip: auto; white-space: normal; }
  .crm-page .crm-table tbody { display: table-row-group; }
  .crm-page .crm-table tbody tr { display: table-row; margin: 0; padding: 0; background: transparent; border: 0; }
  .crm-page .crm-table tbody td { display: table-cell; min-height: 0; padding: 10px 12px; border-bottom: 1px solid var(--border-color); font-size: 14px; }
  .crm-page .crm-table tbody td::before,
  .crm-page .crm-table tbody td[data-label]::before { content: none !important; }
}

@media (min-width: 1100px) {
  .crm-main { padding-right: 34px; padding-left: 34px; }
  .crm-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .crm-kpi-grid.compact,
  .crm-mini-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .crm-task-form { grid-template-columns: minmax(180px, 1fr) 170px 170px auto; }
}

@media (min-width: 1380px) {
  .crm-kpi-grid { grid-template-columns: repeat(6, minmax(150px, 1fr)); }
}

/* Logística: controles operacionais mobile first */
.crm-shipping-policy {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--crm-teal) 8%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--crm-teal) 28%, var(--border-color));
  border-radius: 12px;
}

.crm-shipping-policy > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.crm-shipping-policy strong { color: var(--crm-teal); font-size: 18px; }
.crm-shipping-policy p { margin: 0; }

.crm-melhor-envio-sandbox {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--primary-color) 34%, var(--border-color));
}

.crm-melhor-envio-sandbox[hidden] { display: none !important; }

.crm-melhor-envio-sandbox-heading {
  display: grid;
  gap: 12px;
  align-items: start;
}

.crm-sandbox-badge,
.crm-sandbox-connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.crm-sandbox-badge {
  margin-bottom: 8px;
  color: #815900;
  background: #fff3cd;
  border: 1px solid #f1d47a;
}

.crm-sandbox-badge svg { width: 17px; height: 17px; }

.crm-sandbox-connection {
  color: var(--text-secondary);
  background: var(--bg-main);
  border: 1px solid var(--border-color);
}

.crm-sandbox-connection.is-connected {
  color: #066f56;
  background: color-mix(in srgb, #22a77a 12%, var(--bg-card));
  border-color: color-mix(in srgb, #22a77a 42%, var(--border-color));
}

.crm-sandbox-connection.is-disconnected,
.crm-sandbox-connection.is-error {
  color: #9b3a32;
  background: color-mix(in srgb, #df665d 10%, var(--bg-card));
  border-color: color-mix(in srgb, #df665d 36%, var(--border-color));
}

.crm-sandbox-status-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 0 16px;
}

.crm-sandbox-status-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.crm-sandbox-status-grid span,
.crm-sandbox-actions p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.45;
}

.crm-sandbox-status-grid strong { overflow-wrap: anywhere; }

.crm-sandbox-actions {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 0 16px 16px;
}

.crm-sandbox-actions p { margin: 0; }
.crm-sandbox-actions .btn { width: 100%; min-height: 44px; white-space: normal; }

.crm-sandbox-fixtures {
  display: grid;
  gap: 12px;
  margin: 0 16px 16px;
  padding: 16px;
  background: color-mix(in srgb, #f5b700 6%, var(--bg-main));
  border: 1px solid color-mix(in srgb, #d59c00 30%, var(--border-color));
  border-radius: 12px;
}

.crm-sandbox-fixtures-heading {
  display: grid;
  gap: 12px;
  align-items: start;
}

.crm-sandbox-fixtures-heading h4 { margin: 0 0 4px; }
.crm-sandbox-fixtures-heading p,
.crm-sandbox-fixtures-status,
.crm-sandbox-fixture p,
.crm-sandbox-fixture small {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.45;
}

.crm-sandbox-fixtures-heading .btn { width: 100%; min-height: 44px; white-space: normal; }
.crm-sandbox-fixtures-list { display: grid; gap: 10px; }
.crm-sandbox-fixtures-empty { min-height: 130px; }

.crm-sandbox-fixture {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.crm-sandbox-fixture > div:first-child { display: grid; gap: 4px; min-width: 0; }
.crm-sandbox-fixture-marker {
  width: fit-content;
  color: #815900;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.crm-sandbox-fixture-actions { display: grid; gap: 8px; }
.crm-sandbox-fixture-actions .btn { width: 100%; min-height: 44px; white-space: normal; }

.crm-package-fixed-note { margin: 0 0 12px; }
.crm-package-grid .form-control[readonly] {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--primary-color) 5%, var(--bg-main));
  border-style: dashed;
  cursor: default;
}

.crm-logistics-actions {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.crm-logistics-actions .btn { width: 100%; min-height: 44px; white-space: normal; }
.crm-logistics-state { color: var(--text-secondary); font-size: 14px; line-height: 1.4; }

.crm-logistics-steps {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.crm-logistics-steps li {
  padding: 10px 12px;
  color: var(--text-secondary);
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
}

.crm-logistics-steps li.is-current {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--primary-color) 10%, var(--bg-card));
  border-color: color-mix(in srgb, var(--primary-color) 45%, var(--border-color));
}

.crm-logistics-steps li.is-complete { color: var(--crm-teal); }

.crm-package-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.crm-logistics-quotes { display: grid; gap: 10px; }

.crm-logistics-quote {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 54px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
}

.crm-logistics-quote:has(input:checked) {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 18%, transparent);
}

.crm-logistics-quote input { width: 20px; height: 20px; margin-top: 2px; }
.crm-logistics-quote-copy { display: grid; gap: 5px; min-width: 0; }
.crm-logistics-quote-main { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; }
.crm-logistics-quote-meta { display: flex; flex-wrap: wrap; gap: 6px; color: var(--text-secondary); font-size: 14px; }
.crm-logistics-chip { padding: 3px 7px; color: var(--primary-color); background: color-mix(in srgb, var(--primary-color) 10%, transparent); border-radius: 999px; font-size: 14px; font-weight: 800; }

.crm-logistics-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.crm-logistics-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.crm-logistics-ack { align-items: flex-start; min-height: 44px; }
.crm-logistics-ack input { flex: 0 0 auto; width: 20px; height: 20px; }

.crm-logistics-review { margin-bottom: 16px; }
.crm-logistics-review-list { display: grid; gap: 10px; padding: 0 16px 16px; }
.crm-logistics-review-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: color-mix(in srgb, var(--warning-color, #ff9500) 7%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--warning-color, #ff9500) 32%, var(--border-color));
  border-radius: 12px;
}
.crm-logistics-review-item > div:first-child { display: grid; gap: 4px; min-width: 0; }
.crm-logistics-review-item span,
.crm-logistics-review-item small { color: var(--text-secondary); line-height: 1.4; }
.crm-logistics-review-actions { display: grid; gap: 8px; }
.crm-logistics-review-actions .btn { width: 100%; min-height: 44px; white-space: normal; }

@media (min-width: 480px) {
  .crm-package-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 700px) {
  .crm-shipping-policy { grid-template-columns: minmax(180px, .35fr) minmax(0, 1fr); align-items: center; }
  .crm-melhor-envio-sandbox-heading { grid-template-columns: minmax(0, 1fr) auto; }
  .crm-sandbox-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-sandbox-actions { grid-template-columns: minmax(0, 1fr) auto; }
  .crm-sandbox-actions .btn { width: auto; }
  .crm-sandbox-fixtures-heading { grid-template-columns: minmax(0, 1fr) auto; }
  .crm-sandbox-fixtures-heading .btn { width: auto; }
  .crm-sandbox-fixture { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .crm-sandbox-fixture-actions { grid-template-columns: repeat(2, auto); }
  .crm-sandbox-fixture-actions .btn { width: auto; }
  .crm-logistics-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .crm-package-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .crm-logistics-actions .btn { width: auto; }
  .crm-logistics-review-item { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .crm-logistics-review-actions { grid-template-columns: repeat(3, auto); }
  .crm-logistics-review-actions .btn { width: auto; }
  .crm-order-payment .btn { width: auto; }
}

@media (min-width: 1100px) {
  .crm-sandbox-status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* CRM: piso tipográfico dos seletores ativos (QA-39) */
.crm-page .crm-eyebrow,
.crm-page .crm-sync-status,
.crm-page .crm-local-notice,
.crm-page .crm-quick-guide > strong,
.crm-page .crm-quick-guide button,
.crm-page .crm-tab,
.crm-page .crm-alert,
.crm-page .crm-kpi-trend,
.crm-page .crm-kpi-label,
.crm-page .crm-card-heading p,
.crm-page .crm-section-heading p,
.crm-page .crm-funnel-label strong,
.crm-page .crm-funnel-label span,
.crm-page .crm-funnel-fill,
.crm-page .crm-funnel-value,
.crm-page .crm-retention-copy p,
.crm-page .crm-metric-row,
.crm-page .crm-attention-item strong,
.crm-page .crm-attention-item span,
.crm-page .crm-timeline-copy strong,
.crm-page .crm-timeline-copy p,
.crm-page .crm-timeline-copy time,
.crm-page .crm-check,
.crm-page .crm-result-count,
.crm-page .crm-client-cell strong,
.crm-page .crm-client-cell span,
.crm-page .crm-avatar,
.crm-page .crm-tag,
.crm-page .crm-stage,
.crm-page .crm-status-select,
.crm-page .crm-muted,
.crm-page .crm-code,
.crm-page .crm-mini-kpi span,
.crm-page .crm-loading-state p,
.crm-page .crm-empty-state p,
.crm-page .crm-error-state p,
.crm-page .crm-empty-state strong,
.crm-page .crm-error-state strong,
.crm-page .crm-client-identity p,
.crm-page .crm-client-stat span,
.crm-page .crm-client-stat strong,
.crm-page .crm-client-tab,
.crm-page .crm-detail-block h3,
.crm-page .crm-field,
.crm-page .crm-interest-card strong,
.crm-page .crm-interest-card span,
.crm-page .crm-task-item strong,
.crm-page .crm-task-item span,
.crm-page .crm-form-hint,
.crm-page .crm-form-help,
.crm-page .crm-form-section-title,
.crm-page .crm-form-section-title > span,
.crm-page .crm-sale-item label,
.crm-page .crm-sale-total,
.crm-page .crm-stock-help,
.crm-page .crm-tab-count,
.crm-page .crm-review-intro p,
.crm-page .crm-review-steps li > span,
.crm-page .crm-review-steps strong,
.crm-page .crm-review-steps small,
.crm-page .crm-ai-guardrail strong,
.crm-page .crm-ai-guardrail span,
.crm-page .crm-suggestion-toolbar label > span,
.crm-page .crm-suggestion-type,
.crm-page .crm-confidence-chip,
.crm-page .crm-suggestion-item p,
.crm-page .crm-suggestion-reason span,
.crm-page .crm-suggestion-reason strong,
.crm-page .crm-suggestion-item-meta,
.crm-page .crm-suggestion-detail-header p,
.crm-page .crm-confidence > small,
.crm-page .crm-confidence-row,
.crm-page .crm-suggestion-block h4,
.crm-page .crm-suggestion-why strong,
.crm-page .crm-suggestion-why p,
.crm-page .crm-suggestion-evidence summary,
.crm-page .crm-decision-guide strong,
.crm-page .crm-decision-guide span,
.crm-page .crm-proposed-reply,
.crm-page .crm-proposal-field span,
.crm-page .crm-evidence-item span,
.crm-page .crm-proposal-field strong,
.crm-page .crm-evidence-item strong,
.crm-page .crm-suggestion-resolved,
.crm-page .crm-review-summary,
.crm-page .crm-order-move-transition span,
.crm-page .crm-order-move-transition strong,
.crm-page .crm-order-move-meta span,
.crm-page .crm-order-move-total span,
.crm-page .crm-order-move-meta strong,
.crm-page .crm-order-move-items h3,
.crm-page .crm-order-move-impact-info,
.crm-page .crm-order-move-item strong,
.crm-page .crm-order-move-item span,
.crm-page .crm-order-move-empty,
.crm-page .crm-order-move-financials > div,
.crm-page .crm-order-move-progress,
.crm-page .crm-revision-readonly,
.crm-page .crm-revision-item,
.crm-page .crm-commerce-signal p,
.crm-page .crm-payment-link-chip {
  font-size: 14px;
  line-height: 1.45;
}

.crm-page .crm-account-scope {
  display: grid;
  gap: 4px;
  width: 100%;
  font-size: 14px;
  line-height: 1.45;
}

.crm-page .crm-account-scope[hidden] { display: none; }
.crm-page .crm-account-scope > span { font-weight: 700; }
.crm-page .crm-account-scope small { color: var(--text-secondary); font-size: 14px; }
.crm-page .crm-account-scope select { min-height: 44px; font-size: 16px; }

@media (min-width: 700px) {
  .crm-page .crm-account-scope { width: min(320px, 100%); }
}
