/* ═══════════════════════════════════════════════════════
   FinDash — Design System Premium
   Paleta Fintech | Inter Font | 8px Grid
   ═══════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  /* Base */
  --bg:          #0F172A;
  --bg-card:     #111827;
  --bg-elevated: #1a2236;
  --bg-input:    #1F2937;
  --border:      #1F2937;
  --border-light:#2D3748;

  /* Brand */
  --blue:        #3B82F6;
  --blue-hover:  #2563EB;
  --blue-dim:    rgba(59,130,246,0.12);
  --green:       #22C55E;
  --green-dim:   rgba(34,197,94,0.12);
  --red:         #EF4444;
  --red-dim:     rgba(239,68,68,0.12);
  --yellow:      #F59E0B;
  --yellow-dim:  rgba(245,158,11,0.12);
  --purple:      #8B5CF6;
  --purple-dim:  rgba(139,92,246,0.12);

  /* Text */
  --text:        #E5E7EB;
  --text-muted:  #9CA3AF;
  --text-dim:    #4B5563;

  /* Sidebar */
  --sidebar-w:       240px;
  --sidebar-w-compact: 72px;
  --topbar-h:        60px;

  /* Misc */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --shadow:    0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.5);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 150ms cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }
a { text-decoration: none; cursor: pointer; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width var(--transition);
  overflow: hidden;
}

.sidebar.compact { width: var(--sidebar-w-compact); }
.sidebar.compact .logo-label,
.sidebar.compact .nav-item span,
.sidebar.compact .sidebar-toggle { opacity: 0; pointer-events: none; }
.sidebar.compact .nav-item { justify-content: center; padding: 10px 0; }
.sidebar.compact .nav-item span { display: none; }
.sidebar.compact .logo-mark { margin: 0 auto; }
.sidebar.compact .sidebar-logo { justify-content: center; padding: 20px 0; }

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo-mark {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #1d4ed8, #4f46e5);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 13px; font-weight: 900;
  color: #fff; letter-spacing: -0.5px;
  box-shadow: 0 0 16px rgba(59,130,246,0.45), 0 0 32px rgba(79,70,229,0.2);
  position: relative; overflow: hidden;
}

.logo-mark::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: conic-gradient(transparent 0deg, rgba(255,255,255,0.12) 60deg, transparent 120deg);
  animation: logoMarkSpin 4s linear infinite;
}

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

.logo-label {
  font-size: 16px; font-weight: 700;
  background: linear-gradient(135deg, #93C5FD, #C4B5FD);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
  white-space: nowrap;
  transition: opacity var(--transition);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: color var(--transition);
}

.nav-item:hover {
  background: var(--bg-input);
  color: var(--text);
}

.nav-item.active {
  background: var(--blue-dim);
  color: var(--blue);
}

.nav-item.active i { color: var(--blue); }

/* Footer */
.sidebar-footer {
  padding: 10px 10px 16px;
  border-top: 1px solid var(--border);
}

/* Toggle button */
.sidebar-toggle {
  position: absolute;
  bottom: 80px; right: -14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  transition: all var(--transition);
  z-index: 10;
  cursor: pointer;
}

.sidebar-toggle:hover { background: var(--bg-elevated); color: var(--text); }
.sidebar.compact .sidebar-toggle { transform: rotate(180deg); opacity: 1 !important; pointer-events: auto !important; right: -14px; }

/* ══════════════════════════════════════
   MAIN WRAPPER
══════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.main-wrapper.compact { margin-left: var(--sidebar-w-compact); }

/* ══════════════════════════════════════
   TOPBAR
══════════════════════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: rgba(15,23,42,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 160px;
}

.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: var(--bg-input);
  font-size: 15px;
  transition: all var(--transition);
}

.mobile-menu-btn:hover { color: var(--text); }

.page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.topbar-center { flex: 1; max-width: 480px; margin: 0 auto; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color var(--transition);
}

.search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
}

.search-box i { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }

.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  padding: 9px 0;
}

.search-box input::placeholder { color: var(--text-dim); }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.search-results.open { display: block; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-elevated); }

.search-result-item .sr-cat { font-size: 12px; color: var(--text-muted); }
.search-result-item .sr-val { margin-left: auto; font-weight: 600; font-size: 13px; }
.search-result-item .sr-val.e { color: var(--green); }
.search-result-item .sr-val.s { color: var(--red); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  position: relative;
}

.topbar-btn:hover { background: var(--bg-elevated); color: var(--text); border-color: var(--border-light); }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  display: none;
}

.notif-dot.show { display: block; }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}

/* Notif Panel */
.notif-panel {
  position: fixed;
  top: calc(var(--topbar-h) + 8px);
  right: 16px;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  display: none;
  overflow: hidden;
  animation: fadeSlideDown 0.2s ease;
}

.notif-panel.open { display: block; }

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notif-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
}

