/* ==========================================================================
   TVSD FOLLOWUP — WORLD-CLASS DESIGN SYSTEM v3.0
   Inspired by: Linear · Vercel · Stripe · Apple · Figma
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&display=swap');

:root {
  /* ── TVSD Brand ── */
  --brand-indigo:      #322D69;
  --brand-indigo-mid:  #3d3880;
  --brand-indigo-light:#4a4590;
  --brand-gold:        #E1A03C;
  --brand-gold-light:  #f5b84a;
  --brand-gold-bright: #FFB84D;
  --brand-gold-dim:    rgba(225, 160, 60, 0.15);
  --brand-gold-glow:   rgba(225, 160, 60, 0.3);

  /* ── Dark Theme — Deep Premium (Linear / Vercel v3) ── */
  --bg-app:       #060608;
  --bg-panel:     #0d0d10;
  --bg-panel-2:   #121215;
  --bg-subtle:    #1a1a20;
  --bg-sidebar:   #08080b;
  --bg-elevated:  #15151a;

  --border:       #1e1e24;
  --border-mid:   #282830;
  --border-hover: #32323c;
  --border-focus: var(--brand-gold);

  --text-primary:   #f5f5f7;
  --text-secondary: #9d9dab;
  --text-muted:     #636378;
  --text-faint:     #3a3a48;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* ── Status Semantic Tokens ── */
  --c-green-dot:    #22c55e;
  --c-green-bg:     rgba(34, 197, 94, 0.06);
  --c-green-border: rgba(34, 197, 94, 0.14);
  --c-green-txt:    #86efac;

  --c-blue-dot:    #3b82f6;
  --c-blue-bg:     rgba(59, 130, 246, 0.06);
  --c-blue-border: rgba(59, 130, 246, 0.14);
  --c-blue-txt:    #93c5fd;

  --c-amber-dot:    #f59e0b;
  --c-amber-bg:     rgba(245, 158, 11, 0.06);
  --c-amber-border: rgba(245, 158, 11, 0.14);
  --c-amber-txt:    #fcd34d;

  --c-red-dot:    #ef4444;
  --c-red-bg:     rgba(239, 68, 68, 0.06);
  --c-red-border: rgba(239, 68, 68, 0.14);
  --c-red-txt:    #fca5a5;

  --c-slate-dot:    #71717a;
  --c-slate-bg:     rgba(113, 113, 122, 0.06);
  --c-slate-border: rgba(113, 113, 122, 0.14);
  --c-slate-txt:    #d4d4d8;

  /* ── Geometry ── */
  --r-sm:   4px;
  --r-md:   6px;
  --r-lg:   8px;
  --r-xl:   12px;
  --r-2xl:  16px;
  --r-full: 9999px;

  /* ── Shadows ── */
  --shadow-xs:     0 1px 2px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.02);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:     0 8px 24px rgba(0,0,0,0.5);
  --shadow-lg:     0 16px 48px rgba(0,0,0,0.6);
  --shadow-drawer: -16px 0 48px rgba(0,0,0,0.7);
  --shadow-glow:   0 0 0 1px var(--brand-gold), 0 4px 16px rgba(225,160,60,0.12);
  --shadow-card-hover: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(225,160,60,0.1);

  /* ── Layout ── */
  --sidebar-w:  248px;
  --header-h:   60px;
  --content-px: 52px;

  /* ── Motion ── */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast:      120ms ease;
  --t-std:       200ms var(--ease-out);
  --t-slow:      350ms var(--ease-out);
}

body.light-mode {
  --bg-app:       #f5f5f7;
  --bg-panel:     #ffffff;
  --bg-panel-2:   #fafafa;
  --bg-subtle:    #f0f0f3;
  --bg-sidebar:   #fafafa;

  --border:       #e2e2e8;
  --border-mid:   #d8d8e0;
  --border-hover: #c0c0cc;

  --text-primary:   #0a0a10;
  --text-secondary: #4a4a5a;
  --text-muted:     #72728a;
  --text-faint:     #b0b0c0;

  --c-green-bg:     rgba(34, 197, 94, 0.06);
  --c-green-border: rgba(34, 197, 94, 0.22);
  --c-green-txt:    #16a34a;

  --c-blue-bg:     rgba(59, 130, 246, 0.06);
  --c-blue-border: rgba(59, 130, 246, 0.22);
  --c-blue-txt:    #1d4ed8;

  --c-amber-bg:     rgba(245, 158, 11, 0.06);
  --c-amber-border: rgba(245, 158, 11, 0.22);
  --c-amber-txt:    #b45309;

  --c-red-bg:     rgba(239, 68, 68, 0.06);
  --c-red-border: rgba(239, 68, 68, 0.22);
  --c-red-txt:    #b91c1c;

  --c-slate-bg:     rgba(113, 113, 122, 0.06);
  --c-slate-border: rgba(113, 113, 122, 0.22);
  --c-slate-txt:    #4b5563;

  --shadow-xs:  0 1px 3px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.07);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.08);
  --shadow-drawer: -12px 0 40px rgba(0,0,0,0.1);
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--bg-app);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  letter-spacing: -0.012em;
  transition: background-color var(--t-std), color var(--t-std);
}

