/* ============================================================================
   Home.css — DIRA Home Shell, Subscription, Admin Dashboard, Modals
   Fully deduplicated replacement
============================================================================ */

/* ============================================================================
   DESIGN TOKENS
============================================================================ */
:root {
    --nav-w: 280px;
    --nav-w-collapsed: 60px;
    --panel-gap: 14px;
    --radius: 14px;
    --bg: #f7f8fb;
    --card: #ffffff;
    --border-color: #e8ebf2;
    --border: 1px solid var(--border-color);
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
    --text: #0f172a;
    --muted: #64748b;
    --brand: #2346e8;
    --wave-base: #2346e8;
    --wave-a: rgba(35, 70, 232, 0.16);
    --wave-b: rgba(35, 70, 232, 0.07);
    --wave-border: #cbd5ff;
    --wave-inset: #d0d9ff;
    --wave-shadow: rgba(35, 70, 232, 0.14);
    --wave-label: #1f2c70;
    --ink-1: #eef2ff;
    --ink-2: #e9efff;
    --ink-3: #ffd166;
    --ink-4: #eef2ff;
    --admin-primary: #315bea;
    --admin-primary-dark: #2448c8;
    --admin-soft: #eef4ff;
    --admin-border: #d7dde8;
    --admin-muted: #64748b;
}

/* ============================================================================
   GLOBAL RESET
============================================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    overflow: hidden;
}

.hidden,
.nav-hide-theme {
    display: none !important;
}

/* ============================================================================
   KEYFRAMES
============================================================================ */
@keyframes liquid-wave {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

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

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modal-pop {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ============================================================================
   APP LAYOUT SHELL
============================================================================ */
.container.curtain-layout {
    display: flex;
    gap: var(--panel-gap);
    height: 100vh;
    padding: 16px;
    background: var(--bg);
    overflow: hidden;
}

.curtain {
    position: relative;
    width: var(--nav-w);
    flex: 0 0 var(--nav-w);
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: width 0.28s ease, flex-basis 0.28s ease;
}

.container.curtain-layout:has(.curtain:not([open])) .curtain,
.container.nav-collapsed .curtain {
    width: var(--nav-w-collapsed);
    flex: 0 0 var(--nav-w-collapsed);
}

.container.curtain-layout:has(.curtain:not([open])) .curtain-handle,
.container.nav-collapsed .curtain-handle {
    transform: rotate(180deg);
}

.container.curtain-layout:has(.curtain:not([open])) .nav-button .label,
.container.curtain-layout:has(.curtain:not([open])) .exit-button .label,
.container.nav-collapsed .nav-button .label,
.container.nav-collapsed .exit-button .label {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
}

.curtain-handle {
    position: absolute;
    top: 12px;
    right: 10px;
    z-index: 2;
    width: 28px;
    height: 28px;
    border: 1px solid #dbe2ff;
    border-radius: 999px;
    background: #f1f5ff;
    color: #2643d9;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

    .curtain-handle:hover {
        background: #e7edff;
        border-color: #cbd5ff;
    }

    .curtain-handle .bars {
        position: relative;
        width: 14px;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
    }

        .curtain-handle .bars::before,
        .curtain-handle .bars::after {
            content: "";
            position: absolute;
            left: 0;
            right: 0;
            height: 2px;
            border-radius: 2px;
            background: currentColor;
        }

        .curtain-handle .bars::before {
            top: -5px;
        }

        .curtain-handle .bars::after {
            top: 5px;
        }

.left-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 14px 14px;
    background: var(--card);
    overflow-y: auto;
    overflow-x: hidden;
}

.left-stack {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.left-footer {
    margin-top: auto;
    display: grid;
    gap: 10px;
    padding-top: 8px;
}

.right-panel {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 18px;
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: auto;
}

#main-content {
    position: relative;
    min-height: 0;
}

/* ============================================================================
   SIDEBAR NAVIGATION
============================================================================ */
.nav-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0 4px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

    .nav-group-label::before,
    .nav-group-label::after {
        content: "";
        flex: 1;
        height: 1px;
        background: #e5e7eb;
        opacity: 0.85;
    }

.nav-button,
.exit-button {
    position: relative;
    isolation: isolate;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #f9fafb;
    color: var(--text);
    cursor: pointer;
    overflow: hidden;
    transition: background 0.15s ease, transform 0.05s ease;
}

    .nav-button:hover {
        background: #eef2ff;
    }

    .nav-button:active,
    .exit-button:active {
        transform: translateY(1px);
    }

    .nav-button .icon {
        font-size: 18px;
    }

    .nav-button .label {
        font-weight: 600;
    }

    .nav-button::before {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient( 220px 220px at var(--wave-x, 50%) var(--wave-y, 50%), var(--wave-a), var(--wave-b) 42%, transparent 64% );
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .nav-button:hover::before,
    .nav-button.is-active::before {
        opacity: 1;
    }

    .nav-button.is-active {
        background: linear-gradient(120deg, var(--ink-1), var(--ink-2), var(--ink-3), var(--ink-4));
        background-size: 200% 200%;
        animation: liquid-wave 3.8s ease-in-out infinite;
        border-color: var(--wave-border);
        box-shadow: inset 0 0 0 1px var(--wave-inset), 0 6px 14px var(--wave-shadow);
    }

        .nav-button.is-active .icon {
            color: var(--wave-base);
        }

        .nav-button.is-active .label {
            color: var(--wave-label);
            font-weight: 700;
        }

.exit-button {
    background: #fdeced;
    border-color: #f5c8c8;
    color: #7a1b1b;
}

    .exit-button:hover {
        filter: brightness(0.98);
    }

.nav-collapsible {
    display: flex;
    flex-direction: column;
}

.nav-collapse-toggle {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--ink-1);
    cursor: pointer;
}

    .nav-collapse-toggle:hover {
        background: var(--ink-2);
    }

.nav-collapse-content {
    max-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-left: 12px;
    transition: max-height 0.25s ease;
}

    .nav-collapse-content.open {
        max-height: 1200px;
    }

.nav-collapse-toggle .chevron {
    transition: transform 0.25s ease;
}

.nav-collapse-toggle.is-open .chevron {
    transform: rotate(180deg);
}

.nav-button.workspace-disabled,
.nav-button.dataset-library-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.35);
}

    .nav-button.workspace-disabled:hover,
    .nav-button.dataset-library-disabled:hover {
        transform: none;
    }

