/* The parent portal and /admin/families.php (AA_27097). Loaded by portalHead() in includes/portal.php.
   Any change here bumps PORTAL_CSS_V in includes/portal.php. */

.portal-page .portal-card + .portal-card,
.portal-page .nl-notice + .portal-card {
    margin-top: 1.5rem;
}

/* The bot trap: off screen, never shown to a person. */
.portal-trap {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.portal-table td,
.portal-table th {
    vertical-align: middle;
}

.portal-muted {
    color: #777;
    font-size: 0.9rem;
}

.portal-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
    margin: 0 0 0.75rem;
}

.portal-inline-form label {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    margin: 0;
}

.portal-inline-form input[type="text"],
.portal-inline-form input[type="email"],
.portal-inline-form input[type="tel"],
.portal-inline-form input[type="date"],
.portal-inline-form select {
    padding: 0.35rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 8rem;
}

.portal-inline-form label.portal-check {
    flex-direction: row;
    align-items: center;
    gap: 0.3rem;
}

.portal-off {
    opacity: 0.6;
}

/* A wider admin page (portalHead(..., 'portal-wide'), AA_28385). Phones keep the full width. */
.contact-container.portal-wide {
    max-width: 1100px;
}

/* One name per line in a table cell (the families list, AA_28385). */
.portal-stack + .portal-stack {
    margin-top: 0.15rem;
}

/* A form whose fields sit in the middle of the card ("Add a family", AA_28385). */
.portal-inline-form.portal-center-form {
    flex-direction: column;
    align-items: center;
}

.portal-inline-form.portal-center-form label {
    align-items: center;
}

/* The shared footer's address line is nowrap and runs off a 375px phone; let it wrap here. */
.site-footer .footer-link {
    white-space: normal;
}

.portal-back {
    display: inline-block;
    margin-bottom: 1rem;
}

/* Notes to parents (AA_27179). */
.portal-inline-form textarea {
    padding: 0.35rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
}

.portal-inline-form label.portal-note-text {
    flex: 1 1 100%;
}

.portal-note-who {
    align-self: center;
    font-weight: bold;
}

.portal-note-edit {
    border-top: 1px solid #eee;
    padding-top: 0.75rem;
}

.portal-note + .portal-note {
    border-top: 1px solid #eee;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}

.portal-note {
    text-align: left;
}

.portal-note-head {
    margin-bottom: 0.25rem;
}

.portal-note-body {
    margin: 0;
    overflow-wrap: anywhere;
}


/* Charges and payments (AA_27098). */
.portal-balance {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 1rem;
}

.portal-balance.portal-owes {
    color: #8a1a1a;
}

.portal-table td.portal-amt,
.portal-table th.portal-amt {
    text-align: right;
    white-space: nowrap;
}

.portal-void td {
    color: #999;
}

.portal-void td:not(:last-child) {
    text-decoration: line-through;
}

.portal-void-form {
    margin: 0;
}

.portal-void-form input[type="text"] {
    min-width: 6rem;
}

.portal-ledger td {
    overflow-wrap: anywhere;
}

/* A phone: drop the Student column and tighten the cells, so the Amount stays on screen. */
@media (max-width: 576px) {
    .portal-ledger .portal-col-student {
        display: none;
    }

    .portal-ledger th,
    .portal-ledger td {
        padding: 0.4rem 0.3rem;
        font-size: 0.85rem;
    }
}

/* Equipment (AA_27157). */
.portal-equip-edit {
    border-top: 1px solid #eee;
    padding-top: 0.75rem;
}

.portal-equip-owner {
    align-self: center;
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.portal-equip-alex {
    background: #fff3d6;
    color: #6b4a00;
}

.portal-equip-family {
    background: #e2f1e5;
    color: #1d5a2a;
}

.portal-equip td {
    overflow-wrap: anywhere;
}

/* Lessons (AA_27180): the family's list, the admin schedule, the feed address. */
.portal-lesson-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0.75rem;
}

.portal-lesson-list li {
    padding: 0.35rem 0;
    border-bottom: 1px solid #eee;
    overflow-wrap: anywhere;
}

.portal-lesson-tag {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.85rem;
    background: #e8eef5;
    color: #1a3f5c;
    max-width: 100%;
}

.portal-lesson-skipped .portal-lesson-tag {
    background: #f3e3e3;
    color: #7a1f1f;
}

.portal-lesson-moved .portal-lesson-tag,
.portal-lesson-extra .portal-lesson-tag {
    background: #fff3d6;
    color: #6b4a00;
}

.portal-lesson,
.portal-lesson-time {
    border-top: 1px solid #eee;
    padding: 0.6rem 0;
}

.portal-lesson-when {
    overflow-wrap: anywhere;
}

.portal-lesson-past {
    opacity: 0.6;
}

.portal-lesson-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1rem;
}

/* /admin/lessons.php as one table per section (AA_28386): the edit controls sit in the rows. */
.portal-grid {
    font-size: 0.85rem;
}

.portal-grid th,
.portal-grid td {
    padding: 0.45rem 0.3rem;
}

.portal-grid td {
    text-align: left;
    vertical-align: top;
}

