.page {
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.sidebar {
    background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}

.main-layout {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    --main-header-height: 64px;
    --app-sidebar-width: 17.5rem;
}

.rz-layout.rz-software.main-layout {
    background: #f8fafc;
}

.layout-shell {
    display: flex;
    flex-direction: row;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
}

.layout-main {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 100vh;
    flex-direction: column;
}

.jans-burger {
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.jans-burger:hover {
    background: #f1f5f9;
}

@media (min-width: 901px) {
    .jans-burger {
        left: auto;
        right: 0.75rem;
    }
}

.main-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: calc(100vh - var(--main-header-height));
    min-width: 0;
    width: 100%;
    overflow: auto;
}

.layout-main.without-topbar .main-body {
    height: 100vh;
}

.content-wrap {
    flex: 1 0 auto;
    min-height: 70vh;
    max-width: 100%;
}

.workspace-context-error {
    max-width: 35rem;
    margin: 3rem auto;
    padding: 1.5rem;
    border: 1px solid #fecaca;
    border-radius: 16px;
    background: #fff1f2;
    color: #9f1239;
}

.workspace-context-error button {
    min-height: 44px;
    padding: 0.6rem 0.9rem;
    border: 1px solid #be123c;
    border-radius: 9px;
    background: #ffffff;
    color: #9f1239;
    font-weight: 700;
}

.workspace-context-error button:focus-visible {
    outline: 2px solid #be123c;
    outline-offset: 2px;
}

.jans-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(14rem, 36rem) minmax(0, auto);
    align-items: center;
    gap: 1.25rem;
    min-height: var(--main-header-height);
    padding: 0 2rem;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    box-shadow: none;
}

.jans-topbar.is-portal {
    grid-template-columns: minmax(0, 1fr) auto;
}

.jans-topbar-workspace {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.jans-topbar-workspace strong {
    max-width: min(42vw, 24rem);
    overflow: hidden;
    color: #0f172a;
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jans-topbar-notifications {
    position: relative;
}

.jans-topbar-notification-popover {
    position: absolute;
    z-index: 30;
    top: calc(100% + 0.75rem);
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: min(21rem, calc(100vw - 1.5rem));
    max-height: min(70dvh, 27rem);
    overflow-y: auto;
    padding: 0.9rem;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.16);
}

.jans-topbar-notification-popover > strong {
    padding: 0 0.2rem 0.3rem;
    color: #0f172a;
}

.jans-topbar-notification-popover p {
    margin: 0;
    color: #475569;
}

.jans-topbar-notification-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    min-height: 58px;
    padding: 0.65rem;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    background: #f8fbff;
    color: #0f172a;
    text-align: left;
}

.jans-topbar-notification-item:hover,
.jans-topbar-notification-item:focus-visible {
    border-color: #93c5fd;
    background: #eff6ff;
}

.jans-topbar-notification-item:focus-visible,
.jans-topbar-icon-button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.jans-topbar-notification-item span,
.jans-topbar-notification-item small {
    color: #475569;
    font-size: 0.75rem;
}

.jans-topbar-left,
.jans-topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.jans-topbar-actions {
    justify-content: flex-end;
}

.jans-topbar-menu-button,
.jans-topbar-icon-button,
.jans-topbar-profile {
    border: 0;
    background: transparent;
    color: #111827;
    box-shadow: none;
}

.jans-topbar-menu-button,
.jans-topbar-icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 6px;
}

.jans-topbar-menu-button:hover,
.jans-topbar-icon-button:hover,
.jans-topbar-profile:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.jans-topbar-tenant,
.jans-topbar-current-tenant {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    padding: 0.25rem 0.35rem 0.25rem 0.75rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
}

.jans-topbar-current-tenant {
    min-height: 2.5rem;
    padding-inline: 0.85rem;
    font-weight: 700;
    color: #0f172a;
}

.jans-topbar-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
}

.jans-topbar-tenant-dropdown {
    min-width: 12rem;
    border: none;
    box-shadow: none;
    background: transparent;
    color: #0f172a;
    font: inherit;
    font-weight: 700;
    outline: none;
    cursor: pointer;
}

.jans-topbar-tenant-dropdown:focus-visible {
    outline: 2px solid #bfdbfe;
    outline-offset: 3px;
    border-radius: 10px;
}

.jans-topbar-tenant-dropdown:disabled {
    cursor: wait;
    opacity: 0.68;
}

.jans-topbar-tenant-status {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    white-space: nowrap;
    color: #2563eb;
    font-size: 0.78rem;
    font-weight: 750;
}

.jans-topbar-tenant-status::before {
    content: "";
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 999px;
    border: 2px solid #bfdbfe;
    border-top-color: #2563eb;
    animation: jansTenantSwitchSpin 800ms linear infinite;
}