/* ============================================================================
   HOME WELCOME — COMPACT NO-SCROLL
============================================================================ */
.home-container-centered {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: clamp(8px, 1.6vh, 14px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: fade-in 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.home-welcome-professional {
    position: relative;
    isolation: isolate;
    width: min(100%, 820px);
    max-height: calc(100vh - 76px);
    padding: clamp(16px, 2.35vh, 28px) clamp(18px, 3vw, 42px);
    border-radius: clamp(22px, 3vh, 28px);
    background: linear-gradient(145deg, #ffffff 0%, #f7f9ff 100%);
    border: 1px solid rgba(99, 102, 241, 0.22);
    box-shadow: 0 26px 62px rgba(15, 23, 42, 0.11), 0 10px 24px rgba(15, 23, 42, 0.07);
    text-align: center;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

    .home-welcome-professional::before {
        content: "";
        position: absolute;
        inset: -45%;
        z-index: -1;
        background: radial-gradient(circle, rgba(99, 102, 241, 0.14) 0%, transparent 65%);
        pointer-events: none;
    }

.brand-section {
    position: relative;
    z-index: 1;
    margin: 0 0 clamp(6px, 1.1vh, 10px);
}

.home-logo-large {
    width: auto;
    height: clamp(48px, 7.2vh, 72px);
    margin: 0;
    object-fit: contain;
    filter: drop-shadow(0 5px 14px rgba(15, 23, 42, 0.18));
}

.home-logo,
.home-welcome-logo {
    background: transparent;
    padding: 0;
    box-shadow: none;
    object-fit: contain;
}

.user-info-section {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.welcome-text {
    color: #64748b;
    font-size: clamp(10px, 1.45vh, 13px);
    line-height: 1.1;
    font-weight: 900;
    letter-spacing: 0.34em;
    text-transform: uppercase;
}

.user-display-name {
    max-width: 100%;
    margin: clamp(7px, 1.35vh, 13px) 0 clamp(10px, 1.75vh, 16px);
    color: #0f172a;
    font-size: clamp(30px, 6.6vh, 52px);
    line-height: 0.98;
    font-weight: 950;
    letter-spacing: -1.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-badge {
    max-width: min(92%, 520px);
    min-height: clamp(34px, 5vh, 42px);
    padding: clamp(8px, 1.35vh, 11px) clamp(18px, 3.6vw, 32px);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-size: clamp(10.5px, 1.55vh, 13px);
    line-height: 1.1;
    font-weight: 950;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.10);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .role-badge.admin_user {
        background: linear-gradient(135deg, #4f46e5, #6366f1);
        color: #ffffff;
    }

        .role-badge.admin_user::before {
            content: "🛡️";
        }

    .role-badge.user,
    .role-badge.education,
    .role-badge.dataset_library,
    .role-badge.business_analytics {
        background: #eef2ff;
        color: #4338ca;
        border: 1px solid rgba(99, 102, 241, 0.35);
    }

#home-library-selection-host,
#home-workspace-media-host {
    width: 100%;
    display: flex;
    justify-content: center;
}

#home-library-selection-host {
    margin-top: clamp(7px, 1.25vh, 11px);
}

#home-workspace-media-host {
    margin-top: clamp(8px, 1.45vh, 14px);
}

.home-library-selection {
    max-width: min(92%, 460px);
    min-height: clamp(30px, 4.4vh, 36px);
    padding: clamp(6px, 1.05vh, 8px) clamp(12px, 2.5vw, 16px);
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: clamp(10.5px, 1.45vh, 12.5px);
    line-height: 1.1;
    font-weight: 850;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .home-library-selection strong {
        color: #000000;
        font-weight: 950;
    }

    .home-library-selection.empty {
        color: #64748b;
    }

.home-library-dot {
    flex: 0 0 auto;
}

.home-workspace-media {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-workspace-image-wrap {
    position: relative;
    width: clamp(108px, 16vh, 154px);
    height: clamp(74px, 11vh, 104px);
    padding: clamp(8px, 1.4vh, 12px);
    border-radius: clamp(18px, 3vh, 24px);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.home-workspace-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.home-workspace-icon {
    position: absolute;
    right: 7px;
    bottom: 7px;
    width: clamp(24px, 4vh, 30px);
    height: clamp(24px, 4vh, 30px);
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    display: grid;
    place-items: center;
    font-size: clamp(13px, 2vh, 16px);
    line-height: 1;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.13);
}

.home-workspace-image-wrap.image-failed {
    width: clamp(70px, 11vh, 82px);
    height: clamp(70px, 11vh, 82px);
    border-radius: 22px;
}

    .home-workspace-image-wrap.image-failed .home-workspace-icon {
        position: static;
        width: clamp(44px, 7vh, 52px);
        height: clamp(44px, 7vh, 52px);
        font-size: clamp(22px, 4vh, 28px);
    }

.platform-meta {
    position: relative;
    z-index: 1;
    width: 100%;
    margin-top: clamp(10px, 1.9vh, 18px);
    padding-top: clamp(9px, 1.6vh, 14px);
    border-top: 1px solid rgba(99, 102, 241, 0.28);
    color: #1e293b;
    text-align: center;
    font-size: clamp(12.5px, 1.8vh, 16px);
    line-height: 1.2;
    font-weight: 850;
    letter-spacing: 0.01em;
}

    .platform-meta .muted {
        margin: 5px 0 0;
        color: #475569;
        font-size: clamp(10.5px, 1.45vh, 13px);
        line-height: 1.25;
        font-weight: 650;
        letter-spacing: 0.01em;
    }

        .platform-meta .muted:hover {
            color: #0f172a;
        }

.platform-actions {
    margin-top: clamp(7px, 1.3vh, 10px);
}

/* ============================================================================
   SUBSCRIPTION VIEW
============================================================================ */
#home-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#home-plan-section {
    width: 100%;
    display: flex;
    justify-content: center;
}

.plan-section {
    width: 100%;
    max-width: 1600px;
    padding: 20px 24px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.subscription-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.subscription-title-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
}

.plan-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.policy-link-btn {
    margin-left: auto;
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: transparent;
    color: #4f46e5;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

    .policy-link-btn:hover {
        background: #eef2ff;
        border-color: #c7d2fe;
    }

.status-bars-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 14px 18px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: linear-gradient(180deg, #f9fafc, #ffffff);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
}

.status-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-title {
    color: #111827;
    font-size: 15px;
    font-weight: 700;
}

.status-sub,
.status-label {
    color: #6b7280;
    font-size: 13px;
}

.status-right {
    min-width: 160px;
}

.status-progress {
    width: 100%;
    height: 9px;
    display: flex;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.bar-used,
.bar-remaining {
    height: 100%;
}

#days-used-bar {
    background: #4f46e5;
}

#days-remaining-bar {
    background: #c7d2fe;
}

.storage-used {
    background: #0284c7;
}

.storage-remaining {
    background: #bae6fd;
}

.compute-used {
    background: #7c3aed;
}

.compute-remaining {
    background: #ddd6fe;
}

.api-used {
    background: #dc2626;
}

.api-remaining {
    background: #fecaca;
}

.plan-cards {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.plan-card {
    width: 280px;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    padding: 16px;
    border: 2px solid transparent;
    border-radius: 14px;
    background: #f9fafc;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

    .plan-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
    }

    .plan-card.active {
        border-color: #4f46e5;
        background: #eef2ff;
    }

    .plan-card h3 {
        margin: 0 0 4px;
        font-size: 1.1rem;
    }

.plan-price {
    margin: 2px 0 4px;
    color: #555555;
    font-size: 0.95rem;
}

.plan-desc {
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 0.88rem;
}

.plan-features {
    margin: 0 0 10px;
    padding: 0;
    list-style: none;
}

    .plan-features li {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 3px;
        font-size: 0.87rem;
    }

.plan-btn {
    width: 100%;
    margin-top: auto;
    padding: 8px 10px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

    .plan-btn.primary {
        background: #4f46e5;
        color: #ffffff;
    }

    .plan-btn.secondary {
        background: #e5e7eb;
        color: #374151;
    }

    .plan-btn.outline {
        background: #ffffff;
        color: #4f46e5;
        border: 1px solid #c7d2fe;
    }

    .plan-btn.warning {
        background: #fef3c7;
        color: #92400e;
    }

    .plan-btn:disabled {
        opacity: 0.6;
        cursor: default;
    }

.plan-notice {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    font-weight: 700;
    margin-bottom: 12px;
}

    .plan-notice.error {
        background: #fef2f2;
        color: #991b1b;
        border: 1px solid #fecaca;
    }

    .plan-notice.warning {
        background: #fffbeb;
        color: #92400e;
        border: 1px solid #fde68a;
    }

/* ============================================================================
   THEME BUTTON
============================================================================ */
.theme-open-btn {
    position: relative;
    z-index: 2;
    isolation: isolate;
    min-height: clamp(30px, 4.5vh, 36px);
    padding: clamp(6px, 1vh, 8px) clamp(12px, 2.2vw, 16px);
    border: 1px solid #c7cdd8;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%);
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: clamp(10.5px, 1.45vh, 12px);
    font-weight: 700;
    letter-spacing: 0.35px;
    cursor: pointer;
    user-select: none;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

    .theme-open-btn:hover {
        background: linear-gradient(180deg, #f9fafb 0%, #e5e7eb 100%);
        box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
        transform: translateY(-1px);
    }

    .theme-open-btn:active {
        transform: translateY(0);
    }

    .theme-open-btn:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35), 0 4px 12px rgba(0, 0, 0, 0.12);
    }

/* ============================================================================
   MODULE IFRAME
============================================================================ */
.module-frame {
    display: block;
    width: 100%;
    height: calc(100vh - 120px);
    min-height: 560px;
    border: 0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

#main-content .home-hero:has(+ .module-frame) {
    display: none;
}

/* ============================================================================
   SHARED MODAL SAFETY
============================================================================ */
.s3m-modal[hidden],
.s3m-modal[aria-hidden="true"] {
    display: none !important;
}

/* ============================================================================
   PAYMENT MODAL
============================================================================ */
#payment-modal,
#plan-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    pointer-events: auto;
}

#payment-modal {
    z-index: 2000;
}

    #payment-modal.hidden,
    #plan-confirm-modal.hidden {
        display: none !important;
    }

    #payment-modal .modal-card,
    #plan-confirm-modal .modal-card {
        position: relative;
        width: 100%;
        max-width: 440px;
        padding: 28px 26px;
        border-radius: 18px;
        background: #ffffff;
        box-shadow: 0 40px 80px rgba(0, 0, 0, 0.35), 0 10px 24px rgba(0, 0, 0, 0.18);
        pointer-events: auto;
        animation: modal-pop 0.25s ease-out;
    }

    #payment-modal h2 {
        margin: 0 0 12px;
        color: #0f172a;
        font-size: 22px;
        font-weight: 800;
        text-align: center;
    }

    #payment-modal .summary {
        display: grid;
        gap: 8px;
        margin-bottom: 16px;
        font-size: 14px;
    }

    #payment-modal .security-note {
        margin: 12px 0 16px;
        color: #64748b;
        font-size: 13px;
        text-align: center;
    }

    #payment-modal .provider-logos {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 14px;
        margin-bottom: 18px;
    }

        #payment-modal .provider-logos img {
            height: 28px;
            width: auto;
            opacity: 0.9;
        }

    #payment-modal .primary-btn,
    #payment-modal .secondary-btn {
        width: 100%;
        margin-bottom: 10px;
    }

