html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: #f4f6f8;
    color: #172033;
    font-family: Arial, sans-serif;
}

a {
    color: #243b80;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(100%, 420px);
    background: #fff;
    border: 1px solid #dfe5ec;
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 16px 42px rgba(23, 32, 51, 0.08);
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
    text-align: center;
}

.login-logo {
    display: block;
    width: min(100%, 300px);
    height: auto;
    margin: 0 auto 24px;
}

.text-muted {
    color: #667085;
    text-align: center;
}

.alert {
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
}

.is-hidden {
    display: none;
}

.alert-danger {
    color: #842029;
    background: #f8d7da;
    border: 1px solid #f5c2c7;
}

.mb-3 {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

.form-control {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid #cad3df;
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 9px 12px;
    color: #172033;
    background: #fff;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}

.btn:disabled {
    cursor: wait;
    opacity: 0.72;
}

.btn-primary {
    color: #fff;
    background: #243b80;
    border-color: #243b80;
}

.btn-outline-secondary {
    border-color: #98a2b3;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 14px;
}

.w-100 {
    width: 100%;
}

.app-shell {
    width: min(1840px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.app-topbar h1 {
    margin: 0;
    font-size: 28px;
}

.eyebrow {
    color: #667085;
    font-size: 13px;
    text-transform: uppercase;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 5px 7px 5px 5px;
    border: 1px solid #d5dde8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(23, 32, 51, 0.04);
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    background: #243b80;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
}

.user-name {
    max-width: 180px;
    overflow: hidden;
    color: #172033;
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-signout {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding-left: 10px;
    border-left: 1px solid #dfe5ec;
    color: #243b80;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.user-signout:hover,
.user-signout:focus {
    color: #17245c;
    text-decoration: underline;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 16px;
}

.dashboard-layout-full {
    grid-template-columns: minmax(0, 1fr);
}

.dashboard-list,
.dashboard-viewer,
.empty-state {
    background: #fff;
    border: 1px solid #dfe5ec;
    border-radius: 8px;
    padding: 16px;
}

.dashboard-viewer {
    padding: 12px;
}

.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: start;
}

.dashboard-button {
    border: 1px solid #cad3df;
    background: #fff;
    border-radius: 6px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
}

.dashboard-button.is-active {
    color: #fff;
    background: var(--dashboard-accent, #243b80);
    border-color: var(--dashboard-accent, #243b80);
}

.dashboard-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.viewer-status {
    color: #475467;
}

.viewer-toolbar,
.embed-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.viewer-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.public-topbar-logo {
    display: block;
    width: 190px;
    max-width: 42vw;
    height: auto;
}

.public-topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 190px) auto;
    align-items: center;
}

.dashboard-embed-target {
    position: relative;
    min-height: 760px;
    overflow: hidden;
    border: 1px dashed #cad3df;
    border-radius: 6px;
    background: #fff;
}

.dashboard-embed-frame {
    min-height: 760px;
}

.embed-shell {
    width: min(1840px, calc(100% - 24px));
    margin: 0 auto;
    padding: 12px 0;
}

.embed-topbar h1 {
    margin: 0;
    font-size: 22px;
}

.dashboard-viewer-standalone {
    padding: 10px;
}

.dashboard-embed-target-standalone,
.dashboard-embed-target-standalone .dashboard-embed-frame {
    min-height: calc(100vh - 120px);
}

.dashboard-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: #475467;
    background: rgba(255, 255, 255, 0.94);
    font-size: 14px;
    font-weight: 700;
}

.dashboard-loading[hidden] {
    display: none;
}

.dashboard-spinner {
    width: 36px;
    height: 36px;
    box-sizing: border-box;
    border: 3px solid #d5dde8;
    border-top-color: #243b80;
    border-radius: 50%;
    animation: dashboard-spin 0.8s linear infinite;
}

@keyframes dashboard-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-spinner {
        animation-duration: 1.6s;
    }
}

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

    .dashboard-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 820px) {
    .app-topbar,
    .user-menu,
    .viewer-toolbar,
    .embed-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .public-topbar {
        align-items: center;
        flex-direction: row;
    }

    .viewer-actions {
        justify-content: flex-start;
    }

    .user-menu {
        width: fit-content;
    }

    .user-signout {
        padding-left: 0;
        border-left: 0;
    }

    .dashboard-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .public-topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(96px, 38vw);
        align-items: start;
        gap: 10px;
    }

    .public-topbar-actions {
        grid-template-columns: 1fr;
        justify-items: end;
        gap: 8px;
    }

    .public-topbar-logo {
        width: 100%;
        max-width: 170px;
    }
}
