/* ============================================
   KIDS OVER PROFITS - DATA FORM STYLESHEET
   Comprehensive styling for the facility data form
   ============================================ */

/* ============================================
   BASE & LAYOUT
   ============================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #000435; /* Midnight text for contrast */
    background: #F2EEDF; /* Sand / Warm Ivory */
    margin: 0;
    padding: 20px;
}

/* ============================================
   PUBLIC/PAGE OVERRIDES FOR ACCESSIBLE CONTRAST
   ============================================ */

/* Base container: warm ivory background with midnight text */
.container {
    background: #F2EEDF;
    color: #000435;
}

.admin-header h1,
.admin-header p,
.admin-warning {
    color: #000435;
}

.admin-warning {
    background: #FFF5CB;
    border: 2px solid #33A7B5;
}

.category-tabs .category-tab {
    background: #B6E3D4;
    color: #000435;
    border: 1px solid #33A7B5;
}

.category-tabs .category-tab.active {
    background: #33A7B5;
    color: #FFFFFF;
    border-color: #000435;
}

.section {
    background: #FFFFFF;
    border: 1px solid #000435;
}

.section-header {
    background: #33A7B5;
    color: #FFFFFF;
    border-bottom: 1px solid #000435;
}

.section-title {
    color: #FFFFFF;
}

.section-toggle {
    color: #FFFFFF;
}

.content-box,
.info-box,
.facility-toc,
.facility-controls {
    background: #FFF5CB;
    border: 1px solid #000435;
    color: #000435;
}

label,
.section .section-title,
.content-header h3 {
    color: #000435;
}

.input-form,
.input-secondary,
textarea,
select {
    background: #FFFFFF;
    color: #000435;
    border: 1px solid #000435;
}

.input-form:focus,
.input-secondary:focus,
textarea:focus,
select:focus {
    border-color: #33A7B5;
    box-shadow: 0 0 0 2px rgba(51, 167, 181, 0.25);
}

.btn {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%);
    color: #FFFFFF;
    border: 2px solid #33A7B5;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(51, 167, 181, 0.2);
}

.btn:hover,
.btn:focus {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%);
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(51, 167, 181, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #AEE0ED 0%, #FFF5CB 100%);
    color: #000435;
    border: 2px solid #33A7B5;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #FFF5CB 0%, #AEE0ED 100%);
}

.btn-danger,
.save-master-btn {
    background: linear-gradient(135deg, #FE8088 0%, #FC8ED6 100%);
    color: #000435;
    border: 2px solid #FE8088;
}

.btn-danger:hover,
.save-master-btn:hover {
    background: linear-gradient(135deg, #FC8ED6 0%, #FE8088 100%);
}

.btn-primary,
.btn-success,
.save-suggestion-btn {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%);
    color: #FFFFFF;
    border: 2px solid #33A7B5;
}

.btn-primary:hover,
.btn-success:hover,
.save-suggestion-btn:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%);
}

.info-text,
.text-muted {
    color: #000435;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: #AEE0ED; /* Powder Blue */
    border: 2px solid #33A7B5; /* Teal */
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(252, 142, 214, 0.15), 0 8px 24px rgba(178, 225, 2, 0.1);
    border: 3px solid transparent;
    background-clip: padding-box;
    position: relative;
}

.container::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(135deg, #FC8ED6, #B2E102, #33A7B5, #EF9034);
    border-radius: 12px;
    z-index: -1;
}

/* ============================================
   HEADER & ADMIN ELEMENTS
   ============================================ */
.admin-header {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal */
    color: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: center;
    border: 3px solid #FE8088; /* Coral Pink outline */
}

.admin-header h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
    color: #FFFFFF; /* White */
    font-weight: 700;
}

.admin-header p {
    margin: 0;
    opacity: 0.95;
    font-size: 16px;
}

.admin-warning {
    background: #FFF5CB; /* Soft Pastel Yellow */
    border: 2px solid #EF9034; /* Orange */
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
    color: #000435; /* Midnight Blue */
    font-weight: 600;
}

/* New Top Actions Bar */
.top-actions-bar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
}

/* ============================================
   CATEGORY NAVIGATION (TOP TABS)
   ============================================ */
.category-navigation {
    border: 2px solid #FC8ED6; /* Bubblegum Pink */
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    background: #000080; /* Navy Blue */
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.category-tabs {
    display: flex;
    gap: 5px;
    background: #FFF5CB; /* Soft Pastel Yellow */
    padding: 5px;
    border-radius: 8px;
    justify-content: center; /* Center the tabs */
    border: 2px solid #B2E102; /* Chartreuse */
}

.category-tab {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid transparent;
    background: transparent;
    color: #000435;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.category-tab:hover {
    background: #fff;
    color: #000435;
}

.category-tab.active {
    background: #000080; /* Navy Blue */
    color: #FFFFFF;
    box-shadow: 0 2px 4px rgba(0, 0, 128, 0.2);
    border: 2px solid #FE8088; /* Coral Pink */
}

/* Facility loader panel matches category navigation styling */
.facility-loader-panel {
    border: 2px solid #FC8ED6; /* Bubblegum Pink */
    border-radius: 8px;
    padding: 18px;
    margin: 20px 0;
    background: #000080; /* Navy Blue */
    color: #FFFFFF;
    box-shadow: 0 4px 10px rgba(0, 0, 128, 0.18);
}

.facility-loader-panel h2 {
    margin: 0 0 12px 0;
    color: #FFFFFF;
    font-size: 18px;
    font-weight: 700;
}

.facility-loader-panel .form-group label {
    color: #FFFFFF;
    font-weight: 700;
}

.quick-facilities-list {
    max-height: 250px;
    overflow-y: auto;
    border: 2px solid #B2E102; /* Chartreuse */
    border-radius: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #FFF5CB 0%, #FFFFFF 100%);
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.18);
    color: #000435;
    margin-top: 8px;
}

.quick-facilities-empty {
    color: #6b7280;
    font-style: italic;
}

/* Consultants TOC - match category navigation styling */
#consultants-toc,
#facility-toc {
    border: 2px solid #FC8ED6; /* Bubblegum Pink */
    background: #000080; /* Navy Blue */
    color: #FFFFFF;
    box-shadow: 0 4px 10px rgba(0, 0, 128, 0.2);
    border-radius: 10px;
}

#consultants-toc .toc-header,
#facility-toc .toc-header {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Match admin-header */
    color: #FFFFFF;
    border-bottom: 3px solid #FE8088; /* Coral Pink accent */
}

#consultants-toc .toc-title,
#facility-toc .toc-title {
    color: #fff;
}

#consultants-toc .toc-toggle,
#facility-toc .toc-toggle {
    background: linear-gradient(135deg, #B6E3D4 0%, #FFF5CB 100%); /* Mint to Yellow */
    color: #000435;
    border-color: #33A7B5; /* Teal */
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.2);
}

#consultants-toc .toc-toggle:hover,
#facility-toc .toc-toggle:hover {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%);
    color: #FFFFFF;
}

#consultants-toc .toc-content,
#facility-toc .toc-content {
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF5CB 100%);
    color: #000435;
}

/* Category content containers */
.category-contents-wrapper {
    margin-top: 15px;
}

.category-content, .facility-toc {
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF5CB 100%); /* White to Soft Pastel Yellow */
    border: 2px solid #33A7B5; /* Teal */
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.15);
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.15), inset 0 0 20px rgba(252, 142, 214, 0.05);
}

.category-content.d-none {
    display: none;
}

.view-hidden {
    display: none !important;
}

.content-header h3 {
    margin: 0 0 8px 0;
    color: #000000;
    font-size: 16px;
    font-weight: 600;
}

.content-header p {
    margin: 0 0 12px 0;
    color: #AEE0ED; /* Powder Blue */
    font-size: 13px;
}

