/* Optional: Soften the main containers so they blend perfectly */
#container, #interactive-area, #dynamic-content-area {
  background-color: #f9f9f9;
}

/* If you want to keep the "Glass" effect on the hero banner working well, 
   ensure the main page wrapper doesn't have a grey shadow */
#dynamic-content-area {
  box-shadow: none;
}

/* Wrapper for all checkboxes */
.checkbox-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0;
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
}

/* Each checkbox row */
.checkbox-container div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #000000;
  border-radius: 8px;
  background-color: #fafafa;
  transition: background-color 0.2s ease;
}

.checkbox-container div:hover {
  background-color: #f0f0f0;
}

/* Checkbox styling */
.checkbox-container input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #0077cc; /* modern blue tone */
  cursor: pointer;
}

/* Label styling */
.checkbox-container label {
  font-size: 15px;
  color: #333;
  font-weight: 500;
  cursor: pointer;
}


/* === NEW: User Management List Styles === */

/* Container for the user's name and congregation */
.user-info {
  flex-grow: 1; /* Allows this element to take up any available space */
  min-width: 180px; /* Prevents it from getting too squished */
}

.user-name {
  font-weight: 600;
  color: #333;
  font-size: 1.1em;
  word-break: break-all; /* Prevents long names from overflowing */
}

.user-congregation {
  font-size: 0.9em;
  color: #666;
  margin-top: 2px;
}

/* Container for all the permission checkboxes */
.user-permissions {
  display: flex;
  justify-content: center; /* Centers the entire row of checkboxes */
  gap: 5px; /* Small gap between permission groups */
  flex-shrink: 0; /* Prevents this container from shrinking */
  flex-wrap: wrap; /* Allows checkboxes to wrap on very small screens */
}

/* A single permission group (label + checkbox) */
.permission-group {
  display: flex;
  flex-direction: column; /* Stack the label on top of the checkbox */
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 65px; /* Give each group a consistent width */
  padding: 5px;
  border-radius: 4px;
}

.permission-label {
  font-size: 0.75em;
  font-weight: 500;
  color: #555;
  margin-bottom: 5px;
  text-align: center; /* Ensures label text is centered */
}

.checkbox-only {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin: 0 auto; /* Centers the checkbox within its container */
  display: block; /* Ensures margin auto works properly */
}

/* Mild styles for approved and campaign (non-admin) */
.permission-group.approved {
  background-color: rgba(76, 175, 80, 0.12);  /* Gentle green */
}

.permission-group.campaign {
  background-color: rgba(173, 216, 230, 0.18);  /* Soft light blue */
}

/* More vivid styles for admin roles with strong left borders and bold text */
.permission-group.admin-campaign {
  background-color: rgba(0, 123, 255, 0.25);  /* Brighter blue */
  border-left: 5px solid rgba(0, 70, 140, 1);  /* Dark navy blue */
  font-weight: bold;
}

.permission-group.admin-cong {
  background-color: rgba(255, 193, 7, 0.3);  /* Brighter amber */
  border-left: 5px solid rgba(255, 160, 0, 1);  /* Strong orange */
  font-weight: bold;
}

.permission-group.admin-full {
  background-color: rgba(156, 39, 176, 0.25);  /* Brighter purple */
  border-left: 5px solid rgba(94, 53, 177, 1);  /* Deep violet */
  font-weight: bold;
}






/* --- STANDARDIZED CARD STYLES --- */
/* Base card structure - applies to all card types */
.dashboard-card,
.filter-card,
.card,
#filter-section,
.filter-container,
#new-year-card {
  width: 90%;
  max-width: 600px;
  margin: 20px auto;
  box-sizing: border-box;
  background-color: #ffffff;
  border-radius: 8px;
  border: 2px solid #000000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

/* Hover effect for interactive cards */
.dashboard-card:hover,
.filter-card:hover,
.card:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* --- STANDARDIZED CARD HEADERS --- */
.card-header,
.dashboard-card .card-header,
.filter-card .card-header {
  margin: 0;
  padding: 16px 20px;
  background-color: #f7f9fc;
  border-bottom: 1px solid #e0e0e0;
  font-size: 1.1em;
  font-weight: 600;
  color: #333;
  word-wrap: break-word;
  overflow-wrap: break-word;
}


/* --- STANDARDIZED CARD CONTENT --- */
.card-content,
.filter-card-content,
.dashboard-card .card-content .filter-card-content {
  padding: 20px;
  box-sizing: border-box;
  width: 90%;
  margin: auto;
}

/* Special layout for filter cards */
.filter-card-content {
  display: block;  
  gap: 15px;
}

.filter-card-content .filter-group {
  min-width: 200px;
  box-sizing: border-box;
}

/* --- STANDARDIZED FORM CONTROLS --- */
/* All form inputs and selects follow the same styling */
.filter-card-content select,
.filter-card-content input,
.card-content select,
.card-content input,
.dashboard-card select,
.dashboard-card input,
#new-year-card select,
#new-year-card input,
.standardized-input,
.standardized-select {
  width: 100%;
  padding: 12px;
  font-size: 1em;
  border-radius: 6px;
  border: 1px solid #ccc;
  background-color: #fdfdfd;
  box-sizing: border-box;
  margin-bottom: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Focus states for form controls */
.filter-card-content select:focus,
.filter-card-content input:focus,
.card-content select:focus,
.card-content input:focus,
.dashboard-card select:focus,
.dashboard-card input:focus,
#new-year-card select:focus,
#new-year-card input:focus,
.standardized-input:focus,
.standardized-select:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* --- STANDARDIZED LABELS --- */
.filter-card-content label,
.card-content label,
.dashboard-card label,
#new-year-card label,
.standardized-label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: #555;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* --- STANDARDIZED BUTTONS (Changed to Blue) --- */
.card-button,
.filter-card button,
.card-content button,
.dashboard-card button,
#new-year-card button {
  padding: 12px 24px;
  font-size: 1em;
  font-weight: 600;
  border: 2px solid #007bff;     /* Added Blue Border */
  border-radius: 12px;           /* Curved Edges */
  background-color: #f0f7ff;     /* Light Blue Background */
  color: #004085;                /* Dark Blue Text */
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

/* Hover State */
.card-button:hover,
.filter-card button:hover,
.card-content button:hover,
.dashboard-card button:hover,
#new-year-card button:hover {
  background-color: #e1efff;
  border-color: #0056b3;
}

.card-button:active,
.filter-card button:active,
.card-content button:active,
.dashboard-card button:active,
#new-year-card button:active {
  transform: translateY(0);
}

/* Secondary button style */
.card-button.secondary,
.filter-card button.secondary,
.card-content button.secondary,
.dashboard-card button.secondary,
#new-year-card button.secondary {
  background-color: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
}

.card-button.secondary:hover,
.filter-card button.secondary:hover,
.card-content button.secondary:hover,
.dashboard-card button.secondary:hover,
#new-year-card button.secondary:hover {
  background-color: #e8e8e8;
}

/* --- CONTENT AREA LAYOUT --- */
#dynamic-content-area {
  display: block;
    margin: 20px auto;
  gap: 25px;
  width: 100%;
  box-sizing: border-box;
  padding: 0 10px;
}

/* --- RESPONSIVE DESIGN --- */
/* Tablet breakpoint */
@media (max-width: 768px) {
  #interactive-area {
    width: 98%;
    margin: 10px auto;
    padding: 0 5px;
  }
  
  .dashboard-card,
  .filter-card,
  .card,
  #filter-section,
  .filter-container,
  #new-year-card {
    width: 98%;
    margin: 15px auto;
  }
  
  .card-header,
  .dashboard-card .card-header,
  .filter-card .card-header {
    padding: 12px 15px;
    font-size: 1em;
  }
  
  .card-content,
  .filter-card-content,
  .dashboard-card .card-content .filter-card-content  {
    padding: 15px;
  }
  

  
  .filter-card-content .filter-group {
    min-width: 150px;
  }
  
  #hero-image-banner {
    height: 180px; /* Adjust this to your liking */
    width: 100%;
    transition: background-image 0.5s ease-in-out; /* Smoothly fade between images */
}
  
  #hero-image-banner h1 {
    font-size: 2.2em;
    padding: 0 15px;
  }
}

/* Mobile breakpoint */
@media (max-width: 480px) {
  .dashboard-card,
  .filter-card,
  .card,
  #filter-section,
  .filter-container,
  #new-year-card {
    width: 100%;
    margin: 10px auto;
    border-radius: 4px;
  }
  
  .card-header,
  .dashboard-card .card-header,
  .filter-card .card-header {
    padding: 10px 12px;
    font-size: 0.95em;
  }
  
  .card-content,
  .filter-card-content,
  .dashboard-card .card-content .filter-card-content  {
    padding: 12px;
  }
  

  
  .card-button,
  .filter-card button,
  .card-content button,
  .dashboard-card button,
  #new-year-card button {
    padding: 10px 20px;
    font-size: 0.95em;
  }
  
  #hero-image-banner h1 {
    font-size: 1.8em;
  }
  
  #dynamic-content-area {
    gap: 20px;
    padding: 0 5px;
  }
}

/* Very small mobile devices */
@media (max-width: 320px) {
  
  .card-header,
  .dashboard-card .card-header,

  
  .filter-card-content select,
  .filter-card-content input,
  .card-content select,
  .card-content input,
  .dashboard-card select,
  .dashboard-card input,
  #new-year-card select,
  #new-year-card input {
    font-size: 0.9em;
  }
}


/* --- DASHBOARD STYLES --- */
/* The main container for the dashboard after login */
#interactive-area {
  width: 90%;
  max-width: 600px;
  margin: 10px auto;
  display: none;
  box-sizing: border-box;
  padding: 0 10px;
}

/* The banner image at the top */
#hero-image-banner {
  height: 200px;
  border-radius: 12px;
  background-color: #333;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
  margin-bottom: 30px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  width: 100%;
  box-sizing: border-box;
}

/* Dark overlay on the banner to make text readable */
#hero-image-banner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
}

#hero-image-banner h1 {
  position: relative;
  font-size: 2.8em;
  font-weight: 600;
  text-align: center;
  margin: 0;
  padding: 0 20px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}


#start-process-btn {
  padding: 12px 10px;
   background-color: #1976d2; /* solid color fallback */
  background-image: linear-gradient(135deg, #2196f3, #1565c0);
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: all 0.25s ease;
  margin: 16px auto;
  display: block; /* when shown */
}

