/* =============================================
   SHREE DUKAN MANAGEMENT SYSTEM
   Custom CSS - No Bootstrap/Tailwind
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700;800&family=Mukta:wght@300;400;500;600;700&display=swap');

/* ---- CSS VARIABLES ---- */
:root {
  --primary: #FF6B35;
  --primary-dark: #e8571f;
  --primary-light: #ff8c5a;
  --secondary: #2C3E50;
  --secondary-light: #3d5166;
  --accent: #F7DC6F;
  --accent-dark: #f0c930;
  --bg: #FFF8F0;
  --bg-card: #ffffff;
  --success: #27AE60;
  --success-light: #d5f5e3;
  --error: #E74C3C;
  --error-light: #fdecea;
  --warning: #F39C12;
  --warning-light: #fef9e7;
  --info: #3498DB;
  --text-primary: #2C3E50;
  --text-secondary: #7f8c8d;
  --text-muted: #bdc3c7;
  --border: #e8ddd5;
  --border-light: #f0e8e0;
  --shadow-sm: 0 2px 8px rgba(255,107,53,0.08);
  --shadow-md: 0 4px 20px rgba(255,107,53,0.12);
  --shadow-lg: 0 8px 40px rgba(44,62,80,0.15);
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --topbar-height: 65px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  --font-display: 'Baloo 2', cursive;
  --font-body: 'Mukta', sans-serif;
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: var(--font-body); }
input, select, textarea { font-family: var(--font-body); }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--border-light); }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 3px; }

/* ============================
   LAYOUT
   ============================ */
.app-wrapper { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--secondary);
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-logo {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: var(--topbar-height);
}
.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255,107,53,0.4);
}
.sidebar-logo .logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 1;
  transition: var(--transition);
}
.sidebar-logo .logo-text span { color: var(--accent); display: block; font-size: 0.7rem; font-weight: 400; letter-spacing: 1px; text-transform: uppercase; }
.sidebar.collapsed .logo-text { opacity: 0; width: 0; }

.sidebar-nav { padding: 12px 0; flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-section-label {
  font-size: 0.65rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 14px 20px 6px;
  white-space: nowrap;
  transition: var(--transition);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.65);
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
  border-radius: 0;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
}
.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}
.nav-item.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(255,107,53,0.35);
}
.nav-item .nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.nav-item .nav-label { transition: var(--transition); }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--error);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 20px;
  font-weight: 700;
}
.sidebar.collapsed .nav-badge { display: none; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,0.06); }
.user-avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.8rem; font-weight: 700;
  flex-shrink: 0;
}
.user-info { transition: var(--transition); }
.sidebar.collapsed .user-info { opacity: 0; width: 0; overflow: hidden; }
.user-name { font-size: 0.85rem; font-weight: 600; color: white; }
.user-role { font-size: 0.72rem; color: rgba(255,255,255,0.45); }

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}
.main-content.expanded { margin-left: var(--sidebar-collapsed); }

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}
.topbar-toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--secondary);
  font-size: 1rem;
  transition: var(--transition);
  border: 1px solid var(--border);
}
.topbar-toggle:hover { background: var(--primary); color: white; border-color: var(--primary); }

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--secondary);
}
.topbar-title span { color: var(--primary); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }

.topbar-date {
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
}

.topbar-icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--secondary);
  font-size: 1rem;
  transition: var(--transition);
  border: 1px solid var(--border);
  position: relative;
}
.topbar-icon-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.notification-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--error);
  border-radius: 50%;
  border: 2px solid white;
}

