@media screen {
    body.portal[data-workspace="next"][data-theme="studio"] {
        --ivt-canvas: #edf3f5;
        --ivt-ink: #132d40;
        --ivt-line: #d7e4ea;
        --ivt-teal: #087568;
        --ivt-shadow: 0 1px 2px #132d4008, 0 8px 22px -15px #284e6790;
        background: radial-gradient(ellipse at 85% 0%, #deefec, transparent 44rem), var(--ivt-canvas) !important;
    }

    html body.portal[data-workspace="next"][data-theme="studio"]:not(#ivt-style-unused) .topbar {
        background: #f8fcfd !important;
        border-color: var(--ivt-line) !important;
        box-shadow: 0 6px 20px -16px #143b59aa !important;
    }

    html body.portal[data-workspace="next"][data-theme="studio"]:not(#ivt-style-unused) #sidebar {
        background: linear-gradient(170deg, #f9fcff, #eef7f7) !important;
        border-color: var(--ivt-line) !important;
    }

    html body.portal[data-workspace="next"][data-theme="studio"]:not(#ivt-style-unused) #sidebar nav a.selected {
        background: linear-gradient(105deg, #d6eee9, #eaf6f5) !important;
        box-shadow: inset 3px 0 var(--ivt-teal), 0 2px 5px #204b5020 !important;
    }

    html body.portal[data-workspace="next"][data-theme="studio"]:not(#ivt-style-unused) .page-heading {
        min-height: 74px;
        gap: 12px;
        padding: 14px 18px !important;
        background: linear-gradient(110deg, #fff, #f3faf9);
        border: 1px solid var(--ivt-line) !important;
        border-radius: 15px;
        box-shadow: var(--ivt-shadow);
    }

    .portal-heading-title {
        display: flex;
        align-items: center;
        gap: 13px;
        min-width: 0;
    }

    .portal-heading-icon {
        display: grid;
        flex: 0 0 42px;
        height: 42px;
        place-items: center;
        border-radius: 12px;
        background: linear-gradient(145deg, #e8faf5, #cfe9e6);
        color: #075e56;
        box-shadow: inset 0 1px #fff, 0 3px 8px #1a514922;
    }

    .portal-heading-icon .icon { width: 21px; height: 21px; }

    html body.portal[data-workspace="next"][data-theme="studio"]:not(#ivt-style-unused) .page-heading h1 {
        margin: 0 !important;
        color: var(--ivt-ink) !important;
        overflow-wrap: anywhere;
    }

    html body.portal[data-workspace="next"][data-theme="studio"]:not(#ivt-style-unused) #workspace-main :is(.card, .record-directory, .stat-card) {
        border-color: var(--ivt-line) !important;
        box-shadow: var(--ivt-shadow) !important;
    }

    html body.portal[data-workspace="next"][data-theme="studio"]:not(#ivt-style-unused) #workspace-main :is(.button, button:not([class])) {
        border-radius: 9px !important;
    }

    html body.portal[data-workspace="next"][data-theme="studio"]:not(#ivt-style-unused) #workspace-main :is(.button:not(.secondary,.danger), button:not([class])):enabled,
    html body.portal[data-workspace="next"][data-theme="studio"]:not(#ivt-style-unused) #workspace-main a.button:not(.secondary,.danger) {
        box-shadow: 0 2px 5px #075e562c, inset 0 1px #ffffff28;
    }

    body.portal :is(a,button,summary):focus-visible {
        outline: 2px solid #167d79;
        outline-offset: 3px;
    }

    body.portal .dashboard-hero {
        min-height: clamp(160px, 17vw, 245px);
        align-items: flex-start;
        justify-content: center;
        flex-direction: column;
        gap: 16px;
        padding: clamp(20px, 3.4vw, 46px);
        border-radius: 20px;
        background:
            radial-gradient(ellipse at 85% 35%, #197e74 0%, transparent 55%),
            linear-gradient(115deg, #102739, #123c49 58%, #0b5758);
        box-shadow: 0 16px 32px -21px #073a4cbb, inset 0 1px #ffffff30;
    }

    body.portal .dashboard-hero::after { content: none; }

    html body.portal #workspace-main .dashboard-hero h1 {
        font-size: clamp(1.75rem, 4vw, 3.2rem) !important;
        letter-spacing: -.04em !important;
    }

    .dashboard-hero > :not(.dashboard-art) { position: relative; z-index: 1; }
    .dashboard-hero > div:first-child { max-width: 62%; }

    .dashboard-art {
        position: absolute;
        inset: 0 3% 0 auto;
        width: min(38%, 395px);
        perspective: 640px;
        pointer-events: none;
    }

    .dashboard-orbit {
        position: absolute;
        inset: 50% auto auto 48%;
        width: 78%;
        aspect-ratio: 1;
        border: 1px solid #a6fae249;
        border-radius: 50%;
        box-shadow: 0 0 0 16px #b9ffed12, 0 0 0 36px #b9ffed0c;
        transform: translate(-50%, -50%) rotateX(42deg) rotateZ(-25deg);
    }

    .dashboard-art-tile {
        position: absolute;
        display: grid;
        width: var(--tile-size);
        aspect-ratio: 1;
        place-items: center;
        border: 1px solid #c2fff577;
        border-radius: 22%;
        background: linear-gradient(145deg, #b4f8e986, #2ca99c55 65%, #085651);
        color: #e7fffa;
        box-shadow: inset 0 1px 2px #e0fff58c, 5px 8px #0d4c54, 12px 20px 24px #082a3bb0;
        transform: var(--tile-angle);
    }

    .dashboard-art-tile .icon { width: 43%; height: 43%; }
    .dashboard-art-tile--book {
        --tile-size: clamp(68px, 10vw, 132px);
        --tile-angle: rotateX(24deg) rotateY(-28deg) rotateZ(-12deg);
        top: 23%;
        left: 33%;
    }
    .dashboard-art-tile--calendar {
        --tile-size: clamp(46px, 6vw, 79px);
        --tile-angle: rotateX(20deg) rotateY(-22deg) rotateZ(12deg);
        top: 53%;
        left: 5%;
        background: linear-gradient(145deg, #b1d9ff9c, #377caa8c);
    }
    .dashboard-art-tile--shield {
        --tile-size: clamp(39px, 5vw, 65px);
        --tile-angle: rotateX(12deg) rotateY(-20deg) rotateZ(14deg);
        top: 17%;
        right: 4%;
    }

    body.portal .dashboard-metric {
        background: linear-gradient(148deg, #fff 56%, var(--metric-tint, #e7f6f3));
        border-radius: 15px;
        padding: clamp(12px, 1.6vw, 22px);
        box-shadow: var(--ivt-shadow);
    }
    .dashboard-metric[data-tone="blue"] { --metric-tint: #e5f1ff; }
    .dashboard-metric[data-tone="purple"] { --metric-tint: #f0eafa; }
    .dashboard-metric[data-tone="amber"] { --metric-tint: #fff3df; }
    body.portal .dashboard-metric > strong { font-size: clamp(1.2rem, 2.5vw, 2.25rem); color: var(--ivt-ink); }
    body.portal .dashboard-shortcut {
        background: linear-gradient(125deg, #f5fafb, #edf7f5);
        min-height: 58px;
    }
    body.portal .dashboard-shortcut:hover { background: #e4f3ef; }

    .dashboard-shortcut-count {
        padding: 2px 6px;
        border-radius: 999px;
        background: #d6ece7;
        color: #075e56;
        font-size: .72rem;
        font-weight: 700;
    }

    .dashboard-shortcut:has(.dashboard-shortcut-count) > .icon:last-child { display: none; }

    body.portal .student-card-tile {
        background: linear-gradient(155deg, #fff 55%, #f3f9fa);
        box-shadow: var(--ivt-shadow);
    }
    body.portal .student-card-tile:focus-within { border-color: #4c938a; }

    body.portal :is(.attendance-workspace-nav, .inbox-filters) a[aria-current="page"] {
        background: linear-gradient(125deg, #126f6a, #0d565a);
        color: #fff;
        box-shadow: 0 4px 10px -6px #0a444cc0;
    }

    body.portal .inbox-item.is-unread {
        background: linear-gradient(105deg, #e8f6f3, #f5fbfc);
        border-inline-start: 3px solid #268f83;
    }

    html body.auth.auth-modern[data-theme="studio"]:not(#ivt-editor-unused) .auth-card {
        box-shadow: 0 22px 55px -20px #0a304c80, inset 0 1px #ffffff70 !important;
    }

    body.portal .mobile-bottom-nav {
        box-shadow: 0 -8px 24px -17px #153849a0;
    }

    body.card-review {
        background: radial-gradient(ellipse at top right, #dcefeb, transparent 44rem), #edf3f5;
    }
    .card-review .card-review-header {
        background: #f8fcfd;
        box-shadow: 0 8px 24px -18px #23435c85;
    }
    .card-review .card-review-face {
        box-shadow: 0 10px 24px -17px #19384c85;
    }

    @media (max-width: 600px) {
        html body.portal[data-workspace="next"][data-theme="studio"]:not(#ivt-style-unused) .page-heading {
            align-items: center !important;
            padding: 11px 12px !important;
        }
        html body.portal[data-workspace="next"][data-theme="studio"]:not(#ivt-style-unused) .page-heading .heading-actions { margin: 0; }
        .portal-heading-title { gap: 9px; }
        .portal-heading-icon { flex-basis: 34px; height: 34px; border-radius: 9px; }
        .portal-heading-icon .icon { width: 17px; height: 17px; }
        body.portal .dashboard-hero { min-height: 150px; }
        body.portal .dashboard-shortcut:has(.dashboard-shortcut-count) {
            grid-template-columns: auto minmax(0, 1fr) auto;
        }
        .dashboard-art { right: 0; }
        .dashboard-art-tile--shield { right: 8%; top: 10%; }
        .dashboard-art-tile--book { left: 27%; top: 31%; }
        .dashboard-art-tile--calendar { top: 62%; left: 0; }
    }
}

@media screen and (prefers-reduced-motion: no-preference) {
    body.portal :is(.page-heading, .dashboard-hero),
    body.auth .auth-card,
    body.card-review .card-review-heading {
        animation: ivt-arrive 300ms cubic-bezier(.2,.7,.3,1);
    }

    body.portal .dashboard-art-tile {
        animation: ivt-tile-arrive 580ms cubic-bezier(.2,.7,.3,1) both;
    }
    .dashboard-art-tile--calendar { animation-delay: 75ms !important; }
    .dashboard-art-tile--shield { animation-delay: 135ms !important; }

    body.portal :is(.button, .small-button, .dashboard-shortcut, .icon-button, .student-card-tile, #sidebar nav a, .mobile-bottom-nav a),
    body.card-review .card-review-actions :is(a,button) {
        transition: translate 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
    }

    body.portal :is(.button,.small-button,.dashboard-shortcut):active,
    body.card-review .card-review-actions :is(a,button):active { translate: 0 1px; }

    @media (hover: hover) and (pointer: fine) {
        body.portal :is(.button:not(:disabled), .dashboard-shortcut):hover,
        body.portal .student-card-tile:hover,
        body.card-review .card-review-actions :is(a,button):hover {
            translate: 0 -2px;
        }
    }
}

@keyframes ivt-arrive {
    from { opacity: 0; translate: 0 7px; }
    to { opacity: 1; translate: 0 0; }
}

@keyframes ivt-tile-arrive {
    from { opacity: 0; translate: 0 15px; }
    to { opacity: 1; translate: 0 0; }
}

/* Shared institute branding, with a quieter background behind record-heavy screens. */
@media screen {
    html body.portal[data-theme="studio"][data-workspace="next"]:not(#ivt-style-unused) .page-heading {
        background: linear-gradient(110deg, #fff 58%, #e3f3f2);
        border-inline-start: 3px solid #178779 !important;
    }

    body.portal .dashboard-metrics {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    }

    body.portal .dashboard-shortcuts {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr));
    }

    body.portal .dashboard-shortcut {
        border-color: #d7e6ea;
        background: #fff;
    }

    body.portal .dashboard-shortcut-icon {
        background: linear-gradient(145deg, #e8f7f4, #cceae4);
        box-shadow: inset 0 1px #fff, 0 2px 4px #154a471a;
    }

    body.portal .cards-directory-filters,
    body.portal .cards-selection-bar {
        background: linear-gradient(110deg, #f9fcfd, #e9f5f3);
    }

    @media (max-width: 600px) {
        body.portal :is(.dashboard-metrics, .dashboard-shortcuts) {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }
    }

    html body.auth.auth-modern[data-theme="studio"][data-page="login"]:not(#ivt-editor-unused) .auth-layout {
        display: block !important;
        width: min(100%, 450px) !important;
        max-width: 450px !important;
        min-height: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        overflow: visible;
    }

    html body.auth.auth-modern[data-theme="studio"][data-page="login"]:not(#ivt-editor-unused) .auth-card {
        --editor-card: var(--ivt-login-surface, #fff);
        --editor-text: var(--ivt-login-ink, #142d40);
        --editor-input: var(--ivt-login-field, #f4f8fa);
        --editor-accent: #087568;
        --editor-link: var(--ivt-login-link, #08685f);
        --editor-button-text: #fff;
        width: 100% !important;
        max-width: none !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: clamp(20px, 4vw, 32px) !important;
        background: var(--ivt-login-surface, #fff) !important;
        color: var(--ivt-login-ink, #142d40) !important;
        border: 1px solid var(--ivt-login-border, #dce8eb) !important;
        border-radius: 20px !important;
        box-shadow: 0 24px 60px #091c4350 !important;
    }

    html body.auth.auth-modern[data-theme="studio"][data-page="login"]:not(#ivt-editor-unused) .mobile-brand {
        display: flex !important;
        justify-content: flex-start !important;
        margin: 0 0 18px !important;
        color: var(--ivt-login-ink, #142d40) !important;
    }

    body.auth[data-page="login"] .auth-card :is(.auth-kicker, .auth-icon) { display: none !important; }

    html body.auth.auth-modern[data-theme="studio"][data-page="login"]:not(#ivt-editor-unused) .auth-card :is(h2, .auth-sub) {
        margin-inline: 0 !important;
        text-align: start !important;
        color: var(--ivt-login-ink, #142d40) !important;
    }

    html body.auth.auth-modern[data-theme="studio"][data-page="login"]:not(#ivt-editor-unused) .auth-card .auth-sub {
        color: var(--ivt-login-muted, #455e6b) !important;
    }

    body.auth[data-page="login"].login-bg-video {
        --ivt-login-surface: rgb(7 23 33 / .59);
        --ivt-login-ink: #f5fbff;
        --ivt-login-muted: #d1e4ee;
        --ivt-login-field: rgb(8 24 35 / .72);
        --ivt-login-link: #a2f5e5;
        --ivt-login-border: rgb(204 241 255 / .34);
    }

    html body.auth.auth-modern.login-custom.login-bg-video[data-theme="studio"][data-page="login"]:not(#ivt-editor-unused) .auth-card {
        backdrop-filter: blur(2px) !important;
        -webkit-backdrop-filter: blur(2px) !important;
    }

    html body.auth.auth-modern.login-custom.login-bg-video[data-theme="studio"][data-page="login"]:not(#ivt-editor-unused) .auth-card :is(.verify-action, .android-download a) {
        background: var(--ivt-login-field) !important;
        border-color: var(--ivt-login-border) !important;
    }

    html body.portal[data-theme="studio"][data-workspace="next"]:not(#ivt-style-unused) #sidebar {
        background: #fff !important;
        border-right-color: #dbe7eb !important;
        box-shadow: 12px 0 35px -24px #1b435b60 !important;
    }

    html body.portal[data-theme="studio"][data-workspace="next"]:not(#ivt-style-unused) #sidebar > .brand {
        margin-bottom: 10px !important;
        padding-bottom: 14px !important;
    }

    html body.portal[data-theme="studio"][data-workspace="next"]:not(#ivt-style-unused) #sidebar .workspace-label {
        background: #f2f7f8 !important;
        border-color: #e2ebee !important;
    }

    html body.portal[data-theme="studio"][data-workspace="next"]:not(#ivt-style-unused) #sidebar nav a {
        color: #334d5e !important;
    }

    html body.portal[data-theme="studio"][data-workspace="next"]:not(#ivt-style-unused) #sidebar nav a.selected {
        background: #e2f3ee !important;
        color: #085b50 !important;
        box-shadow: inset 3px 0 #087568 !important;
    }

    html body.portal[data-theme="studio"][data-workspace="next"]:not(#ivt-style-unused) #sidebar .nav-section-heading {
        color: #5a7180 !important;
    }

    @media (max-width: 1000px) {
        html body.portal[data-theme="studio"][data-workspace="next"]:not(#ivt-style-unused) #sidebar {
            width: min(90vw, 365px) !important;
        }

        html body.portal[data-theme="studio"][data-workspace="next"]:not(#ivt-style-unused) #sidebar .sheet-close {
            min-height: 44px !important;
        }

        html body.portal[data-theme="studio"][data-workspace="next"]:not(#ivt-style-unused) .mobile-bottom-nav .is-active {
            background: #e2f3ee !important;
            color: #085b50 !important;
        }
    }
}