h1, h2, h3, h4, .header-title, .card-title, .drawer-title, .modal-title {
  letter-spacing: -0.025em;
  font-weight: 600;
  line-height: 1.2;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

/* Premium scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: var(--r-full);
  transition: background var(--t-fast);
}
::-webkit-scrollbar-thumb:hover { background: var(--brand-indigo-mid); }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.95) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes shimmer {
  from { background-position: -400% 0; }
  to   { background-position: 400% 0; }
}

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

@keyframes pulse-ring {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%       { opacity: 0.8; transform: scale(1.05); }
}

@keyframes empty-float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-6px); }
}

.animate-fade-up { animation: fadeUp 0.35s var(--ease-out) both; }
.animate-scale-up { animation: scaleUp 0.30s var(--ease-out) both; }
.anim-delay-1 { animation-delay: 0.06s; }
.anim-delay-2 { animation-delay: 0.12s; }
.anim-delay-3 { animation-delay: 0.18s; }
.anim-delay-4 { animation-delay: 0.24s; }

/* ==========================================================================
   LAYOUT
   ========================================================================== */

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

/* ── SIDEBAR ── */
.app-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform var(--t-std), background-color var(--t-std), border-color var(--t-std);
}

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

.logo-container {
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 34px;
  max-width: 148px;
  object-fit: contain;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.brand-logo:hover { transform: scale(1.04); opacity: 0.9; }

.close-sidebar-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.close-sidebar-btn:hover { background: var(--bg-subtle); color: var(--text-primary); }

/* Sidebar nav */
.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-faint);
  padding: 0 10px;
  margin: 20px 0 5px;
}
.nav-section-label:first-child { margin-top: 4px; }

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text-secondary);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  cursor: pointer;
  position: relative;
}

.nav-link i {
  width: 16px; height: 16px;
  color: var(--text-faint);
  flex-shrink: 0;
  transition: color var(--t-fast);
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}
.nav-link:hover i { color: var(--text-secondary); }

.nav-link.active {
  background: linear-gradient(135deg, rgba(225, 160, 60, 0.12), rgba(225, 160, 60, 0.06));
  color: var(--brand-gold);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 2.5px;
  background: linear-gradient(180deg, var(--brand-gold), var(--brand-gold-light));
  border-radius: 0 var(--r-full) var(--r-full) 0;
}
.nav-link.active i { color: var(--brand-gold); }

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 8px;
  border-radius: var(--r-md);
  cursor: default;
  transition: background var(--t-fast);
}
.user-profile:hover { background: var(--bg-subtle); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-indigo), var(--brand-indigo-mid));
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--brand-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(50, 45, 105, 0.4);
}

.user-info { display: flex; flex-direction: column; min-width: 0; gap: 1px; }

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role { font-size: 11px; color: var(--text-muted); }

/* ── MAIN WRAPPER ── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0; /* Evita que flex child expanda horizontalmente */
}

/* ── HEADER ── */
.app-header {
  height: var(--header-h);
  padding: 0 var(--content-px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-app);
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color var(--t-std), border-color var(--t-std);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  background: var(--bg-panel);
  transition: all var(--t-fast);
}
.menu-toggle-btn:hover { background: var(--bg-subtle); border-color: var(--border-hover); }

.header-title-area {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.header-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: -0.01em;
}

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

.current-date-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-panel);
  transition: all var(--t-fast);
}
.current-date-badge i { width: 13px; height: 13px; color: var(--text-faint); }
.current-date-badge:hover { border-color: var(--border-hover); }

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--bg-panel);
  transition: all var(--t-fast);
}
.theme-toggle-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.theme-toggle-btn i { width: 14px; height: 14px; }
.theme-toggle-btn .sun-icon { display: none; }
.theme-toggle-btn .moon-icon { display: block; }
body.light-mode .theme-toggle-btn .sun-icon { display: block; }
body.light-mode .theme-toggle-btn .moon-icon { display: none; }

/* ── MAIN CONTENT ── */
.app-content {
  flex: 1;
  padding: 48px var(--content-px);
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  min-width: 0; /* Evita que flex child expanda horizontalmente */
}

/* Footer */
.app-footer-bar {
  padding: 18px 32px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  letter-spacing: 0.01em;
}

