/* ============================================================
   Teen Challenge Staff Portal – Shared Styles
   Aligned with teenchallenge.net branding (Reflex Blue)
   ============================================================ */

/* — CSS Variables — */
:root {
    --tc-blue: #003087;
    --tc-blue-dark: #002060;
    --tc-blue-light: #e8eef6;
    --tc-navy: #001489;
    --tc-text: #1a1a2e;
    --tc-text-secondary: #4a4a6a;
    --tc-text-muted: #6b7280;
    --tc-bg: #f0f2f5;
    --tc-white: #ffffff;
    --tc-border: #d0d5dd;
    --tc-border-light: #e5e7eb;
    --tc-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --tc-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.04);
    --tc-radius: 8px;
    --tc-radius-lg: 12px;
    --tc-font: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --tc-success: #16a34a;
    --tc-success-bg: #dcfce7;
    --tc-danger: #dc2626;
    --tc-danger-bg: #fef2f2;
    --tc-warning: #d97706;
    --tc-warning-bg: #fffbeb;
    --tc-info: #0284c7;
    --tc-info-bg: #e0f2fe;
}

/* — Reset — */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    
}

/* — Body — */
body {
    font-family: var(--tc-font);
    background-color: var(--tc-bg);
    color: var(--tc-text);
    line-height: 1.5;
}

/* Login page body (centered layout) */
body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Hide conditional nav buttons by default to prevent flash-of-content on production
   (where shared-utils.js removes them post-load). On dev, shared-utils.js overrides
   with setProperty('display', 'inline-block', 'important') to show them. */
#navTraining,
#navAdmissions,
#navDemographics { display: none !important; }

/* ============================================================
   NAVBAR
   White background with brand blue accents (matches website)
   ============================================================ */
.navbar {
    background: var(--tc-white);
    color: var(--tc-text);
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 0 var(--tc-border), var(--tc-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 70px;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-logo {
    height: 58px;
    width: auto;
    padding: 4px 0;
}

.navbar h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--tc-blue);
    letter-spacing: -0.3px;
}

.navbar-right {
    display: flex;
    gap: 6px;
    align-items: center;
}

.navbar-right > span {
    color: var(--tc-text-secondary);
    font-size: 14px;
    margin-right: 10px;
    font-weight: 500;
}

.navbar button {
    background: transparent;
    color: var(--tc-text-secondary);
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.15s ease;
    font-family: var(--tc-font);
}

.navbar button:hover {
    background: var(--tc-blue-light);
    color: var(--tc-blue);
}

.navbar button.nav-active {
    background: var(--tc-blue);
    color: var(--tc-white);
}

/* Public header (intake/departure forms) */
.public-header {
    background: var(--tc-white);
    color: var(--tc-text);
    padding: 16px 30px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 0 var(--tc-border), var(--tc-shadow);
}

.public-header .navbar-logo {
    height: 58px;
    width: auto;
}

.public-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--tc-blue);
}

/* ============================================================
   CONTAINERS
   ============================================================ */
.container {
    max-width: 1400px;
    margin: 24px auto;
    padding: 0 24px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
    background: var(--tc-blue);
    color: var(--tc-white);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--tc-font);
    transition: background 0.15s ease;
}

.btn-primary:hover {
    background: var(--tc-blue-dark);
}

.btn-primary:disabled {
    background: #9cb5d8;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6b7280;
    color: var(--tc-white);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--tc-font);
    transition: background 0.15s ease;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: var(--tc-danger);
    color: var(--tc-white);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--tc-font);
    transition: background 0.15s ease;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-edit {
    background: #f59e0b;
    color: var(--tc-white);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--tc-font);
    transition: background 0.15s ease;
}

.btn-edit:hover {
    background: #d97706;
}

.btn-success {
    background: var(--tc-success);
    color: var(--tc-white);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--tc-font);
    transition: background 0.15s ease;
}

.btn-success:hover {
    background: #15803d;
}

.btn-success:disabled {
    background: #86efac;
    cursor: not-allowed;
}

.btn-small {
    padding: 5px 12px;
    font-size: 13px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* ============================================================
   CARDS & SECTIONS
   ============================================================ */
.card {
    background: var(--tc-white);
    padding: 24px;
    border-radius: var(--tc-radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
}

.card h2 {
    color: var(--tc-text);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--tc-blue);
    font-size: 18px;
}

.section {
    margin-bottom: 28px;
    padding: 24px;
    background: #f8f9fb;
    border-radius: var(--tc-radius);
    border: 1px solid var(--tc-border-light);
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--tc-blue);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--tc-blue);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--tc-text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--tc-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--tc-font);
    color: var(--tc-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--tc-blue);
    box-shadow: 0 0 0 3px rgba(0, 48, 135, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.required {
    color: var(--tc-danger);
}

.info-text {
    font-size: 12px;
    color: var(--tc-text-muted);
    font-style: italic;
    margin-top: 4px;
}

/* ============================================================
   FILTERS
   ============================================================ */
.filters {
    background: var(--tc-white);
    padding: 20px;
    border-radius: var(--tc-radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--tc-text-secondary);
    font-size: 13px;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--tc-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--tc-font);
    color: var(--tc-text);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--tc-blue);
    box-shadow: 0 0 0 3px rgba(0, 48, 135, 0.1);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: clamp(10px, 2vw, 20px);
    margin-bottom: 24px;
}

.stat-card {
    background: var(--tc-white);
    padding: clamp(14px, 2vw, 20px);
    border-radius: var(--tc-radius-lg);
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
    transition: box-shadow 0.15s ease;
    min-width: 0;
    overflow-wrap: break-word;
}

.stat-card:hover {
    box-shadow: var(--tc-shadow-md);
}

.stat-card h3 {
    color: var(--tc-text-muted);
    font-size: clamp(11px, 1.4vw, 13px);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-size: clamp(22px, 3vw, 36px);
    font-weight: 700;
    color: var(--tc-blue);
}

.stat-value.blue { color: var(--tc-blue); }
.stat-value.green { color: var(--tc-success); }
.stat-value.orange { color: #ea580c; }
.stat-value.red { color: var(--tc-danger); }
.stat-value.gray { color: var(--tc-text-muted); }
.stat-value.purple { color: #7c3aed; }

.stat-label {
    font-size: clamp(10px, 1.2vw, 12px);
    color: var(--tc-text-muted);
    margin-top: 4px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
    background: var(--tc-white);
    padding: 24px;
    border-radius: var(--tc-radius-lg);
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--tc-blue);
    color: var(--tc-white);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: none;
    white-space: nowrap;
}

th:first-child {
    border-radius: 6px 0 0 0;
}

th:last-child {
    border-radius: 0 6px 0 0;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--tc-border-light);
    font-size: 14px;
    color: var(--tc-text);
}

tr:hover {
    background: var(--tc-blue-light);
}

tr.clickable-row {
    cursor: pointer;
}

tr.clickable-row:hover {
    background: #dbeafe;
}

tr.total-row {
    font-weight: 700;
    background: var(--tc-blue-light);
}

tr.total-row:hover {
    background: #dbeafe;
}

/* ============================================================
   CHART CONTAINERS
   ============================================================ */
.chart-container {
    background: var(--tc-white);
    padding: 24px;
    border-radius: var(--tc-radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
}

.chart-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--tc-text);
}

/* ============================================================
   MESSAGES
   ============================================================ */
.message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: none;
    font-size: 14px;
    font-weight: 500;
}

.message.error, .message-error {
    background: var(--tc-danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.message.success, .message-success {
    background: var(--tc-success-bg);
    color: #166534;
    border: 1px solid #bbf7d0;
}

.message.info {
    background: var(--tc-info-bg);
    color: #075985;
    border: 1px solid #bae6fd;
}

.message.warning {
    background: var(--tc-warning-bg);
    color: #92400e;
    border: 1px solid #fde68a;
}

.success-message {
    background: var(--tc-success-bg);
    color: #166534;
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: none;
    border: 1px solid #bbf7d0;
}

.error-message {
    background: var(--tc-danger-bg);
    color: #991b1b;
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: none;
    border: 1px solid #fecaca;
}

/* ============================================================
   LOADING & EMPTY STATES
   ============================================================ */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--tc-text-muted);
    font-size: 14px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--tc-text-muted);
    font-size: 14px;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

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

