.c365-ai-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1032;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(0px);
    background: rgba(2, 6, 10, 0);
    transition: opacity 180ms ease, backdrop-filter 180ms ease, background-color 180ms ease;
}

.c365-ai-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
    backdrop-filter: blur(2px);
    background: rgba(2, 8, 14, 0.2);
}

.c365-ai-toggle {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1034;
    border: 1px solid rgba(72, 208, 226, 0.52);
    border-radius: 999px;
    padding: 0.58rem 0.88rem;
    color: #d0f5ff;
    background: linear-gradient(130deg, rgba(4, 34, 48, 0.96), rgba(6, 42, 62, 0.96));
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.32);
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 150ms ease, box-shadow 180ms ease;
}

.c365-ai-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.38);
}

.c365-ai-toggle:focus-visible,
.c365-ai-close:focus-visible,
.c365-ai-prompt-chip:focus-visible,
.c365-ai-voice-control:focus-visible,
.c365-ai-send:focus-visible,
.c365-ai-stop:focus-visible,
.c365-ai-input:focus-visible {
    outline: 2px solid var(--c365-focus, rgba(72, 208, 226, 0.72));
    outline-offset: 2px;
}

.c365-ai-panel {
    position: fixed;
    top: var(--c365-header-height, 0px);
    right: 0;
    width: min(520px, 100vw);
    height: calc(100dvh - var(--c365-header-height, 0px));
    z-index: 1035;
    display: flex;
    flex-direction: column;
    gap: 0.52rem;
    padding: 0.62rem;
    padding-bottom: calc(0.62rem + env(safe-area-inset-bottom, 0px));
    border-left: 1px solid rgba(105, 156, 184, 0.38);
    background:
        radial-gradient(580px 280px at 12% -8%, rgba(38, 145, 185, 0.20), transparent 62%),
        radial-gradient(420px 240px at 96% 100%, rgba(39, 105, 167, 0.2), transparent 64%),
        linear-gradient(180deg, rgba(4, 13, 21, 0.98), rgba(3, 11, 17, 0.99));
    box-shadow: -20px 0 42px rgba(0, 0, 0, 0.45);
    transform: translateX(104%);
    transition: transform 220ms ease;
    visibility: hidden;
    pointer-events: none;

    --c365-scrollbar-track: rgba(7, 26, 38, 0.72);
    --c365-scrollbar-thumb: rgba(102, 164, 196, 0.62);
    --c365-scrollbar-thumb-hover: rgba(72, 208, 226, 0.68);
}

.c365-ai-panel.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
}

.c365-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.58rem;
    min-height: 74px;
    padding: 0.24rem 0.1rem 0.06rem;
}

.c365-ai-brand {
    display: grid;
    gap: 0.15rem;
}

.c365-ai-brand__title {
    color: #f0fbff;
    font-family: "Sora", "Manrope", sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.c365-ai-brand__status {
    color: #9fb7c5;
    font-size: 0.72rem;
}

.c365-ai-close {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(130, 177, 201, 0.44);
    border-radius: 10px;
    color: #d2e6f1;
    background: rgba(11, 31, 41, 0.75);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease;
}

.c365-ai-close:hover {
    border-color: rgba(72, 208, 226, 0.62);
    background: rgba(8, 44, 58, 0.88);
}

.c365-ai-usage {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 0.18rem 0.5rem;
    border: 1px solid rgba(116, 174, 202, 0.35);
    border-radius: 999px;
    color: #b7cedb;
    background: rgba(10, 28, 36, 0.72);
    font-size: 0.7rem;
    letter-spacing: 0.01em;
}

.c365-ai-usage-warn {
    border: 1px solid rgba(147, 116, 42, 0.6);
    border-radius: 10px;
    padding: 0.42rem 0.55rem;
    background: rgba(47, 35, 13, 0.8);
    color: #ecd9aa;
    font-size: 0.76rem;
}

.c365-ai-context {
    border: 1px solid rgba(116, 174, 202, 0.34);
    border-radius: 10px;
    padding: 0.48rem 0.54rem;
    background: rgba(7, 24, 34, 0.68);
}

.c365-ai-context__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    color: #e7f6ff;
    font-size: 0.72rem;
    font-weight: 700;
}