/* ==========================================================================
   UI PRIMITIVES — PANELS & BUTTONS
   ========================================================================== */

/* ── Panels / Cards ── */
.glass-panel, .premium-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-std), box-shadow var(--t-std), background-color var(--t-std), transform var(--t-std);
  position: relative;
}

/* Premium glow border on hover */
.glass-panel:hover, .premium-card:hover {
  border-color: var(--border-mid);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(225,160,60,0.05);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}
.btn i { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-gold), var(--brand-gold-light));
  color: #08080a;
  font-weight: 700;
  border: 1px solid var(--brand-gold);
  box-shadow: 0 1px 4px rgba(225,160,60,0.25), inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative;
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.btn-primary:hover::before { opacity: 1; }
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-gold-light), #f8c060);
  box-shadow: 0 4px 16px rgba(225,160,60,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-hover);
}

.btn-secondary-outline {
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-secondary-outline:hover {
  border-color: var(--brand-gold);
  color: var(--brand-gold);
  background: var(--brand-gold-dim);
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  border: 1px solid #f43f5e;
  box-shadow: 0 2px 8px rgba(244,63,94,0.2);
}
.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(244,63,94,0.3);
  transform: translateY(-1px);
}
.btn-danger:active { transform: translateY(0); }

.btn-danger-outline {
  border: 1px solid rgba(244,63,94,0.25);
  color: #fb7185;
}
.btn-danger-outline:hover {
  background: rgba(244,63,94,0.08);
  border-color: #f43f5e;
}

.btn-primary-outline {
  border: 1px solid rgba(225,160,60,0.3);
  color: var(--brand-gold);
}
.btn-primary-outline:hover {
  background: var(--brand-gold-dim);
  border-color: var(--brand-gold);
}

.btn-text {
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-text i { width: 12px; height: 12px; }
.btn-text:hover { background: var(--bg-subtle); color: var(--text-primary); }

/* ── View Toggle ── */
.view-section { display: none; }
.view-section.active { display: block; }

/* ── Date Range Filter ── */
.date-range-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 270px;
  max-width: 360px;
}

.date-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.date-input-group input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 12.5px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-width: 110px;
}

.date-input-group input[type="date"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(225,160,60,0.12);
  outline: none;
}

.date-separator {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.date-range-wrapper .btn-text {
  flex-shrink: 0;
  padding: 4px;
  width: 24px;
  height: 24px;
}

.date-range-wrapper .btn-text i {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   VIEW 1 — EXECUTIVE DASHBOARD
   ========================================================================== */

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

.kpi-card {
  padding: 28px 28px 24px;
  position: relative;
  overflow: hidden;
  cursor: default;
}

/* Subtle gradient noise on cards */
.kpi-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top right, rgba(225,160,60,0.04) 0%, transparent 60%);
  pointer-events: none;
  border-radius: inherit;
}

/* Left accent bar */
.kpi-card::before {
  content: '';
  position: absolute;
  left: 0; top: 20px; bottom: 20px;
  width: 2.5px;
  border-radius: 0 var(--r-full) var(--r-full) 0;
  background: var(--border);
  transition: background var(--t-std);
}
.kpi-card:nth-child(1)::before { background: var(--text-muted); }
.kpi-card:nth-child(2)::before {
  background: linear-gradient(180deg, var(--c-blue-dot), rgba(59,130,246,0.4));
}
.kpi-card:nth-child(3)::before {
  background: linear-gradient(180deg, var(--c-green-dot), rgba(34,197,94,0.4));
}
.kpi-card:nth-child(4)::before {
  background: linear-gradient(180deg, var(--c-amber-dot), rgba(245,158,11,0.4));
}

.kpi-icon-wrapper {
  position: absolute;
  top: 24px; right: 24px;
  color: var(--text-faint);
  transition: color var(--t-std);
}
.kpi-icon-wrapper i { width: 18px; height: 18px; }
.kpi-card:hover .kpi-icon-wrapper { color: var(--text-muted); }

/* Skeleton loading state */
.kpi-card.is-loading .kpi-value,
.kpi-card.is-loading .kpi-trend,
.kpi-card.is-loading .kpi-title {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.kpi-card.is-loading .kpi-value::after,
.kpi-card.is-loading .kpi-trend::after,
.kpi-card.is-loading .kpi-title::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg,
    var(--bg-subtle) 25%,
    var(--bg-panel-2) 50%,
    var(--bg-subtle) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}

.kpi-data { display: flex; flex-direction: column; }

