/* ============================================================
   EINARFINANCE — Premium Design System v1.0
   ============================================================ */

/* --- Variables -------------------------------------------- */
:root {
  --ef-bg:          #F0F4F8;
  --ef-sidebar-bg:  #0F1B2D;
  --ef-sidebar-w:   260px;
  --ef-topbar-h:    64px;
  --ef-accent:      #1D6FF3;
  --ef-accent-soft: #EBF3FF;
  --ef-accent-dark: #1458CC;
  --ef-success:     #10B981;
  --ef-success-soft:#D1FAE5;
  --ef-warning:     #F59E0B;
  --ef-warning-soft:#FEF3C7;
  --ef-danger:      #EF4444;
  --ef-danger-soft: #FEE2E2;
  --ef-text:        #1A2332;
  --ef-text-soft:   #64748B;
  --ef-border:      #E2E8F0;
  --ef-card:        #FFFFFF;
  --ef-radius:      12px;
  --ef-radius-sm:   8px;
  --ef-shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --ef-shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --ef-font:        'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--ef-font);
  background: var(--ef-bg);
  color: var(--ef-text);
  margin: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* --- Sidebar ---------------------------------------------- */
.ef-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--ef-sidebar-w);
  height: 100vh;
  background: var(--ef-sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform .25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}
.ef-sidebar::-webkit-scrollbar { width: 4px; }
.ef-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.ef-sidebar-brand {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.ef-sidebar-brand .brand-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
  display: block;
}
.ef-sidebar-brand .brand-sub {
  font-size: .72rem;
  color: rgba(255,255,255,.4);
  letter-spacing: .6px;
  text-transform: uppercase;
}

.ef-nav { padding: 12px 0 24px; flex: 1; }
.ef-nav-section {
  padding: 16px 20px 6px;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.28);
}
.ef-nav-item { display: block; }
.ef-nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 20px;
  color: rgba(255,255,255,.62);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 450;
  border-radius: 0;
  transition: background .15s, color .15s;
  position: relative;
}
.ef-nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.ef-nav-link.active {
  background: rgba(29,111,243,.22);
  color: #fff;
  font-weight: 600;
}
.ef-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--ef-accent);
  border-radius: 0 3px 3px 0;
}
.ef-nav-link .nav-icon { width: 18px; text-align: center; opacity: .8; flex-shrink: 0; }
.ef-nav-link .nav-badge {
  margin-left: auto;
  background: var(--ef-danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}

/* --- Topbar ----------------------------------------------- */
.ef-topbar {
  position: fixed;
  top: 0;
  left: var(--ef-sidebar-w);
  right: 0;
  height: var(--ef-topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--ef-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  z-index: 100;
}
.ef-topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ef-text);
  flex: 1;
}
.ef-topbar-actions { display: flex; align-items: center; gap: 10px; }

.ef-topbar-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--ef-border);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--ef-text-soft);
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.ef-topbar-btn:hover { background: var(--ef-bg); }
.ef-topbar-btn .badge-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--ef-danger);
  border-radius: 50%;
  border: 2px solid #fff;
}

.ef-user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 14px 4px 4px;
  border-radius: 40px;
  border: 1px solid var(--ef-border);
  background: transparent;
  cursor: pointer;
  transition: background .15s;
}
.ef-user-chip:hover { background: var(--ef-bg); }
.ef-user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--ef-accent);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ef-user-name { font-size: .82rem; font-weight: 600; color: var(--ef-text); }

/* --- Main Content ----------------------------------------- */
.ef-main {
  margin-left: var(--ef-sidebar-w);
  padding-top: var(--ef-topbar-h);
  min-height: 100vh;
}
.ef-content { padding: 28px 32px; }

/* --- Page Header ------------------------------------------ */
.ef-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.ef-page-header h1 {
  font-size: 1.5rem; font-weight: 700; color: var(--ef-text);
  margin: 0; letter-spacing: -.4px;
}
.ef-page-header .ef-breadcrumb {
  font-size: .78rem; color: var(--ef-text-soft); margin-top: 3px;
}

/* --- Cards ------------------------------------------------ */
.ef-card {
  background: var(--ef-card);
  border-radius: var(--ef-radius);
  border: 1px solid var(--ef-border);
  box-shadow: var(--ef-shadow);
  overflow: hidden;
}
.ef-card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--ef-border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ef-card-header h2 {
  font-size: .95rem; font-weight: 600; color: var(--ef-text); margin: 0;
}
.ef-card-body { padding: 22px; }

/* --- KPI Cards -------------------------------------------- */
.ef-kpi {
  background: var(--ef-card);
  border-radius: var(--ef-radius);
  border: 1px solid var(--ef-border);
  box-shadow: var(--ef-shadow);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}
