/* ===================================================
   CasaGest — Design System v2.0
   =================================================== */

:root {
  --sidebar-width: 240px;
  --topbar-height: 56px;

  /* Colors */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --info: #3b82f6;
  --info-light: #dbeafe;

  /* Background — dark (padrão) */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: #1e293b;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Border */
  --border-color: #334155;
  --border-light: #475569;

  /* Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  /* Shadow */
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
}

/* ===================================================
   TEMA CLARO
   =================================================== */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e2e8f0;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --border-light: #cbd5e1;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
}

[data-theme="light"] #sidebar { background: #fff; }
[data-theme="light"] #topbar { background: #fff; border-bottom-color: #e2e8f0; }
[data-theme="light"] .nav-item:hover { background: #f1f5f9; }
[data-theme="light"] .nav-item.active { background: rgba(99,102,241,0.1); }
[data-theme="light"] .input { background: #f8fafc; border-color: #e2e8f0; color: #0f172a; }
[data-theme="light"] .input:focus { border-color: var(--primary); }
[data-theme="light"] .table th { background: #f1f5f9; color: #475569; }
[data-theme="light"] .table tr:hover { background: #f8fafc; }
[data-theme="light"] .modal { background: #fff; }
[data-theme="light"] .modal-header { background: #f8fafc; border-color: #e2e8f0; }
[data-theme="light"] .notif-dropdown { background: #fff; border-color: #e2e8f0; }
[data-theme="light"] .toast { color: #0f172a; }

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
}

/* ===================================================
   LOGIN SCREEN
   =================================================== */
#login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  overflow: auto;
}

.login-bg {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.18) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(129,140,248,0.12) 0%, transparent 55%),
    var(--bg-primary);
  padding: 1.5rem;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2.75rem 2.25rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  animation: loginFadeIn 0.4s ease;
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card.shake {
  animation: loginShake 0.42s cubic-bezier(0.36,0.07,0.19,0.97);
}

@keyframes loginShake {
  10%, 90% { transform: translateX(-4px); }
  20%, 80% { transform: translateX(6px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.login-logo i {
  color: var(--primary);
  font-size: 1.9rem;
  background: rgba(99,102,241,0.15);
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(99,102,241,0.3);
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 2rem;
}

.login-field {
  margin-bottom: 1.1rem;
}

.login-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

.login-field label i {
  margin-right: 0.35rem;
  color: var(--primary);
}

.login-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}

.login-eye-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.login-eye-btn:hover { color: var(--text-primary); }

.login-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.35);
  color: #f87171;
  font-size: 0.82rem;
  padding: 0.6rem 0.875rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  animation: loginFadeIn 0.2s ease;
}

.login-btn {
  width: 100%;
  padding: 0.825rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
  margin-top: 0.5rem;
}

.login-btn:hover  { background: var(--primary-dark); box-shadow: 0 6px 20px rgba(99,102,241,0.45); }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.login-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-top: 1.5rem;
}

/* Tema claro — login */
[data-theme="light"] .login-bg {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(129,140,248,0.06) 0%, transparent 55%),
    #f1f5f9;
}
[data-theme="light"] .login-card {
  background: #ffffff;
  box-shadow: 0 12px 48px rgba(0,0,0,0.1);
}
[data-theme="light"] .login-input { background: #f8fafc; border-color: #e2e8f0; color: #0f172a; }
[data-theme="light"] .login-input:focus { border-color: var(--primary); }

/* Mobile login */
@media (max-width: 480px) {
  .login-card { padding: 2rem 1.5rem 1.5rem; border-radius: 16px; }
  .login-logo  { font-size: 1.5rem; }
}

/* ===================================================
   APP LAYOUT
   =================================================== */
#app {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ===================================================
   SIDEBAR
   =================================================== */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s ease;
  z-index: 100;
  flex-shrink: 0;
}

#sidebar.collapsed {
  width: 60px;
  min-width: 60px;
}
#sidebar.collapsed .sidebar-nav span,
#sidebar.collapsed .nav-group-label,
#sidebar.collapsed .badge,
#sidebar.collapsed .logo span { display: none; }
#sidebar.collapsed .nav-item { justify-content: center; padding: 0.65rem; }
#sidebar.collapsed .nav-item i { margin: 0; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-light);
}
.logo i { font-size: 1.2rem; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

.nav-group { margin-bottom: 0.25rem; }

.nav-group-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 1rem 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 0;
  transition: all 0.15s;
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  cursor: pointer;
}
.nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-item.active {
  background: rgba(99,102,241,0.15);
  color: var(--primary-light);
  border-right: 3px solid var(--primary);
}
.nav-item i { width: 16px; text-align: center; font-size: 0.9rem; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
}
.nav-item .badge:empty { display: none; }

/* ===================================================
   MAIN WRAPPER
   =================================================== */
#main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

/* ===================================================
   TOPBAR
   =================================================== */
#topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  flex-shrink: 0;
  z-index: 90;
}

