/* ==========================================================================
   Base CSS & Variables (Color System, Typography & Resets)
   ========================================================================== */
:root {
  color-scheme: dark;
  /* Color Palette - Premium Slate & Orange Theme (Dark Mode Default) */
  --bg-primary: #0b0f19;
  --bg-secondary: #121826;
  --card-bg: rgba(22, 30, 49, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  
  --primary-color: #f97316;
  --primary-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  --accent-color: #fbbf24;
  --accent-gradient: linear-gradient(135deg, #fbbf24 0%, #f97316 100%);
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;
  
  --glass-glow: rgba(249, 115, 22, 0.15);
  
  /* Font Stack */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-title: 'Outfit', system-ui, -apple-system, sans-serif;
  
  /* Layout values */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-mode {
  color-scheme: light;
  /* Color Palette - Premium White & Orange Theme (Light Mode) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(0, 0, 0, 0.08);
  
  --primary-color: #ea580c;
  --primary-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  --accent-color: #d97706;
  --accent-gradient: linear-gradient(135deg, #fbbf24 0%, #ea580c 100%);
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --glass-glow: rgba(234, 88, 12, 0.1);
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Background Glowing Orbs for Aesthetic depth */
.background-decorations {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
}

.glow-orb-1 {
  top: -10%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  background: var(--primary-color);
  animation: orbFloat 25s ease-in-out infinite alternate;
}

.glow-orb-2 {
  bottom: -15%;
  left: -5%;
  width: 60vw;
  height: 60vw;
  background: var(--accent-color);
  animation: orbFloat 35s ease-in-out infinite alternate-reverse;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 8%) scale(1.1); }
  100% { transform: translate(-3%, -5%) scale(0.95); }
}

/* Main Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
}

/* ==========================================================================
   Header Component
   ========================================================================== */
.app-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
  gap: 1.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}

.logo-icon {
  width: 60px;
  height: 60px;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.3);
}

.logo-icon i {
  width: 32px;
  height: 32px;
  color: var(--text-inverse);
}

.logo-icon-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.minister-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 50%;
  border: 2px solid rgba(249, 115, 22, 0.4);
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.25);
  background: #ffffff;
  transition: var(--transition-smooth);
}

.logo-icon-wrapper:hover .minister-avatar {
  transform: scale(1.05);
  border-color: var(--primary-color);
}

.logo-badge-icon {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 36px;
  height: 36px;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--bg-primary);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.logo-badge-icon i {
  width: 18px;
  height: 18px;
  color: #fff;
}

.logo-area h1 {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-area .subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  margin-top: 2px;
}

/* Contact Person Card */
.contact-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  max-width: 420px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
  transition: var(--transition-smooth);
}

.contact-card:hover {
  transform: translateY(-2px);
  border-color: rgba(249, 115, 22, 0.3);
  box-shadow: 0 8px 30px rgba(249, 115, 22, 0.1);
}

.contact-card-bottom {
  margin: 1.5rem auto 0 auto;
  width: 100%;
}

.contact-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.contact-header i {
  width: 18px;
  height: 18px;
}

.contact-header h3 {
  font-family: var(--font-title);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.contact-name {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: var(--transition-smooth);
  width: fit-content;
}

.contact-item i {
  width: 16px;
  height: 16px;
  color: var(--primary-color);
}

.contact-item:hover {
  color: #fff;
  transform: translateX(3px);
}

.whatsapp-prompt {
  margin-top: 0.5rem;
}

.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--success-color);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition-smooth);
  width: 100%;
  justify-content: center;
  cursor: pointer;
  outline: none;
}

.whatsapp-btn:hover {
  background-color: var(--success-color);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.whatsapp-btn:disabled,
.whatsapp-btn.disabled {
  background-color: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  color: var(--text-muted) !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  box-shadow: none !important;
  transform: none !important;
}

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

/* ==========================================================================
   Navigation Component
   ========================================================================== */
.tab-navigation {
  display: flex;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  width: fit-content;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.tab-btn i {
  width: 18px;
  height: 18px;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  background: var(--primary-gradient);
  color: var(--text-inverse);
  box-shadow: 0 4px 15px rgba(249, 115, 22, 0.25);
}

/* ==========================================================================
   Sections and Cards
   ========================================================================== */
.tab-section {
  display: none;
  animation: fadeIn 0.4s ease;
}

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

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

.section-card, .sheet-container-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.section-card::before, .sheet-container-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.card-header {
  margin-bottom: 2rem;
}

.card-header h2 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.card-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ==========================================================================
   Form Fields and Elements
   ========================================================================== */
.form-group-fieldset {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin-bottom: 2rem;
  background-color: rgba(0, 0, 0, 0.15);
}

.form-group-fieldset legend {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent-color);
  padding: 0 0.75rem;
  letter-spacing: 0.5px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-row:last-child {
  margin-bottom: 0;
}

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

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e2e8f0;
}

.form-field label .required {
  color: var(--danger-color);
}

.form-field label .optional {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.8rem;
}

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

.input-icon {
  position: absolute;
  left: 1rem;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--transition-smooth);
}

