/* ============================================================
   EMPÓRIO KAMINSKI — style.css
   ============================================================ */

/* --- Variables --- */
:root {
  --primary:       #6C1A2A;
  --primary-dark:  #531422;
  --primary-light: #8a2535;
  --primary-50:    rgba(108, 26, 42, 0.05);
  --primary-100:   rgba(108, 26, 42, 0.12);
  --accent:        #C9A84C;

  --bg:            #F0F2F5;
  --bg-white:      #FFFFFF;
  --bg-hover:      #F8F8F9;

  --text-primary:  #1A1A2E;
  --text-secondary:#5A6070;
  --text-muted:    #9CA3AF;

  --border:        #E5E7EB;
  --border-light:  #F3F4F6;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.14);

  --radius-sm:   6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full:9999px;

  --transition: 0.18s ease;

  --nav-h: 62px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a  { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  background: var(--primary);
  height: var(--nav-h);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  flex-shrink: 0;
}

.navbar-logo {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  object-fit: contain;
  flex-shrink: 0;
}

.navbar-brand-text  { display: flex; flex-direction: column; line-height: 1.2; }
.navbar-brand-name  { font-weight: 700; font-size: 0.875rem; letter-spacing: 0.03em; color: white; }
.navbar-brand-sub   { font-size: 0.6rem; letter-spacing: 0.18em; color: rgba(255,255,255,0.55); text-transform: uppercase; }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-link i { font-size: 0.75rem; }
.nav-link:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-link.active {
  color: white;
  position: relative;
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  width: 55%;
  height: 2px;
  background: white;
  border-radius: 2px 2px 0 0;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.page-wrapper {
  padding: 2rem;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.page-header { margin-bottom: 1.75rem; }
.page-header h1 { font-size: 1.625rem; font-weight: 700; }
.page-header p  { color: var(--text-secondary); font-size: 0.875rem; margin-top: 0.2rem; }

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-weight: 700; font-size: 0.9375rem; color: var(--text-primary); }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}
.stat-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}
.stat-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
}
.stat-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  line-height: 1;
}
.stat-badge-up {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #059669;
  background: #D1FAE5;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.525rem 1.05rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  line-height: 1;
  white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-white); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8125rem; }