#plan-confirm-modal button {
    pointer-events: auto;
}

/* ============================================================================
   APP ACTION MODAL
============================================================================ */
#app-action-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(5px);
}

    #app-action-modal.hidden {
        display: none !important;
    }

    #app-action-modal .app-action-card {
        width: min(560px, 96vw);
        padding: 0;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        background: #ffffff;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.20);
        overflow: hidden;
        animation: modal-pop 0.18s ease-out;
    }

    #app-action-modal #app-action-title {
        margin: 0;
        padding: 18px 20px;
        border-bottom: 1px solid #e5e7eb;
        background: #ffffff;
        color: #1e293b;
        font-size: 18px;
        line-height: 1.35;
        font-weight: 700;
        text-align: left;
    }

    #app-action-modal .app-action-text {
        margin: 0;
        padding: 22px 22px 18px;
        background: #ffffff;
        color: #374151;
        font-size: 14px;
        line-height: 1.65;
    }

    #app-action-modal .modal-actions {
        display: flex;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 12px;
        padding: 16px 18px 18px;
        border-top: 1px solid #e5e7eb;
        background: #f9fafb;
    }

    #app-action-modal .btn {
        min-width: 108px;
        padding: 10px 18px;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.15s ease;
    }

        #app-action-modal .btn:hover:not(:disabled) {
            transform: translateY(-1px);
        }

        #app-action-modal .btn:disabled {
            opacity: 0.65;
            cursor: not-allowed;
        }