.topbar-left h1 { font-size: 1.1rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-date { font-size: 0.8rem; color: var(--text-muted); }
.topbar-user { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--text-secondary); }
.avatar-sm {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
}

/* ===================================================
   PAGE CONTENT
   =================================================== */
#page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem;
  background: var(--bg-primary);
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}
#page-content::-webkit-scrollbar { width: 6px; }
#page-content::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

/* Page sections */
.page { display: none; }
.page.active { display: block; }

/* ===================================================
   CARDS
   =================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.card-header h3 { font-size: 0.9rem; font-weight: 600; }
.card-body { padding: 1rem; }

/* ===================================================
   KPI GRID
   =================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--kpi-color, var(--primary));
}
.kpi-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }
.kpi-value { font-size: 1.5rem; font-weight: 700; }
.kpi-icon {
  position: absolute;
  right: 1rem; top: 50%;
  transform: translateY(-50%);
  font-size: 1.8rem;
  opacity: 0.12;
}
.kpi-trend { font-size: 0.75rem; color: var(--text-muted); }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* ===================================================
   CHARTS GRID
   =================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.chart-card { }
.chart-container {
  padding: 1rem;
  height: 260px;
  position: relative;
}

/* ===================================================
   TABLES
   =================================================== */
.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.table th, .table td {
  padding: 0.65rem 0.875rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}
.table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.table tbody tr:hover { background: rgba(255,255,255,0.03); }
.table td:last-child { white-space: nowrap; }

/* ===================================================
   FORMS
   =================================================== */
.input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
}
.input:focus { border-color: var(--primary); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }
textarea.input { resize: vertical; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}
.form-group.fg-2 { flex: 2; }
.form-group.fg-3 { flex: 3; }
.form-group label { font-size: 0.78rem; font-weight: 500; color: var(--text-secondary); }

.form-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.form-group { margin-bottom: 0.75rem; }
.form-row .form-group { margin-bottom: 0; }

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary) !important;
}

/* ===================================================
   BUTTONS
   =================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border-light); }
.btn-secondary:hover { background: var(--border-light); }
.btn-outline { background: transparent; color: var(--text-primary); border-color: var(--border-light); }
.btn-outline:hover { background: var(--bg-tertiary); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-info { background: var(--info); color: white; }
.btn-info:hover { background: #2563eb; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; font-weight: 700; }
.btn-full { width: 100%; justify-content: center; margin-top: 0.5rem; }
.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-icon:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-icon-sm {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: flex; align-items: center;
  transition: all 0.15s;
}
.btn-icon-sm:hover { background: var(--border-light); }
.btn-text-sm {
  background: none;
  border: none;
  color: var(--primary-light);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
}

/* ===================================================
   PAGE TOOLBAR
   =================================================== */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.page-subtitle { font-size: 0.95rem; font-weight: 600; margin: 0; }