.content-header .mb-15 {
    margin-bottom: 12px;
}

.content-header h3 {
    margin: 0 0 6px 0;
    font-size: 18px;
    font-weight: 700;
    color: #000435;
}

.content-header .input-primary {
    height: 36px;
    max-width: 300px;
    flex: 0 1 auto;
}

.content-header .btn-inline {
    height: 36px;
    padding: 0 14px;
    flex-shrink: 0;
}

.content-header .d-flex {
    align-items: center;
}

/* ============================================
   PROJECT MANAGEMENT SECTIONS
   ============================================ */
.project-management {
    text-align: left;
    margin-bottom: 20px;
    padding: 16px;
    border: 2px solid #33A7B5;
    border-radius: 10px;
    background: linear-gradient(135deg, #FFF5CB 0%, #AEE0ED 100%);
    box-shadow: 0 4px 10px rgba(51, 167, 181, 0.18);
}

.project-management h2 {
    text-align: left;
    color: #000435 !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    margin: 5px 0 12px 0 !important;
}

.project-management .form-group {
    text-align: left;
}

.project-management .form-group label {
    text-align: left;
    display: block;
    width: 100%;
    font-weight: 700;
    color: #000435;
    font-size: 14px;
}

.project-management .btn {
    margin: 5px;
}

/* Project action groups */
.project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
}

.project-action-btn {
    padding: 8px 12px;
    background: #33A7B5;
    color: #FFFFFF;
    border: 2px solid #000435;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 4, 53, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.project-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 4, 53, 0.22);
    background: #000080;
    color: #FFFFFF;
}

/* Responsive layout for project actions */
@media (max-width: 768px) {
    .project-actions {
        gap: 6px;
    }

    .project-action-btn {
        padding: 6px 10px;
        font-size: 12px;
        flex: 1 1 auto;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .project-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .project-action-btn {
        width: 100%;
    }
}

/* ============================================
   LOCATION TAB POLISH
   ============================================ */
#states-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.location-project-management {
    margin-bottom: 0;
}

.location-card {
    background: linear-gradient(135deg, #FFF5CB 0%, #B6E3D4 100%);
    border: 2px solid #33A7B5;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 4px 10px rgba(51, 167, 181, 0.18);
    color: #0f172a;
}

.location-card .kop-btn {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%);
    color: #FFFFFF;
    border-color: #000435;
}

/* Responsive location card layout */
@media (max-width: 768px) {
    .location-card {
        padding: 12px;
    }
}

#location-saved-projects-list {
    background: #FFFFFF !important;
    border: 2px solid #33A7B5 !important;
    border-radius: 10px !important;
    padding: 12px !important;
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.2);
}

/* Referrers view polish */
#referrers-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.referrer-card {
    background: linear-gradient(135deg, #AEE0ED 0%, #FFF5CB 100%);
    border: 2px solid #33A7B5;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 4px 10px rgba(51, 167, 181, 0.18);
    color: #0f172a;
}

/* Responsive referrer card layout */
@media (max-width: 768px) {
    .referrer-card {
        padding: 12px;
    }
}

/* Consultant items in overview - matching facility-quick-item styling */
.consultant-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF5CB 100%); /* Match project-item */
    border: 2px solid #FC8ED6; /* Match project-item */
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    align-items: center;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(252, 142, 214, 0.15); /* Match project-item */
    color: #000435;
}

.consultant-item:last-child {
    margin-bottom: 0;
}

.consultant-item:hover {
    background: linear-gradient(135deg, #FFF5CB 0%, #B6E3D4 100%);
    border-color: #B2E102;
    box-shadow: 0 3px 8px rgba(178, 225, 2, 0.25);
    transform: translateY(-2px);
}

.consultant-item.active {
    border-color: #B2E102;
    background: linear-gradient(135deg, #FFF5CB 0%, #B6E3D4 100%);
    box-shadow: 0 3px 8px rgba(178, 225, 2, 0.3);
}

.consultant-item-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%);
    color: #FFFFFF;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 4, 53, 0.25);
    font-size: 12px;
}

.consultant-item-info {
    flex: 1;
    min-width: 0;
}

.consultant-item-name {
    font-weight: 600;
    color: #000435;
    font-size: 14px; /* Match project-item */
    margin-bottom: 2px; /* Match project-item spacing */
    line-height: 1.3;
}

.consultant-item-details {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    word-break: break-word;
}

/* Independent consultant badge */
.consultant-independent-badge {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #FFFFFF;
    border: 2px solid #059669;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.25);
}

.consultant-independent-badge:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-color: #047857;
    box-shadow: 0 3px 6px rgba(5, 150, 105, 0.35);
    transform: translateY(-1px);
}

.consultant-independent-badge.not-independent {
    background: linear-gradient(135deg, #000080 0%, #000435 100%);
    color: #FFFFFF;
    border-color: #000080;
    box-shadow: 0 2px 4px rgba(0, 4, 53, 0.25);
}

.consultant-independent-badge.not-independent:hover {
    background: linear-gradient(135deg, #000435 0%, #000080 100%);
    border-color: #000435;
    box-shadow: 0 3px 6px rgba(0, 4, 53, 0.35);
}

#referrer-saved-projects-list {
    background: #FFFFFF !important;
    border: 2px solid #33A7B5 !important;
    border-radius: 10px !important;
    padding: 12px !important;
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.2);
}

/* Project status text - highlighted */
#project-status,
#project-status-location,
#referrer-project-status,
#upload-status {
    background: linear-gradient(135deg, #FFF5CB 0%, #ECF385 100%); /* Soft Pastel Yellow to Pale Spring Yellow */
    color: #000435; /* Midnight Blue for contrast */
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 700;
    text-align: center;
    margin: 15px auto;
    max-width: 600px;
    border: 2px solid #B2E102; /* Chartreuse */
    box-shadow: 0 3px 8px rgba(178, 225, 2, 0.4);
}

/* Saved project lists - styled containers */
#company-saved-projects-list {
    background: #FFFFFF !important;
    border: 2px solid #33A7B5 !important;
    border-radius: 10px !important;
    padding: 12px !important;
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.2);
    text-align: center;
}

#location-saved-projects-list,
#referrer-saved-projects-list {
    text-align: center;
}

/* ============================================
   FACILITY TABLE OF CONTENTS
   ============================================ */
.facility-toc {
    border: 2px solid #33A7B5; /* Teal */
    border-radius: 10px;
    margin-bottom: 25px;
    overflow: hidden;
    background: linear-gradient(135deg, #FFF5CB 0%, #AEE0ED 100%);
    box-shadow: 0 4px 10px rgba(51, 167, 181, 0.2);
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Match admin-header */
    color: #FFFFFF;
    border-bottom: 3px solid #FE8088; /* Coral Pink accent */
    padding: 15px 20px;
    cursor: pointer;
}

.toc-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.toc-toggle {
    background: linear-gradient(135deg, #33A7B5 0%, #AEE0ED 100%);
    color: #000435;
    border: 2px solid #000435;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 4, 53, 0.2);
}

.toc-toggle:hover {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%);
    color: #FFFFFF;
    border-color: #000435;
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(0, 4, 53, 0.28);
}

.toc-content {
    padding: 15px;
}

.toc-stats {
    background: linear-gradient(135deg, #FFF5CB 0%, #ECF385 100%); /* Match referrer-project-status */
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 700;
    color: #000435;
    border: 2px solid #B2E102; /* Chartreuse accent to align with status */
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.18);
    font-size: 14px;
}

.facility-list {
    background: #FFFFFF;
    border: 2px solid #33A7B5; /* Teal */
    border-radius: 10px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.15);
}

