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

:root {
  /* --- V2 Design System (Synced with Home Page) --- */

  /* Fonts */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Color Palette - Deep Premium Dark Blue Base (Default) */
  --color-bg: #030712;
  --color-surface: rgba(17, 24, 39, 0.7);
  --color-surface-hover: rgba(31, 41, 55, 0.8);

  --color-primary: #3b82f6;
  --color-secondary: #8b5cf6;
  --color-accent: #06b6d4;

  --color-text-main: #f9fafb;
  --color-text-muted: #9ca3af;
  --color-border: rgba(255, 255, 255, 0.1);
  --color-border-hover: rgba(255, 255, 255, 0.2);

  /* Gradients */
  --gradient-mesh: radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);

  --gradient-text: linear-gradient(135deg, #ffffff 0%, #60a5fa 100%);
  --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

  /* Effects */
  --glass-blur: blur(20px);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.15);

  --radius-lg: 1.5rem;
  --radius-full: 9999px;

  /* Admin Specific Extras (Mapped or New) */
  --primary-light: #60a5fa;
  --glow-color: rgba(59, 130, 246, 0.15);
  --header-bg: rgba(17, 24, 39, 0.85);
  --card-header-bg: rgba(59, 130, 246, 0.1);
}

/* Light Mode Override */
body.light-mode {
  --color-bg: #f8fafc;
  --color-surface: rgba(255, 255, 255, 0.8);
  --color-surface-hover: rgba(255, 255, 255, 0.95);
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-border: rgba(0, 0, 0, 0.08);

  --gradient-mesh: radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.05) 0px, transparent 50%);

  --gradient-text: linear-gradient(135deg, #0f172a 0%, #3b82f6 100%);

  --header-bg: rgba(255, 255, 255, 0.85);
  --card-header-bg: #e0f2fe;

  /* Fix for table headers and other elements using primary-light */
  --primary-light: #2563eb;
  /* Darker blue for visibility on light backgrounds */
  --glow-color: rgba(59, 130, 246, 0.2);
}


/* Tiny Delete Button (Cross Icon) */
.btn-icon-delete {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Default (Dark Mode - Modern Glass) */
  background-color: rgba(239, 68, 68, 0.15);
  /* Red */
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  /* Red-300 */
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon-delete:hover {
  background-color: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.15);
}

.btn-icon-delete:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Light Mode Override */
body.light-mode .btn-icon-delete {
  background-color: #fff1f2;
  /* Rose-50 */
  border-color: #fecdd3;
  /* Rose-200 */
  color: #e11d48;
  /* Rose-600 */
}

body.light-mode .btn-icon-delete:hover {
  background-color: #ffe4e6;
  /* Rose-100 */
  border-color: #fda4af;
  /* Rose-300 */
}

/* Tiny Edit Button (Pencil Icon) */
.btn-icon-edit {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Default (Dark Mode - Modern Glass) */
  background-color: rgba(14, 165, 233, 0.15);
  /* Sky */
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #7dd3fc;
  /* Sky-300 */
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-right: 5px;
}

.btn-icon-edit:hover {
  background-color: rgba(14, 165, 233, 0.25);
  border-color: rgba(14, 165, 233, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(2, 132, 199, 0.15);
}

.btn-icon-edit:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Light Mode Override */
body.light-mode .btn-icon-edit {
  background-color: #f0f9ff;
  /* Sky-50 */
  border-color: #bae6fd;
  /* Sky-200 */
  color: #0284c7;
  /* Sky-600 */
}

body.light-mode .btn-icon-edit:hover {
  background-color: #e0f2fe;
  /* Sky-100 */
  border-color: #7dd3fc;
  /* Sky-300 */
}

/* Tiny Preview Button (Eye Icon) */
.btn-icon-preview {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Default (Dark Mode - Modern Glass) */
  background-color: rgba(99, 102, 241, 0.15);
  /* Indigo */
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  /* Indigo-300 */
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-right: 5px;
  text-decoration: none;
}

.btn-icon-preview:hover {
  background-color: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.15);
}

.btn-icon-preview:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Light Mode Override */
body.light-mode .btn-icon-preview {
  background-color: #eef2ff;
  /* Indigo-50 */
  border-color: #c7d2fe;
  /* Indigo-200 */
  color: #4f46e5;
  /* Indigo-600 */
}

body.light-mode .btn-icon-preview:hover {
  background-color: #e0e7ff;
  /* Indigo-100 */
  border-color: #a5b4fc;
  /* Indigo-300 */
}

/* Tiny Download Button (Arrow Icon) */
.btn-icon-download {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Default (Dark Mode - Modern Glass) */
  background-color: rgba(34, 197, 94, 0.15);
  /* Green */
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
  /* Green-300 */
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-right: 5px;
  text-decoration: none;
}

.btn-icon-download:hover {
  background-color: rgba(34, 197, 94, 0.25);
  border-color: rgba(34, 197, 94, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(22, 163, 74, 0.15);
}

.btn-icon-download:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Light Mode Override */
body.light-mode .btn-icon-download {
  background-color: #f0fdf4;
  /* Green-50 */
  border-color: #bbf7d0;
  /* Green-200 */
  color: #16a34a;
  /* Green-600 */
}

body.light-mode .btn-icon-download:hover {
  background-color: #dcfce7;
  /* Green-100 */
  border-color: #86efac;
  /* Green-300 */
}

.btn-icon-preview.disabled,
.btn-icon-download.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
  filter: grayscale(100%);
}


