*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #25D366;
  --green-dark: #128C7E;
  --green-light: #dcfce7;
  --blue: #1B6CA8;
  --blue-light: #dbeafe;
  --yellow: #F59E0B;
  --yellow-light: #fef9c3;
  --red: #EF4444;
  --red-light: #fee2e2;
  --purple: #8B5CF6;
  --purple-light: #ede9fe;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #1A1A2E;
  --muted: #6B7280;
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --radius: 12px;
  --shadow: 0 1px 4px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.05);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width 0.25s ease;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-info,
.sidebar.collapsed .badge { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .user-chip { justify-content: center; padding: 12px 0; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; cursor: default; }
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: 18px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-text {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}
.sidebar-toggle {
  background: none; border: none;
  cursor: pointer; font-size: 18px;
  color: var(--muted); padding: 4px;
  border-radius: 6px;
  transition: background 0.15s;
}
.sidebar-toggle:hover { background: var(--bg); }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, #e8faf2, #d1fae5);
  color: var(--green-dark);
  font-weight: 600;
}
.nav-icon { font-size: 18px; flex-shrink: 0; }
.nav-divider { height: 1px; background: var(--border); margin: 8px 4px; }
.badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.user-chip:hover { background: var(--bg); }
.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: white;
  font-weight: 700;
  font-size: 14px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role { font-size: 11px; color: var(--muted); }

/* ── MAIN ─────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
  min-width: 0;
  overflow-x: hidden;
}
.sidebar.collapsed ~ .main { margin-left: 64px; }

/* No mobile, o main nunca recebe margem — JS não adiciona collapsed */
@media (max-width: 768px) {
  .main,
  .sidebar.collapsed ~ .main,
  .sidebar ~ .main { margin-left: 0 !important; }
}

/* ── TOPBAR ───────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.page-title {
  font-family: 'Sora', sans-serif;
  font-size: 18px; font-weight: 700;
}
.page-subtitle { font-size: 12px; color: var(--muted); display: block; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.search-wrap {
  position: relative;
  display: flex; align-items: center;
}
.search-icon { position: absolute; left: 10px; font-size: 14px; color: var(--muted); pointer-events: none; }
.search-input {
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  width: 220px;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--green); }
.btn-icon {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px;
  transition: background 0.15s;
}
.btn-icon:hover { background: var(--border); }

/* ── BUTTONS ──────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--border); }
.btn-link {
  background: none; border: none;
  color: var(--green-dark); font-size: 13px;
  font-weight: 500; cursor: pointer;
  transition: opacity 0.15s;
}
.btn-link:hover { opacity: 0.7; }
.btn-danger {
  background: var(--red);
  color: white; border: none;
  border-radius: 8px; padding: 6px 14px;
  font-size: 12px; cursor: pointer;
}

/* ── PAGE CONTENT ─────────────────────────── */
.page-content { padding: 24px; flex: 1; }
.page { display: none; }
.page.active { display: block; }

/* ── METRICS ──────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) { .metrics-grid { grid-template-columns: repeat(2,1fr); } }

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.metric-card:hover { transform: translateY(-2px); }
.metric-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.metric-icon.green { background: var(--green-light); }
.metric-icon.blue { background: var(--blue-light); }
.metric-icon.yellow { background: var(--yellow-light); }
.metric-icon.purple { background: var(--purple-light); }
.metric-icon.red { background: var(--red-light); }
.metric-value {
  font-family: 'Sora', sans-serif;
  font-size: 26px; font-weight: 700;
  line-height: 1;
}
.metric-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.metric-delta { font-size: 11px; margin-top: 6px; font-weight: 500; }
.metric-delta.positive { color: var(--green-dark); }
.metric-delta.negative { color: var(--red); }
.metric-delta.neutral { color: var(--muted); }

/* ── CARDS ────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-family: 'Sora', sans-serif; font-size: 15px; font-weight: 700; }
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* ── TABLES ───────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg); }
.data-table tr:last-child td { border-bottom: none; }

/* ── CLIENT LIST MINI ─────────────────────── */
.client-list { display: flex; flex-direction: column; gap: 8px; }
.client-mini {
  display: flex; align-items: center; gap: 12px;
  padding: 10px;
  border-radius: 10px;
  transition: background 0.15s;
  cursor: pointer;
}
.client-mini:hover { background: var(--bg); }
.client-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--green-light), #bbf7d0);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  color: var(--green-dark); flex-shrink: 0;
}
.client-info { flex: 1; }
.client-info-name { font-size: 13px; font-weight: 600; }
.client-info-sub { font-size: 11px; color: var(--muted); }