.c365-ai-context__clear {
    border: 0;
    display: inline-grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    margin: -0.35rem -0.35rem -0.35rem 0;
    padding: 0;
    border-radius: 50%;
    color: #91c8e2;
    background: transparent;
    font-size: 1.35rem;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.c365-ai-context__toggle {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    text-align: left;
}

.c365-ai-context__toggle-icon { display: none; }

.c365-ai-context__clear:hover,
.c365-ai-context__clear:focus-visible {
    color: #e7f6ff;
    background: rgba(145, 200, 226, 0.12);
}

.c365-ai-context__body {
    display: grid;
    gap: 0.12rem;
    margin-top: 0.34rem;
    color: #b7cedb;
    font-size: 0.72rem;
    line-height: 1.28;
}

.c365-ai-context__row {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: start;
    gap: 0.65rem;
}

.c365-ai-context__row--secondary {
    opacity: .72;
}

.c365-ai-context__label {
    color: #7ea6ba;
    white-space: nowrap;
}

.c365-ai-context__value {
    color: #e7f6ff;
    text-align: right;
    overflow-wrap: anywhere;
}

.c365-ai-change-request {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    margin-top: 0.55rem;
    border: 1px solid rgba(95, 166, 194, 0.42);
    border-radius: 10px;
    padding: 0.58rem;
    background: rgba(7, 24, 34, 0.72);
    color: #d9ebf4;
    font-size: 0.76rem;
}

.c365-ai-change-request__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    font-weight: 800;
    color: #f0fbff;
}

.c365-ai-change-request__title {
    display: block;
    margin-top: 0.55rem;
    color: #58d8f2;
    font-size: 0.82rem;
}

.c365-ai-change-request__details {
    display: grid;
    gap: 0.34rem;
    margin: 0.65rem 0 0;
}

.c365-ai-change-request__detail {
    display: grid;
    grid-template-columns: minmax(82px, 0.38fr) minmax(0, 1fr);
    gap: 0.55rem;
}

.c365-ai-change-request__detail dt {
    color: #88a9b8;
    font-weight: 600;
}

.c365-ai-change-request__detail dd {
    min-width: 0;
    margin: 0;
    color: #e3f0f5;
    overflow-wrap: anywhere;
}

.c365-ai-change-request__detail.is-secondary dd {
    color: #91a4ae;
}

.c365-ai-change-request__detail.is-warning dd {
    color: #ffb7b7;
}

.c365-ai-change-request__meta,
.c365-ai-change-request__summary,
.c365-ai-change-request__result {
    min-width: 0;
    margin-top: 0.38rem;
    color: #b7cedb;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.c365-ai-change-request__result--error {
    color: #ffb7b7;
}

.c365-ai-change-request__preview {
    margin-top: 0.45rem;
}

.c365-ai-change-request__preview summary {
    cursor: pointer;
    color: #91c8e2;
    font-weight: 700;
}

.c365-ai-change-request__preview pre {
    max-height: 180px;
    overflow: auto;
    margin: 0.38rem 0 0;
    border: 1px solid rgba(116, 174, 202, 0.26);
    border-radius: 8px;
    padding: 0.48rem;
    background: rgba(2, 10, 16, 0.62);
    white-space: pre-wrap;
    word-break: break-word;
}

.c365-ai-change-request__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.36rem;
    margin-top: 0.55rem;
}