html,
body {
  margin: 0 !important;
  padding: 0 !important;
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Global Background: Blue-Black Gradient */
body {
  box-sizing: border-box;
  /* Ensure body uses border-box */
  font-family: var(--font-body);
  background-color: #020617;
  /* Moved gradient to right side (85% 15%) - Adjusted intensity to 0.25 (Intermediate) */
  background-image: radial-gradient(circle at 85% 15%, rgba(30, 58, 138, 0.4) 0%, #020617 80%);
  background-attachment: fixed;
  color: var(--color-text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

/* Universal Box Sizing Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Scale Adjustment: Reset scale to feel like 100% (from perceived 120%) */
html {
  font-size: 14px;
  /* Scaling down from default 16px */
}

/* Header */
.admin-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  margin: 0;
  z-index: 1000;
  box-sizing: border-box;
  /* Reduced right-side blue intensity from 0.4 to 0.1 */
  background: linear-gradient(90deg, rgba(2, 6, 23, 0.95) 0%, rgba(14, 165, 233, 0.25) 100%);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--color-text-main);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.5);
  transition: background-color 0.3s ease;
}

.admin-header h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.8rem;
  /* Bigger Text */
  font-weight: 800;
  /* Bolder */
  letter-spacing: 0.05em;
  margin: 0;
  opacity: 1;
  text-transform: uppercase;
  line-height: 1.2;
  margin-top: -2px;
  /* Fine-tune optical center */
}

.admin-header h1 a {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  height: 32px;
  /* Slightly larger logo to match text */
  width: 32px;
  filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.6));
}

.brand-blue {
  color: #60a5fa;
  text-shadow: 0 0 20px rgba(96, 165, 250, 0.6), 0 0 10px rgba(96, 165, 250, 0.4);
  /* Blue Glow */
}

.brand-red {
  color: #ef4444;
  font-weight: 400;
  opacity: 1;
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.6), 0 0 10px rgba(239, 68, 68, 0.4);
  /* Red Glow */
}

.admin-header a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
  margin-left: 1.5rem;
}

.admin-header a:hover {
  color: var(--color-text-main);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn {
  margin-right: 12px;
  background: transparent;
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-primary);
}

/* Dashboard Container */
.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding-top: 100px;
  /* 64px Header + Space */
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  width: 96%;
  /* Default width */
}

/* Stats Grid */
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--color-surface);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  flex: 1 1 250px;
}

.stat-box {
  flex: 1 1 200px;
  text-align: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--color-border);
  min-width: 150px;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-light);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 5px;
  display: block;
}

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

/* Buttons */
.btn-primary {
  background-color: var(--color-primary);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  background-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-success {
  background-color: #10b981;
  color: white;
}

.btn-success:hover {
  background-color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text-main);
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.1;
  margin-bottom: 0.25rem;
  display: block;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Forms */
input,
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--color-text-main);
  background-color: rgba(255, 255, 255, 0.03);
  /* Glassy input */
  transition: all 0.2s ease;
  box-sizing: border-box;
  margin-bottom: 1rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--glow-color);
  background-color: rgba(255, 255, 255, 0.08);
}

input:read-only,
input:disabled {
  background-color: rgba(0, 0, 0, 0.2);
  cursor: not-allowed;
  color: var(--color-text-muted);
}

.form-label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--color-text-muted);
  font-size: 0.9em;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background-color: var(--color-primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  transform: scale(1);
}

button:hover {
  background-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--glow-color);
}

button:active {
  transform: scale(0.98);
}

button.danger {
  background-color: transparent;
  color: var(--color-secondary);
  border: 1px solid var(--color-border);
}

button.danger:hover {
  background-color: rgba(211, 47, 47, 0.1);
  color: #b71c1c;
}

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  /* Changed to separate for spacing if needed, but keeping standard */
  border-spacing: 0;
  margin: 0;
}

th {
  text-align: left;
  padding: 1rem;
  background-color: rgba(59, 130, 246, 0.15);
  /* Blue tint header */
  color: var(--primary-light);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-main);
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

tr:hover td {
  background-color: var(--color-surface-hover);
}

/* Light Mode: Remove visible borders between rows */
body.light-mode td {
  border-bottom: 1px solid rgba(226, 232, 240, 0.3);
  /* Very subtle border */
  border-left: none;
  /* Remove vertical borders */
  border-right: none;
  /* Remove vertical borders */
  background-color: #ffffff;
  /* Explicit white background for all cells */
}

body.light-mode th {
  border-left: none;
  /* Remove vertical borders from headers too */
  border-right: none;
}

/* Light Mode: Hover state for non-merged rows - keep white */
body.light-mode tr:hover td {
  background-color: #f8fafc;
  /* Very subtle gray on hover */
}

/* Merged Row Indicator - Green tint only for rows with checked checkboxes */
tr:has(input.bill-checkbox:checked) td {
  background-color: rgba(16, 185, 129, 0.08);
  /* Subtle green tint for dark mode */
}

body.light-mode tr:has(input.bill-checkbox:checked) td {
  background-color: rgba(16, 185, 129, 0.06) !important;
  /* Subtle green tint for light mode - use !important to override white */
}

/* Hover state for merged rows */
tr:has(input.bill-checkbox:checked):hover td {
  background-color: rgba(16, 185, 129, 0.12);
  /* Slightly stronger on hover */
}

body.light-mode tr:has(input.bill-checkbox:checked):hover td {
  background-color: rgba(16, 185, 129, 0.10) !important;
  /* Slightly stronger on hover in light mode */
}

/* Table Separate Rows (Record Registry style) */
.table-separate-rows {
  border-spacing: 0 4px;
}

.table-separate-rows thead tr th {
  padding: 8px;
  font-size: 0.75rem;
}

.table-separate-rows tbody tr {
  background-color: var(--color-surface);
  transition: background 0.2s;
}

.table-separate-rows tbody tr:hover {
  background-color: var(--color-surface-hover);
  transform: translateY(-1px);
}

.table-separate-rows td {
  padding: 8px 6px;
  vertical-align: top;
  font-size: 0.8rem;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
}

