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;
}