#start-process-btn:hover {
  background: linear-gradient(135deg, #1976d2, #0b3c91);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#start-process-btn:active {
  transform: translateY(1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}


#confirm_cong_btn {
  display: none; /* shown later by JS */
  padding: 12px 24px;
  background: linear-gradient(135deg, #2196f3, #0d47a1);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all 0.25s ease;
  margin: 16px auto;
  display: block; /* when shown */
}

#confirm_cong_btn:hover {
  background: linear-gradient(135deg, #1976d2, #0b3c91);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#confirm_cong_btn:active {
  transform: translateY(1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

#confirm_cong_btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}





.service-year-content {
    text-align: center;
}



.action-button {
    justify-content: center;
    background-color: #007bff;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.action-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.action-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}







  .special-row {
    font-weight: bold;
    background-color: #fdf5e6; /* light warm yellow background */
  }

/* ==================== */
/* UNIFIED ACCORDION STYLES */
/* ==================== */

.territory-accordion-container {
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Territory Cards */
.territory-card {
    background: white;
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

/* ==================== */
/* PARENT TERRITORY CARDS */
/* ==================== */
.parent-card {
    border-left: 6px solid;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.parent-card.status-active {
    border-left-color: #dc3545;
}

.parent-card.status-available {
    border-left-color: #007bff;
}

.parent-card.status-none {
    border-left-color: #6c757d;
}

.parent-card .card-header {
    background: linear-gradient(135deg, #d4e6ff 0%, #b8d4ff 100%);
    padding: 20px;
    border-top: 3px solid #0052a3;
    border-right: 3px solid #0052a3;
    border-left: 3px solid #0052a3;
}

/* ==================== */
/* CHILD TERRITORY CARDS */
/* ==================== */
.child-card {
    margin-left: 16px;
    border-left: 4px solid;
    transition: margin 0.2s;
}

.child-card.status-active {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.child-card.status-active .card-header {
    background: #ffe6e6;
}

.child-card.status-returned {
    border-left-color: #28a745;
    background: #f0fff4;
}

.child-card.status-returned .card-header {
    background: #e6ffe6;
}

.child-card.status-available {
    border-left-color: #6c757d;
    background: #ffffff;
}

.child-card.status-available .card-header {
    background: #f0f0f0;
}

/* Card Header */
.card-header {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    transition: background 0.2s;
    font-weight: 600;
}

.parent-card .card-header {
    cursor: default;
    color: #002966;
}

.child-card .card-header:hover {
    filter: brightness(0.98);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 200px;
}

.accordion-icon {
    font-size: 12px;
    color: #666;
    width: 16px;
    text-align: center;
    transition: transform 0.2s;
}

.territory-number {
    font-size: 20px;
    font-weight: 800;
    background: rgba(0,0,0,0.05);
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.territory-description {
    font-size: 16px;
    font-weight: 500;
    color: #002966;
    line-height: 1.4;
    word-break: break-word;
}

.subdivision-description {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
    word-break: break-word;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Status Badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255,255,255,0.9);
}

.status-badge.status-active {
    background: #dc3545;
    color: white;
}

.status-badge.status-available {
    background: #007bff;
    color: white;
}

.status-badge.status-returned {
    background: #28a745;
    color: white;
}

.status-badge.status-none {
    background: #6c757d;
    color: white;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-text {
    font-size: 12px;
    font-weight: 600;
}

.status-text.status-active {
    color: #dc3545;
}

.status-text.status-returned {
    color: #28a745;
}

.status-text.status-available {
    color: #6c757d;
}

.holder-name {
    font-size: 14px;
    font-weight: 600;
    background: rgba(255,255,255,0.3);
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.holder-badge {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

/* Card Content */
.card-content {
    padding: 0 20px 20px 20px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
}

.parent-card .card-content {
    border-bottom: 3px solid #0052a3;
    border-right: 3px solid #0052a3;
    border-left: 3px solid #0052a3;
}

.child-card .card-content {
    border-bottom: 1px solid #666;
    border-right: 1px solid #666;
    border-left: 1px solid #666;
}

.card-content.collapsible {
    display: none;
}

/* Content Rows */
.content-row {
    margin-top: 16px;
}

.content-row:first-child {
    margin-top: 20px;
}

.content-label {
    font-size: 11px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.content-value {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    word-break: break-word;
}

/* Assignment Details */
.assignment-details {
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.detail-value {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}

/* Action Buttons */
.actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.action-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.assign-btn {
    background: #007bff;
    color: white;
}

.assign-btn:hover {
    background: #0056b3;
}

.return-btn {
    background: #dc3545;
    color: white;
}

.return-btn:hover {
    background: #c82333;
}

.reassign-btn {
    background: #ffc107;
    color: #333;
}

.reassign-btn:hover {
    background: #e0a800;
}

/* Empty State */
.content-value.empty-message {
    color: #999;
    font-style: italic;
    background: #f8f9fa;
    border: 1px dashed #ccc;
    text-align: center;
    padding: 16px;
}

.empty-state {
    opacity: 0.8;
}

/* Subdivisions Header */
.subdivisions-header {
    padding: 10px 16px;
    margin: 10px 0;
    background: #e5e5e5;
    border-radius: 8px;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-left: 4px solid #666;
}

.subdivisions-icon {
    margin-right: 8px;
}

/* No subdivisions message */
.no-subdivisions {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #e0e0e0;
    margin-top: 20px;
}

/* ==================== */
/* DESKTOP ENHANCEMENTS */
/* ==================== */
@media (min-width: 1024px) {
    .territory-accordion-container {
        max-width: 1000px;
    }
    
    .child-card {
        margin-left: 30px;
    }
    
    .card-header {
        padding: 20px 24px;
    }
    
    .territory-number {
        font-size: 24px;
    }
    
    .territory-description {
        font-size: 18px;
    }
    
    .card-content {
        padding: 0 24px 24px 24px;
    }
    
    .action-btn {
        min-width: 160px;
    }
}

/* ==================== */
/* MOBILE OPTIMIZATIONS */
/* ==================== */
@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
    }
    
    .header-left {
        width: 100%;
        min-width: 0;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .child-card {
        margin-left: 8px;
    }
    
    .action-btn {
        min-width: 100%;
    }
    
    .territory-number {
        font-size: 18px;
        padding: 2px 8px;
    }
    
    .territory-description {
        font-size: 15px;
    }
    
    .subdivision-description {
        font-size: 13px;
    }
    
    .holder-name, .holder-badge {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .detail-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .detail-label {
        margin-bottom: 4px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .territory-number {
        font-size: 16px;
    }
    
    .territory-description {
        font-size: 14px;
    }
    
    .status-badge, .status-text {
        font-size: 11px;
    }
    
    .content-value {
        font-size: 13px;
        padding: 6px 10px;
    }
}

/* ==================== */
/* ASSIGNMENT INTERFACE STYLES */
/* ==================== */

.assignment-controls {
    background: white;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    margin-top: 8px;
}

.slot-control {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.slot-control:last-child {
    border-bottom: none;
}

.slot-control.history-slot {
    background: #f8f9fa;
    opacity: 0.9;
}

.slot-label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slot-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 4px 0;
}

.slot-row:last-child {
    margin-bottom: 0;
}

.slot-value {
    flex: 1;
    padding: 10px 12px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.slot-value:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.slot-value.filled {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #0d47a1;
    font-weight: 600;
}

.slot-value.empty {
    color: #999;
    font-style: italic;
}

.date-value {
    flex: 1;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: monospace;
    text-align: center;
}

.date-value:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.date-value.filled {
    background: #fff3e0;
    border-color: #ff9800;
    color: #e65100;
    font-weight: 600;
}

.date-value.empty {
    color: #999;
    font-style: italic;
}

.history-label {
    font-size: 12px;
    color: #666;
    width: 60px;
    flex-shrink: 0;
}

.history-value {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

/* History items */
.assignment-history {
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.history-item {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.history-item:last-child {
    border-bottom: none;
}

.history-publisher {
    font-weight: 600;
    color: #333;
}

.history-dates {
    font-size: 12px;
    color: #666;
    font-family: monospace;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .slot-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .slot-label {
        margin-bottom: 4px;
    }
    
    .slot-value, .date-value {
        width: 100%;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .history-dates {
        margin-top: 4px;
    }
}

/* ==================== */
/* STANDARDIZED DROPDOWN CONTROLS */
/* ==================== */
/* Base dropdown styling - applies to all dropdowns */
.admin-style-dropdown {
  width: 90%;
  margin: 0 auto;
  padding: 12px 36px 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background-color: #eef2f6;
  color: #1a202c;
  box-shadow: 
    0 1px 2px rgba(0,0,0,0.05),
    0 1px 1px rgba(0,0,0,0.03);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
  cursor: pointer;
  height: 44px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

/* Focus state - standardized across all dropdowns */
.admin-style-dropdown:focus {
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
  outline: none;
  background-color: #ffffff;
}

/* Hover state - standardized across all dropdowns */
.admin-style-dropdown:hover {
  border-color: #cbd5e0;
  background-color: #f9fafb;
}

/* Option styling - standardized across all dropdowns */
.admin-style-dropdown option {
  padding: 10px 14px;
  background: #ffffff;
  color: #1a202c;
}

.admin-style-dropdown option:hover {
  background: #edf2f7 !important;
}

.admin-style-dropdown option:checked {
  background: #ebf4ff !important;
  font-weight: 500;
  position: relative;
}

.admin-style-dropdown option:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  background-color: #4299e1;
  border-radius: 50%;
}

/* Unified Selection Block: Reduces gap between dropdowns */
.card-content {
    display: flex;
    flex-direction: column;
    gap: 5px !important; /* Forces dropdowns to sit tight together */
    padding: 10px 15px !important;
}






/* ==================== */
/* SPECIFIC DROPDOWN CONTAINERS */
/* ==================== */

/* Assignee dropdown container */
#assignee-dropdown {
  display: none;
}

#assignee-dropdown.assignee-filter {
  display: none;
}

/* Congregation dropdown */
#cong-dropdown {
  display: none;
}

/* ==================== */
/* CONTAINER LAYOUTS */
/* ==================== */

/* Subdivided container - maintains original layout */
.subdivided-container {
  display: none;
}

#res-dropdown.filter-row {
  display: none;
}


/* ==================== */
/* RESPONSIVE ADJUSTMENTS */
/* ==================== */

/* Tablet breakpoint */
@media (max-width: 768px) {
  .subdivided-row,
  .dropdown-row {
    width: 95%;
    gap: 12px;
  }
  
  .subdivided-group,
  #res-dropdown .filter-group {
    min-width: 150px;
  }
  
  #assignee-dropdown,
  #cong-dropdown {
    min-width: 150px;
  }
  
.res-dropdown-container {
  width: 90%;
  max-width: 600px;  /* Changed from 800px */
  margin: 0 auto;
}
}

/* Mobile breakpoint */
@media (max-width: 480px) {
  .subdivided-dropdown,
  .modernized-dropdown,
  .territory-type-dropdown,
  .calm-dropdown,
  #publisher-filter {
    max-width: 100%;
    font-size: 14px;
  }
  
.dropdown-row {
  display: block;
  justify-content: center;
  gap: 16px;
  width: 90%;
  max-width: 700px;  /* Changed from 800px */
  margin: 0 auto;
}
  
  .subdivided-group,
  #res-dropdown .filter-group,
  #assignee-dropdown,
  #cong-dropdown {
    width: 100%;
    min-width: unset;
    max-width: 100%;
  }
  
  .res-dropdown-container {
    width: 100%;
  }
  
  #res-dropdown.filter-row {
    gap: 10px;
  }
  
  .button-group {
    gap: 8px;
  }
}

/* Touch device adjustments */
@media (hover: none) and (pointer: coarse) {
  .subdivided-dropdown,
  .modernized-dropdown,
  .territory-type-dropdown,
  .calm-dropdown,
  #publisher-filter {
    padding: 14px 40px 14px 16px;
    height: 46px;
    font-size: 16px;
  }
  
  .subdivided-dropdown option,
  .modernized-dropdown option,
  .territory-type-dropdown option,
  .calm-dropdown option,
  #publisher-filter option {
    padding: 12px 16px;
  }
}

/* Very small screens */
@media (max-width: 320px) {
  .subdivided-dropdown,
  .modernized-dropdown,
  .territory-type-dropdown,
  .calm-dropdown,
  #publisher-filter {
    padding: 12px 32px 12px 12px;
    font-size: 14px;
  }
  
  .subdivided-container {
    margin-bottom: 12px;
  }
  
  .subdivided-row,
  .dropdown-row {
    gap: 8px;
  }
}




.copper-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #8B4513; /* 'SaddleBrown' - a rich, dark brown for text */
  text-shadow: 0 1px 1px rgba(255, 250, 245, 0.7);
}

/* --- Mild Copper Themed Form Input Field --- */
.copper-input {
  /* Sizing and Layout */
  width: 90%;
  max-width: 600px;
  padding: 10px;
  box-sizing: border-box;

  /* Look & Feel */
  background-color: #FFFFFF;
  border: 1px solid #d1c0b8; /* A soft, dusty copper-like border */
  border-radius: 4px;
  font-size: 1em;
  color: #333;
  
  /* Smooth transition for the focus effect */
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* --- The "Focus" State (When you click in the input) --- */
.copper-input:focus {
  /* A warm copper/orange glow */
  border-color: #B87333; /* A richer, solid copper color */
  box-shadow: 0 0 0 3px rgba(184, 115, 51, 0.25);
  outline: none; /* Remove the default browser outline */
}

/* --- Mild Copper Themed Checkbox Area --- */
.copper-checkbox-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.copper-checkbox-group label {
  font-size: 0.9em;
  color: #8B4513;
  cursor: pointer;
}

.copper-checkbox-group input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #B87333; /* Styles the checkmark color in modern browsers */
}

/* --- Classic Copper Button --- */
.copper-button-small,
.copper-button {
  /* Sizing and Layout */
  display: inline-block;
  
  /* Typography */
  color: #6B4F43; /* A dark, brownish-copper for text */
  font-weight: bold;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 245, 238, 0.8);

  /* The Mild Copper Look & Feel */
  border: 1px solid #b39a8f; /* A darker version of the gradient's end */
  border-radius: 6px;
  /* A very soft copper gradient */
  background-image: linear-gradient(to bottom, #f0e1d9, #e0d0c8);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  
  /* Interactivity */
  cursor: pointer;
  transition: all 0.2s ease-out;
}

/* Specifics for the LARGE button */
.copper-button {
  max-width: 350px;
  width: 100%;
  padding: 12px 20px;
  font-size: 1.1em;
}

/* Specifics for the SMALL button */
.copper-button-small {
  width: 120px; 
  padding: 4px 16px; 
  font-size: 0.8em;
}

/* --- Hover State --- */
.copper-button-small:hover,
.copper-button:hover {
  background-image: linear-gradient(to bottom, #e9d6cc, #d9c5bd);
  border-color: #a98f84;
}

/* --- Active (Pressed) State --- */
.copper-button-small:active,
.copper-button:active {
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2);
  background-image: linear-gradient(to bottom, #d9c5bd, #e9d6cc);
  transform: translateY(1px);
}

/* --- Silver Themed Form Container --- */
.silver-container {
  /* Layout */
  display: flex;
  flex-direction: column;
  gap: 16px; /* Modern way to add space between elements, replaces <br> */
  width: 95%;
  max-width: 600px;
  margin: 16px auto;
  padding: 24px;
  box-sizing: border-box;
  
  /* The Silver Look */
  background-color: #F5F5F5; /* Light part of the silver gradient for the base */
  border: 1px solid #999;
  border-radius: 8px; /* Slightly larger radius for the main container */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}






/* Keep the themed error text for consistency */
.themed-error-text {
  color: #e57373;
  margin-top: 10px;
  font-weight: 500;
  display: none;
}
  /* Added basic styles for password dialog and confirmation dialog boxes */
  .dialog-box, #confirmation-dialog {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: white;
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 5px 15px rgba(0,0,0,0.3);
      z-index: 1000;
      min-width: 300px;
      text-align: center;
  }
   #password-dialog-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
  .dialog-title {
      margin-top: 0;
      margin-bottom: 15px;
      font-size: 18px;
      color: #333;
  }
  .password-input {
      width: calc(100% - 16px); /* Adjust width for padding */
      padding: 8px;
      margin-bottom: 10px;
      border: 1px solid #ccc;
      border-radius: 4px;
  }
  .password-error {
      color: red;
      font-size: 14px;
      margin-top: 5px;
      margin-bottom: 15px;
  }
  .dialog-buttons, .confirmation-buttons {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      margin-top: 10px;
  }
  .submit-btn, .cancel-btn, #confirm-cancel, #confirm-ok {
      padding: 6px 12px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
      font-size: 14px;
  }
  .submit-btn {
      background: #007bff;
      color: white;
  }
  .cancel-btn, #confirm-cancel {
      background: #adb5bd;
      color: #fff;
  }
  #confirm-ok {
      background: #c86b6b;
      color: #fff;
  }
    #confirm-cancel:hover { background: #979fa7; }
    #confirm-ok:hover { background: #b35a5a; }


  /* Existing styles for interactive elements - Adjusting layout properties */
  .filter-group {
    display: flex; /* Keep flex */
    flex-direction: column; /* Keep flex-direction */
    width: 100%; /* Make it fill the parent container */
    box-sizing: border-box;
    justify-content: center;
  }

  .filter-group label {
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
  }

.full-admin-dropdown {
  padding: 7px 36px 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background-color: #eef2f6;
  color: #1f2937;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  appearance: none;
  transition: all 0.2s ease;
  display: none; /* Keeping this as required */
  box-sizing: border-box;
  cursor: pointer;
  height: 44px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px 50%;
  background-size: 16px;
}

#full-admin-dropdown:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  outline: none;
  background-color: #ffffff; /* Brighter background on focus */
}

#full-admin-dropdown:hover {
  border-color: #9ca3af;
  background-color: #f0f0f0;
}

/* Modern option styling */
#full-admin-dropdown option {
  padding: 10px 16px; /* Slightly more padding */
  background: #ffffff;
  color: #1f2937;
  font-size: 14px; /* Slightly smaller font for options */
  transition: all 0.15s ease;
}

#full-admin-dropdown option:hover {
  background: #f3f4f6 !important;
  color: #111827; /* Slightly darker text on hover */
}