.facility-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF5CB 100%);
    border: 2px solid #FC8ED6;
    border-radius: 6px;
    color: #000435;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(252, 142, 214, 0.15);
}

.facility-item:not(:last-child) {
    margin-bottom: 8px;
}

.facility-item:hover {
    background: linear-gradient(135deg, #FFF5CB 0%, #B6E3D4 100%);
    border-color: #B2E102;
    box-shadow: 0 3px 8px rgba(178, 225, 2, 0.25);
    transform: translateY(-2px);
}

.facility-item:focus {
    outline: none;
}

.facility-item:focus-visible {
    outline: 3px solid #B2E102;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(178, 225, 2, 0.2);
}

.facility-item.active {
    border-color: #B2E102;
    background: linear-gradient(135deg, #FFF5CB 0%, #B6E3D4 100%);
    box-shadow: 0 3px 8px rgba(178, 225, 2, 0.3);
}

.facility-item-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%);
    color: #FFFFFF;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 4, 53, 0.25);
    font-size: 12px;
}

.facility-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.facility-item-name {
    font-weight: 600;
    color: #000435; /* Midnight Blue */
    font-size: 15px;
}

.facility-item-details {
    color: #1f2937; /* Dark Slate */
    font-size: 13px;
}

/* Private ownership badge for facility items in location overview */
.facility-ownership-badge {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: #FFFFFF;
    border: 2px solid #6d28d9;
    box-shadow: 0 2px 4px rgba(109, 40, 217, 0.25);
}

.facility-ownership-badge:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
    border-color: #5b21b6;
    box-shadow: 0 3px 6px rgba(109, 40, 217, 0.35);
    transform: translateY(-1px);
}

.facility-ownership-badge.not-private {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #FFFFFF;
    border-color: #d97706;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.25);
}

.facility-ownership-badge.not-private:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    border-color: #b45309;
    box-shadow: 0 3px 6px rgba(217, 119, 6, 0.35);
}

.facility-quick-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF5CB 100%);
    border: 2px solid #FC8ED6;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    align-items: flex-start;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(252, 142, 214, 0.15);
}

.facility-quick-item:last-child {
    margin-bottom: 0;
}

.facility-quick-item:hover {
    background: linear-gradient(135deg, #FFF5CB 0%, #B6E3D4 100%);
    border-color: #B2E102;
    box-shadow: 0 3px 8px rgba(178, 225, 2, 0.25);
    transform: translateY(-2px);
}

.facility-quick-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%);
    color: #FFFFFF;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 4, 53, 0.25);
    font-size: 12px;
}

.facility-quick-content {
    flex: 1;
    min-width: 0;
}

.facility-quick-name {
    font-weight: 600;
    color: #000435;
    line-height: 1.3;
}

.facility-quick-meta {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    word-break: break-word;
}

.toc-no-project {
    padding: 20px;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

/* ============================================
   FACILITY NAVIGATION CONTROLS
   ============================================ */
.facility-controls {
    background: linear-gradient(135deg, #FFF5CB 0%, #AEE0ED 100%); /* Soft Pastel Yellow to Powder Blue */
    border: 2px solid #FC8ED6; /* Bubblegum Pink */
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(252, 142, 214, 0.2);
}

.facility-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #000435; /* Midnight Blue for readability */
}

.facility-header > .d-flex:first-child {
    justify-content: space-between;
    width: 100%;
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#facility-counter {
    color: #33A7B5; /* Teal */
    font-weight: 700;
}

#current-facility-name {
    color: #000435;
    font-weight: 400;
    font-style: italic;
}

#prev-facility-btn,
#next-facility-btn {
    padding: 8px 12px;
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
    background: #FFF5CB; /* Soft Pastel Yellow */
    border: 2px solid #B2E102; /* Chartreuse */
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(178, 225, 2, 0.15);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    transition: max-width 0.3s ease, margin 0.3s ease;
}

.section.expanded {
    max-width: 100%;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #ECF385 0%, #B6E3D4 100%); /* Pale Spring Yellow to Mint Green */
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 2px solid #B2E102; /* Chartreuse */
    transition: all 0.2s ease;
}

.section-header:hover {
    background: linear-gradient(135deg, #B2E102 0%, #B6E3D4 100%); /* Chartreuse to Mint Green */
    box-shadow: 0 2px 6px rgba(178, 225, 2, 0.3);
}

.section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #000435;
}

.section-toggle {
    color: #FFFFFF;
    font-size: 20px;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.section.expanded .section-toggle {
    transform: rotate(180deg);
}

.section-content {
    padding: 20px;
    background: #FFF5CB; /* Soft Pastel Yellow */
    border: 2px solid #B2E102; /* Chartreuse */
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(178, 225, 2, 0.15);
    display: none;
}

.section.expanded .section-content {
    display: block;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: 20px;
    position: relative;
    z-index: 0;
}

/* Ensure active inputs and dropdowns layer above surrounding fields */
.form-group:focus-within,
.array-item:focus-within,
.array-container:focus-within {
    z-index: 1000;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;    
    color: #000435; /* Midnight Blue */
    font-size: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }
}

/* Input Styles */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="url"],
textarea,
select,
.input-form,
.input-primary,
.input-secondary {
    max-width: 400px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.2s ease;
    background: #FFFFFF;
    line-height: 1.4;
}

/* Note fields should be full width (they don't get + buttons) */
textarea[id$="-notes"],
textarea[data-field="notes"],
textarea[data-field$=".notes"] {
    max-width: 100% !important;
    width: 100% !important;
}

/* ============================================
   SMART FIELD SIZING BY CONTENT TYPE
   Normalize input widths based on expected content
   ============================================ */

/* EXTRA SMALL: 80px - Ages, single numbers */
input[data-field*="ageRange.min"],
input[data-field*="ageRange.max"],
input[data-field*="min-age"],
input[data-field*="max-age"] {
    max-width: 80px;
    width: 80px;
}

/* SMALL: 100px - Capacities, census counts */
input[data-field*="capacity"],
input[data-field*="currentCensus"],
input[data-field*="census"] {
    max-width: 100px;
    width: 100px;
}

/* SMALL-MEDIUM: 120px - Years (4-digit) */
input[data-field*="startYear"],
input[data-field*="endYear"],
input[data-field*=".year"],
input[id*="founded"],
input[id$="-founded"],
input[type="number"][placeholder*="e.g., 19"],
input[type="number"][placeholder*="e.g., 20"] {
    max-width: 120px;
    width: 120px;
}

/* MEDIUM-SMALL: 150px - Gender, short status values */
input[data-field*="gender"],
input[data-field*=".gender"] {
    max-width: 150px;
}

/* MEDIUM: 200px - State abbreviations, operating periods */
input[id*="-state"],
input[data-field*=".state"],
input[id*="state"][placeholder*="e.g.,"],
input[data-field*="operatingPeriod.status"],
input[data-field*="yearsOfOperation"],
input[id*="-period"],
input[id*="period"][data-autocomplete-category] {
    max-width: 200px;
}

/* MEDIUM-LARGE: 250px - Cities */
input[id*="-city"],
input[data-field*=".city"],
input[id*="city"][placeholder*="e.g.,"] {
    max-width: 250px;
}

/* STANDARD: 350px - Names, common text fields */
input[data-field*="name"],
input[data-field*="Name"],
input[id*="-name"],
input[data-autocomplete-category="operator"],
input[data-autocomplete-category="facility"],
input[data-autocomplete-category="human"],
input[id*="operator-name"],
input[id*="facility-name"],
input[id="operator-ceo"] {
    max-width: 350px;
}

/* WIDE: 450px - Websites, emails, longer text */
input[type="url"],
input[type="email"],
input[id*="website"],
input[data-field*="website"],
input[data-field*="email"],
input[id*="-email"] {
    max-width: 450px;
}

