/*
 * zkAPI adapter styles for the pinned OA Chat client.
 * These use OA's existing color tokens, type scale, spacing, radii, and motion.
 */

:root {
    --zkapi-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --zkapi-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

.zkapi-primary-button,
.zkapi-secondary-button {
    display: inline-flex;
    min-height: 2.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1rem;
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease,
        opacity 150ms ease, transform 150ms ease;
}

.zkapi-primary-button {
    border: 1px solid hsl(var(--color-primary));
    background: hsl(var(--color-primary));
    color: hsl(var(--color-primary-foreground));
}

.zkapi-primary-button:hover:not(:disabled) {
    opacity: 0.9;
}

.zkapi-secondary-button {
    border: 1px solid hsl(var(--color-border));
    background: hsl(var(--color-background));
    color: hsl(var(--color-foreground));
}

.zkapi-secondary-button:hover:not(:disabled) {
    background: hsl(var(--color-accent));
}

.zkapi-primary-button:disabled,
.zkapi-secondary-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.zkapi-balance-card {
    border: 1px solid hsl(var(--color-border));
    border-radius: 0.75rem;
    background: hsl(var(--color-muted) / 0.18);
    padding: 1rem;
}

.zkapi-details,
.zkapi-panel-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.6875rem;
}

.zkapi-details > div,
.zkapi-panel-details > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.zkapi-details dt,
.zkapi-panel-details dt {
    color: hsl(var(--color-muted-foreground));
}

.zkapi-details dd,
.zkapi-panel-details dd {
    max-width: 65%;
    overflow: hidden;
    color: hsl(var(--color-foreground));
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zkapi-choice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid hsl(var(--color-border));
    border-radius: 0.625rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.zkapi-choice:hover {
    background: hsl(var(--color-accent) / 0.55);
}

.zkapi-choice.selected {
    border-color: hsl(var(--color-primary) / 0.55);
    background: hsl(var(--color-primary) / 0.05);
    box-shadow: 0 0 0 1px hsl(var(--color-primary) / 0.08);
}

.zkapi-choice input {
    margin-top: 0.125rem;
}

.zkapi-choice span {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.2rem;
}

.zkapi-choice strong {
    color: hsl(var(--color-foreground));
    font-size: 0.75rem;
    font-weight: 500;
}

.zkapi-choice small {
    color: hsl(var(--color-muted-foreground));
    font-size: 0.6875rem;
    line-height: 1rem;
}

.zkapi-status-dot {
    width: 0.4rem;
    height: 0.4rem;
    flex: none;
    border-radius: 9999px;
    background: hsl(var(--color-muted-foreground) / 0.5);
}

.zkapi-status-dot.online {
    background: rgb(34 197 94);
    box-shadow: 0 0 0 3px rgb(34 197 94 / 0.12);
}

.zkapi-status-dot.error {
    background: hsl(var(--color-destructive));
    box-shadow: 0 0 0 3px hsl(var(--color-destructive) / 0.12);
}

.zkapi-progress-indeterminate {
    width: 45%;
    animation: zkapi-progress 1.3s ease-in-out infinite;
}

@keyframes zkapi-progress {
    0% { transform: translateX(-110%); }
    50% { transform: translateX(75%); }
    100% { transform: translateX(225%); }
}

#right-panel {
    overflow: hidden;
    transition: width 220ms ease, min-width 220ms ease, border-width 220ms ease,
        transform 220ms ease;
}

#right-panel-content {
    width: 18rem;
    min-width: 18rem;
}

#account-tab-btn [data-private-balance-label] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#account-tab-btn.zkapi-private-balance-control {
    display: inline-flex;
    flex: 0 1 auto;
    width: auto;
    height: 2rem;
    min-height: 2rem;
    max-width: 10rem;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0.6rem;
    border: 1px solid hsl(var(--color-border));
    border-radius: 0.5rem;
    font-size: 0.75rem;
    color: hsl(var(--color-foreground));
    background: hsl(var(--color-background));
}
.zkapi-private-balance-control .account-tab-dot {
    width: 0.4rem;
    height: 0.4rem;
    flex: none;
    border-radius: 50%;
    background: hsl(var(--color-muted-foreground) / 0.6);
}
.zkapi-private-balance-control[data-status="logged-in"] .account-tab-dot {
    background: rgb(34 197 94);
}