.portal-grid input[type="date"] {
    width: 8rem;
}

.portal-grid input[type="time"] {
    width: 6rem;
}

/* The clock icon would cover "PM" in a 6rem box; the time is typed. */
.portal-grid input[type="time"]::-webkit-calendar-picker-indicator {
    display: none;
}

.portal-grid select {
    max-width: 7.5rem;
}

.portal-grid select[name="class_id"] {
    max-width: 13rem;
}

.portal-classes .portal-class-students {
    min-width: 14rem;
}

.portal-weeks .portal-row-actions {
    min-width: 22rem;
}

.portal-grid input[type="text"],
.portal-grid input[type="date"],
.portal-grid input[type="time"],
.portal-grid select {
    padding: 0.25rem 0.4rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 100%;
}

.portal-grid .portal-in-money {
    width: 4.2rem;
}

.portal-grid .portal-in-subject {
    width: 5.5rem;
}

.portal-grid form {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
    margin: 0;
}

.portal-row-actions {
    white-space: normal;
}

.portal-row-actions form + form {
    margin-top: 0.35rem;
}

.portal-share-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.5rem;
    align-items: center;
    padding: 0.2rem 0;
}

.portal-share-row + .portal-share-row {
    border-top: 1px dashed #e4e4e4;
}

.portal-share-who {
    min-width: 7rem;
    overflow-wrap: anywhere;
}

.portal-share-warn {
    color: #8a1a1a;
    font-size: 0.85rem;
    padding: 0.2rem 0;
}

.portal-check {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    font-size: 0.85rem;
}

.portal-btn-quiet {
    background: #6c757d;
}

.portal-add-row td {
    background: #f7f9fb;
}

/* AA_28527: the Classes table is read only, one line per class; one edit area opens below it. */
.portal-classes .portal-one-line {
    overflow-wrap: anywhere;
}

.portal-classes .portal-row-edit {
    text-align: right;
    white-space: nowrap;
}

.portal-classes .portal-share-warn {
    display: inline;
    padding: 0;
    white-space: nowrap;
}

.portal-row-on td {
    background: #eef5fb;
}

.portal-edit-box {
    text-align: left;
}

.portal-edit {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid #dde3e8;
    border-left: 3px solid var(--primary-700, #1a5f8a);
    border-radius: 8px;
    background: #fbfcfd;
    font-size: 0.9rem;
}

.portal-edit-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.portal-edit h3 {
    font-size: 1.1rem;
    margin: 0 0 0.6rem;
    overflow-wrap: anywhere;
}

.portal-edit h4 {
    font-size: 0.95rem;
    margin: 1rem 0 0.3rem;
}

.portal-edit-close {
    white-space: nowrap;
}

.portal-edit form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    align-items: flex-end;
    margin: 0;
}

.portal-edit-form label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0;
    font-size: 0.8rem;
    color: #555;
}

.portal-edit-form label.portal-check {
    flex-direction: row;
    align-self: center;
}

.portal-edit input[type="text"],
.portal-edit input[type="date"],
.portal-edit input[type="time"],
.portal-edit select {
    padding: 0.25rem 0.4rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 100%;
    font-size: 0.9rem;
}

.portal-edit input[type="date"] {
    width: 9rem;
}

.portal-edit input[type="time"] {
    width: 7rem;
}

.portal-edit .portal-in-money {
    width: 5rem;
}

.portal-edit .portal-in-subject {
    width: 9rem;
}

.portal-edit select[name="class_id"] {
    max-width: 18rem;
}

.portal-edit-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* The Coming weeks calendar: each lesson is a link that opens it below the calendar. */
a.portal-cal-lesson {
    display: block;
    color: inherit;
    text-decoration: none;
}

a.portal-cal-lesson:hover {
    filter: brightness(0.95);
}

a.portal-cal-lesson.is-on {
    outline: 2px solid var(--primary-700, #1a5f8a);
    outline-offset: -1px;
}

/* A phone or a narrow window: each row becomes a small card, each cell names its column. */
@media (max-width: 900px) {
    .portal-grid thead {
        display: none;
    }

    .portal-grid,
    .portal-grid tbody,
    .portal-grid tr,
    .portal-grid td {
        display: block;
        width: 100%;
    }

    .portal-grid tr {
        border: 1px solid #ddd;
        border-radius: 6px;
        margin-bottom: 0.75rem;
        padding: 0.4rem 0.6rem;
    }

    .portal-grid td {
        border: 0;
        padding: 0.25rem 0;
        min-width: 0;
    }

    .portal-classes .portal-class-students,
    .portal-weeks .portal-row-actions {
        min-width: 0;
    }

    .portal-grid td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.75rem;
        color: #777;
    }
}

.portal-feed-url {
    font-family: monospace;
    overflow-wrap: anywhere;
    background: #f6f6f6;
    padding: 0.5rem;
    border-radius: 4px;
}

@media (max-width: 576px) {
    .portal-equip .portal-col-added {
        display: none;
    }

    .portal-equip th,
    .portal-equip td {
        padding: 0.4rem 0.3rem;
        font-size: 0.85rem;
    }
}