/* FULL WIDTH: 100% - Addresses, locations, status fields with long placeholders */
textarea[data-field="address"],
textarea[data-field*=".address"],
input[data-field="location"],
input[data-field*=".location"]:not([id*="city"]):not([id*="state"]),
input[id="operator-status"],
input[data-autocomplete-category="status"][style*="width: 100%"] {
    max-width: 100%;
    width: 100%;
}

/* Array container inputs - let them fill available space */
.array-container input,
.array-item input {
    max-width: none;
    flex: 1;
    min-width: 0;
}

/* Override for array inputs that have specific sizing needs */
.array-input {
    max-width: 350px;
}

/* Wider array inputs for accreditations, memberships, etc. (longer text expected) */
[data-path="accreditations.current"] .array-input,
[data-path="accreditations.past"] .array-input,
[data-path="memberships"] .array-input,
[data-path="certifications"] .array-input,
[data-path="licensing"] .array-input,
[data-path="identification.otherNames"] .array-input,
[data-path="identification.knownReferrers"] .array-input,
[data-path="operator.parentCompanies"] .array-input,
[data-path="operator.websites"] .array-input,
[data-path="profileLinks"] .array-input,
[data-path*="affiliations"] .array-input {
    max-width: 500px;
}

/* URL/website arrays should be even wider */
[data-path*="websites"] .array-input,
[data-path*="profileLinks"] .array-input,
[data-path*="Links"] .array-input {
    max-width: 600px;
}

/* Ensure inputs in form-row respect their column sizing */
.form-row input,
.form-row select,
.form-row-3 input,
.form-row-3 select {
    width: 100%;
    max-width: 100%;
}

/* But allow nested sizing overrides within rows */
.form-row input[data-field*="ageRange"],
.form-row-3 input[data-field*="ageRange"] {
    max-width: 80px;
    width: 80px;
}

.form-row input[data-field*="capacity"],
.form-row-3 input[data-field*="capacity"],
.form-row input[data-field*="census"],
.form-row-3 input[data-field*="census"] {
    max-width: 100px;
    width: 100px;
}

.form-row input[type="number"][data-field*="Year"],
.form-row-3 input[type="number"][data-field*="Year"] {
    max-width: 120px;
    width: 120px;
}

input:focus,
textarea:focus,
select:focus {
    outline: none; border-color: #33A7B5; /* Teal */
    box-shadow: 0 0 0 3px rgba(51, 167, 181, 0.2), 0 0 12px rgba(178, 225, 2, 0.15);
    background: linear-gradient(135deg, #FFFFFF 0%, #FDEFF9 100%); /* White to Light Pink */
}

textarea {
    resize: vertical;
    min-height: 60px;
}

/* Autocomplete Wrapper */
.autocomplete-wrapper {
    position: relative;
    max-width: 400px; /* Leave room for the + button */
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.autocomplete-wrapper:has(.autocomplete-dropdown.active) {
    z-index: 10000;
}

.autocomplete-wrapper input {
    flex: 1;
    max-width: 100%; /* Allow input to fill wrapper but respect wrapper's max-width */
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #FFFFFF 0%, #FFF5CB 100%); /* White to Soft Pastel Yellow */
    border: 2px solid #33A7B5; /* Teal */
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 6px 12px rgba(51, 167, 181, 0.2), 0 2px 6px rgba(178, 225, 2, 0.15);
    display: none;
    margin-top: -1px;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #000435;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: linear-gradient(135deg, #ECF385 0%, #B6E3D4 100%); /* Pale Spring Yellow to Mint Green */
    color: #000435; /* Midnight Blue */
    border-left: 3px solid #B2E102; /* Chartreuse */
    padding-left: 9px;
}

.autocomplete-item strong {
    color: #33A7B5; /* Teal */
    font-weight: 600;
}

.autocomplete-no-results {
    padding: 12px;
    text-align: center;
    color: #000435;
    font-size: 13px;
    font-style: italic;
}

.autocomplete-loading {
    padding: 12px;
    text-align: center;
    color: #000435;
    font-size: 13px;
}

/* Make sure dropdown appears above other elements but below modals */
.autocomplete-wrapper {
    z-index: 100;
}

/* ============================================
   ARRAY CONTAINERS & ITEMS
   ============================================ */
.array-container {
    margin-top: 10px;
    position: relative;
    z-index: 0;
}

.array-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    background: #FFF5CB; /* Soft Pastel Yellow */
    padding: 8px;
    border-radius: 4px;
    border: 2px solid #ECF385; /* Pale Spring Yellow */
    transition: all 0.2s ease;
    position: relative;
    z-index: 0;
    box-shadow: 0 1px 4px rgba(236, 243, 133, 0.2);
}

.array-item:hover {
    background: #ECF385; /* Pale Spring Yellow */
    border-color: #B2E102; /* Chartreuse */
    box-shadow: 0 2px 6px rgba(178, 225, 2, 0.25);
}

.array-item input:not(.array-input),
.array-item textarea:not(.array-input) {
    flex: 1 1 0;
    min-width: 0;
}

/* For staff items with role + name, the + button goes between them */
.array-item .array-input-role {
    order: 1;
}

.array-item .add-plus-btn {
    order: 2;
}

.array-item .array-input-name {
    order: 3;
}

.array-item > button[type="button"]:not(.add-plus-btn) {
    order: 4;
}

.array-input {
    flex: 1;
    max-width: 350px;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 0;
}

.array-input:focus {
    outline: none;
    border-color: #33A7B5; /* Teal */
    box-shadow: 0 0 0 3px rgba(51, 167, 181, 0.2), 0 0 8px rgba(178, 225, 2, 0.15);
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF5CB 100%);
    background: linear-gradient(135deg, #FFFFFF 0%, #FDEFF9 100%); /* White to Light Pink */
}

.array-input-role {
    flex: 0 0 35%;
    min-width: 100px;
}

.array-input-name {
    flex: 1;
    min-width: 0;
}

/* URL fields with display text */
.array-input-url {
    flex: 2;
    min-width: 200px;
    max-width: none;
}

.array-input-display-text {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
}

/* Style for URL input type */
input[type="url"].array-input {
    font-family: monospace;
    font-size: 13px;
}

/* ============================================
   BUTTONS - CRITICAL STYLING
   ============================================ */

/* Base Button Style */
.btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #FE8088; /* Coral Pink outline */
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    min-height: fit-content;
}

.btn:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(51, 167, 181, 0.3), 0 0 12px rgba(254, 128, 136, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-danger {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    border: 2px solid #FE8088; /* Coral Pink outline */
}

.btn-danger:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    box-shadow: 0 4px 6px rgba(51, 167, 181, 0.3), 0 0 12px rgba(254, 128, 136, 0.2);
}

.btn-secondary {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    border: 2px solid #FE8088; /* Coral Pink outline */
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    box-shadow: 0 4px 6px rgba(51, 167, 181, 0.3), 0 0 12px rgba(254, 128, 136, 0.2);
}

.btn-inline {
    padding: 8px 14px;
    font-size: 13px;
}

/* Plus Button for Adding Items Inline - matches admin header */
.add-plus-btn {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    min-width: 28px !important;
    max-width: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
    font-size: 16px;
    font-weight: 700;
    flex: 0 0 28px !important; /* Prevent stretching */
    border-radius: 4px;
    border: 2px solid #FE8088; /* Coral Pink */
    box-shadow: 0 2px 4px rgba(51, 167, 181, 0.3);
    transition: all 0.2s ease;
    white-space: nowrap !important;
}

.add-plus-btn:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    box-shadow: 0 3px 8px rgba(51, 167, 181, 0.5), 0 0 10px rgba(254, 128, 136, 0.3);
    transform: scale(1.1);
}