#app-action-cancel {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    color: #334155;
    border: 1px solid #cbd5e1;
}

#app-action-secondary {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.22);
}

#app-action-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}

/* ============================================================================
   LANDING AUTH MODAL
============================================================================ */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 18% 12%, rgba(79, 110, 247, 0.22), transparent 32%), radial-gradient(circle at 82% 86%, rgba(14, 165, 233, 0.16), transparent 34%), linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.94));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

    .auth-overlay.hidden {
        display: none !important;
    }

.dira-auth-shell {
    width: min(1180px, 96vw);
    max-height: min(94vh, 980px);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 36px 90px rgba(0, 0, 0, 0.34), 0 14px 32px rgba(15, 23, 42, 0.18);
    overflow: auto;
}

.dira-auth-brand {
    padding: 18px 28px 14px;
    border-bottom: 1px solid #e5eaf3;
    background: radial-gradient(circle at 50% 0%, rgba(79, 110, 247, 0.10), transparent 42%), linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.brand-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo-img {
    height: 76px;
    width: auto;
    max-width: 320px;
    display: block;
    object-fit: contain;
    user-select: none;
}

.dira-login-landing {
    padding: 26px 34px 22px;
    border-bottom: 1px solid #e8edf5;
    background: radial-gradient(circle at 10% 12%, rgba(79, 110, 247, 0.08), transparent 28%), radial-gradient(circle at 92% 20%, rgba(14, 165, 233, 0.08), transparent 28%), linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.dira-login-hero {
    max-width: 920px;
    margin: 0 auto 24px;
    text-align: center;
}

.dira-login-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    margin-bottom: 14px;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    background: #eef2ff;
    color: #3042b8;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dira-login-hero h1 {
    max-width: 900px;
    margin: 0 auto;
    color: #0f172a;
    font-size: clamp(28px, 3vw, 44px);
    line-height: 1.08;
    font-weight: 950;
    letter-spacing: -1.35px;
}

.dira-login-hero p {
    max-width: 780px;
    margin: 14px auto 0;
    color: #475569;
    font-size: 15px;
    line-height: 1.68;
    font-weight: 650;
}

.dira-sector-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.dira-sector-card {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    isolation: isolate;
    min-height: 230px;
    width: 100%;
    padding: 24px;
    border: 1px solid #dbe2ee;
    border-radius: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.96);
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

    .dira-sector-card::before {
        content: "";
        position: absolute;
        inset: -40%;
        z-index: -1;
        opacity: 0;
        background: radial-gradient(circle at 20% 20%, rgba(79, 110, 247, 0.18), transparent 32%), radial-gradient(circle at 82% 78%, rgba(14, 165, 233, 0.14), transparent 34%);
        pointer-events: none;
        transition: opacity 0.22s ease;
    }

    .dira-sector-card:hover {
        transform: translateY(-4px);
        border-color: #b9c6ff;
        box-shadow: 0 20px 44px rgba(15, 23, 42, 0.13), 0 10px 20px rgba(79, 110, 247, 0.10);
    }

        .dira-sector-card:hover::before,
        .dira-sector-card.selected::before {
            opacity: 1;
        }

    .dira-sector-card.selected {
        transform: translateY(2px);
        border-color: #4f6ef7;
        background: linear-gradient(180deg, #eef4ff 0%, #ffffff 100%);
        box-shadow: inset 0 4px 12px rgba(15, 23, 42, 0.14), 0 12px 26px rgba(79, 110, 247, 0.18);
    }

.dira-sector-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 18px;
    border: 1px solid #dbe4ff;
    border-radius: 20px;
    background: #eef2ff;
    display: grid;
    place-items: center;
    font-size: 34px;
    pointer-events: none;
}

.dira-sector-title {
    display: block;
    margin-bottom: 10px;
    color: #0f172a;
    font-size: 21px;
    line-height: 1.15;
    font-weight: 950;
    letter-spacing: -0.55px;
    pointer-events: none;
}

.dira-sector-text {
    display: block;
    color: #475569;
    font-size: 13px;
    line-height: 1.62;
    font-weight: 650;
    pointer-events: none;
}

.auth-role-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px 8px;
    background: #ffffff;
}

