/* ─────────────────────────────────────────────────────────────
  SLBBC Premium CSS Styling Systems
  Design: Modern Industrial / Corporate Glassmorphism
───────────────────────────────────────────────────────────── */

:root {
  --primary-color: #0E3A5F;      /* Deep Industrial Blue */
  --primary-rgb: 14, 58, 95;
  --secondary-color: #3B4A55;    /* Steel Gray */
  --accent-color: #F26B1F;       /* Safety Orange */
  --accent-rgb: 242, 107, 31;
  --bg-main: #F5F7FB;            /* Premium Light Slate Background */
  --bg-sidebar: #0A2240;         /* Deep Space Navy */
  --bg-card: #FFFFFF;
  --bg-card-rgb: 255, 255, 255;
  --border-color: rgba(14, 58, 95, 0.08);
  --text-main: #1C2434;          /* Midnight Blue-Black */
  --text-muted: #64748B;         /* Cool Slate Gray */
  --text-white: #FFFFFF;
  
  /* Status Colors */
  --status-active: #10B981;      /* Active / Paid / Verified */
  --status-active-bg: rgba(16, 185, 129, 0.08);
  --status-warning: #F59E0B;     /* Draft / Pending */
  --status-warning-bg: rgba(245, 158, 11, 0.08);
  --status-danger: #EF4444;      /* Terminated / Cancelled / Absent */
  --status-danger-bg: rgba(239, 68, 68, 0.08);
  --status-info: #3B82F6;
  --status-info-bg: rgba(59, 130, 246, 0.08);

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(14, 58, 95, 0.04);
  --shadow-md: 0 8px 24px rgba(14, 58, 95, 0.06);
  --shadow-lg: 0 16px 40px rgba(14, 58, 95, 0.1);
  --shadow-inset: inset 0 2px 4px rgba(14, 58, 95, 0.03);

  /* Fonts */
  --font-main: 'Inter', sans-serif;
  --font-heading: 'Outfit', sans-serif;
}

/* ─────────────────────────────────────────────────────────────
  GENERAL & RESET
───────────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* App Containers */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.app-main {
  padding: 2.5rem;
  overflow-y: auto;
  max-height: 100vh;
  background: radial-gradient(circle at 100% 0%, rgba(14, 58, 95, 0.03) 0%, rgba(245, 247, 251, 0) 50%);
}

/* Mobile drawer scrim — hidden on desktop so it doesn't occupy a grid cell
   (which would push .app-main onto a second row, under the sidebar). */
.sidebar-overlay {
  display: none;
}

/* ─────────────────────────────────────────────────────────────
  SIDEBAR STYLE
───────────────────────────────────────────────────────────── */
.app-sidebar {
  background-color: var(--bg-sidebar);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow-lg);
  z-index: 10;
}

.sidebar-brand {
  padding: 2.25rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.brand-logo {
  background: linear-gradient(135deg, var(--accent-color) 0%, #FF8D3F 100%);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(242, 107, 31, 0.3);
}

.icon-flame {
  width: 22px;
  height: 22px;
  stroke: var(--text-white);
  stroke-width: 2px;
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.sub-brand {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: block;
  margin-top: -2px;
}

.sidebar-nav {
  padding: 2rem 1.25rem;
  flex-grow: 1;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.nav-item i {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
}

.nav-item:hover {
  color: var(--text-white);
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: var(--text-white);
  background: linear-gradient(135deg, rgba(14, 58, 95, 0.8) 0%, rgba(14, 58, 95, 0.4) 100%);
  border: 1px solid rgba(14, 58, 95, 0.3);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 4px;
  background-color: var(--accent-color);
  border-radius: 0 4px 4px 0;
}

.sidebar-footer {
  padding: 1.75rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.75rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background-color: var(--status-active);
  box-shadow: 0 0 8px var(--status-active);
}

.org-mini-info .proprietor-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.org-mini-info .proprietor-sub {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
}

/* ─────────────────────────────────────────────────────────────
  HEADER & ACTION BAR
───────────────────────────────────────────────────────────── */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
}

.header-title h2 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
}

.header-title p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.period-selector-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.period-selector-wrapper .input-icon {
  position: absolute;
  left: 1rem;
  width: 18px;
  height: 18px;
  color: var(--primary-color);
  pointer-events: none;
}

.period-select {
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary-color);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem 0.75rem 2.5rem;
  border-radius: 10px;
  cursor: pointer;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230E3A5F' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 14px;
}

.period-select:hover, .period-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(14, 58, 95, 0.06);
}

/* ─────────────────────────────────────────────────────────────
  TAB PANELS & CARDS
───────────────────────────────────────────────────────────── */
.tab-panel {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Metrics Dashboard Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 48px;
  height: 48px;
  background: radial-gradient(circle, rgba(14, 58, 95, 0.02) 0%, transparent 70%);
  border-radius: 50%;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(14, 58, 95, 0.15);
}