/* Add Item Button (at bottom of arrays) - matches admin header */
.add-item-btn {
    padding: 8px 16px;
    margin-top: 8px;
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
    border: 2px solid #FE8088; /* Coral Pink */
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-block;
    width: auto;
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.3);
}

.add-item-btn:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    box-shadow: 0 4px 10px rgba(51, 167, 181, 0.5), 0 0 12px rgba(254, 128, 136, 0.3);
    transform: translateY(-1px);
}

/* Remove Button - small inline minus button */
.remove-btn {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    min-width: 28px !important;
    max-width: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    background: #FE8088; /* Coral Pink */
    color: white;
    font-size: 16px;
    line-height: 1;
    flex: 0 0 28px !important; /* Prevent stretching */
    border-radius: 4px;
    border: none;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.remove-btn:hover {
    background: #fa5f69 !important; /* Darker Coral Pink */
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================
   CHECKBOX GROUPS
   ============================================ */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.checkbox-group:hover {
    background: #ECF385; /* Pale Spring Yellow */
    border-color: #B2E102; /* Chartreuse */
    box-shadow: 0 1px 4px rgba(178, 225, 2, 0.2);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #33A7B5; /* Teal */
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    color: #374151; /* Set a dark color for readability on light backgrounds */
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.d-flex {
    display: flex;
}

.d-none {
    display: none !important;
}

.gap-5 {
    gap: 5px;
}

.gap-10 {
    gap: 10px;
}

.gap-15 {
    gap: 15px;
}

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

.mb-15 {
    margin-bottom: 15px;
}

.mt-15 {
    margin-top: 15px;
}

.fw-normal {
    font-weight: 400;
}

.text-muted {
    color: #000435;
}

.italic {
    font-style: italic;
}

/* ============================================
   INPUT WIDTH UTILITY CLASSES
   ============================================ */
.input-xs {
    max-width: 80px !important;
    width: 80px !important;
}

.input-sm {
    max-width: 120px !important;
    width: 120px !important;
}

.input-md {
    max-width: 200px !important;
}

.input-lg {
    max-width: 350px !important;
}

.input-wide {
    max-width: 450px !important;
}

.input-full {
    max-width: 100% !important;
    width: 100% !important;
}

.bg-light {
    background: #F2EEDF; /* Sand / Warm Ivory */
    background: #FFF5FA; /* Very Light Pink */
}

.content-box {
    padding: 15px;
    border-radius: 6px;
    border: 2px solid #FC8ED6; /* Bubblegum Pink */
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF5CB 100%); /* White to Soft Pastel Yellow */
    box-shadow: 0 2px 4px rgba(252, 142, 214, 0.15);
}

.info-text {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
}

.info-box {
    background: linear-gradient(135deg, #FFF5FA 0%, #FFE4E6 100%); /* Very Light Pink to Misty Rose */
    border: 2px solid #FE8088; /* Coral Pink */    
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 6px rgba(254, 128, 136, 0.2);
}

.info-title {
    font-weight: 600; /* Using .section-title styles */
    color: #000435;
    margin-bottom: 5px;
}

.scroll-container {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid #33A7B5; /* Teal */    
    border-radius: 6px;
    padding: 15px;
    background: linear-gradient(135deg, #FFFFFF 0%, #AEE0ED 100%); /* White to Powder Blue */
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.15);
}

/* ============================================
   ITEMS LIST (Project/Operator Lists)
   ============================================ */
.items-list {
    background: linear-gradient(135deg, #FFFFFF 0%, #AEE0ED 50%, #B6E3D4 100%); /* White to Powder Blue to Mint Green */
    border: 2px solid #33A7B5; /* Teal */
    border-radius: 6px;
    padding: 10px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(51, 167, 181, 0.2);
}

.items-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Project Item Cards */
.project-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF5CB 100%); /* White to Soft Pastel Yellow */
    border: 2px solid #FC8ED6; /* Bubblegum Pink */
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    align-items: center;
    box-shadow: 0 2px 4px rgba(252, 142, 214, 0.15);
}

.project-item:hover {
    background: linear-gradient(135deg, #FFF5CB 0%, #B6E3D4 100%); /* Soft Pastel Yellow to Mint Green */
    border-color: #B2E102; /* Chartreuse */
    box-shadow: 0 3px 8px rgba(178, 225, 2, 0.25);
    transform: translateY(-2px);
}

.project-item-name {
    font-weight: 600;
    color: #000435;
    font-size: 14px;
    margin-bottom: 2px;
    line-height: 1.3;
}

.project-item-date {
    font-size: 12px;
    color: #000435;
    line-height: 1.3;
}

.project-item-date small {
    font-size: 11px;
    color: #000435;
}

.project-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.project-item-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid #FE8088; /* Coral Pink outline */
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
}

.project-item-load {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
}

.project-item-load:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(51, 167, 181, 0.3), 0 0 8px rgba(254, 128, 136, 0.2);
}
.project-item-rename {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
}
.project-item-rename:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(51, 167, 181, 0.3), 0 0 8px rgba(254, 128, 136, 0.2);
}
.project-item-delete {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
}
.project-item-delete:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(51, 167, 181, 0.3), 0 0 8px rgba(254, 128, 136, 0.2);
}

.projects-empty {
    text-align: center;
    padding: 20px 15px;
    color: #000435;
    font-size: 13px;
    line-height: 1.5;
}

.projects-empty small {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: #d1d5db;
}

/* Responsive adjustments for project items */
@media (max-width: 640px) {
    .project-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .project-item-actions {
        justify-content: stretch;
    }

    .project-item-btn {
        flex: 1;
    }
}

/* ============================================
   STATUS MESSAGES
   ============================================ */
.upload-status {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

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

.upload-status.success {
    background: linear-gradient(135deg, #B6E3D4 0%, #B2E102 100%); /* Mint Green to Chartreuse */
    color: #000435; /* Midnight Blue */
    border: 2px solid #33A7B5; /* Teal */
    box-shadow: 0 2px 8px rgba(182, 227, 212, 0.4);
    font-weight: 600;
}

.upload-status.error {
    background: linear-gradient(135deg, #FE8088 0%, #FC8ED6 100%); /* Coral Pink to Bubblegum Pink */
    color: #000435; /* Midnight Blue */
    border: 2px solid #fa5f69;
    box-shadow: 0 2px 8px rgba(254, 128, 136, 0.4);
    font-weight: 600;
}

.upload-status.info {
    background: linear-gradient(135deg, #AEE0ED 0%, #33A7B5 100%); /* Powder Blue to Teal */
    color: white; /* White text on teal background */
    border: 2px solid #33A7B5; /* Teal */
    box-shadow: 0 2px 8px rgba(174, 224, 237, 0.4);
    font-weight: 600;
}

/* ============================================
   JSON DISPLAY
   ============================================ */
.json-output {
    margin-top: 20px;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.output-header h3 {
    margin: 0;
    color: #000435;
    font-size: 16px;
}

.copy-btn {
    padding: 8px 14px;
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
    border: 2px solid #FE8088; /* Coral Pink outline */
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    box-shadow: 0 4px 6px rgba(51, 167, 181, 0.3), 0 0 12px rgba(254, 128, 136, 0.2);
}

#json-display {
    background: #000435; /* Midnight Blue */
    color: #f8fafc;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    line-height: 1.5;
    max-height: 500px;
    overflow-y: auto;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 10000; /* Above toolbar (9999) but below WP admin bar (99999) */
}

.modal.active {
    display: flex !important; /* Show when active class is added */
}

.modal-content {
    background: white;
    color: #1f2937;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: white;
    border-radius: 12px 12px 0 0;
    z-index: 10;
}

.modal-title {
    margin: 0;
    font-size: 20px;
    color: #000435;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #000435;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: linear-gradient(135deg, #FC8ED6 0%, #FE8088 100%); /* Bubblegum Pink to Coral Pink */
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
    color: #1f2937;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: white;
    border-radius: 0 0 12px 12px;
}

.modal-btn {
    padding: 10px 20px;
    border: 2px solid #FE8088; /* Coral Pink outline */
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
    border: 2px solid #FE8088; /* Coral Pink outline */
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.3);
}

.modal-btn-primary:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    box-shadow: 0 4px 10px rgba(51, 167, 181, 0.4), 0 0 12px rgba(254, 128, 136, 0.2);
    transform: translateY(-1px);
}

.modal-btn-secondary {
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
    border: 2px solid #FE8088; /* Coral Pink outline */
}

.modal-btn-secondary:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    box-shadow: 0 4px 6px rgba(51, 167, 181, 0.3), 0 0 12px rgba(254, 128, 136, 0.2);
    transform: translateY(-1px);
}

/* ============================================
   REPORT MODAL CONTENT STYLES
   ============================================ */
#report-modal .modal-content {
    background: #FFFFFF;
}

