:root {
    --oto-app-sidebar-width: 288px;
    --oto-app-sidebar-pad: 18px;
    --oto-app-sidebar-line: rgba(188, 198, 212, 0.88);
    --oto-app-sidebar-shadow: 10px 0 28px rgba(18, 31, 45, 0.06);
    --oto-app-card-shadow: 0 14px 28px rgba(18, 31, 45, 0.08);
    --oto-mobile-gutter: 18px;
    --oto-mobile-stack-gap: 16px;
    --oto-mobile-surface-radius: 20px;
}

.oto-app-page,
.oto-app-layout {
    min-height: 100vh;
}

.oto-app-layout {
    position: relative;
}

.oto-app-drawer-toggle,
.oto-app-drawer-backdrop,
.oto-app-drawer-close {
    display: none;
}

.oto-app-drawer-toggle {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 96;
    box-sizing: border-box;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 16px;
    color: var(--oto-ink);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(188, 198, 212, 0.92);
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(18, 31, 45, 0.12);
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.oto-app-drawer-toggle i,
.oto-app-drawer-close i {
    font-size: 15px;
}

.oto-app-drawer-toggle:hover,
.oto-app-drawer-toggle:focus-visible,
.oto-app-drawer-close:hover,
.oto-app-drawer-close:focus-visible {
    outline: none;
    border-color: rgba(47, 127, 167, 0.34);
    box-shadow: 0 12px 26px rgba(18, 31, 45, 0.16);
}

.oto-app-drawer-close {
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-left: auto;
    color: var(--oto-ink);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(188, 198, 212, 0.92);
    border-radius: 999px;
    cursor: pointer;
}

.oto-app-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 89;
    background: rgba(15, 22, 35, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.oto-app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--oto-app-sidebar-width);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 254, 0.98) 100%);
    border-right: 1px solid var(--oto-app-sidebar-line);
    box-shadow: var(--oto-app-sidebar-shadow);
    overflow-y: auto;
    z-index: 80;
}

.oto-app-sidebar-shell {
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px var(--oto-app-sidebar-pad) 20px;
}

.oto-app-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    box-sizing: border-box;
    padding: 4px 6px;
    color: inherit;
    text-decoration: none;
}

.oto-app-brand .oto-brand-wordmark {
    width: 184px;
    max-width: 100%;
    height: auto;
    display: block;
}

.oto-app-nav {
    display: grid;
    gap: 10px;
}

.oto-app-link {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    padding: 0 15px;
    color: var(--oto-ink);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--oto-line-strong);
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(18, 31, 45, 0.03);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.oto-app-link i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.oto-app-link:hover,
.oto-app-link:focus-visible {
    color: var(--oto-ink);
    background: #ffffff;
    border-color: rgba(47, 127, 167, 0.34);
    box-shadow: 0 8px 18px rgba(18, 31, 45, 0.08);
    transform: translateY(-1px);
    outline: none;
}

.oto-app-link-current {
    color: var(--oto-accent-strong);
    background: rgba(47, 127, 167, 0.1);
    border-color: rgba(47, 127, 167, 0.18);
    box-shadow: none;
}

.oto-app-link-current:hover,
.oto-app-link-current:focus-visible {
    background: rgba(47, 127, 167, 0.14);
    border-color: rgba(47, 127, 167, 0.24);
    box-shadow: none;
}

.oto-app-link-primary {
    color: #ffffff;
    background: linear-gradient(135deg, #55b4df 0%, #f0a8df 100%);
    border-color: transparent;
    box-shadow: 0 12px 26px rgba(85, 180, 223, 0.18);
}

.oto-app-link-primary:hover,
.oto-app-link-primary:focus-visible {
    color: #ffffff;
    background: linear-gradient(135deg, #43a9d8 0%, #eb97d7 100%);
    border-color: transparent;
    box-shadow: 0 16px 28px rgba(85, 180, 223, 0.22);
}

.oto-app-link-secondary {
    color: #3b4b62;
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(201, 212, 226, 0.95);
}

.oto-app-login {
    color: #ffffff;
    background: #5865f2;
    border-color: #5865f2;
    box-shadow: 0 10px 22px rgba(88, 101, 242, 0.16);
}

.oto-app-login:hover,
.oto-app-login:focus-visible {
    color: #ffffff;
    background: #4752c4;
    border-color: #4752c4;
}

.oto-app-sidebar-bottom {
    display: grid;
    gap: 12px;
    margin-top: auto;
}

.oto-app-profile {
    display: grid;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--oto-line);
    border-radius: 16px;
    box-shadow: var(--oto-app-card-shadow);
}

.oto-app-profile-linkable {
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.oto-app-profile-linkable:hover,
.oto-app-profile-linkable:focus-visible {
    background: #ffffff;
    border-color: rgba(47, 127, 167, 0.34);
    box-shadow: 0 10px 22px rgba(18, 31, 45, 0.1);
    transform: translateY(-1px);
    outline: none;
}

.oto-app-profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
    box-shadow: 0 0 0 1px rgba(188, 198, 212, 0.88);
}

.oto-app-profile-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding-top: 10px;
}