.input-wrapper input,
.input-wrapper select,
.input-wrapper textarea {
  width: 100%;
  background-color: rgba(18, 24, 38, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.input-wrapper textarea {
  resize: vertical;
  min-height: 80px;
}

/* Focused states */
.input-wrapper input:focus,
.input-wrapper select:focus,
.input-wrapper textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25);
  background-color: rgba(18, 24, 38, 0.95);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper select:focus + .input-icon,
.input-wrapper textarea:focus + .input-icon {
  color: var(--primary-color);
}

/* Custom select dropdown styling in chromium */
.input-wrapper select option {
  background-color: var(--bg-secondary);
  color: #fff;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Hide dynamic field */
.dynamic-field.hidden {
  display: none !important;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.submit-btn {
  background: var(--primary-gradient);
  color: var(--text-inverse);
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.9rem 2.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 18px rgba(249, 115, 22, 0.3);
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(249, 115, 22, 0.45);
}

.submit-btn:active {
  transform: translateY(1px);
}

.submit-btn i {
  width: 18px;
  height: 18px;
}

/* Status Notifications */
.form-message {
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  opacity: 0;
  transform: translateY(5px);
  transition: var(--transition-smooth);
}

.form-message.show {
  opacity: 1;
  transform: translateY(0);
}

.form-message.success {
  background-color: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--success-color);
}

.form-message.error {
  background-color: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger-color);
}

/* ==========================================================================
   Spreadsheet View Dashboard
   ========================================================================== */
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 1.5rem;
}

.sheet-title h2 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}

.sheet-title p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.sheet-actions {
  display: flex;
  gap: 0.75rem;
}

.export-btn, .refresh-btn {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}

.export-btn {
  background: var(--accent-gradient);
  color: #0b0f19;
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.25);
}

.export-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4);
}

.export-btn i, .refresh-btn i {
  width: 16px;
  height: 16px;
}

.refresh-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.refresh-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Searching and Filtering Panel */
.sheet-controls {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1;
}

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

.search-box input {
  width: 100%;
  background: rgba(18, 24, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-smooth);
}

.search-box input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25);
}

.filter-box {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-icon {
  position: absolute;
  left: 0.9rem;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.filter-box select {
  background: rgba(18, 24, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem 0.65rem 2.25rem;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 220px;
}

.filter-box select:focus {
  border-color: var(--accent-color);
}

.row-count-badge, .row-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

/* ==========================================================================
   Spreadsheet Table (Excel-like Grid Styles)
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
  background: rgba(11, 15, 25, 0.4);
}

/* Custom Scrollbars for spreadsheet */
.table-responsive::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(11, 15, 25, 0.5);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg-primary);
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.spreadsheet-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
  white-space: nowrap;
}

/* Grid Headers */
.spreadsheet-table th {
  background-color: rgba(18, 24, 38, 0.95);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 700;
  padding: 0.9rem 1.25rem;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  user-select: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: sticky;
  top: 0;
  z-index: 10;
}

.spreadsheet-table th:hover {
  background-color: rgba(249, 115, 22, 0.1);
  color: var(--primary-color);
}

.spreadsheet-table th:last-child {
  border-right: none;
  cursor: default;
}

.spreadsheet-table th:last-child:hover {
  background-color: rgba(18, 24, 38, 0.95);
  color: #fff;
}

.sort-indicator {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.75rem;
}

/* Grid Cells */
.spreadsheet-table td {
  padding: 0.85rem 1.25rem;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  vertical-align: middle;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spreadsheet-table td:last-child {
  border-right: none;
}

.spreadsheet-table tbody tr {
  transition: var(--transition-smooth);
}

/* Row Hovering & Alternating colors */
.spreadsheet-table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.01);
}

.spreadsheet-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

/* Highlight Cell Styling */
.cell-id {
  font-family: monospace;
  color: var(--accent-color);
  font-weight: 600;
}

