/* RBILL - Premium Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #1d4ed8;
  --accent: #3b82f6;
  --accent-dark: #1d4ed8;
  --accent-light: #dbeafe;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 72px;
  --topbar-h: 64px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ===== LAYOUT ===== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  overflow: hidden;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white; font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
}

.brand-tagline {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; color: white; line-height: 1.3; }
.user-role {
  font-size: 10px; 
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.role-badge.admin { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.role-badge.staff { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.role-badge.seller { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  padding: 6px 20px 4px;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-item {
  padding: 4px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: white;
  transform: translateX(2px);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.nav-link .nav-icon {
  width: 20px; height: 20px;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.nav-link .nav-text { flex: 1; }

.nav-badge {
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 16px;
}
.topbar-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* ===== PAGE CONTENT ===== */
.page-content {
  padding: 24px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body { padding: 20px; }

/* ===== STAT CARDS ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #6366f1);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card.success::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), #fcd34d); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.stat-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}
.stat-icon.blue { background: #dbeafe; color: var(--accent); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.yellow { background: #fef3c7; color: var(--warning); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.45);
  transform: translateY(-1px);
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.btn-success:hover { box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4); transform: translateY(-1px); color: white; }

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4); transform: translateY(-1px); color: white; }

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.btn-warning:hover { transform: translateY(-1px); color: white; }

.btn-secondary {
  background: var(--bg-main);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }

.btn-outline-primary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline-primary:hover { background: var(--accent); color: white; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-grid {
  display: grid;
  gap: 16px;
}
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
}

/* ===== TABLES ===== */
.table-wrapper {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  background: var(--bg-main);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-main); }

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.badge-paid { background: #d1fae5; color: #059669; }
.badge-unpaid { background: #fee2e2; color: #dc2626; }
.badge-partial { background: #fef3c7; color: #d97706; }
.badge-cancelled { background: #f1f5f9; color: #64748b; }
.badge-admin { background: #fee2e2; color: #dc2626; }
.badge-staff { background: #fef3c7; color: #b45309; }
.badge-seller { background: #d1fae5; color: #059669; }
.badge-primary { background: var(--accent-light); color: var(--accent-dark); }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-success { background: #d1fae5; color: #059669; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-secondary { background: #f1f5f9; color: #64748b; }

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}

.alert-success { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.alert-info { background: #e0f2fe; color: #075985; border-color: #bae6fd; }

/* ===== CHART CONTAINERS ===== */
.chart-container {
  position: relative;
  height: 280px;
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}

.quick-action-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.quick-action-btn .icon {
  font-size: 28px;
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}

.qab-blue .icon { background: #dbeafe; color: var(--accent); }
.qab-green .icon { background: #d1fae5; color: var(--success); }
.qab-purple .icon { background: #ede9fe; color: #7c3aed; }
.qab-orange .icon { background: #ffedd5; color: #ea580c; }
.qab-pink .icon { background: #fce7f3; color: #db2777; }

/* ===== INVOICE FORM ===== */
.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.invoice-items-table th {
  background: var(--sidebar-bg);
  color: white;
  padding: 10px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
}

.invoice-items-table td {
  padding: 8px 6px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-light);
}

.invoice-items-table .form-control {
  padding: 7px 10px;
  font-size: 12.5px;
}

.invoice-totals {
  background: var(--bg-main);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.total-row:last-child { border-bottom: none; }
.total-row.grand-total {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  padding-top: 10px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
  display: block;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at center,
    rgba(59, 130, 246, 0.07) 0%,
    transparent 50%
  );
  animation: rotate 20s linear infinite;
}

@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.login-card {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-card-inner {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-brand-icon {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 900; color: white;
  margin: 0 auto 12px;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.login-logo h1 {
  font-size: 26px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
}

.login-logo p { font-size: 12px; color: rgba(255,255,255,0.4); margin-top: 2px; }

.login-form .form-label {
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  font-weight: 600;
}

.login-form .form-control {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.1);
  color: white;
  border-radius: 10px;
  padding: 12px 16px;
}

.login-form .form-control:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.09);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.login-form .form-control::placeholder { color: rgba(255,255,255,0.3); }

.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  margin-top: 6px;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.5);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVE — FULL MOBILE SUPPORT ===== */

/* Tablet & below */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 20px; }
}

/* Mobile — ≤768px */
@media (max-width: 768px) {
  :root { --topbar-h: 56px; }

  /* --- Sidebar: off-canvas drawer --- */
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
    z-index: 1200;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* make it scrollable on small phones */
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }

  /* --- Overlay behind open sidebar --- */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1100;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.visible { display: block; }

  /* --- Main content fills full width --- */
  .main-content { margin-left: 0; }

  /* --- Topbar: show hamburger, shrink --- */
  .topbar {
    padding: 0 16px;
    height: var(--topbar-h);
  }
  #sidebarToggle { display: flex !important; }

  .topbar-title { font-size: 15px; }
  .topbar-subtitle { display: none; }

  /* Hide the user name/role text in topbar on very small screens */
  .topbar-right > div:last-child { display: none; }

  /* --- Page layout --- */
  .page-content { padding: 14px; }

  /* --- Stat cards: 2 columns --- */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 18px; }
  .stat-icon { width: 36px; height: 36px; font-size: 16px; margin-bottom: 8px; }

  /* --- Form grids collapse to 1 column --- */
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 { grid-template-columns: 1fr !important; }

  /* Override inline style grid-column spans */
  .form-grid [style*="grid-column"] { grid-column: 1 / -1 !important; }

  /* --- Quick actions --- */
  .quick-actions { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .quick-action-btn { padding: 14px 8px; font-size: 11px; }
  .quick-action-btn .icon { width: 40px; height: 40px; font-size: 20px; }

  /* --- Cards --- */
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
  }
  .card-body { padding: 14px; }

  /* --- Tables: horizontal scroll on mobile --- */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 600px; }
  .data-table thead th,
  .data-table tbody td { padding: 10px 12px; font-size: 12.5px; }

  /* --- Invoice items table --- */
  .invoice-items-table { min-width: 700px; }
  .invoice-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* --- Charts: shorter on mobile --- */
  .chart-container { height: 200px; }

  /* --- Action menus stack vertically --- */
  .action-menu { flex-wrap: wrap; gap: 4px; }
  .action-menu .btn { font-size: 11px; padding: 5px 9px; }

  /* --- Topbar action buttons smaller text --- */
  .topbar-right .btn { font-size: 12px; padding: 6px 10px; }

  /* --- Two-column page grids (e.g., seller detail, create seller form) --- */
  div[style*="grid-template-columns:2fr 1fr"],
  div[style*="grid-template-columns:1fr 2fr"],
  div[style*="grid-template-columns:2fr 1fr;"],
  div[style*="grid-template-columns: 1fr 2fr"] {
    display: block !important;
  }
  
  div[style*="grid-template-columns:"] > div {
    margin-bottom: 20px;
  }

  /* Generic two-col inline grids collapse */
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Seller/admin detail stat-grid stripe */
  .stat-grid[style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* --- Page section label --- */
  .page-title { font-size: 18px; }

  /* --- Invoice detail info grid --- */
  .info-grid { grid-template-columns: 1fr !important; }
  .meta-grid { grid-template-columns: 1fr 1fr; }

  /* --- Login card --- */
  .login-card-inner { padding: 28px 20px; }
}

/* Extra small phones — ≤480px */
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .topbar-right .btn span { display: none; } /* icon-only buttons in topbar */
  .btn { font-size: 12.5px; }
  .stat-value { font-size: 16px; }
  .page-content { padding: 10px; }
  .chart-container { height: 180px; }
  .card-header { padding: 10px 12px; }
  .card-body { padding: 12px; }
}


/* ===== MISC ===== */
.text-rupee::before { content: '₹'; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--accent); }
.text-bold { font-weight: 700; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.ms-auto { margin-left: auto; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-3 { margin-top: 12px; }
.w-100 { width: 100%; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.section-header {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-menu { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 0;
  background: var(--bg-main);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.tab-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ===== INVOICE PREVIEW ===== */
.invoice-preview-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.invoice-header-stripe {
  background: linear-gradient(135deg, #0f172a, #1e40af);
  color: white;
  padding: 24px 28px;
}

.invoice-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.invoice-meta-block { font-size: 13px; }
.invoice-meta-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }

/* animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeIn 0.3s ease-out; }

.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--border-light) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