/* Card for lessons and the Charge button (AA_27099). */
.portal-test-bar {
    background: #fff3c4;
    border: 1px solid #e0c200;
    color: #5a4a00;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.portal-card-on-file {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0 0 0.5rem;
}

.portal-consent {
    display: block;
    margin: 0 0 0.75rem;
}

.portal-card-element {
    margin: 1rem 0;
    max-width: 480px;
}

#portal-card-msg {
    margin-top: 0.75rem;
}

.portal-card-note {
    margin: 1.25rem 0 0;
}

.portal-remove-form {
    text-align: center;
    margin: 1rem 0 0;
}

.portal-charge-paid { color: #1a6b2f; font-weight: bold; }
.portal-charge-declined,
.portal-charge-unknown,
.portal-charge-open { color: #8a1a1a; font-weight: bold; }
.portal-charge-canceled { color: #777; }

/* ------------------------------------------------------------------------
   The family pages (AA_28382): a left navigation beside the content; on a
   phone the navigation is a bar across the top. The page box is the wide
   one (portal-wide, AA_28385), so tables wrap less.
   ------------------------------------------------------------------------ */
.portal-shell {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.portal-nav {
    flex: 0 0 11rem;
    position: sticky;
    top: 1rem;
    background: var(--neutral-100, #f4f6f8);
    border-radius: 12px;
    padding: 1rem 0.75rem;
}

.portal-nav-family {
    font-weight: bold;
    color: var(--primary-900, #12324a);
    padding: 0 0.5rem 0.5rem;
    overflow-wrap: anywhere;
}

.portal-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.portal-nav li a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: var(--primary-700, #1a5f8a);
    text-decoration: none;
}

.portal-nav li a:hover,
.portal-nav li a:focus {
    background: #e3ecf3;
}

.portal-nav li a.portal-nav-on {
    background: var(--primary-700, #1a5f8a);
    color: #fff;
    font-weight: bold;
}

.portal-nav-logout {
    margin: 0.75rem 0 0;
    padding: 0.5rem 0.75rem 0;
    border-top: 1px solid #dde3e8;
}

.portal-nav-logout .nl-link-btn {
    padding: 0;
}

.portal-main {
    flex: 1 1 auto;
    min-width: 0;
}

.portal-family .portal-family-title {
    margin-bottom: 1rem;
}

.portal-family .portal-left {
    text-align: left;
}

.portal-family-foot {
    margin-top: 1rem;
}

.portal-nowrap {
    white-space: nowrap;
}

/* One section per student, each with its own soft color. */
.portal-student {
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.portal-student + .portal-student {
    margin-top: 1.25rem;
}

.portal-tone-0 { background: #eef5fb; }
.portal-tone-1 { background: #f3effa; }
.portal-tone-2 { background: #eef7f0; }
.portal-tone-3 { background: #fbf4ea; }
.portal-tone-4 { background: #fbeff3; }

.portal-student h2 {
    color: var(--primary-900, #12324a);
    font-size: 1.5rem;
    margin: 0 0 0.75rem;
}

.portal-student-subject {
    font-size: 1rem;
    font-weight: normal;
    color: #555;
    margin-left: 0.4rem;
}

.portal-student-block + .portal-student-block {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.portal-student h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #666;
    margin: 0 0 0.4rem;
}

.portal-student p {
    margin: 0 0 0.3rem;
}

.portal-change-list,
.portal-equip-list {
    list-style: none;
    margin: 0.4rem 0 0;
    padding: 0;
}

.portal-change-list li {
    padding: 0.2rem 0;
}

.portal-equip-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0;
}

.portal-equip-list li + li {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.portal-equip-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.portal-equip-note {
    display: block;
    font-size: 0.85rem;
}

.portal-equip-list .portal-equip-owner {
    flex: 0 0 auto;
}

.portal-older-notes {
    margin-top: 0.5rem;
}

.portal-older-notes summary {
    display: inline-block;
    cursor: pointer;
    color: var(--primary-700, #1a5f8a);
    border: 1px solid currentColor;
    border-radius: 8px;
    padding: 0.2rem 0.75rem;
    font-size: 0.9rem;
    list-style: none;
}

.portal-older-notes summary::-webkit-details-marker {
    display: none;
}

.portal-older-notes[open] summary {
    margin-bottom: 0.5rem;
}

.portal-student .portal-note {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}

/* The Billing page: the running balance. */
.portal-ledger .portal-run {
    font-weight: bold;
}

.portal-ledger .portal-amt-minus {
    color: #1a6b2f;
}

.portal-ledger-desc-sm {
    display: none;
}

/* The Lessons page: a month calendar, weeks from Sunday. */
.portal-cal-card {
    text-align: left;
}

.portal-cal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.portal-cal-head h2 {
    margin: 0;
    text-align: center;
}

.portal-cal-step {
    white-space: nowrap;
}

.portal-cal-today {
    text-align: center;
    margin: 0.25rem 0 0;
}

.portal-cal {
    margin: 1rem 0;
    border: 1px solid #dde3e8;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.portal-cal-row {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.portal-cal-row + .portal-cal-row {
    border-top: 1px solid #dde3e8;
}

.portal-cal-wd {
    text-align: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: #666;
    padding: 0.35rem 0;
    background: #f4f6f8;
}

.portal-cal-cell {
    min-height: 5.5rem;
    padding: 0.3rem;
    font-size: 0.8rem;
    min-width: 0;
}

.portal-cal-cell + .portal-cal-cell {
    border-left: 1px solid #eef1f4;
}

.portal-cal-out {
    background: #fafbfc;
    color: #aaa;
}

.portal-cal-date {
    font-weight: bold;
    margin-bottom: 0.2rem;
}

.portal-cal-wdname {
    display: none;
}

.portal-cal-now .portal-cal-date {
    color: #fff;
    background: var(--primary-700, #1a5f8a);
    border-radius: 999px;
    display: inline-block;
    min-width: 1.6rem;
    text-align: center;
}

.portal-cal-lesson {
    background: #eef5fb;
    border-left: 3px solid var(--primary-700, #1a5f8a);
    border-radius: 4px;
    padding: 0.2rem 0.3rem;
    overflow-wrap: anywhere;
}

.portal-cal-lesson + .portal-cal-lesson {
    margin-top: 0.25rem;
}

.portal-cal-lesson.portal-lesson-skipped {
    background: #f4f4f4;
    border-left-color: #aaa;
    color: #777;
}

.portal-cal-lesson.portal-lesson-moved {
    border-left-color: #b26b00;
    background: #fbf4ea;
}

.portal-cal-lesson.portal-lesson-extra {
    border-left-color: #1a6b2f;
    background: #eef7f0;
}

.portal-cal-lesson .portal-lesson-tag {
    display: block;
    margin: 0.15rem 0 0;
    font-size: 0.7rem;
}

.portal-cal-min {
    color: #666;
}

/* A tablet or phone: the navigation becomes a bar across the top. */
@media (max-width: 768px) {
    .portal-shell {
        flex-direction: column;
        gap: 1rem;
    }

    .portal-nav {
        position: static;
        flex: none;
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.25rem 0.5rem;
        padding: 0.5rem;
    }

    .portal-nav-family {
        display: none;
    }

    .portal-nav ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        flex: 1 1 auto;
    }

    .portal-nav li a {
        padding: 0.4rem 0.7rem;
    }

    .portal-nav-logout {
        margin: 0;
        padding: 0 0.5rem;
        border-top: none;
    }
}

/* A phone: the calendar is a list of the days that have lessons; the ledger drops a column. */
@media (max-width: 576px) {
    .portal-student {
        padding: 1rem;
    }

    .portal-cal {
        border: none;
        background: none;
    }

    .portal-cal-row.portal-cal-days,
    .portal-cal-cell:not(.portal-cal-has) {
        display: none;
    }

    .portal-cal-row {
        display: block;
    }

    .portal-cal-row + .portal-cal-row {
        border-top: none;
    }

    .portal-cal-cell {
        min-height: 0;
        font-size: 0.9rem;
        border: 1px solid #dde3e8;
        border-radius: 8px;
        background: #fff;
        margin-bottom: 0.5rem;
        padding: 0.5rem;
    }

    .portal-cal-cell + .portal-cal-cell {
        border-left: 1px solid #dde3e8;
    }

    .portal-cal-out {
        color: inherit;
    }

    .portal-cal-wdname {
        display: inline;
    }

    .portal-cal-now .portal-cal-date {
        color: inherit;
        background: none;
        display: block;
        text-align: left;
    }

    .portal-family .newsletter-card {
        padding: 1rem 0.75rem;
    }

    .portal-family .portal-ledger td {
        overflow-wrap: normal;
        word-break: normal;
    }

    .portal-family .portal-ledger .portal-nowrap {
        white-space: normal;
    }

    .portal-ledger .portal-col-desc {
        display: none;
    }

    .portal-ledger-desc-sm {
        display: block;
        font-size: 0.8rem;
        color: #777;
    }
}

/* ------------------------------------------------------------------------
   The admin FAMILY page, /admin/families.php?id=N (AA_28387), on the model of Apex's showFamily.php:
   a summary on top, accordion sections (pf-acc), Ajax rows (pf-save) and an Apex-style ledger.
   ------------------------------------------------------------------------ */
.contact-container.portal-wide.pf-page {
    max-width: 1200px;
}

.pf-top {
    text-align: center;
}

.pf-top .pf-name {
    font-size: 1.8rem;
    margin: 0 0 0.25rem;
    overflow-wrap: anywhere;
}

.pf-top p.pf-status {
    margin: 0 0 1rem;
}

.pf-badge {
    display: inline-block;
    padding: 0.1rem 0.7rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: bold;
}

.pf-on {
    background: #e2f1e5;
    color: #1d5a2a;
}

.pf-offbadge {
    background: #f3e3e3;
    color: #7a1f1f;
}

/* AA_28566: the top pane is plain text in two columns, parents left and students right. Each person
   is one line (a student's classes one line each under it); Edit drops down that row's fields. */
.pf-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 2rem;
    margin: 0 0 1rem;
    text-align: left;
}

.pf-col-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    margin: 0 0 0.4rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e3e3e3;
}

.pf-person,
.pf-kid {
    padding: 0.35rem 0;
    overflow-wrap: anywhere;
}

.pf-person + .pf-person,
.pf-kid + .pf-kid {
    border-top: 1px dotted #e0e4e8;
}

.pf-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.1rem 0.5rem;
}

.pf-person-name,
.pf-kid-name {
    font-weight: bold;
}

.pf-facts {
    color: #444;
}

.pf-fact:empty {
    display: none;
}

/* A dot between facts, never before the first one shown (an empty subject or email is hidden). */
.pf-facts .pf-fact:not(:empty) ~ .pf-fact::before {
    content: "· ";
    color: #999;
}

span.pf-facts .pf-fact {
    margin-right: 0.35rem;
}

.pf-class-line {
    padding-left: 1rem;
    font-size: 0.92rem;
    color: #333;
}

.pf-top .pf-edit-btn {
    font-size: 0.85rem;
    margin-left: auto;
}

.pf-top .pf-print-link {
    font-size: 0.85rem;
}

.pf-top p.pf-status .pf-edit-btn {
    margin-left: 0.5rem;
}

.pf-edit {
    margin: 0.4rem 0 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--neutral-50, #f8f9fa);
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.pf-edit[hidden] {
    display: none;
}

.pf-edit p {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
}

.pf-edit .pf-row {
    margin-bottom: 0;
}

.pf-edit .pf-row label {
    align-items: flex-start;
}

.pf-edit .pf-row input[type="text"],
.pf-edit .pf-row input[type="email"],
.pf-edit .pf-row input[type="tel"],
.pf-edit .pf-row select {
    padding: 0.3rem 0.45rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 100%;
    background: #fff;
}

.pf-edit .pf-row input.pf-in-money {
    width: 6rem;
}

.pf-edit-remove {
    margin: 0;
}

.pf-top .pf-add {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.pf-top .pf-add-form {
    justify-content: flex-start;
}

@media (max-width: 576px) {
    .pf-cols {
        grid-template-columns: 1fr;
    }
}

.pf-tag-none {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    background: #fff3d6;
    color: #6b4a00;
}

.pf-top .pf-balance {
    margin: 0;
}

/* The accordion: one bordered box per section, a chevron on the right, closed by default. */
.pf-accs {
    margin-top: 1.25rem;
}

.pf-acc {
    background: var(--neutral-100, #f6f7f8);
    border: 1px solid #dde3e8;
    border-radius: 10px;
}

.pf-acc + .pf-acc {
    margin-top: 0.6rem;
}

.pf-acc > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    padding: 0.8rem 3rem;
    position: relative;
    text-align: center;
}

.pf-acc > summary::-webkit-details-marker {
    display: none;
}

.pf-acc > summary:focus-visible {
    outline: 2px solid var(--primary-700, #1a3f5c);
    outline-offset: 2px;
}

.pf-acc-title {
    font-size: 1.15rem;
    font-weight: bold;
    color: var(--primary-900, #10283b);
}

.pf-acc-hint {
    color: #666;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.pf-chev {
    position: absolute;
    right: 1.1rem;
    top: 50%;
    width: 0.65rem;
    height: 0.65rem;
    border-right: 2px solid #555;
    border-bottom: 2px solid #555;
    transform: translateY(-70%) rotate(45deg);
    transition: transform 0.15s ease;
}

.pf-acc[open] > summary .pf-chev {
    transform: translateY(-30%) rotate(225deg);
}

.pf-acc[open] > summary {
    border-bottom: 1px solid #dde3e8;
}

.pf-acc-body {
    padding: 1rem;
    text-align: center;
}

.pf-center-text {
    text-align: center;
}

.pf-acc-body p {
    margin: 0 0 0.75rem;
}

.pf-h3 {
    font-size: 1rem;
    font-weight: bold;
    margin: 1rem 0 0.5rem;
}

/* AA_28528: Parents and Students are parts of the one Family section; a thin line sets each apart. */
.pf-acc-body .pf-part {
    border-top: 1px solid #e3e3e3;
    margin-top: 1.25rem;
    padding-top: 1rem;
}

.pf-center {
    justify-content: center;
}

/* An Ajax row outside a table (the Family section). */
.pf-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

.pf-row label {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.85rem;
    margin: 0;
}

.pf-row label.pf-check {
    flex-direction: row;
    gap: 0.3rem;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
}

.pf-row .pf-msg {
    flex: 1 1 100%;
}

/* The section tables: inputs sit in the rows, Remove on the same line. */
.pf-grid {
    background: #fff;
    border-radius: 6px;
    margin: 0 auto 0.5rem;
}

.pf-grid th {
    font-size: 0.8rem;
    color: #555;
    background: #eef1f4;
}

.pf-grid td {
    padding: 0.4rem;
}

.pf-grid input[type="text"],
.pf-grid input[type="email"],
.pf-grid input[type="tel"],
.pf-grid input[type="date"],
.pf-grid select,
.pf-grid textarea,
.pf-row input[type="text"] {
    padding: 0.3rem 0.45rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 100%;
    text-align: center;
    background: #fff;
}

.pf-grid input[type="text"],
.pf-grid input[type="email"],
.pf-grid input[type="tel"] {
    width: 100%;
    min-width: 6rem;
}

.pf-grid input.pf-in-money,
.pf-in-money {
    width: 5.5rem;
    min-width: 0;
}

.pf-grid input.pf-in-mid {
    min-width: 5rem;
}

.pf-grid textarea {
    width: 100%;
    min-width: 12rem;
    text-align: left;
}

.pf-notes .pf-note-cell {
    width: 55%;
}

.pf-grid td.pf-classes-cell {
    font-size: 0.85rem;
}

.pf-act {
    white-space: nowrap;
    width: 1%;
}

.pf-act form {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.pf-act form + form {
    margin-top: 0.35rem;
}

.nl-small-btn.pf-remove {
    background: #8a3a3a;
}

/* The admin equipment page (AA_28388): the owner badge and its Change button on one line. */
.pf-equip-flip {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.pf-equip-owner-cell {
    white-space: nowrap;
}

@media (max-width: 860px) {
    .pf-equip-owner-cell {
        white-space: normal;
    }
}

/* Saved: a short green flash. Refused: a red edge that stays until a good save. */
@keyframes pf-flash {
    0%   { background-color: #bfe8c8; box-shadow: 0 0 0 3px #3a9a52; }
    100% { background-color: #fff; box-shadow: 0 0 0 0 rgba(58, 154, 82, 0); }
}

.pf-saved {
    animation: pf-flash 1.5s ease-out;
}

.pf-bad,
.pf-grid .pf-bad {
    border-color: #b02a2a !important;
    box-shadow: 0 0 0 2px #e9a3a3;
    background: #fff5f5;
}

.pf-msg {
    color: #a01f1f;
    font-size: 0.85rem;
    font-weight: bold;
    white-space: normal;
}

.pf-msg:empty {
    display: none;
}

.pf-grid tr.pf-msg-row td {
    border-top: 0;
    padding-top: 0;
    background: #fff5f5;
}

@media (max-width: 860px) {
    .pf-grid tr.pf-msg-row {
        border: 0;
        padding: 0;
        margin-top: -0.6rem;
        background: none;
    }
}

.pf-busy {
    opacity: 0.85;
}

/* "+ Add …": a button that opens its form, in its own area. */
.pf-add {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px dashed #d6dde3;
}

.pf-add-form {
    justify-content: center;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.pf-add-form[hidden] {
    display: none;
}

.pf-note-form label.portal-note-text {
    text-align: left;
}

/* The lessons of the next 4 weeks. */
.pf-lessons {
    list-style: none;
    padding: 0;
    margin: 0 auto 0.75rem;
    max-width: 34rem;
}

.pf-lessons li {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.2rem 0.6rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid #eee;
}

.pf-lessons li.portal-lesson-skipped > span:not(.portal-lesson-tag) {
    text-decoration: line-through;
    color: #888;
}

/* The ledger, as on Apex's page: oldest first, a running balance, colored amount cells. */
.pf-ledger {
    background: #fff;
    border: 1px solid #ccd3d9;
}

.pf-ledger th {
    background: #eee;
    font-size: 0.85rem;
}

.pf-ledger td {
    border: 1px solid #dfe4e8;
    padding: 0.35rem 0.5rem;
}

.pf-ledger td.pf-desc {
    overflow-wrap: anywhere;
}

.pf-ledger td.pf-up {
    background: #fde2e2;
}

.pf-ledger td.pf-down,
.pf-ledger td.pf-clear {
    background: #dcf5dc;
}

.pf-ledger td.pf-owes {
    background: #fde2e2;
    font-weight: bold;
}

.pf-ledger .pf-older-row td {
    background: #222;
    padding: 0.15rem;
}

.pf-ledger .pf-older-btn {
    color: #fff;
    font-size: 0.85rem;
}

.pf-nowrap {
    white-space: nowrap;
}

.pf-box {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
}

.pf-box .pf-h3 {
    margin-top: 0;
}

.pf-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.3rem;
    border: 0;
    margin: 0 0 0.5rem;
    padding: 0;
    min-width: 0;
}

.pf-pills legend {
    float: left;
    width: auto;
    font-size: 0.85rem;
    font-weight: bold;
    margin: 0 0.4rem 0 0;
    padding: 0;
}

.pf-pill {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.pf-pill input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.pf-pill span {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border: 1px solid #999;
    border-radius: 4px;
    background: #fff;
    font-size: 0.85rem;
}

.pf-pill input:checked + span {
    background: var(--primary-700, #1a3f5c);
    border-color: var(--primary-700, #1a3f5c);
    color: #fff;
}

.pf-pill input:focus-visible + span {
    outline: 2px solid var(--primary-700, #1a3f5c);
    outline-offset: 2px;
}

.pf-line-fields {
    justify-content: center;
    margin-bottom: 0.25rem;
}

.pf-line-fields .pf-grow {
    flex: 1 1 14rem;
    max-width: 24rem;
}

.pf-line-fields .pf-grow input {
    width: 100%;
}

.pf-method[hidden] {
    display: none !important;
}

.pf-box .pf-line-hint {
    margin: 0;
}

.pf-box .portal-charge-form {
    margin-bottom: 0;
}

/* A narrow window: each table row becomes a small card, each cell names its column. */
@media (max-width: 860px) {
    .pf-grid thead {
        display: none;
    }

    .pf-grid,
    .pf-grid tbody,
    .pf-grid tr,
    .pf-grid td {
        display: block;
        width: 100%;
    }

    .pf-grid {
        background: none;
    }

    .pf-grid tr {
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        margin-bottom: 0.75rem;
        padding: 0.4rem 0.6rem;
    }

    .pf-grid td {
        border: 0;
        padding: 0.25rem 0;
    }

    .pf-grid td.pf-act {
        width: 100%;
        white-space: normal;
        padding-top: 0.4rem;
    }

    .pf-notes .pf-note-cell {
        width: 100%;
    }

    .pf-grid textarea {
        min-width: 0;
    }

    .pf-grid td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.75rem;
        color: #777;
    }
}

/* A phone: the ledger drops the Student column and tightens; the summaries shrink. */
@media (max-width: 576px) {
    .pf-page .newsletter-card.pf-top {
        padding: 1rem 0.75rem;
    }

    .pf-acc > summary {
        padding: 0.7rem 2.4rem 0.7rem 0.75rem;
    }

    .pf-acc-body {
        padding: 0.75rem 0.5rem;
    }

    .pf-person {
        min-width: 0;
        width: 100%;
    }

    .pf-ledger .pf-col-student {
        display: none;
    }

    .pf-ledger th,
    .pf-ledger td {
        padding: 0.3rem 0.15rem;
        font-size: 0.78rem;
    }

    .pf-ledger .nl-small-btn {
        padding: 2px 6px;
        font-size: 0.75rem;
    }

    .pf-accs .pf-acc-body {
        padding-left: 0.3rem;
        padding-right: 0.3rem;
    }

    .pf-ledger .pf-nowrap {
        white-space: normal;
    }

    .pf-line-fields label,
    .pf-line-fields .pf-grow {
        flex: 1 1 100%;
        max-width: none;
    }

    .pf-line-fields input,
    .pf-line-fields select {
        width: 100%;
    }
}

/* "Lessons to charge" (AA_28395): a box under the family summary, and one over every family on the
   families list. Each row is ticked; its own Add, and one button for all the ticked ones. */
.pf-due {
    border-left: 4px solid var(--primary-700, #1a3f5c);
}

.pf-due .pf-due-title {
    font-size: 1.25rem;
    margin: 0 0 0.5rem;
    text-align: center;
}

.pf-due p.pf-due-none {
    margin: 0;
}

.pf-due-table td.pf-due-tick,
.pf-due-table th.pf-due-tick {
    width: 1%;
    text-align: center;
}

.pf-due-table td {
    vertical-align: middle;
}

.pf-due-table td.pf-due-tick input {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
}

.pf-due-foot .pf-due-go {
    width: auto;
    margin: 0;
}

.pf-due-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
}

@media (max-width: 860px) {
    .pf-due-table td.pf-due-tick {
        width: 100%;
        text-align: left;
    }
}

/* ------------------------------------------------------------------------
   Design pass (AA_28389): one look for every portal and admin page, tied to the public site.
   The site's navy and its soft cards stay; Aurum's GOLD (the logo's) is the one accent: the
   title rule, the marked nav item, the "Lessons to charge" edge. Every card gets the thin
   outline the public Contact cards carry (styles.css, AA_25787). Looks only: no class that
   families.js, card.js or a page script reads is renamed or removed.
   ------------------------------------------------------------------------ */
:root {
    --aa-gold: #c9a227;
    --aa-gold-soft: #fbf4dc;
    --aa-line: #d9e6f1;
}

/* Page titles: navy, with a short gold rule under them. */
.portal-page .contact-header {
    margin-bottom: 1.5rem;
}

.portal-page .contact-header h1,
.portal-page .pf-top h1.pf-name {
    color: var(--primary-900);
    letter-spacing: -0.01em;
}

.portal-page .contact-header h1::after,
.portal-page .pf-top h1.pf-name::after {
    content: "";
    display: block;
    width: 3rem;
    height: 3px;
    margin: 0.5rem auto 0;
    border-radius: 3px;
    background: var(--aa-gold);
}

/* Cards: white on the page's soft gray, the Contact cards' thin blue outline, a soft shadow. */
.portal-page .newsletter-card {
    background: var(--surface-white);
    border: 1px solid var(--aa-line);
    box-shadow: var(--shadow-sm);
}

.portal-page .newsletter-card > h2:first-child {
    font-size: 1.6rem;
}

.portal-page .newsletter-card.pf-due {
    border-left: 4px solid var(--aa-gold);
    background: linear-gradient(90deg, var(--aa-gold-soft), var(--surface-white) 40%);
}

.pf-due .pf-due-title {
    color: var(--primary-900);
}

/* Tables: small quiet column heads, figures that line up. */
.portal-page table {
    font-variant-numeric: tabular-nums;
}

.portal-page .nl-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--neutral-500);
    border-bottom: 2px solid var(--aa-line);
}

.portal-page .nl-table tbody tr:hover td {
    background-color: rgba(232, 244, 253, 0.45);
}

.portal-page .nl-table .portal-void td,
.portal-page .pf-ledger td.pf-up,
.portal-page .pf-ledger td.pf-down,
.portal-page .pf-ledger td.pf-clear,
.portal-page .pf-ledger td.pf-owes {
    transition: none;
}

/* The family navigation: a white panel; the page you are on is navy with a gold edge. */
.portal-nav {
    background: var(--surface-white);
    border: 1px solid var(--aa-line);
    box-shadow: var(--shadow-sm);
}

.portal-nav-family {
    font-size: 1.05rem;
    border-bottom: 2px solid var(--aa-gold);
    margin: 0 0.5rem 0.6rem;
    padding: 0 0 0.45rem;
}

.portal-nav li + li {
    margin-top: 0.15rem;
}

.portal-nav li a {
    transition: background-color var(--transition-fast);
}

.portal-nav li a:hover,
.portal-nav li a:focus {
    background: var(--primary-100);
}

.portal-nav li a.portal-nav-on {
    background: var(--primary-900);
    box-shadow: inset 4px 0 0 var(--aa-gold);
}

/* The balance line: a pill, red while money is owed, green when it is not. */
.portal-page p.portal-balance {
    display: inline-block;
    padding: 0.3rem 1rem;
    border-radius: 999px;
    background: #e9f6ef;
    color: #1d5a2a;
}

.portal-page p.portal-balance.portal-owes {
    background: #fbeaea;
    color: #8a1a1a;
}

/* A link that is the card's next step ("Save a card", "Manage the card"). */
.portal-cta {
    display: inline-block;
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--primary-700);
    color: var(--primary-700);
    font-weight: 500;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.portal-cta:hover,
.portal-cta:focus {
    background: var(--primary-700);
    color: #fff;
    text-decoration: none;
}

/* Student sections: a gold edge on the left ties them to the brand; the names are bigger. */
.portal-student {
    border-left: 4px solid var(--aa-gold);
    box-shadow: var(--shadow-sm);
}

.portal-student h2 {
    font-size: 1.65rem;
}

/* The admin accordion: white when you point at it or it is open. */
.pf-acc > summary {
    border-radius: 10px;
    transition: background-color var(--transition-fast);
}

.pf-acc > summary:hover {
    background: var(--surface-white);
}

.pf-acc[open] {
    background: var(--surface-white);
    box-shadow: var(--shadow-sm);
}

.pf-acc[open] > summary {
    border-radius: 10px 10px 0 0;
    box-shadow: inset 0 -2px 0 var(--aa-gold);
    border-bottom-color: transparent;
}

.pf-acc .pf-box {
    background: var(--neutral-50);
}

/* Small buttons: one height and one look everywhere; a clear focus ring. */
.portal-page .nl-small-btn {
    line-height: 1.4;
    transition: background-color var(--transition-fast);
}

.portal-page .nl-small-btn:hover {
    background: var(--primary-900);
}

.portal-page .nl-small-btn.pf-remove:hover {
    background: #6e2626;
}

.portal-page .nl-small-btn.portal-btn-quiet:hover {
    background: #4f565c;
}

.portal-page a:focus-visible,
.portal-page button:focus-visible,
.portal-page input:focus-visible,
.portal-page select:focus-visible,
.portal-page textarea:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* The calendar: today and the lesson chips a touch warmer. */
.portal-cal {
    border-color: var(--aa-line);
}

.portal-cal-wd {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.72rem;
    background: var(--primary-100);
    color: var(--primary-900);
}

.portal-cal-now {
    background: var(--aa-gold-soft);
}

/* One calm entrance: the cards rise in, one after the other. None if the reader asks for less motion. */
@keyframes aa-rise {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
    .portal-page .newsletter-card,
    .portal-page .portal-student,
    .portal-page .pf-accs {
        animation: aa-rise 0.35s ease-out both;
    }

    .portal-page .newsletter-card:nth-of-type(2),
    .portal-page .portal-student:nth-of-type(2) {
        animation-delay: 0.06s;
    }

    .portal-page .newsletter-card:nth-of-type(3),
    .portal-page .portal-student:nth-of-type(3),
    .portal-page .pf-accs {
        animation-delay: 0.12s;
    }
}

@media (max-width: 768px) {
    .portal-nav li a.portal-nav-on {
        box-shadow: inset 0 -3px 0 var(--aa-gold);
    }
}

@media (max-width: 576px) {
    .portal-page .newsletter-card > h2:first-child {
        font-size: 1.35rem;
    }

    .portal-student h2 {
        font-size: 1.4rem;
    }

    /* Capitals and letter spacing widen the narrow ledger columns past a 375px phone. */
    .portal-page .nl-table th {
        text-transform: none;
        letter-spacing: 0;
    }

    /* The families list sat 34px past its card on a phone (scrolled inside it); tighter cells fit it. */
    .portal-page .nl-table-wrap .portal-table th,
    .portal-page .nl-table-wrap .portal-table td {
        padding: 0.4rem 0.25rem;
    }

    .portal-cal-now {
        background: var(--aa-gold-soft);
    }
}