.report-header {
    border-bottom: 3px solid #33A7B5;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.report-title {
    font-size: 24px;
    color: #33A7B5;
    margin: 0 0 5px 0;
    font-weight: 700;
}

.report-meta {
    color: #6b7280;
    font-size: 14px;
}

.report-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.report-section:last-child {
    border-bottom: none;
}

.report-section .section-title {
    font-size: 18px;
    color: #33A7B5;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
    margin-bottom: 15px;
    background: transparent;
}

.report-section .info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.report-section .info-item {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.report-section .info-label {
    font-weight: 600;
    color: #374151;
    min-width: 120px;
}

.report-section .info-value {
    color: #1f2937;
}

.report-section .facility-card {
    background: #f9fafb;
    border-left: 4px solid #33A7B5;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 0 8px 8px 0;
}

.report-section .facility-name {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.report-section .list-section {
    margin-top: 12px;
}

.report-section .list-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    font-size: 14px;
}

.report-section .list-items {
    margin: 0;
    padding-left: 20px;
    color: #1f2937;
}

.report-section .list-items li {
    padding: 3px 0;
    font-size: 14px;
}

.report-section .subsection-title {
    font-size: 15px;
    color: #6b7280;
    font-weight: 600;
    margin: 15px 0 10px 0;
}

@media (max-width: 768px) {
    .report-section .info-grid {
        grid-template-columns: 1fr;
    }
    
    .report-section .info-item {
        flex-direction: column;
        gap: 2px;
    }
    
    .report-section .info-label {
        min-width: auto;
    }
}

/* ============================================
   SAVE/SUBMIT BUTTON
   ============================================ */
.save-master-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
    border: 2px solid #FE8088; /* Coral Pink outline */
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(51, 167, 181, 0.3);
}

.save-master-btn:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(51, 167, 181, 0.5), 0 0 16px rgba(254, 128, 136, 0.3);
}

.save-master-btn:active {
    transform: translateY(0);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .admin-header {
        padding: 15px;
    }

    .admin-header h1 {
        font-size: 22px;
    }

    .facility-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .controls {
        width: 100%;
    }

    .btn {
        flex: 1;
        min-width: 0;
    }

    .category-tabs {
        flex-direction: column;
    }

    .category-tab {
        width: 100%;
    }
}

/* ============================================
   FIELD NOTE BUTTONS
   ============================================ */
.field-note-btn {
    flex-shrink: 0;
    width: 28px !important;
    height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    aspect-ratio: 1 / 1;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #000080 0%, #33A7B5 100%); /* Navy Blue to Teal - matches admin header */
    color: white;
    border: 2px solid #FE8088; /* Coral Pink outline */
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    white-space: nowrap !important;
}

.field-note-btn:hover {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Reversed gradient */
    box-shadow: 0 2px 4px rgba(51, 167, 181, 0.3), 0 0 8px rgba(254, 128, 136, 0.2);
}

.field-note-btn.has-note {
    background: linear-gradient(135deg, #EF9034 0%, #d97706 100%); /* Orange gradient */
    box-shadow: 0 2px 6px rgba(239, 144, 52, 0.4), 0 0 8px rgba(178, 225, 2, 0.2);
    animation: pulse-glow 2s ease-in-out infinite;
}

.field-note-btn.has-note:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%); /* Darker Orange gradient */
    box-shadow: 0 3px 10px rgba(239, 144, 52, 0.6), 0 0 12px rgba(178, 225, 2, 0.4);
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 2px 6px rgba(239, 144, 52, 0.4), 0 0 8px rgba(178, 225, 2, 0.2);
    }
    50% {
        box-shadow: 0 2px 8px rgba(239, 144, 52, 0.6), 0 0 12px rgba(178, 225, 2, 0.4);
    }
}

/* ============================================
   FIELD NOTE LAYOUTS
   ============================================ */
.form-group.has-note-button .field-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: nowrap; /* keep note button inline */
}

/* Horizontal wrapper for field + plus button */
.field-input-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

/* Fields with note buttons now respect their max-width to leave room for + button */
/* Removed the 100% width override that was forcing fields to take full width */

.form-group.has-note-button .note-controls {
    width: 100%;
}

.note-container {
    width: 100%;
    order: 10;
}

.form-group.has-note-button .field-content > .field-note-btn {
    flex: 0 0 28px;
    align-self: flex-start;
}

.note-controls .note-add-btn {
    align-self: flex-start;
}

.field-notes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}

.note-row {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: flex-start;
}

/* Keep note buttons inline with fields by allowing the input to shrink */
.form-group.has-note-button .field-content input,
.form-group.has-note-button .field-content textarea,
.form-group.has-note-button .field-content select {
    flex: 1 1 auto;
    width: auto;
    max-width: calc(100% - 48px); /* leave space for 28px button + gap */
    min-width: 140px;
}

.array-item .field-note-btn {
    align-self: center;
}

.array-item .note-container {
    flex: 0 0 100%;
    order: 10;
    margin: 4px 0 0 0;
}

.note-textarea {
    flex: 1;
    min-width: 0;
    max-width: 100% !important;
    width: 100% !important;
    min-height: 48px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
}

.remove-note-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    min-width: 28px;
    background: #FE8088; /* Coral Pink */
    color: white;
    font-size: 18px;
    line-height: 1;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.remove-note-btn:hover {
    background: #fa5f69;
}

.note-add-btn {
    flex-shrink: 0;
}

.array-item-notes {
    margin: -4px 0 12px 36px;
    padding: 0;
}

.array-item-notes .field-notes {
    margin-top: 0;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 10000; /* Above toolbar (9999) but below WP admin bar (99999) */
}

.modal.active {
    display: flex !important; /* Show when active class is added */
}

.modal-content {
    background: #FFFFFF;
    color: #1f2937;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: white;
    border-radius: 12px 12px 0 0;
    z-index: 10;
}

.modal-title {
    margin: 0;
    font-size: 20px;
    color: #000435;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #000435;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: linear-gradient(135deg, #FC8ED6 0%, #FE8088 100%); /* Bubblegum Pink to Coral Pink */
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
    color: #1f2937;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: white;
    border-radius: 0 0 12px 12px;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #33A7B5 0%, #000080 100%); /* Teal to Navy Blue */
    color: white;
    box-shadow: 0 2px 6px rgba(51, 167, 181, 0.3);
}