.cell-timestamp {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.cell-name {
  font-weight: 600;
  color: #fff;
}

.cell-department {
  background-color: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.2);
  color: var(--primary-color);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.cell-accompanying {
  text-align: center;
  font-weight: 600;
}

.delete-row-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger-color);
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.delete-row-btn:hover {
  background: var(--danger-color);
  color: #fff;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

.delete-row-btn i {
  width: 14px;
  height: 14px;
}

/* Empty database state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state.hidden {
  display: none;
}

.empty-state i {
  width: 60px;
  height: 60px;
  color: rgba(255, 255, 255, 0.1);
  margin-bottom: 1.5rem;
}

.empty-state h3 {
  font-family: var(--font-title);
  color: #fff;
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   Admin Authentication Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
  overflow-y: auto;
  padding: 2rem 1rem;
}

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

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  transform: translateY(20px);
  transition: var(--transition-smooth);
  text-align: center;
  margin: auto;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-icon {
  width: 54px;
  height: 54px;
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem auto;
}

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

.modal-content h2 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.modal-content p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.modal-content .form-field {
  text-align: left;
  margin-bottom: 1.5rem;
}

.modal-content input[type="password"] {
  width: 100%;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: #fff;
  outline: none;
  font-family: var(--font-body);
  transition: var(--transition-smooth);
}

.modal-content input[type="password"]:focus {
  border-color: var(--accent-color);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1rem;
}

.cancel-btn, .login-btn {
  font-family: var(--font-title);
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.cancel-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.login-btn {
  background: var(--accent-gradient);
  color: #0b0f19;
}

.login-btn:hover {
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.25);
  opacity: 0.95;
}

.modal-error-msg {
  color: var(--danger-color);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 1rem;
  display: none;
}

.modal-error-msg.show {
  display: block;
}

/* Overlay Helper Classes */
.hidden {
  display: none !important;
}

/* ==========================================================================
   Footer Component
   ========================================================================== */
.app-footer {
  text-align: center;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 2rem;
}

.app-footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 992px) {
  .contact-card {
    max-width: 100%;
  }

  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 1.5rem 1rem;
  }

  .section-card, .sheet-container-card {
    padding: 1.5rem;
  }

  .form-group-fieldset {
    padding: 1.25rem;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .submit-btn {
    width: 100%;
    justify-content: center;
  }

  .sheet-header {
    flex-direction: column;
    align-items: stretch;
  }

  .sheet-actions {
    width: 100%;
  }

  .sheet-actions button {
    flex: 1;
    justify-content: center;
  }

  .sheet-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-box select {
    width: 100%;
  }
}