/* ---- PAGE CONTENT ---- */
.page-content { padding: 24px; flex: 1; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header-left .page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--secondary);
}
.page-header-left .page-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.page-header-left .page-title i { color: var(--primary); margin-right: 8px; }
.breadcrumb {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.breadcrumb span { color: var(--primary); }

/* ---- FOOTER ---- */
.footer {
  background: white;
  border-top: 1px solid var(--border-light);
  padding: 14px 24px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.footer span { color: var(--primary); font-weight: 600; }

/* ============================
   COMPONENTS
   ============================ */

/* ---- STAT CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--primary);
  border-radius: 4px 0 0 4px;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.green::before { background: var(--success); }
.stat-card.red::before { background: var(--error); }
.stat-card.yellow::before { background: var(--warning); }
.stat-card.blue::before { background: var(--info); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.orange { background: rgba(255,107,53,0.12); color: var(--primary); }
.stat-icon.green { background: rgba(39,174,96,0.12); color: var(--success); }
.stat-icon.red { background: rgba(231,76,60,0.12); color: var(--error); }
.stat-icon.yellow { background: rgba(243,156,18,0.12); color: var(--warning); }
.stat-icon.blue { background: rgba(52,152,219,0.12); color: var(--info); }

.stat-info { flex: 1; min-width: 0; }
.stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 0.8rem; color: var(--text-secondary); }
.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--error); }

/* ---- CARDS ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i { color: var(--primary); }
.card-body { padding: 20px; }

/* ---- GRID LAYOUTS ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }

/* ---- CHARTS ---- */
.chart-container { position: relative; height: 280px; padding: 10px 0; }
.chart-container.tall { height: 340px; }

/* ---- TABLES ---- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}
thead th {
  background: var(--secondary);
  color: white;
  padding: 12px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  white-space: nowrap;
}
thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
tbody tr { border-bottom: 1px solid var(--border-light); transition: var(--transition); }
tbody tr:nth-child(even) { background: rgba(255,248,240,0.6); }
tbody tr:hover { background: rgba(255,107,53,0.05); }
tbody td { padding: 11px 14px; font-size: 0.88rem; color: var(--text-primary); vertical-align: middle; }
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}
.empty-state i { font-size: 2.5rem; color: var(--text-muted); display: block; margin-bottom: 10px; }
.empty-state p { font-size: 0.9rem; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-error { background: var(--error-light); color: var(--error); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: rgba(52,152,219,0.12); color: var(--info); }
.badge-primary { background: rgba(255,107,53,0.12); color: var(--primary); }
.badge-secondary { background: rgba(44,62,80,0.1); color: var(--secondary); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,107,53,0.35); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: var(--secondary-light); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #219a52; }
.btn-error { background: var(--error); color: white; }
.btn-error:hover { background: #c0392b; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-ghost { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; border-radius: var(--radius-sm); }
.btn-edit { background: rgba(52,152,219,0.1); color: var(--info); }
.btn-edit:hover { background: var(--info); color: white; }
.btn-delete { background: rgba(231,76,60,0.1); color: var(--error); }
.btn-delete:hover { background: var(--error); color: white; }

/* ---- FORMS ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}
.form-label .required { color: var(--error); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: white;
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,53,0.12); }
.form-control::-webkit-input-placeholder { color: var(--text-muted); }
.form-control.error { border-color: var(--error); }
.error-msg { font-size: 0.75rem; color: var(--error); display: flex; align-items: center; gap: 4px; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,62,80,0.65);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  backdrop-filter: blur(3px);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9) translateY(20px);
  transition: var(--transition);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary);
  display: flex; align-items: center; gap: 8px;
}
.modal-title i { color: var(--primary); }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: var(--transition);
  cursor: pointer;
}
.modal-close:hover { background: var(--error); color: white; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- TOAST ---- */
.toast-container {
  position: fixed;
  top: 80px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 300px;
}
.toast {
  background: white;
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  animation: toastIn 0.4s cubic-bezier(0.4,0,0.2,1) forwards;
  transition: var(--transition);
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }
.toast.warning { border-color: var(--warning); }
.toast-icon { font-size: 1.1rem; margin-top: 1px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.warning .toast-icon { color: var(--warning); }
.toast-content { flex: 1; }
.toast-title { font-size: 0.88rem; font-weight: 700; color: var(--secondary); }
.toast-msg { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.toast-close { font-size: 0.75rem; color: var(--text-muted); cursor: pointer; padding: 2px; }
.toast-close:hover { color: var(--text-primary); }
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; max-height: 100px; } to { transform: translateX(120%); opacity: 0; max-height: 0; overflow: hidden; } }

/* ---- TABS ---- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; background: var(--bg); padding: 5px; border-radius: var(--radius); border: 1px solid var(--border); }
.tab-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.tab-btn:hover { background: white; color: var(--primary); }
.tab-btn.active { background: white; color: var(--primary); box-shadow: var(--shadow-sm); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- FILTER BAR ---- */
.filter-bar {
  background: white;
  border-radius: var(--radius);
  padding: 14px 18px;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-control {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: white;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  font-family: var(--font-body);
}
.filter-control:focus { border-color: var(--primary); }

/* ---- ALERT BOXES ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-light); color: #1a7a42; border-left: 4px solid var(--success); }
.alert-error { background: var(--error-light); color: #c0392b; border-left: 4px solid var(--error); }
.alert-warning { background: var(--warning-light); color: #d68910; border-left: 4px solid var(--warning); }
.alert-info { background: rgba(52,152,219,0.1); color: #2471a3; border-left: 4px solid var(--info); }

/* ---- PRODUCT CARD / QUICK WIDGETS ---- */
.product-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,107,53,0.1);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}
.top-seller-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  padding: 20px;
  color: white;
  text-align: center;
}
.top-seller-card .trophy { font-size: 2.5rem; margin-bottom: 8px; }
.top-seller-card .product-name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }
.top-seller-card .stats { font-size: 0.82rem; opacity: 0.85; margin-top: 4px; }

