.m3-app-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    width: min(1200px, calc(100% - 3rem));
    margin: 1.5rem auto 0;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(13, 148, 136, 0.14);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 118, 106, 0.08);
    backdrop-filter: blur(10px);
}

.brand {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    flex: 0 0 auto;
    max-width: fit-content;
}

.brand-link {
    text-decoration: none;
    color: inherit;
}

.brand-link:focus,
.brand-link:focus-visible {
    outline: none;
    box-shadow: none;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f766a, #5fd0b6);
    color: white;
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 15px 36px rgba(15, 118, 106, 0.25);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.brand-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.brand-sub {
    font-size: 0.8rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    font-weight: 600;
}

.nav-links a {
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    color: rgba(15, 23, 42, 0.85);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-links a:hover {
    background: rgba(15, 118, 106, 0.08);
    color: #0f766a;
}

.nav-link-button {
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    border: none;
    background: rgba(15, 118, 106, 0.08);
    color: #0f766a;
    font-weight: 600;
    cursor: pointer;
}

.nav-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.nav-sso-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 118, 106, 0.2);
    background: linear-gradient(135deg, #0f766a, #12a292);
    color: white;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-sso-button:hover {
    background: rgba(15, 118, 106, 0.16);
    border-color: rgba(15, 118, 106, 0.32);
}

.nav-sso-button:focus-visible {
    box-shadow: 0 0 0 3px rgba(15, 118, 106, 0.18);
}

.nav-sso-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.nav-sso-label {
    font-size: 0.85rem;
    letter-spacing: 0.01em;
}

.nav-sso-debug {
    width: min(1200px, calc(100% - 3rem));
    margin: 0.6rem auto 0;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
    border: 1px dashed rgba(15, 118, 106, 0.25);
    background: rgba(15, 118, 106, 0.05);
    color: rgba(15, 23, 42, 0.85);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-sso-debug-header {
    font-weight: 700;
    font-size: 0.85rem;
}

.nav-sso-debug-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.78rem;
}

.nav-sso-debug-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.nav-sso-debug-time {
    font-weight: 700;
    color: rgba(15, 23, 42, 0.6);
}

.nav-sso-debug-text {
    color: rgba(15, 23, 42, 0.85);
}

.nav-sso-debug-muted {
    color: rgba(15, 23, 42, 0.55);
}

.avatar-button {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.avatar-image {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 12px 30px rgba(15, 118, 106, 0.2);
    border: 1px solid rgba(15, 118, 106, 0.2);
}

.avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0f766a, #12a292);
    color: #ffffff;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 12px 30px rgba(15, 118, 106, 0.2);
}

.status {
    padding: 0.4rem 0.65rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.82rem;
    border: 1px solid rgba(15, 118, 106, 0.16);
}

.status.success {
    background: rgba(15, 118, 106, 0.1);
    color: #0f4f45;
}

.login-dialog {
    display: grid;
    gap: 0.75rem;
}

.nav-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    padding: 1.5rem;
    z-index: 40;
}

.nav-dialog {
    width: min(460px, 100%);
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(15, 118, 106, 0.16);
    box-shadow: 0 24px 70px rgba(15, 118, 106, 0.18);
    padding: 1.25rem;
    display: grid;
    gap: 1rem;
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dialog-title {
    margin: 0;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    align-items: center;
}

.inline-login {
    width: min(1200px, calc(100% - 3rem));
    margin: 1rem auto 0;
    padding: 1.25rem;
    background: #ffffff;
    border: 1px solid rgba(15, 118, 106, 0.12);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(15, 118, 106, 0.1);
}

.nav-inline-host {
    width: min(1200px, calc(100% - 3rem));
    margin: 0 auto;
}

.inline-login-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.inline-login-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.inline-card {
    padding: 1rem;
    border-radius: 14px;
    border: 1px solid rgba(15, 118, 106, 0.12);
    background: rgba(255, 255, 255, 0.9);
    display: grid;
    gap: 0.75rem;
}

.inline-card.secondary {
    background: linear-gradient(145deg, rgba(229, 243, 238, 0.45), rgba(255, 255, 255, 0.9));
}

.side-nav-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    pointer-events: none;
    z-index: 29;
}

.side-nav-overlay.is-open {
    background: rgba(15, 23, 42, 0.35);
    pointer-events: auto;
}

.side-nav {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    bottom: 0;
    width: 260px;
    background: #ffffff;
    border-left: 1px solid rgba(15, 118, 106, 0.16);
    box-shadow: 0 24px 80px rgba(15, 118, 106, 0.25);
    padding: 5rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.2s ease-out;
    z-index: 30;
}

.side-nav.is-open {
    transform: translateX(0);
}

.side-nav .nav-links {
    flex-direction: column;
    align-items: flex-start;
}

.side-nav-header {
    display: flex;
    align-items: center;
}

.side-avatar-button {
    border: none;
    background: transparent;
    padding: 0;
    width: 100%;
    cursor: pointer;
}

.side-avatar {
    display: flex;
    align-items: center;
    width: 66%;
    margin: 0 auto;
}

.side-avatar .avatar-image {
    width: 100%;
    height: auto;
    border-radius: 999px;
}

.side-avatar .avatar-circle {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 999px;
}

.side-nav-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
}

.side-nav-divider {
    height: 1px;
    background: rgba(15, 118, 106, 0.16);
    margin: 0.25rem 0;
}

.side-nav-action {
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    border: none;
    background: transparent;
    text-align: left;
    font-weight: 700;
    color: #0f172a;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.side-nav-action:hover {
    background: rgba(15, 118, 106, 0.08);
    color: #0f4f45;
}

.side-nav-action.danger {
    color: #b42318;
}

.side-nav-action.danger:hover {
    background: rgba(180, 35, 24, 0.1);
}

@media (max-width: 960px) {
    .m3-app-bar {
        grid-template-columns: 1fr;
        width: calc(100% - 2rem);
        gap: 1rem;
    }

    .nav-links {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .login-area {
        grid-template-columns: 1fr;
    }
}