#full-admin-dropdown option:checked {
  background: #f8fafc !important; /* Match dropdown background */
  color: #1f2937;
  font-weight: 500; /* Normal weight with subtle background */
  position: relative;
}

/* Add a subtle indicator for selected option */
#full-admin-dropdown option:checked::before {
  content: "•";
  color: #3b82f6;
  position: absolute;
  left: 8px;
}

.filter-group {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0 auto 10px auto;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

.button-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap; /* ensures wrapping on small screens */
  justify-content: center;
}

/* Button styling (if not already handled globally) */
.button-group button {
  padding: 8px 16px;
  font-weight: 500;
  min-width: 120px;
  max-width: 200px;

  border-radius: 6px;
  color: #0d0d0d;
  cursor: pointer;
}

/* Specific colors */
.delete-btn {
  background-color: #f8e7e7;
  border: 1px solid #8b7e74;
}

.add-btn {
  background-color: #e6f1ec;
  border: 1px solid #91b4a3;
}

/* Optional: Slightly different color for the third button */
.add-btn:last-child {
  background-color: #e0ecf8;
  border: 1px solid #7a9dbb;
}

/* Responsive stacking for mobile */
@media (max-width: 600px) {
  .button-group {
    flex-direction: column;
    align-items: center;
  }

  .button-group button {
    width: 100%;
    max-width: 300px;
  }
}


  /* Table responsive container - kept existing centering */
  .table-responsive {
    max-width: 297mm; /* Keep print-specific max-width */
    overflow-x: auto;
    margin: 20px auto 0; /* Keep existing centering */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

 


  /* General form element styles */
  select,
  button {
    padding: 8px;
    border-radius: 4px;
    font-size: 16px;
    transition: background-color 0.3s, border-color 0.3s;
    box-sizing: border-box; /* Add box-sizing */
  }

  select {
    border: 1px solid #ccc;
    background-color: white;
  }

  select:focus {
    border-color: var(--primary-color);
    outline: none;
  }

  button {
    border: none;
    /* Background/color handled by specific classes/inline styles */
    min-width: 100px;
    cursor: pointer;
  }

  button:disabled {
    background-color: var(--disabled-color);
    cursor: not-allowed;
  }

    /* Specific adjustments for elements inside #register-container to use 100% width */
  #register-container #assignee-form input[type="text"],
  #register-container #assignee-form select {
    width: 100%;
    box-sizing: border-box;
  }

#registration-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px; /* vertical spacing between elements */
}

.lower-action-links {
  display: flex;
  justify-content: center;
  gap: 20px; /* horizontal space between links */
}





  /* Styles related to table content (not the container layout) - kept as is */
  /* ... (ter_desc, checked-out classes, table, th, td, etc.) ... */
    /* ========== ROOT VARIABLES ========== */
  :root {
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --disabled-color: #cccccc;
    --table-border: #000000;
    --header-border: #c0c0c0;
    --row-hover: #f5f5f5;
    --even-row: #f9f9f9;
    --territory-color: #d6f1ee;
    --date-color: #f0f8ff;
    --date-header-color: #f5f5f5;
    --date-header-text: #ffffff;
    --editable-color: #fff8e1;
    --editable-hover: #ffecb3;
    --error-bg: #f8d7da;
    --error-border: #f5c6cb;
    --error-text: #721c24;
    --success-bg: #d4edda;
    --success-border: #c3e6cb;
    --success-text: #155724;
    --lime-bg: #f2f29e;
    --header-color: #f5f5f5;
    --light-text-color: #888888;
  }


  /* ========== DESCRIPTION COLUMN ========== */
  td[data-column="ter_desc"],
  th.ter-desc-header {
    width: 50px; /* Base width */
    min-width: 200px; /* Minimum width */
    max-width: 200px; /* Maximum width */
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    box-sizing: border-box;
    overflow: hidden;
    max-width: 65%;
  }

  /* ========== CHECKED OUT TABLE STYLES ========== */


/* Styling for the entire table */
.grouped-checkout-table {
    max-width: 600px; /* Total max width of the table */
    margin: 0 auto; /* Center the table */
    border-collapse: collapse; /* Clean borders */
    table-layout: fixed; /* Ensure consistent column widths */
    background-color: #ffffff; /* White background for the table */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
    font-family: 'Arial', sans-serif; /* Clean, professional font */
}



/* General styling for table cells */
.grouped-checkout-table td {
    padding: 8px; /* Comfortable padding */
    border-bottom: 1px solid #e0e0e0; /* Subtle row separator */
    font-size: 14px; /* Readable font size */
}

/* Description row (spans all columns) */
.territory-description-cell {
    background-color: #d3e6f5; /* Light blue to match return button */
    font-weight: bold; /* Align with .checked-out-cong-name */
    padding: 10px; /* Slightly more padding for prominence */
    border-bottom: 2px solid #7da9c4; /* Blue border to match theme */
    text-align: left; /* Align content to the left */
    margin-left: 10px; /* Margin from the left side of the box */
}

/* Type column (Residential/Business) */
.grouped-checkout-table .territory-details-row td:nth-child(1) {
    text-align: center; /* Align with .checked-out-ter-type */
}

/* Map Type column (Full Map/Part Map) */
.grouped-checkout-table .territory-details-row td:nth-child(2) {
    text-align: center; /* Consistent with Type column */
}

/* Date column (dd/mm/yy) */
.grouped-checkout-table .territory-details-row td:nth-child(3) {
    background-color: #fff2cc; /* Light yellow from .checked-out-date */
    text-align: center; /* Align with .checked-out-date */
}

/* --- Styles for the "Personal Assignments" Table --- */

/* Main table layout */
.grouped-checkout-table {
    width: 600px;
    border-collapse: collapse;
    table-layout: fixed; /* CRUCIAL: This forces the table to obey the colgroup widths */
    margin-bottom: 25px; /* Space between congregation tables */
}

/* Column widths using colgroup */
.grouped-checkout-table col:nth-child(1) { /* Type (Residential/Business) */
    width: 25%;
}
.grouped-checkout-table col:nth-child(2) { /* Map Type (Full Map/Subdivision) */
    width: 25%;
}
.grouped-checkout-table col:nth-child(3) { /* Date (dd/mm/yy) */
    width: 20%;
}
.grouped-checkout-table col:nth-child(4) { /* Return Button */
    width: 30%;
}

/* Style for the description row that spans all columns */
.territory-description-cell {
    padding: 8px 5px;
    font-weight: 500;
    background-color: #f4f6f8;
    border-bottom: 1px solid #e1e5e9;
    background-color: #d3e6f5;
}

/* General styling for the detail cells */
.territory-details-row td {
    padding: 6px 5px;
    text-align: center;
    vertical-align: middle;
    font-size: 13px;
}

/* --- Corrected Return Button Style --- */
.checked-out-return-btn {
    /* Basic Appearance (Keep these) */
    background-color: #d3e6f5;
    color: #274e13;
    border: 1px solid #93c47d;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 12px;

}

.checked-out-return-btn:hover {
  background-color: #93c47d;
  color: white;
}

/* Congregation header */
.cong-group-header {
    font-weight: bold; /* Align with .checked-out-cong-name */
    padding: 15px 15px 8px 15px; 
    margin: 10px auto 10px; /* Increased margin for more space outside */
    border-radius: 4px;
    max-width: 600px;
}

/* Territory number within description row */
.territory-description-cell strong {
    color: #134e7b; /* Darker blue to match theme */
    padding: 2px 5px; /* Subtle highlight */
    border-radius: 3px;
    margin-left: 10px; /* Align with description cell margin */
}

/* Territory name and description (within description row) */
.territory-description-cell em {
    min-width: 50px; /* From .checked-out-ter-desc */
    max-width: 200px; /* From .checked-out-ter-desc */
    overflow: visible;         /* allow content to overflow naturally */
    text-overflow: unset;      /* disable ellipsis */
    white-space: normal;       /* allow line breaks */
    word-wrap: break-word;  
    margin-left: 10px; /* Margin from the left side of the box */
}

  /* ========== TABLE STYLES ========== */
  table {
    max-width 600px;
    border-collapse: collapse;
    font-size: 14px;
  }

  th,
  td {
    border: 1px solid var(--table-border) !important; /* Using !important to override potential conflicts */
    padding: 12px;
    text-align: center;
    vertical-align: middle;
    height: 40px;
    min-height: 40px;
    box-sizing: border-box;
  }

  th {
    font-weight: bold;
    // position: sticky;
    // top: 0;
    background-color: var(--header-color);
    border-bottom: 2px solid var(--header-border);
  }

  .name-header {
    position: left
  }

  .name-header,
  .description-header {
    background-color: var(--header-color);
    color: #666;
  }

  .editable-header {
    background-color: var(--editable-hover);
  }

  th.date-cell-header {
    background-color: var(--date-header-color);
  }

  tr:nth-child(even) {
    background-color: var(--even-row);
  }

  tr:hover {
    background-color: var(--row-hover);
  }

  /* ========== EDITABLE + DATE CELLS ========== */
  .date-cell,
  .editable-cell {
    cursor: pointer;
    background-color: var(--editable-color);
    position: relative;
    transition: background-color 0.2s;
  }

  .date-cell:hover {
    background-color: ffffff;
  }

  .editable-cell:hover {
    background-color: var(--editable-hover);
  }

  .editable-cell:hover::after {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0.7;
  }

  .editable-cell input,
  .date-cell input {
    padding: 5px;
    border: 1px solid #66afe9;
    border-radius: 3px;
    font: inherit;
    box-sizing: border-box;
    box-shadow: 0 0 5px rgba(102, 175, 233, 0.3);
    text-align: center;
  }

  td:empty::before {
    content: "\00a0";
  }

  /* ========== NOTIFICATION STYLES ========== */
  .notification {
    padding: 12px 15px;
    margin-bottom: 15px;
  }

#new-territory-form {
  max-width: 90%;
  margin: 30px auto;
  padding: 24px 30px;
  background: #f9f9fb;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  box-sizing: border-box;
}

/* --- Form Field Groups --- */
#new-territory-form .form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

/* --- Labels --- */
#new-territory-form .form-group label {
  margin-bottom: 6px;
  font-weight: 600;
  color: #333;
  font-size: 0.95em;
}

/* --- Inputs and Dropdowns --- */
#new-territory-form .form-group input[type="text"],
#new-territory-form .form-group input[type="number"],
#new-territory-form .form-group select {
  width: 100%;
  padding: 10px 12px;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #fff;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#new-territory-form .form-group input:focus,
#new-territory-form .form-group select:focus {
  border-color: #81c8ee;
  box-shadow: 0 0 0 3px rgba(129, 200, 238, 0.25);
  outline: none;
}

/* --- Submit Button --- */
#new-territory-form button[type="submit"] {
  background-color: #3367d6;
  color: white;
  font-weight: 600;
  font-size: 0.95em;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.25s ease;
  display: block;
  margin: 10px auto 0;
}

#new-territory-form button[type="submit"]:hover {
  background-color: #2a5cb8;
}

/* --- Cancel Button --- */
#new-territory-form button#cancel-new-territory-btn {
  background-color: #e0e0e0;
  color: #333;
  font-weight: 500;
  font-size: 0.95em;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-left: 10px;
  transition: background-color 0.25s ease;
}

#new-territory-form button#cancel-new-territory-btn:hover {
  background-color: #d0d0d0;
}

/* --- Button Container --- */
#new-territory-form .button-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* --- Legal Notice --- */
.info-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    background: white;
    border-radius: 16px;
    padding: 32px 28px;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    z-index: 10000;
}

.info-box-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: none;
}