/* ---- SALARY STATUS ---- */
.salary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.salary-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}
.salary-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.salary-months { display: flex; flex-wrap: wrap; gap: 6px; }
.salary-month {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}
.salary-month.paid { background: var(--success-light); border-color: var(--success); color: var(--success); }
.salary-month.unpaid { background: var(--error-light); border-color: var(--error); color: var(--error); }
.salary-month:hover { border-color: var(--primary); }

/* ---- ATTENDANCE ---- */
.attendance-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.attendance-toggle {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid;
}
.attendance-toggle.present { background: var(--success-light); border-color: var(--success); color: var(--success); }
.attendance-toggle.absent { background: var(--error-light); border-color: var(--error); color: var(--error); }

/* ---- MISC ---- */
.divider { height: 1px; background: var(--border-light); margin: 20px 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.text-primary-color { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-muted { color: var(--text-secondary); }
.mb-0 { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.actions-col { display: flex; gap: 6px; align-items: center; }
.rupee { font-family: var(--font-display); }
.section-divider { border: none; border-top: 2px dashed var(--border); margin: 24px 0; }

/* ---- OVERLAY (mobile sidebar) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,62,80,0.5);
  z-index: 999;
}
.sidebar-overlay.active { display: block; }

/* ============================
   RESPONSIVE — COMPREHENSIVE MOBILE-FIRST
   ============================ */

/* ── TABLET (≤1024px) ── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .chart-container { height: 240px; }
  .chart-container.tall { height: 280px; }
}

/* ── MOBILE (≤768px) ── */
@media (max-width: 768px) {

  /* ---- Layout ---- */
  :root {
    --sidebar-width: 280px;
    --topbar-height: 58px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .main-content { margin-left: 0 !important; }

  /* ---- Topbar ---- */
  .topbar {
    padding: 0 14px;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 900;
  }
  .topbar-date { display: none; }
  .topbar-title { font-size: 1rem; }
  .topbar-wallet { font-size: 0.72rem; padding: 4px 9px; }
  .topbar-wallet i { display: none; }

  /* User dropdown — hide name on mobile */
  .user-trigger .uname,
  .user-trigger .urole,
  .user-trigger .caret { display: none; }
  .user-trigger { padding: 5px; }

  /* ---- Page Content ---- */
  .page-content { padding: 14px; }

  .page-header { margin-bottom: 16px; gap: 8px; }
  .page-header-left .page-title { font-size: 1.3rem; }
  .page-header-left .page-subtitle { font-size: 0.78rem; }
  .breadcrumb { font-size: 0.72rem; }

  /* ---- Grids ---- */
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-auto { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* ---- Stat Cards ---- */
  .stat-card { padding: 14px; gap: 12px; }
  .stat-icon { width: 44px; height: 44px; font-size: 1.1rem; }
  .stat-value { font-size: 1.2rem; }

  /* ---- Cards ---- */
  .card-header { padding: 12px 14px; gap: 8px; }
  .card-title { font-size: 0.9rem; }
  .card-body { padding: 14px; }

  /* ---- Tables ---- */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 480px; }
  thead th { padding: 10px 10px; font-size: 0.72rem; }
  tbody td { padding: 9px 10px; font-size: 0.82rem; }

  /* ---- Forms ---- */
  .form-grid { grid-template-columns: 1fr; }
  .form-control { font-size: 16px; } /* prevents iOS zoom */
  select.form-control { font-size: 16px; }
  textarea.form-control { font-size: 16px; }

  /* ---- Filter Bar ---- */
  .filter-bar { padding: 12px; gap: 10px; }
  .filter-group { width: 100%; }
  .filter-control { width: 100%; font-size: 16px; }
  .filter-bar form { flex-direction: column; }

  /* ---- Buttons ---- */
  .btn { font-size: 0.82rem; padding: 8px 14px; }
  .btn-sm { padding: 6px 10px; font-size: 0.76rem; }

  /* ---- Modals — Bottom Sheet Style ---- */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    margin: 0;
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    width: 100%;
    max-width: 100%;
  }
  .modal-header { padding: 16px 18px; }
  .modal-body { padding: 16px 18px; }
  .modal-footer { padding: 12px 18px; }

  /* Modal drag handle */
  .modal::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 8px auto -4px;
  }

  /* ---- Charts ---- */
  .chart-container { height: 200px; }
  .chart-container.tall { height: 240px; }

  /* ---- Tabs ---- */
  .tabs { padding: 4px; gap: 2px; overflow-x: auto; flex-wrap: nowrap; }
  .tab-btn { font-size: 0.76rem; padding: 7px 10px; white-space: nowrap; flex-shrink: 0; }

  /* ---- Footer ---- */
  .footer { padding: 10px 14px; font-size: 0.72rem; }

  /* ---- Salary Grid ---- */
  .salary-grid { grid-template-columns: 1fr; }
  .salary-months { gap: 4px; }
  .salary-month { font-size: 0.66rem; padding: 3px 7px; }

  /* ---- Wallet page specific ---- */
  .wallet-balance-card { padding: 20px 18px; }
  .wallet-balance-card .balance-amount { font-size: 2.2rem; }
  .wallet-meta { gap: 14px; }
  .wallet-meta-item .wm-val { font-size: 1rem; }
  .wallet-meta-item .wm-label { font-size: 0.64rem; }
  .wallet-divider { display: none; }
  .source-breakdown { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .src-card { padding: 10px 12px; }

  /* ---- Attendance buttons ---- */
  .att-btn { width: 32px; height: 32px; font-size: 0.8rem; }

  /* ---- Actions column ---- */
  .actions-col { gap: 4px; }
  .btn-icon { width: 30px; height: 30px; font-size: 0.8rem; }

  /* ---- Alert boxes ---- */
  .alert { font-size: 0.82rem; padding: 10px 12px; }

  /* ---- Confirm Dialog ---- */
  .confirm-dialog { padding: 22px 18px; }
  .confirm-icon { font-size: 2.5rem; margin-bottom: 10px; }
  .confirm-title { font-size: 1.05rem; }
  .confirm-msg { font-size: 0.82rem; }
}

/* ── SMALL MOBILE (≤480px) ── */
@media (max-width: 480px) {

  /* ---- Layout ---- */
  .page-content { padding: 10px; }

  /* ---- Stats ---- */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 1rem; border-radius: var(--radius-sm); }
  .stat-value { font-size: 1.1rem; }
  .stat-label { font-size: 0.72rem; }
  .stat-change { font-size: 0.68rem; }

  /* ---- Page header ---- */
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-left .page-title { font-size: 1.15rem; }

  /* ---- Topbar ---- */
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar-toggle { width: 32px; height: 32px; }
  .topbar-title { font-size: 0.9rem; }
  .topbar-wallet { display: none; } /* too cramped at 480px, wallet is in sidebar */
  .topbar-icon-btn { width: 32px; height: 32px; font-size: 0.85rem; }

  /* ---- Cards ---- */
  .card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .card-header > *:last-child { align-self: flex-start; }

  /* ---- Tabs ---- */
  .tabs { gap: 2px; }
  .tab-btn { font-size: 0.72rem; padding: 6px 8px; }
  .tab-btn i { margin-right: 2px; }

  /* ---- Filter bar ---- */
  .filter-bar { border-radius: var(--radius-sm); }

  /* ---- Table ---- */
  thead th { padding: 8px 8px; font-size: 0.68rem; }
  tbody td { padding: 8px 8px; font-size: 0.78rem; }
  .empty-state { padding: 28px 16px; }
  .empty-state i { font-size: 2rem; }
  .empty-state p { font-size: 0.82rem; }

  /* ---- Buttons in header ---- */
  .page-header .btn { width: 100%; justify-content: center; }

  /* ---- Charts ---- */
  .chart-container { height: 180px; }
  .chart-container.tall { height: 210px; }

  /* ---- Calendar grid (attendance history) ---- */
  /* smaller cells on tiny screens */

  /* ---- Reports page ---- */
  .top-seller-card .trophy { font-size: 2rem; }
  .top-seller-card .product-name { font-size: 1.1rem; }

  /* ---- Wallet ---- */
  .wallet-balance-card { padding: 16px 14px; border-radius: var(--radius); }
  .wallet-balance-card .balance-amount { font-size: 1.9rem; }
  .wallet-meta { gap: 10px; flex-wrap: wrap; }
  .source-breakdown { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .src-card { padding: 8px 10px; }
  .src-card .src-name { font-size: 0.72rem; }

  /* ---- Salary tracker ---- */
  .salary-card { padding: 12px; }
  .salary-card-header { gap: 8px; margin-bottom: 10px; }

  /* ---- Attendance table columns — hide role on tiny screens ---- */
  /* use nth-child to hide role column on smallest screens */
  .att-table-role { display: none; }

  /* ---- Badges ---- */
  .badge { font-size: 0.65rem; padding: 2px 7px; }

  /* ---- Modal ---- */
  .modal { max-height: 95vh; }
  .modal-header { padding: 12px 14px; }
  .modal-title { font-size: 0.95rem; }
  .modal-body { padding: 12px 14px; }
  .modal-footer { padding: 10px 14px; }

  /* ---- Confirm ---- */
  .confirm-dialog { padding: 18px 14px; width: 95%; }

  /* ---- Login page ---- */
  .login-card { padding: 28px 20px; }
  .login-logo h1 { font-size: 1.3rem; }
  .logo-circle { width: 60px; height: 60px; font-size: 1.6rem; }

  /* ---- Rent progress tiles ---- */
  /* month tiles wrap better */

  /* ---- Footer ---- */
  .footer { font-size: 0.68rem; }
}

/* ── EXTRA SMALL (≤360px) ── */
@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { flex-direction: row; }
  .source-breakdown { grid-template-columns: 1fr; }
  .tab-btn .nav-label,
  .tab-btn span:not(.badge) { display: none; }
  .wallet-balance-card .balance-amount { font-size: 1.6rem; }
}

/* ── TOUCH IMPROVEMENTS (all touch devices) ── */
@media (hover: none) and (pointer: coarse) {
  /* Larger tap targets */
  .nav-item { padding: 13px 20px; }
  .btn { min-height: 40px; }
  .btn-icon { width: 36px; height: 36px; }
  .att-btn { width: 38px; height: 38px; }
  .form-control { min-height: 42px; }
  select.form-control { min-height: 42px; }
  .filter-control { min-height: 40px; }
  .salary-month { padding: 6px 12px; }
  .tab-btn { min-height: 36px; }

  /* Remove hover animations on touch — prevents sticky states */
  .stat-card:hover { transform: none; box-shadow: var(--shadow-sm); }
  .btn-primary:hover { transform: none; }
  .btn-outline:hover { }
  .topbar-wallet:hover { transform: none; box-shadow: none; }
  .nav-item:hover { }
}

/* ── LANDSCAPE PHONE ── */
@media (max-width: 768px) and (orientation: landscape) {
  :root { --topbar-height: 50px; }
  .topbar { height: var(--topbar-height); }
  .page-content { padding: 10px 14px; }
  .modal { max-height: 85vh; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .chart-container { height: 160px; }
  .chart-container.tall { height: 190px; }
}

/* ── SAFE AREA (iPhone notch/home bar) ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .modal-overlay {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .footer {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
}

/* ── PRINT ── */
@media print {
  .sidebar, .topbar, .filter-bar, .page-header-right,
  .btn, .tabs, .modal-overlay, .toast-container,
  .topbar-toggle, .sidebar-overlay { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; page-break-inside: avoid; }
  .stats-grid { grid-template-columns: repeat(4, 1fr) !important; }
  .grid-2, .grid-3 { grid-template-columns: repeat(2, 1fr) !important; }
  body { background: white !important; }
  canvas { max-height: 250px !important; }
}

/* ---- Loading pulse ---- */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
.loading { animation: pulse 1.5s ease infinite; }

/* ---- Confirm Dialog ---- */
.confirm-dialog {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: var(--transition);
}
.modal-overlay.active .confirm-dialog { transform: scale(1); }
.confirm-icon { font-size: 3rem; margin-bottom: 14px; }
.confirm-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--secondary); margin-bottom: 8px; }
.confirm-msg { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }