body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #f5f7fb;
    color: #1c1c1c;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.page-header h1 a {
    text-decoration: none;
    color: #1c1c1c;
}

.card {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.form-grid {
    display: grid;
    gap: 12px;
}

input, select, textarea, button {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
}

textarea {
    min-height: 100px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid #e8e8e8;
    vertical-align: top;
}

.flash {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 8px;
}

.flash-success {
    background: #e9f8ee;
}

.flash-error {
    background: #fdecec;
}

.actions-inline form {
    margin-bottom: 12px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.summary-card {
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 14px;
    background: #fafafa;
}

.summary-card strong {
    display: block;
    margin-top: 6px;
    font-size: 1.3rem;
}

.card-actions {
    margin-bottom: 12px;
}

.button-link {
    display: inline-block;
    padding: 10px 14px;
    background: #1f5eff;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
}

.button-link:hover {
    opacity: 0.92;
}

.zapier-test-panel {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
}

#sendZapierTestBtn {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #2563eb;
  color: white;
  font-weight: 600;
}

#sendZapierTestBtn:hover {
  background: #1d4ed8;
}

#zapierTestResult {
  padding: 12px;
  background: #111827;
  color: #d1fae5;
  border-radius: 6px;
  font-size: 13px;
}

.header-link {
    color: inherit;
    text-decoration: none;
}

.header-link:hover,
.header-link:focus,
.header-link:visited {
    color: inherit;
    text-decoration: none;
}

.sync-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(240px, 1fr)
    );
    gap: 16px;
}

.sync-card {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px;
    background: #fafafa;
    text-decoration: none;
}

.sync-card h3 {
    margin-top: 0;
}

.sync-button {
    width: 100%;
    padding: 10px;
    text-decoration: none;
    appearance: auto;
    text-rendering: auto;
    color: buttontext;
    letter-spacing: normal;
    word-spacing: normal;
    line-height: normal;
    text-transform: none;
    text-indent: 0px;
    text-shadow: none;
    display: inline-block;
    text-align: center;
    cursor: default;
    box-sizing: border-box;
    background-color: #f5f7fb;
    margin: 0em 0em 0em 0em;
    padding-inline: 6px;
    border-width: 1px;
    border-style: outset;
    border-color: buttonborder;
    border-image: initial;
}

.sync-button:hover {
    opacity: 0.92;
}

.bulk-upload-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(240px, 1fr)
    );
    gap: 16px;
}

.bulk-upload-card {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px;
    background: #fafafa;
}

.bulk-upload-card h3 {
    margin-top: 0;
}

.bulk-upload-card input[type="file"] {
    margin-bottom: 12px;
}

.event-item {
    padding: 14px 0;
    border-bottom: 1px solid #e8e8e8;
}

.event-item:last-child {
    border-bottom: none;
}
/*
.message-preview {
    cursor: help;
    white-space: nowrap;
}
*/


.event-history-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

/*
 * This is the fixed, stationary window.
 */
.event-history-window {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 400px;
    box-sizing: border-box;
    overflow: hidden;

    border: 1px solid #d9dee7;
    border-radius: 8px;
    background: #f9f9f9;
}

/*
 * This element scrolls inside the stationary window.
 * Its absolute position prevents its contents from
 * changing the width of the page or card.
 */