.kpi-title {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.kpi-trend i { width: 12px; height: 12px; }
.trend-up     { color: var(--c-green-dot); }
.trend-down   { color: var(--c-red-dot); }
.trend-info   { color: var(--c-blue-dot); }
.trend-neutral { color: var(--text-muted); }

/* ── Charts Grid ── */
.charts-grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 14px;
  margin-bottom: 20px;
}

.chart-card {
  padding: 28px 30px;
  display: flex;
  flex-direction: column;
}

.card-header { margin-bottom: 20px; }

.card-header-action {
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 400;
}

.chart-container {
  position: relative;
  flex: 1;
  min-height: 230px;
  max-height: 270px;
}

/* Empty chart overlay */
.chart-empty-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  pointer-events: none;
}
.chart-empty-overlay i {
  width: 28px; height: 28px;
  color: var(--text-faint);
  animation: empty-float 3s ease-in-out infinite;
}
.chart-empty-overlay p {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 500;
  max-width: 140px;
  line-height: 1.4;
}

/* ── Dashboard detail grid ── */
.dashboard-details-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 14px;
}

.details-card { padding: 28px 30px; }

/* ── Recent contacts ── */
.recent-list-container {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  transition: background var(--t-fast);
  gap: 12px;
}
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: var(--bg-subtle); }

.recent-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.recent-avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.recent-item:hover .recent-avatar {
  border-color: var(--border-hover);
  background: var(--bg-panel-2);
}
.recent-avatar i { width: 13px; height: 13px; }