.toolbar-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.toolbar-filters { display: flex; align-items: center; gap: 0.5rem; }

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}
.search-box i {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.search-box input {
  width: 100%;
  padding-left: 2rem;
}

.input-filter {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}
.input-filter:focus { border-color: var(--primary); }

/* ===================================================
   MODAIS
   =================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.modal.modal-lg { max-width: 740px; }
.modal.modal-xl { max-width: 960px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.modal-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  transition: color 0.15s;
}
.btn-close:hover { color: var(--text-primary); }

/* ===================================================
   NOTIFICAÇÕES
   =================================================== */
.notif-wrapper { position: relative; }
.notif-btn { position: relative; }
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: white;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 500;
  overflow: hidden;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-empty { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

.notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover { background: var(--bg-tertiary); }
.notif-item.unread { background: rgba(99,102,241,0.05); }
.notif-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.notif-content { flex: 1; min-width: 0; }
.notif-content strong { font-size: 0.82rem; display: block; line-height: 1.3; }
.notif-content span { font-size: 0.75rem; color: var(--text-muted); }

/* ===================================================
   STATUS BADGES
   =================================================== */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-status.critico { background: var(--danger-light); color: var(--danger); }
.badge-status.atencao { background: var(--warning-light); color: var(--warning); }
.badge-status.ok { background: var(--success-light); color: var(--success); }
.badge-status.info { background: var(--info-light); color: var(--info); }
.badge-status.pendente { background: #fef3c7; color: #92400e; }
.badge-status.pago { background: var(--success-light); color: var(--success); }
.badge-status.vencido { background: var(--danger-light); color: var(--danger); }
.badge-status.vip { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #78350f; }

.count-badge {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ===================================================
   TOAST
   =================================================== */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 280px;
  animation: slideIn 0.3s ease;
  border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

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

/* ===================================================
   DASHBOARD EXTRAS
   =================================================== */
.dash-bottom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.alertas-list, .datas-list, .aniversarios-list { padding: 0.5rem; }

.alerta-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
  font-size: 0.83rem;
}
.alerta-item.danger { background: rgba(239,68,68,0.1); border-left: 3px solid var(--danger); }
.alerta-item.warning { background: rgba(245,158,11,0.1); border-left: 3px solid var(--warning); }
.alerta-item.info { background: rgba(59,130,246,0.1); border-left: 3px solid var(--info); }
.alerta-item.success { background: rgba(16,185,129,0.1); border-left: 3px solid var(--success); }

.data-item, .aniv-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.83rem;
}
.data-item:last-child, .aniv-item:last-child { border-bottom: none; }
.data-badge {
  min-width: 44px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
}

/* ===================================================
   CLIENTES
   =================================================== */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
  flex-shrink: 0;
}
.cliente-cell { display: flex; align-items: center; gap: 0.65rem; }
.cliente-info { line-height: 1.3; }
.cliente-info strong { font-size: 0.875rem; display: block; }
.cliente-info span { font-size: 0.75rem; color: var(--text-muted); }

/* ===================================================
   KANBAN
   =================================================== */
.kanban-board {
  display: flex;
  gap: 0.875rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  min-height: 400px;
}

.kanban-col {
  min-width: 240px;
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.875rem;
  border-bottom: 1px solid var(--border-color);
  border-top: 4px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 0.8rem;
  font-weight: 600;
}
.kanban-count {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75rem;
}
.kanban-cards {
  padding: 0.5rem;
  flex: 1;
  overflow-y: auto;
  min-height: 100px;
}
.kanban-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  margin-bottom: 0.5rem;
  cursor: grab;
  transition: box-shadow 0.15s;
  font-size: 0.8rem;
}
.kanban-card:hover { box-shadow: var(--shadow-sm); }
.kanban-card.atrasado { border-color: var(--danger); }
.kanban-card-title { font-weight: 600; font-size: 0.82rem; margin-bottom: 0.25rem; }
.kanban-card-meta { color: var(--text-muted); font-size: 0.75rem; line-height: 1.5; }
.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-color);
}
.encomendas-kpis {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

/* ===================================================
   PÓS-VENDA
   =================================================== */
.posvenda-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.posvenda-list { padding: 0.5rem; max-height: 480px; overflow-y: auto; }
.posvenda-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.83rem;
}
.nps-scale {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}
.nps-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.nps-btn:hover, .nps-btn.selected { border-color: var(--primary); background: var(--primary); }
.nps-btn.det.selected { background: var(--danger); border-color: var(--danger); }
.nps-btn.neu.selected { background: var(--warning); border-color: var(--warning); }
.nps-btn.pro.selected { background: var(--success); border-color: var(--success); }

.stars-select { display: flex; gap: 0.3rem; margin-top: 0.25rem; }
.star-btn {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--border-light);
  transition: color 0.15s;
  border: none;
  background: none;
}
.star-btn.selected, .star-btn:hover { color: var(--warning); }