.metric-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-inset);
}

.metric-icon i {
  width: 24px;
  height: 24px;
}

/* Icon Colors */
.bg-blue { background-color: rgba(14, 58, 95, 0.08); color: var(--primary-color); }
.bg-green { background-color: rgba(16, 185, 129, 0.08); color: var(--status-active); }
.bg-purple { background-color: rgba(139, 92, 246, 0.08); color: #8B5CF6; }
.bg-orange { background-color: rgba(242, 107, 31, 0.08); color: var(--accent-color); }
.bg-teal { background-color: rgba(20, 184, 166, 0.08); color: #14B8A6; }
.bg-red { background-color: rgba(239, 68, 68, 0.08); color: var(--status-danger); }

.metric-data {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.15rem;
  margin-bottom: 0.15rem;
}

.metric-trend {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────
  CHARTS SECTIONS
───────────────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.chart-container:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(14, 58, 95, 0.12);
}

.chart-container.span-2 {
  grid-column: span 2;
}

.chart-header {
  margin-bottom: 1.5rem;
}

.chart-header h4 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-color);
}

.chart-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.chart-canvas-wrapper {
  position: relative;
  flex-grow: 1;
  min-height: 250px;
  max-height: 320px;
}

.mt-4 { margin-top: 1.5rem; }

/* Audit Logs Panel */
.audit-logs-feed {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.audit-item {
  display: flex;
  gap: 0.85rem;
  padding: 0.75rem;
  border-radius: 10px;
  background-color: var(--bg-main);
  border-left: 3px solid var(--text-muted);
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.audit-item:hover {
  background-color: rgba(14, 58, 95, 0.04);
}

.audit-item.action-insert { border-left-color: var(--status-active); }
.audit-item.action-update { border-left-color: var(--status-info); }
.audit-item.action-delete { border-left-color: var(--status-danger); }

.audit-details p {
  font-weight: 500;
  color: var(--text-main);
}

.audit-details span {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  display: block;
}

/* ─────────────────────────────────────────────────────────────
  TABLE SYSTEMS
───────────────────────────────────────────────────────────── */
.toolbar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.search-input-wrapper {
  position: relative;
  flex-grow: 1;
  max-width: 450px;
}

.search-input-wrapper .input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.search-input-wrapper input {
  width: 100%;
  font-family: var(--font-main);
  font-size: 0.9rem;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-main);
  outline: none;
  transition: all 0.3s ease;
  color: var(--text-main);
}

.search-input-wrapper input:focus {
  background-color: var(--bg-card);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(14, 58, 95, 0.08);
}

.filter-controls {
  display: flex;
  gap: 0.85rem;
}

.filter-select {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-select:hover, .filter-select:focus {
  border-color: var(--primary-color);
}

/* Data Table Structure */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  background-color: rgba(14, 58, 95, 0.02);
  padding: 1.15rem 1.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary-color);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-main);
}

.data-table tbody tr {
  transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
  background-color: rgba(14, 58, 95, 0.01);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Table Specific Cell Styles */
.emp-code-badge {
  font-weight: 700;
  background-color: var(--bg-main);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  color: var(--primary-color);
  font-size: 0.8rem;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.status-pill.verified { background-color: var(--status-active-bg); color: var(--status-active); }
.status-pill.pending { background-color: var(--status-warning-bg); color: var(--status-warning); }
.status-pill.missing { background-color: var(--status-danger-bg); color: var(--status-danger); }

/* Table Action Buttons */
.btn-action-icon {
  background: none;
  border: 1px solid var(--border-color);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--primary-color);
  transition: all 0.2s ease;
}

.btn-action-icon:hover {
  background-color: var(--primary-color);
  color: var(--text-white);
  border-color: var(--primary-color);
}

/* ─────────────────────────────────────────────────────────────
  VENDORS SYSTEM
───────────────────────────────────────────────────────────── */
.vendors-locations-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.location-banner {
  padding: 1.5rem;
  border-radius: 16px;
  color: var(--text-white);
  position: relative;
  overflow: hidden;
}

.location-banner.hyd {
  background: linear-gradient(135deg, var(--primary-color) 0%, #154570 100%);
  box-shadow: 0 4px 16px rgba(14, 58, 95, 0.2);
}

.location-banner.vzk {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #4D5E6B 100%);
  box-shadow: 0 4px 16px rgba(59, 74, 85, 0.2);
}

.location-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.location-title h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
}

.location-banner p {
  font-size: 0.85rem;
  opacity: 0.8;
}

.vendors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.vendor-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.vendor-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(14, 58, 95, 0.15);
}