.notif-header button { color: var(--blue); font-size: 12px; font-weight: 500; }
.notif-header button:hover { text-decoration: underline; }

.notif-list { max-height: 260px; overflow-y: auto; }

.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
  transition: background var(--transition);
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-elevated); }
.notif-item i { font-size: 14px; margin-top: 1px; flex-shrink: 0; }
.notif-item .ni-msg { color: var(--text); margin-bottom: 2px; }

.notif-empty { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; }

/* ══════════════════════════════════════
   PAGE CONTENT
══════════════════════════════════════ */
.page-content { flex: 1; padding: 24px; overflow-y: auto; }

.page { display: none; animation: pageFadeIn 0.2s ease; }
.page.active { display: block; }

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

/* ── Page Toolbar ── */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover { border-color: var(--border-light); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 8px;
}

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

.card-title i { color: var(--blue); font-size: 13px; }
.card-actions { display: flex; gap: 8px; align-items: center; }

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

.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.02), transparent);
  pointer-events: none;
}

.kpi-card:hover { border-color: var(--border-light); transform: translateY(-1px); box-shadow: var(--shadow); }

.kpi-card.kpi-sm { padding: 14px 16px; }

.kpi-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.kpi-body { flex: 1; min-width: 0; }

.kpi-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

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

.kpi-value-sm { font-size: 17px; }

.kpi-trend {
  font-size: 11px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ══════════════════════════════════════
   GRIDS
══════════════════════════════════════ */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* ══════════════════════════════════════
   CHARTS
══════════════════════════════════════ */
.chart-wrap { position: relative; }

/* ══════════════════════════════════════
   TRANSACTIONS TABLE
══════════════════════════════════════ */
.tx-table-header {
  display: grid;
  grid-template-columns: 90px 130px 1fr 90px 110px 40px;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.tx-table { display: flex; flex-direction: column; gap: 2px; }

.tx-row {
  display: grid;
  grid-template-columns: 90px 130px 1fr 90px 110px 40px;
  gap: 8px;
  align-items: center;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  cursor: default;
  font-size: 13px;
}

.tx-row:hover { background: var(--bg-elevated); }

.tx-row .tx-date { color: var(--text-muted); font-size: 12px; }

.tx-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--bg-input);
  color: var(--text-muted);
}

.tx-desc { color: var(--text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tx-type-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  text-align: center;
}

.tx-type-badge.e { background: var(--green-dim); color: var(--green); }
.tx-type-badge.s { background: var(--red-dim); color: var(--red); }

.tx-val { font-weight: 700; font-size: 13px; text-align: right; }
.tx-val.e { color: var(--green); }
.tx-val.s { color: var(--red); }

.tx-actions { display: flex; justify-content: center; }
.tx-del-btn {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-dim);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: all var(--transition);
}

.tx-row:hover .tx-del-btn { opacity: 1; }
.tx-del-btn:hover { background: var(--red-dim); color: var(--red); }

/* ══════════════════════════════════════
   PROJECTS GRID
══════════════════════════════════════ */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.proj-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  position: relative;
}

.proj-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }

.proj-card-accent {
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--purple));
}

.proj-card-accent.green { background: linear-gradient(90deg, var(--green), #06b6d4); }
.proj-card-accent.yellow { background: linear-gradient(90deg, var(--yellow), var(--red)); }
.proj-card-accent.red { background: linear-gradient(90deg, var(--red), #ec4899); }
.proj-card-accent.gray { background: var(--border-light); }

.proj-card-body { padding: 18px; }

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

.proj-card-title-wrap { display: flex; align-items: center; gap: 10px; }

.proj-type-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.proj-name { font-size: 14px; font-weight: 600; color: var(--text); }
.proj-type { font-size: 11px; color: var(--text-muted); text-transform: capitalize; margin-top: 1px; }

.proj-actions { display: flex; gap: 6px; }

.proj-del-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-dim);
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}

.proj-del-btn:hover { background: var(--red-dim); color: var(--red); }

.proj-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.proj-metric {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.proj-metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.proj-metric-val { font-size: 13px; font-weight: 700; color: var(--text); }
.proj-metric-val.blue { color: var(--blue); }
.proj-metric-val.green { color: var(--green); }
.proj-metric-val.yellow { color: var(--yellow); }

.proj-progress-wrap { margin-bottom: 10px; }
.proj-progress-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-bottom: 5px; }

.proj-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.proj-dates { font-size: 11px; color: var(--text-muted); display: flex; gap: 12px; }
.proj-obs { font-size: 11px; color: var(--text-muted); font-style: italic; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 8px; }

/* Proj mini list (dashboard) */
.proj-mini-list { display: flex; flex-direction: column; gap: 8px; }

.proj-mini-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}

.proj-mini-item:hover { background: var(--bg-input); }
.proj-mini-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.proj-mini-name { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; }
.proj-mini-val { font-size: 12px; font-weight: 600; color: var(--green); }

/* ══════════════════════════════════════
   GOALS
══════════════════════════════════════ */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all var(--transition);
  position: relative;
}

.goal-card:hover { border-color: var(--border-light); }

.goal-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.goal-name { font-size: 14px; font-weight: 600; color: var(--text); }
.goal-pct { font-size: 18px; font-weight: 800; color: var(--blue); }
.goal-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 8px; }
.goal-forecast { font-size: 11px; color: var(--green); margin-top: 4px; display: flex; align-items: center; gap: 4px; }

.goal-del-btn {
  position: absolute; top: 14px; right: 14px;
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  background: none; color: var(--text-dim);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: all var(--transition);
}

.goal-card:hover .goal-del-btn { opacity: 1; }
.goal-del-btn:hover { background: var(--red-dim); color: var(--red); }

/* ══════════════════════════════════════
   TASKS
══════════════════════════════════════ */
.tasks-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
}

.task-card:hover { border-color: var(--border-light); }
.task-card.done { opacity: 0.5; border-color: transparent; }
.task-card.late { border-left: 3px solid var(--red); }

.task-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; cursor: pointer;
  transition: all var(--transition);
}

.task-check:hover { border-color: var(--green); }
.task-check.checked { background: var(--green); border-color: var(--green); color: #fff; }

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 13px; font-weight: 500; color: var(--text); }
.task-card.done .task-title { text-decoration: line-through; color: var(--text-muted); }

.task-meta { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; align-items: center; }

.task-tag {
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 20px;
}

.pri-alta   { background: var(--red-dim);    color: var(--red); }
.pri-media  { background: var(--yellow-dim); color: var(--yellow); }
.pri-baixa  { background: var(--green-dim);  color: var(--green); }

.task-date-tag { font-size: 10px; color: var(--text-muted); display: flex; align-items: center; gap: 3px; }
.task-date-tag.late { color: var(--red); }

.task-del-btn {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  background: none; color: var(--text-dim);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: all var(--transition);
  flex-shrink: 0;
}

.task-card:hover .task-del-btn { opacity: 1; }
.task-del-btn:hover { background: var(--red-dim); color: var(--red); }

/* ══════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════ */
.progress-outer {
  background: var(--bg-input);
  border-radius: 20px; height: 6px; overflow: hidden;
  margin-bottom: 10px;
}

.progress-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: 20px;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}

.task-stats {
  display: flex; gap: 16px;
  font-size: 12px; color: var(--text-muted);
}

/* ══════════════════════════════════════
   REPORTS
══════════════════════════════════════ */
.rel-table { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }

.rel-row {
  display: grid;
  grid-template-columns: 1fr 100px 100px 80px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background var(--transition);
}

.rel-row:hover { background: var(--bg-elevated); }
.rel-row-header { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding-bottom: 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* ══════════════════════════════════════
   CATEGORY LEGEND
══════════════════════════════════════ */
.cat-legend { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }

.cat-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.cat-legend-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.cat-legend-label { display: flex; align-items: center; flex: 1; }
.cat-legend-val { font-weight: 600; color: var(--text); }

/* ══════════════════════════════════════
   SIMULATOR
══════════════════════════════════════ */
.sim-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.sim-result {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 4px;
}

.sim-stat {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex; flex-direction: column; gap: 4px;
}

.sim-stat span { font-size: 11px; color: var(--text-muted); }
.sim-stat strong { font-size: 15px; font-weight: 700; color: var(--text); }

/* Config */
.config-form { display: flex; flex-direction: column; gap: 14px; }

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn-primary {
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary:hover { background: var(--blue-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,0.3); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px;
  transition: all var(--transition);
}

.btn-secondary:hover { background: var(--bg-elevated); color: var(--text); border-color: var(--border-light); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
  transition: all var(--transition);
}

.btn-danger:hover { background: var(--red); color: #fff; }

.btn-link {
  background: none;
  color: var(--blue);
  font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all var(--transition);
}

.btn-link:hover { color: var(--text); gap: 7px; }

.btn-sm { padding: 7px 14px; font-size: 12px; }

/* ══════════════════════════════════════
   INPUTS
══════════════════════════════════════ */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 12px; font-weight: 500; color: var(--text-muted); }

.input-field {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
  -webkit-appearance: none;
}

.input-field::placeholder { color: var(--text-dim); }
.input-field:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }
.input-field option { background: var(--bg-card); color: var(--text); }
textarea.input-field { resize: vertical; min-height: 60px; line-height: 1.5; }

.select-sm {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text-muted);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: all var(--transition);
}

