/* ==========================================================================
   ROJMED ERP - CLEAN & SPACIOUS ENTERPRISE SAAS DESIGN SYSTEM
   Lighter, visually balanced, refined whitespace, compact elements & clear hierarchy
   ========================================================================== */

:root {
  /* Brand Palette - Refined Indigo & Navy */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-500: #4f46e5;
  --primary-600: #4338ca;
  --primary-700: #3730a3;
  
  --accent-cyan: #0891b2;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  
  /* Surfaces & Clean Backgrounds */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-card: #1e293b;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
  --bg-sidebar-active: #2563eb;
  
  /* Typography Colors */
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  /* Borders & Dividers */
  --border-subtle: #f1f5f9;
  --border-light: #e2e8f0;
  --border-focus: #818cf8;
  
  /* Subtle Clean Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px 0 rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  
  /* Proportional Dimensions */
  --sidebar-width: 240px;
  --header-height: 56px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
}

/* Global Reset & Proportional Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-body);
  margin: 0;
  padding: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-top: 0;
}

h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 0.95rem; }
h6 { font-size: 0.84rem; }

/* App Layout Grid */
#app-layout {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  position: relative;
}

/* -------------------------------------------------------------
   SIDEBAR NAVIGATION (Clean, Minimalist & Uncluttered)
   ------------------------------------------------------------- */
#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: #94a3b8;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1045;
  transition: transform 0.25s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.2rem;
  gap: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1rem;
}

.brand-text {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-text .badge-erp {
  font-size: 0.58rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-subtext {
  font-size: 0.62rem;
  color: #64748b;
  font-weight: 500;
  display: block;
}

.sidebar-menu {
  flex-grow: 1;
  overflow-y: auto;
  padding: 0.85rem 0.65rem;
  list-style: none;
  margin: 0;
}

.sidebar-menu::-webkit-scrollbar {
  width: 3px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.nav-section-title {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  font-weight: 800;
  padding: 0.75rem 0.6rem 0.25rem;
}

.nav-item {
  margin-bottom: 0.12rem;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  padding: 0.45rem 0.65rem;
  color: #94a3b8;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-link-custom i {
  font-size: 0.95rem;
  margin-right: 0.65rem;
  width: 18px;
  text-align: center;
  color: #64748b;
  transition: all 0.15s ease;
}

.nav-link-custom:hover {
  background-color: var(--bg-sidebar-hover);
  color: #f1f5f9;
}
.nav-link-custom:hover i {
  color: #38bdf8;
}

.nav-link-custom.active {
  background: var(--bg-sidebar-active);
  color: #ffffff;
  font-weight: 600;
}
.nav-link-custom.active i {
  color: #ffffff;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.08rem 0.35rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.submenu-collapse {
  padding-left: 1.5rem;
  list-style: none;
  margin: 0.15rem 0 0.35rem;
}
.submenu-link {
  display: flex;
  align-items: center;
  padding: 0.3rem 0.55rem;
  font-size: 0.76rem;
  color: #64748b;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.15s;
}
.submenu-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
}
.submenu-link.active {
  color: #38bdf8;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.1);
}

.sidebar-footer {
  padding: 0.65rem 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.15);
}
.btn-reset-demo {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 0.74rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem;
  width: 100%;
  transition: all 0.15s;
}
.btn-reset-demo:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* -------------------------------------------------------------
   MAIN WRAPPER & TOPBAR (Spacious & Clean)
   ------------------------------------------------------------- */
#main-wrapper {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  max-width: calc(100vw - var(--sidebar-width));
}

#top-navbar {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.topbar-search {
  position: relative;
  width: 250px;
}
.topbar-search input {
  padding-left: 2rem;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid var(--border-light);
  background: #f8fafc;
  font-weight: 500;
  transition: all 0.2s;
  height: 32px;
}
.topbar-search input:focus {
  background: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.topbar-search i {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s;
}
.user-profile-badge:hover {
  border-color: #cbd5e1;
}
.user-avatar {
  width: 26px;
  height: 26px;
  background: #eff6ff;
  color: #2563eb;
  font-weight: 700;
  font-size: 0.72rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Page Container - Ample Breathing Room */
.page-container {
  padding: 1.5rem 1.75rem;
  flex-grow: 1;
}

/* -------------------------------------------------------------
   CLEAN CARDS & BALANCED METRICS
   ------------------------------------------------------------- */
.card-custom {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  margin-bottom: 1.25rem;
  transition: border-color 0.2s ease;
}
.card-custom:hover {
  border-color: #cbd5e1;
}

.card-custom .card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-main);
  font-size: 0.86rem;
}