/* ── TASK LIST MINI ───────────────────────── */
.task-list-mini { display: flex; flex-direction: column; gap: 8px; }
.task-mini {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
}
.task-mini-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.task-mini-dot.urgente { background: var(--red); }
.task-mini-dot.normal { background: var(--yellow); }
.task-mini-dot.baixa { background: var(--green); }
.task-mini-text { flex: 1; }
.task-mini-cliente { font-size: 11px; color: var(--muted); }

/* ── STATUS BADGES ────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.status-badge.ativo { background: var(--green-light); color: var(--green-dark); }
.status-badge.inadimplente { background: var(--red-light); color: var(--red); }
.status-badge.pendente { background: var(--yellow-light); color: #92400e; }
.status-badge.cancelado { background: #f3f4f6; color: var(--muted); }
.status-badge.concluida { background: var(--blue-light); color: var(--blue); }

/* ── FILTERS ──────────────────────────────── */
.filters-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.filter-tabs { display: flex; gap: 4px; }
.filter-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 500;
  cursor: pointer; color: var(--muted);
  transition: all 0.15s;
}
.filter-tab.active {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white; border-color: transparent;
}
.filter-search {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px; font-family: 'Inter', sans-serif;
  color: var(--text); background: var(--surface);
  outline: none; min-width: 220px;
}
.filter-search:focus { border-color: var(--green); }
.doc-filters { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }

/* ── TASKS GRID ───────────────────────────── */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.task-card:hover { transform: translateY(-2px); }
.task-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.task-card-title { font-weight: 600; font-size: 14px; }
.task-card-cliente { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.task-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.priority-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
}
.priority-badge.urgente { background: var(--red-light); color: var(--red); }
.priority-badge.normal { background: var(--yellow-light); color: #92400e; }
.priority-badge.baixa { background: var(--green-light); color: var(--green-dark); }

/* ── CONVERSAS ────────────────────────────── */
.conversas-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: calc(100vh - var(--topbar-h) - 80px);
}
.conversas-lista {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.conversa-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.conversa-item:hover, .conversa-item.active { background: var(--bg); }
.conversa-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white; font-size: 16px; flex-shrink: 0;
}
.conversa-nome { font-size: 13px; font-weight: 600; }
.conversa-ultima { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversas-chat { display: flex; flex-direction: column; }
.chat-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--muted); gap: 12px;
}
.chat-messages {
  flex: 1; padding: 20px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.msg { max-width: 70%; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.msg.received { background: var(--bg); border: 1px solid var(--border); align-self: flex-start; border-radius: 4px 12px 12px 12px; }
.msg.sent { background: linear-gradient(135deg, #d1fae5, #a7f3d0); align-self: flex-end; border-radius: 12px 4px 12px 12px; }
.msg-time { font-size: 10px; color: var(--muted); margin-top: 4px; }
.chat-input-wrap {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center;
}
.chat-input {
  flex: 1; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 20px;
  font-family: 'Inter', sans-serif; font-size: 13px;
  color: var(--text); outline: none;
}
.chat-input:focus { border-color: var(--green); }

/* ── DOCS GRID ────────────────────────────── */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}
.doc-card:hover { transform: translateY(-3px); border-color: var(--green); }
.doc-icon { font-size: 36px; margin-bottom: 10px; }
.doc-nome { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.doc-meta { font-size: 11px; color: var(--muted); }

/* ── CONFIG ───────────────────────────────── */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.config-list { display: flex; flex-direction: column; gap: 12px; }
.config-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.config-item:last-child { border-bottom: none; }
.config-name { font-size: 13px; font-weight: 600; }
.config-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.planos-list { display: flex; flex-direction: column; gap: 10px; }
.plano-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s;
}
.plano-item.destaque { border-color: var(--green); background: var(--green-light); }
.plano-nome { font-size: 13px; font-weight: 700; }
.plano-preco { font-size: 18px; font-weight: 800; color: var(--green-dark); margin: 4px 0; }
.plano-desc { font-size: 11px; color: var(--muted); }

/* ── MODAL ────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; animation: fadeIn 0.2s ease; }
.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 560px; max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: slideUp 0.2s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 700; }
.modal-close {
  background: var(--bg); border: none;
  width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer;
  font-size: 14px; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--muted); }
.form-input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px; color: var(--text);
  outline: none; background: var(--bg);
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--green); }

/* ── TOAST ────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 9999;
  max-width: 300px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── UTILS ────────────────────────────────── */
.loading { text-align: center; padding: 24px; color: var(--muted); font-size: 13px; }
.empty { text-align: center; padding: 32px; color: var(--muted); font-size: 13px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── VENCIMENTOS ──────────────────────────── */
.venc-list { display: flex; flex-direction: column; gap: 8px; }
.venc-item {

/* ══════════════════════════════════════════
   RESPONSIVO — MOBILE FIRST
   ══════════════════════════════════════════ */

/* Overlay escuro para fechar sidebar */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}
.sidebar-overlay.open { display: block; }

/* ── TABLET (até 1024px) ── */
@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── MOBILE (até 768px) ── */
@media (max-width: 768px) {

  /* Sem overflow horizontal em lugar nenhum */
  html, body { overflow-x: hidden; width: 100%; }

  /* SIDEBAR: drawer oculto por padrão */
  .sidebar {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: 260px !important;
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    z-index: 200;
    /* Mostrar labels que ficavam ocultos no collapsed */
  }
  .sidebar .logo-text,
  .sidebar .nav-label,
  .sidebar .user-info,
  .sidebar .badge { display: flex !important; }
  .sidebar .sidebar-header { justify-content: space-between !important; padding: 20px 16px 16px !important; }
  .sidebar .nav-item { justify-content: flex-start !important; padding: 10px 12px !important; }
  .sidebar .user-chip { justify-content: flex-start !important; padding: 8px 12px !important; }

  /* Quando aberta */
  .sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  /* MAIN: ocupa 100% sempre */
  .main {
    margin-left: 0 !important;
    width: 100% !important;
    overflow-x: hidden;
  }

  /* TOPBAR */
  .topbar {
    padding: 0 14px;
    height: 56px;
    position: sticky; top: 0; z-index: 90;
  }
  .page-title { font-size: 16px; }
  .page-subtitle { display: none; }
  .search-wrap { display: none; }
  .topbar-right { gap: 8px; }

  /* CONTEÚDO */
  .page-content { padding: 12px; }

  /* METRICS */
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
  .metric-card { padding: 14px; gap: 10px; }
  .metric-value { font-size: 20px; }
  .metric-icon { width: 36px; height: 36px; font-size: 16px; }

  /* GRIDS */
  .dash-grid { grid-template-columns: 1fr; gap: 12px; }
  .tasks-grid { grid-template-columns: 1fr; }
  .config-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }

  /* CARDS */
  .card { padding: 14px; }
  .card-header { flex-wrap: wrap; gap: 8px; }

  /* TABELA: scroll horizontal */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 500px; }

  /* FILTROS */
  .filters-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .filter-tabs { overflow-x: auto; width: 100%; padding-bottom: 4px; flex-wrap: nowrap; }
  .filter-search { width: 100%; }

  /* DOCS */
  .docs-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* CONVERSAS */
  .conversas-layout { grid-template-columns: 1fr; height: auto; }
  .conversas-lista { max-height: 220px; }

  /* MODAL */
  .modal { width: 96vw; max-width: 96vw; margin: 4vh auto; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }

  /* TOAST */
  .toast { left: 12px; right: 12px; bottom: 16px; text-align: center; max-width: none; }

  /* VENCIMENTOS */
  .venc-item { flex-direction: column; align-items: flex-start; gap: 4px; }
  .venc-item button { width: 100%; }
}

/* ── EXTRA PEQUENO (até 480px) ── */
@media (max-width: 480px) {
  .metrics-grid { gap: 8px; }
  .metric-card { padding: 12px; }
  .metric-value { font-size: 18px; }
  .docs-grid { grid-template-columns: repeat(2, 1fr); }
  .btn-primary, .btn-secondary { padding: 8px 12px; font-size: 12px; }
}

/* ══════════════════════════════════════════
   OVERRIDE MOBILE ABSOLUTO — não remover
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { display: none !important; }
  .main, .sidebar ~ .main, .sidebar.collapsed ~ .main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }
  body, html { overflow-x: hidden !important; }
}
