/* ==========================================================================
   ADUAN STUDIO - FINANCIAL DASHBOARD DESIGN SYSTEM
   Notion Minimal Architecture + Apple-Grade Micro-Interactions
   Colors: Cobalt Blue (#1e40af, #002060), Neutral Grays (#f8fafc, #e2e8f0), Pure White
   ========================================================================== */

:root {
  --cobalt-primary: #1e40af;
  --cobalt-hover: #1d4ed8;
  --cobalt-dark: #002060;
  --cobalt-light: #eff6ff;
  --cobalt-border: #bfdbfe;

  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #f1f5f9;
  
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --accent-red: #dc2626;
  --accent-red-bg: #fef2f2;
  --accent-salmon-bg: #f8d7da;
  --accent-salmon-text: #900000;
  --accent-green: #16a34a;
  --accent-green-bg: #f0fdf4;
  --accent-amber: #d97706;
  --accent-purple: #7c3aed;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-apple: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-apple-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-apple-active: 0 1px 1px 0 rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

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

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden !important; /* No window scrollbars */
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  user-select: none;
}

/* Base App Layout (Fixed Desktop Grid) */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden !important;
}

/* ==========================================================================
   SIDEBAR (Notion Style Clean Navigation - No Horizontal Scrollbar)
   ========================================================================== */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px;
  z-index: 10;
  overflow: hidden !important;
  overflow-x: hidden !important;
}

.brand-section {
  padding: 4px 8px 18px 8px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--cobalt-primary), var(--cobalt-dark));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  box-shadow: var(--shadow-apple);
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.brand-text span {
  font-size: 11px;
  color: var(--cobalt-primary);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-x: hidden !important;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
}

.nav-menu::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
  width: 0;
  height: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  border: 1px solid transparent;
  width: 100%;
  box-sizing: border-box;
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  /* No horizontal translation to eliminate scrollbar */
}

.nav-item.active {
  background: var(--cobalt-light);
  color: var(--cobalt-primary);
  font-weight: 600;
  border-color: var(--cobalt-border);
}

.nav-item .icon {
  font-size: 16px;
  opacity: 0.85;
}

.nav-item.active .icon {
  opacity: 1;
}

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden !important;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 4px 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.4);
}

/* ==========================================================================
   MAIN CONTENT ZONE (Desktop Fit - No Body Scrolling)
   ========================================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  height: 100vh;
  overflow: hidden !important;
}

/* Top Header Bar */
.top-header {
  height: 60px;
  min-height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.header-title-group h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.header-title-group p {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Apple-Style Controls & Buttons */
.btn-apple {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-apple);
  border: 1px solid transparent;
  outline: none;
  white-space: nowrap;
}

.btn-apple:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-apple-hover);
}

.btn-apple:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: var(--shadow-apple-active);
}

.btn-apple-primary {
  background: var(--cobalt-primary);
  color: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}

.btn-apple-primary:hover {
  background: var(--cobalt-hover);
}

.btn-apple-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-light);
}

.btn-apple-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-medium);
}

.btn-apple-danger {
  background: #ffffff;
  color: var(--accent-red);
  border-color: #fca5a5;
}

.btn-apple-danger:hover {
  background: var(--accent-red-bg);
}

.select-apple {
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  box-shadow: var(--shadow-apple);
  transition: all 0.15s ease;
}

.select-apple:focus {
  border-color: var(--cobalt-primary);
  box-shadow: 0 0 0 2px var(--cobalt-border);
}

/* ==========================================================================
   VIEW PANELS
   ========================================================================== */
.view-panel {
  display: none;
  flex: 1;
  padding: 20px 28px;
  overflow-y: auto;
  height: calc(100vh - 60px);
}

.view-panel.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeIn 0.18s ease-out;
}

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

/* KPI Summary Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border-light);
}

.kpi-card.cobalt::before { background: var(--cobalt-primary); }
.kpi-card.green::before { background: var(--accent-green); }
.kpi-card.red::before { background: var(--accent-red); }
.kpi-card.dark::before { background: var(--cobalt-dark); }

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-light);
}

/* Split Section on Dashboard */
.dashboard-split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.content-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.card-body {
  padding: 14px 18px;
  overflow-y: auto;
  flex: 1;
}

/* ==========================================================================
   DATA TABLES (Clean Notion / Apple Hybrid Style)
   ========================================================================== */