.table-separate-rows tbody tr td:first-child {
  border-left: 1px solid var(--color-border);
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.table-separate-rows tbody tr td:last-child {
  border-right: 1px solid var(--color-border);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.dense-cell {
  font-size: 0.8em;
  line-height: 1.4;
}

.cell-line {
  display: block;
  margin-bottom: 2px;
}

/* Light Mode Override for Table Headers */
body.light-mode th {
  background-color: rgba(59, 130, 246, 0.08);
}

/* Table Cell Text Color Classes (for JS-generated content) */
.text-primary-light {
  color: #60a5fa;
  /* Light blue for dark mode */
}

.text-muted-gray {
  color: #94a3b8;
  /* Light gray for dark mode */
}

.text-light-gray {
  color: #e2e8f0;
  /* Very light gray for dark mode */
}

/* Light Mode Overrides for Table Text */
body.light-mode .text-primary-light {
  color: #2563eb;
  /* Darker blue for light mode */
}

body.light-mode .text-muted-gray {
  color: #64748b;
  /* Darker gray for light mode */
}

body.light-mode .text-light-gray {
  color: #334155;
  /* Dark gray for light mode */
}

/* Badge Styles (for Job Movement and similar pages) */
.badge-done {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  background: #065f46;
  /* Dark green background for dark mode */
  color: #6ee7b7;
  /* Light green text for dark mode */
}

.badge-pending {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  background: #7f1d1d;
  /* Dark red background for dark mode */
  color: #fca5a5;
  /* Light red text for dark mode */
}

/* Light Mode Overrides for Badges */
body.light-mode .badge-done {
  background: #d1fae5;
  /* Light green background for light mode */
  color: #065f46;
  /* Dark green text for light mode */
}

body.light-mode .badge-pending {
  background: #fee2e2;
  /* Light red background for light mode */
  color: #991b1b;
  /* Dark red text for light mode */
}

/* Navigation Tabs */
.nav-grid {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: none;
  padding-bottom: 0;
  flex-wrap: wrap;
}

.nav-item {
  background: transparent;
  padding: 0.75rem 2rem;
  /* Wider Pill */
  color: #94a3b8;
  /* Slate-400 */
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 9999px;
  /* Full Pill Shape */
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: #f8fafc;
  background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  background-color: #3b82f6;
  /* Bright Blue */
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

/* Light Mode Override for Navigation */
body.light-mode .nav-item {
  color: #64748b;
  /* Darker gray for light mode visibility */
}

body.light-mode .nav-item:hover {
  color: #0f172a;
  /* Dark text on hover */
  background-color: rgba(59, 130, 246, 0.05);
}

/* Dark mode override for active nav text if needed, but white usually works on primary color */

/* Cards */
/* Cards */
.card {
  background: rgba(15, 23, 42, 0.6);
  /* Darker Slate Glass */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: #06b6d4;
  /* Bright Cyan Accent */
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.25), 0 10px 30px -5px rgba(0, 0, 0, 0.3);
  /* Subtle Cyan Glow */
  transform: translateY(-2px);
}

.card h3,
.stat-card h3 {
  margin: 0 0 1.5rem 0;
  padding: 1.25rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #f1f5f9;
  /* White Text */
  width: 100%;
  box-sizing: border-box;

  /* Dark Header Strip with Left Glow Gradient */
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.15) 0%, rgba(15, 23, 42, 0.4) 100%);
  border-radius: 8px;

  /* Bright Blue Accent Border */
  border-left: 5px solid #0ea5e9;
  /* Sky Blue 500 */

  display: flex;
  align-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Light Mode Override for Card Headers */
body.light-mode .card h3,
body.light-mode .stat-card h3 {
  color: #0f172a;
  /* Dark text for light mode */
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, rgba(148, 163, 184, 0.05) 100%);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.05);
}

/* Removed legacy dark-mode override as default is now dark */
/* body.dark-mode .card h3 { ... } */

/* Grid System */
.grid {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.col-span-2 {
  grid-column: span 2;
}

.grid-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.grid-sidebar-layout {
  grid-template-columns: 350px 1fr;
}

/* Text Colors */
.text-success {
  color: #22c55e;
}

.text-danger {
  color: #ef4444;
}

.text-primary {
  color: var(--color-primary);
}

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

.text-green {
  color: #4ade80;
}

.font-bold {
  font-weight: bold;
}

.mt-2 {
  margin-top: 0.5rem;
}

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

.mb-0 {
  margin-bottom: 0 !important;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.text-center {
  text-align: center;
}

.hidden {
  display: none;
}

.text-sm {
  font-size: 0.85rem;
}

.text-xs {
  font-size: 0.75rem;
}

/* Layout Utilities */
.container-full {
  max-width: none;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

.w-full {
  width: 100%;
}

.h-fit {
  height: fit-content;
}

.min-w-1400 {
  min-width: 1400px;
}

.flex {
  display: flex;
}

.flex-1 {
  flex: 1;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: start;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-4 {
  gap: 1rem;
}

.divider {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 1rem 0;
}

.overflow-x-auto {
  overflow-x: auto;
}

.overflow-y-auto {
  overflow-y: auto;
}

.max-h-90vh {
  max-height: 90vh;
}

.bg-subtle {
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  border-radius: 4px;
}

.modal-content-lg {
  max-width: 800px;
}

/* Buttons */
.btn-danger {
  background-color: #ef4444;
  color: white;
  border: none;
}

.btn-danger:hover {
  background-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Badges */
.badge-pending {
  background-color: #7f1d1d;
  color: #fca5a5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8em;
  display: inline-block;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-done {
  background-color: #064e3b;
  color: #6ee7b7;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8em;
  display: inline-block;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Quick Notes Styling */
.notes-list {
  list-style: none;
  padding: 0;
  margin-top: 10px;
}

.notes-list li {
  background-color: #fff9c4;
  /* Light Yellow */
  color: #5d4037;
  /* Brown text */
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid #fbc02d;
  /* Darker yellow accent */
}

.notes-list li .delete-note {
  cursor: pointer;
  color: #d32f2f;
  font-weight: bold;
  padding: 0 5px;
  font-size: 1.2rem;
  line-height: 1;
}

.notes-list li .delete-note:hover {
  background-color: rgba(211, 47, 47, 0.1);
  border-radius: 4px;
}

/* --- MODAL STYLES --- */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: var(--color-surface);
  padding: 24px;
  border-radius: 12px;
  width: 600px;
  max-width: 95%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
  margin: 0;
}

.close-btn {
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-muted);
}

.close-btn:hover {
  color: var(--color-secondary);
}

/* --- LOGIN PAGE STYLES --- */
body.admin-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--color-bg);
  /* background-image removed here, moved to ::after for layering */
  position: relative;
}

/* Semi-transparent background image overlay */
body.admin-body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/images/login-bg.jpg');
  background-size: cover;
  background-position: center;
  /* Dark Mode: Reduced opacity for balance */
  opacity: 0.4;
  z-index: 0;
  pointer-events: none;
}

/* Gradient Mesh Overlay (Top Layer) */
body.admin-body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Restored Home Page Gradient Mesh */
  background-image: var(--gradient-mesh);
  background-attachment: fixed;
  z-index: 0;
  pointer-events: none;
}

/* Light Mode Override: Fully Opaque */
body.light-mode.admin-body::before {
  opacity: 1;
}

.login-box {
  width: 100%;
  max-width: 420px;
  /* Slightly wider for perfect square */
  aspect-ratio: 1 / 1;
  /* Force square shape */
  display: flex;
  flex-direction: column;
  justify-content: center;

  background: rgba(15, 23, 42, 0.75);
  /* Darker Premium Glass */
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 2rem;
  border-radius: 20px;
  /* Softer, modern corners */

  /* Subtle border initially */
  border: 1px solid rgba(255, 255, 255, 0.08);

  /* Deep shadow for depth + subtle glow hint */
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.02);

  position: relative;
  z-index: 1;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  /* Smooth spring-like transition */
  overflow: hidden;
}