.event-history-scroll {
    position: absolute;
    inset: 0;

    overflow-x: auto;
    overflow-y: auto;

    padding: 15px;
    box-sizing: border-box;

    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.event-item {
    box-sizing: border-box;
    min-width: 0;
    margin-bottom: 12px;
    padding: 12px;

    border: 1px solid #e1e5eb;
    border-radius: 6px;
    background: #ffffff;
}

.event-item:last-child {
    margin-bottom: 0;
}

.event-item div,
.event-item p {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/*
 * Keeps the Events card constrained to the page width.
 */
.events-page-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

/*
 * Fixed, stationary table window.
 */
.events-table-window {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 500px;
    box-sizing: border-box;
    overflow: hidden;

    border: 1px solid #d9dee7;
    border-radius: 8px;
    background: #ffffff;
}

/*
 * Only this inner element scrolls.
 */
.events-table-scroll {
    position: absolute;
    inset: 0;

    overflow-x: auto;
    overflow-y: auto;

    box-sizing: border-box;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/*
 * Table may be wider than the window without widening the page.
 */
.events-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

/*
 * Keep headings visible during vertical scrolling.
 */
.events-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f5f7fa;
}

/*
 * Prevent cells from collapsing too narrowly.
 */
.events-table th,
.events-table td {
    padding: 10px 12px;
    box-sizing: border-box;
    white-space: nowrap;
    vertical-align: top;
}

/*
 * Allow Subject and Message fields to wrap within controlled widths.
 */
.events-table th:nth-child(8),
.events-table td:nth-child(8) {
    min-width: 220px;
    max-width: 320px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.events-table th:nth-child(9),
.events-table td:nth-child(9) {
    min-width: 140px;
    max-width: 220px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.event-message-cell {
    max-width: 220px;
}

.message-preview {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

.admissions-health-widget {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.health-score-block {
    background: var(--cd-primary-soft);
    border-radius: 20px;
    padding: 26px;
    text-align: center;
}

.health-score-block strong {
    display: block;
    font-size: 3.4rem;
    line-height: 1;
    letter-spacing: -0.06em;
}

.health-score-block span {
    display: block;
    margin-top: 8px;
    color: var(--cd-muted);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.health-indicators {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.health-indicator-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    background: var(--cd-surface-soft);
    border: 1px solid var(--cd-border);
    border-radius: 14px;
    padding: 12px 14px;
}

.health-indicator-row strong {
    display: block;
}

.health-indicator-row span {
    color: var(--cd-muted);
    font-size: 0.84rem;
}

.health-status {
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.76rem;
    font-weight: 900;
    white-space: nowrap;
}

.health-good {
    background: #dcfce7;
    color: #166534;
}

.health-watch {
    background: #fef3c7;
    color: #92400e;
}

.health-risk {
    background: #fee2e2;
    color: #991b1b;
}

.health-neutral {
    background: #e2e8f0;
    color: #334155;
}

@media (max-width: 640px) {
    .admissions-health-widget {
        grid-template-columns: 1fr;
    }

    .health-indicator-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

.events-page-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: 12px 0 16px;
}

.events-page-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    background: #2563eb;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.events-page-actions a:hover {
    background: #1d4ed8;
    color: #ffffff;
    text-decoration: none;
}


.mini-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mini-targets span {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 600;
}

.event-view-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.event-view-toggle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
}

.event-view-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    width: 100%;
    text-align: center;
}

.event-view-button.active {
    background: #1f3a5f;
    border-color: #1f3a5f;
    color: #ffffff;
}

.event-timeline-section {
    margin-top: 18px;
}

.event-timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 16px 0 24px;
    padding-left: 26px;
}

.event-timeline::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: #d8dee9;
}

.timeline-item {
    position: relative;
}

.timeline-marker {
    position: absolute;
    left: -24px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #1f3a5f;
    box-shadow: 0 0 0 4px #eef3f8;
}

.timeline-card {
    background: #ffffff;
    border: 1px solid #d8dee9;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.timeline-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.timeline-card-header strong {
    display: block;
    color: #111827;
}

.timeline-card-header span {
    display: block;
    color: #6b7280;
    font-size: 0.84rem;
    margin-top: 3px;
}

.timeline-chip {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef3f8;
    color: #1f3a5f !important;
    font-weight: 700;
    white-space: nowrap;
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.timeline-meta span {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.78rem;
    font-weight: 600;
}

.timeline-subject {
    margin: 12px 0 4px;
    font-weight: 700;
    color: #111827;
}

.timeline-message {
    margin: 6px 0 0;
    color: #4b5563;
    line-height: 1.45;

    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile */
@media (max-width: 640px) {
    .event-view-toggle-grid {
        grid-template-columns: 1fr;
    }
}

.card.sync-section .event-view-toggle-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}

.card.sync-section .event-view-toggle-grid > a.event-view-button {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    width: 100%;
    /*padding: 10px 14px;*/

    border: 1px solid;
    /*border-radius: 10px;*/

    background: buttonface;
    color: #1f2937;

    font-weight: 400;
    text-align: center;
    text-decoration: none !important;

    cursor: pointer;
}

.card.sync-section .event-view-toggle-grid > a.event-view-button:hover {
    background: #eef3f8;
    color: #1f2937;
    text-decoration: none !important;
}

.card.sync-section .event-view-toggle-grid > a.event-view-button.active {
    background: lightgrey;
    border: 1px solid black;
    /*color: #ffffff;*/
    text-decoration: none !important;
}

.card.sync-section .event-view-toggle-grid > a.event-view-button.active:hover {
    background: #eef3f8;
    color: #ffffff;
}

@media (max-width: 640px) {
    .card.sync-section .event-view-toggle-grid {
        grid-template-columns: 1fr;
    }
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-brand h1 {
    margin: 0;
}

.header-logo {
    display: block;
    width: 120px;
    height: auto;
    object-fit: contain;
}

@media (max-width: 600px) {
    .header-brand {
        gap: 12px;
    }

    .header-logo {
        width: 115px;
    }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.header-navigation {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.header-navigation h1,
.header-navigation h2 {
    margin: 0;
}

.header-logo {
    display: block;
    width: 120px;
    height: auto;
    flex-shrink: 0;
    object-fit: contain;
}

@media (max-width: 700px) {
    .page-header {
        align-items: flex-start;
        gap: 16px;
    }

    .header-logo {
        width: 110px;
    }
}

.staff-task input,
.process-task input {
    width: 90px;
    max-width: 100%;
    box-sizing: border-box;
}

.staff-task td,
.process-task td {
    vertical-align: middle;
}

tfoot th {
    font-weight: 700;
}


.lead-status-page {
    width: 100%;
}

.lead-status-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.lead-status-program {
    opacity: 0.8;
    margin-top: 4px;
}

.lead-status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.lead-status-summary {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.lead-status-summary > div {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.lead-status-summary span {
    display: block;
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 3px;
}

.lead-status-flow {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        auto
        minmax(0, 1fr)
        auto
        minmax(0, 1fr);

    align-items: stretch;
    gap: 10px;

    padding: 20px;
    border-radius: 20px;
    background: #4a5d73;
}

.lead-status-stage {
    border-radius: 8px;
    overflow: hidden;
    min-width: 0;
}

.lead-status-stage-new {
    background: #1597d3;
}

.lead-status-stage-in-process {
    background: #f0c600;
}

.lead-status-stage-application {
    background: #e7523d;
}

.lead-status-stage-heading {
    padding: 12px;
    color: white;
}

.lead-status-stage-heading h2 {
    margin: 0;
    font-size: 1rem;
}

.lead-status-stage-heading span {
    font-size: 0.75rem;
}

.lead-status-checklist {
    padding: 0 10px 12px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;

    min-height: 32px;

    margin-bottom: 4px;
    padding: 5px 8px;

    background: rgba(255, 255, 255, 0.9);

    color: #222;
    font-size: 0.85rem;
}

.status-checkbox {
    width: 18px;
    height: 18px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 18px;

    border: 2px solid #aaa;

    background: white;

    font-size: 13px;
    font-weight: bold;
}

.status-complete .status-checkbox {
    background: #26b943;
    border-color: #26b943;
    color: white;
}

.status-pending .status-label {
    opacity: 0.7;
}

.lead-status-arrow {
    display: flex;
    align-items: center;
    justify-content: center;

    color: white;
    font-size: 38px;
    font-weight: bold;
}

@media (max-width: 900px) {

    .lead-status-flow {
        grid-template-columns: 1fr;
    }

    .lead-status-arrow {
        transform: rotate(90deg);
        min-height: 40px;
    }

    .lead-status-header {
        flex-direction: column;
    }
}

.lead-status-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;

    width: 100%;

    margin-top: 25px;
    margin-bottom: 20px;
}

.lead-status-actions form {
    margin: 0;
    width: 100%;
}

.lead-status-actions button {
    width: 100%;
    height: 100%;
}

@media (max-width: 900px) {

    .lead-status-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {

    .lead-status-actions {
        grid-template-columns: 1fr;
    }
}

.lead-data-panel {
    margin-top: 20px;
}

.lead-data-table {
    width: 100%;
    border-collapse: collapse;
}

.lead-data-table th,
.lead-data-table td {
    padding: 10px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #ddd;
}

.lead-data-table th:first-child,
.lead-data-table td:first-child {
    width: 25%;
}

.lead-data-table td:last-child {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.event-type-dropdown {
    width: 100%;
    position: relative;
}

/*
 * Make the custom multi-select control visually match
 * the normal <select> controls used elsewhere on the page.
 */
.event-type-summary {
    box-sizing: border-box;
    width: 100%;

    padding: 10px 32px 10px 12px;

    border: 1px solid black;

    border-radius: 0;

    background-color: Field;
    color: FieldText;

    font: inherit;
    font-weight: normal;
    font-size: 13px;
    color: inherit;

    cursor: pointer;
    list-style: none;

    position: relative;
}

/* Remove the browser's default <details> marker */
.event-type-summary::-webkit-details-marker {
    display: none;
}

.event-type-summary::marker {
    display: none;
    content: "";
}

/*
 * Small select-style arrow.
 * This is deliberately subtle so it resembles
 * the native dropdown arrow used by <select>.
 */
.event-type-summary::after {
    content: "";

    position: absolute;
    right: 5px;
    top: 50%;

    width: 5px;
    height: 5px;

    border-right: 2px solid currentColor !important;
    border-bottom: 2px solid currentColor !important;

    transform:
        translateY(-70%)
        rotate(45deg);

    opacity: 1 !important;
    z-index: 10;

    pointer-events: none;
}
/*
 * Expanded checkbox list
 */
.event-type-options {
    box-sizing: border-box;

    width: 100%;
    margin-top: 6px;
    padding: 10px;

    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 6px;

    background: #fff;

    max-height: 300px;
    overflow-y: auto;
}

/*
 * Individual event type rows
 */
.event-type-option {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;

    width: 100%;
    padding: 5px 2px;

    gap: 8px;

    font: inherit;
    font-weight: normal;

    cursor: pointer;
}

.event-type-option input[type="checkbox"] {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;

    margin: 0 !important;
    padding: 0 !important;

    flex: 0 0 auto !important;
}

.event-type-option span {
    display: inline-block;
    flex: 0 1 auto;

    margin: 0;
    padding: 0;

    text-align: left;
    white-space: nowrap;
}

.event-type-option input {
    margin: 0;
    flex-shrink: 0;
}