.modal-btn-primary:hover {
    background: linear-gradient(135deg, #000080 0%, #000435 100%); /* Navy Blue to Midnight Blue */
    box-shadow: 0 4px 10px rgba(0, 0, 128, 0.4);
    transform: translateY(-1px);
}

.modal-btn-secondary {
    background: #FC8ED6; /* Bubblegum Pink */
    color: white;
    border: none;
}

.modal-btn-secondary:hover {
    background: #fa74c8; /* Darker Pink */
    transform: translateY(-1px);
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
.facility-list::-webkit-scrollbar,
.items-list::-webkit-scrollbar,
.scroll-container::-webkit-scrollbar,
#json-display::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.facility-list::-webkit-scrollbar-track,
.items-list::-webkit-scrollbar-track,
.scroll-container::-webkit-scrollbar-track,
#json-display::-webkit-scrollbar-track {
    background: #e8e4d8; /* Darker Sand */
    border-radius: 4px;
}

.facility-list::-webkit-scrollbar-thumb,
.items-list::-webkit-scrollbar-thumb,
.scroll-container::-webkit-scrollbar-thumb,
#json-display::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.facility-list::-webkit-scrollbar-thumb:hover,
.items-list::-webkit-scrollbar-thumb:hover,
.scroll-container::-webkit-scrollbar-thumb:hover,
#json-display::-webkit-scrollbar-thumb:hover {
    background: #000435;
}

/* ============================================
   MOBILE / SMALL SCREEN RESPONSIVE STYLES
   ============================================ */

/* Tablets and smaller - changed from 1024px to 768px */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
}

/* Mobile phones and narrow screens */
@media (max-width: 640px) {
    body {
        padding: 10px;
        font-size: 14px;
    }

    .container {
        padding: 15px;
        border-radius: 8px;
    }

    /* Header */
    .admin-header {
        padding: 15px;
    }

    .admin-header h1 {
        font-size: 20px;
    }

    .admin-header p {
        font-size: 14px;
    }

    /* Category Tabs - Stack Vertically */
    .category-navigation {
        padding: 10px;
    }

    .category-tabs {
        flex-direction: column;
        gap: 8px;
    }

    .category-tab {
        width: 100%;
        padding: 12px 16px;
        font-size: 15px;
        text-align: center;
    }

    /* Table of Contents */
    .toc-header {
        padding: 12px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .toc-title {
        font-size: 16px;
        flex: 1;
    }

    .toc-content {
        padding: 12px;
    }

    .facility-list {
        max-height: 200px;
        padding: 10px;
    }

    /* Facility Controls - Stack Everything */
    .facility-controls {
        padding: 15px;
    }

    .facility-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .facility-header h2 {
        font-size: 16px;
        text-align: center;
    }

    .controls {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .controls .btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 14px;
    }

    /* Sections */
    .section {
        margin-bottom: 15px;
        max-width: 100%; /* On mobile, sections are always full width */
    }

    .section-header {
        padding: 12px 15px;
    }

    .section-title {
        font-size: 16px;
    }

    .section-content {
        padding: 15px;
    }

    /* Form Elements */
    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group label {
        font-size: 13px;
    }

    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="url"],
    textarea,
    select,
    .input-form,
    .input-primary,
    .input-secondary {
        max-width: 100%;
        width: 100%;
        font-size: 14px;
        padding: 10px 12px;
    }

    /* Fields with buttons should shrink to fit */
    .form-group.has-note-button .field-content input,
    .form-group.has-note-button .field-content textarea,
    .form-group.has-note-button .field-content select,
    .field-input-wrapper input,
    .field-input-wrapper textarea,
    .field-input-wrapper select {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 100px !important;
        max-width: none !important;
    }

    /* Ensure field-content containers are flex */
    .form-group.has-note-button .field-content,
    .field-input-wrapper {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }

    textarea {
        min-height: 80px;
    }

    /* Autocomplete */
    .autocomplete-wrapper {
        max-width: 100%;
        width: 100%;
    }

    .autocomplete-dropdown {
        max-height: 180px;
        font-size: 13px;
    }

    .autocomplete-item {
        padding: 10px;
    }

    /* Array Items - Stack fields vertically, small buttons on the right */
    .array-item {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: start;
        padding: 10px;
        gap: 8px;
    }

    .array-item input,
    .array-item textarea,
    .array-item select,
    .array-item .field-input-wrapper {
        grid-column: 1;
        max-width: 100%;
        width: 100%;
    }

    /* Small field buttons on the right side */
    .array-item .field-note-btn,
    .array-item .add-plus-btn,
    .array-item .remove-btn {
        grid-column: 2;
        grid-row: 1;
    }

    /* Regular buttons (like Add) stack below fields */
    .array-item > .btn,
    .array-item > button:not(.field-note-btn):not(.add-plus-btn):not(.remove-btn) {
        grid-column: 1 / -1;
        width: 100%;
    }

    .array-input {
        max-width: 100%;
        width: 100%;
        font-size: 14px;
        padding: 10px;
    }

    .array-input-role,
    .array-input-name {
        flex: 1;
        width: 100%;
        max-width: 100%;
    }

    /* Buttons on Mobile - Keep plus/note buttons small */
    .array-item .field-note-btn,
    .array-item .add-plus-btn {
        width: 28px !important;
        max-width: 28px !important;
        min-width: 28px !important;
        height: 28px !important;
        max-height: 28px !important;
        min-height: 28px !important;
        flex: 0 0 28px !important;
        align-self: center;
    }

    .array-item .remove-btn {
        align-self: center;
        width: 28px !important;
        max-width: 28px !important;
        min-width: 28px !important;
        height: 28px !important;
        max-height: 28px !important;
        min-height: 28px !important;
        flex: 0 0 28px !important;
        font-size: 16px;
        order: 10;
    }

    .btn {
        padding: 12px 16px;
        font-size: 14px;
        width: auto; /* Changed from 100% to auto to prevent narrowing in flex containers */
        min-width: 80px; /* Minimum width to prevent vertical text wrapping */
        flex-shrink: 0; /* Prevent buttons from shrinking below min-width */
    }

    /* Only apply full width to buttons that are not in flex containers */
    .controls .btn,
    .project-management .btn,
    .form-group > .btn {
        width: 100%;
    }

    .btn-inline {
        padding: 10px 14px;
        font-size: 13px;
        min-width: 70px;
    }

    .add-item-btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 14px;
    }

    /* Project Management */
    .project-management h2 {
        font-size: 16px !important;
    }

    .project-management .btn {
        width: 100%;
        margin: 5px 0;
    }

    /* Project Items - Full Width Buttons */
    .project-item {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }

    .project-item-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .project-item-btn {
        width: 100%;
        padding: 10px 16px;
        font-size: 13px;
        justify-content: center;
    }

    /* Status Messages */
    #project-status,
    #project-status-location,
    #referrer-project-status,
    #upload-status {
        padding: 10px 15px;
        font-size: 13px;
        margin: 12px auto;
    }

    .upload-status {
        padding: 10px 15px;
        font-size: 13px;
    }

    /* Modal on Mobile */
    .modal-content {
        width: 95%;
        max-width: 100%;
        margin: 10px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }

    .modal-title {
        font-size: 18px;
    }

    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }

    .modal-btn {
        width: 100%;
        padding: 12px 16px;
    }

    /* JSON Display */
    #json-display {
        font-size: 11px;
        padding: 15px;
        max-height: 300px;
    }

    .output-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .copy-btn {
        width: 100%;
    }

    /* Save Button */
    .save-master-btn {
        font-size: 15px;
        padding: 14px;
    }

    /* Top Actions Bar */
    .top-actions-bar {
        flex-direction: column;
        gap: 8px;
    }

    .top-actions-bar .btn {
        width: 100%;
    }

    /* Content Headers */
    .content-header .d-flex {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .content-header .input-primary {
        max-width: 100%;
        width: 100%;
    }

    .content-header .btn-inline {
        width: 100%;
    }

    /* Field Notes on Mobile */
    .note-row {
        flex-direction: column;
        gap: 8px;
    }

    .note-textarea {
        min-height: 60px;
    }

    .remove-note-btn {
        width: 100%;
        height: 36px;
    }

    .array-item-notes {
        margin: 8px 0 12px 0;
    }

    /* Facility / consultant cards – keep badges inline */
    .facility-item,
    .facility-quick-item,
    .consultant-item {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .facility-ownership-badge,
    .consultant-independent-badge {
        flex-shrink: 0;
    }

    /* Consultant navigation - make it wrap on mobile */
    #referrer-consultants-section .section-content > div[style*="display: flex"] {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    #referrer-consultants-section .section-content > div[style*="display: flex"] > div {
        flex-wrap: wrap !important;
        justify-content: center !important;
        width: 100% !important;
    }

    /* Consultant dropdown - make it responsive */
    #consultant-dropdown {
        min-width: 150px !important;
        max-width: 100% !important;
        flex: 1 1 auto !important;
    }

    /* Consultant navigation buttons */
    #prev-consultant-btn,
    #next-consultant-btn,
    #add-consultant-btn,
    #remove-consultant-btn {
        min-width: 90px !important;
        flex-shrink: 0 !important;
    }

    /* General rule: Any flex container with buttons should wrap on mobile */
    div[style*="display: flex"] {
        flex-wrap: wrap !important;
    }

    /* Ensure button groups have proper spacing */
    div[style*="display: flex"][style*="gap"] {
        gap: 8px !important;
    }

    /* Make select dropdowns responsive in flex containers */
    select[style*="min-width"] {
        min-width: 120px !important;
        max-width: 100% !important;
    }
}