.modal {
    background: var(--tc-white);
    border-radius: var(--tc-radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal h2 {
    color: var(--tc-text);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--tc-blue);
    font-size: 18px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-executive { background: #dcfce7; color: #166534; }
.badge-director { background: #dbeafe; color: #1e40af; }
.badge-program-director { background: #e0e7ff; color: #3730a3; }
.badge-staff { background: #cffafe; color: #155e75; }
.badge-intern { background: #ffedd5; color: #9a3412; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fef2f2; color: #991b1b; }

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-scheduled { background: #dbeafe; color: #1e40af; }
.status-enrolled { background: #dcfce7; color: #166534; }
.status-no-show { background: #ffedd5; color: #9a3412; }
.status-dismissed { background: #fef2f2; color: #991b1b; }
.status-left { background: #f3f4f6; color: #4b5563; }
.status-transferred { background: #fef9c3; color: #854d0e; }
.status-completed { background: #f3e8ff; color: #6b21a8; }

.status-active { background: #dcfce7; color: #166534; }
.status-completed-program { background: #dbeafe; color: #1e40af; }
.status-departed { background: #fef2f2; color: #991b1b; }

.status-matched { background: #dcfce7; color: #166534; }
.status-unmatched { background: #fef2f2; color: #991b1b; }
.status-skipped-fields { background: #fef9c3; color: #854d0e; }
.status-auto-created { background: #dbeafe; color: #1e40af; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    color: var(--tc-text);
    font-size: 22px;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--tc-text-muted);
    font-size: 14px;
}

/* ============================================================
   CHECKBOXES & RADIOS
   ============================================================ */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

.checkbox-group label {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
    font-size: 14px;
    color: var(--tc-text);
}

.center-checkboxes {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--tc-border);
    border-radius: 6px;
    padding: 12px;
    background: #f9fafb;
}

.center-checkbox-item {
    padding: 4px;
    margin: 2px 0;
}

.center-checkbox-item label {
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--tc-text);
}

.select-all-btn {
    background: var(--tc-blue);
    color: var(--tc-white);
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--tc-font);
}

.select-all-btn:hover {
    background: var(--tc-blue-dark);
}

/* ============================================================
   TABS
   ============================================================ */
.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: var(--tc-white);
    color: var(--tc-text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    border-radius: var(--tc-radius) var(--tc-radius) 0 0;
    box-shadow: var(--tc-shadow);
    font-family: var(--tc-font);
    transition: all 0.15s ease;
}

.tab-btn.active {
    color: var(--tc-blue);
    border-bottom-color: var(--tc-blue);
}

.tab-btn:hover {
    color: var(--tc-blue);
}

.tab-content {
    display: none;
}

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

/* ============================================================
   RESOURCE CARDS (training page)
   ============================================================ */
.admin-panel {
    background: var(--tc-white);
    padding: 20px;
    border-radius: var(--tc-radius-lg);
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-panel h3 {
    color: var(--tc-text);
}

.category-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--tc-blue);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--tc-blue);
}

.resource-card {
    background: var(--tc-white);
    padding: 18px 20px;
    border-radius: var(--tc-radius);
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.15s ease;
}

.resource-card:hover {
    box-shadow: var(--tc-shadow-md);
}

.resource-info {
    flex: 1;
}

.resource-info strong {
    font-size: 15px;
    color: var(--tc-text);
}

.resource-info p {
    color: var(--tc-text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.resource-actions {
    flex-shrink: 0;
    margin-left: 20px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.resource-type-icon {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 10px;
    text-transform: uppercase;
}

.type-link { background: #dbeafe; color: #1e40af; }
.type-file { background: #dcfce7; color: #166534; }
.type-checklist { background: #ffedd5; color: #9a3412; }

.target-group-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #f3f4f6;
    color: var(--tc-text-muted);
}

.department-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #dcfce7;
    color: #166534;
}

.user-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #ffedd5;
    color: #9a3412;
}

/* ============================================================
   YTD / OUTREACH GRIDS (dashboard)
   ============================================================ */
.ytd-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(10px, 1.5vw, 15px);
}

.outreach-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: clamp(6px, 1vw, 10px);
}

/* ============================================================
   DEMOGRAPHICS (student-demographics page)
   ============================================================ */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: clamp(10px, 2vw, 20px);
    margin-bottom: 24px;
}

.summary-card {
    background: var(--tc-white);
    padding: clamp(14px, 2vw, 20px);
    border-radius: var(--tc-radius-lg);
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
    text-align: center;
}

.summary-card h3 {
    color: var(--tc-text-muted);
    font-size: clamp(11px, 1.4vw, 13px);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: clamp(24px, 3vw, 40px);
    font-weight: 700;
    color: var(--tc-blue);
}

.summary-label {
    font-size: 12px;
    color: var(--tc-text-muted);
    margin-top: 4px;
}

.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.demo-card {
    background: var(--tc-white);
    padding: 20px;
    border-radius: var(--tc-radius-lg);
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
}

.demo-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--tc-text);
    border-bottom: 2px solid var(--tc-blue);
    padding-bottom: 8px;
}

/* Bar chart rows */
.bar-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.bar-label {
    width: 180px;
    min-width: 180px;
    font-size: 13px;
    color: var(--tc-text-secondary);
    text-align: right;
    padding-right: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-track {
    flex: 1;
    height: 22px;
    background: var(--tc-blue-light);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 2px;
}

.bar-value {
    width: 75px;
    min-width: 75px;
    font-size: 13px;
    color: var(--tc-text-secondary);
    text-align: right;
    padding-left: 8px;
    white-space: nowrap;
}

.bar-fill.c0 { background: var(--tc-blue); }
.bar-fill.c1 { background: var(--tc-success); }
.bar-fill.c2 { background: #ea580c; }
.bar-fill.c3 { background: var(--tc-danger); }
.bar-fill.c4 { background: #7c3aed; }
.bar-fill.c5 { background: #0891b2; }
.bar-fill.c6 { background: #db2777; }
.bar-fill.c7 { background: var(--tc-text-muted); }
.bar-fill.c8 { background: #059669; }
.bar-fill.c9 { background: #d97706; }

/* Center section tables */
.center-section, .center-table-section {
    background: var(--tc-white);
    padding: 20px;
    border-radius: var(--tc-radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
    overflow-x: auto;
}

.center-section h3, .center-table-section h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--tc-text);
}

/* ============================================================
   VIEW REPORT
   ============================================================ */
.report-header {
    background: var(--tc-white);
    padding: 28px;
    border-radius: var(--tc-radius-lg);
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
    margin-bottom: 20px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--tc-blue);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.header-left { flex: 1; }
.header-right { flex-shrink: 0; margin-left: 20px; }
.header-right img { max-height: 60px; width: auto; }

.report-title {
    color: var(--tc-text);
    font-size: 22px;
    margin-bottom: 8px;
}

.report-subtitle {
    color: var(--tc-text-muted);
    font-size: 14px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--tc-font);
    transition: background 0.15s ease;
}

.btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.data-item {
    padding: 12px;
    background: #f8f9fb;
    border-radius: 6px;
    border: 1px solid var(--tc-border-light);
}

.data-label {
    font-weight: 600;
    color: var(--tc-text-secondary);
    font-size: 12px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.data-value {
    font-size: 18px;
    color: var(--tc-blue);
    font-weight: 700;
}

.notes-section {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 14px 16px;
    border-radius: 0 6px 6px 0;
    margin-top: 12px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-container {
    background: var(--tc-white);
    padding: 40px;
    border-radius: var(--tc-radius-lg);
    box-shadow: var(--tc-shadow-md);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--tc-border-light);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--tc-blue);
}

.login-header img {
    height: 80px;
    width: auto;
    margin-bottom: 16px;
}

.login-header h1 {
    color: var(--tc-blue);
    font-size: 22px;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--tc-text-muted);
    font-size: 14px;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--tc-blue);
    color: var(--tc-white);
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--tc-font);
    transition: background 0.15s ease;
}

.btn-login:hover {
    background: var(--tc-blue-dark);
}

.btn-login:disabled {
    background: #9cb5d8;
    cursor: not-allowed;
}

.password-requirements {
    font-size: 12px;
    color: var(--tc-text-muted);
    margin-top: 4px;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--tc-white);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* ============================================================
   REPORT FORM HEADER
   ============================================================ */
.header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--tc-blue);
}

.logo {
    color: var(--tc-blue);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
}

/* ============================================================
   FORM CARD (intake, departure, admission summary)
   ============================================================ */
.form-card {
    background: var(--tc-white);
    padding: 32px;
    border-radius: var(--tc-radius-lg);
    box-shadow: var(--tc-shadow);
    border: 1px solid var(--tc-border-light);
}

.form-card h2 {
    color: var(--tc-text);
    font-size: 22px;
    margin-bottom: 4px;
}

.form-card p.subtitle {
    color: var(--tc-text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.success-actions {
    margin-top: 16px;
    display: flex;
    gap: 16px;
}

.success-actions a {
    color: var(--tc-blue);
    text-decoration: none;
    font-weight: 600;
}

.success-actions a:hover {
    text-decoration: underline;
}

/* ============================================================
   CHECKLIST GRIDS (admission summary)
   ============================================================ */
.checklist-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
}

.checklist-grid label {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--tc-text);
    text-transform: none;
    letter-spacing: normal;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 6px;
}

.radio-group label {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--tc-text);
    text-transform: none;
    letter-spacing: normal;
}

/* ============================================================
   DAY RANGE GRID (report form)
   ============================================================ */
.day-range-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* ============================================================
   REPORT PREVIEW (admission reports)
   ============================================================ */
.report-preview {
    border: 1px solid var(--tc-border);
    border-radius: 6px;
    padding: 20px;
    min-height: 200px;
    background: #fafbfc;
}

.report-preview-empty {
    text-align: center;
    color: var(--tc-text-muted);
    padding: 60px 20px;
}

/* ============================================================
   STUDENT DETAIL PAGE
   ============================================================ */
.back-btn {
    background: var(--tc-blue);
    color: var(--tc-white);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--tc-font);
    transition: background 0.15s ease;
}

.back-btn:hover {
    background: var(--tc-blue-dark);
}

.page-title {
    font-size: 22px;
    color: var(--tc-text);
}

/* ============================================================
   TRAINING CHECKLIST ITEMS
   ============================================================ */
.checklist-items {
    margin-top: 10px;
    padding-left: 5px;
}

.checklist-item {
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--tc-text);
}

.checklist-editor-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.checklist-editor-item input { flex: 1; }
.checklist-editor-item button { padding: 4px 10px; font-size: 13px; }

.target-groups {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

/* ============================================================
   FIELD DESCRIPTION (departure form)
   ============================================================ */
.field-description {
    display: block;
    font-size: 12px;
    color: var(--tc-text-muted);
    margin-bottom: 5px;
    font-weight: 400;
}

/* ============================================================
   RESULT DETAILS
   ============================================================ */
.result-details {
    margin-top: 10px;
    font-size: 13px;
}

.result-details ul {
    margin: 5px 0 5px 20px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .navbar {
        padding: 8px 16px;
        flex-direction: column;
        gap: 8px;
    }

    .navbar-right {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    .navbar button {
        padding: 6px 10px;
        font-size: 12px;
    }

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

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

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

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

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

    .bar-label {
        width: 120px;
        min-width: 120px;
    }

    .resource-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .resource-actions {
        margin-left: 0;
        margin-top: 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

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

    .radio-group {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .ytd-stats-grid {
        grid-template-columns: 1fr;
    }

    .outreach-stats-grid {
        grid-template-columns: 1fr;
    }

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

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

@media print {
    .navbar, .public-header, .action-buttons, .button-group {
        display: none;
    }
}
