/* ===== Global App Styling ===== */

html { font-size: 14px; height: 100%; }
@media (min-width: 768px){ html{ font-size:16px; } }

body {
    min-height: 100%;
    margin: 0;
    background: #f8fafc;
}

body.app-auth { overflow: hidden; }

.btn:focus, .btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus{
  box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem #258cfb;
}

/* Navbar (unauthenticated fallback pages) */
.navbar {
    background-color: #ffffff;
}

.navbar-brand {
    font-weight: 600;
}

/* Cards */
.card {
    border-radius: 14px;
    background: #ffffff;
}

/* Buttons */
.btn,
.form-control,
.form-select {
    border-radius: 10px;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

/* Tables */
.table > :not(caption) > * > * {
    padding: 0.9rem 1rem;
}

.table thead th {
    color: #6c757d;
    font-weight: 600;
}

/* Badges */
.badge {
    font-size: 0.85rem;
}

/* Links */
a {
    color: #0077cc;
}
a:hover {
    color: #005fa3;
    text-decoration: none;
}

/* ===============================
   APP SHELL LAYOUT
================================ */
.app-shell{
  display: flex;
  height: 100vh;
}

.sidebar{
  width: 285px;
  flex: 0 0 285px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #0b1220 0%, #0d1b2a 40%, #0a1526 100%);
  color: #e9eefc;
  border-right: 1px solid rgba(255,255,255,.08);
}

.main{
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-scroll{
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.main-content{
  flex: 1 0 auto;
  padding: 28px;
}

.app-footer{
  margin-top: auto;
  border-top: 1px solid rgba(0,0,0,.08);
  background: #fff;
  padding: .75rem 1rem;
}

/* ===============================
   SIDEBAR UI
================================ */
.brand{
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-row{
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo{
  width: 46px; height: 46px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 10px 25px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}

.brand-title{ font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.brand-sub{ font-size: .78rem; opacity: .75; }

.sidebar-nav{
  padding: 10px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
}

.nav-section-title{
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .6;
  padding: 8px 10px 6px;
}

.nav-item, .nav-sub{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: rgba(233,238,252,.9);
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
  margin: 4px 4px;
}

.nav-item i, .nav-sub i{ font-size: 1.05rem; opacity: .9; }

.nav-item:hover, .nav-sub:hover{
  background: rgba(255,255,255,.07);
  transform: translateY(-1px);
  color: rgba(233,238,252,.9);
}

.nav-item.active, .nav-sub.active{
  background: linear-gradient(90deg, rgba(77,163,255,.25), rgba(77,163,255,.06));
  box-shadow: 0 10px 22px rgba(0,0,0,.22);
  border: 1px solid rgba(77,163,255,.25);
}

/* Sidebar footer */
.sidebar-footer{
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: grid;
  gap: 10px;
}

.user-pill{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}

.user-dot{
  width: 10px; height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34,197,94,.15);
}

.sidebar-logout{ border-radius: 14px; }

/* ===============================
   TOPBAR (GRAY THEME)
================================ */
.topbar{
  flex: 0 0 auto;
  z-index: 10;
}

.topbar-gray{
  height: 84px;
  background: linear-gradient(180deg, #4b5563 0%, #1f2937 100%);
  border-bottom: 1px solid rgba(15,23,42,.10);
  color: #f8fafc;
}

.topbar-gray .container-fluid{
  padding-left: 28px;
  padding-right: 28px;
}

.page-icon{
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(129, 131, 139, 0.05);
  border: 1px solid rgba(236, 241, 251, 0.1);
}

.page-icon i{ font-size: 1.35rem; color: #4f87ff; }

.page-title{
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.1;
  color: #f8fafc;
}

.page-subtitle{
  font-size: .85rem;
  color: rgba(247, 248, 252, 0.65);
}

.user-box{
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 14px 0 6px;
  border-radius: 999px;
  background: rgba(245, 246, 246, 0.04);
  border: 1px solid rgba(77, 122, 228, 0.1);
  color: #ffffff;
}

.user-box:hover{ background: rgba(255, 255, 255, 0.08); }

.user-avatar{
  width: 38px; height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #22c55e);
}

.user-name{ font-weight: 700; font-size: .9rem; max-width: 200px; }
.user-role{ font-size: .72rem; color: rgba(248, 249, 252, 0.6); }

/* ===============================
   TABLE / CARD POLISH
================================ */
.page-card{
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.08);
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
}

.table-modern thead th{
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(15,23,42,.65);
  background: #f8fafc;
  border-bottom: 1px solid rgba(15,23,42,.10);
  padding: 14px 12px;
}

.table-modern td{
  padding: 14px 12px;
  border-color: rgba(15,23,42,.08);
}

.table-modern tbody tr:hover{ background: #f1f5f9; }

.status-pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  border: 1px solid rgba(15,23,42,.10);
}
.status-pill.active{
  background: #dcfce7;
  color: #166534;
  border-color: rgba(22,101,52,.18);
}

/* ===============================
   MOBILE RESPONSIVE
================================ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: -295px;
    top: 0;
    height: 100vh;
    width: 285px;
    z-index: 1045;
    transition: left .2s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
  }

  body.sidebar-open .sidebar {
    left: 0;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1040;
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .main {
    width: 100%;
  }

  .main-content {
    padding: 16px;
  }

  .topbar-gray {
    height: auto;
    padding: 12px 0;
  }

  .topbar-gray .container-fluid {
    padding-left: 16px;
    padding-right: 16px;
  }

  .page-icon { width: 42px; height: 42px; border-radius: 14px; }
  .page-icon i { font-size: 1.1rem; }
  .page-title { font-size: 1.05rem; }
  .page-subtitle { font-size: .8rem; }

  .user-box {
    height: 44px;
    padding: 0 10px 0 6px;
  }
  .user-name { max-width: 140px; }
}

@media (max-width: 575.98px) {
  .page-subtitle { display: none; }
  .user-name { max-width: 110px; }
}

/* ===== Shared "polished" page components (KPI cards, sectioned form cards) =====
   Reused across dashboards, Payments, Expenses, and any other data-entry page that
   wants the same visual language instead of a bare Bootstrap card. */
.kpi { border-radius: 16px; border: 1px solid rgba(0,0,0,.06); box-shadow: 0 8px 24px rgba(0,0,0,.05); }
.kpi .card-body { padding: 16px; }
.kpi .label { color: rgba(33,37,41,.6); font-size: .82rem; }
.kpi .value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.4px; }
.kpi .hint { color: rgba(33,37,41,.5); font-size: .78rem; margin-top: 4px; }
.kpi-a { background: linear-gradient(180deg, rgba(13,110,253,.10), rgba(13,110,253,.02)); }
.kpi-b { background: linear-gradient(180deg, rgba(25,135,84,.10), rgba(25,135,84,.02)); }
.kpi-c { background: linear-gradient(180deg, rgba(255,193,7,.12), rgba(255,193,7,.02)); }
.kpi-d { background: linear-gradient(180deg, rgba(220,53,69,.10), rgba(220,53,69,.02)); }

.icon-badge { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.6); border: 1px solid rgba(0,0,0,.06); font-size: 1.1rem; }
.chart-shell { border-radius: 18px; border: 1px solid rgba(0,0,0,.06); background: #fff; }
.form-card { border-radius: 18px; border: 1px solid rgba(0,0,0,.06); box-shadow: 0 10px 30px rgba(0,0,0,.05); }

.form-section { border-radius: 14px; border: 1px solid rgba(0,0,0,.07); padding: 16px; }
.form-section.accent-blue { border-left: 4px solid #0d6efd; background: rgba(13,110,253,.03); }
.form-section.accent-amber { border-left: 4px solid #ffc107; background: rgba(255,193,7,.04); }
.form-section.accent-green { border-left: 4px solid #198754; background: rgba(25,135,84,.03); }
.form-section .section-title { font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.form-section .section-title .bi { font-size: 1.1rem; }