@media (max-width: 576px) {
  .logo-area h1 {
    font-size: 1.5rem;
  }
  
  .logo-area .subtitle {
    font-size: 0.85rem;
  }

  .logo-icon-wrapper {
    width: 100px;
    height: 100px;
  }
  
  .logo-badge-icon {
    width: 30px;
    height: 30px;
  }

  .logo-badge-icon i {
    width: 15px;
    height: 15px;
  }

  .receipt-modal-content {
    padding: 1.5rem 1rem;
    width: 95%;
  }

  .receipt-print-wrapper {
    padding: 1.25rem 1rem;
  }

  .modal-actions-receipt {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .modal-actions {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   Receipt Modal & Print Styles
   ========================================================================== */
.receipt-modal-content {
  max-width: 620px;
  width: 90%;
  padding: 2.2rem;
}

.success-icon {
  background: rgba(16, 185, 129, 0.15) !important;
  color: var(--success-color) !important;
}

.receipt-print-wrapper {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  border-top: 4px solid var(--primary-color);
  border-radius: var(--radius-sm);
  padding: 2rem;
  margin: 1.5rem 0;
  text-align: left;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.receipt-header-print {
  text-align: center;
  margin-bottom: 1.5rem;
}

.receipt-emblem {
  color: var(--primary-color);
  margin-bottom: 0.4rem;
}

.receipt-emblem i {
  width: 32px;
  height: 32px;
}

.receipt-header-print h3 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.5px;
}

.emblem-subtitle {
  font-size: 0.82rem;
  color: #475569;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 1px;
}

.receipt-divider {
  height: 1px;
  background: #cbd5e1;
  margin: 0.75rem auto;
  width: 80%;
}

.receipt-meta-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.receipt-badge-container {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.receipt-id-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 1px;
}

.receipt-id-val {
  font-family: monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
  background: #e2e8f0;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

.receipt-section {
  margin-bottom: 1.5rem;
}

.receipt-sec-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #475569;
  border-bottom: 1.5px solid #e2e8f0;
  padding-bottom: 0.3rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.receipt-table-details {
  width: 100%;
}

.receipt-table-details tr {
  border-bottom: 1px solid #f1f5f9;
}

.receipt-table-details tr:last-child {
  border-bottom: none;
}

.receipt-table-details td {
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: #334155;
  background: transparent !important;
  border: none !important;
  white-space: normal;
}

.receipt-table-details td.lbl {
  width: 38%;
  font-weight: 700;
  color: #64748b;
}

.receipt-table-details td.val {
  width: 62%;
  font-weight: 500;
  color: #0f172a;
}

.receipt-footer-print {
  border-top: 1.5px solid #e2e8f0;
  padding-top: 1rem;
  margin-top: 1.5rem;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.5;
}

.receipt-note-bold {
  font-weight: 700;
  color: #0f172a;
  margin: 0.6rem 0;
  font-size: 0.85rem;
}

.receipt-timestamp-print {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: right;
  margin-top: 0.75rem;
  font-style: italic;
}

.modal-actions-receipt {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.8fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.wa-share-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.wa-share-btn:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.wa-share-btn i {
  width: 18px;
  height: 18px;
}

/* Print Overrides */
@media print {
  body * {
    visibility: hidden;
  }
  #receipt-print-area, #receipt-print-area * {
    visibility: visible;
  }
  #receipt-print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border: none;
    box-shadow: none;
  }
}

/* Admin Portal Button Styles */
.admin-portal-btn {
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.2);
  color: var(--primary-color);
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
  margin-top: 0.6rem;
  outline: none;
}

.admin-portal-btn:hover {
  background: var(--primary-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
  transform: translateY(-1px);
}

.admin-portal-btn:active {
  transform: translateY(1px);
}

.admin-portal-btn i {
  width: 14px;
  height: 14px;
}

/* Theme Toggle Button Styling */
.theme-toggle-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--accent-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle-btn:hover {
  transform: scale(1.08) rotate(15deg);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.25);
  border-color: var(--primary-color);
}

.theme-toggle-btn i {
  width: 20px;
  height: 20px;
  stroke-width: 2.5px;
}

body.light-mode .theme-toggle-btn {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

body.light-mode .theme-toggle-btn:hover {
  background: #f1f5f9;
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.18);
  border-color: var(--primary-color);
}

@media (max-width: 768px) {
  .theme-toggle-btn {
    top: 1rem;
    right: 1rem;
    width: 38px;
    height: 38px;
  }
  .theme-toggle-btn i {
    width: 18px;
    height: 18px;
  }
}

/* ==========================================================================
   Light Mode Overrides
   ========================================================================== */
body.light-mode {
  color: var(--text-main);
  background-color: var(--bg-primary);
}

body.light-mode .logo-area h1 {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light-mode .card-header h2,
body.light-mode .sheet-title h2,
body.light-mode .modal-content h2 {
  color: #0f172a;
}

body.light-mode .contact-name {
  color: #0f172a;
}

body.light-mode .contact-item {
  color: var(--text-muted);
}

body.light-mode .contact-item:hover {
  color: #0f172a;
}

body.light-mode .form-field label {
  color: #1e293b;
}

body.light-mode .form-group-fieldset {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background-color: rgba(0, 0, 0, 0.02);
}

body.light-mode .section-card,
body.light-mode .sheet-container-card {
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
}

body.light-mode .input-wrapper input,
body.light-mode .input-wrapper select,
body.light-mode .input-wrapper textarea {
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

body.light-mode .input-wrapper input:focus,
body.light-mode .input-wrapper select:focus,
body.light-mode .input-wrapper textarea:focus {
  background-color: #ffffff;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2);
}

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

body.light-mode .tab-btn:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.03);
}

body.light-mode .table-responsive {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  box-shadow: inset 0 2px 8px rgba(15, 23, 42, 0.04);
}

body.light-mode .table-responsive::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border: 2px solid var(--bg-primary);
}

body.light-mode .spreadsheet-table th {
  background-color: #e2e8f0;
  color: #0f172a;
  border-right: 1px solid #cbd5e1;
  border-bottom: 2px solid #cbd5e1;
}

body.light-mode .spreadsheet-table th:hover {
  background-color: #cbd5e1;
  color: var(--primary-color);
}

body.light-mode .spreadsheet-table th:last-child:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

body.light-mode .spreadsheet-table td {
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  color: #334155;
}

body.light-mode .spreadsheet-table tbody tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.015);
}

body.light-mode .spreadsheet-table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.035);
}

body.light-mode .cell-name {
  color: #0f172a;
}

body.light-mode .search-box input {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

body.light-mode .search-box input:focus {
  background: #ffffff;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2);
}

body.light-mode .filter-box select {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

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

body.light-mode .filter-box select:focus {
  background: #ffffff;
  border-color: var(--primary-color);
}

body.light-mode .row-count-badge,
body.light-mode .row-count {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
}

body.light-mode .glow-orb {
  opacity: 0.06;
}

body.light-mode .modal-overlay {
  background-color: rgba(248, 250, 252, 0.85);
}

body.light-mode .modal-content {
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-mode .modal-content p {
  color: #475569;
}

body.light-mode .modal-content input[type="password"] {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

body.light-mode .modal-content input[type="password"]:focus {
  background: #ffffff;
  border-color: var(--primary-color);
}

body.light-mode .cancel-btn {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-muted);
}

body.light-mode .cancel-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #0f172a;
}

body.light-mode .refresh-btn {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-main);
}

body.light-mode .refresh-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #0f172a;
}

body.light-mode .app-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

body.light-mode .app-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
