html {
    height: auto;
}

body[data-page-name="school_family_dashboard"] {
    min-height: 100dvh;
    height: auto !important;
    overflow-x: hidden;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

body[data-page-name="school_family_dashboard"].sc-page-loading {
    overflow: hidden !important;
}

body[data-page-name="school_family_dashboard"] > .container-fluid {
    min-height: 100dvh;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.sc-page-loader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(244, 248, 252, 0.82);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.sc-page-loader.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sc-page-loader-card {
    width: min(100%, 420px);
    padding: 1.6rem 1.4rem;
    border-radius: 24px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.16), transparent 42%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.98));
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.14);
    text-align: center;
}

.sc-page-loader-spinner {
    width: 54px;
    height: 54px;
    margin: 0 auto 1rem;
    border-radius: 999px;
    border: 4px solid #dbeafe;
    border-top-color: #2563eb;
    animation: sc-loader-spin 0.85s linear infinite;
}

.sc-page-loader-title {
    color: var(--theme-text-head);
    font-size: 1.08rem;
    font-weight: 700;
}

.sc-page-loader-copy {
    color: #64748b;
    font-size: 0.94rem;
    line-height: 1.65;
}

@keyframes sc-loader-spin {
    to {
        transform: rotate(360deg);
    }
}

.sc-page-shell {
    max-width: 1160px;
    margin: 0 auto;
}

.sc-hero-card {
    border: 1px solid #dbe7f3;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.sc-hero-card .card-body {
    padding: 1rem 1.2rem !important;
}

.sc-hero-copy {
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.sc-hero-copy > p {
    display: none;
}

.sc-hero-card h1 {
    margin-bottom: 0 !important;
    font-size: 1.35rem;
    line-height: 1.28;
}

.sc-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.38rem 0.78rem;
    border-radius: 999px;
    background: #f8fbff;
    border: 1px solid #d7e4f1;
    color: #475569;
    font-weight: 600;
    margin-bottom: 0 !important;
}

.sc-hero-meta-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: flex-end;
    gap: 0.6rem;
}

.sc-hero-meta-chip {
    min-width: 180px;
    padding: 0.58rem 0.78rem;
    border-radius: 14px;
    border: 1px solid #dbe7f3;
    background: #ffffff;
    box-shadow: none;
}

.sc-hero-meta-chip strong {
    display: block;
    color: var(--theme-text-head);
    font-size: 0.88rem;
    line-height: 1.35;
}

.sc-hero-meta-label {
    display: block;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 0.18rem;
}

.sc-shell-card {
    border: 0;
    border-radius: 24px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.sc-section-head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.sc-collapse-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.sc-collapse-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 48px;
    padding: 0.7rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fbff;
    color: #1d4ed8;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
}

.sc-collapse-toggle:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1e40af;
}

.sc-collapse-toggle[aria-expanded="true"] .sc-collapse-chevron {
    transform: rotate(180deg);
}

.sc-collapse-chevron {
    transition: transform 0.2s ease;
}

.sc-section-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sc-simple-card,
.sc-suggestion-card,
.sc-tip-card {
    height: 100%;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    padding: 1.2rem;
}

.sc-card-title {
    color: var(--theme-text-head);
    font-weight: 700;
    margin-bottom: 0.55rem;
}

.sc-card-copy {
    color: #64748b;
    font-size: 0.94rem;
    line-height: 1.7;
    margin-bottom: 0;
}

.sc-card-kicker {
    color: #2563eb;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 0.55rem;
}

.sc-card-label {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.7rem;
}

.sc-suggestion-wrap {
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 32%),
        linear-gradient(135deg, #ffffff, #f8fafc);
    border: 1px solid #dbeafe;
}

.sc-suggestion-number {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 700;
    margin-bottom: 0.85rem;
}

.sc-tip-card {
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(255, 255, 255, 0.98));
    border-color: #dbeafe;
}

.sc-record-preview {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    min-height: 6.8rem;
}

.sc-record-card {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.sc-record-action {
    align-self: flex-start;
}

.sc-borrow-summary {
    border-radius: 16px;
    border: 1px solid #dbeafe;
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(255, 255, 255, 0.98));
    color: #1d4ed8;
    padding: 0.95rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.sc-borrow-filters-wrap {
    margin-bottom: 0.9rem;
}

.sc-borrow-filters-card {
    border-radius: 18px;
    border: 1px solid #dbeafe;
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.9), rgba(255, 255, 255, 0.98));
    padding: 1rem;
}

.sc-borrow-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.sc-borrow-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sc-borrow-filter-field span {
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 600;
}

.sc-borrow-filter-field .form-control,
.sc-borrow-filter-field .form-select {
    border-radius: 12px;
    border-color: #dbe3ef;
    font-size: 0.82rem;
    min-height: 2.2rem;
}

.sc-borrow-filter-summary {
    color: #64748b;
    font-size: 0.76rem;
    margin-top: 0.75rem;
}