.c365-ai-change-request__actions button {
    border: 1px solid rgba(116, 174, 202, 0.38);
    border-radius: 8px;
    padding: 0.26rem 0.5rem;
    color: #e7f6ff;
    background: rgba(15, 45, 58, 0.84);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.c365-ai-change-request__evidence {
    margin-top: .65rem;
    padding: .7rem;
    border: 1px solid rgba(59, 205, 231, .28);
    border-radius: .7rem;
    background: rgba(7, 19, 27, .72);
    color: #d7edf4;
}

.c365-ai-change-request__evidence > div {
    margin-top: .35rem;
}

.c365-ai-change-request__metric {
    display: inline-flex;
    align-items: baseline;
    gap: .25rem;
    margin-left: .5rem;
    color: #f5fbfd;
    font-size: 1.45rem;
    font-weight: 700;
}

.c365-ai-change-request__metric small {
    color: #9fc3cf;
    font-size: .72em;
    font-weight: 600;
}

.c365-ai-change-request__actions button:hover {
    border-color: rgba(72, 208, 226, 0.62);
}

.c365-ai-change-request__actions button:disabled {
    cursor: default;
    opacity: 0.72;
}

.c365-ai-change-request__actions button.is-busy {
    border-color: rgba(72, 208, 226, 0.68);
    background: rgba(8, 60, 78, 0.92);
    color: #f1fbff;
}

.c365-ai-change-request__result--action {
    color: #9fd5ea;
}

.c365-ai-action-invitation {
    margin-top: .85rem;
    color: var(--c365-accent, #48d0e2);
    font: inherit;
    font-weight: 700;
}
.c365-ai-response-actions {
    display: grid;
    grid-template-columns: minmax(0, max-content);
    justify-items: start;
    gap: .55rem;
    width: 100%;
    margin-top: .8rem;
}
.c365-ai-response-actions button {
    max-width: 100%;
    min-height: 2.35rem;
    border-radius: .55rem;
    padding: .48rem .8rem;
    font: inherit;
    font-weight: 700;
}
.c365-ai-response-actions button.is-primary { background: var(--c365-accent, #48d0e2); color: #07131b; border: 1px solid var(--c365-accent, #48d0e2); }
.c365-ai-response-actions button.is-secondary { background: transparent; color: #dff8ff; border: 1px solid color-mix(in srgb, var(--c365-accent, #48d0e2) 62%, transparent); }
.c365-ai-response-actions button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.c365-ai-import-destinations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.45rem;
    width: 100%;
}

.c365-ai-import-destinations a,
.c365-ai-import-destinations button {
    display: grid;
    gap: 0.2rem;
    min-height: 68px;
    padding: 0.65rem;
    border: 1px solid rgba(116, 174, 202, 0.38);
    border-radius: 10px;
    color: #e7f6ff;
    background: rgba(15, 45, 58, 0.84);
    text-decoration: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.c365-ai-import-destinations a:hover,
.c365-ai-import-destinations a:focus-visible,
.c365-ai-import-destinations button:hover,
.c365-ai-import-destinations button:focus-visible {
    border-color: #4bd3e7;
    outline: 2px solid transparent;
}

.c365-ai-import-destinations a.is-primary {
    border-color: #4bd3e7;
    background: rgba(14, 96, 119, 0.9);
}

.c365-ai-import-destinations span {
    font-size: 0.75rem;
    font-weight: 800;
}

.c365-ai-import-destinations small {
    color: #a9c7d2;
    font-size: 0.65rem;
    line-height: 1.3;
}

@media (max-width: 640px) {
    .c365-ai-import-destinations { grid-template-columns: 1fr; }
    .c365-ai-import-destinations a,
    .c365-ai-import-destinations button { min-height: 54px; }
}

@media (prefers-reduced-motion: no-preference) {
    .c365-ai-import-destinations { animation: c365-import-destinations-in 180ms ease-out both; }
}

@keyframes c365-import-destinations-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.c365-ai-prompts {
    display: flex;
    gap: 0.32rem;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding-bottom: 0.08rem;
    scrollbar-width: thin;
    scrollbar-color: var(--c365-scrollbar-thumb) var(--c365-scrollbar-track);
}

.c365-ai-prompts::-webkit-scrollbar {
    height: 8px;
}

.c365-ai-prompts::-webkit-scrollbar-track {
    background: var(--c365-scrollbar-track);
    border-radius: 999px;
}

.c365-ai-prompts::-webkit-scrollbar-thumb {
    background: var(--c365-scrollbar-thumb);
    border-radius: 999px;
}

.c365-ai-prompts::-webkit-scrollbar-thumb:hover {
    background: var(--c365-scrollbar-thumb-hover);
}

.c365-ai-panel.c365-ai-prompts-collapsed .c365-ai-prompts {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    pointer-events: none;
}

.c365-ai-prompt-chip {
    border: 1px solid rgba(113, 166, 190, 0.4);
    border-radius: 999px;
    background: rgba(8, 30, 41, 0.76);
    color: #cde2ee;
    font-size: 0.7rem;
    line-height: 1;
    padding: 0.34rem 0.54rem;
    cursor: pointer;
    transition: transform 130ms ease, border-color 150ms ease, background-color 150ms ease;
}

.c365-ai-prompt-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(72, 208, 226, 0.58);
    background: rgba(8, 44, 60, 0.88);
}

.c365-ai-empty-state {
    border: 1px solid rgba(110, 163, 190, 0.28);
    border-radius: 14px;
    padding: 0.62rem 0.66rem;
    background: rgba(7, 24, 34, 0.62);
}

.c365-ai-empty-state__title {
    margin: 0 0 0.36rem;
    color: #e7f6ff;
    font-size: 0.86rem;
    font-weight: 700;
}

.c365-ai-empty-state__copy {
    margin: 0 0 0.5rem;
    color: #9eb8c8;
    font-size: 0.76rem;
    line-height: 1.32;
}

.c365-ai-empty-state__prompts {
    display: flex;
    gap: 0.38rem;
    flex-wrap: wrap;
}

.c365-ai-thread {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.48rem;
    padding: 0.18rem 0.08rem var(--c365-ai-composer-clearance, 5.5rem);
    scroll-padding-bottom: var(--c365-ai-composer-clearance, 5.5rem);
    scrollbar-width: thin;
    scrollbar-color: var(--c365-scrollbar-thumb) var(--c365-scrollbar-track);
}

.c365-ai-thread::-webkit-scrollbar {
    width: 10px;
}

.c365-ai-thread::-webkit-scrollbar-track {
    background: var(--c365-scrollbar-track);
    border-radius: 999px;
}

.c365-ai-thread::-webkit-scrollbar-thumb {
    background: var(--c365-scrollbar-thumb);
    border-radius: 999px;
    border: 2px solid rgba(4, 14, 22, 0.78);
}

.c365-ai-thread::-webkit-scrollbar-thumb:hover {
    background: var(--c365-scrollbar-thumb-hover);
}

.c365-ai-message {
    display: flex;
    max-width: 90%;
    gap: 0.36rem;
}

.c365-ai-message-user {
    align-self: flex-end;
    justify-content: flex-end;
}

.c365-ai-message-assistant {
    align-self: flex-start;
}

.c365-ai-avatar {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 999px;
    border: 1px solid rgba(72, 208, 226, 0.48);
    background: rgba(8, 50, 68, 0.88);
    color: #d4f4fc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.54rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

.c365-ai-bubble {
    border: 1px solid rgba(108, 160, 186, 0.3);
    border-radius: 12px;
    padding: 0.44rem 0.54rem;
    background: rgba(7, 24, 34, 0.78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.c365-ai-message-user .c365-ai-bubble {
    border-color: rgba(72, 208, 226, 0.35);
    background: linear-gradient(140deg, rgba(8, 55, 74, 0.96), rgba(10, 68, 90, 0.96));
}

.c365-ai-message-assistant.c365-ai-message--setup-pulse {
    padding: 0.7rem;
    border: 1px solid rgba(72, 208, 226, 0.28);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(11, 34, 45, 0.68), rgba(7, 24, 34, 0.42));
    box-shadow: 0 0 0 1px rgba(72, 208, 226, 0.08), 0 0 1rem rgba(29, 184, 220, 0.11);
}

@media (prefers-reduced-motion: no-preference) {
    .c365-ai-message-assistant.c365-ai-message--setup-pulse {
        animation: c365-setup-pulse 1.6s ease-in-out 3;
    }
}

@keyframes c365-setup-pulse {
    0%, 100% {
        border-color: rgba(72, 208, 226, 0.24);
        box-shadow: 0 0 0 1px rgba(72, 208, 226, 0.06), 0 0 0.9rem rgba(29, 184, 220, 0.08);
    }
    50% {
        border-color: rgba(72, 208, 226, 0.48);
        box-shadow: 0 0 0 1px rgba(72, 208, 226, 0.16), 0 0 1.35rem rgba(29, 184, 220, 0.2);
    }
}

.c365-ai-data-preview {
    display: grid;
    gap: .55rem;
    margin: .75rem 0;
    padding: .85rem;
    border: 1px solid var(--c365-border-subtle, rgba(122, 188, 215, .22));
    border-radius: .75rem;
    background: var(--c365-surface-raised, rgba(255, 255, 255, .025));
}

.c365-ai-data-preview > header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .75rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--c365-border-subtle, rgba(122, 188, 215, .16));
}

.c365-ai-data-preview > header span {
    color: var(--c365-text-muted, #8799a2);
    font-size: .68rem;
}

.c365-ai-data-preview__field {
    display: grid;
    gap: .28rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--c365-border-subtle, rgba(122, 188, 215, .16));
}

.c365-ai-data-preview__field:last-child { padding-bottom: 0; border-bottom: 0; }
.c365-ai-data-preview__field label {
    display: flex;
    justify-content: space-between;
    gap: .65rem;
    color: #e7f6ff;
    font-weight: 650;
}
.c365-ai-data-preview__field label small,
.c365-ai-data-preview__type {
    color: var(--c365-text-muted, #8799a2);
    font-size: .66rem;
    font-weight: 500;
}
.c365-ai-data-preview__field p { margin: 0; color: var(--c365-text-muted, #8799a2); font-size: .7rem; }
.c365-ai-data-preview__control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    min-height: 2rem;
    padding: .4rem .5rem;
    border: 1px solid rgba(116, 174, 202, .32);
    border-radius: .45rem;
    background: rgba(5, 17, 25, .72);
    color: #8fa6b2;
}
.c365-ai-data-preview__control small { color: #b8d2df; }

.c365-ai-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.2rem;
    color: #8eaaba;
    font-size: 0.61rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.c365-ai-assistant-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.18rem;
    color: #8eaaba;
    font-size: 0.61rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.c365-ai-meta__time {
    margin-left: auto;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.64rem;
}

.c365-ai-content {
    color: #deedf5;
    font-size: 0.81rem;
    line-height: 1.42;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.c365-ai-content blockquote {
    margin: 0 0 .42rem;
    padding: .1rem 0 .1rem .65rem;
    border-left: 2px solid rgba(72, 208, 226, .5);
    color: #b7cedb;
}

.c365-ai-recovery-action { margin-top: .5rem; }
.c365-ai-recovery-action button {
    border: 1px solid rgba(72, 208, 226, .55);
    border-radius: 8px;
    padding: .38rem .62rem;
    color: #e7f6ff;
    background: rgba(8, 55, 74, .86);
    font: inherit;
    cursor: pointer;
}

.c365-ai-thinking {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    margin: 0.04rem 0 0.16rem;
}

.c365-ai-thinking-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(171, 210, 229, 0.85);
    animation: c365-ai-thinking-dot 1.2s ease-in-out infinite;
}

.c365-ai-thinking-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.c365-ai-thinking-dot:nth-child(3) {
    animation-delay: 0.3s;
}

.c365-ai-content p,
.c365-ai-content ul,
.c365-ai-content ol {
    margin: 0 0 0.42rem;
}

.c365-ai-content p:last-child,
.c365-ai-content ul:last-child,
.c365-ai-content ol:last-child {
    margin-bottom: 0;
}

.c365-ai-content ul,
.c365-ai-content ol {
    padding-left: 1rem;
}

.c365-ai-content a {
    color: #7de4f2;
    text-decoration: underline;
    text-decoration-color: rgba(72, 208, 226, 0.48);
}

.c365-ai-content code {
    font-family: "JetBrains Mono", Consolas, "Courier New", monospace;
    font-size: 0.74rem;
    border-radius: 6px;
    padding: 0.03rem 0.26rem;
    background: rgba(21, 43, 55, 0.86);
    color: #d7f0ff;
}

.c365-ai-code-wrap {
    margin: 0 0 0.46rem;
    border: 1px solid rgba(106, 151, 175, 0.42);
    border-radius: 10px;
    background: rgba(8, 16, 25, 0.94);
    overflow: hidden;
}

.c365-ai-code-language {
    display: block;
    padding: 0.22rem 0.46rem;
    color: #9fc0d2;
    border-bottom: 1px solid rgba(106, 151, 175, 0.32);
    font-size: 0.63rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.c365-ai-code-wrap pre {
    margin: 0;
    padding: 0.42rem 0.5rem;
    overflow-x: auto;
}

.c365-ai-code-wrap code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    display: block;
}

.c365-ai-message-title {
    color: #edf9ff;
    font-size: 0.84rem;
}

.c365-ai-content p.c365-ai-lead {
    color: #edf9ff;
    font-size: 0.86rem;
    font-weight: 500;
    line-height: 1.5;
}

.c365-ai-content p.c365-ai-suggest,
.c365-ai-content ul.c365-ai-suggest,
.c365-ai-content ol.c365-ai-suggest {
    color: rgba(180, 210, 225, 0.6);
    font-size: 0.76rem;
    margin-top: 0.08rem;
}

.c365-ai-details {
    margin: 0 0 0.42rem;
    border: 1px solid rgba(106, 151, 175, 0.2);
    border-radius: 7px;
    overflow: hidden;
}

.c365-ai-details[open] {
    border-color: rgba(106, 151, 175, 0.34);
}

.c365-ai-details-summary {
    padding: 0.3rem 0.52rem;
    cursor: pointer;
    color: #b8d8e8;
    font-size: 0.78rem;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.38rem;
    user-select: none;
}

.c365-ai-details-summary::-webkit-details-marker {
    display: none;
}

.c365-ai-details-summary::before {
    content: '▸';
    font-size: 0.6rem;
    color: rgba(180, 210, 225, 0.65);
    transition: transform 0.14s;
    flex-shrink: 0;
}

.c365-ai-details[open] .c365-ai-details-summary::before {
    transform: rotate(90deg);
}

.c365-ai-details-body {
    padding: 0.3rem 0.52rem 0.4rem;
    border-top: 1px solid rgba(106, 151, 175, 0.16);
}

.c365-ai-details-body p,
.c365-ai-details-body ul,
.c365-ai-details-body ol {
    margin: 0 0 0.38rem;
}

.c365-ai-details-body p:last-child,
.c365-ai-details-body ul:last-child,
.c365-ai-details-body ol:last-child {
    margin-bottom: 0;
}

.c365-ai-message.is-streaming .c365-ai-stream-cursor {
    display: inline-block;
}

.c365-ai-stream-cursor {
    display: none;
    width: 0.44rem;
    height: 0.95rem;
    margin-left: 0.16rem;
    border-radius: 1px;
    background: rgba(171, 230, 255, 0.72);
    vertical-align: -0.16rem;
    animation: c365-ai-caret 1s steps(2, end) infinite;
}

.c365-ai-message-assistant.is-typing .c365-ai-content {
    min-height: 0;
}

.c365-ai-message-assistant.is-typing .c365-ai-bubble {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    padding-left: 0;
}

.c365-ai-message.is-error .c365-ai-bubble {
    border-color: rgba(212, 108, 108, 0.54);
    background: linear-gradient(120deg, rgba(61, 23, 30, 0.82), rgba(38, 17, 21, 0.86));
}

.c365-ai-message-extra {
    margin-top: 0.34rem;
    display: grid;
    align-items: stretch;
    gap: 0.42rem;
    min-width: 0;
    width: 100%;
}

.c365-ai-error-text {
    color: #ffcbcb;
    font-size: 0.75rem;
}

.c365-ai-stopped-text {
    color: #b3c9d6;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.c365-ai-retry {
    border: 1px solid rgba(126, 165, 186, 0.42);
    border-radius: 999px;
    padding: 0.16rem 0.44rem;
    background: rgba(13, 37, 48, 0.8);
    color: #d8ebf4;
    font-size: 0.72rem;
}

.c365-ai-status,
.c365-ai-error {
    border-radius: 10px;
    padding: 0.32rem 0.46rem;
    font-size: 0.74rem;
}

.c365-ai-status {
    border: 1px solid rgba(96, 160, 188, 0.42);
    color: #cce7f5;
    background: rgba(11, 36, 48, 0.62);
}

.c365-ai-error {
    border: 1px solid rgba(209, 123, 123, 0.42);
    color: #ffcaca;
    background: rgba(62, 22, 22, 0.68);
}

.c365-ai-composer {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: 0.44rem;
    padding-bottom: calc(0.44rem + env(safe-area-inset-bottom, 0px));
    border: 1px solid rgba(111, 160, 185, 0.28);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(7, 24, 34, 0.92), rgba(5, 18, 26, 0.95));
}

.c365-ai-input {
    width: 100%;
    border: 1px solid rgba(122, 178, 204, 0.36);
    border-radius: 11px;
    background: rgba(9, 27, 37, 0.9);
    color: #e5f1f9;
    resize: none;
    min-height: 44px;
    max-height: 140px;
    line-height: 1.38;
    padding: 0.52rem 0.6rem;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.c365-ai-input:focus {
    border-color: rgba(72, 208, 226, 0.60);
    box-shadow: 0 0 0 0.16rem rgba(72, 208, 226, 0.14);
}

.c365-ai-composer-actions {
    margin-top: 0.38rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.36rem;
}

.c365-ai-send,
.c365-ai-stop,
.c365-ai-voice-control {
    border: 1px solid rgba(117, 170, 195, 0.38);
    border-radius: 9px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 130ms ease, border-color 150ms ease, opacity 150ms ease;
}

.c365-ai-send,
.c365-ai-stop,
.c365-ai-voice-control {
    width: 32px;
}

.c365-ai-send {
    border-radius: 999px;
    border-color: rgba(102, 210, 178, 0.58);
    background: linear-gradient(140deg, rgba(12, 86, 74, 0.96), rgba(10, 70, 82, 0.96));
    color: #e9fff7;
    font-size: 0.9rem;
}

.c365-ai-stop {
    background: rgba(14, 35, 46, 0.92);
    color: #c9dfec;
    font-size: 0.66rem;
}

.c365-ai-send:hover,
.c365-ai-stop:hover,
.c365-ai-voice-control:hover {
    transform: translateY(-1px);
}

.c365-ai-send:disabled,
.c365-ai-stop:disabled,
.c365-ai-voice-control:disabled {
    cursor: not-allowed;
    opacity: 0.52;
    transform: none;
}

.c365-ai-send:disabled,
.c365-ai-stop:disabled,
.c365-ai-voice-control:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.c365-ai-voice-control {
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(14, 35, 46, 0.92);
    color: #c9dfec;
    font-size: 0.92rem;
}

.c365-ai-message-images {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 92px));
    gap: 7px;
    margin-bottom: .5rem;
}

.c365-ai-message-images img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid rgba(72, 208, 226, .38);
    border-radius: 9px;
    background: rgba(5, 18, 26, .82);
}

.c365-ai-voice-control svg,
.c365-ai-message-voice svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    pointer-events: none;
}

.c365-ai-voice-meter {
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #48d0e2;
}

.c365-ai-voice-meter span {
    width: 3px;
    height: calc(4px + 14px * var(--c365-voice-level, .12));
    border-radius: 999px;
    background: currentColor;
    transition: height 70ms linear;
}

.c365-ai-message-voice {
    width: 36px;
    height: 36px;
    margin-left: auto;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #91b7c9;
    background: transparent;
    cursor: pointer;
}

.c365-ai-message-voice:hover,
.c365-ai-message-voice.is-active {
    color: #e9fbff;
    background: rgba(72, 208, 226, .13);
}

.c365-ai-message-voice.is-paused {
    color: #ffb4ae;
}

.c365-ai-voice-control.is-active {
    border-color: rgba(72, 208, 226, 0.8);
    color: #e9fbff;
    box-shadow: 0 0 0 0.16rem rgba(72, 208, 226, 0.14);
}

.c365-ai-voice-control.is-listening {
    border-color: rgba(255, 107, 99, 0.8);
    color: #ffd2cf;
}

.c365-ai-voice-status:not(.visually-hidden) {
    display: block;
    padding: 0.28rem 0.2rem 0;
    color: #9fc4d7;
    font-size: 0.72rem;
}

@media (prefers-reduced-motion: no-preference) {
    .c365-ai-voice-control.is-listening {
        animation: c365-ai-voice-pulse 1.4s ease-in-out infinite;
    }
}

@keyframes c365-ai-voice-pulse {
    50% { box-shadow: 0 0 0 0.3rem rgba(255, 107, 99, 0.12); }
}

.c365-ai-send.is-loading {
    position: relative;
    color: transparent;
}

.c365-ai-send.is-loading::after {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(217, 255, 245, 0.4);
    border-top-color: #d9fff5;
    animation: c365-ai-spin 900ms linear infinite;
}

.is-hidden {
    display: none !important;
}

@media (max-width: 992px) {
    .c365-ai-panel {
        width: 100vw;
        border-left: 0;
        padding: 0.56rem;
        padding-bottom: calc(0.56rem + env(safe-area-inset-bottom, 0px));
    }

    .c365-ai-message {
        max-width: 96%;
    }

    .c365-ai-thread {
        padding-bottom: var(--c365-ai-composer-clearance, 7rem);
    }

    .c365-ai-context.is-compact { padding-block: .34rem; }
    .c365-ai-context.is-compact .c365-ai-context__body { display: none; }
    .c365-ai-context__toggle { cursor: pointer; }
    .c365-ai-context__toggle-icon { display: inline; transition: transform 150ms ease; }
    .c365-ai-context:not(.is-compact) .c365-ai-context__toggle-icon { transform: rotate(180deg); }
    .c365-ai-context.is-compact .c365-ai-context__toggle-label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .c365-ai-composer {
        padding: 0.46rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
        border-radius: 16px;
    }

    .c365-ai-input {
        min-height: 46px;
        font-size: 16px;
    }

    .c365-ai-composer-actions {
        justify-content: stretch;
        gap: 0.5rem;
    }

    .c365-ai-stop,
    .c365-ai-voice-control,
    .c365-ai-message-voice {
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        border-radius: 12px;
        font-size: 0.8rem;
    }

    .c365-ai-send {
        width: 100%;
        min-width: 0;
        height: 44px;
        border-radius: 12px;
        font-size: 0.86rem;
        letter-spacing: 0.02em;
    }

    .c365-ai-send::before {
        content: "Send";
        color: inherit;
    }

    .c365-ai-send.is-loading::before {
        content: "";
    }


@media (max-width: 420px) {
    .c365-ai-panel {
        gap: 0.42rem;
        padding: 0.46rem;
        padding-bottom: calc(0.56rem + env(safe-area-inset-bottom, 0px));
    }

    .c365-ai-header {
        min-height: 64px;
        padding-top: 0.08rem;
    }

    .c365-ai-brand__title {
        font-size: 0.86rem;
    }

    .c365-ai-brand__status {
        font-size: 0.68rem;
    }

    .c365-ai-usage {
        padding: 0.15rem 0.42rem;
        font-size: 0.66rem;
    }

    .c365-ai-prompts {
        gap: 0.28rem;
        padding-bottom: 0.04rem;
    }

    .c365-ai-prompt-chip {
        font-size: 0.66rem;
        padding: 0.3rem 0.46rem;
    }

    .c365-ai-thread {
        gap: 0.4rem;
    }

    .c365-ai-message {
        max-width: 98%;
        gap: 0.3rem;
    }

    .c365-ai-avatar {
        width: 18px;
        height: 18px;
        flex: 0 0 18px;
        font-size: 0.5rem;
        margin-top: 0.18rem;
    }

    .c365-ai-bubble {
        padding: 0.4rem 0.48rem;
        border-radius: 11px;
    }

    .c365-ai-content {
        font-size: 0.78rem;
        line-height: 1.4;
    }

    .c365-ai-composer {
        padding: 0.4rem;
        border-radius: 14px;
    }

    .c365-ai-input {
        min-height: 44px;
        max-height: 132px;
        padding: 0.48rem 0.54rem;
    }

    .c365-ai-composer-actions {
        margin-top: 0.32rem;
        gap: 0.42rem;
    }

    .c365-ai-stop,
    .c365-ai-voice-control,
    .c365-ai-send {
        height: 42px;
    }

    .c365-ai-stop,
    .c365-ai-voice-control {
        width: 42px;
        flex: 0 0 42px;
    }

    .c365-ai-send {
        border-radius: 11px;
        font-size: 0.82rem;
    }
}

@media (max-height: 520px) and (orientation: landscape) {
    .c365-ai-panel {
        gap: 0.34rem;
        padding: 0.38rem;
        padding-bottom: calc(0.46rem + env(safe-area-inset-bottom, 0px));
    }

    .c365-ai-header {
        min-height: 50px;
        padding: 0.04rem 0.08rem 0;
    }

    .c365-ai-brand__title {
        font-size: 0.8rem;
    }

    .c365-ai-brand__status,
    .c365-ai-usage {
        font-size: 0.64rem;
    }

    .c365-ai-prompts {
        gap: 0.24rem;
        padding-bottom: 0.02rem;
    }

    .c365-ai-prompt-chip {
        font-size: 0.64rem;
        padding: 0.24rem 0.4rem;
    }

    .c365-ai-empty-state {
        padding: 0.48rem 0.52rem;
    }

    .c365-ai-empty-state__title {
        margin-bottom: 0.24rem;
        font-size: 0.78rem;
    }

    .c365-ai-empty-state__copy {
        margin-bottom: 0.34rem;
        font-size: 0.7rem;
    }

    .c365-ai-thread {
        gap: 0.34rem;
        padding: 0.06rem 0.05rem 0.2rem;
    }

    .c365-ai-message {
        max-width: 99%;
    }

    .c365-ai-bubble {
        padding: 0.34rem 0.42rem;
    }

    .c365-ai-content {
        font-size: 0.75rem;
    }

    .c365-ai-composer {
        padding: 0.34rem;
        padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
    }

    .c365-ai-input {
        min-height: 40px;
        max-height: 108px;
        padding: 0.4rem 0.48rem;
        font-size: 15px;
    }

    .c365-ai-composer-actions {
        margin-top: 0.26rem;
    }

    .c365-ai-stop,
    .c365-ai-send {
        height: 38px;
    }

    .c365-ai-stop {
        width: 38px;
        flex: 0 0 38px;
    }
}
    .c365-ai-toggle {
        right: 0.68rem;
        bottom: 0.68rem;
    }
}

@keyframes c365-ai-caret {
    0%, 45% {
        opacity: 1;
    }

    46%, 100% {
        opacity: 0;
    }
}

@keyframes c365-ai-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes c365-ai-thinking-dot {
    0%,
    80%,
    100% {
        opacity: 0.36;
        transform: translateY(0);
    }

    40% {
        opacity: 0.95;
        transform: translateY(-2px);
    }
}
