/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; }
body { background: #fff; color: #18181b; min-height: 100vh; }
.hidden { display: none !important; }

/* ── LOGIN ── */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(150deg, #0D1529 0%, #162159 50%, #111D4A 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%; max-width: 380px;
  box-shadow: 0 28px 72px rgba(0,0,0,.45);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo-icon {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, #D0171A, #9B0F12);
  border-radius: 16px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(208,23,26,.35);
}
.login-logo-title { font-size: 20px; font-weight: 900; color: #1B2A6B; letter-spacing: .2px; margin-bottom: 5px; }
.login-logo-sub { font-size: 11px; font-weight: 600; color: #9CA3AF; letter-spacing: .1em; text-transform: uppercase; }
.login-divider { height: 2px; background: linear-gradient(90deg, #D0171A, #1B2A6B); border-radius: 2px; margin-top: 20px; }

.login-error {
  background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B;
  border-radius: 8px; padding: 10px 14px; font-size: 13px;
  margin-bottom: 14px; line-height: 1.4;
}

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 10px 14px; border: 1.5px solid #D1D5DB;
  border-radius: 8px; font-size: 14px; outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: #1B2A6B; box-shadow: 0 0 0 3px rgba(27,42,107,.1); }

.btn-full { width: 100%; margin-top: 8px; }
.login-footer {
  text-align: center; padding-top: 20px; margin-top: 16px;
  border-top: 1px solid #F3F4F6;
  font-size: 11px; color: #C0C0C0; letter-spacing: .04em;
}

/* ── HEADER ── */
.header-box {
  background: linear-gradient(135deg, #111D4A 0%, #1B2A6B 55%, #243580 100%);
  padding: 16px 48px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header-title h1 { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: .5px; text-transform: uppercase; }
.header-title p { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 4px; font-weight: 500; }
.header-meta { text-align: right; }
.hname { font-size: 13px; font-weight: 700; color: #fff; }
.hco { font-size: 10px; color: rgba(255,255,255,.55); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.role-badge {
  font-size: 9px; font-weight: 800; padding: 2px 8px; border-radius: 10px;
  letter-spacing: .06em; border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.1);
}

/* ── SUBMENU ── */
.submenu {
  background: #fff; border-bottom: 3px solid #D0171A;
  padding: 8px 48px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 72px; z-index: 99;
  box-shadow: 0 4px 8px rgba(0,0,0,.08);
  flex-wrap: wrap;
}
.submenu-tabs { display: flex; gap: 6px; }
.submenu-months { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.submenu-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }

.pill {
  padding: 5px 14px; border-radius: 20px; border: 1.5px solid rgba(27,42,107,.25);
  background: #fff; color: #1B2A6B; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.pill:hover { background: rgba(27,42,107,.06); border-color: #1B2A6B; }
.pill-active { background: #1B2A6B !important; color: #fff !important; border-color: #1B2A6B !important; }
.pill-sm { padding: 4px 10px; font-size: 11px; }

/* ── BUTTONS ── */
.btn-primary {
  background: linear-gradient(135deg, #1B2A6B, #243580); color: #fff;
  border: none; border-radius: 8px; padding: 10px 22px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .88; }
.btn-sm {
  padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1.5px solid transparent; transition: all .15s; white-space: nowrap;
}
.btn-sm.btn-primary { background: #1B2A6B; color: #fff; border-color: #1B2A6B; }
.btn-sm.btn-primary:hover { background: #243580; }
.btn-sm.btn-outline { background: #fff; color: #1B2A6B; border-color: rgba(27,42,107,.3); }
.btn-sm.btn-outline:hover { background: rgba(27,42,107,.06); border-color: #1B2A6B; }
.btn-sm.btn-ghost { background: transparent; color: #6B7280; border-color: #E5E7EB; }
.btn-sm.btn-ghost:hover { background: #F9FAFB; color: #374151; border-color: #D1D5DB; }

.btn-logout {
  background: transparent; color: #fff;
  border: 1.5px solid rgba(255,255,255,.5);
  border-radius: 6px; padding: 4px 12px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn-logout:hover { background: rgba(255,255,255,.15); border-color: #fff; }

.badge-readonly {
  background: rgba(255,200,0,.15); color: #FFD166;
  font-size: 10px; font-weight: 800; padding: 4px 10px;
  border-radius: 10px; border: 1px solid rgba(255,200,0,.25); letter-spacing: .04em;
}

/* ── CONTENT ── */
.content { padding: 24px 48px 48px; max-width: 1400px; margin: 0 auto; }
.sec-lbl { font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #A1A1AA; margin-bottom: 14px; }
.divider { height: 1.5px; background: linear-gradient(90deg, #D0171A, #1B2A6B, transparent); margin: 24px 0; opacity: .3; border-radius: 2px; }
.caption { font-size: 12px; color: #71717A; margin-bottom: 16px; }

/* ── PANEL CARDS ── */
.panel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 4px; }
.panel-card { background: #fff; border-radius: 14px; border: 1.5px solid #E0E0DC; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.ph-r { background: linear-gradient(135deg,#FDF0F0,#FDE8E8); padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
.ph-n { background: linear-gradient(135deg,#EEF1FA,#E4E9F7); padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
.ph-g { background: linear-gradient(135deg,#F4F4F0,#EEEEEA); padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
.pi-r { width:32px;height:32px;background:#D0171A;border-radius:8px;display:flex;align-items:center;justify-content:center;flex-shrink:0 }
.pi-n { width:32px;height:32px;background:#1B2A6B;border-radius:8px;display:flex;align-items:center;justify-content:center;flex-shrink:0 }
.pi-g { width:32px;height:32px;background:#888780;border-radius:8px;display:flex;align-items:center;justify-content:center;flex-shrink:0 }
.pt-r { font-size:13px;font-weight:700;color:#D0171A }
.pt-n { font-size:13px;font-weight:700;color:#1B2A6B }
.pt-g { font-size:13px;font-weight:700;color:#444 }
.pb { padding:16px 18px; background:#fff; }
.prow { display:flex;justify-content:space-between;align-items:center;margin-bottom:8px }
.pl { color:#52525B;font-size:12px;font-weight:500 }
.pv { font-weight:700;font-size:15px;color:#18181B }
.pv-pos { font-weight:700;font-size:15px;color:#2D6A11 }
.pv-neg { font-weight:700;font-size:15px;color:#8B1C1C }
.bar-bg { height:6px;background:#E8E8E4;border-radius:3px;margin-top:12px;overflow:hidden }
.bf-r { height:6px;border-radius:3px;background:linear-gradient(90deg,#A50F12,#D0171A) }
.bf-n { height:6px;border-radius:3px;background:linear-gradient(90deg,#111D4A,#1B2A6B) }
.bf-g { height:6px;border-radius:3px;background:linear-gradient(90deg,#666,#888780) }
.pct-txt { font-size:10px;color:#A1A1AA;text-align:right;margin-top:5px;font-weight:600;letter-spacing:.04em }

/* ── ANNUAL ── */
.anual-wrap { background:#fff;border-radius:14px;border:1.5px solid #E0E0DC;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.06) }
.anual-cards { display:grid;grid-template-columns:repeat(4,1fr);gap:12px;padding:18px;background:linear-gradient(135deg,#111D4A,#1B2A6B) }
.ac { background:rgba(255,255,255,.1);border-radius:8px;padding:14px 16px;border:1px solid rgba(255,255,255,.15) }
.ac-l { font-size:10px;color:rgba(255,255,255,.6);margin-bottom:6px;font-weight:700;letter-spacing:.06em;text-transform:uppercase }
.ac-v { font-size:22px;font-weight:800;color:#fff;letter-spacing:-.5px }
.ac-v-g { font-size:22px;font-weight:800;color:#7FE05A;letter-spacing:-.5px }
.mrow { display:flex;align-items:center;gap:14px;padding:9px 18px;border-bottom:1px solid #EDEDE9;font-size:12px }
.mrow:last-child { border-bottom:none }
.mrow-cur { background:linear-gradient(90deg,#EEF1FA,transparent) }
.mname { min-width:90px;color:#52525B;font-size:12px;font-weight:500 }
.mname-cur { min-width:90px;color:#1B2A6B;font-size:12px;font-weight:700 }
.mbadge { display:inline-block;background:#D0171A;color:#fff;font-size:9px;font-weight:700;padding:1px 6px;border-radius:10px;margin-left:5px }
.mbar-bg { flex:1;height:6px;background:#E8E8E4;border-radius:3px;overflow:hidden }
.mbar-f { height:6px;border-radius:3px;background:linear-gradient(90deg,#111D4A,#1B2A6B) }
.mval { min-width:200px;text-align:right;color:#52525B;font-size:11px;font-weight:500 }

/* ── MONTH TITLE ── */
.month-title {
  background: linear-gradient(135deg,#111D4A,#1B2A6B); color: #fff;
  padding: 10px 18px; border-radius: 8px; font-weight: 800; font-size: 15px;
  margin: 20px 0 12px; letter-spacing: .5px; text-transform: uppercase;
  display: flex; align-items: center; gap: 10px;
}
.month-title::before { content:'';display:block;width:4px;height:20px;background:#D0171A;border-radius:2px }

/* ── CATEGORY CARD (Gastos) ── */
.sh-wrap { background:#fff;border-radius:8px;border:1.5px solid #E0E0DC;overflow:hidden;margin-bottom:12px }
.sh-r { background:linear-gradient(135deg,#FDF0F0,#FDE8E8);border-bottom:1.5px solid #E5E5E2;padding:13px 18px;display:flex;align-items:center;justify-content:space-between }
.sh-n { background:linear-gradient(135deg,#EEF1FA,#E4E9F7);border-bottom:1.5px solid #E5E5E2;padding:13px 18px;display:flex;align-items:center;justify-content:space-between }
.sh-g { background:linear-gradient(135deg,#F4F4F0,#EEEEEA);border-bottom:1.5px solid #E5E5E2;padding:13px 18px;display:flex;align-items:center;justify-content:space-between }
.sh-ti-r { font-size:13px;font-weight:700;color:#D0171A;text-transform:uppercase;letter-spacing:.5px;display:flex;align-items:center;gap:8px }
.sh-ti-n { font-size:13px;font-weight:700;color:#1B2A6B;text-transform:uppercase;letter-spacing:.5px;display:flex;align-items:center;gap:8px }
.sh-ti-g { font-size:13px;font-weight:700;color:#444;text-transform:uppercase;letter-spacing:.5px;display:flex;align-items:center;gap:8px }
.sh-ico { border-radius:7px;display:flex;align-items:center;justify-content:center;width:28px;height:28px }
.sh-totals { display:flex;gap:16px;font-size:12px;color:#A1A1AA;flex-wrap:wrap }
.sh-totals b { color:#A1A1AA;font-weight:600 }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
.expense-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.expense-table th {
  background: #F9FAFB; color: #6B7280; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 10px; border-bottom: 1.5px solid #E5E7EB; text-align: left;
  white-space: nowrap;
}
.expense-table td { padding: 6px 8px; border-bottom: 1px solid #F3F4F6; vertical-align: middle; }
.expense-table tbody tr:hover { background: #FAFAFA; }
.expense-table .num-cell { text-align: right; font-weight: 600; color: #374151; }
.tfoot-add td { padding: 6px 10px; }

.cell-input {
  width: 100%; padding: 5px 8px; border: 1.5px solid #E5E7EB;
  border-radius: 5px; font-size: 12px; background: #fff; outline: none;
  transition: border-color .15s;
  min-width: 80px;
}
.cell-input:focus { border-color: #1B2A6B; box-shadow: 0 0 0 2px rgba(27,42,107,.1); }
.cell-input.cell-wide { min-width: 160px; }
.cell-input.cell-num { min-width: 90px; text-align: right; }
.cell-select {
  width: 100%; padding: 5px 8px; border: 1.5px solid #E5E7EB;
  border-radius: 5px; font-size: 12px; background: #fff; outline: none;
  cursor: pointer; min-width: 120px;
}
.cell-select:focus { border-color: #1B2A6B; }

.btn-delete {
  background: #FEF2F2; color: #EF4444; border: 1.5px solid #FECACA;
  border-radius: 5px; padding: 3px 8px; font-size: 11px; cursor: pointer;
  transition: all .15s;
}
.btn-delete:hover { background: #EF4444; color: #fff; }

.btn-add-row {
  background: transparent; color: #1B2A6B; border: 1.5px dashed rgba(27,42,107,.3);
  border-radius: 6px; padding: 5px 14px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.btn-add-row:hover { background: rgba(27,42,107,.05); border-color: #1B2A6B; }

.card-save-row { padding: 8px 12px 12px; display: flex; justify-content: flex-end; }

.status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 700; white-space: nowrap;
}
.status-planejado    { background: #EFF6FF; color: #1D4ED8; }
.status-em-andamento { background: #FFF7ED; color: #C2410C; }
.status-concluido    { background: #F0FDF4; color: #15803D; }
.status-atrasado     { background: #FEF2F2; color: #DC2626; }
.status-interno      { background: #F5F3FF; color: #7C3AED; }
.status-cancelado    { background: #F9FAFB; color: #6B7280; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: #1B2A6B; color: #fff;
  padding: 12px 20px; border-radius: 10px; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.toast-error { background: #DC2626; }
.toast.toast-info  { background: #374151; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .header-box, .submenu, .content { padding-left: 16px; padding-right: 16px; }
  .panel-grid { grid-template-columns: 1fr; }
  .anual-cards { grid-template-columns: repeat(2, 1fr); }
  .mval { min-width: 120px; }
  .submenu { top: 64px; }
}