.sc-borrow-list-card {
    padding: 0.7rem 0.9rem;
}

.sc-borrow-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sc-borrow-list-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.sc-borrow-list-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.sc-borrow-list-item:first-child {
    padding-top: 0;
}

.sc-borrow-list-index {
    color: #94a3b8;
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 1.4rem;
}

.sc-borrow-list-content {
    min-width: 0;
}

.sc-borrow-list-title {
    color: var(--theme-text-head);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.45;
}

.sc-borrow-list-meta {
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.5;
    margin-top: 0.15rem;
}

.sc-modal-body {
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 0.98rem;
    max-height: 60vh;
    overflow-y: auto;
    color: #475569;
}

.sc-modal-section {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #ffffff;
}

.sc-modal-section h6 {
    font-weight: 700;
    color: var(--theme-text-head);
    margin-bottom: 0.65rem;
}

.sc-modal-section p {
    white-space: pre-wrap;
    line-height: 1.8;
    color: #475569;
    margin-bottom: 0;
}

.sc-observation-summary {
    background:
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 40%),
        linear-gradient(135deg, rgba(239, 246, 255, 0.92), rgba(255, 255, 255, 0.98));
    border-color: #bfdbfe;
}

.sc-observation-note {
    border-radius: 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    padding: 0.9rem 1rem;
    font-size: 0.92rem;
    line-height: 1.6;
}

.sc-observation-meta {
    margin-top: 0.9rem;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
}

.sc-observation-questions {
    margin: 0;
    padding-left: 1.2rem;
    color: #475569;
}

.sc-observation-questions li {
    line-height: 1.8;
    margin-bottom: 0.6rem;
}

.sc-observation-questions li:last-child {
    margin-bottom: 0;
}

.sc-home-opening-card {
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 38%),
        linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(255, 255, 255, 0.98));
    border-color: #bfdbfe;
}

.sc-home-suggestion-card {
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 32%),
        linear-gradient(135deg, #ffffff, #f8fafc);
}

.sc-followup-theme-card {
    border-color: #dbeafe;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.08), transparent 34%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
}

.sc-step-card {
    position: relative;
    overflow: hidden;
}

.sc-step-sequence {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    padding: 0.32rem 0.72rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
}

.sc-step-detail-box {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: #f8fbff;
    border: 1px solid #dbeafe;
}

.sc-step-detail-label {
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.sc-step-detail-copy {
    color: #475569;
    font-size: 0.88rem;
    line-height: 1.65;
    margin-bottom: 0;
}

.sc-parent-questions-card {
    padding-bottom: 0.95rem;
}

.sc-parent-questions-intro {
    color: #475569;
    margin-bottom: 1rem;
}

.sc-parent-question-card {
    border-color: #dbeafe;
}

.sc-parent-question-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.85rem;
}

.sc-parent-question-item {
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid #dbeafe;
    background: #f8fbff;
}

.sc-parent-question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 0.55rem;
}

.sc-parent-question-prompt {
    color: var(--theme-text-head);
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.6;
    margin-bottom: 0.35rem;
}

.sc-parent-question-followup {
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.65;
    margin-bottom: 0;
}

.sc-parent-question-empty {
    color: #64748b;
    margin-bottom: 0;
}

.sc-followup-tip-card {
    border: 1px solid #dbeafe;
}

.sc-loading-card {
    overflow: hidden;
}

.sc-loading-stack {
    display: grid;
    gap: 0.75rem;
}

.sc-loading-line {
    height: 0.95rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #e2e8f0 0%, #f8fafc 48%, #e2e8f0 100%);
    background-size: 200% 100%;
    animation: sc-loading-pulse 1.25s ease-in-out infinite;
}

.sc-loading-line.is-title {
    width: 48%;
    height: 1.1rem;
}

.sc-loading-line.is-short {
    width: 68%;
}

@keyframes sc-loading-pulse {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.sc-actions-card {
    border: 0;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(245, 158, 11, 0.1));
}

.sc-action-btn {
    min-height: 58px;
    font-weight: 700;
}

.sc-section-overview,
.sc-section-followup,
.sc-section-chat,
.sc-section-borrow,
.sc-section-actions {
    scroll-margin-top: 1rem;
}

.sc-section-switch-card {
    border: 0;
    border-radius: 20px;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.12), transparent 38%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
}

.sc-section-switch-title {
    color: var(--theme-text-head);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.sc-section-switch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.sc-section-switch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.75rem 0.9rem;
    border-radius: 16px;
    border: 1px solid #dbeafe;
    background: rgba(255, 255, 255, 0.92);
    color: #1d4ed8;
    font-size: 0.92rem;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
    appearance: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sc-section-switch-btn:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1e40af;
}

.sc-section-switch-btn.is-active {
    border-color: #2563eb;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 12px 20px rgba(37, 99, 235, 0.18);
}

