/* SEND Life Update 25D - mobile form and layout polish */
:root {
    --sl25d-control-height: 50px;
    --sl25d-mobile-gap: 12px;
}

/* Reward detail card: clear labels, explanations and full usable controls. */
.sl25d-reward-details {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid #cfe3e5;
    border-radius: 16px;
    background: linear-gradient(135deg, #f7ffff, #fff);
}
.sl25d-reward-help {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding-bottom: 3px;
}
.sl25d-reward-help > span {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: #eaf9f7;
    font-size: 1.18rem;
}
.sl25d-reward-help strong,
.sl25d-reward-help small,
.sl25d-reward-field > span,
.sl25d-reward-field > small {
    display: block;
}
.sl25d-reward-help strong { color: #17335b; }
.sl25d-reward-help small,
.sl25d-reward-field > small {
    margin-top: 2px;
    color: #667b84;
    font-size: .78rem;
    font-weight: 650;
    line-height: 1.3;
}
.sl25d-reward-field {
    min-width: 0;
    width: 100%;
    word-break: normal !important;
    overflow-wrap: normal !important;
}
.sl25d-reward-field > span {
    color: #17335b;
    font-weight: 900;
    line-height: 1.25;
    white-space: normal;
}

@media (max-width: 760px) {
    /* Defensive mobile sizing. Nothing in the parent app should force the page wider than the phone. */
    .sl-ui-19j .sl-shell,
    .sl-ui-19j .sl-main,
    .sl-ui-19j .sl-card,
    .sl-ui-19j .sl-form,
    .sl-ui-19j .sl-form > *,
    .sl-ui-19j .sl-form fieldset,
    .sl-ui-19j .sl-task-form-section-19h1 > div,
    .sl-ui-19j .sl19g2-form-section,
    .sl-ui-19j .sl23a-form-panel {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    /* iOS-friendly controls: full width, comfortable height and 16px text prevents focus zoom. */
    .sl-ui-19j .sl-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    .sl-ui-19j .sl-form select,
    .sl-ui-19j .sl-form textarea,
    .sl-ui-19j .sl23a-calendar-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    .sl-ui-19j .sl23a-calendar-form select,
    .sl-ui-19j .sl23a-calendar-form textarea {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        font-size: 16px !important;
    }
    .sl-ui-19j .sl-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
    .sl-ui-19j .sl-form select {
        min-height: var(--sl25d-control-height) !important;
    }
    .sl-ui-19j .sl-form textarea { min-height: 108px; }
    .sl-ui-19j .sl-form input[type="file"] { min-height: 0 !important; }
    .sl-ui-19j .sl-form .sl-check input,
    .sl-ui-19j .sl-form input[type="checkbox"],
    .sl-ui-19j .sl-form input[type="radio"] {
        width: auto !important;
        min-width: auto !important;
        min-height: auto !important;
    }

    /* Form grids become one clear field per row on phones. */
    .sl-ui-19j .sl-form .sl-grid-2,
    .sl-ui-19j .sl-form .sl-grid-3,
    .sl-ui-19j .sl-form .sl-grid-4,
    .sl-ui-19j .sl23a-form-grid,
    .sl-ui-19j .sl-task-schedule-grid-19h1,
    .sl-ui-19j .sl-task-repeat-reward-grid-19h1,
    .sl-ui-19j .sl-task-reward-options-19h1,
    .sl-ui-19j .sl-task-advanced-checks-19h1,
    .sl-ui-19j .sl-routine-support-options-19h2 {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    /* Task builder: preserve numbered steps, but make the content column truly full-width. */
    .sl-ui-19j .sl-task-form-section-19h1 {
        width: 100% !important;
        min-width: 0 !important;
        grid-template-columns: 34px minmax(0, 1fr) !important;
        gap: 10px !important;
    }
    .sl-ui-19j .sl-task-form-section-19h1 > div,
    .sl-ui-19j .sl-task-repeat-reward-grid-19h1,
    .sl-ui-19j .sl-task-reward-options-19h1,
    .sl-ui-19j .sl-task-schedule-grid-19h1,
    .sl-ui-19j .sl-task-repeat-reward-grid-19h1 > label,
    .sl-ui-19j .sl-task-reward-options-19h1 > label,
    .sl-ui-19j .sl-task-schedule-grid-19h1 > label {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
    .sl-ui-19j .sl-task-repeat-reward-grid-19h1 > label,
    .sl-ui-19j .sl-task-reward-options-19h1 > label,
    .sl-ui-19j .sl-task-schedule-grid-19h1 > label {
        word-break: normal !important;
        overflow-wrap: normal !important;
        white-space: normal !important;
    }
    .sl-ui-19j .sl-task-reward-options-19h1 { gap: 12px !important; }
    .sl-ui-19j .sl25d-reward-details { padding: 13px !important; }
    .sl-ui-19j .sl25d-reward-field > span { font-size: .98rem; }

    /* The optional panel must not squeeze its label/copy/status columns. */
    .sl-ui-19j .sl-task-more-options-19h1 > summary {
        grid-template-columns: 34px minmax(0, 1fr) !important;
        align-items: center !important;
        gap: 9px !important;
        padding: 14px !important;
    }
    .sl-ui-19j .sl-task-more-options-19h1 > summary > em {
        grid-column: 2 !important;
        justify-self: start !important;
        margin-top: 2px;
    }
    .sl-ui-19j .sl-task-more-panel-19h1 { padding: 14px !important; }

    /* Appointment/calendar and other common parent forms follow the same single-column rule. */
    .sl-ui-19j .sl19g2-form-section,
    .sl-ui-19j .sl19g2-mode-section { overflow: hidden; }
    .sl-ui-19j .sl19g2-check-grid { grid-template-columns: minmax(0, 1fr) !important; }
    .sl-ui-19j .sl19g2-reminder-field { max-width: none !important; }
    .sl-ui-19j .sl-routine-search-19h2 { grid-template-columns: minmax(0, 1fr) !important; }

    /* Mobile action bars and submit buttons leave safe space above the fixed app navigation. */
    .sl-ui-19j .sl-task-send-button-19h1,
    .sl-ui-19j .sl-routine-submit-19h2,
    .sl-ui-19j .sl19g2-form-actions .sl-button {
        min-height: 52px !important;
    }
    .sl-ui-19j .sl-task-submit-note-19h1 { margin-bottom: 18px !important; }
    .sl-ui-19j .sl-main { padding-bottom: 62px !important; }
    .sl-has-mobile-bottom-nav {
        padding-bottom: calc(var(--sl19j-bottom-height) + var(--sl19j-safe-bottom) + 28px) !important;
    }

    /* Cards and headings wrap naturally rather than forcing horizontal scroll. */
    .sl-ui-19j :where(.sl-card, .sl-form, .sl-form label, .sl-section-head, .sl-card-title-row) {
        overflow-wrap: break-word;
    }
}

@media (max-width: 430px) {
    .sl-ui-19j .sl-quick-task-card-19h1,
    .sl-ui-19j .sl19g2-form-card { padding-inline: 12px !important; }
    .sl-ui-19j .sl-task-form-section-19h1 {
        grid-template-columns: 30px minmax(0, 1fr) !important;
        gap: 8px !important;
    }
    .sl-ui-19j .sl25d-reward-details {
        margin-top: 9px;
        padding: 12px !important;
        border-radius: 14px;
    }
    .sl-ui-19j .sl25d-reward-help { align-items: flex-start; }
    .sl-ui-19j .sl25d-reward-help > span { width: 34px; height: 34px; }
}

@media (max-width: 360px) {
    .sl-ui-19j .sl-shell { padding-inline: 8px !important; }
    .sl-ui-19j .sl-card { padding-inline: 12px !important; }
    .sl-ui-19j .sl-task-form-section-19h1 {
        grid-template-columns: 28px minmax(0, 1fr) !important;
        gap: 7px !important;
    }
    .sl-ui-19j .sl-task-form-number-19h1 { width: 28px !important; height: 28px !important; }
}

html[data-sl-effective-theme="dark"] .sl25d-reward-details {
    border-color: #2b4554;
    background: #102333;
}
html[data-sl-effective-theme="dark"] .sl25d-reward-help strong,
html[data-sl-effective-theme="dark"] .sl25d-reward-field > span { color: #f3f7ff; }
html[data-sl-effective-theme="dark"] .sl25d-reward-help small,
html[data-sl-effective-theme="dark"] .sl25d-reward-field > small { color: #b5c5cd; }