.info-box-title {
    font-size: 13px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.info-box-label {
    font-size: 13px;
    color: #888;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.info-box-code {
    font-size: 42px;
    font-weight: 800;
    color: #2c3e50;
    font-family: 'SF Mono', 'Monaco', 'Fira Code', monospace;
    margin-bottom: 24px;
}

.info-box-code-bus {
    color: #00a085;
}

.info-box-close {
    margin-top: 10px;
    padding: 10px 30px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}


/* --- New Congregation Form --- */

/* Container */
#new-cong-form.form-container {
  max-width: 600px;
  margin: 20px auto;
  padding: 24px;
  background-color: #f9f9fb;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  box-sizing: border-box;
}

/* Title */
#new-cong-form .form-title {
  text-align: center;
  color: #3367d6;
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.25em;
  font-weight: 600;
}

/* Label */
#new-cong-form .form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
  font-size: 0.95em;
}

/* Info Box */
#new-cong-form .info-box {
  margin-bottom: 20px;
  font-size: 13px;
  color: #2b4e72;
  background-color: #e6f2fa;
  padding: 10px 14px;
  border-left: 4px solid #81c8ee;
  border-radius: 6px;
}

#new-cong-form .info-box p {
  margin: 4px 0;
}

/* Input */
#new-cong-form .form-input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 20px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1em;
  box-sizing: border-box;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#new-cong-form .form-input:focus {
  border-color: #81c8ee;
  box-shadow: 0 0 0 3px rgba(129, 200, 238, 0.25);
  outline: none;
}

/* Button */
#new-cong-form .form-button {
  width: 100%;
  padding: 12px;
  background-color: #3367d6;
  color: white;
  font-size: 1em;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.25s ease;
}

#new-cong-form .form-button:hover {
  background-color: #2a5cb8;
}

/* Message Box */
#new-cong-form .form-message {
  margin-top: 15px;
  padding: 10px;
  border-radius: 6px;
  text-align: center;
  min-height: 1.2em;
  font-size: 14px;
  color: #333;
}

/* New Year Warning ?*
/* Warning Box Container */
.warning-box {
  background-color: #fefefe;
  border: 1px solid #f6c67a;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  width: 50%;
  margin: 30px auto;
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  max-width: 600px;
  width: 90%;
}

/* Warning Icon */
.warning-icon {
  font-size: 26px;
  margin-bottom: 10px;
}

/* Warning Title */
.warning-title {
  margin: 0 0 12px;
  font-size: 1.25em;
  color: #8a6d3b;
}

/* Button Group */
.warning-buttons {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Cancel Button */
.warning-buttons .btn-cancel {
  padding: 10px 20px;
  background-color: #e0e0e0;
  color: #333;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.warning-buttons .btn-cancel:hover {
  background-color: #d5d5d5;
}

/* Confirm Button */
.warning-buttons .btn-confirm {
  padding: 10px 20px;
  background-color: #d9534f;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.warning-buttons .btn-confirm:hover {
  background-color: #c9302c;
}



/*
=================================================================
== STYLES FOR THE LOGIN & REGISTRATION FORM                    ==
== This stylesheet provides a modern and professional design   ==
== for the main container, form inputs, buttons, and links.    ==
=================================================================
*/

/* --- 1. GLOBAL BACKGROUND (Grey on both) --- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #d3d3d3; 
  color: #333;
  margin: 0;
  padding: 20px;
}

@media (max-width: 768px) {
    #hero-image-banner {
        height: 150px; /* Just make it shorter, don't hide it */
    }
    
    #hero-image-banner h1 {
        font-size: 1.8em; /* Make text slightly smaller */
        padding: 0 10px;
    }
}

/* --- Main Container --- */
.copper-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 95%;
  max-width: 600px;
  margin: 40px auto;
  padding: 40px;
  box-sizing: border-box;
  background-color: #ffffff;
  border: 1px solid #d1c0b8; /* Soft copper border */
  border-top: 20px solid #b87333; /* Bold copper accent */
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* A simple grouping for a label and its input */
.form-group {
  text-align: center;
  margin-bottom: 20px;
}

.silver-label {
  display: block;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
  font-size: 14px;
}

/* --- Input Fields --- */
.silver-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
  background-color: #f9f9f9;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-sizing: border-box; /* Ensures padding doesn't affect width */
}

.silver-input:focus {
  outline: none;
  border-color: #b87333; /* Copper accent on focus */
  box-shadow: 0 0 0 3px rgba(184, 115, 51, 0.2);
}

/* --- Checkbox Styling --- */
.silver-checkbox-group {
  display: flex;
  align-items: center;
  margin-top: 10px;
  font-size: 14px;
  color: #666;
}

.silver-checkbox-group input[type="checkbox"] {
  margin-right: 8px;
  accent-color: #b87333; /* Modern way to color checkboxes */
}

/* --- Buttons --- */
.silver-button, .silver-button-small {
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  font-size: 16px;
}

/*
/*
======================================================
== NEW METALLIC COPPER-TO-GOLD LOGIN BUTTON           ==
======================================================
*/

/* --- The Main Button Style --- */
.login-button {
  /* Sizing and Layout */
  display: inline-block;
  width: 100%;
  max-width: 350px;
  padding: 14px 24px;
  
  /* Typography: Silver text with a shadow for readability */
  color: #F0F0F0; /* A very light, clean silver */
  font-size: 1.2em;
  font-weight: 700;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6); /* Makes text pop */

  /* The Gradient: A rich, burnished copper to a bright gold */
  background: linear-gradient(
    125deg, 
    #a0652d, /* Dark Burnished Copper */
    #B87333 40%, /* Standard Copper */
    #DAA520 60%, /* Rich Gold */
    #B8860B  /* Dark Burnished Gold */
  );
  
  /* The "Metallic" Look */
  border: 1px solid #8B4513; /* A dark, framing copper border */
  border-radius: 8px;
  /* Outer shadow for lift, inner highlight for a 3D metal sheen */
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2), 
              inset 0 1px 1px rgba(255, 255, 255, 0.4);
  
  /* Interactivity */
  cursor: pointer;
  /* Smooth transition for all interactive effects */
  transition: all 0.2s ease-out;
}

/* --- Hover State --- */
.login-button:hover {
  /* "Lifts" the button up and makes the shadow more prominent */
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3), 
              inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* --- Active (Pressed) State --- */
.login-button:active {
  /* Pushes the button "down" */
  transform: translateY(1px);
  /* A strong inner shadow simulates being pressed in */
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.4);
  /* Make the click feedback feel instant */
  transition: transform 0.1s, box-shadow 0.1s;
}

/* --- Focus State for Accessibility --- */
.login-button:focus {
  outline: none;
  /* A "glow" that matches the gold color for keyboard users */
  box-shadow: 0 0 0 4px rgba(218, 165, 32, 0.5);
}

/* --- Containers & Wrappers --- */
.login-filter-group {
  text-align: center;
  margin-top: 24px;
}

/*
======================================================
== SILVER TEXT FOR LOGIN BUTTON            ==
======================================================
*/

/* --- The simple, solid text style inside the button --- */
.login-button-text {
  /* Typography */
  font-size: 1.2em;
  font-weight: 700;
  
  /* A solid, light silver color for the text */
  color: #EAEAEA; 

  /* A simple, dark shadow to make the text pop against the button's gradient */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.registration-wrapper {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0; /* A subtle separator */
}

.initial-action-buttons {
  display: inline-flex;
  gap: 20px;
}

/* --- Utility & State Classes --- */
.login-error {
  color: #d32f2f; /* A more standard error red */
  display: none;
  margin-top: 15px;
  font-weight: 500;
  font-size: 14px;
}

.lower-action-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

/* Shared link styles */
.legal-notice-link,
.middle-action-link {
  text-decoration: underline;
  font-size: 0.95rem;
  cursor: pointer;
}

/* Light blue (Deregister + Legal Notice) */
.legal-notice-link {
  color: #666; /* was #777, now a little darker */
}

.legal-notice-link:hover {
  color: #444;
}

/* Darker middle link (New User) */
.middle-action-link {
  color: #222;
  font-weight: 600;
}

.middle-action-link:hover {
  color: #000;
}

/* This rule keeps the delete button hidden by default */
#delete-user-button {
  display: block;
}

/* --- MOBILE CARD STYLES --- */
.mobile-card-wrapper {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-bottom: 40px;
}

.ter-card {
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Header: Blue bar with Territory # */
.ter-card-header {
  background: #007bff; /* Blue */
  color: white;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 1.2em;
}

/* Adds a strong line under the 'Last Done' row */
.ter-card-subheader {
  border-bottom: 2px solid #000000 !important; /* The line */
  background-color: #ffffff; /* Clean background */
  padding: 8px 15px;         /* Spacing */
  display: flex;
  justify-content: flex-end; /* Keeps text on the right */
  align-items: center;
}

/* Optional: Ensures the text inside is also black/bold to match */
.ter-card-subheader span, 
.ter-card-subheader .last-completed {
  color: #000000 !important;
  font-weight: 700 !important;
}

/* Slot Containers */
.slot-container {
  padding: 10px;
  border-bottom: 1px solid #eee;
}
.slot-container:last-child { border-bottom: none; }

/* The Name Row */
.slot-name-row {
  font-size: 1.1em;
  font-weight: 500;
  margin-bottom: 8px;
  color: #000;
}

/* --- CHANGE: Hide the 1, 2, 3, 4 --- */
.slot-label {
  display: none; 
}

/* The Dates Row */
.slot-dates-row {
  display: flex;
  gap: 10px;
}
.date-box {
  flex: 1;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 6px;
  font-size: 0.9em;
}
.lbl-out { color: #007bff; font-weight: bold; font-size: 0.8em; display: block; }
.lbl-ret { color: #28a745; font-weight: bold; font-size: 0.8em; display: block; }

/* Hide empty slots on mobile to save space */
.slot-hidden { display: none; }

/* ========================================================= */
/* === UNIFIED MOBILE WIDTHS (Vertical Alignment Fix)    === */
/* ========================================================= */
@media (max-width: 768px) {
    
    /* 1. Reclaim screen space by reducing outer padding */
    body {
        padding: 5px !important;
    }

    /* 2. Reset the main wrapper to be a transparent container */
    #interactive-area {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 3. Force all main "Blocks" to exact same width and center them */
/* 3. Force all main "Blocks" to exact same width and center them */

/* Specific rule for the Banner spacing */
#hero-image-banner {
    margin-top: calc(env(safe-area-inset-top) + 20px) !important;
}

/* Shared sizing rule for all containers */
#hero-image-banner,
.dashboard-card,
.ter-card,
#table-container {
    width: 96% !important;
    max-width: 500px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

    /* 4. Fix the Sticky Search Bar to fit inside the aligned container */
    /* This targets the div created in JS with position: sticky */
    #table-container > div[style*="position: sticky"] {
        width: 100% !important; /* Fill the 96% parent exactly */
        border-radius: 8px !important; /* Match card rounded corners */
        top: 5px !important; /* Slight gap from top of screen */
    }

    /* 5. Ensure cards have consistent spacing */
    .ter-card {
        margin-bottom: 15px !important;
    }
    
    /* 6. Ensure the hero image text fits */
    #hero-image-banner h1 {
        width: 100%;
        box-sizing: border-box;
    }
}

/* ========================================================= */
/* === DESKTOP ALIGNMENT (Centered & Framed)             === */
/* ========================================================= */
@media (min-width: 769px) {

    /* 1. Main Wrapper: Standard Block Centering (No Flex) */
    #interactive-area {
        
        width: 95% !important;
        max-width: 1100px !important;    /* Standard wide width */
        margin: 20px auto !important;    /* Centers the block on screen */
        padding: 0 !important;
    }

    /* 2. Hero Image: Natural Cover with White Frame */
    #hero-image-banner {
        width: 100% !important;
        height: 250px !important;        /* Fixed height for consistency */
        
        /* The White Banner/Frame Effect */
        border: 15px solid white !important; 
        background-color: white !important;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        margin-bottom: 30px !important;
        box-sizing: border-box;

        /* Image: Fills the frame naturally without stretching */
        background-size: cover !important; 
        background-position: center center !important;
        background-repeat: no-repeat !important;
    }

    /* Restore overlay visibility so text is readable */
    #hero-image-banner::before {
        display: block !important;
        border-radius: 0 !important; /* Fits inside the border */
    }

    /* 3. Control Box & Table: Full width of the centered parent */
    .dashboard-card, 
    #table-container {
        width: 100% !important;
        max-width: 1100px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        margin-bottom: 25px !important;
        box-sizing: border-box;
    }

    /* 4. The "Paper" Sheets */
    .page-container {
        width: 100% !important;
        box-sizing: border-box;
    }
}

/* Styling for empty input placeholders */
.input-placeholder {
    display: block;
    background-color: #f1f3f4; /* Light grey background */
    border: 1px solid #dadce0; /* Subtle border */
    border-radius: 4px;
    color: #5f6368;           /* Darker grey text */
    padding: 8px 12px;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.input-placeholder:hover {
    background-color: #e8eaed;
    border-color: #b87333; /* Copper highlight on hover */
    color: #202124;
}

@media print {
  /* 1. Nuke the background and grey margins from the monitor view */
  body { 
    background: white !important; 
    padding: 0 !important; 
    margin: 0 !important; 
  }

  /* 2. Force the container to stop being a "Monitor Box" */
  #interactive-area, .copper-container, #table-container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* 3. Ensure the "Paper" sheets take up the full width of the A4 */
  .page-container {
    width: 190mm !important; /* Standard A4 printable width */
    margin: 0 auto !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }

  /* 4. Hide monitor-only elements like the Search Bar or Hero Image */
  #hero-image-banner, [style*="position: sticky"], .login-button, button {
    display: none !important;
		}
	}