.sc-section-switcher,
.sc-switch-panel {
    overflow-anchor: none;
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    .sc-dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .sc-page-shell {
        max-width: 100%;
    }

    .sc-section-hero,
    .sc-section-switcher,
    .sc-section-overview,
    .sc-section-followup,
    .sc-section-chat,
    .sc-section-borrow,
    .sc-section-actions {
        grid-column: 1 / -1;
    }

    .sc-switch-panel {
        display: none;
    }

    .sc-switch-panel.is-active {
        display: block;
    }

    .sc-section-switcher {
        position: sticky;
        top: 0.75rem;
        z-index: 10;
    }

    .sc-section-switch-btn {
        min-height: 44px;
        padding: 0.68rem 0.55rem;
        font-size: 0.85rem;
    }

    .sc-section-overview,
    .sc-section-followup,
    .sc-section-chat,
    .sc-section-borrow,
    .sc-section-actions {
        margin-top: 0 !important;
    }

    body[data-page-name="school_family_dashboard"] {
        font-size: 17px;
    }

    .sc-hero-card h1 {
        font-size: 1.22rem;
        line-height: 1.28;
    }

    .sc-hero-card p,
    .sc-shell-card p,
    .sc-actions-card p {
        font-size: 0.98rem;
        line-height: 1.68;
    }

    .sc-hero-badge {
        font-size: 0.9rem;
        padding: 0.55rem 0.86rem;
    }

    .sc-hero-meta-chip {
        min-width: 0;
        flex: 1 1 180px;
        padding: 0.58rem 0.72rem;
    }

    .sc-hero-meta-chip strong {
        font-size: 0.88rem;
    }

    .sc-section-head h2,
    .sc-actions-card h2 {
        font-size: 1.4rem;
        line-height: 1.28;
    }

    .sc-hero-card .card-body,
    .sc-shell-card .card-body,
    .sc-actions-card .card-body {
        padding: 1rem !important;
    }

    .sc-section-head {
        gap: 0.7rem;
        margin-bottom: 0.85rem;
    }

    .sc-section-icon {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .sc-simple-card,
    .sc-suggestion-card,
    .sc-tip-card {
        padding: 1rem;
    }

    .sc-card-title {
        font-size: 1.08rem;
        line-height: 1.35;
    }

    .sc-card-copy {
        font-size: 0.93rem;
        line-height: 1.62;
    }

    .sc-card-kicker,
    .sc-card-label,
    .sc-observation-meta,
    .sc-observation-note {
        font-size: 0.84rem;
    }

    .sc-observation-note {
        padding: 0.82rem 0.92rem;
        line-height: 1.55;
    }

    .sc-modal-body,
    .sc-modal-section p,
    .sc-observation-questions li {
        font-size: 0.95rem;
        line-height: 1.72;
    }

    .sc-modal-section h6 {
        font-size: 0.98rem;
    }

    .sc-action-btn {
        min-height: 56px;
        font-size: 0.98rem;
    }

    .sc-page-loader-card {
        padding: 1.45rem 1.2rem;
    }

    .sc-page-loader-title {
        font-size: 1rem;
    }

    .sc-page-loader-copy,
    .sc-step-detail-copy,
    .sc-parent-question-followup {
        font-size: 0.84rem;
    }

    .sc-record-preview {
        -webkit-line-clamp: 3;
        min-height: 4.6rem;
    }

    .sc-borrow-filter-field span,
    .sc-borrow-list-meta,
    .sc-borrow-filter-summary,
    .sc-section-switch-title {
        font-size: 0.8rem;
    }

    .sc-chat-records-grid > [class*="col-"] {
        display: flex;
    }
}

@media (min-width: 900px) and (max-width: 1199.98px) {
    .sc-hero-card h1 {
        font-size: 1.3rem;
    }

    .sc-section-switch-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .sc-section-head h2,
    .sc-actions-card h2 {
        font-size: 1.65rem;
    }

    .sc-card-title {
        font-size: 1.26rem;
    }

    .sc-section-switch-btn {
        font-size: 0.9rem;
    }
}

@media (max-width: 767.98px) {
    .sc-hero-card,
    .sc-shell-card,
    .sc-section-switch-card,
    .sc-suggestion-wrap,
    .sc-actions-card {
        border-radius: 20px;
    }

    .sc-hero-meta-wrap {
        width: 100%;
    }

    .sc-page-loader {
        padding: 1rem;
    }

    .sc-hero-meta-chip {
        width: 100%;
        min-width: 0;
    }

    .sc-collapse-toggle {
        width: 100%;
    }

    .sc-borrow-filters {
        grid-template-columns: 1fr;
    }

    .sc-chat-records-grid > [class*="col-"] {
        display: block;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .sc-borrow-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    body[data-page-name="school_family_dashboard"] {
        overflow-y: auto !important;
        height: auto !important;
    }
}

@media (min-width: 992px) {
    body[data-page-name="school_family_dashboard"] {
        overflow-y: auto !important;
        height: auto !important;
    }
}