.btn-icon { padding: 0.45rem; border-radius: var(--radius-sm); color: var(--text-secondary); }
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.23rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
/* Status */
.badge-novo      { background: #F3F4F6; color: #4B5563; }
.badge-producao  { background: #FEF3C7; color: #92400E; }
.badge-montagem  { background: #DBEAFE; color: #1E40AF; }
.badge-pronto    { background: #D1FAE5; color: #065F46; }
.badge-rota      { background: #EDE9FE; color: #5B21B6; }
.badge-entregue  { background: #F3F4F6; color: #374151; }
.badge-cancelado { background: #FEE2E2; color: #991B1B; }
/* Segment */
.badge-vip        { background: #FEF3C7; color: #78350F; }
.badge-recorrente { background: #DBEAFE; color: #1E40AF; }
.badge-ocasional  { background: #F3F4F6; color: #374151; }
.badge-inativo    { background: #F9FAFB; color: #9CA3AF; border: 1px solid var(--border); }
/* Chat type */
.badge-ia     { background: #EDE9FE; color: #5B21B6; }
.badge-humano { background: #F3F4F6; color: #374151; }

/* ============================================================
   INPUTS
   ============================================================ */
.input-wrap { position: relative; }
.input-wrap .icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.8125rem; pointer-events: none; }
.input-field {
  width: 100%;
  padding: 0.55rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-white);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-field::placeholder { color: var(--text-muted); }
.input-field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.input-wrap .input-field { padding-left: 2.25rem; }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border); }
th {
  padding: 0.875rem 1.125rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
  user-select: none;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text-secondary); }
th .sort-icon { margin-left: 0.25rem; font-size: 0.625rem; opacity: 0.5; }
th.sorted .sort-icon { opacity: 1; color: var(--primary); }
td {
  padding: 0.875rem 1.125rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-hover); }
.td-name { font-weight: 600; }
.td-muted { color: var(--text-secondary); }
.td-value { font-weight: 700; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 860px) { .dash-grid { grid-template-columns: 1fr; } }

.order-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.375rem;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
  cursor: pointer;
}
.order-row:last-child { border-bottom: none; }
.order-row:hover { background: var(--bg-hover); }
.order-ico {
  width: 36px;
  height: 36px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
  flex-shrink: 0;
}
.order-info { flex: 1; min-width: 0; }
.order-info .name  { font-weight: 600; font-size: 0.875rem; }
.order-info .desc  { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }
.order-price { font-weight: 700; font-size: 0.875rem; }

.conv-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1.375rem;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
  cursor: pointer;
}
.conv-row:last-child { border-bottom: none; }
.conv-row:hover { background: var(--bg-hover); }
.conv-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  flex-shrink: 0;
}
.conv-av.bot { background: var(--primary-50); color: var(--primary); }
.conv-body { flex: 1; min-width: 0; }
.conv-body .name    { font-weight: 600; font-size: 0.875rem; }
.conv-body .preview { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.375rem; flex-shrink: 0; }
.conv-meta .time { font-size: 0.6875rem; color: var(--text-muted); }
.conv-meta .dot  { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }

/* ============================================================
   ATENDIMENTO
   ============================================================ */
.at-layout {
  display: grid;
  grid-template-columns: 295px 1fr 272px;
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}

/* Left sidebar */
.at-sidebar {
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.at-sidebar-head {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.at-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.at-tab {
  flex: 1;
  text-align: center;
  padding: 0.35rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.at-tab.active { background: var(--bg-white); color: var(--text-primary); box-shadow: var(--shadow-sm); }

.at-conv-list { flex: 1; overflow-y: auto; }
.at-conv-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background var(--transition);
}
.at-conv-item:hover { background: var(--bg-hover); }
.at-conv-item.active { background: var(--primary-50); border-left-color: var(--primary); }
.at-conv-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  flex-shrink: 0;
}
.at-conv-av.bot { background: var(--primary-50); color: var(--primary); }
.at-conv-body { flex: 1; min-width: 0; }
.at-conv-name    { font-weight: 600; font-size: 0.875rem; }
.at-conv-preview { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-conv-meta  { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; flex-shrink: 0; }
.at-conv-meta .time { font-size: 0.6875rem; color: var(--text-muted); }
.at-conv-meta .dot  { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }

/* Chat area */
.at-chat {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.at-chat-head {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.at-chat-head-info .client-name  { font-weight: 700; font-size: 0.9375rem; }
.at-chat-head-info .client-phone { font-size: 0.8125rem; color: var(--text-muted); }
.at-chat-head-actions { display: flex; align-items: center; gap: 0.25rem; }

.at-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.msg-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 68%;
}
.msg-wrap.out { align-self: flex-end; flex-direction: row-reverse; }
.msg-wrap.in  { align-self: flex-start; }

.msg-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-white);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.msg-av.bot { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); }

.msg-bubble {
  padding: 0.7rem 1rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.5;
  max-width: 100%;
}
.msg-wrap.in  .msg-bubble { background: var(--bg-white); box-shadow: var(--shadow-sm); border-bottom-left-radius: 4px; }
.msg-wrap.out .msg-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }

.at-input-bar {
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.at-input-actions { display: flex; gap: 0.375rem; }
.at-chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.6rem 1.125rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
}
.at-chat-input:focus { border-color: var(--primary); }
.btn-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem;
  transition: background var(--transition);
  flex-shrink: 0;
}
.btn-send:hover { background: var(--primary-dark); }

/* Right client panel */
.at-panel {
  background: var(--bg-white);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.375rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.client-panel-name { font-weight: 700; font-size: 1rem; }
.client-panel-detail {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}
.client-panel-detail i { font-size: 0.75rem; color: var(--text-muted); }
.client-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}
.client-stat {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}
.client-stat .val { font-size: 1.375rem; font-weight: 700; }
.client-stat .lbl { font-size: 0.6875rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.2rem; }
.divider { height: 1px; background: var(--border-light); }
.panel-section-title { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-muted); margin-bottom: 0.625rem; }
.client-order-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.875rem;
  margin-bottom: 0.5rem;
}
.client-order-head { display: flex; justify-content: space-between; font-size: 0.8125rem; font-weight: 600; }
.client-order-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.btn-create-order {
  width: 100%;
  background: var(--primary);
  color: white;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  display: flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  transition: background var(--transition);
}
.btn-create-order:hover { background: var(--primary-dark); }

/* ============================================================
   PEDIDOS — KANBAN
   ============================================================ */
.pedidos-page {
  padding: 2rem;
  overflow-x: auto;
  min-height: calc(100vh - var(--nav-h));
}
.pedidos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.kanban-board {
  display: flex;
  gap: 1rem;
  min-width: max-content;
  align-items: flex-start;
}

.k-col {
  width: 235px;
  flex-shrink: 0;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 185px);
  box-shadow: var(--shadow-sm);
}
.k-col-head {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--bg-white);
}
.k-col-title { font-weight: 600; font-size: 0.875rem; }
.k-count {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
}
.k-cards {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  min-height: 80px;
}
.k-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  cursor: grab;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.k-card:hover     { box-shadow: var(--shadow-md); border-color: #d1d5db; }
.k-card.dragging  { opacity: 0.4; cursor: grabbing; }
.k-card.drag-over { border-color: var(--primary); background: var(--primary-50); }

.k-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.45rem; }
.k-card-id   { font-size: 0.6875rem; font-weight: 700; color: var(--text-muted); }
.k-card-ico  { color: var(--text-muted); font-size: 0.875rem; }
.k-card-name { font-weight: 600; font-size: 0.875rem; }
.k-card-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.k-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.7rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}
.k-card-price { font-weight: 700; font-size: 0.875rem; }
.k-card-time  { font-size: 0.6875rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.25rem; }

