.fme-form,
.fme-preferences,
.fme-notification-centre,
.fme-guide,
.fme-form-guide,
.fme-empty {
    box-sizing: border-box;
}

.fme-form,
.fme-preferences,
.fme-notification-centre,
.fme-notification-list,
.fme-preference-list,
.fme-checklist {
    display: grid;
}

.fme-preferences,
.fme-notification-centre {
    gap: 28px;
}

.fme-notification-centre { grid-template-columns:minmax(0,1fr); overflow-wrap:anywhere; }
.fme-notification-centre > section, .fme-notification-centre .fme-form { min-width:0; }

.fme-preferences > header h3,
.fme-preferences > header p,
.fme-notification-centre h3,
.fme-notification-centre section > p {
    margin-top: 0;
}

.fme-form {
    gap: 16px;
}

.fme-preferences .fme-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fme-profile-preferences {
    border: 0;
    display: grid;
    gap: 16px;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 8px 0 0;
    min-width: 0;
    padding: 0;
}

/* Editorial Stories on wider screens; the same sections become a Daily Journal on mobile. */
.fme-match-story { gap: 22px; }
.fme-match-story > header { border-bottom: 1px solid #d9e2de; max-width: 720px; padding-bottom: 22px; }
.fme-match-eyebrow { color: #a46d25; font-size: 12px; font-weight: 800; letter-spacing: .08em; margin: 0 0 8px; text-transform: uppercase; }
.fme-match-story > header h3 { font-family: Georgia, serif; font-size: 34px; font-weight: 500; line-height: 1.1; margin: 0 0 10px; }
.fme-match-story > .fme-form { gap: 22px; grid-template-columns: minmax(0, 1fr); }
.fme-preference-chapter { background: #f7f8f7; border: 1px solid #d9e2de; border-radius: 6px; padding: 24px; }
.fme-preference-chapter-heading { align-items: flex-start; display: grid; gap: 14px; grid-template-columns: 34px minmax(0, 1fr); margin-bottom: 20px; }
.fme-preference-chapter-heading > span { border-top: 2px solid #b87a2d; color: #a46d25; font-size: 12px; font-weight: 800; padding-top: 7px; }
.fme-preference-chapter h4 { font-family: Georgia, serif; font-size: 22px; font-weight: 500; margin: 0; }
.fme-preference-chapter-heading p { color: #65736d; margin: 5px 0 0; }
.fme-preference-chapter .fme-profile-preferences { margin: 0; }
.fme-preference-list { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fme-preference-chapter--language .fmp-tag-picker { margin: 0; }
.fme-preference-save { align-items: center; display: flex; flex-wrap: wrap; gap: 14px; justify-content: flex-end; }

/* The dashboard uses the same interactive language picker as Edit Profile. */
.encounter3-site .fme-preferences .fmp-tag-heading {
    align-items: center !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: #1f2935 !important;
    display: flex !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    justify-content: space-between !important;
    min-height: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    width: 100% !important;
}

.encounter3-site .fme-preferences .fmp-tag-dropdown-toggle,
.encounter3-site .fme-preferences .fmp-tag button {
    box-shadow: none !important;
    margin: 0 !important;
}

.encounter3-site .fme-preferences .fmp-tag-dropdown-toggle {
    align-items: center !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    display: inline-flex !important;
    height: 36px !important;
    justify-content: center !important;
    min-height: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    position: absolute;
    right: 3px;
    top: 3px;
    width: 36px !important;
}

.encounter3-site .fme-preferences .fmp-tag-options button {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #17324a !important;
    display: block !important;
    font-family: inherit !important;
    font-size: 1rem !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    min-height: 0 !important;
    padding: 10px 11px !important;
    text-align: left !important;
    width: 100% !important;
}

.encounter3-site .fme-preferences .fmp-tag-options button:hover,
.encounter3-site .fme-preferences .fmp-tag-options button:focus-visible {
    background: transparent !important;
    color: #641a2a !important;
    outline: 0 !important;
    text-decoration: underline;
}

.encounter3-site .fme-preferences .fmp-tag button {
    align-items: center !important;
    background: #66717e !important;
    border: 0 !important;
    border-radius: 50% !important;
    color: #fff !important;
    display: inline-flex !important;
    font-size: 0.9rem !important;
    height: 20px !important;
    justify-content: center !important;
    line-height: 1 !important;
    min-height: 20px !important;
    min-width: 20px !important;
    padding: 0 !important;
    width: 20px !important;
}

.fme-form label:not(.fme-check) {
    display: grid;
    gap: 6px;
}

.fme-form label > span,
.fme-form legend {
    font-weight: 700;
}

.fme-form input[type="text"],
.fme-form input[type="email"],
.fme-form select,
.fme-form textarea {
    border: 1px solid #bbc9c3;
    border-radius: 6px;
    box-sizing: border-box;
    min-height: 42px;
    padding: 9px 11px;
    width: 100%;
}

.fme-form button {
    align-self: end;
    background: #265c4b;
    border: 1px solid #265c4b;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    min-height: 42px;
    padding: 9px 14px;
}

.fme-form button.fme-secondary {
    background: #fff;
    color: #265c4b;
}

.fme-guide,
.fme-form-guide,
.fme-empty {
    background: #f5f7f6;
    border-left: 4px solid #265c4b;
    border-radius: 6px;
    padding: 16px;
}

.fme-form-guide {
    margin-bottom: 18px;
}

.fme-form-guide p,
.fme-empty p {
    margin-bottom: 0;
}

.fme-guide > header {
    align-items: center;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(150px, auto) minmax(180px, 1fr);
}

.fme-guide h3,
.fme-guide header p {
    margin: 0;
}

.fme-progress {
    background: #dbe5e1;
    border-radius: 4px;
    height: 10px;
    overflow: hidden;
}

.fme-progress span {
    background: #c4803e;
    display: block;
    height: 100%;
}

.fme-checklist {
    gap: 1px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
}

.fme-checklist > div {
    align-items: center;
    background: #fff;
    display: grid;
    gap: 9px;
    grid-template-columns: 24px 1fr auto;
    min-height: 44px;
    padding: 9px 12px;
}

.fme-checklist > div.is-done > span {
    color: #26713d;
    font-weight: 800;
}

.fme-checklist small,
.fme-notification time {
    color: #65736d;
}

.fme-guide-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.fme-photo-guidance {
    border-top: 1px solid #d9e2de;
    margin: 18px 0 0;
    padding-top: 14px;
}

.fme-section-header {
    align-items: start;
    display: flex;
    gap: 20px;
    justify-content: space-between;
}

.fme-section-header .fme-form {
    flex: 0 0 auto;
}

.fme-notification-list {
    border-top: 1px solid #d9e2de;
    gap: 0;
}

.fme-notification {
    border-bottom: 1px solid #d9e2de;
    padding: 16px 12px;
}

.fme-notification.is-unread {
    background: #f2f8f5;
    border-left: 4px solid #c4803e;
}

.fme-notification > div {
    align-items: baseline;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.fme-notification p {
    margin: 8px 0;
}

.fme-preference-list {
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fme-preference-list fieldset {
    border: 1px solid #d9e2de;
    border-radius: 6px;
    display: grid;
    gap: 10px;
    margin: 0;
    min-width: 0;
    padding: 14px;
}

.fme-preference-list legend {
    padding: 0 5px;
}

.fme-preference-list.fme-single-preference { grid-template-columns:minmax(0,1fr); max-width:480px; width:100%; }
.fme-single-preference .fme-delivery-card { padding:20px; gap:16px; border-color:var(--fm-border,#d9e2de); background:#fff; }
.fme-delivery-card legend { font-weight:700; color:var(--fm-green,#193e55); }
.fme-delivery-card .fme-delivery-enable { justify-self:end; display:inline-flex; min-height:44px; margin:0; }
.fme-delivery-card input[type="checkbox"] { width:18px; height:18px; accent-color:var(--fm-green,#193e55); }
.fme-delivery-card select { width:100%; min-width:0; }
.fme-delivery-card .fme-no-saved-searches { padding:12px 14px; border-left:3px solid var(--fm-coral,#9e2331); background:var(--fm-mint,#f1f5f4); color:var(--fm-green,#193e55); overflow-wrap:anywhere; }
.fme-no-saved-searches a { color:inherit; font-weight:700; text-decoration:underline !important; text-underline-offset:3px; }
.fme-delivery-preferences > .fme-form > button { justify-self:start; }

.fme-preference-list p {
    color: #65736d;
    margin: 0;
}

.fme-check {
    align-items: center;
    display: inline-flex;
    gap: 7px;
}

.fme-notification-centre section:last-child:not(.fme-delivery-preferences) > .fme-form {
    align-items: end;
    border-bottom: 1px solid #d9e2de;
    grid-template-columns: minmax(150px, 1fr) minmax(160px, 220px) auto;
    padding: 12px 0;
}

.fme-notice {
    background: #eff7f1;
    border-left: 4px solid #26713d;
    padding: 12px 14px;
}

.fme-notice.is-error {
    background: #fff2f1;
    border-left-color: #a12d2d;
}

.fme-admin-table {
    table-layout: fixed;
    width: 100%;
}

.fme-admin-table th:nth-child(1) { width: 20%; }
.fme-admin-table th:nth-child(2) { width: 14%; }
.fme-admin-table th:nth-child(3) { width: 34%; }
.fme-admin-table th:nth-child(4) { width: 22%; }
.fme-admin-table th:nth-child(5) { width: 10%; }

.fme-admin-table textarea,
.fme-admin-table input[type="email"],
.fme-admin-table input[type="text"],
.fme-admin-table select {
    box-sizing: border-box;
    margin-top: 6px;
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

.fme-admin-table td {
    overflow-wrap: anywhere;
    vertical-align: top;
}

@media (max-width: 820px) {
    .fme-preferences .fme-form,
    .fme-profile-preferences,
    .fme-preference-list,
    .fme-checklist {
        grid-template-columns: 1fr;
    }

    .fme-notification-centre section:last-child:not(.fme-delivery-preferences) > .fme-form {
        grid-template-columns: 1fr;
    }

    .fme-admin-table {
        display: block;
        overflow-x: auto;
        table-layout: auto;
        width: 920px;
    }
}

@media (max-width: 520px) {
    .fme-match-story > header h3 { font-size: 28px; }
    .fme-preference-chapter { background: transparent; border: 0; border-left: 2px solid #d9e2de; border-radius: 0; margin-left: 9px; padding: 0 0 24px 22px; position: relative; }
    .fme-preference-chapter::before { background: #b87a2d; border: 3px solid #fff; border-radius: 50%; content: ''; height: 10px; left: -7px; position: absolute; top: 4px; width: 10px; }
    .fme-preference-chapter-heading { display: block; margin-bottom: 16px; }
    .fme-preference-chapter-heading > span { display: block; font-size: 11px; margin-bottom: 7px; padding: 0; }
    .fme-preference-chapter h4 { font-size: 20px; }
    .fme-preference-save { justify-content: stretch; }
    .fme-preference-save button { width: 100%; }
    .fme-guide > header {
        grid-template-columns: 1fr;
    }

    .fme-section-header,
    .fme-notification > div {
        align-items: stretch;
        flex-direction: column;
    }
}