/* Payment onboarding owns its surface. Do not depend on removed upstream
   welcome-page glass classes: transparent cards become unreadable on overlays. */
.zkapi-welcome-dialog {
    color: hsl(var(--color-foreground));
    background: hsl(var(--color-card));
    max-width: calc(100vw - 2rem) !important;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    flex-shrink: 0;
    animation: zkapiWelcomeIn 180ms ease-out;
}
@keyframes zkapiWelcomeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .zkapi-welcome-dialog { animation: none; }
}

#scrubber-shortcut-hint,
#scrubber-preview-hint,
#scrubber-settings-section,
#memory-settings-section,
#chat-mode-toggle {
    display: none !important;
}

@media (max-width: 1023px) {
    #right-panel {
        position: fixed;
        width: 18rem !important;
        min-width: 18rem !important;
        transform: translateX(0);
    }

    html[data-right-panel-hidden="true"] #right-panel {
        transform: translateX(100%);
    }
}

@media (max-width: 480px) {
    #right-panel {
        width: min(18rem, 90vw) !important;
        min-width: min(18rem, 90vw) !important;
    }

    #right-panel-content {
        width: min(18rem, 90vw);
        min-width: min(18rem, 90vw);
    }
}

@media (prefers-reduced-motion: reduce) {
    .zkapi-progress-indeterminate {
        width: 100%;
        animation: none;
    }
}

/* zkAPI state experience proposals. These intentionally inherit OA's visual
 * language; the variants change information architecture, not branding. */
.zkapi-state-spinner {
    width: 0.875rem;
    height: 0.875rem;
    flex: none;
    border: 1.5px solid hsl(var(--color-muted-foreground) / 0.28);
    border-top-color: hsl(var(--color-foreground) / 0.72);
    border-radius: 9999px;
    animation: zkapi-state-spin 1.2s linear infinite;
}

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

.zkapi-state-glyph {
    display: inline-flex;
    width: 0.875rem;
    height: 0.875rem;
    flex: none;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: hsl(var(--color-muted-foreground) / 0.16);
    color: hsl(var(--color-muted-foreground));
    font-size: 0.625rem;
    font-weight: 700;
}

.zkapi-state-glyph svg {
    width: 0.75rem;
    height: 0.75rem;
}

.zkapi-state-glyph--success {
    background: rgb(34 197 94 / 0.13);
    color: rgb(22 101 52);
}

.dark .zkapi-state-glyph--success {
    color: rgb(134 239 172);
}

.zkapi-state-glyph--error {
    background: hsl(var(--color-destructive) / 0.12);
    color: hsl(var(--color-destructive));
}

.zkapi-state-glyph--waiting {
    background: rgb(245 158 11 / 0.14);
    color: rgb(180 83 9);
}

.dark .zkapi-state-glyph--waiting {
    color: rgb(252 211 77);
}

.zkapi-composer-state {
    display: block;
    margin: 0.125rem 0.5rem 0.25rem;
    color: hsl(var(--color-muted-foreground));
    font-size: 0.6875rem;
    line-height: 1rem;
}

.zkapi-composer-inline {
    display: flex;
    min-height: 1.75rem;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: hsl(var(--color-muted) / 0.28);
}

.zkapi-composer-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: baseline;
    gap: 0.4rem;
}

.zkapi-composer-copy strong,
.zkapi-composer-guided-heading strong {
    flex: none;
    color: hsl(var(--color-foreground));
    font-weight: 550;
}

.zkapi-composer-copy small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zkapi-composer-state--activity .zkapi-composer-inline {
    background: transparent;
    box-shadow: 0 0 0 1px hsl(var(--color-border)) inset;
}