.k-drop-hint {
  min-height: 50px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: all var(--transition);
}
.k-cards.drag-over-col .k-drop-hint {
  border-color: var(--primary);
  background: var(--primary-50);
  color: var(--primary);
}

/* ============================================================
   CRM
   ============================================================ */
.crm-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}
.crm-search-wrap { width: 260px; }

/* ============================================================
   INTELIGÊNCIA
   ============================================================ */
.intel-seg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}
@media (max-width: 900px) { .intel-seg-grid { grid-template-columns: repeat(2,1fr); } }

.seg-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.seg-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.625rem; }
.seg-card-ico { font-size: 1.375rem; }
.seg-card-pct { font-size: 0.8125rem; color: var(--text-muted); font-weight: 500; }
.seg-card-val { font-size: 1.875rem; font-weight: 700; line-height: 1; }
.seg-card-lbl { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.25rem; }

.intel-mid-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 860px) { .intel-mid-grid { grid-template-columns: 1fr; } }

.rfm-chart-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.5rem 1rem;
}
.rfm-canvas-wrap { width: 180px; height: 180px; }
.rfm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  justify-content: center;
  margin-top: 1rem;
}
.rfm-legend-item { display: flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; color: var(--text-secondary); }
.rfm-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.birthday-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.375rem;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.birthday-item:last-child { border-bottom: none; }
.birthday-item:hover { background: var(--bg-hover); }
.b-av {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.875rem; flex-shrink: 0;
}
.b-info { flex: 1; }
.b-name  { font-weight: 600; font-size: 0.875rem; }
.b-phone { font-size: 0.75rem; color: var(--text-muted); }
.b-date  { font-size: 0.8125rem; color: var(--text-secondary); }