.oto-app-profile-main {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.oto-app-profile-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.oto-app-profile-name {
    max-width: none;
    color: var(--oto-ink);
    font-size: 14px;
    font-weight: 700;
}

.oto-admin-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(233, 84, 84, 0.1);
    border: 1px solid rgba(233, 84, 84, 0.22);
    color: #b23a3a;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

.oto-admin-badge[hidden] {
    display: none;
}

.oto-app-profile .oto-admin-badge {
    min-height: 20px;
    padding: 0 8px;
    font-size: 10px;
    letter-spacing: 0.1em;
}

.oto-app-credit-link {
    display: grid;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
    padding: 2px 0 10px;
    border-bottom: 1px solid rgba(188, 198, 212, 0.58);
    color: var(--oto-accent-strong);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.oto-app-credit-label {
    color: var(--oto-quiet);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.oto-app-credit-value {
    color: var(--oto-accent-strong);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
}

.oto-app-credit-link:hover,
.oto-app-credit-link:focus-visible {
    color: var(--oto-accent-strong);
    text-decoration: none;
    outline: none;
}

.oto-app-credit-link.is-current {
    border-bottom-color: rgba(47, 127, 167, 0.22);
}

.oto-app-credit-link.is-current:hover,
.oto-app-credit-link.is-current:focus-visible {
    text-decoration: none;
    border-bottom-color: rgba(47, 127, 167, 0.3);
}

.oto-app-credit-link.is-empty .oto-app-credit-value {
    color: var(--oto-accent);
}

.oto-app-main {
    min-width: 0;
    margin-left: var(--oto-app-sidebar-width);
    padding: 28px 34px 34px;
}

.oto-app-main > .loading-state,
.oto-app-main > .auth-gate {
    width: min(var(--oto-shell-width), calc(100% - 8px));
    margin-left: auto;
    margin-right: auto;
}

body.oto-app-drawer-open {
    overflow: hidden;
}

@media (max-width: 980px) {
    .oto-app-drawer-toggle,
    .oto-app-drawer-backdrop,
    .oto-app-drawer-close {
        display: inline-flex;
    }

    .oto-app-drawer-toggle {
        top: 12px;
        left: 12px;
        min-height: 44px;
        padding: 0 15px;
    }

    .oto-app-drawer-backdrop {
        display: block;
    }

    .oto-app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(var(--oto-app-sidebar-width), calc(100vw - 28px));
        max-width: 320px;
        border-right: 1px solid var(--oto-app-sidebar-line);
        border-bottom: 0;
        box-shadow: var(--oto-app-sidebar-shadow);
        overflow-y: auto;
        transform: translateX(calc(-100% - 20px));
        transition: transform 0.24s ease;
        z-index: 90;
    }

    .oto-app-sidebar-shell {
        min-height: 100dvh;
        gap: 14px;
        padding: 18px var(--oto-mobile-gutter) 18px;
    }

    .oto-app-nav {
        grid-template-columns: 1fr;
    }

    .oto-app-link {
        min-height: 50px;
        border-radius: 16px;
    }

    .oto-app-sidebar-bottom {
        gap: 10px;
        margin-top: 0;
    }

    .oto-app-profile {
        border-radius: var(--oto-mobile-surface-radius);
    }

    .oto-app-main {
        margin-left: 0;
        padding: 74px var(--oto-mobile-gutter) 26px;
    }

    .oto-app-main > .loading-state,
    .oto-app-main > .auth-gate {
        width: min(var(--oto-shell-width), 100%);
    }

    body.oto-app-drawer-open .oto-app-sidebar {
        transform: translateX(0);
    }

    body.oto-app-drawer-open .oto-app-drawer-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 720px) {
    .oto-app-drawer-toggle {
        top: 10px;
        left: 10px;
    }

    .oto-app-sidebar {
        width: min(var(--oto-app-sidebar-width), calc(100vw - 20px));
    }

    .oto-app-main {
        padding: 70px 18px 22px;
    }

    .oto-app-brand .oto-brand-wordmark {
        width: 160px;
    }
}

@media (max-width: 560px) {
    .oto-app-nav {
        grid-template-columns: 1fr;
    }
}