.auth-role-tab {
    appearance: none;
    -webkit-appearance: none;
    min-width: 76px;
    min-height: 38px;
    padding: 0 18px;
    border: 1px solid #dbe2ee;
    border-radius: 999px;
    background: #ffffff;
    color: #0f172a;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

    .auth-role-tab:hover {
        background: #f8fafc;
    }

    .auth-role-tab.active,
    .auth-role-tab[aria-selected="true"] {
        color: #ffffff;
        border-color: #4f6ef7;
        background: linear-gradient(135deg, #4f6ef7, #2346e8);
        box-shadow: 0 10px 22px rgba(35, 70, 232, 0.22);
    }

.auth-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    padding: 20px 34px 34px;
    background: #ffffff;
}

.auth-panel {
    position: relative;
    z-index: 5;
    min-width: 0;
    min-height: 100%;
    padding: 24px;
    border: 1px solid #e5eaf3;
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

    .auth-panel .panel-header {
        padding: 0;
        margin-bottom: 16px;
        border: 0;
        background: transparent;
    }

        .auth-panel .panel-header h2 {
            margin: 0;
            color: #0f172a;
            font-size: 20px;
            line-height: 1.2;
            font-weight: 950;
            letter-spacing: -0.45px;
        }

.panel-subtitle {
    margin: 8px 0 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.55;
    font-weight: 650;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.auth-form input,
.auth-form select {
    width: 100%;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid #dbe2ee;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

    .auth-form input:focus,
    .auth-form select:focus {
        border-color: #4f6ef7;
        box-shadow: 0 0 0 4px rgba(79, 110, 247, 0.14);
    }

.password-policy-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 2px;
    color: #008236;
    font-size: 12px;
    font-weight: 750;
}

.kbd-select {
    width: auto !important;
    min-height: 32px !important;
    padding: 0 10px !important;
    border-radius: 8px !important;
    font-size: 11px !important;
}

.password-hint-wrap {
    min-height: 34px;
}

.password-rules {
    color: #ef0000;
    font-size: 11px;
    line-height: 1.5;
    font-weight: 700;
}

.password-strength {
    font-size: 11px;
    font-weight: 800;
}

.primary-btn {
    min-height: 42px;
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f6ef7, #2346e8);
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(35, 70, 232, 0.20);
}

    .primary-btn:hover {
        filter: brightness(1.02);
    }

    .primary-btn:disabled {
        cursor: not-allowed;
        color: #94a3b8;
        background: #dce5ff;
        box-shadow: none;
    }

.form-msg {
    min-height: 18px;
    font-size: 12px;
    font-weight: 700;
}

.auth-links {
    margin: 10px 0 14px;
    text-align: center;
}

    .auth-links a {
        color: #4f6ef7;
        font-size: 12px;
        font-weight: 750;
    }

.panel-divider {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin: 14px 0;
    color: #4f6ef7;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

    .panel-divider.inline-oauth {
        flex-direction: column;
        gap: 10px;
        margin-top: 18px;
    }

.provider-btn {
    min-height: 42px;
    width: 100%;
    padding: 0 14px;
    border: 1px solid #dbe2ee;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

    .provider-btn:hover {
        background: #f8fafc;
        border-color: #cbd5e1;
    }

    .provider-btn.google {
        position: relative;
        z-index: 10;
        pointer-events: auto;
    }

        .provider-btn.google .icon.google {
            position: relative;
            width: 18px;
            height: 18px;
            flex: 0 0 18px;
            border-radius: 50%;
            background: conic-gradient( from -45deg, #4285f4 0deg 90deg, #34a853 90deg 180deg, #fbbc05 180deg 270deg, #ea4335 270deg 360deg );
        }

            .provider-btn.google .icon.google::after {
                content: "";
                position: absolute;
                inset: 4px;
                border-radius: 50%;
                background: #ffffff;
            }

#login-modal .inline-oauth,
#login-modal .inline-oauth.hidden {
    display: none !important;
}

#login-modal .auth-shell {
    overflow: hidden !important;
}

#login-modal .auth-panels {
    align-items: stretch;
}

#login-modal .signin-provider-stack {
    display: grid;
    gap: 8px;
}

#login-modal .provider-btn {
    min-height: 38px;
    height: 38px;
}

#login-modal .panel-divider {
    margin: 8px 0;
}

#login-modal .auth-links {
    margin: 8px 0;
}

/* ============================================================================
   ADMIN DASHBOARD / DATASET CATALOG
============================================================================ */
.admin-dashboard-page,
.admin-dashboard-page * {
    box-sizing: border-box;
}

.admin-dashboard-page {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 14px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 10px;
    overflow: hidden;
    background: radial-gradient(circle at top left, rgba(47, 91, 234, 0.08), transparent 34%), linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.admin-dashboard-hero {
    margin: 0;
    padding: 16px 18px;
    border: 1px solid var(--admin-border);
    border-radius: 20px;
    background: radial-gradient(circle at top right, rgba(47, 91, 234, 0.10), transparent 34%), linear-gradient(135deg, #ffffff, #f5f8ff);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.admin-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    margin-bottom: 6px;
    border: 1px solid rgba(47, 91, 234, 0.22);
    border-radius: 999px;
    background: #e8efff;
    color: var(--admin-primary-dark);
    font-size: 10px;
    font-weight: 950;
    text-transform: uppercase;
}

.admin-dashboard-hero h1 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(22px, 2vw, 30px);
    line-height: 1.05;
    font-weight: 950;
}

.admin-dashboard-hero p {
    margin: 5px 0 0;
    color: var(--admin-muted);
    font-size: 12px;
    line-height: 1.35;
    font-weight: 700;
}

.admin-dashboard-tabs {
    display: flex;
    gap: 8px;
    min-height: 38px;
    margin: 0;
}

.admin-dashboard-tab {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--admin-border);
    border-radius: 999px;
    background: #ffffff;
    color: #0f172a;
    font-size: 12px;
    font-weight: 950;
    cursor: pointer;
}

    .admin-dashboard-tab.active {
        background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark));
        border-color: transparent;
        color: #ffffff;
        box-shadow: 0 8px 18px rgba(47, 91, 234, 0.2);
    }

.admin-dashboard-content,
.admin-dashboard-panel {
    min-height: 0;
    overflow: hidden;
}

.admin-dashboard-panel {
    display: none;
    height: 100%;
}

    .admin-dashboard-panel.active {
        display: block;
    }

.dataset-admin-layout {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(300px, 36%) minmax(0, 64%);
    gap: 12px;
    overflow: hidden;
}

.dataset-admin-card {
    min-height: 0;
    height: 100%;
    padding: 14px;
    border: 1px solid var(--admin-border);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.055);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dataset-admin-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.dataset-admin-card h2 {
    margin: 0 0 5px;
    color: #0f172a;
    font-size: 16px;
    line-height: 1.15;
    font-weight: 950;
}

.dataset-admin-card p {
    margin: 0 0 10px;
    color: var(--admin-muted);
    font-size: 11px;
    line-height: 1.3;
    font-weight: 700;
}

.dataset-admin-form {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
}

    .dataset-admin-form label {
        display: grid;
        gap: 4px;
        color: #475569;
        font-size: 10.5px;
        line-height: 1.1;
        font-weight: 950;
    }

    .dataset-admin-form input,
    .dataset-admin-form textarea,
    .dataset-admin-form select {
        width: 100%;
        min-height: 34px;
        padding: 7px 10px;
        border: 1px solid var(--admin-border);
        border-radius: 11px;
        background: #ffffff;
        color: #0f172a;
        font: inherit;
        font-size: 12px;
        line-height: 1.2;
        font-weight: 700;
        outline: none;
    }

        .dataset-admin-form input:focus,
        .dataset-admin-form textarea:focus,
        .dataset-admin-form select:focus {
            border-color: var(--admin-primary);
            box-shadow: 0 0 0 3px rgba(47, 91, 234, 0.12);
        }

    .dataset-admin-form textarea {
        min-height: 54px;
        max-height: 82px;
        resize: vertical;
    }

.dataset-admin-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.dataset-admin-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 2px;
}