.vendor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.vendor-badge-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.vendor-code {
  font-weight: 800;
  font-size: 0.9rem;
  background-color: rgba(14, 58, 95, 0.06);
  color: var(--primary-color);
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
}

.vendor-location-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.vendor-location-badge.vzk { background-color: rgba(59, 74, 85, 0.1); color: var(--secondary-color); }
.vendor-location-badge.hyd { background-color: rgba(14, 58, 95, 0.1); color: var(--primary-color); }

.vendor-title-block h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.5rem;
}

.vendor-title-block p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.vendor-stats-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.25rem 0;
  padding: 1rem;
  border-radius: 12px;
  background-color: var(--bg-main);
}

.vendor-stat-item span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.vendor-stat-item p {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.15rem;
}

.vendor-footer-details {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  margin-top: auto;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.vendor-footer-details span {
  display: flex;
  justify-content: space-between;
}

.vendor-footer-details strong {
  color: var(--text-main);
}

/* ─────────────────────────────────────────────────────────────
  ATTENDANCE HEATMAP GRID
───────────────────────────────────────────────────────────── */
.attendance-grid-container {
  padding: 1.5rem;
}

.attendance-grid-scroll {
  max-width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.attendance-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.attendance-table th, .attendance-table td {
  border-right: 1px solid rgba(14, 58, 95, 0.06);
  border-bottom: 1px solid rgba(14, 58, 95, 0.06);
  text-align: center;
}

.attendance-table th {
  background-color: rgba(14, 58, 95, 0.02);
  padding: 0.75rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-color);
}

.sticky-col-header {
  position: sticky;
  left: 0;
  background-color: #FFFFFF !important;
  z-index: 5;
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  text-align: left !important;
  padding: 0.85rem 1rem !important;
  box-shadow: 4px 0 8px rgba(14, 58, 95, 0.03);
  border-right: 2px solid var(--border-color) !important;
}

.attendance-row:hover td.sticky-col-header {
  background-color: var(--bg-main) !important;
}

.sticky-col-header p {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-col-header span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.day-cell {
  width: 32px;
  min-width: 32px;
  height: 42px;
  padding: 0 !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.day-cell:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  position: relative;
  z-index: 6;
}

/* Heatmap Shift Color Matrix */
.shift-general { background-color: #E0F2FE; color: #0369A1; } /* Light Blue */
.shift-1 { background-color: #CCFBF1; color: #0F766E; }       /* Teal */
.shift-2 { background-color: #FEE2E2; color: #B91C1C; }       /* Pink/Red */
.shift-3 { background-color: #F5E6FF; color: #701A75; }       /* Purple */
.shift-ot { background-color: #FEF3C7; color: #D97706; }      /* Amber/Yellow */
.shift-extra { background-color: #DBEAFE; color: #1D4ED8; }   /* Indigo Blue */
.shift-weekoff { background-color: #F1F5F9; color: #64748B; } /* Gray */
.shift-absent { background-color: #FFFFFF; color: #CBD5E1; }  /* Empty cell */

.day-cell-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.7rem;
  font-weight: 700;
}

.heatmap-legend-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.legend-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-color);
  text-transform: uppercase;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ─────────────────────────────────────────────────────────────
  INVOICES AGGREGATES BANNER
───────────────────────────────────────────────────────────── */
.invoices-aggregate-banner {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem 2rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2rem;
  box-shadow: var(--shadow-sm);
}

.aggregate-stat {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
}

.aggregate-stat:last-child {
  border-right: none;
}

.aggregate-stat span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.aggregate-stat h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.25rem;
}

.aggregate-stat.highlighted h3 {
  color: var(--accent-color);
}

/* ─────────────────────────────────────────────────────────────
  MODALS & SLIDE-OUT DRAWERS SYSTEM
───────────────────────────────────────────────────────────── */

/* Drawer Side Panel Overlay */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(10, 34, 64, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  background-color: var(--bg-card);
  box-shadow: -10px 0 40px rgba(10, 34, 64, 0.2);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 1px solid var(--border-color);
}

.drawer-overlay.active .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.75rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-title-block h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-color);
}

.drawer-title-block p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.drawer-badge {
  font-weight: 800;
  background-color: rgba(14, 58, 95, 0.06);
  color: var(--primary-color);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.drawer-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.drawer-close-btn:hover {
  background-color: var(--bg-main);
  color: var(--text-main);
}

.drawer-body {
  padding: 2rem;
  overflow-y: auto;
  flex-grow: 1;
}

.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background-color: var(--bg-main);
  padding: 0.35rem;
  border-radius: 10px;
}

.drawer-tab-btn {
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.65rem 0.5rem;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.drawer-tab-btn.active {
  background-color: var(--bg-card);
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.drawer-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.drawer-tab-content.active {
  display: block;
}

/* Inner Drawer Profile Details Cards */
.drawer-section-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card-header-with-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-header-with-status h4 {
  margin-bottom: 0 !important;
}

.drawer-section-card h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.drawer-section-card h4 i {
  width: 18px;
  height: 18px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.info-item span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.info-item p {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 0.15rem;
}

/* Wage breakdown structures */
.wage-summary-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.wage-stat-pill {
  flex-grow: 1;
  background-color: var(--bg-main);
  padding: 0.85rem 1rem;
  border-radius: 10px;
}

.wage-stat-pill span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.wage-stat-pill p {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-top: 0.15rem;
}

.wage-table-wrapper {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

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

.wage-breakdown-table th {
  background-color: var(--bg-main);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.65rem 1rem;
  text-align: left;
}

.wage-breakdown-table td {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  border-top: 1px solid var(--border-color);
}

.wage-breakdown-table tbody tr:first-child td {
  border-top: none;
}

.text-right { text-align: right !important; }

/* Calendar view inner drawer */
.attendance-summary-banner {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  background-color: var(--bg-main);
  padding: 0.75rem;
  border-radius: 10px;
}

.attendance-summary-banner .summary-pill {
  flex-grow: 1;
  text-align: center;
}

.attendance-summary-banner .summary-pill span {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
}

.attendance-summary-banner .summary-pill p {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.1rem;
}

.drawer-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}

.drawer-cal-day {
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background-color: var(--bg-main);
  transition: all 0.2s ease;
  position: relative;
}

.drawer-cal-day:hover {
  transform: scale(1.1);
  z-index: 5;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.drawer-cal-day.empty {
  visibility: hidden;
}

.drawer-cal-label {
  font-size: 0.75rem;
}

.drawer-cal-shift {
  font-size: 0.65rem;
  opacity: 0.8;
  margin-top: 0.1rem;
}

/* Modals System Overlays */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(10, 34, 64, 0.5);
  backdrop-filter: blur(5px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 2rem 0;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(10, 34, 64, 0.25);
  display: flex;
  flex-direction: column;
  width: 90%;
  max-width: 800px;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  max-height: 90vh;
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 2rem;
  background-color: var(--bg-main);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.modal-close-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

/* Button Classes */
.btn {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid transparent;
}

.btn i {
  width: 16px;
  height: 16px;
}

.btn-secondary {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  color: var(--primary-color);
}

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

/* ─────────────────────────────────────────────────────────────
  INTERACTIVE REALISTIC PAYSLIP STUB VISUALIZER (PRINT OPTIMIZED)
───────────────────────────────────────────────────────────── */
.payslip-document {
  padding: 2.5rem;
  color: #000000;
  background-color: #FFFFFF;
  overflow-y: auto;
}

.payslip-logo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #1A1F2A;
  padding-bottom: 1.25rem;
}

.payslip-logo-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0A2240;
}

.payslip-logo-header .payslip-meta-period {
  text-align: right;
}

.payslip-meta-period h2 {
  font-size: 1rem;
  font-weight: 700;
}

.payslip-meta-period span {
  font-size: 0.8rem;
  color: #4A5568;
}

.payslip-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin: 1.5rem 0;
  font-size: 0.85rem;
}

.payslip-details-col p {
  display: grid;
  grid-template-columns: 140px 14px 1fr;
  margin-bottom: 0.35rem;
}

.payslip-details-col p strong {
  color: #4A5568;
  font-weight: 500;
}

.payslip-table-wrapper {
  margin-top: 1.5rem;
}

.payslip-main-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #CBD5E1;
  font-size: 0.85rem;
}

.payslip-main-table th {
  background-color: #F1F5F9;
  border: 1px solid #CBD5E1;
  padding: 0.65rem 1rem;
  font-weight: 700;
  text-align: left;
}

.payslip-main-table td {
  border: 1px solid #CBD5E1;
  padding: 0.65rem 1rem;
}

.payslip-total-row {
  font-weight: 700;
  background-color: #F8FAFC;
}

.payslip-net-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 2px solid #0A2240;
  background-color: #F8FAFC;
  padding: 1.25rem;
  margin-top: 1.5rem;
  border-radius: 8px;
}

.payslip-net-box h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0A2240;
}

.payslip-employer-contrib-block {
  border-top: 1px dashed #CBD5E1;
  margin-top: 1.5rem;
  padding-top: 1rem;
}

.payslip-employer-contrib-block h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #4A5568;
  margin-bottom: 0.5rem;
}

/* ─────────────────────────────────────────────────────────────
  INTERACTIVE COMMERCIAL TAX INVOICE VISUALIZER (PRINT OPTIMIZED)
───────────────────────────────────────────────────────────── */
.invoice-document {
  padding: 3rem;
  color: #000000;
  background-color: #FFFFFF;
  overflow-y: auto;
}

.invoice-headline-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0A2240;
  text-transform: uppercase;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  letter-spacing: 1px;
}

.invoice-biller-receiver-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3rem;
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.invoice-biller-receiver-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0A2240;
  margin-bottom: 0.65rem;
  text-transform: uppercase;
  border-bottom: 2px solid #CBD5E1;
  padding-bottom: 0.25rem;
}

.invoice-biller-receiver-col p {
  line-height: 1.6;
  margin-bottom: 0.25rem;
}

.invoice-details-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  border: 1px solid #CBD5E1;
  background-color: #F8FAFC;
  padding: 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.invoice-detail-stat span {
  font-size: 0.75rem;
  color: #4A5568;
  display: block;
}

.invoice-detail-stat p {
  font-weight: 700;
  color: #000000;
  margin-top: 0.15rem;
}

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #CBD5E1;
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.invoice-items-table th {
  background-color: #F1F5F9;
  border: 1px solid #CBD5E1;
  padding: 0.75rem 1rem;
  font-weight: 700;
  text-align: left;
}

.invoice-items-table td {
  border: 1px solid #CBD5E1;
  padding: 0.75rem 1rem;
}

.invoice-summary-right-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.invoice-summary-row {
  display: flex;
  justify-content: space-between;
  width: 320px;
  padding: 0.45rem 0;
  border-bottom: 1px solid #CBD5E1;
}

.invoice-summary-row.grand-total {
  border-top: 2px solid #000000;
  border-bottom: 2px solid #000000;
  font-weight: 700;
  font-size: 1.05rem;
  color: #0A2240;
}

.invoice-words-box {
  border: 1px dashed #CBD5E1;
  padding: 1rem;
  background-color: #F8FAFC;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.invoice-words-box strong {
  display: block;
  font-size: 0.75rem;
  color: #4A5568;
}

.invoice-bank-sign-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 3rem;
  font-size: 0.8rem;
  border-top: 1px solid #CBD5E1;
  padding-top: 1.5rem;
}

