/* =====================================================================
 *  Rocket — app styling (Bootstrap 5 admin shell)
 * ===================================================================== */

:root {
  --rk-sidebar-w: 250px;
  --rk-primary: #0d6efd;
  --rk-dark: #1f2a44;
  --rk-dark-2: #27324f;
}

body {
  font-family: 'Hind Siliguri', 'Segoe UI', system-ui, sans-serif;
  background: #f4f6fb;
  font-size: 0.94rem;
}

/* ---- layout shell ---- */
.rk-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--rk-sidebar-w);
  background: linear-gradient(180deg, var(--rk-dark), var(--rk-dark-2));
  color: #cbd3e1;
  overflow-y: auto;
  z-index: 1040;
  transition: transform .25s ease;
}
.rk-sidebar .brand {
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: .5rem;
}
.rk-sidebar .nav-link {
  color: #cbd3e1;
  padding: .55rem 1.25rem;
  display: flex; align-items: center; gap: .65rem;
  border-left: 3px solid transparent;
  font-size: .9rem;
}
.rk-sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.rk-sidebar .nav-link.active {
  background: rgba(13,110,253,.18);
  color: #fff;
  border-left-color: var(--rk-primary);
}
.rk-sidebar .nav-section {
  text-transform: uppercase;
  font-size: .68rem;
  letter-spacing: .05em;
  color: #6b7793;
  padding: 1rem 1.25rem .35rem;
}

/* ---- collapsible submenu groups ---- */
.rk-sidebar .nav-group-toggle {
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.rk-sidebar .nav-group-toggle .nav-group-caret {
  margin-left: auto;
  font-size: .68rem;
  transition: transform .2s ease;
}
.rk-sidebar .nav-group-toggle[aria-expanded="true"] {
  color: #fff;
  background: rgba(255,255,255,.04);
}
.rk-sidebar .nav-group-toggle[aria-expanded="true"] .nav-group-caret {
  transform: rotate(90deg);
}

/* nested child list: inset panel + vertical guide rail */
.rk-sidebar .nav-group {
  background: rgba(0,0,0,.18);
  box-shadow: inset 0 1px 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(255,255,255,.03);
}
.rk-sidebar .nav-group .nav-link {
  position: relative;
  padding: .45rem 1.25rem .45rem 3rem;
  font-size: .82rem;
  color: #9aa5bd;
  border-left: 3px solid transparent;
}
/* guide rail running down the child list */
.rk-sidebar .nav-group .nav-link::before {
  content: "";
  position: absolute;
  left: 1.85rem;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(255,255,255,.10);
}
/* connector tick from the rail to each item */
.rk-sidebar .nav-group .nav-link::after {
  content: "";
  position: absolute;
  left: 1.85rem;
  top: 50%;
  width: .55rem;
  height: 1px;
  background: rgba(255,255,255,.10);
}
.rk-sidebar .nav-group .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.05);
}
.rk-sidebar .nav-group .nav-link.active {
  color: #fff;
  background: rgba(13,110,253,.16);
  border-left-color: var(--rk-primary);
}
.rk-sidebar .nav-group .nav-link.active::before,
.rk-sidebar .nav-group .nav-link.active::after {
  background: var(--rk-primary);
}
.rk-sidebar .nav-group .nav-link .bi {
  font-size: .82rem;
  opacity: .85;
}

.rk-main {
  margin-left: var(--rk-sidebar-w);
  min-height: 100vh;
  transition: margin .25s ease;
}
.rk-topbar {
  background: #fff;
  height: 58px;
  border-bottom: 1px solid #e6e9f0;
  position: sticky; top: 0; z-index: 1030;
  display: flex; align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
}
.rk-content { padding: 1.25rem; }

@media (max-width: 991.98px) {
  .rk-sidebar { transform: translateX(-100%); }
  .rk-sidebar.show { transform: translateX(0); }
  .rk-main { margin-left: 0; }
}

/* ---- backdrop for mobile sidebar ---- */
.rk-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 1035; display: none;
}
.rk-backdrop.show { display: block; }

/* ---- cards ---- */
.stat-card {
  border: none;
  border-radius: .65rem;
  box-shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(16,24,40,.10); }
.stat-card .stat-icon {
  width: 46px; height: 46px; border-radius: .55rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-card .stat-label { color: #6c757d; font-size: .82rem; }

.card { border: none; border-radius: .65rem; box-shadow: 0 1px 3px rgba(16,24,40,.06); }
.card-header { background: #fff; border-bottom: 1px solid #eef0f5; font-weight: 600; }

/* ---- money cells ---- */
.text-money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-pos { color: #198754; }
.money-neg { color: #dc3545; }

/* ---- badges ---- */
.badge-due-zero { background: #d1e7dd; color: #0f5132; }
.badge-due-some { background: #fff3cd; color: #664d03; }
.badge-due-high { background: #f8d7da; color: #842029; }

table.dataTable td.text-money, table.dataTable th.text-money { text-align: right; }

/* ---- login / setup ---- */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f2a44, #0d6efd);
  padding: 1rem;
}
.auth-card { width: 100%; max-width: 410px; border-radius: .9rem; }
.auth-card .brand-badge {
  width: 60px; height: 60px; border-radius: 1rem;
  background: var(--rk-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; margin: 0 auto .75rem;
}

/* ---- modals: always fit inside the viewport ---------------------------
 * Bootstrap's default modal grows the whole .modal wrapper past the
 * viewport when content is tall, so the header/footer (and its action
 * button) scroll out of view along with the page. Capping .modal-dialog
 * to the viewport height and letting only .modal-body scroll (same
 * mechanism as .modal-dialog-scrollable, applied to every modal) keeps the
 * title and action buttons always on screen; tighter field spacing means
 * ordinary forms fit with no scrolling at all. */
.modal-dialog {
  max-height: calc(100vh - 3.5rem);
}
.modal-content {
  max-height: 100%;
  overflow: hidden;
}
.modal-body {
  overflow-y: auto;
  padding-top: .85rem;
  padding-bottom: .85rem;
}
.modal-body .mb-3 { margin-bottom: .6rem !important; }
