.zido-panel {
    display: flex;
    flex-direction: column;
    min-height: 560px;
    height: calc(100vh - 150px);
    max-height: 920px;
    overflow: hidden;
    background: var(--zidni-surface, #ffffff);
    border: 1px solid var(--zidni-border, #e6ecf5);
    border-radius: 8px;
    box-shadow: var(--zidni-shadow-sm);
}

.zido-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--zidni-border, #e6ecf5);
}

.zido-panel-identity,
.zido-panel-actions,
.zido-error,
.zido-safety-note,
.zido-composer,
.zido-reference {
    display: flex;
    align-items: center;
}

.zido-panel-identity {
    min-width: 0;
    gap: 12px;
}

.zido-panel-title {
    margin: 0;
    color: var(--zidni-ink, #0b1638);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
}

.zido-panel-subtitle {
    margin: 2px 0 0;
    color: var(--zidni-gray-500, #6b7a95);
    font-size: 12px;
}

.zido-panel-actions {
    flex: 0 0 auto;
    gap: 6px;
}

.zido-icon-button,
.zido-send {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--zidni-gray-700, #33415f);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
}

.zido-icon-button:hover,
.zido-icon-button:focus-visible {
    color: var(--zidni-brand, #5b61ff);
    background: var(--zidni-gray-100, #eef5ff);
    border-color: var(--zidni-border, #e6ecf5);
}

.zido-icon-button:disabled,
.zido-send:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.zido-icon-button svg,
.zido-send svg {
    width: 20px;
    height: 20px;
}

.zido-action-plus {
    position: absolute;
    inset-block-start: 5px;
    inset-inline-end: 5px;
    font-size: 13px;
    font-weight: 900;
}

.zido-status {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--zidni-gray-600, #495a78);
}

.zido-spinner,
.zido-send-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(91, 97, 255, 0.22);
    border-top-color: var(--zidni-brand, #5b61ff);
    border-radius: 50%;
    animation: zido-spin 0.8s linear infinite;
}

.zido-send-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border-color: rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
}

.zido-send.is-loading svg {
    display: none;
}

.zido-send.is-loading .zido-send-spinner {
    display: inline-block;
}

@keyframes zido-spin {
    to { transform: rotate(360deg); }
}

.zido-error {
    gap: 8px;
    padding: 8px 12px;
    color: #991b1b;
    background: var(--zidni-error-bg, rgba(239, 68, 68, 0.1));
    border-bottom: 1px solid rgba(239, 68, 68, 0.18);
}

.zido-error > span {
    flex: 1;
    min-width: 0;
}

.zido-error > svg {
    flex: 0 0 auto;
    width: 20px;
}

.zido-conversation {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.zido-welcome,
.zido-closed {
    height: 100%;
    overflow-y: auto;
    padding: 40px 24px 24px;
}

.zido-welcome > .zido-mark {
    width: 64px;
    height: 64px;
}

.zido-welcome h2,
.zido-closed h2 {
    margin: 20px 0 6px;
    color: var(--zidni-ink, #0b1638);
    font-size: 24px;
    font-weight: 800;
}

.zido-welcome > p,
.zido-closed p {
    color: var(--zidni-gray-600, #495a78);
}

.zido-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.zido-prompt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 12px;
    color: var(--zidni-gray-800, #1f2b46);
    background: var(--zidni-gray-50, #f6faff);
    border: 1px solid var(--zidni-border, #e6ecf5);
    border-radius: 8px;
    cursor: pointer;
}

.zido-prompt:hover,
.zido-prompt:focus-visible {
    color: var(--zidni-brand, #5b61ff);
    border-color: var(--zidni-brand, #5b61ff);
}

.zido-prompt svg {
    width: 17px;
    height: 17px;
}

.zido-safety-note {
    align-items: flex-start;
    gap: 8px;
    max-width: 680px;
    margin: 24px 0 0;
    color: var(--zidni-gray-600, #495a78);
    font-size: 13px;
    line-height: 1.7;
}

.zido-safety-note svg {
    flex: 0 0 auto;
    width: 18px;
    color: var(--zidni-brand, #5b61ff);
}

.zido-messages {
    height: 100%;
    overflow-y: auto;
    padding: 20px 16px;
}

.zido-message {
    display: flex;
    margin-bottom: 12px;
}

.zido-message.is-user {
    justify-content: flex-end;
}

.zido-message.is-assistant {
    justify-content: flex-start;
}

.zido-message-body {
    max-width: min(680px, 86%);
    padding: 12px 14px;
    border-radius: 8px;
    line-height: 1.75;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.zido-message.is-user .zido-message-body {
    color: #ffffff;
    background: var(--zidni-brand, #5b61ff);
}

.zido-message.is-assistant .zido-message-body {
    color: var(--zidni-gray-800, #1f2b46);
    background: var(--zidni-gray-50, #f6faff);
    border: 1px solid var(--zidni-border, #e6ecf5);
}

.zido-message-text {
    margin: 0;
}

.zido-references {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.zido-reference {
    gap: 6px;
    min-height: 38px;
    padding: 6px 10px;
    color: var(--zidni-brand, #5b61ff);
    background: transparent;
    border: 1px solid rgba(91, 97, 255, 0.30);
    border-radius: 8px;
}

.zido-reference svg {
    width: 16px;
    height: 16px;
}

.zido-pending-action {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(15, 61, 58, 0.16);
}

.zido-pending-heading,
.zido-pending-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zido-pending-heading svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: var(--zidni-brand, #5b61ff);
}

.zido-pending-heading strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.zido-pending-changes {
    display: grid;
    gap: 7px;
    margin-top: 10px;
}

.zido-pending-change {
    display: grid;
    grid-template-columns: minmax(92px, 0.34fr) minmax(0, 1fr);
    gap: 10px;
    font-size: 0.875rem;
    line-height: 1.55;
}

.zido-pending-change strong,
.zido-pending-change span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.zido-pending-actions {
    flex-wrap: wrap;
    margin-top: 10px;
}

.zido-closed {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.zido-closed > svg {
    width: 48px;
    height: 48px;
    color: var(--zidni-success, #16a34a);
}

.zido-closed .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.zido-composer {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
    background: var(--zidni-surface, #ffffff);
    border-top: 1px solid var(--zidni-border, #e6ecf5);
}

.zido-attach-button {
    flex: 0 0 auto;
}

.zido-attachment-chip {
    order: -1;
    display: inline-flex;
    flex: 1 0 100%;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    max-width: 100%;
    padding: 7px 8px 7px 10px;
    color: var(--zidni-gray-800, #1f2b46);
    background: var(--zidni-gray-50, #f6faff);
    border: 1px solid var(--zidni-border, #e6ecf5);
    border-radius: 8px;
}

.zido-attachment-chip[hidden] {
    display: none;
}

.zido-attachment-chip > svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    color: var(--zidni-brand, #5b61ff);
}

.zido-attachment-chip span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zido-attachment-remove {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    color: var(--zidni-gray-600, #495a78);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

.zido-attachment-remove:hover,
.zido-attachment-remove:focus-visible {
    color: var(--zidni-brand, #5b61ff);
    background: var(--zidni-gray-100, #eef5ff);
}

.zido-attachment-remove svg {
    width: 16px;
    height: 16px;
}

.zido-composer textarea {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    max-height: 132px;
    padding: 10px 12px;
    resize: none;
    color: var(--zidni-ink, #0b1638);
    background: var(--zidni-gray-50, #f6faff);
    border: 1px solid var(--zidni-border, #e6ecf5);
    border-radius: 8px;
    outline: none;
}

.zido-composer textarea:focus {
    border-color: var(--zidni-brand, #5b61ff);
    box-shadow: 0 0 0 3px rgba(91, 97, 255, 0.12);
}

.zido-send {
    flex: 0 0 auto;
    color: #ffffff;
    background: var(--zidni-brand, #5b61ff);
}

.zido-send:hover,
.zido-send:focus-visible {
    background: var(--zidni-brand-600, #4b52ff);
}

html[data-theme="dark"] .zido-panel-title,
html[data-theme="dark"] .zido-welcome h2,
html[data-theme="dark"] .zido-closed h2,
html[data-theme="dark"] .zido-composer textarea {
    color: var(--zidni-ink, #e8efff);
}

html[data-theme="dark"] .zido-message.is-assistant .zido-message-body {
    color: var(--zidni-ink, #e8efff);
}

@media (max-width: 767px) {
    .zido-panel {
        min-height: calc(100vh - 118px);
        height: calc(100vh - 118px);
        border-radius: 0;
    }

    .zido-panel-header {
        padding-inline: 12px;
    }

    .zido-panel-subtitle {
        display: none;
    }

    .zido-panel-actions {
        gap: 2px;
    }

    .zido-icon-button {
        width: 40px;
        height: 40px;
    }

    .zido-welcome {
        padding: 28px 16px 20px;
    }

    .zido-prompts {
        display: grid;
        grid-template-columns: 1fr;
    }

    .zido-prompt {
        width: 100%;
    }

    .zido-message-body {
        max-width: 92%;
    }
}

.zido-floating-assistant {
    position: fixed;
    inset-inline-end: 24px;
    inset-block-end: 24px;
    z-index: 1040;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    pointer-events: none;
}

.zido-floating-trigger,
.zido-floating-dialog {
    pointer-events: auto;
}

.zido-floating-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 66px;
    height: 66px;
    padding: 0;
    background: #ffffff;
    border: 1px solid rgba(91, 97, 255, 0.24);
    border-radius: 50%;
    box-shadow: 0 18px 42px rgba(11, 22, 56, 0.18);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.zido-floating-trigger:hover,
.zido-floating-trigger:focus-visible {
    transform: translateY(-2px);
    border-color: var(--zidni-brand, #5b61ff);
    box-shadow: 0 22px 54px rgba(91, 97, 255, 0.26);
    outline: none;
}

.zido-floating-trigger:focus-visible {
    box-shadow: 0 0 0 4px rgba(91, 97, 255, 0.16), 0 22px 54px rgba(91, 97, 255, 0.26);
}

.zido-floating-trigger .zido-mark {
    width: 44px;
    height: 44px;
}

.zido-floating-dialog {
    position: absolute;
    inset-inline-end: 0;
    inset-block-end: 78px;
    width: min(390px, calc(100vw - 32px));
    height: min(640px, calc(100vh - 126px));
    transform-origin: bottom right;
}

.rtl .zido-floating-dialog {
    transform-origin: bottom left;
}

.zido-floating-dialog[hidden] {
    display: none;
}

.zido-panel.zido-panel-floating {
    min-height: 0;
    height: 100%;
    max-height: none;
    border-radius: 8px;
    box-shadow: 0 28px 68px rgba(11, 22, 56, 0.24);
}

.zido-panel-floating .zido-floating-header {
    min-height: 64px;
}

.zido-panel-floating .zido-panel-title {
    font-size: 18px;
}

.zido-panel-floating .zido-welcome {
    padding: 26px 18px 20px;
}

.zido-panel-floating .zido-welcome > .zido-mark {
    width: 56px;
    height: 56px;
}

.zido-panel-floating .zido-welcome h2,
.zido-panel-floating .zido-closed h2 {
    font-size: 20px;
}

.zido-panel-floating .zido-prompts {
    display: grid;
    grid-template-columns: 1fr;
}

.zido-panel-floating .zido-prompt {
    width: 100%;
    justify-content: flex-start;
}

.zido-panel-floating .zido-message-body {
    max-width: 92%;
}

html[data-theme="dark"] .zido-floating-trigger {
    background: var(--zidni-surface, #10192f);
    border-color: rgba(128, 144, 255, 0.28);
}

@media (max-width: 575px) {
    .zido-floating-assistant {
        inset-inline-end: 14px;
        inset-block-end: 14px;
    }

    .zido-floating-trigger {
        width: 60px;
        height: 60px;
    }

    .zido-floating-dialog {
        inset-inline-end: -2px;
        inset-block-end: 72px;
        width: calc(100vw - 24px);
        height: calc(100vh - 104px);
    }

    .zido-panel.zido-panel-floating {
        border-radius: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .zido-floating-trigger {
        transition: none;
    }

    .zido-spinner,
    .zido-send-spinner {
        animation-duration: 1.8s;
    }
}