.select-sm:focus { border-color: var(--blue); color: var(--text); }

/* ══════════════════════════════════════
   MODALS
══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; animation: modalIn 0.2s ease; }

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalSlide 0.25s cubic-bezier(0.34,1.56,0.64,1);
  overflow: hidden;
}

.modal-lg { max-width: 640px; }
.modal-sm { max-width: 360px; }

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

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

.modal-header h3 { font-size: 15px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.modal-header h3 i { color: var(--blue); }

.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--bg-elevated); color: var(--text); }

.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 14px 20px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-shrink: 0; }
.modal-footer button { flex: 1; justify-content: center; }

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* ══════════════════════════════════════
   BADGES
══════════════════════════════════════ */
.badge-pill {
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
}

.badge-blue   { background: var(--blue-dim); color: var(--blue); }
.badge-green  { background: var(--green-dim); color: var(--green); }
.badge-red    { background: var(--red-dim); color: var(--red); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-gray   { background: rgba(75,85,99,0.25); color: var(--text-muted); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }

/* Status badges */
.status-ativo     { background: var(--green-dim); color: var(--green); }
.status-aguardando { background: var(--yellow-dim); color: var(--yellow); }
.status-pausado   { background: rgba(75,85,99,0.25); color: var(--text-muted); }
.status-concluido { background: var(--blue-dim); color: var(--blue); }
.status-cancelado { background: var(--red-dim); color: var(--red); }

/* ══════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state i { font-size: 40px; opacity: 0.3; display: block; margin-bottom: 14px; }
.empty-state p { font-size: 14px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.empty-state span { font-size: 12px; }

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
#toasts {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  min-width: 240px; max-width: 340px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.hide { animation: toastOut 0.25s ease forwards; }

@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

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

/* ══════════════════════════════════════
   LOADING OVERLAY
══════════════════════════════════════ */
#loading-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.loading-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-lg);
}

.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border-light);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-box span {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ══════════════════════════════════════
   SKELETON LOADING
══════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-elevated) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ══════════════════════════════════════
   UTILITY
══════════════════════════════════════ */
.text-green  { color: var(--green) !important; }
.text-red    { color: var(--red) !important; }
.text-yellow { color: var(--yellow) !important; }
.text-blue   { color: var(--blue) !important; }
.text-muted  { color: var(--text-muted) !important; }

/* ══════════════════════════════════════
   MOBILE OVERLAY
══════════════════════════════════════ */
.mobile-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1 { grid-template-columns: 1fr; }
  .sim-grid { grid-template-columns: repeat(2, 1fr); }
  .sim-result { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); width: 240px !important; transition: transform 0.25s ease; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-toggle { display: none; }
  .main-wrapper { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex; }
  .mobile-overlay.show { display: block; }
  .topbar-center { max-width: 240px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .tx-table-header { display: none; }
  .tx-row { grid-template-columns: 1fr auto; gap: 4px; }
  .tx-row .tx-date,
  .tx-row .tx-cat-badge,
  .tx-row .tx-type-badge { display: none; }
}

@media (max-width: 600px) {
  .page-content { padding: 12px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-center { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 16px; }
  .kpi-icon { width: 36px; height: 36px; font-size: 14px; }
  .form-row { grid-template-columns: 1fr; }
  .sim-grid { grid-template-columns: repeat(2, 1fr); }
  .sim-result { grid-template-columns: 1fr; }
  .proj-metrics { grid-template-columns: repeat(2, 1fr); }
  .goals-grid { grid-template-columns: 1fr; }
  .modal { max-width: 100%; border-radius: 20px 20px 0 0; margin: auto 0 0 0; max-height: 92vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .page-toolbar { flex-direction: column; align-items: stretch; }
  .page-toolbar button { width: 100%; justify-content: center; }
  .toolbar-filters { flex-wrap: wrap; }
  #toasts { bottom: 16px; right: 16px; left: 16px; }
  .toast { min-width: unset; }
  .card { padding: 14px; }
  .proj-grid { grid-template-columns: 1fr; }
  .rel-table .rel-row { grid-template-columns: 1fr 1fr; }
  .rel-row-header span:nth-child(3),
  .rel-row-header span:nth-child(4),
  .rel-row span:nth-child(3),
  .rel-row span:nth-child(4) { display: none; }
}