.feedback-info-box {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.83rem;
  color: var(--text-secondary);
}

/* ===================================================
   ESTOQUE
   =================================================== */
.estoque-legenda { display: flex; gap: 0.5rem; }
.estoque-row-critico { background: rgba(239,68,68,0.06); }
.estoque-row-atencao { background: rgba(245,158,11,0.06); }

/* ===================================================
   CARRINHO
   =================================================== */
.carrinho-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1rem;
}
.carrinho-items-list { padding: 0.5rem; min-height: 200px; }
.carrinho-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
  font-size: 0.83rem;
}
.carrinho-item-info { flex: 1; }
.carrinho-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
}
.carrinho-totals {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
}
.criticos-list { padding: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.critico-card {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===================================================
   FORNECEDORES
   =================================================== */

/* ===================================================
   FINANCEIRO
   =================================================== */
.dre-container { display: flex; flex-direction: column; gap: 0.5rem; }
.dre-row {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}
.dre-row.header {
  background: var(--bg-tertiary);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.dre-row.positive { color: var(--success); }
.dre-row.negative { color: var(--danger); }
.dre-row.total {
  background: var(--bg-tertiary);
  font-weight: 700;
  font-size: 1rem;
  border: 1px solid var(--border-color);
}
.dre-row.subtotal { font-weight: 600; }
.dre-section { margin: 0.5rem 0; }

/* ===================================================
   CALENDÁRIO
   =================================================== */
.calendario-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
  align-items: start;
}
.cal-nav { display: flex; align-items: center; gap: 0.75rem; }
.calendario-visual { padding: 1rem; }
.cal-header { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.cal-day-name {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.3rem 0;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day {
  min-height: 68px;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  font-size: 0.8rem;
  cursor: default;
  transition: background 0.1s;
}
.cal-day.other-month { opacity: 0.35; }
.cal-day.today { border-color: var(--primary); background: rgba(99,102,241,0.1); }
.cal-day.has-event { cursor: pointer; }
.cal-day.has-event:hover { background: rgba(99,102,241,0.15); }
.cal-day-num { font-weight: 600; font-size: 0.82rem; margin-bottom: 2px; }
.cal-event {
  display: inline-block;
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 1px;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event.alto { background: rgba(239,68,68,0.3); color: #fca5a5; }
.cal-event.medio { background: rgba(245,158,11,0.3); color: #fcd34d; }
.cal-event.baixo { background: rgba(59,130,246,0.3); color: #93c5fd; }
.cal-event.feriado { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.cal-event.queda { background: rgba(107,114,128,0.3); color: #d1d5db; }

.datas-list-full { padding: 0.5rem; max-height: 500px; overflow-y: auto; }
.data-full-item {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.83rem;
}
.data-full-item:last-child { border-bottom: none; }
.data-full-nome { font-weight: 600; margin-bottom: 0.2rem; }
.data-full-meta { color: var(--text-muted); font-size: 0.75rem; }
.data-full-acao { color: var(--info); font-size: 0.75rem; font-style: italic; margin-top: 0.2rem; }

/* ===================================================
   PLANEJAMENTO
   =================================================== */
.planejamento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
.progress-bar-wrap {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  margin: 0.5rem 1rem;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 4px;
  transition: width 0.4s;
}
.checklist-list { padding: 0.5rem; max-height: 500px; overflow-y: auto; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.83rem;
  cursor: pointer;
  transition: background 0.1s;
}
.checklist-item:hover { background: var(--bg-tertiary); }
.checklist-item.done span { text-decoration: line-through; color: var(--text-muted); }
.checklist-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }

.simulador-form { padding: 1rem; }
.simulador-result { padding: 1rem; }
.simulador-result-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}
.simulador-result-row:last-child { border-bottom: none; }
.simulador-result-row.highlight { font-weight: 700; font-size: 1rem; color: var(--success); }

/* ===================================================
   CUSTOS
   =================================================== */
.custos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.custos-list { padding: 0.5rem; }
.custo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.83rem;
}
.custo-item:last-child { border-bottom: none; }
.custos-total {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===================================================
   PRECIFICAÇÃO
   =================================================== */
.precif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.precif-result { padding: 1rem; }
.precif-cenario {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 0.875rem;
  margin-bottom: 0.5rem;
}
.precif-cenario h4 { font-size: 0.82rem; margin-bottom: 0.5rem; color: var(--text-secondary); }
.precif-preco { font-size: 1.6rem; font-weight: 700; }
.precif-historico { padding: 0.75rem; max-height: 200px; overflow-y: auto; }

/* ===================================================
   CONDIÇÕES DE PAGAMENTO
   =================================================== */
.condicoes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.875rem;
  padding: 1rem;
}
.condicao-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
}
.condicao-card.inativa { opacity: 0.5; }
.condicao-nome { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; }
.condicao-detalhe { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.6; }
.condicao-formas { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; }
.condicao-forma-tag {
  font-size: 0.7rem;
  padding: 2px 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
}

/* ===================================================
   CONFIG
   =================================================== */
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.config-actions { display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem; }

/* ===================================================
   LANÇAMENTOS
   =================================================== */

/* ===================================================
   MISC
   =================================================== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.4; }
.empty-state p { font-size: 0.875rem; }

.action-btns { display: flex; gap: 0.35rem; }

/* Curva ABC */
.abc-a { color: var(--success); font-weight: 700; }
.abc-b { color: var(--warning); font-weight: 600; }
.abc-c { color: var(--text-muted); }

/* ===================================================
   CATÁLOGO DIGITAL
   =================================================== */
.cat-produtos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.cat-produto-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.cat-produto-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.cat-produto-card.selecionado { border-color: var(--primary); background: rgba(99,102,241,0.08); }
.cat-produto-card.selecionado::after {
  content: '✓';
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.cat-card-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.cat-card-img img { width: 100%; height: 100%; object-fit: cover; }

.cat-card-body { padding: 0.75rem; }
.cat-card-nome { font-size: 0.85rem; font-weight: 600; line-height: 1.3; margin-bottom: 0.35rem; }
.cat-card-cat { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.cat-card-preco { font-size: 1rem; font-weight: 700; color: var(--success); }
.cat-card-preco-original { font-size: 0.78rem; color: var(--text-muted); text-decoration: line-through; }
.cat-card-promo { font-size: 0.78rem; font-weight: 700; color: white; background: var(--danger); padding: 2px 6px; border-radius: 4px; display: inline-block; }
.cat-card-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.5rem; }

.cat-badge-destaque { background: rgba(245,158,11,0.2); color: #f59e0b; border: 1px solid rgba(245,158,11,0.4); font-size: 0.68rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.cat-badge-promo { background: rgba(239,68,68,0.2); color: #ef4444; border: 1px solid rgba(239,68,68,0.4); font-size: 0.68rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.cat-badge-novo { background: rgba(99,102,241,0.2); color: #818cf8; border: 1px solid rgba(99,102,241,0.4); font-size: 0.68rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; }

/* Preview catálogo (dentro do modal) */
.catalogo-preview-header {
  text-align: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.catalogo-preview-header h2 { font-size: 1.4rem; color: var(--primary-light); margin-bottom: 0.4rem; }
.catalogo-preview-header p { color: var(--text-secondary); font-size: 0.9rem; }

.catalogo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.875rem;
}

.catalogo-card-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: center;
}
.catalogo-card-img-preview {
  width: 100%; height: 120px;
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  position: relative;
}
.catalogo-card-img-preview img { width: 100%; height: 100%; object-fit: cover; }
.catalogo-card-preview-body { padding: 0.75rem; }
.catalogo-card-preview-nome { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; }
.catalogo-card-preview-preco { font-size: 1rem; font-weight: 700; color: var(--success); }
.catalogo-card-preview-promo { font-size: 0.82rem; color: var(--text-muted); text-decoration: line-through; }

/* ===================================================
   ETIQUETAS — Preview no Sistema
   =================================================== */
.etiq-preview-wrapper {
  overflow-x: auto;
  padding: 1rem;
  background: var(--bg-primary);
}

.etiq-preview-sheet {
  background: white;
  color: #000;
  width: 210mm;
  min-width: 210mm;
  margin: 0 auto 16px;
  padding: 8mm;
  box-sizing: border-box;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  position: relative;
}

.etiq-sheet-info {
  font-size: 7px;
  color: #aaa;
  text-align: right;
  margin-bottom: 4px;
  font-family: Arial, sans-serif;
}

.etiq-grid-2x5 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4mm; }
.etiq-grid-3x6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; }
.etiq-grid-4x8 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2mm; }
.etiq-grid-2x2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8mm; }

/* Etiqueta Padrão */
.etiqueta {
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: white;
  break-inside: avoid;
  overflow: hidden;
  min-height: 42mm;
  font-family: Arial, sans-serif;
}

.etiq-grid-3x6 .etiqueta { min-height: 32mm; }
.etiq-grid-4x8 .etiqueta { min-height: 22mm; padding: 4px 6px; }

.etiq-sku { font-size: 7px; color: #666; font-family: monospace; text-transform: uppercase; }
.etiq-nome { font-size: 9px; font-weight: 700; color: #111; line-height: 1.25; margin: 2px 0; }
.etiq-cat { font-size: 7px; color: #555; text-transform: uppercase; letter-spacing: 0.03em; }
.etiq-preco-box { text-align: right; margin-top: 3px; }
.etiq-preco { font-size: 13px; font-weight: 900; color: #111; line-height: 1; }
.etiq-preco-label { font-size: 7px; color: #666; }
.etiq-barcode-line {
  width: 100%; height: 16px;
  background: repeating-linear-gradient(90deg, #000 0, #000 1px, transparent 1px, transparent 3px);
  margin-top: 4px;
  border-radius: 1px;
}

/* Etiqueta Promoção */
.etiqueta-promo { border: 2px solid #dc2626; }
.etiqueta-promo .etiq-preco-original { font-size: 8px; color: #999; text-decoration: line-through; text-align: right; }
.etiqueta-promo .etiq-preco { color: #dc2626; }
.etiq-promo-badge { background: #dc2626; color: white; font-size: 7px; font-weight: 800; padding: 2px 5px; border-radius: 3px; text-transform: uppercase; display: inline-block; }
.etiq-desconto { font-size: 11px; font-weight: 900; color: #dc2626; }

/* Etiqueta Elegante */
.etiqueta-elegante { border: none; border-top: 3px solid #6366f1; padding: 8px 10px; }
.etiqueta-elegante .etiq-nome { font-size: 10px; color: #1e293b; }
.etiqueta-elegante .etiq-preco { color: #6366f1; }
.etiqueta-elegante .etiq-linha { border-top: 1px solid #e2e8f0; margin: 4px 0; }

/* Etiqueta Grande (2x2) */
.etiq-grid-2x2 .etiqueta { min-height: 65mm; padding: 12px 14px; }
.etiq-grid-2x2 .etiq-nome { font-size: 14px; }
.etiq-grid-2x2 .etiq-preco { font-size: 24px; }
.etiq-grid-2x2 .etiq-sku { font-size: 9px; }
.etiq-grid-2x2 .etiq-barcode-line { height: 28px; }
.etiq-grid-2x2 .etiq-cat { font-size: 9px; }
.etiq-grid-2x2 .etiq-preco-label { font-size: 9px; }

/* Stats bar para etiquetas */
.etiq-stats-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.etiq-stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.etiq-stat-item strong { color: var(--primary-light); }

/* Print button overlay */
.etiq-print-overlay {
  position: sticky;
  bottom: 1rem;
  text-align: center;
  pointer-events: none;
}
.etiq-print-overlay button {
  pointer-events: all;
  box-shadow: 0 4px 20px rgba(99,102,241,0.5);
}

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 1100px) {
  .charts-grid { grid-template-columns: 1fr 1fr; }
  .planejamento-grid, .precif-grid, .custos-grid, .config-grid { grid-template-columns: 1fr; }
  .calendario-grid { grid-template-columns: 1fr; }
  .carrinho-grid { grid-template-columns: 1fr; }
  .posvenda-grid { grid-template-columns: 1fr; }
  .dash-finance-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  #sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 260px; transform: translateX(-100%);
    transition: transform 0.25s; z-index: 200;
    overflow-y: auto;
  }
  #sidebar.mobile-open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,0.5); }
  #sidebar.mobile-open ~ #main-wrapper::before {
    content: '';
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 199;
  }
  .charts-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .topbar-date { display: none; }
  .form-row { flex-direction: column; }
  .page-toolbar { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .toolbar-actions { flex-wrap: wrap; gap: 0.4rem; }
  .toolbar-filters { flex-wrap: wrap; gap: 0.4rem; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .modal {
    margin: 0; max-width: 100vw; width: 100%;
    border-radius: 14px 14px 0 0;
    position: fixed; bottom: 0; left: 0; right: 0;
    top: auto; transform: none; max-height: 92vh;
  }
  .modal-overlay { align-items: flex-end; }
  .kanban-board { flex-direction: column; }
  .kanban-col { min-width: unset; }
  .precif-grid { grid-template-columns: 1fr; }
  #page-content { padding: 0.75rem 0.625rem; padding-bottom: 5rem; }
  .card-header { padding: 0.75rem; }
  .modal-body { padding: 0.875rem; }
  .cat-produtos-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-finance-row { grid-template-columns: 1fr; }
  .action-btns { flex-wrap: wrap; gap: 0.25rem; }
  .btn-sm { padding: 0.3rem 0.5rem; font-size: 0.75rem; }
  .kpi-card { padding: 0.875rem; }
  .kpi-value { font-size: 1.4rem; }
  .topbar-user span { display: none; }
  .rateio-item .form-row { flex-direction: row; flex-wrap: wrap; }
  .table th, .table td { padding: 0.5rem 0.625rem; font-size: 0.78rem; }
  .dash-bottom-grid { grid-template-columns: 1fr; }
  .section-title-mobile { font-size: 1rem; }

  /* Mobile bottom navigation */
  #mobile-bottom-nav {
    display: flex !important;
  }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .cat-produtos-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .toolbar-actions .btn span { display: none; }
  .etiq-preview-sheet { width: 100%; min-width: unset; }
  .kpi-card { padding: 0.75rem; min-height: unset; }
  .kpi-value { font-size: 1.25rem; }
  .kpi-icon { font-size: 1.8rem; }
  #page-title { font-size: 0.95rem; }
}

/* Mobile bottom navigation bar */
#mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  z-index: 150;
  align-items: center;
  justify-content: space-around;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.2);
}
.mob-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.6rem;
  font-family: inherit;
  transition: color 0.2s;
}
.mob-nav-btn i { font-size: 1.15rem; }
.mob-nav-btn.active, .mob-nav-btn:hover { color: var(--primary-light); }
.mob-nav-btn .mob-badge {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--danger);
  color: white;
  font-size: 0.55rem;
  width: 14px; height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mob-nav-btn { position: relative; }

/* ===================================================
   DASHBOARD — CONTAS FINANCEIRAS
   =================================================== */
.dash-finance-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.contas-list { padding: 0 0.5rem 0.5rem; }
.conta-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.375rem;
  border-bottom: 1px solid var(--border-color);
}
.conta-item:last-of-type { border-bottom: none; }
.conta-total {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.5rem 0.375rem;
  text-align: right;
  border-top: 1px solid var(--border-color);
  margin-top: 0.25rem;
}

/* ===================================================
   PRECIFICAÇÃO — INFO BOX & RATEIO
   =================================================== */
.precif-info-box {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  color: var(--info);
  margin-top: 0.5rem;
}
.rateio-item {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

/* ===================================================
   ETIQUETAS — SEM CÓDIGO DE BARRAS (versão melhorada)
   =================================================== */
.etiqueta-clean {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: white;
  break-inside: avoid;
  overflow: hidden;
  font-family: Arial, sans-serif;
}
.etiqueta-clean .etiq-nome { font-size: 11px; font-weight: 800; }
.etiqueta-clean .etiq-preco { font-size: 18px; font-weight: 900; }
.etiq-grid-2x2 .etiqueta-clean .etiq-preco { font-size: 28px; }
.etiq-grid-4x8 .etiqueta-clean .etiq-preco { font-size: 12px; }

/* ===================================================
   MOBILE — HAMBURGER BTN
   =================================================== */
#btn-toggle-sidebar {
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 768px) {
  #btn-toggle-sidebar {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    color: var(--text-primary);
  }
  .topbar-left { gap: 0.5rem; }
  #page-title { font-size: 1rem; }
}