/* Full Screen Lock Overlay */
#offline-overlay {
    /* Hidden by default */
    display: none; 
    
    /* Force it to cover the WHOLE screen, not just the container */
    position: fixed; 
    top: 0;
    left: 0;
    width: 100vw;  /* 100% of Viewport Width */
    height: 100vh; /* 100% of Viewport Height */
    
    /* Maximum Z-Index to stay on top of everything */
    z-index: 2147483647; 
    
    /* Darken the screen behind the box (Visual Lock) */
    background-color: rgba(0, 0, 0, 0.6); 
    
    /* Centering Magic */
    align-items: center;
    justify-content: center;
    
    /* Stop all clicks from passing through */
    pointer-events: all;
    touch-action: none;
}

/* 1. The Parent: Covers screen and holds the child in the center */
#offline-overlay {
    /* Hidden by default, JS toggles this */
    display: none; 
    
    /* Force full viewport coverage */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2147483647; /* Highest possible layer */
    
    /* Darken the background */
    background-color: rgba(0, 0, 0, 0.6);
    
    /* --- CENTERING MAGIC --- */
    /* This makes whatever is inside this div sit perfectly in the middle */
    justify-content: center; /* Horizontal Center */
    align-items: center;     /* Vertical Center */
}

/* 2. The Child: The white alert box */
.offline-box {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    
    /* SIZING FIX: 
       Use width 90% for mobile, but cap it at 400px for desktop 
       so it doesn't stretch across the whole monitor. */
    width: 90%;
    max-width: 600px; 
    
    /* Visuals */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 2px solid #cc0000;
}



/* Make the hero banner look clickable and add a hover effect */
#hero-image-banner {
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

#hero-image-banner:hover {
  filter: brightness(1.1); /* Slightly brighten on hover */
}

#hero-image-banner:active {
  transform: scale(0.98); /* Slight shrink when tapped/clicked */
}

/* Optional: Add a "Logout" tooltip hint on desktop */
#hero-image-banner::after {
  content: 'Tap to Log Out';
  position: absolute;
  bottom: 10px;
  right: 20px;
  font-size: 10px;
  background: rgba(51,51,51,0.4);
  color: white;
  padding: 3px 10px;
  border-radius: 4px;
  opacity: 0.9; /* Always visible */
  pointer-events: none;
  z-index: 10;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  transition: opacity 0.3s ease; /* Keep smooth transition for potential hover effects */
}


/* Optional: Slightly brighter on hover for feedback */
#hero-image-banner:hover::after {
  opacity: 1;
  background: rgba(0,0,0,0.8);
}

/* --- Professional Hero Banner Styling --- */
#hero-image-banner {
  height: 250px;
  border-radius: 12px;
  background-color: #2c3e50; /* Solid base color during load */
  background-size: cover;
  background-position: center 30%; /* Focus on the upper-center of the photo */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: filter 0.3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

/* Sophisticated Dark-to-Transparent Gradient Overlay */
#hero-image-banner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    to bottom, 
    rgba(0, 0, 0, 0.2) 0%, 
    rgba(0, 0, 0, 0.6) 100%
  );
  z-index: 1;
}

/* Banner Title Styling */
#hero-image-banner h1 {
  position: relative;
  z-index: 2;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -1px;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  margin: 0;
  padding: 0 20px;
}

/* Sub-text or context span inside the title */
#user-context-prefix {
  color: #FFD700; /* Subtle Gold for the Congregation Name */
  text-transform: uppercase;
  font-size: 1.5rem;
  display: block; /* Puts it on its own line above the main title */
  letter-spacing: 2px;
  margin-bottom: 4px;
}


html {
  scroll-behavior: auto !important; /* Prevents slow 'sliding' during redraws */
}



/* This targets all dropdowns including the publisher filter */
.admin-style-dropdown, 
#publisher-filter {
    font-size: 16px !important;         /* Sets the text size */
    height: auto !important;            /* Removes the forced height that causes misalignment */
    padding-top: 10px !important;       /* Space above text */
    padding-bottom: 10px !important;    /* Space below text (keeps it centered) */
    line-height: 1.2 !important;        /* Ensures the text height is standard */
}
/* Target the select element or its dropdown container */
.admin-style-dropdown {
    max-height: 300px;    /* Limits the height */
    overflow-y: auto;     /* Adds vertical scrollbar if needed */
}

/* If you are using a custom list inside the dropdown */
.admin-style-dropdown option {
    padding: 10px;        /* Makes it easier to click */
}





/* This stops the mobile "double tap" requirement */
#publisher-filter, 
.admin-style-dropdown {
    font-size: 16px !important; 
    touch-action: manipulation; /* Removes the 300ms tap delay */
}

/* Styling for the immediate native dropdowns */
.mobile-native-select {
    width: 100%;
    max-width: 250px;
    height: 40px;
    font-size: 16px !important; /* Prevents iOS auto-zoom */
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    appearance: auto !important; /* Forces the native mobile arrow */
    cursor: pointer;
    text-align: center;
}

/* Red border if the previous slot isn't finished (dependency) */
.mobile-native-select:disabled {
    background-color: #eee;
    color: #999;
    cursor: not-allowed;
    border: 1px dashed #ccc;
}

/* This ensures the blue header is visible after a jump */
.ter-card {
    scroll-margin-top: 95px; /* Adjust this value if your search bar is taller/shorter */
}


/* User Management Container */
.user-management-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
}

/* Congregation Group Wrapper */
.congregation-group {
    display: block;
    clear: both; /* Prevents floating elements from causing nesting */
    width: 100%;
    margin-bottom: 40px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    background: white; /* Ensures the background doesn't stay transparent */
}

/* Group Headers */
.cong-header-blue {
    background: #007bff;
    color: white;
    padding: 12px 15px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 1px;
}







/* 1. Standby State: Blue (Updated selector to win priority) */
.dashboard-card .admin-button {
  background-color: #007bff; 
  color: #ffffff;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 300px;
}

/* 2. Hover State: Darker Blue */
.dashboard-card .admin-button:hover:not(:disabled) {
  background-color: #0056b3;
}

/* 3. Disabled State: Grey */
.dashboard-card .admin-button:disabled {
  background-color: #f0f0f0;
  color: #999999;
  border: 2px solid #cccccc;
  cursor: not-allowed;
  opacity: 1;
}

/* Primary style for Admin Buttons */
.admin-style {
    background-color: #007bff !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    width: 100%;             /* Fills the centered container */
    max-width: 400px;        /* Limits width on desktop */
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: block;
    margin: 0 auto 10px auto; /* Centers the button itself if width is less than 100% */
}

/* Hover effect - slightly darker blue */
.admin-style:hover {
    background-color: #0056b3 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Click effect - button depresses slightly */
.admin-style:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Focus state for accessibility */
.admin-style:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.4);
}

/* --- LOADING INDICATOR (Floating Pill Style) --- */
#loading-indicator {
    /* Critical: Removes element from layout flow so table doesn't jump */
    position: fixed;
    bottom: 30px;           /* Floats 30px from bottom of screen */
    left: 50%;              /* Centers horizontally */
    transform: translateX(-50%); 
    
    /* Layering */
    z-index: 9999;          /* Ensures it sits on top of everything */
    
    /* Visual Styling */
    background-color: rgba(255, 255, 255, 0.95); /* Slight transparency */
    border: 1px solid #e0e0e0;
    border-radius: 30px;    /* Pill shape */
    box-shadow: 0 4px 15px rgba(0,0,0,0.15); /* Nice drop shadow */
    padding: 10px 25px;
    
    /* Content Layout */
    /* Note: JS sets display to 'flex' or 'none', this handles alignment when visible */
    align-items: center;
    gap: 12px;
    
    /* Text Styling */
    color: #333;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;   /* Allows clicking through it if it blocks something */
}



.hero-code-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Segoe UI', sans-serif;
}

.code-label { color: #FFD700; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.code-value { color: #ffffff; font-family: monospace; font-size: 18px; font-weight: bold; }

.level-select {
	max-width: 500px;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: 12px auto;
    padding-right: 40px !important;
}

/* Container for the badges */
#hero-code-wrapper {
  display: none; /* Hidden by default, shown by JavaScript */
  flex-direction: column; /* Stack badges vertically */
  align-items: center; /* Center horizontally */
  gap: 8px; /* Gentle spacing between badges */
  width: 100%;
  margin-top: 15px;
}

/* When JavaScript shows it, use flex display */
#hero-code-wrapper.show {
  display: flex;
}

.hero-code-badge {
  background-color: #ffffff;
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #333333;
  width: 100%;
  max-width: 280px;
  box-sizing: border-box;
}

/* Hover effect for gentle interaction */
.hero-code-badge:hover {
  background-color: #f8f9fa; /* Slightly off-white on hover */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Label text styling */
#hero-cong-label,
.hero-bus-label {
  color: #6c757d; /* Muted gray for labels */
  font-weight: 500;
  font-size: 12px;
}

/* Code numbers - clean highlight */
.code-number {
  color: #2c7be5; /* Professional blue */
  font-size: 14px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-weight: 600;
  background-color: #f8f9fa; /* Very light background */
  padding: 4px 10px;
  border-radius: 4px;
}

/* Business badge styling */
#hero-bus-code-box {
  display: none;
}

/* When business badge should be shown */
#hero-bus-code-box.show {
  display: flex;
}

/* Business ID number styling */
#hero-bus-code-box .code-number {
  color: #00a085; /* Muted teal for business ID */
  background-color: #f0f9f7; /* Very light teal background */
}

/* MOBILE ADAPTATION */
@media (max-width: 768px) {
  .hero-code-badge {
    width: 90%;
    max-width: 280px;
    padding: 10px 12px;
  }
  
  #hero-cong-label,
  .hero-bus-label {
    font-size: 11px;
  }
  
  .code-number {
    font-size: 13px;
    padding: 3px 8px;
  }
  
  #hero-code-wrapper {
    gap: 6px;
    margin-top: 12px;
  }
}

/* Animation for gentle appearance */
@keyframes gentleFadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}



/* Clean, low-key style for admin action buttons */
.admin-button {
    background-color: #007bff; /* The "Nice Blue" */
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 24px;
    border: none;
    border-radius: 25px; /* Pill shape */
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2);
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
    outline: none;
}

.admin-button:hover {
    background-color: #0056b3; /* Slightly darker on hover */
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transform: translateY(-1px); /* Subtle lift */
}

.admin-button:active {
    transform: translateY(0); /* Press down effect */
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
    background-color: #004a9b;
}

/* Ensure the button doesn't appear on the actual printed document */
@media print {
    .admin-button {
        display: none !important;
    }
}

/* Make non-header data rows white */
.territory-type-row,
.territory-action-row {
    background-color: #ffffff !important;
}

/* Ensure the specific cells within those rows are also white */
.territory-type-cell,
.territory-map-type-cell,
.territory-date-cell,
.territory-return-cell {
    background-color: #ffffff !important;
}



/* The Animated Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff; /* Blue to match your app */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 1. THE MAIN OVERLAY */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    display: none; /* Hidden by default, JS will show it */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000000; /* Extremely high to sit on top of everything */
    padding: 20px;
    box-sizing: border-box;
    text-align: center;
}

/* Class added by JS to show the panel */
#loading-overlay.visible {
    display: flex !important;
}

/* 2. THE HOUSES (SVG) */
.house-graphic {
    width: 320px;
    height: auto;
    margin-bottom: 20px;
    color: #007bff; /* This color applies to the stroke/fill in SVG */
}

/* 3. THE ALTERNATING QUOTES */
.quote-container {
    width: 100%;
    height: 50px; /* Fixed height prevents jumping */
    position: relative;
    margin-bottom: 20px;
}

.moving-quote {
    position: absolute;
    left: 0;
    right: 0;
    font-size: 1.4em;
    font-weight: 600;
    color: #007bff;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0; /* Hidden by default */
}

/* Quote Animation Logic: Total cycle 10 seconds */
.moving-quote:nth-child(1) {
    animation: quoteCycle 10s linear infinite;
}

.moving-quote:nth-child(2) {
    animation: quoteCycle 10s linear infinite;
    animation-delay: 5s; /* Starts halfway through the cycle */
}

@keyframes quoteCycle {
    0% { opacity: 0; transform: translateY(10px); }
    5% { opacity: 1; transform: translateY(0); }
    45% { opacity: 1; transform: translateY(0); }
    50% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 0; }
}

/* 4. THE WELCOME TEXT AREA */
#loading-text {
    max-width: 500px;
}

/* These classes must match what your JS inserts in innerHTML */
#loading-text .bible-verse {
    margin: 0 0 15px 0;
    font-size: 2.2em;
    font-weight: 800;
    color: #004085;
    letter-spacing: 1px;
}

#loading-text h2 {
    margin: 0 0 8px 0;
    color: #5d6d7e;
    font-size: 1.4em;
    font-weight: 600;
}

#loading-text p.congregation {
    margin: 0;
    color: #7b8a99;
    font-size: 1.1em;
}

.footer-note {
    margin-top: 30px !important;
    font-size: 0.9em;
    color: #abb2b9 !important;
    font-style: italic;
    display: block;
}