.admin-primary-btn,
.admin-secondary-btn,
.dataset-logo-browse {
    min-height: 36px;
    padding: 0 13px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 950;
    cursor: pointer;
    white-space: nowrap;
}

.admin-primary-btn {
    border: 0;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark));
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(47, 91, 234, 0.18);
}

.admin-secondary-btn,
.dataset-logo-browse {
    border: 1px solid var(--admin-border);
    background: #ffffff;
    color: #0f172a;
}

.dataset-logo-picker {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.dataset-logo-preview {
    width: 72px;
    height: 72px;
    border: 1px solid #dbe3f0;
    border-radius: 16px;
    background: #f8fafc;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
}

    .dataset-logo-preview img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        padding: 6px;
    }

.dataset-logo-actions {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.dataset-logo-help {
    color: #64748b;
    font-size: 10.5px;
    line-height: 1.35;
    font-weight: 700;
}

.dataset-admin-list {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.dataset-admin-empty {
    padding: 14px;
    border: 1px dashed var(--admin-border);
    border-radius: 14px;
    background: #f1f5f9;
}

    .dataset-admin-empty strong {
        display: block;
        color: #0f172a;
        font-size: 13px;
        line-height: 1.2;
        font-weight: 950;
    }

    .dataset-admin-empty span {
        display: block;
        margin-top: 4px;
        color: var(--admin-muted);
        font-size: 11.5px;
        line-height: 1.3;
        font-weight: 700;
    }

.dataset-admin-item,
.dataset-library-admin-row {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border: 1px solid #dbe3f0;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.045);
}

.dataset-admin-item-logo,
.dataset-library-card-logo {
    width: 72px;
    height: 72px;
    border: 1px solid #dbe3f0;
    border-radius: 16px;
    background: #f8fafc;
    display: grid;
    place-items: center;
    overflow: hidden;
}

    .dataset-admin-item-logo img,
    .dataset-library-card-logo img {
        width: 72px;
        height: 72px;
        object-fit: contain;
        padding: 6px;
    }

.dataset-admin-item-main,
.dataset-library-admin-copy {
    min-width: 0;
}

.dataset-admin-item-top,
.dataset-library-admin-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

    .dataset-admin-item-top strong,
    .dataset-library-admin-title strong {
        color: #0f172a;
        font-size: 13px;
        font-weight: 950;
    }

    .dataset-admin-item small,
    .dataset-library-admin-title code {
        display: inline-flex;
        width: fit-content;
        padding: 3px 7px;
        border-radius: 999px;
        background: #eef2ff;
        color: #315bea;
        font-size: 10px;
        font-weight: 900;
    }

.dataset-admin-item p,
.dataset-library-admin-copy p {
    margin: 4px 0 0;
    color: #475569;
    font-size: 11px;
    line-height: 1.35;
    font-weight: 650;
}

.dataset-admin-item span,
.dataset-library-admin-meta {
    display: block;
    margin-top: 5px;
    color: #64748b;
    font-size: 10.5px;
    font-weight: 800;
}

.dataset-admin-item em,
.dataset-status-pill {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-style: normal;
    font-weight: 950;
}

    .dataset-admin-item em.active,
    .dataset-status-pill.active {
        background: #dcfce7;
        color: #166534;
    }

    .dataset-admin-item em.hidden-status,
    .dataset-status-pill.hidden-status {
        background: #f1f5f9;
        color: #475569;
    }

.dataset-admin-item-actions,
.dataset-library-admin-actions {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

/* ============================================================================
   DATASET CATALOG MODAL
============================================================================ */
.dataset-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.62);
}

.dataset-modal-card {
    width: min(420px, calc(100vw - 32px));
    padding: 28px;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

    .dataset-modal-card h3 {
        margin: 0 0 10px;
        color: #0f172a;
        font-size: 20px;
        font-weight: 950;
    }

    .dataset-modal-card p {
        margin: 0 0 20px;
        color: #475569;
        font-size: 14px;
        line-height: 1.6;
    }

    .dataset-modal-card button {
        border: 0;
        border-radius: 999px;
        background: #315bea;
        color: #ffffff;
        padding: 10px 18px;
        font-weight: 900;
        cursor: pointer;
    }

/* ============================================================================
   RESPONSIVE
============================================================================ */
@media (max-width: 1180px) {
    :root {
        --nav-w: 250px;
    }

    .container.curtain-layout {
        padding: 14px;
        gap: 14px;
    }

    .plan-section {
        padding: 18px;
    }

    .plan-card {
        width: 260px;
        max-width: 260px;
    }

    .dataset-admin-layout {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .dataset-admin-card {
        height: auto;
        min-height: 0;
    }
}

@media (max-width: 900px) {
    :root {
        --nav-w: 240px;
    }

    .status-bars-row {
        grid-template-columns: 1fr;
    }

    .auth-panels {
        grid-template-columns: 1fr;
    }

    .dira-sector-grid {
        grid-template-columns: 1fr;
    }

    .dira-sector-card {
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .container.curtain-layout {
        padding: 10px;
        gap: 10px;
    }

    .right-panel {
        padding: 12px;
    }

    .home-container-centered {
        padding: 8px;
    }

    .home-welcome-professional {
        max-height: calc(100vh - 48px);
        padding: 16px;
        border-radius: 20px;
    }

    .home-logo-large {
        height: 50px;
    }

    .welcome-text {
        letter-spacing: 0.28em;
    }

    .user-display-name {
        font-size: clamp(28px, 8.5vw, 42px);
        white-space: normal;
    }

    .role-badge,
    .home-library-selection {
        max-width: 96%;
        white-space: normal;
    }

    .home-workspace-image-wrap {
        width: 116px;
        height: 78px;
    }

    .platform-meta {
        font-size: 13px;
    }

        .platform-meta .muted {
            font-size: 11.5px;
        }

    .plan-card {
        width: 100%;
        max-width: 420px;
    }

    .status-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .status-right {
        width: 100%;
        min-width: 0;
    }

    .auth-overlay {
        align-items: flex-start;
        padding: 12px;
    }

    .dira-auth-shell {
        width: 100%;
        max-height: calc(100vh - 24px);
        border-radius: 22px;
    }

    .dira-auth-brand {
        padding: 14px 18px 10px;
    }

    .brand-logo-img {
        height: 58px;
        max-width: 250px;
    }

    .dira-login-landing {
        padding: 22px 18px 18px;
    }

    .dira-login-hero h1 {
        font-size: 28px;
        letter-spacing: -1px;
    }

    .dira-login-hero p {
        font-size: 13px;
    }

    .dira-sector-card {
        padding: 20px;
        border-radius: 20px;
    }

    .dira-sector-icon {
        width: 56px;
        height: 56px;
        font-size: 30px;
    }

    .auth-role-tabs {
        padding: 12px 18px 6px;
    }

    .auth-panels {
        padding: 16px 18px 22px;
        gap: 18px;
    }

    .auth-panel {
        padding: 20px;
        border-radius: 18px;
    }

    .form-row,
    .dataset-admin-two {
        grid-template-columns: 1fr;
    }

    .dataset-admin-item,
    .dataset-library-admin-row {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .dataset-admin-item-actions,
    .dataset-library-admin-actions {
        grid-column: 1 / -1;
        flex-direction: row;
    }
}

@media (max-width: 640px) {
    #app-action-modal .app-action-card {
        width: 92vw;
        border-radius: 12px;
    }

    #app-action-modal #app-action-title {
        padding: 14px 16px;
        font-size: 16px;
    }

    #app-action-modal .app-action-text {
        padding: 16px 16px 12px;
        font-size: 14px;
    }

    #app-action-modal .modal-actions {
        flex-direction: column;
        padding: 14px 16px 16px;
    }

    #app-action-modal .btn {
        width: 100%;
        min-width: 100%;
    }
}