/* Premium Top Highlight */
.login-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0.5;
}

/* Hover Effect: Bright Cyan Border & Glow */
.login-box:hover {
  transform: translateY(-5px);
  /* Gentle float up */

  /* Bright Cyan Accent Border */
  border-color: #06b6d4;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.25), 0 20px 40px -10px rgba(0, 0, 0, 0.6);
}

/* Light Mode Override: Solid White Card */
body.light-mode .login-box {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}



body.light-mode .login-box:hover {
  border-color: #3b82f6;
  /* Same Vivid Blue Edge Light */
  box-shadow: 0 0 10px 1px rgba(59, 130, 246, 0.4), 0 20px 25px -5px rgba(0, 0, 0, 0.15);
}

.login-box h2 {
  text-align: center;
  margin-bottom: 2rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: #60a5fa;
  /* Dark Mode: Blue Text */
  background: none;
  -webkit-text-fill-color: initial;
}

body.light-mode .login-box h2 {
  color: #1e3a8a;
  /* Light Mode: Distinct Navy Blue Text */
}

body.dark-mode .login-box h2 {
  color: #60a5fa;
}

.absolute-top-right {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}

.login-box form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  /* Larger gap */
}

.login-box input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  /* Matching rounded style */
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(0, 0, 0, 0.3);
  /* Darker, cleaner input */
  color: #ffffff;
  font-size: 1rem;
  transition: all 0.3s;
}

body.light-mode .login-box input {
  background-color: #f1f5f9;
  /* Light Gray */
  color: #334155;
  border: 1px solid transparent;
}

body.light-mode .login-box input:focus {
  background-color: #ffffff;
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Custom Login Button */
.btn-login {
  width: 100%;
  margin-top: 1rem;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: #3b82f6;
  /* Default (Dark Mode): Blue Button */
  color: white;
}

.btn-login:hover {
  background: #2563eb;
}

body.dark-mode .btn-login {
  background: #3b82f6;
  border: none;
}

body.dark-mode .btn-login:hover {
  background: #2563eb;
}

body.light-mode .btn-login {
  background: #0f172a;
  color: #ffffff;
}

body.light-mode .btn-login:hover {
  background: #1e293b;
}

/* Footer Links */
.login-footer {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.link-red {
  color: #ef4444;
  font-size: 0.95rem;
  text-decoration: none;
}

.link-red:hover {
  text-decoration: underline;
}

.link-muted {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.link-muted:hover {
  color: var(--color-text-main);
}

/* Reset Password / Steps */
.step-section {
  display: none;
}

.step-section.active {
  display: block;
}

.method-btn {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.method-btn:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-primary);
}

.back-link {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: underline;
  margin-top: 10px;
  display: inline-block;
}

.error-msg {
  color: var(--color-secondary);
  display: none;
  margin-top: 15px;
  font-size: 0.9rem;
}

.text-accent {
  color: var(--color-accent);
}

.input-readonly {
  background-color: var(--color-surface);
  color: var(--color-text-muted);
  border-color: var(--color-border);
  cursor: default;
}

/* Pagination Controls */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  gap: 12px;
  padding: 10px;
}

.pagination-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: auto;
  text-align: center;
}

.pagination-btn:hover:not(:disabled) {
  background-color: transparent;
  color: var(--color-primary);
}

.pagination-btn.active {
  background-color: transparent;
  color: var(--color-primary);
  border: none;
  font-weight: 700;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background-color: transparent;
}

.pagination-info {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0 10px;
}

/* Search Component */
.search-container {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
  align-items: stretch;
  /* Ensures button matches input height */
}

.search-container input {
  margin-bottom: 0 !important;
  /* Override default input margin */
  flex: 1;
}

.btn-search {
  background-color: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  padding: 0 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: 80px;
  /* Ensure decent width for text */
}