.featured-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.featured-col { padding: 1.25rem; }
.featured-col:not(:last-child) { border-right: 1px solid var(--border-light); }
.featured-col-title { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-muted); margin-bottom: 0.875rem; }
.featured-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; }
.featured-rank { width: 18px; font-size: 0.6875rem; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.featured-name { flex: 1; font-size: 0.875rem; font-weight: 500; }
.featured-val  { font-size: 0.875rem; font-weight: 700; white-space: nowrap; }

/* ============================================================
   RELATÓRIOS
   ============================================================ */
.rel-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
@media (max-width: 860px) { .rel-grid { grid-template-columns: 1fr; } }
.chart-area { padding: 1.25rem; height: 270px; }

/* ============================================================
   CONFIGURAÇÕES
   ============================================================ */
.config-layout { display: grid; grid-template-columns: 210px 1fr; gap: 1.5rem; }
.config-nav { display: flex; flex-direction: column; gap: 0.125rem; }
.config-nav-item {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.6rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.config-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.config-nav-item.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.config-nav-item i { width: 14px; text-align: center; font-size: 0.8125rem; }

.config-section { display: none; }
.config-section.active { display: block; }
.config-section-title { font-size: 1rem; font-weight: 700; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 500; margin-bottom: 0.35rem; }
.form-helper { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1rem;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 0.625rem;
}
.toggle-row-left .toggle-title { font-size: 0.875rem; font-weight: 500; }
.toggle-row-left .toggle-sub   { font-size: 0.75rem; color: var(--text-muted); }
.toggle {
  position: relative;
  display: inline-block;
  width: 42px; height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.48);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: all var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 530px;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-head {
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-weight: 700; font-size: 1.0625rem; }
.modal-body   { padding: 1.5rem; }
.modal-foot   { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar        { width: 5px; height: 5px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: #D1D5DB; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ============================================================
   UTILITY
   ============================================================ */
.flex        { display: flex; }
.items-center{ align-items: center; }
.gap-2       { gap: 0.5rem; }
.gap-3       { gap: 0.75rem; }
.ml-auto     { margin-left: auto; }
.mt-1        { margin-top: 0.25rem; }
.hidden      { display: none !important; }
.text-sm     { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.font-semibold { font-weight: 600; }
.font-bold   { font-weight: 700; }
.text-muted  { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.w-full      { width: 100%; }

/* ============================================================
   FOCO & ACESSIBILIDADE
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ============================================================
   FEEDBACK DE TOQUE / PRESS
   ============================================================ */
.btn         { user-select: none; }
.btn:active  { transform: scale(0.97); }
.btn-icon:active { transform: scale(0.92); }
.btn-send:active { transform: scale(0.92); }
.k-card { user-select: none; }

/* ============================================================
   TOUCH TARGETS (dispositivos de toque)
   ============================================================ */
@media (pointer: coarse) {
  .btn        { min-height: 44px; }
  .btn-sm     { min-height: 38px; }
  .btn-icon   { min-height: 44px; min-width: 44px; }
  .btn-send   { width: 44px; height: 44px; }
  .nav-link   { min-height: 44px; padding: 0.5rem 0.875rem; }
  .at-tab     { min-height: 38px; }
  .chip       { min-height: 38px; }
  .at-conv-item { padding: 1rem; }
  th, td      { padding: 0.875rem 1rem; }
}

/* ============================================================
   HAMBURGER — MOBILE
   ============================================================ */
.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 1.1875rem;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}
.nav-hamburger:hover  { background: rgba(255,255,255,0.12); }
.nav-hamburger:active { transform: scale(0.93); }

/* ── Mobile overlay ── */
.nav-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  z-index: 198;
  -webkit-tap-highlight-color: transparent;
}
.nav-mobile-overlay.open { display: block; }

/* ── Mobile drawer ── */
.nav-mobile-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 272px;
  background: var(--primary-dark);
  z-index: 199;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.26s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.nav-mobile-drawer.open { transform: translateX(0); }

.nav-drawer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.nav-drawer-links {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.625rem;
  gap: 0.25rem;
  flex: 1;
  overflow-y: auto;
}
.nav-drawer-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.72);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--transition);
  min-height: 48px;
}
.nav-drawer-link i { width: 18px; text-align: center; font-size: 0.875rem; }
.nav-drawer-link:hover  { background: rgba(255,255,255,0.1); color: white; }
.nav-drawer-link.active { background: rgba(255,255,255,0.16); color: white; font-weight: 600; }

/* ============================================================
   BOTÃO VOLTAR MOBILE
   ============================================================ */
.btn-back-mobile {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 1rem;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-back-mobile:hover  { background: var(--bg-hover); color: var(--text-primary); }
.btn-back-mobile:active { transform: scale(0.93); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  pointer-events: none;
}
.toast {
  background: var(--text-primary);
  color: white;
  padding: 0.75rem 1.125rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  pointer-events: auto;
  animation: toastIn 0.22s ease both;
  max-width: 320px;
  line-height: 1.4;
}
.toast.success { background: #059669; }
.toast.error   { background: #DC2626; }
.toast.warning { background: #D97706; }
.toast.info    { background: var(--primary); }
.toast.out     { animation: toastOut 0.22s ease both; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(10px) scale(0.95); } to { opacity:1; transform:none; } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(10px) scale(0.95); } }

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, #f8f9fa 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
}
.skeleton * { visibility: hidden; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  gap: 0.875rem;
}
.empty-state i { font-size: 2.25rem; opacity: 0.3; }
.empty-state p { font-size: 0.875rem; max-width: 220px; line-height: 1.55; color: var(--text-secondary); }

/* ============================================================
   RESPONSIVE — TABLET (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .navbar-nav    { display: none; }
  .nav-hamburger { display: flex; }

  .page-wrapper  { padding: 1.5rem; }

  .stats-grid { grid-template-columns: repeat(3, 1fr); }

  .at-layout { grid-template-columns: 260px 1fr; }
  .at-panel  { display: none; }

  .crm-header-row { flex-wrap: wrap; gap: 0.75rem; }
  .crm-search-wrap { width: 100%; max-width: 360px; }

  .intel-seg-grid { grid-template-columns: repeat(2, 1fr); }

  .featured-grid {
    grid-template-columns: 1fr 1fr;
  }
  .featured-col:nth-child(3) {
    grid-column: 1 / -1;
    border-right: none;
    border-top: 1px solid var(--border-light);
  }
  .featured-col:not(:last-child) { border-right: 1px solid var(--border-light); }
  .featured-col:nth-child(2)     { border-right: none; }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  :root { --nav-h: 56px; }

  /* Layout base */
  .page-wrapper { padding: 1rem; }
  .page-header  { margin-bottom: 1.25rem; }
  .page-header h1 { font-size: 1.375rem; }
  .page-header-row {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  .page-header-row .btn { width: 100%; justify-content: center; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1.25rem; }
  .stat-card  { padding: 1rem; }
  .stat-value { font-size: 1.5rem; }

  /* Dashboard */
  .dash-grid { grid-template-columns: 1fr; }

  /* Atendimento — coluna única com navegação por estado */
  .at-layout {
    grid-template-columns: 1fr;
    position: relative;
    overflow: visible;
    height: auto;
    min-height: calc(100vh - var(--nav-h));
  }
  .at-sidebar {
    height: calc(100vh - var(--nav-h));
    width: 100%;
  }
  .at-chat {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0; bottom: 0;
    z-index: 90;
    flex-direction: column;
  }
  .at-panel {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0; bottom: 0;
    z-index: 91;
    overflow-y: auto;
  }
  .at-layout.chat-active .at-sidebar { display: none; }
  .at-layout.chat-active .at-chat    { display: flex; }
  .btn-back-mobile { display: flex; }

  /* Modal — bottom sheet em mobile */
  .modal-overlay { align-items: flex-end; }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-width: 100%;
    max-height: 92vh;
    overflow-y: auto;
  }

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

  /* Pedidos */
  .pedidos-page         { padding: 1rem; }
  .pedidos-header       { flex-direction: column; gap: 0.75rem; align-items: stretch; }
  .pedidos-header-right { flex-direction: column; align-items: stretch; }
  .pedidos-header-right .btn { justify-content: center; }
  .filter-chips { flex-wrap: wrap; }

  /* CRM */
  .crm-header-row  { flex-direction: column; gap: 0.75rem; }
  .crm-search-wrap { width: 100%; max-width: 100%; }

  /* Inteligência */
  .intel-mid-grid  { grid-template-columns: 1fr; }
  .featured-grid   { grid-template-columns: 1fr; }
  .featured-col    { border-right: none !important; }
  .featured-col:not(:first-child) { border-top: 1px solid var(--border-light); }

  /* Relatórios */
  .rel-grid { grid-template-columns: 1fr; }

  /* Tabelas */
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* Cards */
  .card-header { flex-wrap: wrap; gap: 0.5rem; }
}

/* ============================================================
   RESPONSIVE — MOBILE PEQUENO (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
  .navbar { padding: 0 1rem; }
  .navbar-brand-text { display: none; }
  .navbar-logo { width: 34px; height: 34px; }

  .stats-grid { gap: 0.5rem; }
  .stat-card  { padding: 0.875rem; }
  .stat-value { font-size: 1.375rem; }
  .stat-label { font-size: 0.625rem; }

  .k-col { width: 210px; }

  #toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
  .toast { max-width: 100%; }

  /* Mensagens de chat — largura maior em mobile */
  .msg-wrap { max-width: 88%; }

  /* Config nav na horizontal em mobile pequeno */
  @media (max-width: 480px) {
    .config-layout { grid-template-columns: 1fr; }
  }
}
