/* SIGMS - Main Stylesheet */
:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --primary-light: #e8f0fe;
  --success: #057a55;
  --success-light: #def7ec;
  --warning: #c27803;
  --warning-light: #fdf6b2;
  --danger: #c81e1e;
  --danger-light: #fde8e8;
  --info: #0e7490;
  --info-light: #e0f2fe;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-width: 256px;
  --header-height: 64px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: 1.5;
}

/* Auth Screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 48px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.auth-logo-icon {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
}

.auth-logo-text h1 { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.auth-logo-text p { font-size: 12px; color: var(--gray-500); }

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar — Windows 11 Fluent Design ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(248, 248, 252, 0.97);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-right: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.05);
  color: #1e1e2e;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0067c0, #0099f8);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 103, 192, 0.35);
}

.sidebar-logo-text { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; color: #1e1e2e; }
.sidebar-logo-sub  { font-size: 10px; color: #a0a0b8; margin-top: 2px; }

.sidebar-nav {
  flex: 1;
  padding: 6px 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.12) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 2px; }

.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #b4b4c8;
  padding: 13px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  margin: 1px 8px;
  border-radius: 8px;
  color: #3c3c50;
  cursor: pointer;
  transition: background 0.13s ease, color 0.13s ease;
  text-decoration: none;
  font-size: 12px;
  font-weight: 400;
  border: none;
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.045);
  color: #1a1a2e;
}

.nav-item.active {
  background: rgba(0, 103, 192, 0.10);
  color: #0055a8;
  font-weight: 550;
}

/* Frosted-glass icon container — single-color SVG icons */
.nav-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.07);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.nav-icon {
  width: 15px;
  height: 15px;
  display: block;
  flex-shrink: 0;
  color: #3c3c58;
  opacity: 0.32;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.nav-item:hover .nav-icon-wrap {
  background: rgba(255, 255, 255, 0.80);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.nav-item:hover .nav-icon { opacity: 0.72; }

.nav-item.active .nav-icon-wrap {
  background: rgba(0, 103, 192, 0.10);
  border-color: rgba(0, 103, 192, 0.20);
  box-shadow: 0 2px 8px rgba(0,103,192,0.12);
}

.nav-item.active .nav-icon {
  opacity: 1;
  color: #0067c0;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Legacy compat — hide old icon span if still rendered */
.nav-item .icon { display: none; }

.sidebar-user {
  padding: 10px 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #0067c0, #0099f8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 1px 6px rgba(0,103,192,.3);
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #1e1e2e; }
.user-role { font-size: 10px; color: #9898b0; }
.sidebar-user .btn-icon { color: #aaaabe !important; }
.sidebar-user .btn-icon:hover { background: rgba(0,0,0,.05) !important; color: #1e1e2e !important; }

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 18px; font-weight: 600; color: var(--gray-900); flex: 1; }

.page-content {
  flex: 1;
  padding: 24px;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.card-title { font-size: 15px; font-weight: 600; color: var(--gray-900); }
.card-body { padding: 20px; }

/* KPI Tiles */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.kpi-icon.blue { background: var(--primary-light); color: var(--primary); }
.kpi-icon.green { background: var(--success-light); color: var(--success); }
.kpi-icon.yellow { background: var(--warning-light); color: var(--warning); }
.kpi-icon.red { background: var(--danger-light); color: var(--danger); }
.kpi-icon.cyan { background: var(--info-light); color: var(--info); }

.kpi-info { flex: 1; }
.kpi-value { font-size: 24px; font-weight: 700; color: var(--gray-900); line-height: 1; margin-bottom: 4px; }
.kpi-label { font-size: 12px; color: var(--gray-500); }

/* Charts grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* Tables */
.table-wrapper { overflow-x: auto; }

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

thead th {
  background: var(--gray-50);
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13.5px;
  color: var(--gray-700);
}

tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green { background: var(--success-light); color: var(--success); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-cyan { background: var(--info-light); color: var(--info); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-success { background: var(--success); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* Forms */
.form-group { margin-bottom: 16px; position: relative; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--gray-800);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}

input.error { border-color: var(--danger); }
.field-error { font-size: 11px; color: var(--danger); margin-top: 4px; }
.field-hint { font-size: 11px; color: var(--gray-500); margin-top: 4px; }

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

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 0 12px;
  flex: 1;
  max-width: 320px;
}

.search-bar input {
  border: none;
  box-shadow: none;
  padding: 8px 0;
}

.search-bar input:focus { box-shadow: none; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.modal {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-lg { max-width: 800px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--gray-200);
  justify-content: space-between;
}

.pagination-info { font-size: 12px; color: var(--gray-500); }
.pagination-btns { display: flex; gap: 4px; }

/* Quick actions */
.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.15s;
}

.qa-call { background: var(--success-light); color: var(--success); }
.qa-call:hover { background: #c6f6e5; }
.qa-email { background: var(--primary-light); color: var(--primary); }
.qa-email:hover { background: #d0e3ff; }
.qa-whatsapp { background: #f0fdf4; color: #16a34a; }
.qa-whatsapp:hover { background: #dcfce7; }

/* Alerts/Notifications */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-info { background: var(--info-light); color: var(--info); border: 1px solid #a5f3fc; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #a7f3d0; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--gray-900);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  animation: slideIn 0.2s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

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

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--gray-400);
  gap: 8px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--gray-400);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--gray-600); margin-bottom: 8px; }
.empty-state-text { font-size: 13px; }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Utility */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-gray { color: var(--gray-500); }
.font-mono { font-family: 'SF Mono', Consolas, monospace; }
.text-right { text-align: right; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full { width: 100%; }

/* Acompanhamento — Tips */
.tips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; padding: 16px; }
.tip-card { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 10px; padding: 16px; }
.tip-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tip-icon { font-size: 20px; }
.tip-body { margin: 0 0 8px; color: var(--gray-700); font-size: 13px; line-height: 1.6; }
.tip-example { font-size: 12px; color: var(--gray-500); background: var(--gray-100); border-left: 3px solid var(--primary); padding: 6px 10px; border-radius: 0 6px 6px 0; margin-bottom: 8px; }
.tip-tags { display: flex; gap: 4px; flex-wrap: wrap; }

/* Client search suggestions dropdown */
.suggestions-dropdown { position: absolute; z-index: 100; background: white; border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.1); width: 100%; max-height: 200px; overflow-y: auto; }
.suggestion-item { padding: 10px 14px; cursor: pointer; font-size: 13px; }
.suggestion-item:hover { background: var(--primary-light, #eff6ff); }

/* Quick action buttons */
.quick-action-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 6px; font-size: 12px; text-decoration: none; font-weight: 500; }
.qa-call { background: #ecfdf5; color: #065f46; }
.qa-email { background: #eff6ff; color: #1e40af; }
.qa-whatsapp { background: #f0fdf4; color: #166534; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