.invoice-bank-sign-col p {
  line-height: 1.6;
  margin-bottom: 0.25rem;
}

.invoice-authorized-block {
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 120px;
}

/* ─────────────────────────────────────────────────────────────
  PRINT MEDIA STYLING (Hides Dashboard shell during prints)
───────────────────────────────────────────────────────────── */
@media print {
  body {
    background-color: #FFFFFF;
    color: #000000;
    font-size: 12pt;
  }
  
  .app-container {
    display: block;
  }
  
  .app-sidebar, .main-header, .tab-panels, .no-print, .drawer-overlay, .modal-header {
    display: none !important;
  }

  .app-main {
    padding: 0;
    background: none;
    max-height: none;
    overflow-y: visible;
  }

  .modal-overlay {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    background: none;
    backdrop-filter: none;
    display: block;
    opacity: 1;
    pointer-events: auto;
    padding: 0;
    z-index: auto;
  }

  .modal-card {
    box-shadow: none;
    border-radius: 0;
    width: 100%;
    max-width: none;
    transform: none;
    max-height: none;
    overflow: visible;
  }

  .payslip-document {
    padding: 0;
    border: none;
  }

  .invoice-document {
    padding: 0;
    border: none;
  }
}

/* ─────────────────────────────────────────────────────────────
  PREMIUM LOADING OVERLAY
───────────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(10, 34, 64, 0.45);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.loader-content {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 20px 40px rgba(10, 34, 64, 0.15);
  padding: 2.5rem 3.5rem;
  border-radius: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 90%;
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loader-text {
  font-family: 'Outfit', var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary-color) !important;
  margin: 0;
}

/* Spinner Animation */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(14, 58, 95, 0.1);
  border-left-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