.btn-search:hover {
  background-color: var(--color-primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* --- DOCUMENTS MODULE --- */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.search-bar button {
  padding: 10px 20px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s, transform 0.1s;
}

.search-bar button:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.search-bar button:active {
  transform: translateY(0);
}

.upload-area {
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

.upload-area:hover {
  border-color: var(--color-primary);
}

.document-list {
  display: grid;
  gap: 10px;
}

.document-item {
  background: var(--color-surface);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: var(--glass-blur);
}

.doc-info h4 {
  margin: 0 0 5px 0;
  font-size: 16px;
  color: var(--color-text-main);
}

.doc-meta {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* Section Label (Standardized) */
.section-label {
  font-size: 0.85em;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 4px;
}

/* --- Flag/Status Button Styles (Round Circle Toggle) --- */
.flag-input {
  display: none;
}

/* Base Style (Active/Visible State) */
/* Used directly in Table (always active if present) and in Form (toggled) */
.flag-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  user-select: none;
  background-color: rgba(255, 255, 255, 0.05);
  /* Default text color fallback */
  color: var(--color-text-muted);
}

/* Specific Flag Colors */
.flag-b {
  color: #60a5fa;
  /* Blue */
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(96, 165, 250, 0.1);
}

.flag-r {
  color: #f59e0b;
  /* Amber */
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.1);
}

.flag-fc {
  color: #10b981;
  /* Emerald */
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.1);
}

/* Form Interaction: Inactive State */
/* When the hidden checkbox is NOT checked, dim the circle */
.flag-input:not(:checked)+.flag-circle {
  opacity: 0.4;
  filter: grayscale(1);
  box-shadow: none;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.1);
}

/* Form Interaction: Checked State (Reinforce active look + glow) */
.flag-input:checked+.flag-circle {
  opacity: 1;
  filter: none;
  transform: scale(1.1);
}

.flag-input:checked+.flag-circle.flag-b {
  box-shadow: 0 0 15px rgba(96, 165, 250, 0.3);
}

.flag-input:checked+.flag-circle.flag-r {
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

.flag-input:checked+.flag-circle.flag-fc {
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.flag-toggle-label {
  cursor: pointer;
  display: inline-block;
  transition: opacity 0.2s;
}

.flag-toggle-label:hover {
  opacity: 0.9;
}

/* Tooltips */
.tooltip-container {
  position: relative;
  cursor: help;
}

.tooltip-content {
  visibility: hidden;
  width: 250px;
  background-color: rgba(17, 24, 39, 0.95);
  color: var(--color-text-main);
  text-align: left;
  border-radius: 8px;
  padding: 12px;
  position: absolute;
  z-index: 100;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  margin-bottom: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--color-border);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  font-size: 0.85em;
  pointer-events: none;
}

.tooltip-container:hover .tooltip-content {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  border-bottom: 1px dashed var(--color-border);
  padding-bottom: 4px;
}

.tooltip-row:last-child {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
  font-weight: bold;
  color: #f87171;
  margin-top: 4px;
  border-top: 1px solid var(--color-border);
  padding-top: 6px;
}

/* Floating Summary */
.floating-summary {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--color-surface);
  padding: 15px 25px;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--color-primary);
  z-index: 100;
  align-items: center;
  gap: 15px;
  backdrop-filter: blur(10px);
}

.floating-summary.active {
  display: flex;
}

.pt-4 {
  padding-top: 1rem;
}

.border-t {
  border-top: 1px solid var(--color-border);
}

/* Animations */
/* --- FINANCE MODULE STYLES (v47 Update) --- */

.finance-stats .stat-card {
  background-color: #0f172a;
  /* Darker background */
  text-align: left;
  align-items: flex-start;
  /* Override align-items: center */
  padding: 1.5rem;
}

.finance-stats .stat-card.glow-blue {
  border: 1px solid #3b82f6;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.card-header-bar {
  background: #1e293b;
  /* Slate-800 */
  border-left: 5px solid #3b82f6;
  /* Blue-500 */
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  color: #f1f5f9;
  /* Slate-100 */
  font-weight: 600;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  padding-left: 5px;
}

.text-blue {
  color: #60a5fa;
}

/* Form Inputs for Finance */
.form-input {
  background-color: #111827 !important;
  /* Gray-900 */
  border: 1px solid #374151 !important;
  /* Gray-700 */
  color: #f9fafb !important;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  width: 100%;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-input:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  outline: none;
}