.table-container {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.table-toolbar {
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-scroll {
  flex: 1;
  overflow-y: auto;
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.modern-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 2;
}

.modern-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  white-space: nowrap;
}

.modern-table tbody tr {
  transition: background 0.1s ease;
}

.modern-table tbody tr:hover {
  background: #f8fafc;
}

.badge-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
}

.badge-blue { background: var(--cobalt-light); color: var(--cobalt-primary); }
.badge-green { background: var(--accent-green-bg); color: var(--accent-green); }
.badge-red { background: var(--accent-red-bg); color: var(--accent-red); }
.badge-purple { background: #f3e8ff; color: var(--accent-purple); }
.badge-gray { background: var(--bg-subtle); color: var(--text-muted); }

.val-positive { color: var(--accent-green); font-weight: 600; }
.val-negative { color: var(--accent-red); font-weight: 600; }

/* ==========================================================================
   REPORTS & VISUAL ANALYTICS ZONE (Interactive Tabs + Charts + Detailed Table)
   ========================================================================== */
.reports-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reports-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.report-category-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.rep-tab-btn {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.rep-tab-btn.active {
  background: var(--bg-surface);
  color: var(--cobalt-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.chart-type-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-type-btn {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart-type-btn.active {
  background: var(--cobalt-primary);
  color: #ffffff;
  border-color: var(--cobalt-primary);
}

/* Charts Card Container */
.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-canvas-container {
  width: 100%;
  height: 260px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ==========================================================================
   RELATÓRIO ASSESSORIA (GESTÓRIA) - EXACT 100% REPLICA OF USER ATTACHMENT
   ========================================================================== */
.assessoria-view-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.assessoria-document {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  max-width: 950px;
  margin: 0 auto;
  width: 100%;
}

.assessoria-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 22px;
  font-size: 13.5px;
}

.assessoria-table th.main-header {
  background-color: #002060 !important; /* EXACT Cobalt Blue from sample */
  color: #ffffff !important;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  text-align: left;
  border: 1px solid #002060;
}

.assessoria-table th.sub-header {
  background-color: #ffffff;
  color: #002060;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  text-align: left;
}

.assessoria-table td {
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  color: #1e293b;
}

.assessoria-table td.col-idx {
  width: 40px;
  text-align: center;
}

.assessoria-table td.col-date {
  width: 110px;
  text-align: center;
}

.assessoria-table td.col-val {
  width: 140px;
  text-align: right;
  font-weight: 500;
}

.assessoria-table tr.total-blue {
  background-color: #002060 !important;
  color: #ffffff !important;
  font-weight: 700;
}

.assessoria-table tr.total-blue td {
  color: #ffffff !important;
  border-color: #002060;
}

.assessoria-table tr.discount-salmon {
  background-color: #f8d7da !important;
  font-weight: 700;
}

.assessoria-table tr.discount-salmon td {
  color: #900000 !important;
  border-color: #cbd5e1;
}

.text-red-negative {
  color: #dc2626;
  font-weight: 500;
}

/* ==========================================================================
   SETTINGS PANEL & CARDS
   ========================================================================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.settings-card h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-card p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   MODALS (Apple Style Smooth Dialogs)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 580px;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

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

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.btn-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.btn-close:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
  outline: none;
  transition: all 0.15s ease;
}

.form-control:focus {
  border-color: var(--cobalt-primary);
  box-shadow: 0 0 0 2px var(--cobalt-border);
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-subtle);
}

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

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-modal);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideToast 0.25s ease-out;
}

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

/* ==========================================================================
   PRINT STYLES FOR ASSESSORIA & REPORTS
   ========================================================================== */
@media print {
  body {
    background: #ffffff;
    color: #000000;
    overflow: visible !important;
  }

  .sidebar, .top-header, .header-actions, .btn-apple, .assessoria-toolbar, .toast-container, .chart-type-selector, .report-category-tabs {
    display: none !important;
  }

  .main-content {
    height: auto !important;
    overflow: visible !important;
  }

  .view-panel {
    display: none !important;
  }

  .view-panel#view-assessoria,
  .view-panel#view-reports {
    display: block !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  .assessoria-document {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .assessoria-table th.main-header,
  .assessoria-table tr.total-blue {
    background-color: #002060 !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .assessoria-table tr.discount-salmon {
    background-color: #f8d7da !important;
    color: #900000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
