html:has(.atg-chat) {
    height: 100%;
    overflow: hidden;
}
html:has(.atg-chat) body {
    height: 100%;
    overflow: hidden;
}
.site-footer,
.float-dock,
#cookie-banner {
    display: none !important;
}
.atg-page {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-top: var(--ds-space-3);
    padding-bottom: var(--ds-space-3);
    background: radial-gradient(circle at 50% 0%, var(--ds-color-primary-subtle) 0%, var(--ds-color-surface-sunken) 55%);
}
.atg-shell {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--ds-gutter);
}
.atg-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-3);
    flex: 0 0 auto;
    flex-wrap: wrap;
}
.atg-topbar__brand {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
    min-width: 0;
}
.atg-topbar__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(145deg, var(--ds-color-primary), #7c9bff);
    color: #fff;
    font-size: 0.95rem;
    box-shadow: var(--ds-shadow-brand);
}
.atg-topbar__text {
    min-width: 0;
}
.atg-topbar__title {
    font-size: var(--ds-text-base);
    font-weight: var(--ds-font-extrabold);
    color: var(--ds-color-text-primary);
    letter-spacing: var(--ds-tracking-tight);
    margin: 0;
    line-height: 1.2;
}
.atg-topbar__tagline {
    display: block;
    font-size: var(--ds-text-xs);
    color: var(--ds-color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 46ch;
}
.atg-topbar__actions {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
    flex-shrink: 0;
}
.atg-credits-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: center;
    margin: 0 auto var(--ds-space-2);
    padding: 4px 12px;
    border-radius: var(--ds-radius-full);
    background: var(--ds-color-primary-muted);
    color: var(--ds-color-primary);
    font-size: 0.7rem;
    font-weight: var(--ds-font-bold);
    letter-spacing: var(--ds-tracking-wide);
    text-transform: uppercase;
    text-decoration: none;
    transition: background var(--ds-transition-base), color var(--ds-transition-base);
}
.atg-credits-badge:hover {
    background: var(--ds-color-primary);
    color: var(--ds-color-text-inverse);
}
.atg-credits-badge i {
    font-size: 0.65rem;
}
.atg-credits-badge--empty {
    background: var(--ds-color-warning-muted);
    color: var(--ds-color-warning-text);
}
.atg-dataset-note {
    flex: 0 0 auto;
    margin: 0;
    font-size: var(--ds-text-xs);
    color: var(--ds-color-text-muted);
    text-align: center;
}
.atg-newchat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--ds-radius-full);
    border: 1.5px solid var(--ds-color-border-input);
    background: var(--ds-color-surface);
    color: var(--ds-color-text-secondary);
    font-family: var(--ds-font-family);
    font-size: var(--ds-text-xs);
    font-weight: var(--ds-font-bold);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--ds-transition-base), border-color var(--ds-transition-base), color var(--ds-transition-base);
}
.atg-newchat-btn:hover {
    background: var(--ds-color-primary-muted);
    border-color: var(--ds-color-primary);
    color: var(--ds-color-primary);
}
.atg-panel {
    display: none;
}
.atg-panel.is-active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.atg-chat {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-4);
    overflow-y: auto;
    padding: var(--ds-space-4) var(--ds-space-2) var(--ds-space-2);
    scroll-behavior: smooth;
    position: relative;
}
.atg-form-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--ds-space-1) var(--ds-space-1) var(--ds-space-4);
}
.atg-message {
    display: flex;
    align-items: flex-start;
    animation: ds-fade-slide-in 0.3s ease;
}
.atg-message--user {
    justify-content: flex-end;
}
.atg-message__col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 92%;
}
.atg-message--user .atg-message__col {
    align-items: flex-end;
}
.atg-message__bubble {
    background: var(--ds-color-surface-raised);
    border: 1px solid var(--ds-color-border);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    padding: 12px 16px;
    font-size: 0.88rem;
    line-height: var(--ds-leading-relaxed);
    color: var(--ds-color-text-primary);
    max-width: 100%;
    white-space: pre-line;
    box-shadow: var(--ds-shadow-xs);
}
.atg-message__bubble p {
    margin: 0 0 8px;
}
.atg-message__bubble p:last-child {
    margin-bottom: 0;
}
.atg-message--user .atg-message__bubble {
    background: linear-gradient(135deg, var(--ds-color-primary), var(--ds-color-primary-hover));
    color: var(--ds-color-text-inverse);
    border-color: transparent;
    border-bottom-right-radius: 6px;
    border-bottom-left-radius: 20px;
    box-shadow: var(--ds-shadow-brand);
}
.atg-message--typing .atg-message__bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 18px;
}
.atg-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ds-color-text-muted);
    animation: ds-dot-blink 1.2s ease-in-out infinite both;
}
.atg-typing-dot:nth-child(2) {
    animation-delay: 0.18s;
}
.atg-typing-dot:nth-child(3) {
    animation-delay: 0.36s;
}
.atg-composer-area {
    flex: 0 0 auto;
    padding-top: var(--ds-space-2);
}
.atg-suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--ds-space-2);
    margin-bottom: var(--ds-space-3);
}
.atg-suggestions.is-hidden {
    display: none;
}
.atg-suggestions__list {
    display: contents;
}
.atg-suggestions__label {
    grid-column: 1 / -1;
    font-size: var(--ds-text-xs);
    font-weight: var(--ds-font-bold);
    color: var(--ds-color-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--ds-tracking-wide);
}
.atg-suggestion-chip {
    border: 1.5px solid var(--ds-color-border-input);
    background: var(--ds-color-surface);
    color: var(--ds-color-text-secondary);
    border-radius: var(--ds-radius-lg);
    padding: 10px 14px;
    font-size: 0.82rem;
    font-family: var(--ds-font-family);
    cursor: pointer;
    max-width: 100%;
    text-align: left;
    transition: background var(--ds-transition-base), border-color var(--ds-transition-base), color var(--ds-transition-base), transform var(--ds-transition-spring-fast), box-shadow var(--ds-transition-base);
}
.atg-suggestion-chip:hover {
    background: var(--ds-color-primary-muted);
    border-color: var(--ds-color-primary);
    color: var(--ds-color-primary);
    transform: translateY(-2px);
    box-shadow: var(--ds-shadow-sm);
}
.atg-composer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "tools input send";
    align-items: center;
    column-gap: var(--ds-space-2);
    row-gap: 2px;
    background: var(--ds-color-surface);
    border: 1.5px solid var(--ds-color-border-input);
    border-radius: var(--ds-radius-2xl);
    padding: 6px;
    box-shadow: var(--ds-shadow-lg);
}
.atg-composer.is-expanded {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "input input"
        "tools send";
}
.atg-composer__tools {
    grid-area: tools;
    display: flex;
    align-items: center;
    gap: var(--ds-space-2);
}
.atg-composer:focus-within {
    border-color: var(--ds-color-primary);
    box-shadow: var(--ds-shadow-focus);
}
.atg-composer__input {
    grid-area: input;
    width: 100%;
    min-width: 0;
    resize: none;
    border: none;
    background: transparent;
    padding: 10px 8px;
    font-family: var(--ds-font-family);
    font-size: 0.95rem;
    max-height: 200px;
    line-height: var(--ds-leading-normal);
}
.atg-composer.is-expanded .atg-composer__input {
    padding: 10px 12px 4px;
}
.atg-composer__input:focus {
    outline: none;
    border: none;
    box-shadow: none;
}
.ds-btn.atg-composer__send {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    padding: 0;
    flex-shrink: 0;
    font-size: 0.9rem;
    grid-area: send;
}
.atg-composer__newchat,
.atg-composer__deep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    padding: 0;
    flex-shrink: 0;
    border: 1.5px solid var(--ds-color-border-input);
    background: var(--ds-color-surface);
    color: var(--ds-color-text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--ds-transition-base), border-color var(--ds-transition-base), color var(--ds-transition-base), box-shadow var(--ds-transition-base);
}
.atg-composer__newchat:hover,
.atg-composer__deep:hover {
    background: var(--ds-color-primary-muted);
    border-color: var(--ds-color-primary);
    color: var(--ds-color-primary);
}
.atg-composer__deep.is-deep {
    background: var(--ds-color-primary);
    border-color: var(--ds-color-primary);
    color: var(--ds-color-text-inverse);
    box-shadow: var(--ds-shadow-brand);
}
.atg-composer__deep.is-deep:hover {
    background: var(--ds-color-primary-hover);
    border-color: var(--ds-color-primary-hover);
    color: var(--ds-color-text-inverse);
}
.atg-composer-note {
    margin: var(--ds-space-2) 2px 0;
    font-size: 0.7rem;
    color: var(--ds-color-text-muted);
    text-align: center;
}
.atg-message__bubble strong {
    font-weight: var(--ds-font-bold);
    color: inherit;
}
.atg-message__bubble ul {
    margin: 6px 0;
    padding-left: 18px;
}
.atg-message__bubble li {
    margin-bottom: 2px;
}
.atg-message__meta {
    font-size: 0.68rem;
    color: var(--ds-color-text-muted);
    margin-top: 4px;
    padding-left: 2px;
}
.atg-message--user .atg-message__meta {
    text-align: right;
    padding-right: 2px;
}
.atg-message__actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}
.atg-message--user .atg-message__actions {
    display: none;
}
.atg-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--ds-radius-full);
    border: 1px solid var(--ds-color-border-input);
    background: var(--ds-color-surface);
    color: var(--ds-color-text-muted);
    font-size: 0.72rem;
    cursor: pointer;
    transition: background var(--ds-transition-fast), color var(--ds-transition-fast), border-color var(--ds-transition-fast);
}
.atg-action-btn:hover {
    background: var(--ds-color-primary-muted);
    border-color: var(--ds-color-primary);
    color: var(--ds-color-primary);
}
.atg-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: currentColor;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: atg-cursor-blink 0.9s steps(1) infinite;
}
@keyframes atg-cursor-blink {
    0%,
    50% {
        opacity: 1;
    }
    50.01%,
    100% {
        opacity: 0;
    }
}
.atg-message--streaming .atg-message__bubble {
    background: linear-gradient(100deg, var(--ds-color-surface-raised) 40%, var(--ds-color-primary-subtle) 50%, var(--ds-color-surface-raised) 60%);
    background-size: 200% 100%;
    animation: atg-bubble-shimmer 2.2s linear infinite;
}
@keyframes atg-bubble-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
@media (max-width: 576px) {
    .atg-topbar__tagline {
        display: none;
    }
    .atg-suggestions {
        grid-template-columns: 1fr;
    }
    .atg-message__bubble {
        padding: 12px 15px;
    }
    .atg-message__col {
        max-width: 95%;
    }
    .atg-shell {
        gap: var(--ds-space-2);
    }
}
.ds-toggle input:disabled+.ds-toggle__slider {
    opacity: 0.45;
    cursor: not-allowed;
}
.atg-history-note {
    margin: 0 0 var(--ds-space-3);
    font-size: var(--ds-text-xs);
    color: var(--ds-color-text-muted);
}
.atg-history-item .ds-list-item__title {
    max-width: 210px;
}
.atg-history-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: var(--ds-radius-full);
    background: none;
    color: var(--ds-color-text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background var(--ds-transition-fast), color var(--ds-transition-fast);
}
.atg-history-delete:hover {
    background: var(--ds-color-danger-muted);
    color: var(--ds-color-danger);
}
.atg-history-more {
    width: 100%;
    margin-top: var(--ds-space-3);
}
@media (max-width: 576px) {
    .atg-newchat-btn span {
        display: none;
    }
    .atg-newchat-btn {
        padding: 8px 12px;
    }
    .atg-history-item .ds-list-item__title {
        max-width: 160px;
    }
}
.atg-chat__spacer {
    flex: 0 0 auto;
    pointer-events: none;
}
.atg-mode-list {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
}
.atg-mode-option {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
    width: 100%;
    padding: var(--ds-space-3) var(--ds-space-4);
    border: 1.5px solid var(--ds-color-border-input);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-color-surface);
    font-family: var(--ds-font-family);
    text-align: left;
    cursor: pointer;
    transition: background var(--ds-transition-base), border-color var(--ds-transition-base), box-shadow var(--ds-transition-base);
}
.atg-mode-option:hover {
    border-color: var(--ds-color-primary);
    background: var(--ds-color-primary-subtle);
}
.atg-mode-option.is-selected {
    border-color: var(--ds-color-primary);
    background: var(--ds-color-primary-muted);
    box-shadow: var(--ds-shadow-focus);
}
.atg-mode-option__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ds-color-surface-sunken);
    color: var(--ds-color-text-secondary);
    font-size: 0.95rem;
}
.atg-mode-option.is-selected .atg-mode-option__icon {
    background: var(--ds-color-primary);
    color: var(--ds-color-text-inverse);
}
.atg-mode-option__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.atg-mode-option__title {
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-font-bold);
    color: var(--ds-color-text-primary);
}
.atg-mode-option__desc {
    font-size: var(--ds-text-xs);
    line-height: var(--ds-leading-snug);
    color: var(--ds-color-text-muted);
}
.atg-mode-option__cost {
    flex-shrink: 0;
}
.atg-mode-option__check {
    display: none;
    flex-shrink: 0;
    color: var(--ds-color-primary);
}
.atg-mode-option.is-selected .atg-mode-option__check {
    display: inline-block;
}
.atg-mode-option__lock {
    display: none;
    flex-shrink: 0;
    color: var(--ds-color-warning);
}
.atg-mode-option.is-locked {
    opacity: 0.75;
    cursor: not-allowed;
}
.atg-mode-option.is-locked:hover {
    border-color: var(--ds-color-border-input);
    background: var(--ds-color-surface);
}
.atg-mode-option.is-locked .atg-mode-option__lock {
    display: inline-block;
}
.atg-mode-lock,
.atg-mode-note {
    margin: var(--ds-space-3) 0 0;
    font-size: 0.72rem;
    line-height: var(--ds-leading-snug);
    color: var(--ds-color-text-muted);
    text-align: center;
}
#atgModeDrawer .ds-drawer__body {
    padding-bottom: calc(var(--ds-space-5) + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 577px) {
    #atgModeDrawer .ds-drawer__panel {
        left: 50%;
        right: auto;
        width: 480px;
        max-width: 100%;
        transform: translate(-50%, 100%);
    }
    #atgModeDrawer.is-open .ds-drawer__panel {
        transform: translate(-50%, 0);
    }
}
@media (max-width: 576px) {
    .atg-composer__newchat,
    .atg-composer__deep {
        width: 38px;
        height: 38px;
    }
    .ds-btn.atg-composer__send {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
    }
}
.atg-offer {
    margin-top: var(--ds-space-2);
    padding: var(--ds-space-3) var(--ds-space-4);
    background: var(--ds-color-primary-subtle);
    border: 1px solid var(--ds-color-primary-border);
    border-radius: var(--ds-radius-lg);
    animation: ds-fade-slide-in 0.3s ease;
}
.atg-offer__text {
    margin: 0 0 var(--ds-space-2);
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-font-semibold);
    line-height: var(--ds-leading-snug);
    color: var(--ds-color-text-primary);
}
.atg-offer__actions,
.atg-offer__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ds-space-2);
}
.atg-offer__input {
    flex: 1 1 180px;
    min-width: 0;
}
.atg-offer__status {
    margin: var(--ds-space-2) 0 0;
    font-size: var(--ds-text-xs);
    color: var(--ds-color-text-muted);
}
.atg-offer__status:empty {
    display: none;
}
.atg-offer__status.is-error {
    color: var(--ds-color-danger);
}
.atg-offer.is-done {
    background: var(--ds-color-success-muted);
    border-color: var(--ds-color-success-border);
}
.atg-offer.is-done .atg-offer__text i {
    margin-right: 6px;
    color: var(--ds-color-success);
}
.atg-action-btn.is-active {
    background: var(--ds-color-primary-muted);
    border-color: var(--ds-color-primary);
    color: var(--ds-color-primary);
}
.atg-action-btn[data-atg-action="dislike"].is-active {
    background: var(--ds-color-danger-muted);
    border-color: var(--ds-color-danger);
    color: var(--ds-color-danger);
}
.atg-feedback-chips .ds-chip {
    white-space: normal;
    text-align: left;
    line-height: 1.3;
}
.atg-feedback-note {
    margin: 0;
    padding: var(--ds-space-2) var(--ds-space-6) var(--ds-space-3);
    font-size: 0.68rem;
    line-height: var(--ds-leading-snug);
    color: var(--ds-color-text-muted);
    text-align: center;
}
@media (max-width: 768px) {
    .atg-feedback-note {
        padding-left: var(--ds-space-4);
        padding-right: var(--ds-space-4);
    }
}