/* Personal Agent entry: shares the server-gated access and saved persona. */
.sidebar-agent-entry{text-decoration:none;min-width:0}
.sidebar-agent-entry[hidden]{display:none!important}

/* Mobile partner dock: a personal avatar occupies the center navigation slot. */
.mobile-agent-entry { display: none; border: 0; padding: 0; background: transparent; font: inherit; cursor: pointer; appearance: none; }
@media (max-width: 760px) {
    body:not(.workbench-open) .app-main {
        height: calc(100svh - 92px - env(safe-area-inset-bottom));
    }
    body.agent-view-open:not(.workbench-open) .app-main {
        height: var(--agent-shell-height, calc(100svh - 92px - env(safe-area-inset-bottom)));
    }
    body.agent-view-open.agent-keyboard-open .mobile-nav { display: none; }
    .app-page .mobile-nav {
        left: max(12px, env(safe-area-inset-left));
        right: max(12px, env(safe-area-inset-right));
        bottom: calc(10px + env(safe-area-inset-bottom));
        height: 70px;
        padding: 7px 5px;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        align-items: start;
        border: 1px solid rgba(255, 255, 255, .9);
        border-radius: 28px;
        background: rgba(251, 251, 254, .94);
        -webkit-backdrop-filter: blur(22px) saturate(1.15);
        backdrop-filter: blur(22px) saturate(1.15);
        box-shadow: 0 8px 28px rgba(37, 43, 72, .1), 0 0 0 1px rgba(78, 91, 153, .07);
        overflow: visible;
    }
    .app-page.has-agent-access .mobile-nav { grid-template-columns: 1fr 1fr 1.08fr 1fr 1fr; }
    .app-page .mobile-nav .nav-item {
        position: relative;
        min-width: 0;
        min-height: 54px;
        gap: 6px;
        border-radius: 17px;
        background: transparent;
        color: #747887;
        font-size: 10px;
        font-weight: 500;
        transition: color .18s ease, background .18s ease, transform .18s ease;
    }
    .app-page .mobile-nav .nav-item svg { width: 21px; height: 21px; }
    .app-page .mobile-nav .nav-item.is-active { color: #4e5b99; background: #e9edf7; }
    .app-page .mobile-nav .nav-item.is-active svg { stroke: #4e5b99; }
    .app-page .mobile-nav .nav-item:active { transform: scale(.95); background: #e5e9f3; }
    .mobile-agent-entry {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        min-width: 0;
        height: 74px;
        margin-top: -17px;
        text-decoration: none;
        color: #48568f;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    .mobile-agent-orb {
        position: relative;
        display: grid;
        place-items: center;
        flex-shrink: 0;
        width: 52px;
        height: 52px;
        border: 0;
        border-radius: 50%;
        background: #e9eafa;
        box-shadow: 0 3px 10px rgba(78, 91, 153, .13);
        transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s ease;
    }
    .mobile-agent-orb img { width: 52px; height: 52px; object-fit: contain; border-radius: 0; background: transparent; mix-blend-mode: normal; filter: none; display: block; }
    .mobile-agent-orb::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .42);
        pointer-events: none;
    }
    .mobile-agent-label { margin-top: 5px; font-size: 10px; line-height: 15px; font-weight: 500; letter-spacing: .025em; }
    .mobile-agent-entry:active .mobile-agent-orb { transform: translateY(2px) scale(.94); box-shadow: 0 1px 3px rgba(10, 9, 22, .12); }
    .mobile-agent-entry:focus-visible { outline: 2px solid #4e5b99; outline-offset: 3px; border-radius: 24px; }
    .mobile-agent-entry[hidden] { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .mobile-agent-orb, .app-page .mobile-nav .nav-item { transition: none; }
}


.app-page .sidebar-agent-entry > img { width:30px;height:30px;flex:0 0 30px;margin:-5px;object-fit:contain; }

/* Agent owns its header. The old standalone topbar is hidden; only the system
   safe area belongs above the embedded conversation, once. */
@media (max-width:760px) {
    body.agent-view-open:not(.workbench-open) .app-main,
    html.is-standalone body.agent-view-open:not(.workbench-open) .app-main {
        box-sizing: border-box;
        padding-top: env(safe-area-inset-top, 0px);
        min-height: 0;
        height: var(--agent-shell-height, calc(100svh - 92px - env(safe-area-inset-bottom)));
        overflow: hidden;
    }
}

/* The conversation, system safe areas and space around the dock share one
   warm paper surface. Other app views retain their own theme. */
html.agent-surface-open, html.agent-surface-open body.app-page, body.agent-view-open {
    --agent-paper: #faf9f7;
    background: var(--agent-paper);
}
body.agent-view-open .app-shell, body.agent-view-open .app-main {
    background: var(--agent-paper);
}
@media (max-width:760px) {
    body.agent-view-open .mobile-nav {
        background: var(--agent-paper);
        border-color: rgba(80, 72, 63, .09);
        box-shadow: 0 8px 28px rgba(52, 45, 35, .08);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* Safari samples a real viewport-attached element for its top chrome; the
   embedded header cannot provide that parent-page edge. No layout space. */
#agent-top-surface { display: none; pointer-events: none; }
html.agent-surface-open .app-loader { background: var(--agent-paper); }
@media (max-width:760px) {
    html.agent-surface-open #agent-top-surface {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: max(12px, env(safe-area-inset-top, 0px));
        z-index: 90;
        background: var(--agent-paper);
    }
}