.ef-kpi::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--kpi-color, var(--ef-accent));
  border-radius: var(--ef-radius) var(--ef-radius) 0 0;
}
.ef-kpi-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--ef-text-soft); margin-bottom: 8px; }
.ef-kpi-value { font-size: 1.75rem; font-weight: 800; color: var(--ef-text); letter-spacing: -1px; line-height: 1; }
.ef-kpi-sub   { font-size: .78rem; color: var(--ef-text-soft); margin-top: 6px; }
.ef-kpi-icon  { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 2.2rem; opacity: .07; }

/* KPI accent variants */
.ef-kpi--success { --kpi-color: var(--ef-success); }
.ef-kpi--warning { --kpi-color: var(--ef-warning); }
.ef-kpi--danger  { --kpi-color: var(--ef-danger);  }

/* --- Status Badges ---------------------------------------- */
.ef-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .73rem; font-weight: 600; white-space: nowrap;
}
.ef-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; flex-shrink: 0; }
.ef-badge-previsto   { background: #EFF6FF; color: #2563EB; }
.ef-badge-recebido   { background: var(--ef-success-soft); color: #065F46; }
.ef-badge-conciliado { background: #F0FDF4; color: #166534; }
.ef-badge-vencido    { background: var(--ef-danger-soft);  color: #991B1B; }
.ef-badge-parcial    { background: var(--ef-warning-soft); color: #92400E; }
.ef-badge-cancelado  { background: #F1F5F9; color: #475569; }
.ef-badge-ativo      { background: var(--ef-success-soft); color: #065F46; }
.ef-badge-inativo    { background: #F1F5F9; color: #475569; }
.ef-badge-prefeitura { background: #EDE9FE; color: #5B21B6; }
.ef-badge-camara     { background: #FFF7ED; color: #9A3412; }
.ef-badge-privado    { background: #F0F9FF; color: #0369A1; }

/* --- Tables ----------------------------------------------- */
.ef-table-wrap { overflow-x: auto; }
.ef-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.ef-table thead th {
  padding: 11px 14px;
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ef-text-soft);
  border-bottom: 2px solid var(--ef-border);
  text-align: left;
  white-space: nowrap;
  background: #FAFBFC;
}
.ef-table tbody tr { border-bottom: 1px solid var(--ef-border); transition: background .1s; }
.ef-table tbody tr:last-child { border-bottom: none; }
.ef-table tbody tr:hover { background: #F8FAFF; }
.ef-table td { padding: 12px 14px; vertical-align: middle; }
.ef-table .td-amount { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.ef-table .td-center { text-align: center; }

/* --- Buttons ---------------------------------------------- */
.ef-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--ef-radius-sm);
  font-size: .855rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent; transition: all .15s; text-decoration: none;
  white-space: nowrap; line-height: 1;
}
.ef-btn-primary   { background: var(--ef-accent); color: #fff; }
.ef-btn-primary:hover { background: var(--ef-accent-dark); color: #fff; }
.ef-btn-success   { background: var(--ef-success); color: #fff; }
.ef-btn-success:hover { filter: brightness(.9); }
.ef-btn-danger    { background: var(--ef-danger); color: #fff; }
.ef-btn-danger:hover { filter: brightness(.9); }
.ef-btn-outline   { background: transparent; border-color: var(--ef-border); color: var(--ef-text); }
.ef-btn-outline:hover { background: var(--ef-bg); }
.ef-btn-ghost     { background: transparent; border-color: transparent; color: var(--ef-text-soft); }
.ef-btn-ghost:hover { background: var(--ef-bg); color: var(--ef-text); }
.ef-btn-sm        { padding: 6px 12px; font-size: .78rem; }
.ef-btn-icon      { padding: 8px; border-radius: var(--ef-radius-sm); }

/* --- Forms ------------------------------------------------ */
.ef-form-group   { margin-bottom: 18px; }
.ef-form-label   { display: block; font-size: .8rem; font-weight: 600; color: var(--ef-text); margin-bottom: 6px; }
.ef-form-label .req { color: var(--ef-danger); margin-left: 2px; }
.ef-form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--ef-border); border-radius: var(--ef-radius-sm);
  font-size: .875rem; color: var(--ef-text); background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: var(--ef-font);
}
.ef-form-control:focus { outline: none; border-color: var(--ef-accent); box-shadow: 0 0 0 3px rgba(29,111,243,.12); }
.ef-form-control::placeholder { color: #A0AEC0; }
.ef-form-error  { font-size: .77rem; color: var(--ef-danger); margin-top: 4px; }
.ef-form-hint   { font-size: .77rem; color: var(--ef-text-soft); margin-top: 4px; }
textarea.ef-form-control { resize: vertical; min-height: 90px; }
select.ef-form-control { cursor: pointer; }

/* --- Alerts / Flash --------------------------------------- */
.ef-alert {
  padding: 12px 18px; border-radius: var(--ef-radius-sm);
  font-size: .875rem; font-weight: 500;
  display: flex; align-items: flex-start; gap: 10px;
  border-left: 4px solid;
  margin-bottom: 20px;
}
.ef-alert-success { background: var(--ef-success-soft); border-color: var(--ef-success); color: #065F46; }
.ef-alert-error   { background: var(--ef-danger-soft);  border-color: var(--ef-danger);  color: #991B1B; }
.ef-alert-warning { background: var(--ef-warning-soft); border-color: var(--ef-warning); color: #92400E; }
.ef-alert-info    { background: var(--ef-accent-soft);  border-color: var(--ef-accent);  color: #1E40AF; }

/* --- Filter Bar ------------------------------------------- */
.ef-filter-bar {
  background: #fff; border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius); padding: 14px 20px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.ef-filter-bar .ef-form-control { width: auto; min-width: 150px; }

/* --- Progress bar ----------------------------------------- */
.ef-progress { background: var(--ef-border); border-radius: 20px; height: 7px; overflow: hidden; }
.ef-progress-bar { height: 100%; border-radius: 20px; transition: width .4s ease; background: var(--ef-accent); }

/* --- Empty state ------------------------------------------ */
.ef-empty {
  text-align: center; padding: 60px 20px;
  color: var(--ef-text-soft);
}
.ef-empty-icon { font-size: 3rem; opacity: .3; margin-bottom: 12px; }
.ef-empty p { margin: 0; font-size: .9rem; }

/* --- Bank color dot --------------------------------------- */
.ef-bank-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0;
}

/* --- Dropdown --------------------------------------------- */
.ef-dropdown { position: relative; display: inline-block; }
.ef-dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-sm); box-shadow: var(--ef-shadow-md);
  min-width: 180px; z-index: 500; padding: 6px 0;
  display: none;
}
.ef-dropdown.open .ef-dropdown-menu { display: block; }
.ef-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; font-size: .855rem; color: var(--ef-text);
  text-decoration: none; cursor: pointer; transition: background .1s;
}
.ef-dropdown-item:hover { background: var(--ef-bg); }
.ef-dropdown-divider { border-top: 1px solid var(--ef-border); margin: 4px 0; }

/* --- Modal ------------------------------------------------ */
.ef-modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,27,45,.55);
  z-index: 900; display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.ef-modal-backdrop.open { display: flex; }
.ef-modal {
  background: #fff; border-radius: var(--ef-radius); padding: 0;
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.ef-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--ef-border);
  display: flex; align-items: center; justify-content: space-between;
}
.ef-modal-title { font-size: 1rem; font-weight: 700; margin: 0; }
.ef-modal-close { background: none; border: none; cursor: pointer; color: var(--ef-text-soft); font-size: 1.2rem; padding: 4px; }
.ef-modal-body  { padding: 24px; }
.ef-modal-footer { padding: 16px 24px; border-top: 1px solid var(--ef-border); display: flex; justify-content: flex-end; gap: 10px; }

/* --- Chart containers ------------------------------------- */
.ef-chart-container { position: relative; }

/* --- Timeline (cobrança) ---------------------------------- */
.ef-timeline { list-style: none; padding: 0; margin: 0; }
.ef-timeline-item { display: flex; gap: 14px; padding-bottom: 20px; position: relative; }
.ef-timeline-item:not(:last-child)::before {
  content: ''; position: absolute; left: 15px; top: 30px; bottom: 0;
  width: 2px; background: var(--ef-border);
}
.ef-timeline-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ef-accent-soft); color: var(--ef-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; flex-shrink: 0; border: 2px solid var(--ef-border);
}
.ef-timeline-content { flex: 1; padding-top: 4px; }
.ef-timeline-meta { font-size: .75rem; color: var(--ef-text-soft); margin-top: 2px; }

/* --- Responsive ------------------------------------------- */
@media (max-width: 991px) {
  .ef-sidebar { transform: translateX(-100%); }
  .ef-sidebar.open { transform: translateX(0); }
  .ef-main { margin-left: 0; }
  .ef-topbar { left: 0; }
  .ef-content { padding: 20px 16px; }
  .ef-btn-menu { display: flex !important; }
}
@media (min-width: 992px) {
  .ef-btn-menu { display: none !important; }
}

/* --- Utilities -------------------------------------------- */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-soft { color: var(--ef-text-soft); }
.text-danger { color: var(--ef-danger); }
.text-success { color: var(--ef-success); }
.text-warning { color: var(--ef-warning); }
.text-right { text-align: right; }
.d-none { display: none; }
.mt-0 { margin-top: 0; }
.currency::before { content: 'R$ '; font-size: .8em; font-weight: 400; opacity: .7; }