.card-custom .card-body {
  padding: 1.15rem;
}

/* KPI Cards - Clean & Lightweight */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}
.kpi-card:hover {
  transform: translateY(-1px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.kpi-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.kpi-title {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}
.kpi-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}
.kpi-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* KPI Color Schemes */
.kpi-blue .kpi-icon-box { background: #eff6ff; color: #2563eb; }
.kpi-purple .kpi-icon-box { background: #faf5ff; color: #7c3aed; }
.kpi-cyan .kpi-icon-box { background: #ecfeff; color: #0891b2; }
.kpi-indigo .kpi-icon-box { background: #e0e7ff; color: #4338ca; }
.kpi-emerald .kpi-icon-box { background: #ecfdf5; color: #059669; }
.kpi-rose .kpi-icon-box { background: #fff1f2; color: #e11d48; }
.kpi-amber .kpi-icon-box { background: #fffbeb; color: #d97706; }
.kpi-green .kpi-icon-box { background: #f0fdf4; color: #16a34a; }

/* -------------------------------------------------------------
   CLEAN DATA TABLES
   ------------------------------------------------------------- */
.table-custom {
  margin-bottom: 0;
  width: 100%;
}
.table-custom thead th {
  background-color: #f8fafc;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-light);
  border-top: none;
  white-space: nowrap;
}
.table-custom tbody td {
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-body);
}
.table-custom tbody tr:hover td {
  background-color: #f8fafc;
}
.table-custom tbody tr:last-child td {
  border-bottom: none;
}
.table-custom tfoot td {
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
}

/* Micro Badges */
.badge {
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
}
.badge-soft-success { background-color: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-soft-warning { background-color: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-soft-danger  { background-color: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }
.badge-soft-info    { background-color: #ecfeff; color: #155e75; border: 1px solid #a5f3fc; }
.badge-soft-primary { background-color: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-soft-secondary { background-color: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

/* Currency Typography */
.amount-inr {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-weight: 700;
}

/* Action Buttons */
.btn-action {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.78rem;
  margin-right: 2px;
  border: 1px solid var(--border-light);
  background: #ffffff;
  color: var(--text-muted);
  transition: all 0.15s;
}
.btn-action:hover {
  background: #f1f5f9;
}
.btn-action.btn-view:hover { color: #0284c7; background: #f0f9ff; border-color: #bae6fd; }
.btn-action.btn-edit:hover { color: #d97706; background: #fffbeb; border-color: #fde68a; }
.btn-action.btn-delete:hover { color: #e11d48; background: #fff1f2; border-color: #fecdd3; }

.btn-primary-custom {
  background: #2563eb;
  border: 1px solid #2563eb;
  color: #ffffff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.38rem 0.85rem;
  font-size: 0.8rem;
  transition: all 0.15s;
}
.btn-primary-custom:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

/* -------------------------------------------------------------
   FINANCIAL SUMMARY BOXES
   ------------------------------------------------------------- */
.fin-summary-box {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-align: center;
  box-shadow: var(--shadow-xs);
}
.fin-summary-box.income {
  border-top: 3px solid #10b981;
}
.fin-summary-box.expense {
  border-top: 3px solid #f43f5e;
}
.fin-summary-box.profit {
  border-top: 3px solid #2563eb;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}

/* -------------------------------------------------------------
   FORMS & MODALS
   ------------------------------------------------------------- */
.modal-content {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  border-bottom: 1px solid var(--border-light);
  background-color: #f8fafc;
  padding: 0.75rem 1.15rem;
}
.modal-footer {
  border-top: 1px solid var(--border-light);
  background-color: #f8fafc;
  padding: 0.65rem 1.15rem;
}

.form-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  margin-bottom: 0.2rem;
}
.form-control, .form-select {
  font-size: 0.8rem;
  border-color: var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.38rem 0.6rem;
  color: var(--text-main);
  transition: all 0.15s;
}
.form-control:focus, .form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-control[readonly] {
  background-color: #f1f5f9;
  font-weight: 600;
  color: #334155;
}

/* Progress bar */
.progress-thin {
  height: 6px;
  border-radius: 4px;
  background-color: #e2e8f0;
  overflow: hidden;
}
.progress-bar-custom {
  background: #2563eb;
  border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.show {
    transform: translateX(0);
    box-shadow: 10px 0 25px rgba(0,0,0,0.2);
  }
  #main-wrapper {
    margin-left: 0;
    max-width: 100vw;
  }
  .page-container {
    padding: 1rem;
  }
}
