.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%;
}

.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-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-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--ai-terminal,
.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--ai-terminal,
.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;
}

.overlay--ai-terminal .lockscreen-message {
    max-width: min(28rem, calc(100vw - 3rem));
    color: #ffffff;
    font-size: clamp(1.05rem, 3.6vw, 1.42rem);
    font-weight: 600;
    line-height: 1.28;
    letter-spacing: -0.02em;
}

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

.ai-terminal {
    width: min(92vw, 720px);
    max-height: 320px;
    display: flex;
    flex-direction: column;
    border: 1px solid #1f2937;
    border-radius: 10px;
    background: #0b1220;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.ai-progress-card {
    width: min(92vw, 720px);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border: 1px solid #1f2937;
    border-radius: 12px;
    background: #0b1220;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.ai-progress-copy {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.ai-progress-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #dbeafe;
}

.ai-progress-count {
    font-size: 0.82rem;
    color: #bfdbfe;
}

.ai-progress-bar {
    width: 100%;
}

.ai-progress-card .rz-progressbar {
    background: #111827;
    border: 1px solid #1f2937;
}

.ai-progress-card .rz-progressbar-value {
    background: linear-gradient(90deg, #2563eb 0%, #38bdf8 100%);
}

.ai-stream-receive-card {
    width: min(92vw, 720px);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.85rem 1rem;
    border: 1px solid #1f2937;
    border-radius: 12px;
    background: #0b1220;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.ai-stream-receive-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ai-stream-receive-label {
    color: #dbeafe;
    font-size: 0.85rem;
    font-weight: 700;
}

.ai-stream-receive-count {
    color: #86efac;
    font-size: 0.84rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.ai-stream-receive-bar {
    position: relative;
    height: 0.55rem;
    overflow: hidden;
    border: 1px solid #1f2937;
    border-radius: 999px;
    background: #111827;
}

.ai-stream-receive-bar span {
    position: absolute;
    inset-block: 0;
    left: -35%;
    width: 35%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.1) 0%, #38bdf8 45%, #86efac 100%);
    animation: aiStreamReceiveIndeterminate 1.45s ease-in-out infinite;
}

.ai-stream-receive-note {
    color: #93a4bd;
    font-size: 0.75rem;
    line-height: 1.35;
}

@keyframes aiStreamReceiveIndeterminate {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(390%);
    }
}

.ai-terminal-header {
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    color: #dbeafe;
    background: #111827;
    border-bottom: 1px solid #1f2937;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ai-terminal-status {
    padding: 0.55rem 0.75rem;
    font-size: 0.78rem;
    color: #bfdbfe;
    background: #0f172a;
    border-bottom: 1px solid #1f2937;
}

.ai-terminal-body {
    margin: 0;
    padding: 0.75rem;
    white-space: pre-wrap;
    overflow: auto;
    font-size: 0.82rem;
    line-height: 1.35;
    color: #86efac;
    font-family: Consolas, "Courier New", monospace;
}