@keyframes scaleUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   📱 MOBILE & TABLET RESPONSIVE DECK (max-width: 991px)
   ========================================================================== */
@media (max-width: 991px) {
  /* 1. App Layout */
  .app-container {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative;
  }

  .app-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px !important;
    z-index: 1000 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  .app-sidebar.mobile-active {
    transform: translateX(0) !important;
  }

  /* Dark Overlay when mobile sidebar is active */
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(10, 34, 64, 0.4);
    backdrop-filter: blur(4px);
    z-index: 950;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .app-main {
    padding: 1.5rem 1rem !important;
    max-height: none !important;
    overflow-y: visible !important;
  }

  /* 2. Top Header */
  .main-header {
    margin-bottom: 1.5rem !important;
    padding-bottom: 1rem !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: sticky !important;
    top: 0;
    background-color: var(--bg-main) !important;
    z-index: 100 !important;
    padding-top: 0.5rem !important;
    border-bottom: 1px solid var(--border-color);
  }

  .header-title {
    flex-grow: 1;
  }

  .header-title h2 {
    font-size: 1.35rem !important;
    margin-bottom: 0.2rem !important;
  }

  .header-title p {
    font-size: 0.75rem !important;
  }

  /* Hamburger menu toggle button */
  .menu-toggle-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    cursor: pointer;
    margin-right: 0.75rem;
    transition: all 0.2s ease;
  }

  .menu-toggle-btn:hover {
    background-color: var(--primary-color);
    color: var(--text-white);
  }

  /* 3. Executive Dashboard Grid and Cards */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .executive-charts-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .chart-card {
    padding: 1.25rem !important;
  }

  /* 4. Directory filters */
  .directory-search-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
    padding: 1rem !important;
  }

  .search-input-wrapper {
    max-width: none !important;
  }

  .filter-controls {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.5rem !important;
  }

  .filter-select {
    padding: 0.65rem 0.5rem !important;
    font-size: 0.75rem !important;
  }

  /* 5. Invoices Aggregate Banner */
  .invoices-aggregate-banner {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.25rem !important;
    padding: 1.25rem 1.5rem !important;
  }

  .aggregate-stat {
    border-right: none !important;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem !important;
  }

  .aggregate-stat:nth-child(2n), .aggregate-stat:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }

  /* 6. Vendors Locations Banner */
  .vendors-locations-summary {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* 7. Slide-out drawer */
  .drawer-panel {
    width: 100% !important;
    max-width: 100% !important;
  }

  .drawer-body {
    padding: 1.25rem !important;
  }

  /* 8. Printable documents (Payslips and Invoices in Modal) */
  .payslip-document {
    padding: 1.25rem !important;
  }

  .invoice-document {
    padding: 1.25rem !important;
  }

  .payslip-details-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .invoice-details-block {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .invoice-summary-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .invoice-totals-wrapper {
    width: 100% !important;
  }
}

@media (max-width: 576px) {
  /* 9. Further refinement for extra small mobile */
  .filter-controls {
    grid-template-columns: 1fr !important;
  }

  .invoices-aggregate-banner {
    grid-template-columns: 1fr !important;
  }

  .aggregate-stat {
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding-bottom: 0.75rem !important;
  }

  .aggregate-stat:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }

  .drawer-calendar-grid {
    gap: 0.25rem !important;
  }

  .drawer-cal-day {
    font-size: 0.65rem !important;
  }

  .day-label {
    font-size: 0.55rem !important;
  }
}

