.portal-body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(110, 52, 255, 0.16), transparent 28%),
        linear-gradient(180deg, #f8f5ff 0%, #f5f7fb 42%, #ffffff 100%);
    color: #12062a;
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.eyebrow {
    margin: 0 0 0.3rem;
    color: #6e34ff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 2rem;
}

.login-card {
    width: min(100%, 480px);
    padding: 2rem;
    border: 1px solid rgba(110, 52, 255, 0.14);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 20px 48px rgba(18, 6, 42, 0.1);
}

.login-brand,
.sidebar-header {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.login-brand {
    justify-content: center;
    margin-bottom: 0.5rem;
}

.login-brand > div {
    display: grid;
    justify-items: center;
}

.login-logo-image {
    display: block;
    width: 112px;
    max-width: 100%;
    height: auto;
    margin-bottom: 0.85rem;
}

.login-copy,
.header-copy,
.sidebar-meta,
.dashboard-panel p {
    color: #574e6a;
    line-height: 1.6;
}

.login-copy {
    max-width: 28ch;
    margin: 0 auto;
    text-align: center;
}

.flash-message,
.dev-preview {
    margin: 1rem 0;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: rgba(110, 52, 255, 0.1);
    color: #4f26bd;
}

.dev-preview a {
    color: #6e34ff;
    word-break: break-all;
}

.login-form {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.login-form label {
    font-weight: 600;
}

.login-form input {
    padding: 0.9rem 1rem;
    border: 1px solid rgba(110, 52, 255, 0.2);
    border-radius: 12px;
    font-size: 1rem;
}

.login-form button,
.secondary-button {
    padding: 0.85rem 1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #e70481, #6e34ff);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.secondary-button {
    background: rgba(110, 52, 255, 0.1);
    color: #4f26bd;
}

.full-width {
    width: 100%;
}

.portal-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 260px 1fr;
    transition: grid-template-columns 0.18s ease;
}

.portal-sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    border-right: 1px solid rgba(110, 52, 255, 0.12);
    background: rgba(255, 255, 255, 0.94);
    overflow: hidden;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    margin-left: auto;
    border: 1px solid rgba(110, 52, 255, 0.15);
    border-radius: 999px;
    background: rgba(110, 52, 255, 0.08);
    color: #6e34ff;
    cursor: pointer;
}

.sidebar-toggle-icon {
    font-size: 1.2rem;
    line-height: 1;
    transition: transform 0.18s ease;
}

.sidebar-logo-image {
    display: block;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    object-fit: contain;
}

.sidebar-header-copy {
    min-width: 0;
}

.sidebar-header-copy strong {
    display: block;
    color: #12062a;
    font-size: 1rem;
}

.sidebar-nav {
    display: grid;
    gap: 0.4rem;
}

.sidebar-link {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: #352b4a;
    text-decoration: none;
}

.sidebar-link-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    flex: 0 0 auto;
    border-radius: 0.55rem;
    background: rgba(110, 52, 255, 0.12);
    color: #6e34ff;
    font-size: 0.82rem;
    font-weight: 700;
}

.sidebar-link-label {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sidebar-link:hover,
.sidebar-link.is-active {
    background: rgba(231, 4, 129, 0.08);
    color: #e70481;
}

.sidebar-link:hover .sidebar-link-badge,
.sidebar-link.is-active .sidebar-link-badge {
    background: rgba(231, 4, 129, 0.12);
    color: #e70481;
}

.sidebar-link.is-disabled {
    background: #f5f7fb;
    color: #8593a5;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 0.75rem;
}

.sidebar-meta {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.82rem;
}

.portal-main {
    padding: 1.75rem 2rem;
}

.portal-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.portal-header h1,
.dashboard-panel h2,
.login-card h1 {
    margin: 0;
}

.login-card h1 {
    line-height: 1.15;
    text-align: center;
}

.dashboard-panel {
    border: 1px solid rgba(110, 52, 255, 0.12);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 34px rgba(18, 6, 42, 0.06);
}

.dashboard-panel:not(.dashboard-embed-shell) {
    padding: 1.5rem;
}

.dashboard-embed-shell {
    min-height: calc(100vh - 170px);
    overflow: hidden;
}

#metabase-dashboard-root,
#metabase-dashboard-root metabase-dashboard {
    display: block;
    width: 100%;
    min-height: calc(100vh - 170px);
}

.embed-loading,
.embed-error {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 220px);
    color: #58677a;
    text-align: center;
}

.loading-bar {
    width: 180px;
    height: 10px;
    margin-bottom: 1rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(110, 52, 255, 0.12);
    position: relative;
}

.loading-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 45%;
    border-radius: inherit;
    background: linear-gradient(135deg, #e70481, #6e34ff);
    animation: loading-slide 1.2s infinite ease-in-out;
}

.sidebar-collapsed .portal-layout {
    grid-template-columns: 88px 1fr;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
}

.sidebar-collapsed .sidebar-logo-image {
    width: 24px;
    height: 24px;
}

.sidebar-collapsed .sidebar-header-copy,
.sidebar-collapsed .sidebar-link-label,
.sidebar-collapsed .sidebar-footer {
    display: none;
}

.sidebar-collapsed .sidebar-nav {
    justify-items: center;
}

.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar-collapsed .sidebar-toggle-icon {
    transform: rotate(180deg);
}

@keyframes loading-slide {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(260%);
    }
}

@media (max-width: 960px) {
    .portal-layout {
        grid-template-columns: 1fr;
    }

    .portal-sidebar {
        border-right: none;
        border-bottom: 1px solid rgba(110, 52, 255, 0.12);
    }

    .sidebar-collapsed .portal-layout {
        grid-template-columns: 1fr;
    }

    .sidebar-collapsed .sidebar-header-copy,
    .sidebar-collapsed .sidebar-link-label,
    .sidebar-collapsed .sidebar-footer {
        display: initial;
    }
}