.jans-topbar-tenant-error {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 2rem;
    z-index: 20;
    max-width: min(22rem, calc(100vw - 2rem));
    padding: 0.45rem 0.65rem;
    border: 1px solid #fecdd3;
    border-radius: 6px;
    background: #fff1f2;
    color: #be123c;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

@keyframes jansTenantSwitchSpin {
    to {
        transform: rotate(360deg);
    }
}

.jans-topbar-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
    width: 100%;
    height: 2.5rem;
    padding: 0 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
    color: #64748b;
}

.jans-topbar-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: #0f172a;
    font-size: 0.94rem;
}

.jans-topbar-search input::placeholder {
    color: #94a3b8;
}

.jans-topbar-search-popover {
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-height: min(60vh, 28rem);
    overflow: auto;
    padding: 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.jans-topbar-search-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.jans-topbar-search-title {
    padding-inline: 0.25rem;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.jans-topbar-search-result {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    color: #0f172a;
    text-align: left;
}

.jans-topbar-search-result:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.jans-topbar-search-chip {
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    padding: 0.2rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 800;
}

.jans-topbar-search-empty {
    color: #64748b;
    padding: 0.35rem;
}

.jans-topbar-notification-dot {
    position: absolute;
    top: 0.62rem;
    right: 0.65rem;
    width: 0.55rem;
    height: 0.55rem;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #ef4444;
}

.jans-topbar-profile {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    min-height: 2.5rem;
    padding: 0.25rem 0.35rem 0.25rem 0.65rem;
    border-radius: 6px;
}

.jans-topbar-profile-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: right;
    line-height: 1.1;
}

.jans-topbar-profile-copy strong,
.jans-topbar-profile-copy small {
    max-width: 11rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.jans-topbar-profile-copy strong {
    color: #0f172a;
    font-size: 0.9rem;
}

.jans-topbar-profile-copy small {
    color: #64748b;
    font-size: 0.74rem;
}

.jans-topbar-profile img,
.jans-topbar-profile-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    object-fit: cover;
}

.eyebrow {
    text-align: center;
}

.content-wrap .eyebrow {
    width: 100%;
    margin-inline: auto;
    text-align: center;
}

.top-row {
    background-color: #f7f7f7;
    border-bottom: 1px solid #d6d5d5;
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
}

.rz-header {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    min-height: 3.5rem;
    height: auto;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 10;
} .rz-header .rz-sidebar-toggle {
    margin-top: 0;
    margin-right: 0;
    align-self: center;
} .rz-header .main-header-content {
    width: 100%;
    flex-wrap: nowrap;
    align-items: center;
} .rz-header .main-header-right {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-end;
} .rz-header .main-header-left {
    flex: 0 0 auto;
} .rz-header .main-header-title-wrapper {
    margin-left: 20px;
    margin-top: 10px;
}

.main-layout .rz-sidebar {
    top: var(--main-header-height);
    height: calc(100vh - var(--main-header-height));
}

@media (max-width: 640.98px) { .rz-header .main-header-content {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    } .rz-header .main-header-left {
        justify-content: flex-start;
    } .rz-header .main-header-right {
        flex: 1 1 auto;
        justify-content: flex-end;
    }
    .rz-header {
        padding: 0.15rem 0.5rem;
        min-height: 2.5rem;
    }
    .rz-header .main-header-title-wrapper {
        margin-top: 0;
        margin-left: 0.5rem;
    }
}

    .top-row a, .top-row .btn-link {
        white-space: nowrap;
        margin-left: 1.5rem;
        text-decoration: none;
    }

    .top-row a:hover, .top-row .btn-link:hover {
        text-decoration: underline;
    }

    .top-row a:first-child {
        overflow: hidden;
        text-overflow: ellipsis;
    }

@media (max-width: 640.98px) {
    .top-row {
        justify-content: space-between;
    }

    .top-row a, .top-row .btn-link {
        margin-left: 0;
    }
}

@media (max-width: 1100px) {
    .jans-topbar {
        grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
    }

    .jans-topbar-profile-copy,
    .jans-topbar-tenant .jans-topbar-label {
        display: none;
    }

    .jans-topbar-tenant-dropdown {
        min-width: 9rem;
    }
}

@media (max-width: 1100px) {
    .jans-topbar-tenant,
    .jans-topbar-current-tenant {
        display: none;
    }
}

@media (max-width: 760px) {
    .main-layout {
        --main-header-height: auto;
    }

    .jans-topbar {
        grid-template-columns: auto 1fr auto;
        gap: 0.6rem;
        padding: 0.7rem;
    }

    .jans-topbar-left {
        min-width: 0;
    }

    .jans-topbar-search {
        height: 2.55rem;
        padding-inline: 0.75rem;
    }

    .jans-topbar-search input {
        font-size: 0.86rem;
    }

    .jans-topbar-actions {
        gap: 0.45rem;
    }

    .jans-topbar-menu-button,
    .jans-topbar-icon-button {
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 14px;
    }

    .jans-topbar-profile {
        min-height: 2.5rem;
        padding: 0.18rem;
    }

    .main-body {
        height: auto;
        min-height: calc(100vh - 4rem);
    }
}

@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
    }

    .top-row {
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .top-row.auth a:first-child {
        flex: 1;
        text-align: right;
        width: 0;
    }

    .top-row, article {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    min-height: 100dvh;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: max(1.5rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
}

.overlay--plain-lock {
    background: rgba(248, 250, 249, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.overlay--pause {
    background-color: rgba(0, 0, 0, 0.5);
}

.overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.overlay-content--plain-lock {
    width: min(21.25rem, calc(100vw - 2rem));
    min-height: 10rem;
    gap: 0;
    justify-content: center;
    padding: 2rem 2rem;
    border-radius: 12px;
    background: #ffffff;
    color: #1f2937;
    box-shadow: 0 18px 45px rgba(31, 41, 55, 0.16), 0 4px 12px rgba(31, 41, 55, 0.08);
}

.overlay-content--pause {
    padding: 2rem;
}

.timer {
    font-size: 1.5rem;
    margin-top: 1rem;
    white-space: pre-line;
}

.lockscreen-spinner {
    width: 1.9rem;
    height: 1.9rem;
    margin-bottom: 1rem;
    border-radius: 999px;
    border: 2px solid rgba(143, 216, 200, 0.35);
    border-top-color: #8fd8c8;
    animation: lockscreenSpin 0.8s linear infinite;
}

.lockscreen-message {
    margin: 0;
    max-width: 17rem;
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    white-space: pre-line;
}

.overlay-content--plain-lock .lockscreen-message:first-of-type {
    color: #1f2937;
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.3;
}

.overlay-content--plain-lock .lockscreen-message + .lockscreen-message {
    margin-top: 0.55rem;
}

@keyframes lockscreenSpin {
    to {
        transform: rotate(360deg);
    }
}

.overlay--ai-terminal {
    z-index: 12000;
    box-sizing: border-box;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(6px);
}

.overlay-content--ai-terminal {
    box-sizing: border-box;
    width: min(100%, 44rem);
    max-height: calc(100dvh - 2rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-width: 0;
    align-items: stretch;
    gap: 1rem;
    padding: 1.25rem;
    overflow: auto;
    text-align: left;
    border: 1px solid #dce3ec;
    border-radius: 18px;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
}

.ai-terminal-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.ai-terminal-heading h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
}

.ai-terminal-symbol {
    display: flex;
    padding: 0.5rem;
    border-radius: 10px;
    background: #eff6ff;
    color: #1d4ed8;
}

.ai-terminal-activity {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
    font-size: 0.78rem;
    color: #475569;
}

.ai-terminal-activity > span {
    width: 0.65rem;
    height: 0.65rem;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: lockscreenSpin 1.2s linear infinite;
}

.ai-terminal-status {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.ai-progress-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-progress-copy {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    color: #475569;
    font-size: 0.8rem;
}

.ai-progress-label { overflow-wrap: anywhere; }
.ai-progress-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ai-progress-card .rz-progressbar { height: 0.3rem; background: #e2e8f0; border: 0; }
.ai-progress-card .rz-progressbar-value { background: #2563eb; }

.ai-terminal {
    min-width: 0;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid #253249;
    border-radius: 10px;
    background: #111b2c;
}

.ai-terminal-header {
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid #2b384d;
    font-size: 0.75rem;
    font-weight: 500;
    color: #cbd5e1;
}

.ai-terminal-body {
    box-sizing: border-box;
    min-height: 9rem;
    max-height: min(38dvh, 22rem);
    margin: 0;
    padding: 0.9rem;
    overflow: auto;
    overscroll-behavior: contain;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    text-align: left;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #e2e8f0;
    font-family: Consolas, "Courier New", monospace;
    scrollbar-color: #64748b #111b2c;
}

.ai-terminal-body--waiting { color: #b6c3d5; }
.ai-terminal-body:focus-visible { outline: 2px solid #93c5fd; outline-offset: -3px; }
.ai-terminal-note { margin: 0; color: #64748b; font-size: 0.78rem; line-height: 1.5; }

@media (max-width: 480px) {
    .overlay-content--ai-terminal { padding: 1rem; gap: 0.85rem; }
    .ai-terminal-heading { gap: 0.5rem; }
    .ai-terminal-heading h2 { font-size: 1rem; }
    .ai-terminal-activity { font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
    .ai-terminal-activity > span { animation: none; border-color: #2563eb; }
    .overlay-content--ai-terminal * { scroll-behavior: auto; transition: none; }
}