/* ═════════════════════════════════════════════════════════════════
   PHASE 1 — CRUD: buttons, form modal, toast, assignments
   ═════════════════════════════════════════════════════════════════ */
.btn-primary {
  background-color: var(--accent-color, #F26B1F);
  border-color: var(--accent-color, #F26B1F);
  color: #fff;
}
.btn-primary:hover { filter: brightness(0.94); }
.btn-danger {
  background-color: #fff;
  border-color: #ef4444;
  color: #ef4444;
}
.btn-danger:hover { background-color: #ef4444; color: #fff; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; }

.drawer-header-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Add-employee button sits to the right of the filter toolbar */
.toolbar-card { flex-wrap: wrap; }
#add-employee-btn { margin-left: auto; white-space: nowrap; }

/* Form modal */
.form-card { max-width: 720px; width: 92%; max-height: 90vh; overflow-y: auto; }
.form-card-sm { max-width: 460px; }
.crud-form { padding: 1.5rem; }
.crud-form .form-section {
  margin: 1.4rem 0 0.6rem; font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted, #64748b); border-bottom: 1px solid var(--border-color); padding-bottom: 0.4rem;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1.1rem; }
.crud-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; font-weight: 600; color: var(--primary-color, #0e3a5f); }
.crud-form label.full { grid-column: 1 / -1; }
.crud-form input, .crud-form select, .crud-form textarea {
  font-family: var(--font-main); font-size: 0.9rem; padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-color); border-radius: 8px; background: #fff; color: var(--text-dark, #1e293b);
}
.crud-form input:focus, .crud-form select:focus, .crud-form textarea:focus {
  outline: none; border-color: var(--accent-color, #F26B1F); box-shadow: 0 0 0 3px rgba(242,107,31,0.12);
}
.crud-form .req { color: #ef4444; }
.crud-form .checkbox-label { flex-direction: row; align-items: center; gap: 0.5rem; }
.crud-form .checkbox-label input { width: auto; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; }
.form-error { color: #ef4444; font-size: 0.82rem; margin-top: 0.9rem; min-height: 1em; }

/* Assignment rows in the drawer */
.assignment-row {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border-color); font-size: 0.85rem;
}
.assignment-row:last-child { border-bottom: none; }
.assignment-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.muted { color: var(--text-muted, #64748b); font-size: 0.8rem; }

/* Toast */
.app-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #0e3a5f; color: #fff; padding: 0.8rem 1.4rem; border-radius: 10px;
  font-size: 0.88rem; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  opacity: 0; pointer-events: none; transition: all 0.3s ease; z-index: 3000;
}
.app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.app-toast.toast-error { background: #ef4444; }

@media (max-width: 576px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* Button spinner + success popup */
.btn-spinner {
  width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff; border-radius: 50%; display: inline-block;
  animation: btnspin 0.6s linear infinite; vertical-align: -2px;
}
@keyframes btnspin { to { transform: rotate(360deg); } }
.btn-loading { cursor: progress; }

.success-popup { max-width: 380px; width: 90%; text-align: center; padding: 2.25rem 2rem; }
.success-popup .success-icon i { width: 60px; height: 60px; color: #10B981; stroke-width: 1.75; }
.success-popup h3 { margin: 0.85rem 0 0.45rem; color: var(--primary-color, #0e3a5f); }
.success-popup p { color: var(--text-muted, #64748b); margin: 0 0 1.6rem; font-size: 0.92rem; }
.success-popup .btn-primary { min-width: 120px; justify-content: center; }

/* Lucide swaps <i> for <svg> — size/color the svg and let it inherit currentColor */
.success-popup .success-icon { color: #10B981; line-height: 0; }
.success-popup .success-icon svg { width: 60px; height: 60px; stroke-width: 1.75; }

/* Vendors & Contracts CRUD */
.tab-action-row { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.vendor-actions {
  display: flex; gap: 0.5rem; margin-top: 1rem; padding-top: 0.9rem;
  border-top: 1px solid var(--border-color); flex-wrap: wrap;
}
.vendor-actions .btn { flex: 1; justify-content: center; min-width: 90px; }
.vendor-inactive { opacity: 0.6; }
.vendor-inactive .vendor-actions { opacity: 1; }

/* Fix: keep the required asterisk inline with the label text (label was a flex
   column, which forced the text, the * span, and the input onto separate rows). */
.crud-form label { display: block; }
.crud-form label:not(.checkbox-label) > input,
.crud-form label:not(.checkbox-label) > select,
.crud-form label:not(.checkbox-label) > textarea {
  display: block; width: 100%; margin-top: 0.3rem; box-sizing: border-box;
}
.crud-form .checkbox-label { display: flex; flex-direction: row; align-items: center; gap: 0.5rem; margin-top: 0.2rem; }
.crud-form .checkbox-label > input { width: auto; margin-top: 0; }

/* Monthly adjustments editor */
.adj-controls { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.adj-controls label { flex: 1; }
#adjustments-table th, #adjustments-table td { padding: 0.5rem 0.6rem; font-size: 0.84rem; vertical-align: middle; }
.adj-input {
  width: 100%; padding: 0.4rem 0.5rem; border: 1px solid var(--border-color);
  border-radius: 6px; font-family: var(--font-main); font-size: 0.85rem; box-sizing: border-box;
}
.adj-input:focus { outline: none; border-color: var(--accent-color, #F26B1F); box-shadow: 0 0 0 2px rgba(242,107,31,0.12); }
#adjustments-table td:nth-child(n+3):nth-child(-n+6) { width: 100px; }
.adj-notes { min-width: 120px; }
.adj-save { color: var(--accent-color, #F26B1F); }
tr.adj-saved { background: rgba(16,185,129,0.12); transition: background 0.3s; }

/* Attendance day editor */
.de-status-group { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.de-status-opt {
  display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.8rem;
  border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; color: var(--primary-color, #0e3a5f);
}
.de-status-opt input { margin: 0; width: auto; }
.de-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.de-slot {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; font-weight: 700;
}
.de-slot input { width: auto; margin: 0; }
.de-slot span { color: var(--text-muted, #64748b); font-weight: 400; font-size: 0.78rem; margin-left: auto; }
/* keep slot/status toggles as normal inline controls (not full-width inputs) */
.crud-form .de-slot > input, .crud-form .de-status-opt > input { display: inline-block; width: auto; margin: 0; }

/* Invoice generation + status */
.ig-line { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; }
.ig-line .ig-desc { flex: 1; }
.ig-line .ig-amt { width: 140px; }
.ig-line input { padding: 0.5rem 0.6rem; border: 1px solid var(--border-color); border-radius: 6px; font-size: 0.88rem; box-sizing: border-box; }
.inv-status-select {
  padding: 0.3rem 0.5rem; border: 1px solid var(--border-color); border-radius: 6px;
  font-size: 0.76rem; font-weight: 700; text-transform: capitalize; cursor: pointer; background: #fff;
}
.inv-status-select.status-paid { color: #10B981; border-color: #10B981; }
.inv-status-select.status-sent { color: #2563eb; border-color: #2563eb; }
.inv-status-select.status-cancelled { color: #ef4444; border-color: #ef4444; }

/* ── Print / Save-as-PDF: only the open document modal, clean A4 ── */
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; }

  /* show ONLY the modal that's open (was printing every hidden modal) */
  .modal-overlay:not(.active) { display: none !important; }
  .modal-overlay.active { position: static !important; height: auto !important; }

  /* hide transient chrome */
  #app-toast, .loading-overlay, .sidebar-overlay, #sidebar-overlay { display: none !important; }

  /* the document fills the page */
  .modal-card { width: 100% !important; max-width: none !important; margin: 0 auto !important; box-shadow: none !important; }
  .payslip-document, .invoice-document { width: 100%; }

  /* avoid awkward page breaks inside table rows */
  tr, .payslip-document table, .invoice-document table { page-break-inside: avoid; }
}
@media print { .app-container { display: none !important; } }
@media print {
  /* keep the payslip identity grid two-up (a responsive rule collapses it to
     one column at narrow widths, and the A4 print width triggers that) */
  .payslip-details-grid { grid-template-columns: 1fr 1fr !important; gap: 1.25rem !important; }
}
@media print {
  /* keep the payslip header title from colliding with the period block at A4 width */
  .payslip-logo-header { gap: 1.5rem; }
  .payslip-logo-header h1 { font-size: 1.2rem !important; line-height: 1.25; }
  .payslip-meta-period { flex-shrink: 0; white-space: nowrap; }
}

/* GST challan (draft) document */
.challan-print-card { max-width: 820px; width: 92%; }
.challan-document { padding: 2rem 2.25rem; }
.challan-title { text-align: center; margin-bottom: 0.75rem; }
.challan-title h2 { margin: 0; font-size: 1.2rem; letter-spacing: 1px; color: #0A2240; }
.challan-title p { margin: 2px 0 0; font-size: 0.95rem; font-weight: 700; color: #4A5568; }
.challan-note { font-size: 0.78rem; color: #4A5568; background: #F8FAFC; border: 1px solid #E2E8F0; padding: 0.5rem 0.75rem; border-radius: 6px; margin-bottom: 1rem; }
.challan-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.challan-table td, .challan-table th { border: 1px solid #333; padding: 6px 9px; vertical-align: middle; }
.challan-table td span { display: block; font-size: 0.68rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.4px; }
.challan-table .ch-section { background: #eef2f7; font-weight: 700; }
.challan-table .ch-head th { background: #eef4fa; font-weight: 700; text-align: center; }
.challan-table .ch-r { text-align: right; }
.challan-table .ch-gov { font-weight: 600; vertical-align: top; }
.challan-table .ch-subtotal { background: #fafafa; font-weight: 600; }
.challan-table .ch-grandtotal td { font-weight: 700; background: #eef4fa; text-align: right; }
.challan-table .ch-grandtotal td:first-child { text-align: right; }
.challan-table .ch-words td { font-weight: 600; }
.challan-foot { font-size: 0.72rem; color: #94a3b8; margin-top: 1rem; text-align: center; }

/* Button spacing on tab action rows */
.tab-action-row { gap: 0.75rem; }

/* Consolidated bill summary doc + bill-number FY tag */
.bill-fy-tag { font-size: 0.68rem; color: #94a3b8; margin-top: 1px; }
.billsummary-print-card { max-width: 880px; width: 94%; }
.billsummary-document { padding: 1.75rem 2rem; }
.bs-title { text-align: center; margin-bottom: 0.75rem; }
.bs-title h2 { margin: 0; font-size: 1.1rem; letter-spacing: 0.5px; color: #0A2240; }
.bs-title p { margin: 2px 0 0; font-size: 0.8rem; color: #4A5568; }
.bs-meta { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; font-size: 0.8rem; margin-bottom: 0.75rem; color: #334155; }
.bs-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.bs-table th, .bs-table td { border: 1px solid #cbd5e1; padding: 5px 9px; }
.bs-table thead th { background: #eef4fa; text-align: left; }
.bs-table .r { text-align: right; }
.bs-table .bs-total td { font-weight: 700; background: #f1f5f9; }
.bs-foot { font-size: 0.78rem; color: #475569; margin-top: 0.9rem; padding-top: 0.6rem; border-top: 1px solid #e2e8f0; }

/* Adjustments: red = deducted (advance/others), green = added (extra/transport) */
#adjustments-table th.adj-deduct { color: #c0392b; }
#adjustments-table th.adj-add { color: #15803d; }
.adj-input.adv, .adj-input.others { color: #c0392b; font-weight: 600; }
.adj-input.extra, .adj-input.transport { color: #15803d; font-weight: 600; }