.recent-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.recent-company {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-meta { font-size: 11px; color: var(--text-muted); }

.recent-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.recent-val {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Performance metrics ── */
.funnel-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.performance-metric { display: flex; flex-direction: column; gap: 7px; }

.metric-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.metric-label { color: var(--text-secondary); font-weight: 500; }
.metric-val {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.metric-bar-wrapper {
  height: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--r-full);
  overflow: hidden;
}
body.light-mode .metric-bar-wrapper {
  background: rgba(0,0,0,0.06);
}
.metric-bar {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 0.7s var(--ease-out);
}
.success-bar { background: linear-gradient(90deg, var(--c-green-dot), #4ade80); }
.lost-bar    { background: linear-gradient(90deg, var(--c-red-dot), #f87171); }
.warning-bar { background: linear-gradient(90deg, var(--c-amber-dot), #fbbf24); }
.info-bar    { background: linear-gradient(90deg, var(--c-blue-dot), #60a5fa); }

/* ── Empty state ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--text-faint);
  text-align: center;
  gap: 8px;
  font-size: 12px;
}
.empty-state i { width: 24px; height: 24px; }

/* ── Dashboard Premium Empty State ── */
.dashboard-empty-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
  gap: 0;
}

.dashboard-empty-icon {
  width: 64px; height: 64px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, rgba(50,45,105,0.3), rgba(50,45,105,0.1));
  border: 1px solid rgba(50,45,105,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  animation: empty-float 4s ease-in-out infinite;
  box-shadow: 0 8px 32px rgba(50,45,105,0.2);
}
.dashboard-empty-icon i { width: 28px; height: 28px; color: var(--brand-gold); }

.dashboard-empty-hero h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.dashboard-empty-hero p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 340px;
  margin-bottom: 24px;
}

/* ==========================================================================
   VIEW 2 — PROPOSALS TABLE
   ========================================================================== */

/* Toolbar */
.toolbar-panel {
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.toolbar-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.toolbar-row-bottom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 2px;
}

.filter-comercial-wrapper {
  max-width: 280px;
}

@media (max-width: 768px) {
  .filter-comercial-wrapper {
    max-width: 100%;
  }
}

.filter-search-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  max-width: 360px;
}
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px; height: 13px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-input-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 33px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.search-input-wrapper input::placeholder { color: var(--text-faint); }
.search-input-wrapper input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(225,160,60,0.12);
  background: var(--bg-panel);
}

/* Select dropdowns */
.select-wrapper, .select-wrapper-form { position: relative; min-width: 140px; flex: 1; }
.select-wrapper::after, .select-wrapper-form::after {
  content: '';
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-65%) rotate(45deg);
  width: 5px; height: 5px;
  border-right: 1.5px solid var(--text-faint);
  border-bottom: 1.5px solid var(--text-faint);
  pointer-events: none;
}
.select-wrapper select, .select-wrapper-form select {
  width: 100%;
  padding: 8px 28px 8px 12px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.select-wrapper select:focus, .select-wrapper-form select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(225,160,60,0.12);
  outline: none;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.filter-totals {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.total-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.total-item i {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
}
.total-item.total-value {
  font-weight: 700;
  color: var(--brand-gold);
  padding-left: 16px;
  border-left: 1px solid var(--border);
}
.total-item.total-value i {
  color: var(--brand-gold);
}

.records-counter {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Table container */
.table-container-outer {
  padding: 0;
  overflow: hidden;
}
.table-responsive-desktop {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.proposal-table {
  width: 100%;
  min-width: 700px;   /* garante scroll horizontal antes de esmagar */
  border-collapse: collapse;
  table-layout: auto;
}

/* ── Column widths ── */
.col-nproposta  { width: 130px;  white-space: nowrap; }
.col-empresa    { min-width: 160px; }
.col-pessoa     { min-width: 140px; }
.col-data       { width: 110px;  white-space: nowrap; }
.col-tipo       { width: 130px;  white-space: nowrap; }
.col-valor      { width: 140px;  white-space: nowrap; }
.col-status     { width: 150px;  white-space: nowrap; }
.col-comercial  { width: 120px;  white-space: nowrap; }
.col-actions    { width: 80px; }

/* Torna a coluna de acções sticky à direita para estar sempre visível */
.proposal-table th.col-actions,
.proposal-table td.col-actions {
  position: sticky;
  right: 0;
  background: var(--bg-panel);
  z-index: 10;
  box-shadow: -4px 0 8px rgba(0,0,0,0.12);
}
.proposal-table tbody tr:hover td.col-actions {
  background: var(--bg-subtle);
}
.proposal-table th, .proposal-table td {
  padding: 15px 24px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.proposal-table th {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: transparent;
  white-space: nowrap;
}
.proposal-table tbody tr { transition: background var(--t-fast), transform var(--t-fast); }
.proposal-table tbody tr:hover { background: var(--bg-subtle); transform: translateX(1px); }
.proposal-table tbody tr:last-child td { border-bottom: none; }

/* Skeleton rows for table */
.skeleton-row td {
  padding: 15px 24px;
  border-bottom: 1px solid var(--border);
}
.skeleton-row td::after {
  content: '';
  display: block;
  height: 12px;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg,
    var(--bg-subtle) 25%,
    var(--bg-panel-2) 50%,
    var(--bg-subtle) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  width: 80%;
}
.skeleton-row td:first-child::after { width: 50%; }
.skeleton-row td:last-child::after  { width: 30%; }

/* Table cell chips */
.prop-num {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.date-chip {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px 7px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tipo-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}
.valor-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.comercial-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Company avatar in table */
.empresa-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.empresa-avatar {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}
.avatar-color-0 { background: rgba(59,130,246,0.14);  color: #93c5fd; }
.avatar-color-1 { background: rgba(34,197,94,0.14);   color: #86efac; }
.avatar-color-2 { background: rgba(245,158,11,0.14);  color: #fcd34d; }
.avatar-color-3 { background: rgba(239,68,68,0.14);   color: #fca5a5; }
.avatar-color-4 { background: rgba(168,85,247,0.14);  color: #d8b4fe; }
.avatar-color-5 { background: rgba(20,184,166,0.14);  color: #5eead4; }

/* ── Status Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--r-full);
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-adjudicado { background: var(--c-green-bg); color: var(--c-green-txt); border-color: var(--c-green-border); }
.badge-adjudicado::before { background: var(--c-green-dot); box-shadow: 0 0 4px var(--c-green-dot); }

.badge-analise { background: var(--c-blue-bg); color: var(--c-blue-txt); border-color: var(--c-blue-border); }
.badge-analise::before { background: var(--c-blue-dot); box-shadow: 0 0 4px var(--c-blue-dot); }

.badge-sem-verba { background: var(--c-amber-bg); color: var(--c-amber-txt); border-color: var(--c-amber-border); }
.badge-sem-verba::before { background: var(--c-amber-dot); }

.badge-perdido { background: var(--c-red-bg); color: var(--c-red-txt); border-color: var(--c-red-border); }
.badge-perdido::before { background: var(--c-red-dot); }

.badge-cancelado { background: var(--c-slate-bg); color: var(--c-slate-txt); border-color: var(--c-slate-border); }
.badge-cancelado::before { background: var(--c-slate-dot); }

/* ── Table action buttons ── */
.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.action-btn {
  width: 30px; height: 30px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  color: var(--text-faint);
}
.action-btn i { width: 13px; height: 13px; }
.action-btn:hover { background: var(--bg-subtle); color: var(--text-primary); border-color: var(--border-hover); }
.action-btn.delete-btn:hover { color: #ef4444; background: rgba(239,68,68,0.08); }

/* ── Mobile cards ── */
.mobile-cards-grid {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}
.mobile-prop-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.mobile-prop-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}
.mobile-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.mobile-card-title { display: flex; flex-direction: column; gap: 2px; }
.mobile-company { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.mobile-number  { font-size: 11px; color: var(--text-muted); }
.mobile-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mobile-card-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin-bottom: 2px;
}
.mobile-card-val { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.mobile-card-val.val-emphasis { font-weight: 700; color: var(--text-primary); }
.mobile-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ── Empty state large ── */
.empty-state-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 32px;
  text-align: center;
  color: var(--text-secondary);
}
.empty-icon-box {
  width: 52px; height: 52px;
  border-radius: var(--r-xl);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 16px;
  animation: empty-float 3.5s ease-in-out infinite;
}
.empty-icon-box i { width: 20px; height: 20px; }
.empty-state-large h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 7px;
  letter-spacing: -0.02em;
}
.empty-state-large p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.6;
}

/* ==========================================================================
   VIEW 3 — SETTINGS
   ========================================================================== */

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.settings-card { padding: 28px 30px; }
.settings-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  gap: 16px;
  transition: all var(--t-fast);
}
.setting-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-subtle);
}
.setting-info { flex: 1; }
.setting-info h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.setting-info p { font-size: 11.5px; color: var(--text-muted); }

/* About card */
.about-app {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  text-align: center;
}
.app-logo-large {
  padding: 14px 24px;
  background: var(--bg-subtle);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  display: inline-flex;
}
.app-logo-large img {
  height: 30px;
  object-fit: contain;
  filter: grayscale(0.6);
  opacity: 0.85;
}
.about-app p {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.65;
}
.app-specs {
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.spec-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.spec-row:hover { background: var(--bg-subtle); }
.spec-row span   { color: var(--text-muted); }
.spec-row strong { color: var(--text-primary); font-weight: 600; }

/* DB status row in sidebar */
.db-status-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}
.db-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background var(--t-std), box-shadow var(--t-std);
}
.db-dot--online {
  background: var(--c-green-dot);
  box-shadow: 0 0 6px var(--c-green-dot);
  animation: pulse-ring 2.5s ease-in-out infinite;
}
.db-dot--offline {
  background: var(--c-slate-dot);
  box-shadow: none;
}
.db-dot--warning {
  background: var(--c-amber-dot);
  box-shadow: 0 0 6px var(--c-amber-dot);
  animation: pulse-ring 2.5s ease-in-out infinite;
}
.db-status-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ==========================================================================
   DRAWER (SLIDE-OVER FORM)
   ========================================================================== */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,9,.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-std);
}
.drawer-overlay.active { opacity: 1; pointer-events: auto; }

.drawer-content {
  position: absolute;
  top: 0; right: 0;
  width: 500px;
  max-width: 100%;
  height: 100%;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-drawer);
  transform: translateX(100%);
  transition: transform var(--t-slow);
  display: flex;
  flex-direction: column;
}
.drawer-overlay.active .drawer-content { transform: translateX(0); }

.drawer-header {
  height: var(--header-h);
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--bg-panel-2);
}
.drawer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.close-drawer-btn {
  width: 30px; height: 30px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
}
.close-drawer-btn i { width: 14px; height: 14px; }
.close-drawer-btn:hover { background: var(--border-mid); color: var(--text-primary); }

.drawer-form {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.input-icon-wrapper { position: relative; }
.input-icon-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px; height: 13px;
  color: var(--text-faint);
  pointer-events: none;
  transition: color var(--t-fast);
}
.input-icon-wrapper:focus-within i { color: var(--brand-gold); }

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.form-control::placeholder { color: var(--text-faint); }
.input-icon-wrapper .form-control { padding-left: 34px; }
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(225,160,60,0.12);
  background: var(--bg-panel);
  outline: none;
}
.form-control.is-invalid { border-color: #ef4444 !important; }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }

.invalid-feedback {
  display: none;
  font-size: 11px;
  font-weight: 500;
  color: #f87171;
}

.text-area-control {
  resize: vertical;
  min-height: 96px;
  line-height: 1.6;
  padding-left: 12px !important;
}

.drawer-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg-panel-2);
}

/* ==========================================================================
   DETAILS DRAWER (Visualização de Detalhes da Proposta)
   ========================================================================== */

.details-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 8, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-std);
}
.details-drawer-overlay.active { opacity: 1; pointer-events: auto; }

.details-drawer-content {
  position: absolute;
  top: 0; right: 0;
  width: 560px;
  max-width: 100%;
  height: 100%;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-mid);
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform var(--t-slow);
  display: flex;
  flex-direction: column;
}
.details-drawer-overlay.active .details-drawer-content { transform: translateX(0); }

.details-drawer-header {
  height: var(--header-h);
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--bg-panel-2);
}

.details-drawer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.close-details-btn {
  width: 30px; height: 30px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
}
.close-details-btn i { width: 14px; height: 14px; }
.close-details-btn:hover { background: var(--border-mid); color: var(--text-primary); }

.details-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* Details sections */
.details-section {
  margin-bottom: 28px;
}
.details-section:last-child { margin-bottom: 0; }

.details-section-title {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Details grid */
.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.details-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.details-item.full-width { grid-column: 1 / -1; }

.details-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.details-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
}
.details-value.emphasis {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-gold);
  letter-spacing: -0.02em;
}
.details-value.mono {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
}

