:root {
  --sac-brown: #4a3220;
  --sac-brown-dark: #2f1f13;
  --sac-green: #2e8b3d;
  --sac-green-dark: #1f6b2c;
  --sac-blue: #1e6fd9;
  --sac-bg: #f4f6f8;
  --sac-card-radius: 14px;
}

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

body {
  background: var(--sac-bg);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: #212529;
}

/* ---------- Layout ---------- */
.sac-shell { display: flex; min-height: 100vh; }

.sac-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sac-brown-dark), var(--sac-brown));
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sac-sidebar .brand { padding: 1.25rem 1rem; display: flex; align-items: center; gap: .6rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.sac-sidebar .brand img { width: 40px; height: 40px; border-radius: 8px; background: #fff2; }
.sac-sidebar .brand-text { line-height: 1.1; }
.sac-sidebar .brand-text strong { font-size: 1.02rem; display:block; }
.sac-sidebar .brand-text span { font-size: .68rem; opacity: .75; }

.sac-nav { padding: .75rem .6rem; }
.sac-nav a {
  display: flex; align-items: center; gap: .65rem;
  color: rgba(255,255,255,.85); text-decoration: none;
  padding: .6rem .75rem; border-radius: 10px; margin-bottom: .15rem;
  font-size: .92rem; transition: background .15s;
}
.sac-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sac-nav a.active { background: var(--sac-green); color: #fff; font-weight: 600; }
.sac-nav a i { font-size: 1.05rem; width: 20px; text-align: center; }

.sac-main { flex: 1; min-width: 0; }
.sac-topbar {
  background: #fff; border-bottom: 1px solid #e5e7eb;
  padding: .7rem 1.25rem; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.sac-content { padding: 1.25rem; }

/* ---------- Cards ---------- */
.sac-card {
  background: #fff; border-radius: var(--sac-card-radius);
  border: 1px solid #eceff1; padding: 1.1rem 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.sac-stat .label { color: #6c757d; font-size: .82rem; }
.sac-stat .value { font-size: 1.55rem; font-weight: 700; margin-top: .15rem; }
.sac-stat .icon { width: 42px; height: 42px; border-radius: 10px; display:flex; align-items:center; justify-content:center; font-size: 1.15rem; }

.badge-status-pendente { background: #fff3cd; color: #997404; }
.badge-status-vencido { background: #f8d7da; color: #842029; }
.badge-status-pago { background: #d1e7dd; color: #146c43; }

.btn-sac-primary { background: var(--sac-green); border-color: var(--sac-green); color: #fff; }
.btn-sac-primary:hover { background: var(--sac-green-dark); border-color: var(--sac-green-dark); color: #fff; }

.table-sac thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6c757d; border-bottom-width: 1px; }
.table-sac td, .table-sac th { vertical-align: middle; }

/* mobile stacked cards for tables */
@media (max-width: 767.98px) {
  .table-mobile-cards thead { display: none; }
  .table-mobile-cards tr {
    display: block; margin-bottom: .85rem; border: 1px solid #eceff1;
    border-radius: 12px; padding: .75rem .9rem; background: #fff;
  }
  .table-mobile-cards td {
    display: flex; justify-content: space-between; align-items: center;
    border: none; padding: .3rem 0; text-align: right;
  }
  .table-mobile-cards td::before {
    content: attr(data-label); font-weight: 600; color: #6c757d;
    font-size: .74rem; text-transform: uppercase; text-align: left; margin-right: 1rem;
  }
  .sac-sidebar { position: fixed; left: -260px; z-index: 1050; transition: left .2s; box-shadow: 4px 0 18px rgba(0,0,0,.25); }
  .sac-sidebar.open { left: 0; }
  .sac-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1040; }
  .sac-overlay.show { display: block; }
}

.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at top, #5a4028, var(--sac-brown-dark));
  padding: 1rem;
}
.login-card { background: #fff; border-radius: 18px; padding: 1.25rem 2rem 1rem; max-width: 400px; width: 100%; box-shadow: 0 20px 45px rgba(0,0,0,.3); }
.login-card img.logo { width: 200px; max-width: 100%; display: block; margin: 0 auto .5rem; }

.progress-cat { height: 8px; border-radius: 6px; background: #eef0f2; }
.progress-cat > div { height: 100%; border-radius: 6px; }

.color-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }

.sac-version-footer { color: #adb5bd; font-size: .7rem; text-align: center; padding: .75rem 1rem 1.25rem; }
.sac-version-footer--guest { color: rgba(0,0,0,.35); margin-top: .5rem; padding: 0; }

/* ---------- Impressão (Relatórios) ---------- */
@media print {
  .sac-sidebar, .sac-topbar, .sac-overlay, .d-print-none { display: none !important; }
  .sac-main { width: 100% !important; }
  .sac-content { padding: 0 !important; }
  body { background: #fff !important; }
  .sac-card { border: 1px solid #ccc !important; box-shadow: none !important; break-inside: avoid; }
}