.zkapi-composer-state--activity button {
    min-height: 1.5rem;
    flex: none;
    border: 0;
    border-radius: 0.375rem;
    padding: 0 0.4rem;
    background: transparent;
    color: hsl(var(--color-foreground));
    font-size: 0.625rem;
    font-weight: 550;
    cursor: pointer;
    transition: background-color 120ms ease-out, transform 120ms ease-out;
}

@media (hover: hover) and (pointer: fine) {
    .zkapi-composer-state--activity button:hover {
        background: hsl(var(--color-muted) / 0.7);
    }
}

.zkapi-composer-state--activity button:active {
    transform: scale(0.96);
}

.zkapi-composer-state--activity button:focus-visible,
.zkapi-billing-explainer summary:focus-visible {
    outline: 2px solid hsl(var(--color-ring));
    outline-offset: 2px;
}

.zkapi-composer-state--guided {
    border-radius: 0.625rem;
    padding: 0.5rem 0.625rem 0.55rem;
    background: hsl(var(--color-muted) / 0.22);
    box-shadow: 0 0 0 1px hsl(var(--color-border) / 0.72) inset;
}

.zkapi-composer-guided-heading {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.zkapi-composer-guided-heading > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.zkapi-composer-guided-heading small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zkapi-journey {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    margin-top: 0.65rem;
}

.zkapi-journey-step {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.3rem;
    color: hsl(var(--color-muted-foreground) / 0.68);
}

.zkapi-journey-step:not(:last-child)::after {
    position: absolute;
    z-index: 0;
    top: 0.45rem;
    right: -0.25rem;
    width: 0.35rem;
    height: 1px;
    background: hsl(var(--color-border));
    content: '';
}

.zkapi-journey-marker {
    z-index: 1;
    display: inline-flex;
    width: 1rem;
    height: 1rem;
    flex: none;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: hsl(var(--color-muted));
    color: hsl(var(--color-muted-foreground));
    font-size: 0.55rem;
    font-variant-numeric: tabular-nums;
}

.zkapi-journey-step[data-state="active"] {
    color: hsl(var(--color-foreground));
}

.zkapi-journey-step[data-state="active"] .zkapi-journey-marker {
    background: hsl(var(--color-foreground));
    color: hsl(var(--color-background));
    box-shadow: 0 0 0 3px hsl(var(--color-foreground) / 0.08);
}

.zkapi-journey-step[data-state="complete"] {
    color: hsl(var(--color-foreground) / 0.82);
}

.zkapi-journey-step[data-state="complete"] .zkapi-journey-marker {
    background: rgb(34 197 94 / 0.14);
    color: rgb(22 101 52);
}

.dark .zkapi-journey-step[data-state="complete"] .zkapi-journey-marker {
    color: rgb(134 239 172);
}

.zkapi-journey-step[data-state="error"] .zkapi-journey-marker {
    background: hsl(var(--color-destructive) / 0.12);
    color: hsl(var(--color-destructive));
}

.zkapi-journey-label {
    overflow: hidden;
    font-size: 0.625rem;
    line-height: 0.85rem;
    text-overflow: ellipsis;
}

.zkapi-journey--compact {
    margin-top: 0.5rem;
}

.zkapi-panel-experience {
    margin-top: 0.75rem;
    border-radius: 0.625rem;
    padding: 0.65rem;
    background: hsl(var(--color-muted) / 0.18);
    box-shadow: 0 0 0 1px hsl(var(--color-border) / 0.7) inset;
}

.zkapi-panel-experience--quiet {
    padding: 0.55rem 0.6rem;
    background: transparent;
}

.zkapi-panel-experience--disclosure {
    padding: 0;
    overflow: visible;
    background: transparent;
}

.zkapi-panel-experience--disclosure > summary {
    display: flex;
    min-height: 2rem;
    align-items: center;
    gap: 0.45rem;
    border-radius: 0.625rem;
    padding: 0.4rem 0.55rem;
    color: hsl(var(--color-muted-foreground));
    cursor: pointer;
    list-style: none;
}

.zkapi-panel-experience--disclosure > summary::-webkit-details-marker {
    display: none;
}

.zkapi-panel-experience--disclosure > summary > span:nth-child(2) {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    color: hsl(var(--color-foreground));
    font-size: 0.6875rem;
    font-weight: 550;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zkapi-disclosure-chevron {
    width: 0.875rem;
    height: 0.875rem;
    flex: none;
    transition: transform 160ms var(--zkapi-ease-out);
}

.zkapi-panel-experience--disclosure[open] .zkapi-disclosure-chevron {
    transform: rotate(180deg);
}

.zkapi-panel-disclosure-body {
    padding: 0.15rem 0.6rem 0.65rem 1.9rem;
}

.zkapi-panel-disclosure-body > strong {
    color: hsl(var(--color-foreground));
    font-size: 0.6875rem;
    font-weight: 600;
}

.zkapi-panel-disclosure-body > p {
    margin-top: 0.2rem;
    color: hsl(var(--color-muted-foreground));
    font-size: 0.625rem;
    line-height: 0.9rem;
}

.zkapi-panel-experience--disclosure > summary:focus-visible,
.zkapi-composer-receipt:focus-visible,
.zkapi-composer-relay:focus-visible,
.zkapi-composer-ambient-button:focus-visible,
.zkapi-composer-capsule:focus-visible {
    outline: 2px solid hsl(var(--color-ring));
    outline-offset: 2px;
}

.zkapi-composer-state--receipt,
.zkapi-composer-state--relay,
.zkapi-composer-state--capsule {
    display: flex;
    justify-content: flex-end;
}

.zkapi-composer-relay,
.zkapi-composer-capsule,
.zkapi-composer-ambient-button {
    border: 0;
    color: hsl(var(--color-muted-foreground));
    cursor: pointer;
}

.zkapi-composer-relay {
    display: inline-flex;
    min-height: 1.75rem;
    align-items: center;
    gap: 0.4rem;
    border-radius: 9999px;
    padding: 0.25rem 0.5rem;
    background: hsl(var(--color-muted) / 0.45);
    box-shadow: 0 0 0 1px hsl(var(--color-border) / 0.65) inset;
    font-size: 0.625rem;
    font-weight: 550;
    transition: color 140ms ease, background-color 140ms ease, transform 140ms var(--zkapi-ease-out);
}

.zkapi-composer-relay > svg {
    width: 0.8rem;
    height: 0.8rem;
}

.zkapi-composer-state--ambient {
    position: relative;
    height: 0.875rem;
    margin-top: 0;
    overflow: visible;
}

.zkapi-composer-state--ambient::before,
.zkapi-composer-state--ambient::after {
    position: absolute;
    right: 2rem;
    bottom: 0.15rem;
    left: 0;
    height: 2px;
    border-radius: 9999px;
    content: '';
    pointer-events: none;
}

.zkapi-composer-state--ambient::before {
    background: hsl(var(--color-border) / 0.6);
}

.zkapi-composer-state--ambient::after {
    width: 30%;
    background: hsl(var(--color-foreground) / 0.7);
    opacity: 0.55;
}

.zkapi-composer-state--ambient[aria-busy="true"]::after {
    animation: zkapiAmbientEdge 1.6s linear infinite;
}

.zkapi-composer-state--ambient[data-tone="error"]::after {
    width: auto;
    background: hsl(var(--color-destructive));
    animation: none;
}

.zkapi-composer-state--ambient[data-tone="waiting"]::after {
    width: auto;
    background: rgb(217 119 6);
    opacity: 0.82;
    animation: none;
}

.dark .zkapi-composer-state--ambient[data-tone="waiting"]::after {
    background: rgb(252 211 77);
}

.zkapi-composer-ambient-button {
    position: absolute;
    right: 0;
    bottom: -0.35rem;
    display: inline-flex;
    width: 1.5rem;
    height: 1.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: hsl(var(--color-background));
}

.zkapi-composer-capsule {
    display: inline-grid;
    min-width: 4.5rem;
    min-height: 1.75rem;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    border-radius: 9999px;
    padding: 0.2rem 0.45rem;
    background: hsl(var(--color-muted) / 0.35);
    box-shadow: 0 0 0 1px hsl(var(--color-border) / 0.7) inset;
    transition: color 140ms ease, background-color 140ms ease, transform 140ms var(--zkapi-ease-out);
}

.zkapi-capsule-check {
    color: rgb(22 101 52);
}

.dark .zkapi-capsule-check {
    color: rgb(134 239 172);
}

.zkapi-capsule-arrow {
    color: hsl(var(--color-foreground));
}

.zkapi-capsule-origin,
.zkapi-capsule-end {
    display: inline-flex;
    min-width: 0.75rem;
    align-items: center;
    justify-content: center;
}

.zkapi-capsule-origin--neutral i {
    width: 0.375rem;
    height: 0.375rem;
    border: 1px solid currentColor;
    border-radius: 9999px;
    opacity: 0.72;
}

.zkapi-capsule-end--hold {
    color: rgb(180 83 9);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: -0.12em;
}

.dark .zkapi-capsule-end--hold {
    color: rgb(252 211 77);
}

.zkapi-capsule-end--error {
    color: hsl(var(--color-destructive));
    font-size: 0.75rem;
    font-weight: 700;
}

.zkapi-capsule-end--closing {
    color: hsl(var(--color-muted-foreground));
    font-size: 0.75rem;
    line-height: 1;
}

.zkapi-composer-state--receipt[data-tone="waiting"] .zkapi-composer-receipt,
.zkapi-composer-state--relay[data-tone="waiting"] .zkapi-composer-relay,
.zkapi-composer-state--capsule[data-tone="waiting"] .zkapi-composer-capsule {
    background: rgb(245 158 11 / 0.08);
    color: rgb(180 83 9);
    box-shadow: 0 0 0 1px rgb(217 119 6 / 0.24) inset;
}

.dark .zkapi-composer-state--receipt[data-tone="waiting"] .zkapi-composer-receipt,
.dark .zkapi-composer-state--relay[data-tone="waiting"] .zkapi-composer-relay,
.dark .zkapi-composer-state--capsule[data-tone="waiting"] .zkapi-composer-capsule {
    color: rgb(252 211 77);
}

@media (hover: hover) and (pointer: fine) {
    .zkapi-composer-relay:hover,
    .zkapi-composer-capsule:hover,
    .zkapi-composer-ambient-button:hover {
        color: hsl(var(--color-foreground));
        background: hsl(var(--color-muted) / 0.75);
    }
}

.zkapi-composer-relay:active,
.zkapi-composer-capsule:active,
.zkapi-composer-ambient-button:active {
    transform: scale(0.96);
}

.zkapi-panel-state-heading {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.zkapi-panel-state-heading > div {
    min-width: 0;
    flex: 1;
}

.zkapi-panel-state-heading strong {
    display: block;
    color: hsl(var(--color-foreground));
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 0.9rem;
}

.zkapi-panel-state-heading p {
    margin-top: 0.15rem;
    color: hsl(var(--color-muted-foreground));
    font-size: 0.625rem;
    line-height: 0.9rem;
}

.zkapi-running-count {
    flex: none;
    border-radius: 9999px;
    padding: 0.1rem 0.35rem;
    background: hsl(var(--color-foreground));
    color: hsl(var(--color-background));
    font-size: 0.55rem;
    font-weight: 600;
}

.zkapi-activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-top: 0.55rem;
}

.zkapi-activity-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.25rem;
    border-radius: 0.45rem;
    padding: 0.3rem 0.35rem;
}

.zkapi-activity-row + .zkapi-activity-row {
    border-top: 1px solid hsl(var(--color-border) / 0.55);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.zkapi-activity-indicator {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 9999px;
    background: hsl(var(--color-muted-foreground) / 0.5);
}

.zkapi-activity-row[data-status="running"] .zkapi-activity-indicator,
.zkapi-activity-row[data-status="waiting"] .zkapi-activity-indicator {
    background: hsl(var(--color-foreground));
    box-shadow: 0 0 0 3px hsl(var(--color-foreground) / 0.08);
}

.zkapi-activity-row[data-status="success"] .zkapi-activity-indicator {
    background: rgb(34 197 94);
}

.zkapi-activity-row[data-status="error"] .zkapi-activity-indicator {
    background: hsl(var(--color-destructive));
}

.zkapi-activity-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.zkapi-activity-copy strong,
.zkapi-activity-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zkapi-activity-copy strong {
    color: hsl(var(--color-foreground));
    font-size: 0.625rem;
    font-weight: 550;
}

.zkapi-activity-copy small,
.zkapi-activity-state,
.zkapi-activity-empty {
    color: hsl(var(--color-muted-foreground));
    font-size: 0.55rem;
}

.zkapi-activity-state {
    max-width: 4.25rem;
    text-align: end;
}

.zkapi-activity-empty {
    margin-top: 0.55rem;
}

.zkapi-billing-explainer summary {
    border-radius: 0.25rem;
    color: hsl(var(--color-muted-foreground));
    font-size: 0.625rem;
    font-weight: 550;
    cursor: pointer;
}

.zkapi-billing-explainer p {
    margin-top: 0.45rem;
    color: hsl(var(--color-muted-foreground));
    font-size: 0.625rem;
    line-height: 0.9rem;
}

.account-tab-btn[data-status="busy"] .account-tab-dot {
    background: hsl(var(--color-foreground));
    box-shadow: 0 0 0 3px hsl(var(--color-foreground) / 0.08);
    animation: zkapiBalancePulse 1.6s var(--zkapi-ease-in-out) infinite;
}

.account-tab-btn[data-status="attention"] .account-tab-dot {
    background: hsl(var(--color-destructive));
}

.account-tab-btn[data-status="waiting"] .account-tab-dot {
    background: rgb(217 119 6);
}

.zkapi-composer-live-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* The verbose lifecycle sentence is announced by screen readers while the
   compact OA-style trace remains the only visible status. */
.pending-response-announcement {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Delivery changes remain available to assistive technology while the
   assistant placeholder is the sole visible lifecycle surface. */
#zkapi-send-announcer {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.message-action-btn.is-processing,
.confirm-edit-btn.is-processing {
    position: relative;
    color: transparent !important;
    cursor: wait;
    pointer-events: none;
}

.message-action-btn.is-processing > *,
.confirm-edit-btn.is-processing > * {
    visibility: hidden;
}

.message-action-btn.is-processing::after,
.confirm-edit-btn.is-processing::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.75rem;
    height: 0.75rem;
    border: 1.5px solid hsl(var(--color-muted-foreground) / 0.3);
    border-top-color: hsl(var(--color-foreground) / 0.82);
    border-radius: 9999px;
    animation: zkapiActionOrbit 1.1s linear infinite;
    content: '';
    transform: translate(-50%, -50%);
}

.pending-response-line {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.pending-response-dots {
    display: inline-flex;
    gap: 0.18rem;
    align-items: center;
    height: 0.75rem;
}

.pending-response-dots i {
    width: 0.25rem;
    height: 0.25rem;
    border-radius: 50%;
    background: hsl(var(--color-muted-foreground));
    animation: zkapiDotLift 1.2s var(--zkapi-ease-in-out) infinite;
}

.pending-response-dots i:nth-child(2) { animation-delay: 120ms; }
.pending-response-dots i:nth-child(3) { animation-delay: 240ms; }

.pending-response-label {
    font-size: 0.625rem;
    letter-spacing: 0.01em;
}

.zkapi-send-orbit {
    position: relative;
    width: 1rem;
    height: 1rem;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    opacity: 0.95;
}

.zkapi-send-orbit i {
    position: absolute;
    top: -0.14rem;
    left: 50%;
    width: 0.28rem;
    height: 0.28rem;
    border-radius: 50%;
    background: currentColor;
    transform-origin: 0 0.64rem;
    animation: zkapiSendOrbit 1.25s linear infinite;
}

.zkapi-send-check {
    width: 1rem;
    height: 1rem;
    animation: zkapiSendCheck 160ms var(--zkapi-ease-out) both;
}

@keyframes zkapiSendOrbit { to { transform: rotate(360deg); } }
@keyframes zkapiSidebarOrbit { to { transform: rotate(360deg); } }
@keyframes zkapiActionOrbit { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes zkapiAmbientEdge {
    from { opacity: 0.25; transform: translateX(-110%); }
    50% { opacity: 0.85; }
    to { opacity: 0.25; transform: translateX(360%); }
}
@keyframes zkapiBalancePulse {
    0%, 100% { opacity: 0.45; transform: scale(0.88); }
    50% { opacity: 1; transform: scale(1); }
}
@keyframes zkapiSendCheck {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes zkapiDotLift {
    0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-0.16rem); }
}

.zkapi-sidebar-orbit {
    animation: zkapiSidebarOrbit 1.2s linear infinite;
}

.chat-session[data-deleting="true"] {
    cursor: wait;
    opacity: 0.72;
}

.chat-session[data-deleting="true"] > a,
.chat-session[data-deleting="true"] .session-title-input {
    cursor: wait;
    pointer-events: none;
}

/* OA's dark destructive token is intended for solid surfaces and is too dark
   for small status text on OA's #262626 canvas. Keep its subtle fills, but use
   the existing red-400 value for zkAPI error foregrounds and indicators. */
.dark .zkapi-state-glyph--error,
.dark .zkapi-journey-step[data-state="error"] .zkapi-journey-marker,
.dark .zkapi-capsule-end--error,
.dark #right-panel .text-destructive,
.dark #account-modal .text-destructive,
.dark #sidebar .text-destructive {
    color: rgb(248 113 113) !important;
}

.dark .zkapi-status-dot.error,
.dark .zkapi-composer-state--ambient[data-tone="error"]::after,
.dark .zkapi-activity-row[data-status="error"] .zkapi-activity-indicator,
.dark .account-tab-btn[data-status="attention"] .account-tab-dot {
    background: rgb(248 113 113);
}

@media (max-width: 640px) {
    .zkapi-composer-copy small {
        display: none;
    }

    .zkapi-composer-guided-heading small {
        white-space: normal;
    }

    .zkapi-journey-label {
        display: none;
    }

    .zkapi-journey-step {
        justify-content: center;
    }

    .zkapi-journey-step:not(:last-child)::after {
        right: -0.4rem;
        width: 0.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    #right-panel {
        transition: none;
    }

    .zkapi-progress-indeterminate,
    #welcome-panel .animate-spin {
        animation: none !important;
        transform: none;
    }

    .zkapi-state-spinner {
        animation: none;
        border-top-color: currentColor;
    }

    .zkapi-composer-state--activity button {
        transition: none;
    }

    .pending-response-dots i,
    .zkapi-send-orbit i,
    .zkapi-send-check,
    .zkapi-sidebar-orbit,
    .message-action-btn.is-processing::after,
    .confirm-edit-btn.is-processing::after,
    .account-tab-btn[data-status="busy"] .account-tab-dot,
    .zkapi-composer-state--ambient::after {
        animation: none !important;
        transform: none;
    }

    .message-action-btn.is-processing::after,
    .confirm-edit-btn.is-processing::after {
        transform: translate(-50%, -50%);
    }

    .zkapi-disclosure-chevron,
    .zkapi-composer-relay,
    .zkapi-composer-capsule,
    .zkapi-composer-ambient-button {
        transition: none;
    }

    .pending-response-dots i {
        opacity: 0.8;
    }

    .pending-response-streaming {
        animation: none !important;
        background-image: none !important;
        color: hsl(var(--color-muted-foreground)) !important;
        -webkit-text-fill-color: currentColor !important;
    }
}