/* Smooth Fade-in for text elements */
.fade-in {
    animation: textFadeIn 1.2s ease-out forwards;
}

@keyframes textFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#cong-filter, #name-filter {
    width: 100%;
    max-width: 500px;
    padding: 14px;
    border: 2px solid #007bff;
    border-radius: 12px;
    font-size: 16px;
    background-color: #f0f7ff;
    color: #004085;
    font-weight: bold;
    display: block;
    margin: 0 auto;
    outline: none;
	margin: 10px auto 10px auto;
}

#full-admin-dropdown {
    width: 100%;
    max-width: 500px;
    padding: 14px;
    border: 2px solid #007bff;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    color: #004085;
    background-color: #ffffff; /* White background provides contrast to the blue filters */
    display: block;
    margin: 10px auto 10px auto; /* Centers it and adds space below */
    outline: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); /* Subtle shadow to make it feel like the primary control */
}


#res-filter, #subdivided-filter {
    width: 100%;
    max-width: 500px;
    padding: 14px;
    /* Teal Border */
    border: 2px solid #17a2b8; 
    border-radius: 12px;
    font-size: 16px;
    /* Light Teal Background */
    background-color: #eef9fb; 
    /* Dark Teal Text */
    color: #0f5963;            
    font-weight: bold;
    display: block;
    margin: 10px auto 10px auto;
    outline: none;
    cursor: pointer;
    /* Smooth transition for hover effects */
    transition: background-color 0.2s, border-color 0.2s;
}

/* Optional: Slight darken on hover */
#res-filter:hover, #subdivided-filter:hover {
    background-color: #e2f6f9;
    border-color: #138496;
}

/* --- Help Modal System --- */
#help-modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Dim the background */
    z-index: 2000000; /* Sit on top of everything */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.help-box {
    background: white;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.help-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#help-body {
    padding: 20px;
    overflow-y: auto; /* Scrollable content */
    text-align: left;
    line-height: 1.5;
}



.close-help-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.menu-header-label {
    font-size: 10px;
    font-weight: 800;
    color: #0056b3;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    text-align: center;
}

.menu-btn {
    width: 100%;
    background-color: #ffffff;
    color: #004085;
    border: 2px solid #b8daff;
    border-radius: 12px;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.menu-btn:hover {
    background-color: #e7f3ff;
    border-color: #007bff;
    transform: translateY(-1px);
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}


/* --- FIXED TOOL MENU --- */
#menu-layer {
    width: 100%;
    max-width: 500px; /* Matches your filters width */
    margin: 0 auto;
    padding: 10px 0;
}

.tool-menu-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px;
    animation: menuFadeIn 0.2s ease-out;
}

/* Specificity override: Force Blue and Curved Edges */
#menu-layer .menu-btn {
    width: 100% !important;
    background-color: #ffffff !important; /* Light Blue Background */
    background-image: none !important;    /* Kills any inherited gradients */
    color: #004085 !important;           /* Deep Blue Text */
    border: 2px solid #007bff !important; /* Strong Blue Border */
    border-radius: 12px !important;      /* Match your curved filters */
    padding: 15px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05) !important;
    transition: all 0.2s ease !important;
    text-align: center !important;
}

/* Hover: Slightly darker blue pulse */
#menu-layer .menu-btn:hover {
    background-color: #e1efff !important;
    border-color: #0056b3 !important;
    transform: translateY(-1px);
}

/* The label at the top of the menu */
#menu-layer .menu-header-label {
    font-size: 11px !important;
    font-weight: 800 !important;
    color: #007bff !important; /* Blue Label */
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    text-align: center;
}

/* Style for the tool close button */
.menu-btn.tool-active {
    background-color: #f8f9fa !important;
    border: 2px solid #6c757d !important;
    color: #495057 !important;
    border-radius: 50px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    padding: 10px 20px !important;
    width: 100% !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Hover effect */
.menu-btn.tool-active:hover {
    background-color: #e9ecef !important;
    border-color: #495057 !important;
    color: #212529 !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important;
    transform: translateY(-1px);
}

/* Active/pressed effect */
.menu-btn.tool-active:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}

/* --- OFFLINE OVERLAY STYLES --- */

#offline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75); /* Dark background to focus on the box */
    backdrop-filter: blur(8px);       /* Modern blur effect for the app behind */
    display: none;                    /* Hidden by default, shown via JS */
    justify-content: center;
    align-items: center;
    z-index: 9999999;                 /* Ensure it stays above everything */
    padding: 20px;
    box-sizing: border-box;
}

.offline-box {
    background: #ffffff;
    width: 100%;
    max-width: 340px;                 /* Perfect size for cell phones */
    padding: 35px 25px;
    border-radius: 20px;              /* Smooth rounded corners */
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    animation: offlinePop 0.3s ease-out; /* Smooth entrance animation */
}