/* ============================================
   PAGE-SPECIFIC & MODAL STYLES
   (Moved from data.html)
   ============================================ */

/* Hide site header on data form pages only - toolbar replaces it */
body.page-template-page-admin-data header.site-header,
body.page-template-page-admin-data .site-header,
body.page-template-page-admin-data nav.main-navigation,
body.page-template-page-admin-data .main-navigation,
body.page-template-page-admin-data #masthead,
body.page-template-page-admin-data .header-wrapper,
body.page-template-page-data header.site-header,
body.page-template-page-data .site-header,
body.page-template-page-data nav.main-navigation,
body.page-template-page-data .main-navigation,
body.page-template-page-data #masthead,
body.page-template-page-data .header-wrapper {
    display: none !important;
}

/* Modal Styles */
.organizer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    align-items: center;
    justify-content: center;
}

.organizer-modal.active {
    display: flex;
}

.organizer-modal-content {
    background: white;
    color: #1f2937;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.organizer-modal-header {
    background: linear-gradient(135deg, #33A7B5 0%, #AEE0ED 100%);
    color: #000435;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.organizer-modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.organizer-modal-close:hover {
    background: #000080;
    color: white;
    transform: rotate(90deg);
}

.organizer-modal-body {
    padding: 20px;
    color: #1f2937;
    overflow-y: auto;
    flex: 1;
}

/* Ensure autocomplete dropdowns appear properly in modals */
.organizer-modal-body .autocomplete-dropdown {
    max-height: 180px;
    z-index: 100001;
}

/* Ensure the form groups in modal have relative positioning for dropdowns */
.organizer-modal-body .form-group {
    position: relative;
}

/* Clone Modal Styles */
.clone-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.clone-modal.active {
    display: flex !important;
}

.clone-modal .organizer-modal-content {
    background: white;
    color: #1f2937;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Extra small screens */
@media (max-width: 375px) {
    body {
        padding: 8px;
        font-size: 13px;
    }

    .container {
        padding: 12px;
    }

    .admin-header h1 {
        font-size: 18px;
    }

    .section-title,
    .toc-title {
        font-size: 15px;
    }

    .category-tab {
        font-size: 14px;
        padding: 10px 14px;
    }

    .btn,
    .controls .btn {
        font-size: 13px;
        padding: 10px 14px;
        min-width: 70px; /* Ensure buttons don't become too narrow */
    }

    /* Consultant navigation on very small screens */
    #prev-consultant-btn,
    #next-consultant-btn {
        min-width: 80px !important;
    }

    #consultant-dropdown {
        min-width: 120px !important;
    }

    input,
    textarea,
    select {
        font-size: 13px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body {
        background: white;
    }

    .container {
        box-shadow: none;
    }

    .btn,
    .modal,
    .toc-toggle,
    .section-toggle {
        display: none !important;
    }

    .section {
        page-break-inside: avoid;
    }

    .section-content {
        display: block !important;
    }
}

/* ============================================
   AUTOCOMPLETE DROPDOWN STYLES
   ============================================ */
.autocomplete-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.autocomplete-wrapper input {
    flex: 1;
    min-width: 0;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: none;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    color: #1f2937;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: #e0f2fe;
}

.autocomplete-item[data-placeholder="true"] {
    cursor: default;
    color: #9ca3af;
    font-style: italic;
}

.autocomplete-item[data-placeholder="true"]:hover {
    background-color: transparent;
}

.autocomplete-item strong {
    color: #33A7B5;
    font-weight: 600;
}

/* Ensure dropdown appears above other elements */
.autocomplete-wrapper {
    z-index: 1;
}

.section-content .autocomplete-wrapper {
    z-index: 10;
}

/* Fix for dropdowns inside form groups */
.form-group .autocomplete-wrapper {
    position: relative;
}

.form-group .autocomplete-dropdown {
    width: 100%;
    min-width: 200px;
}

/* Scrollbar styling for dropdown */
.autocomplete-dropdown::-webkit-scrollbar {
    width: 8px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 0 6px 0;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ============================================
   MOBILE SECTION CONTROLS
   ============================================ */

/* Mobile section controls bar - hidden on desktop */
.mobile-section-controls {
    display: none;
}

@media (max-width: 768px) {
    /* Mobile Section Controls Bar */
    .mobile-section-controls {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        background: linear-gradient(135deg, #f8fafc 0%, #e0f2fe 100%);
        border: 1px solid #33A7B5;
        border-radius: 8px;
        margin-bottom: 15px;
        position: sticky;
        top: 0;
        z-index: 100;
        gap: 10px;
    }

    .mobile-section-controls .section-control-label {
        font-size: 13px;
        font-weight: 600;
        color: #000435;
    }

    .mobile-section-controls .section-control-btns {
        display: flex;
        gap: 8px;
    }

    .mobile-section-controls .btn-section-control {
        padding: 6px 12px;
        font-size: 12px;
        background: #33A7B5;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        white-space: nowrap;
    }

    .mobile-section-controls .btn-section-control:hover,
    .mobile-section-controls .btn-section-control:active {
        background: #000435;
    }

    /* Make sections collapsible by default on mobile */
    .section:not(.expanded) .section-content {
        display: none !important;
    }

    /* Section header visual indicator for collapsed state */
    .section:not(.expanded) .section-header {
        border-radius: 8px;
    }

    .section:not(.expanded) .section-toggle::after {
        content: ' ▼';
        font-size: 10px;
    }

    .section.expanded .section-toggle::after {
        content: ' ▲';
        font-size: 10px;
    }

    /* Compact section headers on mobile */
    .section-header {
        padding: 10px 15px;
        min-height: 44px; /* Touch-friendly target */
    }

    /* Visual feedback when tapping section header */
    .section-header:active {
        background: linear-gradient(135deg, #000435 0%, #33A7B5 100%);
    }
}

/* Even smaller screens - stack controls vertically */
@media (max-width: 480px) {
    .mobile-section-controls {
        flex-direction: column;
        gap: 8px;
    }

    .mobile-section-controls .section-control-btns {
        width: 100%;
        justify-content: stretch;
    }

    .mobile-section-controls .btn-section-control {
        flex: 1;
    }
}