@media (max-width: 420px) {
    .home-welcome-professional {
        padding: 14px 12px;
        border-radius: 18px;
    }

    .home-logo-large {
        height: 44px;
    }

    .user-display-name {
        font-size: clamp(26px, 9vw, 36px);
    }

    .role-badge {
        letter-spacing: 0.1em;
    }

    .home-workspace-image-wrap {
        width: 102px;
        height: 70px;
    }

    .brand-logo-img {
        height: 50px;
    }

    .dira-login-kicker {
        font-size: 10px;
        letter-spacing: 0.05em;
    }

    .dira-login-hero h1 {
        font-size: 24px;
    }

    .dataset-logo-picker {
        grid-template-columns: 1fr;
    }
}

@media (max-height: 760px) {
    .home-container-centered {
        padding: 8px;
    }

    .home-welcome-professional {
        width: min(100%, 780px);
        padding: 14px 30px;
        border-radius: 22px;
    }

    .home-logo-large {
        height: 48px;
    }

    .welcome-text {
        font-size: 9.5px;
        letter-spacing: 0.3em;
    }

    .user-display-name {
        margin: 6px 0 8px;
        font-size: clamp(28px, 6vh, 44px);
    }

    .role-badge {
        min-height: 32px;
        padding: 7px 20px;
        font-size: 10.5px;
    }

    #home-library-selection-host {
        margin-top: 6px;
    }

    #home-workspace-media-host {
        margin-top: 7px;
    }

    .home-library-selection {
        min-height: 28px;
        padding: 6px 12px;
        font-size: 10.5px;
    }

    .home-workspace-image-wrap {
        width: 106px;
        height: 72px;
        padding: 8px;
        border-radius: 18px;
    }

    .home-workspace-icon {
        width: 23px;
        height: 23px;
        font-size: 13px;
    }

    .platform-meta {
        margin-top: 8px;
        padding-top: 8px;
        font-size: 12px;
    }

        .platform-meta .muted {
            margin-top: 4px;
            font-size: 10.5px;
            line-height: 1.2;
        }

    .platform-actions {
        margin-top: 6px;
    }

    .theme-open-btn {
        min-height: 30px;
        padding: 5px 12px;
        font-size: 10.5px;
    }

    .admin-dashboard-page {
        padding: 10px;
        gap: 8px;
    }

    .admin-dashboard-hero {
        padding: 12px 14px;
        border-radius: 16px;
    }

    .admin-kicker {
        display: none;
    }

    .dataset-admin-card {
        padding: 12px;
    }

    .dataset-admin-form textarea {
        min-height: 48px;
        max-height: 60px;
    }
}


.home-container-centered {
    padding: clamp(12px, 2vh, 22px);
}

.home-welcome-professional {
    width: min(100%, 1040px);
    max-height: calc(100vh - 52px);
    padding: clamp(26px, 4vh, 46px) clamp(42px, 6vw, 76px);
}

.home-logo-large {
    height: clamp(70px, 10vh, 96px);
}

.welcome-text {
    font-size: clamp(12px, 1.8vh, 16px);
}

.user-display-name {
    margin: clamp(10px, 1.6vh, 16px) 0 clamp(14px, 2vh, 22px);
    font-size: clamp(48px, 8vh, 72px);
}

.role-badge {
    min-height: clamp(40px, 5.8vh, 50px);
    padding: clamp(10px, 1.6vh, 14px) clamp(28px, 4.8vw, 44px);
    font-size: clamp(13px, 1.8vh, 16px);
}

.home-library-selection {
    min-height: clamp(34px, 4.8vh, 42px);
    font-size: clamp(12px, 1.6vh, 14px);
}

.home-workspace-image-wrap {
    width: clamp(132px, 17vh, 180px);
    height: clamp(88px, 12vh, 128px);
}

.platform-meta {
    margin-top: clamp(14px, 2.2vh, 24px);
    padding-top: clamp(12px, 1.8vh, 18px);
    font-size: clamp(15px, 2vh, 19px);
}

    .platform-meta .muted {
        font-size: clamp(12px, 1.6vh, 14px);
    }

:root {
    --home-pill-width: min(92%, 300px);
}

.role-badge,
.home-library-selection,
.home-workspace-image-wrap {
    width: var(--home-pill-width);
    max-width: var(--home-pill-width);
}

.role-badge,
.home-library-selection {
    justify-content: center;
}

.home-workspace-image-wrap {
    height: 108px;
}

/* ============================================================================
   RESPONSIVE SIDEBAR — IPHONE, IPAD, TABLET, ROTATION
============================================================================ */

:root {
    --mobile-sidebar-width: min(86vw, 340px);
    --mobile-header-height: 54px;
}

html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overscroll-behavior: none;
}

.mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9990;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.mobile-sidebar-button {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    z-index: 10020;
    width: 42px;
    height: 42px;
    padding: 0;
    display: none;
    place-items: center;
    border: 1px solid #dbe2ff;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    color: #2643d9;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

    .mobile-sidebar-button .bars,
    .mobile-sidebar-button .bars::before,
    .mobile-sidebar-button .bars::after {
        width: 18px;
        height: 2px;
        display: block;
        border-radius: 999px;
        background: currentColor;
    }

    .mobile-sidebar-button .bars {
        position: relative;
    }

        .mobile-sidebar-button .bars::before,
        .mobile-sidebar-button .bars::after {
            content: "";
            position: absolute;
            left: 0;
        }

        .mobile-sidebar-button .bars::before {
            top: -6px;
        }

        .mobile-sidebar-button .bars::after {
            top: 6px;
        }

.left-panel {
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

@media (min-width: 769px) and (max-width: 1180px) and (orientation: landscape) {

    :root {
        --nav-w: clamp(220px, 23vw, 250px);
    }

    .container.curtain-layout {
        gap: 10px;
        padding: 10px;
    }

    .left-panel {
        padding: 16px 10px 10px;
    }

    .left-stack {
        gap: 4px;
    }

    .nav-button,
    .exit-button {
        min-height: 42px;
        padding: 9px 10px;
        gap: 8px;
    }

    .nav-collapse-toggle {
        min-height: 42px;
        padding: 9px 10px;
    }
}

@media (max-width: 900px), (max-width: 1180px) and (orientation: portrait) {

    body.mobile-sidebar-open {
        overflow: hidden;
        touch-action: none;
    }

    .container.curtain-layout {
        position: relative;
        display: block;
        width: 100%;
        height: 100dvh;
        min-height: 100dvh;
        padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
        overflow: hidden;
    }

    .mobile-sidebar-button {
        display: grid;
    }

    .mobile-sidebar-backdrop {
        display: block;
    }

    body.mobile-sidebar-open .mobile-sidebar-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .curtain {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 10010;
        width: var(--mobile-sidebar-width) !important;
        max-width: 340px;
        height: 100dvh;
        min-height: 100dvh;
        flex: none !important;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        transform: translate3d(-105%, 0, 0);
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.24s ease, visibility 0.24s ease;
        will-change: transform;
    }

    body.mobile-sidebar-open .curtain {
        transform: translate3d(0, 0, 0);
        visibility: visible;
        pointer-events: auto;
    }

    .curtain-handle {
        display: none;
    }

    .left-panel {
        width: 100%;
        height: 100%;
        min-height: 0;
        padding: 18px 12px max(14px, env(safe-area-inset-bottom));
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }

    .left-stack {
        min-height: min-content;
        padding-bottom: 10px;
    }

    .left-footer {
        margin-top: 12px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }

    .right-panel {
        width: 100%;
        height: 100%;
        min-height: 0;
        padding: calc(var(--mobile-header-height) + env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
        border-radius: 12px;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .container.nav-collapsed .curtain {
        width: var(--mobile-sidebar-width) !important;
        flex-basis: auto !important;
    }

    .container.nav-collapsed .nav-button .label,
    .container.nav-collapsed .exit-button .label {
        position: static !important;
        width: auto;
        height: auto;
        overflow: visible;
        clip: auto;
        clip-path: none;
    }

    .nav-button,
    .exit-button {
        min-height: 44px;
        padding: 10px 11px;
        gap: 10px;
    }

    .nav-collapse-toggle {
        min-height: 44px;
        align-items: center;
        padding: 10px 11px;
    }

    .nav-collapse-content {
        padding-left: 8px;
    }
}

@media (max-width: 480px) {
    :root {
        --mobile-sidebar-width: min(88vw, 320px);
    }

    .nav-group-label {
        margin-top: 8px;
        font-size: 10px;
    }

    .nav-button,
    .exit-button,
    .nav-collapse-toggle {
        border-radius: 9px;
    }

        .nav-button .icon {
            flex: 0 0 22px;
            text-align: center;
            font-size: 17px;
        }

        .nav-button .label,
        .exit-button .label {
            min-width: 0;
            overflow-wrap: anywhere;
        }
}

@media (max-height: 500px) and (orientation: landscape) and (max-width: 950px) {

    :root {
        --mobile-sidebar-width: min(52vw, 330px);
        --mobile-header-height: 48px;
    }

    .mobile-sidebar-button {
        top: max(6px, env(safe-area-inset-top));
        left: max(6px, env(safe-area-inset-left));
        width: 38px;
        height: 38px;
    }

    .left-panel {
        padding-top: 10px;
    }

    .left-stack {
        gap: 2px;
    }

    .nav-group-label {
        margin: 6px 0 3px;
    }

    .nav-button,
    .exit-button,
    .nav-collapse-toggle {
        min-height: 38px;
        padding: 7px 9px;
    }
}

@supports not (height: 100dvh) {
    @media (max-width: 900px) {
        .container.curtain-layout,
        .curtain {
            height: var(--app-mobile-height, 100vh);
            min-height: var(--app-mobile-height, 100vh);
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .curtain,
    .mobile-sidebar-backdrop,
    .mobile-sidebar-button {
        transition: none !important;
    }
}

/* ============================================================================
   RESPONSIVE CONTEXT NAVIGATION — STRUCTURAL BASE
   Final responsive/stacking rules are in dira_global_responsive_override.css.
============================================================================ */

.mobile-sidebar-button {
    position: fixed;
    top: max(10px, env(safe-area-inset-top, 0px));
    left: max(10px, env(safe-area-inset-left, 0px));
    z-index: 10030;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #dbe2ff;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.98);
    color: #2643d9;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.16);
    display: none;
    place-items: center;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 900px), (max-width: 1180px) and (orientation: portrait) {

    body.dira-mobile-context-ready
    .mobile-sidebar-button {
        display: grid !important;
    }

        body.dira-mobile-context-ready
        .mobile-sidebar-button[hidden] {
            display: grid !important;
        }
}

.mobile-sidebar-button .bars,
.mobile-sidebar-button .bars::before,
.mobile-sidebar-button .bars::after {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.mobile-sidebar-button .bars {
    position: relative;
    display: block;
}

    .mobile-sidebar-button .bars::before,
    .mobile-sidebar-button .bars::after {
        content: "";
        position: absolute;
        left: 0;
        transition: transform 0.2s ease, top 0.2s ease;
    }

    .mobile-sidebar-button .bars::before {
        top: -6px;
    }

    .mobile-sidebar-button .bars::after {
        top: 6px;
    }

.mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    background: rgba(15, 23, 42, 0.48);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