/* Entering animation for the box */
@keyframes offlinePop {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.offline-box h2 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.offline-box p {
    font-size: 15px;
    line-height: 1.5;
}

/* The Printer Link/Button */
.offline-box a {
    display: block;                  /* Full width for easy thumb-tapping */
    background: #007bff;
    color: #fff !important;          /* Force white text */
    text-decoration: none;
    padding: 15px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    margin-top: 15px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.offline-box a:active {
    transform: scale(0.97);          /* Visual feedback when tapped */
    background: #0056b3;
}

/* The "Need to print" text */
.offline-box .fallback-text {
    font-size: 13px;
    color: #999;
    margin-top: 20px;
    display: block;
}

/* Pulsing signal icon to show it's "Searching" */
.offline-icon {
    font-size: 50px;
    margin-bottom: 15px;
    display: block;
    animation: signalPulse 2s infinite;
}

@keyframes signalPulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* --- UI STYLES (Hidden when actually printing) --- */
@media screen {
    body {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        background-color: #f4f7f9;
        margin: 0;
        padding: 20px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .no-print-zone {
        background: #ffffff;
        width: 100%;
        max-width: 450px; /* Limits width on computers */
        padding: 30px 25px;
        border-radius: 16px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
        border: 2px solid #e1e8ed;
        text-align: center;
        box-sizing: border-box;
    }

    .no-print-zone h1 {
        margin: 0 0 10px 0;
        font-size: 24px;
        color: #1a202c;
        font-weight: 800;
    }

    .no-print-zone p {
        margin: 0 0 25px 0;
        font-size: 15px;
        color: #718096;
        line-height: 1.5;
    }

    /* Modern Styled File Input */
    input[type="file"] {
        width: 100%;
        padding: 15px;
        margin-bottom: 20px;
        border: 2px dashed #cbd5e0;
        border-radius: 12px;
        background: #f8fafc;
        cursor: pointer;
        font-size: 14px;
        box-sizing: border-box;
        transition: all 0.2s ease;
    }

    input[type="file"]:hover {
        background: #edf2f7;
        border-color: #4299e1;
    }

    /* Print Button Styling */
    .btn-print {
        display: none; /* Hidden until CSV is loaded via your JS */
        width: 100%;
        background-color: #007bff;
        color: white;
        border: none;
        padding: 16px;
        border-radius: 12px;
        font-weight: 700;
        font-size: 16px;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
        transition: transform 0.1s active, background 0.2s;
    }

    .btn-print:hover {
        background-color: #0056b3;
    }

    .btn-print:active {
        transform: scale(0.98);
    }
}

/* --- MOBILE SPECIFIC FIXES --- */
@media screen and (max-width: 600px) {
    body {
        padding: 15px;
    }
    
    .no-print-zone {
        padding: 25px 20px;
        border-radius: 20px; /* Extra rounded for mobile feel */
    }

    .no-print-zone h1 {
        font-size: 22px;
    }
}

/* --- PRINT ENGINE (Hides the UI during print) --- */
@media print {
    .no-print-zone {
        display: none !important;
    }
    body {
        background: white;
        padding: 0;
        margin: 0;
    }
}




/* =========================================
   1. DESKTOP / GENERAL STYLES (DO NOT TOUCH)
   ========================================= */

/* Table Wrapper */
.cong-table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.cong-table {
    width: 100%;
    border-collapse: collapse;
}

/* Header Styles */
.cong-table-header {
    background: #f8f9fa;
    text-align: left;
    font-size: 11px;
    border-bottom: 2px solid #ddd;
    color: #666;
}

.cong-table-header th {
    padding: 10px;
}

.cong-table-header th.text-right {
    text-align: right;
}

/* Row Styles */
.cong-row {
    border-bottom: 1px solid #eee;
    background-color: #fff;
}

/* Name/ID Column */
.cong-cell-name {
    padding: 12px 8px;
    font-weight: bold;
    font-size: 13px;
    color: #333;
    vertical-align: middle;
}

.cong-id {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
}

/* Input Columns (Desktop) */
.cong-cell-input {
    padding: 12px 4px;
    vertical-align: middle;
}

/* Shared Input Styles */
.cong-input-gid, 
.cong-input-lang {
    padding: 6px;
    border: 2px solid #ccc;
    border-radius: 4px;
    text-align: center;
    box-sizing: border-box; 
    background: #fff;
}

.cong-input-gid {
    width: 60px;
}

.cong-input-lang {
    width: 50px;
    text-transform: uppercase;
}

/* Action/Button Column */
.cong-cell-action {
    padding: 12px 8px;
    text-align: right;
    vertical-align: middle;
}

/* Save Button Style */
.login-button.cong-btn-save {
    padding: 6px 12px;
    font-size: 12px;
    width: auto;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* =========================================
   2. ACCORDION & FORM STYLES
   ========================================= */

.cong-accordion-header {
    background-color: #f8f9fa;
    color: #333;
    cursor: pointer;
    padding: 18px 25px;
    width: 100%;
    box-sizing: border-box;
    border: 2px solid #000000;
    text-align: left;
    outline: none;
    font-size: 16px;
    font-weight: 700;
    transition: 0.3s;
    border-radius: 8px;
    margin: 10px auto 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cong-accordion-header:hover {
    background-color: #e2e6ea;
}

.cong-accordion-header.active {
    background-color: #007bff;
    color: white;
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.cong-accordion-header:after {
    content: '+'; 
    font-size: 18px;
    font-weight: bold;
}

.cong-accordion-header.active:after {
    content: '-';
}

.cong-accordion-panel {
    padding: 20px;
    background-color: white;
    display: none;
    overflow: hidden;
    border: 2px solid #dee2e6;
    border-top: none;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    margin-bottom: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.cong-manager-input {
    width: 100%;
    padding: 12px 15px;
    margin: 8px 0 20px 0;
    display: inline-block;
    border: 2px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px;
}

.cong-manager-label {
    font-size: 14px;
    font-weight: bold;
    color: #555;
    margin-bottom: 5px;
    display: block;
}









/////////////////////////////////////////////
/////////////////////////////////////////////
/* --- SHARED MANAGER STYLES (Territory & Congregation) --- */

/* Wrapper & Panels */
#tm-tool-wrapper { max-width: 600px; margin: 0 auto; text-align: center; }
.tm-panel-white { display: none; padding: 15px; background: white; }
.tm-panel-grey { display: none; padding: 15px; background: #f8f9fa; }

/* Utilities */
.tm-full-width { width: 100%; }
.tm-max-width { max-width: 500px; }
.tm-min-height { min-height: 50px; }
.tm-number-input { width: 100px; }
.tm-empty-msg { text-align: center; padding: 15px; color: #999; }

/* Table Structure */
.tm-maintenance-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.tm-maintenance-table tr { border-bottom: 1px solid #eee; }

/* Desktop Specifics */
@media (min-width: 769px) {
    .tm-maintenance-table { border: 2px solid #dee2e6; }
    .tm-maintenance-table td { border: 2px solid #eee; padding: 8px; vertical-align: middle; }
    .tm-input-field { border: none; width: 100%; padding: 4px; }
    
    /* Input sizing for desktop */
    .tm-short-input { 
        width: 60px !important; 
        border: 2px solid #ccc !important; 
        border-radius: 4px; 
        text-align: center; 
    }
    
    /* Hide mobile labels on desktop */
    .tm-mobile-label { display: none; }
}

/* Common Cells */
.tm-num-td {
    padding: 10px;
    font-weight: bold;
    color: #2d3748;
}

.tm-action-td {
    padding: 10px;
    text-align: right;
    white-space: nowrap;
}

/* Inputs */
.tm-input-name { font-size: 14px; font-weight: 500; }
.tm-input-desc { font-size: 12px; color: #718096; }

/* Buttons */
.tm-btn-delete { background: none; border: none; cursor: pointer; font-size: 16px; }
.tm-btn-save {
    padding: 6px 12px;
    font-size: 12px;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.tm-btn-recreate { padding: 4px 10px; font-size: 11px; }
.tm-lock-icon { opacity: 0.2; cursor: not-allowed; }
.tm-missing-msg { padding: 10px; color: #a0aec0; font-style: italic; font-size: 13px; }

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {

    .tm-maintenance-table, 
    .tm-maintenance-table tbody, 
    .tm-maintenance-table tr, 
    .tm-maintenance-table td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        border: none !important;
    }

    .tm-map-row {
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        border: 2px solid #e2e8f0 !important;
        background: white;
        display: grid !important;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "num    action"
            "name   name"
            "desc   desc";
        gap: 8px;
        align-items: start;
    }

    .tm-map-row:nth-child(even) { background-color: #f8fafc; }

    .tm-num-td {
        grid-area: num;
        padding: 0 !important;
        font-size: 15px;
        font-weight: bold;
        align-self: center;
    }

    .tm-action-td {
        grid-area: action;
        padding: 0 !important;
        text-align: right !important;
        align-self: center;
    }

    .tm-cell-name {
        grid-area: name;
        padding: 0 !important;
    }

    .tm-cell-desc {
        grid-area: desc;
        padding: 0 !important;
    }

    .tm-input-field {
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 10px !important;
        border: 2px solid #cbd5e0 !important;
        border-radius: 6px !important;
        font-size: 16px !important;
        background: #fff;
        min-height: 42px;
    }

    .tm-btn-save {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
	
	.tm-cell-name,
.tm-cell-desc {
    padding: 0 !important;
    margin-bottom: 6px;
}

    .tm-btn-recreate { 
        width: 100%;
        padding: 10px;
        font-size: 13px;
        margin-top: 4px;
    }

    .tm-missing-msg {
        grid-column: 1 / -1;
        padding: 6px 0 !important;
    }

    .tm-mobile-label { display: none; }
}

/* --- CONGREGATION MANAGER TABLE STYLES --- */

/* 1. Panel & Wrapper */
/* Merged into primary .cong-accordion-header block above */

.admin-cong-accordion-panel {
    display: none; 
    width: 100%; /* Matches header exactly */
    box-sizing: border-box;
    background-color: #ffffff;
    border: 2px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    /* FIX: 25px padding on left/right makes the inner space exactly 450px */
    padding: 20px 25px; 
}

.admin-cong-table-wrapper {
    width: 100%; /* Exact internal width */
    margin: 0 auto;
}

/* 2. Table Base */
.admin-admin-cong-table {
    width: 100% !important;
    table-layout: fixed; /* CRITICAL: Forces the 200/50/50/150 math */
    border-collapse: collapse;
    background: white;
}

/* 3. Header Styling - ALL CENTRAL */
.admin-cong-table-header th {
    background-color: #f8fafc;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 0;
    border-bottom: 2px solid #e2e8f0;
    text-align: center; /* Centers all labels */
}

/* 4. Exact Column Width Logic (Total = 450px) */
.admin-cong-table-header th:nth-child(1) { width: 150px; } /* NAME */
.admin-cong-table-header th:nth-child(2) { width: 75px;  } /* GROUP */
.admin-cong-table-header th:nth-child(3) { width: 75px;  } /* LANG */
.admin-cong-table-header th:nth-child(4) { width: 150px; } /* ACTION */

/* 5. Cell Styling */
.admin-cong-row td {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    text-align: center; /* Centers everything by default */
}

/* Override Name Column to align Left */
.admin-cong-row td.admin-cong-cell-name {
    text-align: left !important;
    padding-left: 10px;
    font-weight: 600;
    color: #1e293b;
}

.admin-cong-id {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 400;
    margin-top: 2px;
}

/* 6. Inputs - Sized for the 50px columns */
.admin-cong-input-gid, 
.admin-cong-input-lang {
    border: 2px solid #cbd5e0;
    border-radius: 4px;
    padding: 6px 0;
    font-size: 13px;
    width: 65px; /* Leaves 5px gap on each side of the 50px col */
    box-sizing: border-box;
    text-align: center;
    background: #f8fafc;
}

/* 7. Action Button - Centered in 150px column */
.admin-cong-btn-save {
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 8px 0;
    width: 130px; /* Neatly fits in the 150px space */
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.admin-cong-btn-save:hover {
    background-color: #2563eb;
}

/* --- 📱 MOBILE OPTIMIZATION (Phone) --- */
@media (max-width: 768px) {
    
    /* Hide the original header row */
    .admin-cong-table-header {
        display: none;
    }

    /* Transform table elements into blocks */
    .admin-admin-cong-table, 
    .admin-admin-cong-table tbody, 
    .admin-cong-row, 
    .admin-cong-row td {
        display: block;
        width: 100%;
    }

    /* Transform each row into a Card */
    .admin-cong-row {
        background: white;
        border: 2px solid #e2e8f0;
        border-radius: 10px;
        margin-bottom: 15px;
        padding: 10px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }

    .admin-cong-row td {
        border: none;
        padding: 8px 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
    }

    /* Add labels back to cells using pseudo-elements */
    .admin-cong-cell-input:nth-child(2)::before { content: "GROUP:"; font-size: 11px; font-weight: 700; color: #94a3b8; }
    .admin-cong-cell-input:nth-child(3)::before { content: "LANG:"; font-size: 11px; font-weight: 700; color: #94a3b8; }

    /* Name Cell Header Style */
    .admin-cong-cell-name {
        text-align: left;
        display: block;
        border-bottom: 1px solid #f1f5f9 !important;
        margin-bottom: 5px;
        font-size: 16px;
    }

    /* Make the lang/group inputs a bit wider for fingers */
    .admin-cong-input-gid, 
    .admin-cong-input-lang {
        width: 80px;
        padding: 10px;
        font-size: 15px;
    }

    /* Full-width save button on mobile */
    .admin-cong-cell-action {
        text-align: center;
        padding-top: 15px !important;
    }

    .admin-cong-btn-save {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
}

/* ============================================================
   📱 MOBILE FIX: No Overlap & Perfect Alignment
   ============================================================ */
@media (max-width: 768px) {

    /* 1. Reset Containers to fit screen */
    .cong-accordion-header, 
    .admin-cong-accordion-panel,
    .admin-cong-table-wrapper {
        width: 100% !important;
        box-sizing: border-box !important;
        margin: 10px 0 !important;
    }

    /* 2. Hide the old table header row */
    .admin-cong-table-header {
        display: none !important;
    }

    /* 3. Force Table to behave like a list of Cards */
    .admin-admin-cong-table, 
    .admin-admin-cong-table tbody {
        display: block !important;
        width: 100% !important;
    }

    /* 4. THE CARD (White Box) */
    .admin-cong-row {
        display: block !important; /* Force vertical stacking */
        background-color: #ffffff !important;
        border: 2px solid #000000 !important;
        border-radius: 15px !important;
        margin: 0 10px 20px 10px !important;
        padding: 15px !important; /* Internal spacing for the card */
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
        box-sizing: border-box !important;
    }

    /* 5. CONGREGATION NAME (Top of Card) */
    .admin-cong-cell-name {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        padding: 0 0 15px 0 !important;
        border-bottom: 1px solid #f1f5f9 !important;
        margin-bottom: 15px !important;
        font-size: 18px !important;
        font-weight: 800 !important;
        border: none !important;
    }

    .admin-cong-id {
        display: block !important;
        font-size: 11px !important;
        color: #94a3b8 !important;
        margin-top: 4px !important;
    }

    /* 6. INPUT ROWS (Group & Lang) */
    .admin-cong-cell-input {
        display: flex !important; /* Label left, Box right */
        width: 100% !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 0 !important;
        border: none !important;
        box-sizing: border-box !important;
		margin-bottom: 10px !important;
    }

    /* Labels */
    .admin-cong-cell-input::before {
        font-weight: 700 !important;
        font-size: 12px !important;
        color: #64748b !important;
        text-transform: uppercase !important;
    }

    /* Entry Boxes */
    .admin-cong-input-gid, 
    .admin-cong-input-lang {
        width: 90px !important;
        height: 45px !important;
        font-size: 16px !important;
        border: 2px solid #cbd5e0 !important;
        border-radius: 8px !important;
        background: #f8fafc !important;
        text-align: center !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    /* 7. SAVE BUTTON CONTAINER */
    .admin-cong-cell-action {
        display: block !important;
        width: 100% !important;
        padding: 15px 0 0 0 !important;
        border: none !important;
        box-sizing: border-box !important;
    }

    /* 8. THE SAVE BUTTON */
    .admin-cong-btn-save {
        display: block !important;
        width: 100% !important; /* Fills the card width */
        height: 50px !important;
        padding: 0 !important;
        border-radius: 12px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        box-sizing: border-box !important; /* FIX: Keeps it inside the card */
        margin: 0 !important;
    }
}

.help-button-fixed,
#hero-info-icon {
  position: fixed;
  
  /* Fallback for older browsers */
  bottom: 30px; 
  
  /* The Fix: Adds the Android/iOS system spacing automatically */
  bottom: calc(20px + env(safe-area-inset-bottom));
  
  width: 50px;
  height: 50px;
  border-radius: 50%;
  
  /* GLASS EFFECT: Very low opacity white/silver background */
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(200, 200, 200, 0.1));
  
  /* FROSTED EFFECT: This makes it look like translucent glass */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  
  /* SILVER EDGE: A light, semi-transparent white border looks like a glass edge */
  border: 1px solid rgba(255, 255, 255, 0.4);
  
  color: rgba(255, 255, 255, 0.5);
  text-shadow: -1px -1px 1px rgba(0,0,0,0.2), 1px 1px 1px rgba(255,255,255,0.7);
  
  /* SOFT GLOW: A shadow that isn't too dark keeps it feeling light */
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15),
              inset 0 0 10px rgba(255, 255, 255, 0.2);
              
  font-size: 22px;
  font-weight: 800;
  z-index: 9999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

/* Position help button on the right */
.help-button-fixed {
  right: 20px;
}

/* Position hero info icon on the left */
#hero-info-icon {
  left: 20px;
}

/* Hover effect for both buttons */
.help-button-fixed:hover,
#hero-info-icon:hover {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.6);
  transform: translateY(-3px);
  box-shadow: 0 10px 40px 0 rgba(31, 38, 135, 0.2);
}

/* Global Controls Bar */
#global-controls-bar {
    margin-top: -20px;
    position: relative;
    z-index: 10;
}

#global-controls-bar .card-content {
    padding: 15px;
}

/* Filter Groups */

.filter-group:last-child {
    margin-bottom: 0;
}

/* Filter Row - for the four dropdowns */
.filter-row {
    display: flex;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
}

.filter-row .filter-group {
    flex: 1;
    min-width: 150px; /* Prevents dropdowns from getting too narrow */
    margin-bottom: 0;
}

/* Dropdown styling - matches your admin-style-dropdown class */
.admin-style-dropdown {
    width: 100%;
    padding: 12px;
    border: 2px solid #007bff;
    border-radius: 10px;
    background-color: #f0f7ff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23007bff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

/* Hide dropdowns by default (JS will show them) */
#cong-dropdown,
#name-dropdown,
#assignee-dropdown,
#res-dropdown,
#subdivided-dropdown {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-row .filter-group {
        width: 100%;
    }
    
    .admin-style-dropdown {
        padding: 14px; /* Larger touch target on mobile */
        font-size: 16px;
    }
}

/* Workspace */
#app-workspace {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}





/* Notification Area */
#notification-area {
    text-align: center;
    margin: 10px auto;
    width: 100%;
}

.notification {
    padding: 12px 20px;
    border-radius: 8px;
    margin: 10px 0;
    font-weight: 500;
    display: none;
}

.notification.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.notification.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#subdivided-message {
    display: none;
    color: #721c24;
    background-color: #f8d7da;
    padding: 8px;
    border-radius: 4px;
    margin: 10px 0;
    border: 1px solid #f5c6cb;
}

/* Loading Indicator */
#loading-indicator {
    display: none;
    text-align: center;
    padding: 20px;
    margin: 10px auto;
}

.loading-text {
    display: inline-block;
    padding: 10px 20px;
    background-color: #f8f9fa;
    border-radius: 20px;
    color: #007bff;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Loading spinner animation */
.loading-text::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid #007bff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    #app-workspace {
        padding: 0 10px;
    }
    
    #assignee-current {
        padding: 15px;
        border-radius: 10px;
    }
    
    .notification {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .loading-text {
        padding: 8px 16px;
        font-size: 14px;
    }
}

/* Help Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.modal-container {
    background: white;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    background: #007bff;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
}

.modal-close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(85vh - 120px);
}

.modal-footer {
    padding: 15px;
    background: #f8f9fa;
    text-align: center;
    border-top: 1px solid #dee2e6;
}

.modal-btn {
    padding: 10px 25px;
    border-radius: 5px;
    border: none;
    background: #6c757d;
    color: white;
    cursor: pointer;
    font-weight: bold;
}

.modal-btn:hover {
    background: #5a6268;
}

/* Help tool blocks */
.help-tool-block {
    background: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.help-tool-block h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}



.help-tool-block p {
    margin: 8px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #555;
}

.help-tool-block ul {
    margin: 8px 0;
    padding-left: 20px;
    font-size: 13px;
}

.help-tool-block li {
    margin: 4px 0;
    color: #555;
}



/* Ensure results list is clean */
#assignee-list {
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
    min-height: 50px;
}




/* Main content container (Blue Box) - Only visible when JS sets display:block */
#assignee-current {
    display: none;  /* Hidden by default */
    width: 100%;
    margin: 10px auto 0 auto;
    background-color: transparent;
    border-radius: 12px;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: none;
    border: none;
    text-align: center;
}

/* When JavaScript sets display:block, it becomes visible with all styling */
#assignee-current[style*="display: block"] {
    display: block !important;
}

/* Responsive width */
@media (max-width: 768px) {
    #assignee-current {
        width: 95%;
        max-width: 600px;
        padding: 15px;
    }
}

.reset-link {
    display: block;
    width: fit-content;
    margin: 15px auto;
    font-size: 12px;
    color: #666;
    text-decoration: none;
}

.reset-link:hover {
    color: #007bff;
    text-decoration: underline;
}

/* Target the permission checkbox containers */
#setup-checkbox-area > div > div {
    background-color: #ffffff !important;
    border: 2px solid #333333 !important;
    border-radius: 8px;
    transition: all 0.2s ease;
}

/* Optional: Add a hover effect */
#setup-checkbox-area > div > div:hover {
    background-color: #f8f9fa !important;
    border-color: #000000 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Style the checkboxes themselves */
#setup-checkbox-area input[type="checkbox"] {
    accent-color: #007bff;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Style the labels */
#setup-checkbox-area label {
    color: #333333;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

/* Rule selector container */
.rule-selector-container {
    padding: 20px;
    text-align: center;
}

/* Admin name label */
.rule-selector-label {
    margin-bottom: 15px;
    font-weight: bold;
    color: #333;
}

/* Admin name span */
.rule-selector-name {
    color: #007bff;
    font-size: 1.2em;
    display: block;
    margin-top: 5px;
}

/* Rule selector dropdown - extends admin-style-dropdown */
.rule-selector-dropdown {
    width: 100%;
    max-width: 500px;
    border: 2px solid #007bff;
    background: #f0f7ff;
    padding: 12px;
    border-radius: 10px;
    font-weight: bold;
    margin: 0 auto;
}

/* Save status indicator */
.rule-save-status {
    margin-top: 12px;
    font-size: 12px;
    font-weight: bold;
    height: 15px;
    color: #28a745;
}

/* Footnote text */
.rule-footnote {
    font-size: 11px;
    color: #888;
    margin-top: 15px;
    line-height: 1.4;
}
/* ============================================
   USER CARD STYLES
   ============================================ */



/* Alert box base styles */
.alert-box {
    max-width: 550px;
    margin: 0 auto 15px auto;
    padding: 10px;
    border-radius: 12px;
    font-size: 12px;
    text-align: center;
}

/* Restricted access alert (red) */
.alert-box.restricted {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

/* Info alert (grey) */
.alert-box.info {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* Warning alert (yellow) */
.alert-box.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Role dropdown */
.level-select {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #004085;
    background-color: #e7f3ff;
    border: 2px solid #b8daff;
    border-radius: 20px;
    cursor: pointer;
    text-align-last: center;
    display: block;
    outline: none;
    transition: all 0.2s ease;
}

.level-select:disabled {
    background-color: #f1f3f5;
    border-color: #ddd;
    color: #6c757d;
    cursor: not-allowed;
}

.level-select:hover:not(:disabled) {
    background-color: #d4e3ff;
    border-color: #007bff;
}

/* Scrub button */
.scrub-btn {
    margin-top: 15px;
    width: 100%;
    max-width: 500px;
    padding: 12px 24px;
    border: 2px solid #dc3545;
    border-radius: 50px;
    background: #dc3545;
    color: white;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
    display: block;
}

.scrub-btn:hover:not(:disabled) {
    background: #c82333;
    border-color: #bd2130;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.4);
}

.scrub-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(220, 53, 69, 0.4);
}

.scrub-btn:disabled {
    background: #e9ecef;
    border-color: #ced4da;
    color: #adb5bd;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

/* Manage access (Passport) button */
.manage-access-btn {
    margin-top: 20px;
    width: 100%;
    max-width: 500px;
    padding: 12px;
    background: #fff;
    border: 2px solid #007bff;
    color: #007bff;
    border-radius: 15px;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
	margin-left: auto;
    margin-right: auto;
}

.manage-access-btn:hover {
    background: #f0f7ff;
    border-color: #0056b3;
    color: #0056b3;
}

.manage-access-btn:active {
    transform: translateY(1px);
}

/* Access list container */
/* Access list container */
[id^="access-list-"] {
    max-width: 500px;
    margin: 10px auto 0 auto;
    width: 100%;
    box-sizing: border-box;
    display: none; /* Hidden by default */
}

/* Only show border and background when it has content AND is visible */
[id^="access-list-"]:not(:empty) {
    border: 1px solid #ddd;
    padding: 10px;
    background: #fdfdfd;
    border-radius: 10px;
}

/* When it's set to block by JS but still empty, keep it invisible */
[id^="access-list-"][style*="display: block"]:empty {
    display: none !important;
}

/* Save status indicator */
#save-status {
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    height: 18px;
    color: #28a745;
    margin-top: 10px;
}
/* Territory Management Tool Wrapper */
#tm-tool-wrapper {
    max-width: 500px;
    margin: 0 auto;
    background-color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
}

/* Ensure all direct children maintain consistent spacing */
#tm-tool-wrapper > * {
    margin-bottom: 15px;
}

#tm-tool-wrapper > *:last-child {
    margin-bottom: 0;
}

/* Style the accordion headers inside */
#tm-tool-wrapper .cong-accordion-header {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#tm-tool-wrapper .cong-accordion-header:hover {
    background-color: #e9ecef;
}

#tm-tool-wrapper .cong-accordion-header.active {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
}

/* Style the panels */
#tm-tool-wrapper .cong-accordion-panel {
    background-color: #ffffff;
    border: 1px solid #000000;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 20px;
}