/* Specific styling for Finance Layout */
.finance-stats~.grid-dashboard .card {
  background-color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.finance-stats~.grid-dashboard table {
  border-collapse: separate;
  border-spacing: 0 8px;
  /* Gap between rows if desired, or collapsed */
  border-collapse: collapse;
  /* User image shows solid rows */
}

.finance-stats~.grid-dashboard table thead th {
  background-color: #1e40af;
  /* Darker Blue */
  color: white;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1rem;
  border: none;
}

.finance-stats~.grid-dashboard table tbody tr {
  background-color: #1e293b;
  border-bottom: 1px solid #334155;
}

.finance-stats~.grid-dashboard table tbody td {
  padding: 0.8rem 1rem;
  vertical-align: middle;
  color: #e2e8f0;
  border-bottom: 1px solid #334155;
  font-size: 0.85rem;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
}

.finance-stats~.grid-dashboard table tbody tr:last-child td {
  border-bottom: none;
}

/* --- BILL REGISTRY SPECIFIC STYLES (v48 Update) --- */

/* Sidebar Layout & Inputs */
.bill-registry-sidebar .card {
  background-color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.bill-registry-sidebar .section-label {
  color: #94a3b8;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: block;
  font-weight: 600;
}

.bill-registry-sidebar .compact-input {
  background-color: #111827 !important;
  border: 1px solid #374151 !important;
  color: #f3f4f6 !important;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  width: 100%;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}

.bill-registry-sidebar .compact-input:focus {
  border-color: #3b82f6 !important;
  outline: none;
}

/* Big "Create New Bill" Header/Button look */
.create-bill-header {
  background: linear-gradient(to right, #1e3a8a, #1e40af);
  color: white;
  padding: 10px;
  text-align: center;
  border-radius: 6px;
  font-weight: 600;
  margin-bottom: 1rem;
  border: 1px solid #1d4ed8;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

/* Main Ledger Area */
.ledger-card {
  background-color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0 !important;
  /* Reset padding for full-width header */
  overflow: hidden;
}

.ledger-header-bar {
  background: #1e293b;
  border-left: 5px solid #0ea5e9;
  /* Sky blue accent */
  padding: 1rem 1.5rem;
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ledger-actions-bar {
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid #334155;
}

/* Table Styles */
.bill-table {
  width: 100%;
  border-collapse: collapse;
}

.bill-table thead th {
  background-color: #172554;
  /* Dark Blue */
  color: #bfdbfe;
  /* Light Blue Text */
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid #1e3a8a;
}

.bill-table tbody tr {
  background-color: #0f172a;
  border-bottom: 1px solid #1e293b;
  transition: background-color 0.2s;
}

.bill-table tbody tr:hover {
  background-color: #1e293b;
}

.bill-table td {
  padding: 10px 14px;
  color: #e2e8f0;
  font-size: 0.85rem;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  vertical-align: middle;
}

/* Action Buttons in Row */
.action-btn-group {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.btn-icon-square {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  color: white;
  transition: transform 0.1s;
}

.btn-icon-square:hover {
  transform: scale(1.05);
}

.btn-edit-square {
  background-color: #0ea5e9;
  /* Sky Blue */
}

.btn-delete-square {
  background-color: #7f1d1d;
  /* Dark Red */
  border: 1px solid #ef4444;
}

/* Button Colors */
.btn-green-solid {
  background-color: #22c55e;
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-green-solid:hover {
  background-color: #16a34a;
}

.btn-red-solid {
  background-color: #ef4444;
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-red-solid:hover {
  background-color: #dc2626;
}

/* Checkbox */
.custom-checkbox {
  accent-color: #3b82f6;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Pagination */
.pagination-controls {
  padding: 1rem;
  display: flex;
  justify-content: center;
  background: #0f172a;
}

/* Modal Dark Theme Fixes */
.modal-content {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155;
}

.modal-header {
  border-bottom-color: #334155 !important;
}

.modal .compact-input {
  background-color: #0f172a !important;
  border-color: #475569 !important;
}

/* Grand Amount Cell Merging Styles */
.grand-amount-cell {
  vertical-align: middle !important;
  text-align: left;
  background-color: rgba(6, 78, 59, 0.1);
  /* Very subtle green tint */
  border-left: 1px solid #334155;
  padding: 0.5rem 1rem !important;
}

.grand-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ref-text {
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: monospace;
}

/* Light Mode Override for Reference Text */
body.light-mode .ref-text {
  color: #475569;
  /* Darker for visibility in light mode */
}

.input-highlight-success {
  background-color: rgba(6, 78, 59, 0.2) !important;
  color: #4ade80 !important;
  font-weight: bold;
  border-color: #059669 !important;
}

/* Ensure Card Header Bar is global if not already */
.card-header-bar {
  background: #1e293b;
  border-left: 5px solid #3b82f6;
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  color: #f1f5f9;
  font-weight: 600;
  width: 100%;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.flag-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
}

/* Tiny Delete Button (Cross Icon) - Ensuring visibility */
.btn-icon-delete {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(239, 68, 68, 0.15);
  /* Red */
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  /* Red-300 */
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  /* Reset padding */
  font-size: 1.2rem;
  font-weight: bold;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon-delete:hover {
  background-color: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.15);
}

/* --- MODERN LIGHT THEME RECREATION --- */
/* Overrides for hardcoded dark styles in Finance & Bill Registry */

body.light-mode .card,
body.light-mode .stat-card,
body.light-mode .ledger-card,
body.light-mode .bill-registry-sidebar .card,
body.light-mode .finance-stats .stat-card,
body.light-mode .finance-stats~.grid-dashboard .card {
  background-color: #ffffff !important;
  border: 1px solid rgba(226, 232, 240, 0.8) !important;
  /* Slate-200 */
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.08),
    0 4px 6px -2px rgba(0, 0, 0, 0.04),
    0 20px 25px -5px rgba(0, 0, 0, 0.02) !important;
  /* Deeper 3D shadow */
  color: #0f172a !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.light-mode .card:hover,
body.light-mode .stat-card:hover {
  transform: translateY(-2px);
  border-color: #3b82f6 !important;
  /* Blue-500 border on hover */
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.08),
    0 10px 10px -5px rgba(0, 0, 0, 0.03) !important;
}

/* Headers in Cards */
body.light-mode .card-header-bar,
body.light-mode .ledger-header-bar {
  background: #f1f5f9 !important;
  /* Slate-100 */
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: none !important;
}

body.light-mode .card h3,
body.light-mode .stat-card h3 {
  background: linear-gradient(90deg, #f0f9ff 0%, #f8fafc 100%) !important;
  color: #0f172a !important;
  border-bottom: 1px solid #e0f2fe;
}

/* Inputs */
body.light-mode .form-input,
body.light-mode .compact-input,
body.light-mode input,
body.light-mode select,
body.light-mode textarea {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  /* Slate-300 */
  color: #0f172a !important;
}



body.light-mode input:read-only,
body.light-mode input:disabled,
body.light-mode textarea:read-only {
  background-color: #f1f5f9 !important;
  /* Light gray for readonly */
  color: #64748b !important;
  cursor: not-allowed;
}

/* Fix for dropdown options to match theme */
select option {
  background-color: #1e293b;
  /* Dark theme bg */
  color: #f8fafc;
}

body.light-mode select option {
  background-color: #ffffff;
  color: #0f172a;
}

body.light-mode .form-input:focus,
body.light-mode .compact-input:focus,
body.light-mode input:focus,
body.light-mode select:focus,
body.light-mode textarea:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
  background-color: #ffffff !important;
}

/* Tables */
body.light-mode table thead th,
body.light-mode .finance-stats~.grid-dashboard table thead th,
body.light-mode .bill-table thead th {
  background-color: #eff6ff !important;
  /* Blue-50 */
  color: #1e40af !important;
  /* Blue-800 */
  border-bottom: 2px solid #dbeafe !important;
}

body.light-mode table tbody tr,
body.light-mode .finance-stats~.grid-dashboard table tbody tr,
body.light-mode .bill-table tbody tr {
  background-color: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-mode table tbody tr:hover,
body.light-mode .finance-stats~.grid-dashboard table tbody tr:hover,
body.light-mode .bill-table tbody tr:hover {
  background-color: #f8fafc !important;
  /* Slate-50 */
}

body.light-mode table td,
body.light-mode .finance-stats~.grid-dashboard table tbody td,
body.light-mode .bill-table td {
  color: #334155 !important;
  /* Slate-700 */
  border-bottom-color: #e2e8f0 !important;
}

/* Modals */
body.light-mode .modal-content {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
}

body.light-mode .modal-header {
  border-bottom-color: #e2e8f0 !important;
}

/* Pagination */
body.light-mode .pagination-controls {
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0;
}

/* Status Flags */
body.light-mode .flag-circle {
  background-color: #ffffff;
  border-color: #cbd5e1;
  color: #64748b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

body.light-mode .flag-b {
  color: #2563eb !important;
  /* Blue-600 */
  border-color: #bfdbfe !important;
  /* Blue-200 */
  background-color: #eff6ff !important;
  /* Blue-50 */
}

body.light-mode .flag-r {
  color: #d97706 !important;
  /* Amber-600 */
  border-color: #fde68a !important;
  /* Amber-200 */
  background-color: #fffbeb !important;
  /* Amber-50 */
}

body.light-mode .flag-fc {
  color: #059669 !important;
  /* Emerald-600 */
  border-color: #a7f3d0 !important;
  /* Emerald-200 */
  background-color: #ecfdf5 !important;
  /* Emerald-50 */
}

/* Inactive/Unchecked State in Forms */
body.light-mode .flag-input:not(:checked)+.flag-circle {
  background: #f8fafc !important;
  /* Slate-50 */
  border-color: #e2e8f0 !important;
  /* Slate-200 */
  color: #94a3b8 !important;
  /* Slate-400 */
  opacity: 0.6;
  filter: grayscale(1);
  box-shadow: none;
}

/* Checked State Glows for Light Mode */
body.light-mode .flag-input:checked+.flag-circle.flag-b {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

body.light-mode .flag-input:checked+.flag-circle.flag-r {
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2);
}

body.light-mode .flag-input:checked+.flag-circle.flag-fc {
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

/* Specific Finance Stats Text */
body.light-mode .finance-stats .stat-value {
  color: #0f172a !important;
}

body.light-mode .text-blue {
  color: #2563eb !important;
  /* Darker blue for light mode readability */
}

/* Ledger Actions Bar */
body.light-mode .ledger-actions-bar {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}


/* --- GLOBAL LAYOUT LIGHT MODE FIXES --- */
/* Overriding hardcoded dark gradients on Body and Header */

body.light-mode {
  background: linear-gradient(135deg, #f0f4f8 0%, #dce3f0 100%) !important;
  /* Subtle blue-grey gradient */
  background-attachment: fixed !important;
  color: #0f172a !important;
  min-height: 100vh;
}

body.light-mode .admin-header {
  background: #ffffff !important;
  /* Remove dark linear gradient */
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

body.light-mode .logo-text {
  color: #0f172a !important;
}

body.light-mode .admin-badge {
  background-color: #eff6ff !important;
  color: #2563eb !important;
  border: 1px solid #dbeafe;
}

body.light-mode .logout-btn {
  color: #64748b !important;
}

body.light-mode .logout-btn:hover {
  color: #0f172a !important;
}

/* Navigation Tabs */
body.light-mode .nav-item {
  color: #64748b !important;
  /* Slate-500 */
}

body.light-mode .nav-item:hover {
  color: #2563eb !important;
  /* Blue-600 */
  background-color: #eff6ff !important;
  /* Blue-50 */
}

body.light-mode .nav-item.active {
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

/* Active tab indicator (if using underline style in some places) */
body.light-mode .nav-links {
  border-bottom-color: transparent;
}

/* Scrollbar for Light Mode */
body.light-mode::-webkit-scrollbar-track {
  background: #f1f5f9;
}

body.light-mode::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border: 3px solid #f1f5f9;
}

body.light-mode::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}


/* Logo refinements for Light Mode */
body.light-mode .brand-red {
  color: #dc2626 !important;
  text-shadow: none !important;
}

/* =========================================
   MOBILE RESPONSIVENESS (Added)
   ========================================= */

@media (max-width: 768px) {

  /* 1. Layout: Stack Sidebar and Content */
  .grid-sidebar-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .grid-sidebar-layout>div:first-child {
    width: 100%;
    /* Sidebar takes full width */
    max-height: none !important;
    overflow: visible !important;
    /* Remove height limit if any */
    margin-bottom: 1rem;
  }

  /* 2. Navigation: Scrollable or Stacked */
  .nav-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
  }

  .nav-item {
    font-size: 0.85rem;
    padding: 0.5rem 0.8rem;
    flex: 0 0 auto;
    /* Don't shrink */
  }

  /* 3. Header Adjustments */
  .admin-header {
    position: relative;
    /* Push content down instead of floating over */
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    height: auto;
  }

  .admin-header>div {
    width: 100%;
    justify-content: flex-end;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 10px;
  }

  /* 4. Filter Bar & Controls */
  .flex.gap-2.mb-4.items-center {
    flex-direction: column;
    align-items: stretch;
  }

  #divisionFilter {
    width: 100%;
    min-width: 0 !important;
  }

  .dashboard-container {
    padding: 1rem;
    padding-top: 0;
    /* Header is relative now, so we don't need huge padding */
  }

  /* 5. Tables: Horizontal Scroll */
  .card {
    padding: 1rem !important;
    /* overflow: hidden;  <-- REMOVED to allow full scroll */
  }

  /* Create scrolling context for tables */
  .card>.overflow-x-auto,
  .table-container {
    overflow-x: auto;
    width: 100%;
    display: block;
    -webkit-overflow-scrolling: touch;
  }

  /* Ensure tables don't shrink too much */
  table,
  .table-separate-rows {
    min-width: 1000px !important;
    /* Increased to 1000px and forced */
    width: auto !important;
    /* Override w-full */
    table-layout: auto !important;
  }

  /* Adjust cell packing for mobile */
  td,
  th,
  .table-separate-rows td,
  .table-separate-rows th {
    padding: 8px 10px;
    font-size: 0.8rem;
    white-space: nowrap !important;
    /* Prevent text wrapping */
  }

  /* Prevent wrapping INSIDE the cell lines (for stacked content) */
  .cell-line {
    white-space: nowrap !important;
    width: auto !important;
  }

  /* 6. Modals: Full Width / Centered */
  .modal-content {
    width: 95%;
    margin: 10% auto;
    /* More margin on mobile */
    max-height: 90vh;
    /* Better height constraint */
    padding: 1rem;
  }

  .grid-cols-3,
  .grid-3,
  .grid-cols-2,
  .grid-2 {
    grid-template-columns: 1fr;
    /* Stack inputs */
  }

  /* 7. Stats Grid Stacking */
  .stats-grid {
    flex-direction: column;
  }

  .stat-card {
    width: 100%;
    min-width: 0;
  }
}

/* 
   =========================================
   MOBILE RESPONSIVE FIXES (ADDED BY AGENT) 
   =========================================
*/

@media (max-width: 768px) {

  /* 1. Module Buttons (Nav Grid) Fix */
  .nav-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2 columns for better layout */
    gap: 0.8rem;
  }

  .nav-item {
    text-align: center;
    padding: 0.6rem 0.5rem;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 2. Payment Registry Scroll Fix */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    display: block;
    width: 100%;
    margin-bottom: 1rem;
    border: 1px solid var(--color-border);
    /* highlight scrollable area */
    border-radius: 8px;
  }

  /* Ensure table is wide enough to force scroll */
  .bill-table {
    min-width: 1000px;
    /* Force minimum width to trigger scroll */
  }

  /* Styling scrollbar for visibility */
  .table-container::-webkit-scrollbar {
    height: 6px;
  }

  .table-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
  }

  .table-container::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 3px;
  }

  /* 3. Login Page Redesign for Mobile */
  .login-box {
    width: 80%;
    /* Reduced width to 80% */
    max-width: 350px;
    /* Tighter constraint for compact look */
    aspect-ratio: auto;
    min-height: auto;
    padding: 1.25rem;
    /* Slightly less padding */
    margin: 6rem auto 2rem;
    /* Kept top margin */
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .login-box h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .login-box input {
    padding: 12px;
    font-size: 1rem;
    /* Prevent zoom on focus on iOS */
  }

  .btn-login {
    padding: 14px;
    font-size: 1rem;
  }

  /* Remove absolute positioning of theme toggle on mobile login to prevent overlap */
  .absolute-top-right {
    top: 10px;
    right: 10px;
  }

  /* Adjust Dashboard Cards/Grids for Mobile */
  .grid-sidebar-layout {
    grid-template-columns: 1fr;
    /* Stack sidebar and main content */
  }

  .bill-registry-sidebar {
    width: 100%;
    margin-bottom: 1.5rem;
  }

  /* Compact stats grid */
  .stats-grid {
    gap: 1rem;
  }

  .stat-card,
  .stat-box {
    flex: 1 1 100%;
    /* Full width stats on mobile */
  }

}

/* Force Horizontal Scroll for Record Registry Table on Mobile */
@media (max-width: 768px) {

  /* Fix for dashboard container width overflowing viewport */
  .dashboard-container {
    width: 100vw !important;
    /* Force viewport width */
    max-width: 100% !important;
    padding-left: 1.5rem !important;
    /* Increased padding / safe area */
    padding-right: 1.5rem !important;
    overflow-x: hidden;
    /* Prevent horizontal scroll on body */
  }

  /* Fix for sidebar/content stacking causing overflow issues */
  .grid-sidebar-layout {
    display: block;
    /* Use block instead of flex to avoiding flex-growth issues */
    width: 100%;
  }

  .grid-sidebar-layout>div {
    min-width: 0;
    /* Allow grid/flex items to shrink */
    max-width: 100%;
  }

  /* Ensure card allows inner content to scroll */
  .card {
    max-width: 100vw;
    overflow: visible;
    /* Let the inner container handle overflow */
  }

  /* Specific fix for Record Table scrolling */
  #recordTable {
    min-width: 1000px !important;
    /* Force wide table */
    width: auto !important;
    display: table !important;
    /* Ensure it behaves like a table */
    table-layout: auto !important;
  }

  #recordTable th,
  #recordTable td {
    white-space: nowrap !important;
    /* Prevent text wrapping */
    display: table-cell !important;
    /* Ensure cells stay cells */
  }

  /* Ensure the container allows scrolling */
  .overflow-x-auto {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    /* Constrain width */
    display: block;
    padding-bottom: 10px;
    /* Space for scrollbar */
  }

  /* Styling for the scrollbar itself to make it more visible */
  .overflow-x-auto::-webkit-scrollbar {
    height: 8px;
    /* Slightly thicker for easier touch */
  }

  .overflow-x-auto::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
  }

  .overflow-x-auto::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
  }

  body.light-mode .overflow-x-auto::-webkit-scrollbar-track {
    background: #f1f5f9;
  }

  body.light-mode .overflow-x-auto::-webkit-scrollbar-thumb {
    background: #cbd5e1;
  }
}