/* Details hero card */
.details-hero {
  background: linear-gradient(135deg, rgba(50, 45, 105, 0.15), rgba(225, 160, 60, 0.08));
  border: 1px solid rgba(50, 45, 105, 0.3);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.details-hero-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.details-hero-company {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.details-hero-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  margin-top: 4px;
}

.details-hero-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--brand-gold);
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.details-hero-meta {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.details-hero-meta span {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Resumo text */
.details-resumo {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

/* Details drawer footer with actions */
.details-drawer-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg-panel-2);
}

.details-drawer-actions {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   CONFIRM MODAL
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,9,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--t-std);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-box {
  width: 380px;
  max-width: 90%;
  padding: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: scaleUp var(--t-std) both;
}

.modal-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: rgba(244,63,94,0.1);
  color: #f87171;
  border: 1px solid rgba(244,63,94,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.modal-icon i { width: 16px; height: 16px; }
.modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 7px;
}
.modal-message {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 270px;
  max-width: 340px;
  padding: 11px 14px;
  border-radius: var(--r-lg);
  background: var(--bg-panel);
  border: 1px solid var(--border-mid);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  transform: translateY(16px);
  opacity: 0;
  transition: transform var(--t-std), opacity var(--t-std);
  pointer-events: auto;
}
.toast.show { transform: translateY(0); opacity: 1; }

.toast-icon { width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.toast-icon i { width: 14px; height: 14px; }
.toast-message { font-size: 12.5px; font-weight: 500; line-height: 1.4; flex: 1; }

.toast-success { border-left: 3px solid var(--c-green-dot); }
.toast-success .toast-icon { color: var(--c-green-dot); }
.toast-error   { border-left: 3px solid var(--c-red-dot); }
.toast-error .toast-icon   { color: var(--c-red-dot); }
.toast-info    { border-left: 3px solid var(--c-blue-dot); }
.toast-info .toast-icon    { color: var(--c-blue-dot); }

/* Toast body + progress bar */
.toast-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.toast-progress {
  height: 2px;
  border-radius: var(--r-full);
  background: currentColor;
  opacity: 0.25;
  transform-origin: left;
  animation: toast-shrink 4s linear forwards;
}
@keyframes toast-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Button spinner */
.btn-spinner {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(0,0,0,0.15);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Empty state inline (recent contacts) */
.empty-state-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 20px;
  text-align: center;
  color: var(--text-faint);
}
.empty-state-inline svg { opacity: 0.4; animation: empty-float 4s ease-in-out infinite; }
.empty-state-inline p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}
.empty-state-inline p span { display: block; color: var(--text-faint); font-size: 11px; margin-top: 2px; }

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.mt-16   { margin-top: 16px; }
.hidden  { display: none !important; }
.text-right  { text-align: right; }
.text-danger { color: #f87171 !important; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1280px) {
  .kpi-grid    { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}

/* Comprime o padding das células quando o espaço começa a apertar (sem ocultar colunas para manter os detalhes) */
@media (max-width: 1350px) {
  .proposal-table th, .proposal-table td { padding: 13px 16px; }
  .skeleton-row td { padding: 13px 16px; }
}

/* Comprime um pouco mais o padding em tablets grandes e ajusta a barra de filtros */
@media (max-width: 1200px) {
  .proposal-table th, .proposal-table td { padding: 12px 14px; }
  .skeleton-row td { padding: 12px 14px; }
  
  .toolbar-panel {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }
  .filter-search-group {
    flex-wrap: wrap;
    gap: 10px;
  }
  .search-input-wrapper {
    max-width: 100%;
    flex: 1 1 100%;
  }
  .select-wrapper {
    flex: 1 1 calc(33.333% - 7px);
    min-width: 120px;
  }
  .toolbar-actions {
    justify-content: flex-end;
    margin-top: 4px;
  }
}

@media (max-width: 1150px) {
  #btnOpenNewForm span { display: none; }
  .current-date-badge { padding: 6px 8px; }
  .current-date-badge span { font-size: 11px; }
}

@media (max-width: 1100px) {
  .dashboard-details-grid { grid-template-columns: 1fr; }
}

@media (max-width: 992px) {
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 32px rgba(0,0,0,0.25);
  }
  .app-sidebar.active { transform: translateX(0); }
  .close-sidebar-btn  { display: flex; }
  .main-wrapper       { margin-left: 0; }
  .menu-toggle-btn    { display: flex; }
  .app-header         { padding: 0 20px; }
  .app-content        { padding: 24px 20px; --content-px: 20px; }
  .current-date-badge { display: none; }
  #btnOpenNewForm span { display: none; }
}

/* Switch para cartões mobile abaixo de 1024px */
@media (max-width: 1024px) {
  .table-responsive-desktop { display: none; }
  .mobile-cards-grid        { display: flex; }
}

@media (max-width: 768px) {
  .kpi-grid       { grid-template-columns: 1fr 1fr; gap: 10px; }
  .settings-grid  { grid-template-columns: 1fr; }
  .form-row-2     { grid-template-columns: 1fr; }
  .kpi-value      { font-size: 22px; }
  .kpi-card       { padding: 22px 20px 18px; }
  .chart-card, .details-card { padding: 22px 20px; }
  .drawer-content { width: 100%; }
  .header-subtitle { display: none; } /* Ocultar subtítulo para economizar altura no mobile */
  /* Toolbar filters: wrap to 2 per row on tablet */
  .filter-search-group  { flex-wrap: wrap; }
  .search-input-wrapper { max-width: 100%; flex: 1 1 100%; }
  .date-range-wrapper   { max-width: 100%; }
  .select-wrapper       { flex: 1 1 calc(50% - 5px); min-width: 120px; }
  .toolbar-panel        { flex-direction: column; align-items: stretch; }
  .toolbar-actions      { justify-content: flex-end; }
}

@media (max-width: 480px) {
  .kpi-grid           { grid-template-columns: 1fr; }
  .header-actions     { gap: 6px; }
  .current-date-badge { display: none; }
  /* Toolbar filters: single column on phone */
  .select-wrapper     { flex: 1 1 100%; min-width: 100%; }
}

/* ==========================================================================
   AUTENTICAÇÃO & GLASSMORPHISM
   ========================================================================== */
.auth-wrapper {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, rgba(8, 8, 10, 0.98) 0%, rgba(20, 20, 25, 0.96) 90%);
  padding: 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: opacity var(--t-std), visibility var(--t-std);
}
.auth-wrapper.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Light mode override for auth screen */
body.light-mode .auth-wrapper {
  background: radial-gradient(circle at 10% 20%, rgba(230, 230, 240, 0.97) 0%, rgba(245, 245, 250, 0.97) 90%);
}
body.light-mode .auth-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(50, 45, 105, 0.15);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.auth-card {
  width: 420px;
  max-width: 100%;
  padding: 40px 36px;
  background: rgba(15, 15, 17, 0.65);
  border: 1px solid rgba(225, 160, 60, 0.12);
  border-radius: var(--r-2xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.03);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(225, 160, 60, 0.03) 0%, transparent 60%);
  pointer-events: none;
}