/* Style input fields */
#tm-tool-wrapper input[type="number"],
#tm-tool-wrapper input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

#tm-tool-wrapper input[type="number"]:focus,
#tm-tool-wrapper input[type="text"]:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* Style buttons */
#tm-tool-wrapper .admin-button {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#tm-tool-wrapper .admin-button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.2);
}

#tm-tool-wrapper .admin-button:active {
    transform: translateY(1px);
    box-shadow: none;
}

/* ============================================== */
/* ANDROID DROPDOWN FIX - PASTE AT BOTTOM OF CSS */
/* ============================================== */

/* 1. Force the root to identify as light mode to the browser engine */
:root {
  color-scheme: light;
}

/* 2. Hard override for ALL select elements to prevent grey background */
select {
  background-color: #ffffff !important;
  color: #000000 !important;
  opacity: 1 !important;
  /* Ensures the native Android styling doesn't override the color */
  -webkit-text-fill-color: #000000 !important; 
}

/* 3. Force the popup options (the list that opens up) to be white */
option {
  background-color: #ffffff !important;
  color: #000000 !important;
}

/* 4. Specific fix for your .mobile-native-select class */
/* Since you used 'appearance: auto', Android tries to theme this heavily. */
/* We keep the arrow but force the colors. */
.mobile-native-select {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* 5. Fix for .admin-style-dropdown to ensure your SVG arrow remains visible */
/* If the background turns grey, the arrow often disappears. This keeps it white. */
.admin-style-dropdown {
    background-color: #ffffff !important;
}



/* ================================================================
   SUBDIVISION ACCORDION
   ================================================================ */

.territory-accordion-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* --- PARENT CARD --- */
.parent-card {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.parent-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: #f1f3f5;
    border-left: 4px solid #adb5bd;
}

.parent-card .card-header.status-active {
    background: #fff3cd;
    border-left-color: #f0ad4e;
}

.parent-card .card-header.status-none {
    background: #e9ecef;
    border-left-color: #adb5bd;
}

.territory-number {
    font-weight: 700;
    font-size: 15px;
    color: #333;
    margin-right: 8px;
}

.territory-description {
    font-size: 13px;
    color: #555;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-active   { background: #dc3545; color: #fff; }
.status-badge.status-available { background: #e9ecef; color: #666; }
.status-badge.status-returned  { background: #28a745; color: #fff; }
.status-badge.status-none      { background: #adb5bd; color: #fff; }

.holder-name {
    font-size: 13px;
    font-weight: 600;
    color: #856404;
}

/* --- SUBDIVISIONS HEADER --- */
.subdivisions-header {
    padding: 10px 4px 4px;
}

.subdivisions-title {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.subdivisions-locked {
    font-size: 10px;
    color: #adb5bd;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 4px;
}

/* --- CHILD CARDS --- */
.child-card {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 6px;
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.child-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 14px;
    cursor: pointer;
    user-select: none;
    background: #eef6ff;
    transition: background 0.15s;
}

.child-card .card-header:hover {
    background: #deeeff;
}

/* Locked child — greyed out */
.locked-card .card-header {
    background: #f5f5f5;
    cursor: pointer;
}

.locked-card .card-header:hover {
    background: #ececec;
}

.accordion-icon {
    font-size: 10px;
    color: #adb5bd;
    transition: transform 0.2s;
    min-width: 12px;
}

.subdivision-description {
    font-size: 13px;
    color: #333;
}

.locked-card .subdivision-description {
    color: #999;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.lock-icon {
    font-size: 12px;
    opacity: 0.5;
}

.status-text {
    font-size: 11px;
    color: #888;
}

.holder-badge {
    font-size: 11px;
    font-weight: 600;
    background: #e8f4fd;
    color: #0056b3;
    padding: 2px 7px;
    border-radius: 10px;
}

.locked-card .holder-badge {
    background: #ececec;
    color: #999;
}

/* --- CARD CONTENT (expanded) --- */
.child-card .card-content {
    background: #fff;
    border-top: 1px solid #dee2e6;
    padding: 12px 14px;
}

.locked-card .card-content {
    background: #fafafa;
}

.content-row {
    display: flex;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.content-row:last-child {
    border-bottom: none;
}

.content-label {
    color: #888;
    min-width: 90px;
    font-size: 12px;
    padding-top: 1px;
}

.content-value {
    color: #333;
    font-weight: 500;
}

.locked-info .content-value {
    color: #aaa;
}

.locked-notice {
    margin-top: 10px;
    font-size: 11px;
    color: #bbb;
    text-align: center;
    padding: 6px;
    background: #f5f5f5;
    border-radius: 6px;
}

/* --- ASSIGNMENT CONTROLS --- */
.assignment-controls {
    width: 100%;
}

.slot-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
}

.slot-label {
    color: #888;
    min-width: 90px;
    font-size: 12px;
}

.slot-value, .date-value {
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.15s;
}

.slot-value.empty, .date-value.empty {
    background: #f0f7ff;
    color: #0056b3;
    border: 1px dashed #90c4f9;
}

.slot-value.filled, .date-value.filled {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
    font-weight: 600;
}

.slot-value:hover, .date-value:hover {
    filter: brightness(0.95);
}

.return-btn {
    margin-top: 8px;
    width: 100%;
    padding: 9px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #f0ad4e;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.return-btn:hover {
    background: #ffeaa0;
}

/* --- EMPTY STATE --- */
.no-subdivisions {
    text-align: center;
    padding: 20px;
    color: #adb5bd;
    font-size: 13px;
    font-style: italic;
}

/* 1. BASE STYLES FIRST */
.user-card {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px;
    border-bottom: 1px solid #eee;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.user-card.banned-row {
    background-color: #fff5f5;
}

.user-info {
    flex: 1;
    min-width: 200px;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-name.banned-text {
    color: #d32f2f;
}

.user-permissions {
    width: 200px;
}

/* 2. RESPONSIVE OVERRIDES AFTER — both breakpoints combined */
@media (max-width: 600px) {
    .user-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .user-permissions {
        width: 100%;
        justify-content: flex-start;
        gap: 2px;
    }
}

@media (max-width: 480px) {
    .user-card {
        position: relative;
        box-sizing: border-box;
    }
}


/* =============================================
   GEOMETRY VIEWER
   ============================================= */

.geo-wrapper {
    max-width: 100%;
    padding: 10px;
}

.geo-total {
    font-size: 12px;
    color: #888;
    margin-bottom: 12px;
}

.geo-loading,
.geo-empty,
.geo-error {
    text-align: center;
    padding: 20px;
}

.geo-empty { color: #888; }
.geo-error { color: #e74c3c; }

/* --- ACCORDION BLOCKS --- */

.geo-cong-block {
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.geo-type-block {
    margin-bottom: 6px;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
}

.geo-ter-block {
    margin-bottom: 4px;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
}

/* --- ACCORDION BUTTONS --- */

.geo-btn {
    width: 100%;
    text-align: left;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.geo-btn-cong {
    padding: 12px 16px;
    background: #2c3e50;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.geo-btn-type {
    padding: 10px 14px;
    color: white;
    font-size: 13px;
}

.geo-btn-type-residential { background: #2980b9; }
.geo-btn-type-business    { background: #8e44ad; }

.geo-btn-ter {
    padding: 8px 12px;
    background: #f8f9fa;
    color: #2c3e50;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

/* --- BADGES --- */

.geo-badge {
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 12px;
}

.geo-badge-ter {
    background: #ddd;
    color: #555;
    font-size: 11px;
}

/* --- PANEL --- */

.geo-panel { display: block; padding: 6px; }
.geo-panel-hidden { display: none; }

/* --- TABLE --- */

.geo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    overflow-x: auto;
}

.geo-table th {
    padding: 6px 10px;
    background: #f0f0f0;
    color: #555;
    text-align: left;
}

.geo-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f5f5f5;
}

/* --- TYPE BADGES --- */

.geo-type-badge {
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: bold;
}

.geo-type-boundary    { background: #d5f5e3; color: #1e8449; }
.geo-type-subdivision { background: #fdebd0; color: #a04000; }

/* --- DELETE BUTTON --- */

.geo-delete-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 3px 10px;
    cursor: pointer;
    font-size: 11px;
}

.geo-delete-btn-confirming {
    background: #c0392b;
}

/* --- MOBILE --- */

@media (max-width: 768px) {

    .geo-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .geo-btn-cong {
        font-size: 13px;
        padding: 10px 12px;
    }

    .geo-btn-type {
        font-size: 12px;
        padding: 8px 12px;
    }

    .geo-btn-ter {
        font-size: 12px;
        padding: 7px 10px;
    }

    .geo-table th,
    .geo-table td {
        padding: 5px 7px;
        font-size: 11px;
    }

    .geo-delete-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}