/* Work OS page assistant panel */

.agent-panel-root {
    position: fixed;
    right: calc(1rem + env(safe-area-inset-right));
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 2200;
    font-family: 'Archivo', var(--font);
    --ap-panel: #eeeeef;
    --ap-header: #e7e7e8;
    --ap-message: #e6e6e7;
    --ap-input: #dededf;
    --ap-icon: #29292b;
    --ap-title: #2f3033;
    --ap-body: #4d4e52;
    --ap-muted: #9a9a9d;
    --ap-border: rgba(255, 255, 255, 0.72);
}

.agent-panel-root--above-style-panel {
    bottom: calc(4.75rem + env(safe-area-inset-bottom));
}

.agent-panel-root--open {
    bottom: calc(1rem + env(safe-area-inset-bottom));
}

.agent-panel-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #8f8f92;
    background: #e2e2e3;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.68);
    cursor: pointer;
    transition: transform 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.agent-panel-root--open .agent-panel-toggle {
    display: none;
}

.agent-panel-toggle:hover {
    color: #5f6064;
    transform: translateY(-1px);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.agent-panel-toggle svg {
    width: 18px;
    height: 18px;
}

.agent-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(344px, calc(100vw - 2rem));
    height: min(548px, calc(100vh - 7rem));
    min-height: 400px;
    border: 1px solid var(--ap-border);
    border-radius: 10px;
    background: var(--ap-panel);
    color: var(--ap-body);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.24), 0 8px 22px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.agent-panel[hidden] {
    display: none;
}

.agent-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 78px;
    padding: 18px 24px;
    background: var(--ap-header);
}

.agent-panel-title {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.agent-panel-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--ap-icon);
    flex: 0 0 auto;
}

.agent-panel-avatar img {
    width: 17px;
    height: 17px;
    display: block;
    filter: brightness(0) invert(1);
    transform: translate(0.5px, 6.5px);
}

.agent-panel-title strong {
    display: block;
    color: var(--ap-title);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.1;
}

.agent-panel-title span {
    display: block;
    margin-top: 4px;
    color: var(--ap-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.15;
}

.agent-panel-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #9a9a9c;
    background: transparent;
    cursor: pointer;
}

.agent-panel-close:hover {
    color: #6f7074;
    background: rgba(0, 0, 0, 0.035);
}

.agent-panel-close svg {
    width: 17px;
    height: 17px;
}

.agent-panel-messages {
    flex: 1 1 auto;
    min-height: 0;
    padding: 18px 24px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    background: var(--ap-panel);
}

.agent-panel-message {
    max-width: 86%;
    padding: 14px 17px;
    border-radius: 9px;
    color: var(--ap-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42;
    word-break: break-word;
}

.agent-panel-message p {
    margin: 0 0 0.45rem;
}

.agent-panel-message p:last-child,
.agent-panel-message ul:last-child {
    margin-bottom: 0;
}

.agent-panel-message ul {
    margin: 0.35rem 0 0.45rem 1rem;
    padding: 0;
}

.agent-panel-message li {
    margin: 0.2rem 0;
}

.agent-panel-message--assistant {
    align-self: flex-start;
    background: var(--ap-message);
}

.agent-panel-message--user {
    align-self: flex-end;
    color: #ffffff;
    background: #2f3033;
}

.agent-panel-thinking {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--ap-muted);
    font-size: 13px;
    padding: 9px 12px;
    border-radius: 999px;
    background: var(--ap-message);
}

.agent-panel-thinking span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: agent-panel-pulse 1s ease-in-out infinite;
}

.agent-panel-thinking span:nth-child(2) { animation-delay: 0.15s; }
.agent-panel-thinking span:nth-child(3) { animation-delay: 0.3s; }

@keyframes agent-panel-pulse {
    0%, 100% { opacity: 0.35; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-2px); }
}

.agent-panel-composer {
    padding: 16px 18px;
    background: var(--ap-header);
}

.agent-panel-attachment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 12px;
    padding: 9px 12px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    color: #77787c;
    background: var(--ap-message);
    font-size: 13px;
}

.agent-panel-attachment[hidden] {
    display: none;
}

.agent-panel-attachment button {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #8e8e91;
    background: transparent;
    cursor: pointer;
}

.agent-panel-attachment button:hover {
    color: #5f6064;
    background: rgba(0, 0, 0, 0.04);
}

.agent-panel-input-row {
    display: flex;
    align-items: center;
    gap: 0;
    border: 0;
    border-radius: 999px;
    min-height: 48px;
    padding: 4px;
    background: var(--ap-input);
    transition: box-shadow 0.16s ease, background 0.16s ease;
}

.agent-panel-input-row:focus-within,
.agent-panel-input-row.is-drag-over {
    box-shadow: none;
}

.agent-panel.is-drag-over .agent-panel-messages {
    background: #e9e9ea;
}

.agent-panel-icon-btn {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: #9a9a9d;
    background: transparent;
    cursor: pointer;
}

.agent-panel-icon-btn:hover {
    color: #6f7074;
    background: rgba(0, 0, 0, 0.04);
}

.agent-panel-icon-btn svg {
    width: 17px;
    height: 17px;
}

.agent-panel-icon-btn#agent-panel-upload {
    color: #ffffff;
    background: var(--ap-icon);
}

.agent-panel-icon-btn#agent-panel-upload:hover {
    color: #ffffff;
    background: #1f1f21;
}

.agent-panel-send {
    color: #9a9a9d;
    background: transparent;
}

.agent-panel-send:hover {
    color: #6f7074;
    background: rgba(0, 0, 0, 0.04);
}

.agent-panel-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.agent-panel-input {
    flex: 1 1 auto;
    min-width: 0;
    max-height: 120px;
    border: 0;
    resize: none;
    outline: none;
    color: var(--ap-title);
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.35;
    padding: 10px 8px;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

.agent-panel-input::placeholder {
    color: #8e8e91;
    opacity: 1;
}

.agent-panel-input:focus,
.agent-panel-input:focus-visible {
    outline: none;
    border-color: transparent;
    box-shadow: none;
}

.agent-panel-note {
    display: none;
}

.agent-panel-file-input {
    display: none;
}

@media (max-width: 640px) {
    .agent-panel-root {
        right: calc(0.75rem + env(safe-area-inset-right));
        bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }

    .agent-panel {
        width: calc(100vw - 1.5rem);
        height: min(548px, calc(100vh - 6.5rem));
        min-height: 380px;
    }

    .agent-panel-header {
        min-height: 76px;
        padding: 18px 22px;
    }

    .agent-panel-messages {
        padding: 18px 22px 14px;
    }

    .agent-panel-composer {
        padding: 16px 18px;
    }

    .agent-panel-input {
        font-size: 14px;
    }
}