.auth-header {
  margin-bottom: 28px;
}
.auth-logo {
  height: 48px;
  object-fit: contain;
  margin-bottom: 16px;
}
.auth-card h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  margin-bottom: 6px;
}
.auth-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 0 10px;
}

.auth-form {
  text-align: left;
  display: flex;
  flex-direction: column;
}

.auth-switch {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 20px;
}
.auth-switch a {
  color: var(--brand-gold);
  font-weight: 600;
  transition: color var(--t-fast);
}
.auth-switch a:hover {
  color: var(--brand-gold-light);
  text-decoration: underline;
}

/* Utilitários Extras */
.w-full { width: 100% !important; }
.mt-16 { margin-top: 16px !important; }
.mt-24 { margin-top: 24px !important; }

/* Logout Button */
.logout-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  background: transparent;
  flex-shrink: 0;
}
.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.logout-btn i {
  width: 14px;
  height: 14px;
}

/* Light mode overrides for Auth */
body.light-mode .auth-wrapper {
  background: radial-gradient(circle at 10% 20%, rgba(245, 245, 247, 0.98) 0%, rgba(230, 230, 235, 0.96) 90%);
}
body.light-mode .auth-card {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(225, 160, 60, 0.25);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}


@media (min-width: 1025px) {
  .mobile-cards-grid { display: none; }
}

/* ==========================================================================
   PAINEL DE PAGINAÇÃO
   ========================================================================== */
.pagination-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: transparent;
  border-top: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}
.pagination-info {
  font-size: 12.5px;
  color: var(--text-muted);
}
.pagination-info span {
  font-weight: 600;
  color: var(--text-primary);
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pagination-pages {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pagination-pages .btn {
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12.5px;
}
.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--r-md);
  height: 32px;
}
.btn-sm i {
  width: 14px;
  height: 14px;
}
