/* Kitano AI workspace polish
 * Loaded after the legacy frontend bundle so the chat shell has one final,
 * predictable responsive and theme layer. It is intentionally scoped to the
 * Kitano workspace classes and does not style marketing or billing sections.
 */

body.frontend-body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body.frontend-body :where(
    .kitano-icon-button,
    .kitano-round-action,
    .kitano-send,
    .kitano-intelligence-button,
    .kitano-tool-item,
    .kitano-choice,
    .kitano-setting-row
) {
    -webkit-tap-highlight-color: transparent;
}

body.frontend-body :where(
    .kitano-icon-button,
    .kitano-round-action,
    .kitano-send,
    .kitano-intelligence-button
) {
    min-width: 40px;
    min-height: 40px;
}

body.frontend-body :where(
    .kitano-icon-button,
    .kitano-round-action,
    .kitano-send,
    .kitano-intelligence-button,
    .kitano-tool-item,
    .kitano-choice,
    .kitano-setting-row,
    .kitano-history-open,
    .kitano-popover-link
):focus-visible {
    outline: 3px solid color-mix(in srgb, #6f78f4 52%, transparent) !important;
    outline-offset: 2px;
}

body.frontend-body .kitano-svg-icon {
    width: 19px;
    height: 19px;
    stroke-width: 1.8;
}

body.frontend-body .kitano-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--kitano-ink) !important;
    text-decoration: none !important;
}

body.frontend-body .kitano-brand .kitano-brand-mark {
    width: 32px;
    height: 32px;
    max-width: none;
    flex: 0 0 32px;
    object-fit: cover;
    border: 1px solid var(--kitano-line);
    border-radius: 50%;
    filter: none !important;
}

body.frontend-body .kitano-brand-name {
    color: inherit;
    font-size: 18px;
    font-weight: 780;
    letter-spacing: -.035em;
    line-height: 1;
    white-space: nowrap;
}

body.frontend-body .kitano-nav,
body.frontend-body .kitano-composer,
body.frontend-body .kitano-popover,
body.frontend-body .kitano-tool-menu,
body.frontend-body .kitano-command-menu,
body.frontend-body .kitano-intelligence-panel,
body.frontend-body .kitano-search-dialog,
body.frontend-body .kitano-sources-panel {
    background-color: var(--kitano-panel) !important;
    border-color: var(--kitano-line) !important;
}

body.frontend-body .kitano-nav {
    background-color: var(--kitano-bg) !important;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--kitano-ink) 4%, transparent);
}

body.frontend-body .kitano-composer {
    width: min(860px, calc(100% - 28px));
    border-width: 1px !important;
    box-shadow: 0 12px 34px rgba(16, 24, 40, .08) !important;
}

body.frontend-body .kitano-composer:focus-within {
    border-color: color-mix(in srgb, #6f78f4 48%, var(--kitano-line)) !important;
    box-shadow: 0 0 0 4px color-mix(in srgb, #6f78f4 12%, transparent),
                0 14px 38px rgba(16, 24, 40, .1) !important;
}

body.frontend-body .kitano-composer textarea {
    color: var(--kitano-ink) !important;
    font-size: 15.5px !important;
    letter-spacing: -.006em;
}

body.frontend-body .kitano-composer textarea::placeholder {
    color: var(--kitano-muted) !important;
    opacity: .92;
}

/* The model/settings trigger is the visible model selector. Give it enough
 * room for a branded model label instead of reducing it to a tiny icon. */
body.frontend-body .kitano-intelligence-button {
    max-width: 230px;
    min-height: 40px;
    padding: 7px 11px !important;
    border: 1px solid var(--kitano-line) !important;
    border-radius: 12px !important;
    background: var(--kitano-soft) !important;
    color: var(--kitano-ink) !important;
    font-size: 13px !important;
    font-weight: 700;
}

body.frontend-body .kitano-intelligence-button:hover,
body.frontend-body .kitano-intelligence-button[aria-expanded="true"] {
    border-color: color-mix(in srgb, #6f78f4 48%, var(--kitano-line)) !important;
    background: color-mix(in srgb, #6f78f4 8%, var(--kitano-panel)) !important;
}

body.frontend-body .kitano-intelligence-button > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.frontend-body .kitano-intelligence-panel {
    width: min(320px, calc(100vw - 24px));
    padding: 9px !important;
    border-radius: 16px !important;
    box-shadow: 0 24px 64px rgba(15, 20, 34, .2) !important;
}

body.frontend-body .kitano-setting-row,
body.frontend-body #kitano-model-choices .kitano-choice {
    min-height: 56px;
    padding: 9px 11px;
    border-radius: 11px;
}

body.frontend-body :where(.kitano-setting-row, #kitano-model-choices .kitano-choice) strong {
    color: var(--kitano-ink);
    font-size: 13.5px !important;
    line-height: 1.25;
}

body.frontend-body :where(.kitano-setting-row, #kitano-model-choices .kitano-choice) small {
    color: var(--kitano-muted) !important;
    font-size: 12px !important;
    line-height: 1.35;
}

body.frontend-body .kitano-tool-menu {
    width: min(440px, calc(100vw - 24px));
    padding: 8px !important;
    border-radius: 16px !important;
    box-shadow: 0 22px 58px rgba(15, 20, 34, .18) !important;
}

body.frontend-body .kitano-tool-item {
    min-height: 54px !important;
    grid-template-columns: 28px minmax(0, auto) minmax(0, 1fr);
    gap: 9px;
    padding: 9px 11px !important;
    border-radius: 11px;
}

body.frontend-body .kitano-tool-item strong {
    color: var(--kitano-ink);
    font-size: 13.5px !important;
}

body.frontend-body .kitano-tool-item span {
    color: var(--kitano-muted) !important;
    font-size: 12.5px !important;
}

body.frontend-body .kitano-message.assistant .bubble {
    color: var(--kitano-ink) !important;
}

body.frontend-body .kitano-message.user .bubble {
    border: 1px solid var(--kitano-line);
}

html[data-kitano-theme="dark"] body.frontend-body {
    --kitano-bg: #121315;
    --kitano-panel: #1b1d20;
    --kitano-soft: #24272b;
    --kitano-line: #373b41;
    --kitano-ink: #f5f6f7;
    --kitano-muted: #b0b5be;
    background: var(--kitano-bg) !important;
}

html[data-kitano-theme="dark"] body.frontend-body :where(
    .kitano-nav,
    .kitano-composer,
    .kitano-popover,
    .kitano-tool-menu,
    .kitano-command-menu,
    .kitano-intelligence-panel,
    .kitano-search-dialog,
    .kitano-sources-panel,
    .kitano-sidebar-account
) {
    background: var(--kitano-panel) !important;
    border-color: var(--kitano-line) !important;
    backdrop-filter: none !important;
}

html[data-kitano-theme="dark"] body.frontend-body .kitano-composer {
    box-shadow: 0 16px 44px rgba(0, 0, 0, .28) !important;
}

html[data-kitano-theme="dark"] body.frontend-body .kitano-composer:focus-within {
    border-color: #686f83 !important;
    box-shadow: 0 0 0 4px rgba(130, 139, 255, .12),
                0 18px 48px rgba(0, 0, 0, .34) !important;
}

html[data-kitano-theme="dark"] body.frontend-body .kitano-intelligence-button {
    background: #25282d !important;
    border-color: #3d424a !important;
}

html[data-kitano-theme="dark"] body.frontend-body .kitano-intelligence-button:hover,
html[data-kitano-theme="dark"] body.frontend-body .kitano-intelligence-button[aria-expanded="true"] {
    background: #2b2f35 !important;
    border-color: #606775 !important;
}

body.frontend-body.kitano-chat-mode #capabilities,
body.frontend-body.kitano-chat-mode #prices {
    display: none !important;
}

@media (max-width: 700px) {
    html.kitano-chat-mode {
        width: 100%;
        height: 100%;
        overflow: hidden !important;
        overscroll-behavior: none;
    }

    body.frontend-body.kitano-chat-mode {
        width: 100%;
        height: 100%;
        overflow: hidden !important;
        overscroll-behavior: none;
    }

    body.frontend-body .kitano-hero.chat-active {
        position: fixed !important;
        inset: calc(58px + env(safe-area-inset-top)) 0 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 42px 8px 0 !important;
        overflow: hidden !important;
        z-index: 2;
    }

    body.frontend-body .kitano-brand {
        justify-content: center;
        gap: 8px;
    }

    body.frontend-body .kitano-brand .kitano-brand-mark {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
    }

    body.frontend-body .kitano-brand-name {
        font-size: 16px;
    }

    body.frontend-body .kitano-composer,
    body.frontend-body .kitano-hero.chat-active .kitano-composer {
        z-index: 75 !important;
        left: 9px !important;
        right: 9px !important;
        bottom: max(7px, env(safe-area-inset-bottom)) !important;
        width: auto !important;
        min-height: 120px !important;
        padding: 10px !important;
        border-radius: 26px !important;
        transition: border-color .18s ease, box-shadow .18s ease !important;
    }

    body.frontend-body .kitano-composer-row {
        display: grid !important;
        grid-template-columns: 46px minmax(0, 1fr) !important;
        grid-template-rows: minmax(58px, auto) 46px !important;
        width: 100%;
        min-width: 0;
        gap: 7px 8px !important;
        align-items: end;
    }

    body.frontend-body .kitano-composer textarea {
        display: block;
        grid-column: 1 / -1 !important;
        grid-row: 1 !important;
        width: 100% !important;
        min-width: 0 !important;
        height: var(--kitano-prompt-height, 58px) !important;
        min-height: 58px !important;
        max-height: min(220px, 34dvh) !important;
        padding: 12px 14px 7px !important;
        border-radius: 16px !important;
        font-size: 16px !important;
        line-height: 1.5 !important;
        white-space: pre-wrap !important;
        overflow-wrap: anywhere;
        overflow-x: hidden;
        overflow-y: hidden;
        scrollbar-width: thin;
        scrollbar-color: color-mix(in srgb, var(--kitano-ink) 35%, transparent) transparent;
    }

    body.frontend-body #kitano-tools-toggle {
        display: inline-grid !important;
        flex: 0 0 46px !important;
        grid-column: 1 !important;
        grid-row: 2 !important;
        width: 46px !important;
        min-width: 46px !important;
        height: 46px !important;
    }

    body.frontend-body .kitano-composer-actions {
        display: flex !important;
        flex: 0 0 auto !important;
        grid-column: 2 !important;
        grid-row: 2 !important;
        justify-content: flex-end;
        width: 100% !important;
        min-width: 0;
        gap: 4px !important;
        padding: 0 !important;
    }

    body.frontend-body .kitano-composer-actions > #kitano-intelligence-toggle {
        display: inline-flex !important;
        flex: 1 1 116px !important;
        width: auto !important;
        min-width: 96px !important;
        max-width: 154px !important;
        height: 46px !important;
        justify-content: center;
        padding: 0 10px !important;
        border-radius: 14px !important;
    }

    body.frontend-body #kitano-intelligence-toggle > span {
        display: block !important;
        min-width: 0;
        max-width: none;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.frontend-body #kitano-intelligence-toggle > .fa-chevron-up {
        display: none !important;
    }

    body.frontend-body .kitano-composer-actions .kitano-round-action,
    body.frontend-body .kitano-composer-actions .kitano-send {
        flex: 0 0 46px !important;
        width: 46px !important;
        min-width: 46px !important;
        height: 46px !important;
    }

    body.frontend-body .kitano-intelligence-panel,
    body.frontend-body .kitano-intelligence-panel.open {
        position: fixed !important;
        z-index: 190 !important;
        left: 9px !important;
        right: 9px !important;
        top: auto !important;
        bottom: calc(var(--kitano-composer-height, 120px) + 15px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-height: min(66dvh, 560px) !important;
        overflow-y: auto !important;
        border-radius: 18px !important;
    }

    body.frontend-body .kitano-tool-menu {
        position: fixed !important;
        left: 9px !important;
        right: 9px !important;
        top: auto !important;
        bottom: calc(var(--kitano-composer-height, 120px) + 15px + env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-height: min(370px, 58dvh) !important;
        overflow-y: auto;
    }

    body.frontend-body .kitano-hero.chat-active .kitano-thread {
        flex: 1 1 auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        padding: 6px 3px 176px !important;
        scroll-padding-bottom: 176px !important;
        overscroll-behavior-y: contain;
        overflow-anchor: none;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 390px) {
    body.frontend-body .kitano-composer textarea {
        min-width: 0 !important;
    }

    body.frontend-body .kitano-composer-actions > #kitano-intelligence-toggle {
        flex-basis: 74px !important;
        min-width: 68px !important;
        max-width: 92px !important;
        padding-inline: 7px !important;
    }

    body.frontend-body #kitano-intelligence-toggle > span {
        max-width: 66px;
    }

    body.frontend-body #kitano-intelligence-toggle > .fa-sparkles {
        display: none !important;
    }

    body.frontend-body .kitano-composer-actions .kitano-round-action,
    body.frontend-body .kitano-composer-actions .kitano-send,
    body.frontend-body #kitano-tools-toggle {
        flex-basis: 44px !important;
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
    }
}

/* Responsive conversation frame v9
 * Keep the reading column centered at every window size while the thread
 * remains the full-width scroll viewport. This places the native scrollbar
 * on the application's far-right edge instead of beside a narrow column.
 */
body.frontend-body .kitano-hero {
    --kitano-conversation-width: 820px;
    --kitano-conversation-gutter: clamp(16px, 3vw, 34px);
}

body.frontend-body .kitano-hero.chat-active {
    padding-top: 0 !important;
}

body.frontend-body .kitano-hero.chat-active .kitano-thread {
    align-self: stretch;
    width: 100% !important;
    max-width: none !important;
    margin-inline: 0 !important;
    padding-left: max(
        var(--kitano-conversation-gutter),
        calc((100% - var(--kitano-conversation-width)) / 2)
    ) !important;
    padding-right: max(
        var(--kitano-conversation-gutter),
        calc((100% - var(--kitano-conversation-width)) / 2)
    ) !important;
    box-sizing: border-box;
    padding-top: clamp(4px, 1vh, 10px) !important;
    overflow-x: hidden !important;
    overflow-y: scroll !important;
    scrollbar-gutter: stable;
    scrollbar-width: thin !important;
    scrollbar-color: color-mix(in srgb, var(--kitano-ink) 42%, transparent) transparent !important;
}

body.frontend-body .kitano-hero.chat-active .kitano-thread::-webkit-scrollbar {
    display: block !important;
    width: 10px;
}

body.frontend-body .kitano-hero.chat-active .kitano-thread::-webkit-scrollbar-track {
    background: transparent;
}

body.frontend-body .kitano-hero.chat-active .kitano-thread::-webkit-scrollbar-thumb {
    min-height: 42px;
    border: 3px solid transparent;
    border-radius: 999px;
    background: color-mix(in srgb, var(--kitano-ink) 42%, transparent);
    background-clip: padding-box;
}

body.frontend-body .kitano-hero.chat-active .kitano-thread::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--kitano-ink) 62%, transparent);
    background-clip: padding-box;
}

body.frontend-body .kitano-hero.chat-active .kitano-composer,
body.frontend-body .kitano-hero.chat-active .kitano-status {
    width: min(
        var(--kitano-conversation-width),
        calc(100% - var(--kitano-conversation-gutter) - var(--kitano-conversation-gutter))
    ) !important;
    max-width: var(--kitano-conversation-width) !important;
    margin-inline: auto !important;
}

body.frontend-body .kitano-hero.chat-active .kitano-chat-minimap {
    right: 20px;
}

@media (max-width: 700px) {
    body.frontend-body .kitano-hero {
        --kitano-conversation-gutter: clamp(10px, 3.5vw, 16px);
    }

    body.frontend-body .kitano-hero.chat-active .kitano-thread {
        padding-left: var(--kitano-conversation-gutter) !important;
        padding-right: var(--kitano-conversation-gutter) !important;
        scrollbar-gutter: auto;
    }

    body.frontend-body .kitano-hero.chat-active .kitano-thread::-webkit-scrollbar {
        width: 7px;
    }

    body.frontend-body .kitano-hero.chat-active .kitano-composer {
        width: auto !important;
        max-width: none !important;
        margin-inline: 0 !important;
    }

    body.frontend-body .kitano-hero.chat-active .kitano-status {
        width: calc(100% - var(--kitano-conversation-gutter) - var(--kitano-conversation-gutter)) !important;
    }

    body.frontend-body .kitano-hero.chat-active .kitano-chat-minimap {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.frontend-body .kitano-composer,
    body.frontend-body .kitano-intelligence-panel,
    body.frontend-body .kitano-tool-menu {
        transition: none !important;
    }
}

/* Kitano workspace visual system v7
 * A final, deliberately small override layer for the public workspace. It
 * improves depth, contrast and responsive composition without changing the
 * request, history, voice, image or task behaviour implemented by the page.
 */
body.frontend-body {
    --kitano-bg: #f6f7fb;
    --kitano-panel: #ffffff;
    --kitano-soft: #f0f2f7;
    --kitano-line: #dfe3ec;
    --kitano-ink: #121622;
    --kitano-muted: #687184;
    --kitano-brand-accent: #6875ff;
    --kitano-brand-cyan: #44c7e8;
    background: var(--kitano-bg) !important;
}

html[data-kitano-theme="dark"] body.frontend-body {
    --kitano-bg: #0d0f13;
    --kitano-panel: #17191f;
    --kitano-soft: #20232b;
    --kitano-line: #30343e;
    --kitano-ink: #f7f8fb;
    --kitano-muted: #a9b0bd;
    background: var(--kitano-bg) !important;
}

body.frontend-body :where(.page, .page-main, .main-content, .side-app, .frontend-background) {
    background: var(--kitano-bg) !important;
}

body.frontend-body .kitano-nav {
    min-height: 66px;
    background: color-mix(in srgb, var(--kitano-bg) 92%, transparent) !important;
    border-bottom: 1px solid color-mix(in srgb, var(--kitano-line) 86%, transparent) !important;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--kitano-ink) 3%, transparent) !important;
    backdrop-filter: blur(20px) saturate(1.18) !important;
}

body.frontend-body .kitano-brand .kitano-brand-mark {
    border-color: color-mix(in srgb, var(--kitano-brand-cyan) 35%, var(--kitano-line));
    box-shadow: 0 7px 22px rgba(36, 155, 210, .18);
}

body.frontend-body .kitano-nav-links > a:not(.kitano-start) {
    padding-inline: 4px;
    color: color-mix(in srgb, var(--kitano-ink) 88%, var(--kitano-muted));
    text-decoration: none;
    transition: color .16s ease, transform .16s ease;
}

body.frontend-body .kitano-nav-links > a:not(.kitano-start):hover {
    color: var(--kitano-ink);
    transform: translateY(-1px);
}

body.frontend-body .kitano-start,
body.frontend-body .kitano-nav-install {
    min-height: 42px;
    border-radius: 13px !important;
}

body.frontend-body .kitano-hero:not(.chat-active) {
    isolation: isolate;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 16%, color-mix(in srgb, var(--kitano-brand-cyan) 8%, transparent), transparent 29%),
        radial-gradient(circle at 82% 4%, color-mix(in srgb, var(--kitano-brand-accent) 11%, transparent), transparent 32%),
        linear-gradient(180deg, color-mix(in srgb, var(--kitano-panel) 18%, transparent), transparent 48%),
        var(--kitano-bg) !important;
}

body.frontend-body .kitano-hero:not(.chat-active)::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    background-image: radial-gradient(circle, color-mix(in srgb, var(--kitano-ink) 12%, transparent) .7px, transparent .8px);
    background-size: 27px 27px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 58%);
    opacity: .25;
    pointer-events: none;
}

body.frontend-body .kitano-hero:not(.chat-active) > h1 {
    max-width: 880px;
    text-shadow: 0 1px 0 color-mix(in srgb, var(--kitano-panel) 65%, transparent);
}

body.frontend-body .kitano-hero:not(.chat-active) > .kitano-lead {
    max-width: 720px;
    color: color-mix(in srgb, var(--kitano-muted) 91%, var(--kitano-ink));
}

body.frontend-body .kitano-composer {
    border-color: color-mix(in srgb, var(--kitano-line) 78%, var(--kitano-ink)) !important;
    background: color-mix(in srgb, var(--kitano-panel) 96%, var(--kitano-soft)) !important;
    box-shadow: 0 20px 60px rgba(18, 24, 40, .11), 0 3px 10px rgba(18, 24, 40, .055) !important;
}

html[data-kitano-theme="dark"] body.frontend-body .kitano-composer {
    background: #181b21 !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34), inset 0 1px 0 rgba(255,255,255,.025) !important;
}

body.frontend-body .kitano-composer :where(.kitano-round-action, .kitano-intelligence-button) {
    border-color: color-mix(in srgb, var(--kitano-line) 82%, transparent) !important;
    transition: transform .16s ease, color .16s ease, border-color .16s ease, background-color .16s ease;
}

body.frontend-body .kitano-composer :where(.kitano-round-action, .kitano-intelligence-button):hover {
    border-color: color-mix(in srgb, var(--kitano-brand-accent) 42%, var(--kitano-line)) !important;
    color: var(--kitano-ink) !important;
    transform: translateY(-1px);
}

body.frontend-body .kitano-hero:not(.chat-active) .kitano-suggestion {
    border-color: color-mix(in srgb, var(--kitano-line) 84%, transparent) !important;
    background: color-mix(in srgb, var(--kitano-panel) 97%, var(--kitano-soft)) !important;
    box-shadow: 0 10px 28px rgba(19, 28, 48, .055);
}

body.frontend-body .kitano-hero.chat-active {
    background:
        linear-gradient(90deg, transparent, color-mix(in srgb, var(--kitano-panel) 18%, transparent) 50%, transparent),
        var(--kitano-bg) !important;
}

body.frontend-body .kitano-hero.chat-active .kitano-thread {
    width: min(900px, 100%);
    margin-inline: auto;
}

body.frontend-body .kitano-message.user .bubble {
    max-width: min(72ch, 78vw);
    border-color: color-mix(in srgb, var(--kitano-line) 78%, var(--kitano-ink));
    background: color-mix(in srgb, var(--kitano-soft) 90%, var(--kitano-panel));
    box-shadow: 0 5px 18px rgba(18, 24, 40, .045);
}

html[data-kitano-theme="dark"] body.frontend-body .kitano-message.user .bubble {
    background: #252830 !important;
    border-color: #363b46 !important;
}

body.frontend-body .kitano-message.assistant .bubble {
    color: color-mix(in srgb, var(--kitano-ink) 95%, var(--kitano-muted)) !important;
}

body.frontend-body .kitano-message.assistant .bubble :where(h1, h2, h3) {
    text-wrap: balance;
}

body.frontend-body .kitano-message.assistant .bubble :where(blockquote.kitano-callout, details, .kitano-table-shell) {
    box-shadow: 0 8px 28px rgba(18, 24, 40, .04);
}

body.frontend-body .kitano-generated-figure,
body.frontend-body .kitano-source-card.kitano-output-card,
body.frontend-body .kitano-audio-result {
    border: 1px solid var(--kitano-line);
    box-shadow: 0 18px 48px rgba(18, 24, 40, .09);
}

body.frontend-body .kitano-generated-figure {
    background: color-mix(in srgb, var(--kitano-soft) 82%, var(--kitano-panel));
}

body.frontend-body .kitano-image-edit,
body.frontend-body .kitano-image-download {
    min-width: 46px;
    height: 42px;
    background: rgba(12, 15, 21, .84);
    border: 1px solid rgba(255,255,255,.16);
    box-shadow: 0 10px 30px rgba(0,0,0,.24);
}

body.frontend-body .kitano-status.visible,
body.frontend-body .kitano-inline-task {
    border-color: color-mix(in srgb, var(--kitano-brand-accent) 26%, var(--kitano-line)) !important;
    background: color-mix(in srgb, var(--kitano-panel) 95%, var(--kitano-brand-accent)) !important;
    box-shadow: 0 16px 45px rgba(43, 51, 112, .09);
}

body.frontend-body .kitano-capability,
body.frontend-body .kitano-price-card {
    background: color-mix(in srgb, var(--kitano-panel) 97%, var(--kitano-soft));
    border-color: color-mix(in srgb, var(--kitano-line) 88%, transparent);
    box-shadow: 0 18px 52px rgba(18, 24, 40, .065);
}

body.frontend-body .kitano-price-card.featured {
    border-color: color-mix(in srgb, var(--kitano-brand-accent) 58%, var(--kitano-line));
    box-shadow: 0 24px 70px rgba(79, 89, 215, .15);
}

@media (max-width: 700px) {
    body.frontend-body .kitano-nav {
        min-height: calc(58px + env(safe-area-inset-top));
        backdrop-filter: blur(18px) saturate(1.12) !important;
    }

    /* The idle page should read like a complete landing screen. Only an
       active conversation needs the fixed, bottom-aligned composer. */
    body.frontend-body .kitano-hero:not(.chat-active) {
        min-height: auto !important;
        padding: clamp(30px, 6vh, 54px) 12px 54px !important;
        overflow: visible !important;
    }

    body.frontend-body .kitano-hero:not(.chat-active) .kitano-composer {
        position: relative !important;
        z-index: 5 !important;
        inset: auto !important;
        width: min(100%, 520px) !important;
        min-height: 120px !important;
        margin: 24px auto 0 !important;
    }

    body.frontend-body .kitano-hero:not(.chat-active) .kitano-suggestions {
        order: initial;
        margin-top: 12px !important;
    }

    body.frontend-body .kitano-hero:not(.chat-active) .kitano-note {
        margin-top: 14px !important;
    }

    body.frontend-body .kitano-hero.chat-active .kitano-thread {
        padding-inline: 7px !important;
    }

    body.frontend-body .kitano-message.user .bubble {
        max-width: min(88vw, 62ch);
        padding: 11px 14px;
    }

    body.frontend-body .kitano-message.assistant .bubble {
        font-size: 15px !important;
        line-height: 1.6 !important;
    }

    body.frontend-body .kitano-message.assistant .kitano-message-actions,
    body.frontend-body .kitano-message.user .kitano-message-actions {
        opacity: .82 !important;
        visibility: visible !important;
        transform: none !important;
    }
}

@media (max-width: 390px) {
    body.frontend-body .kitano-hero:not(.chat-active) > h1 {
        font-size: clamp(30px, 9.4vw, 38px) !important;
    }

    body.frontend-body .kitano-hero:not(.chat-active) > .kitano-lead {
        font-size: 14px !important;
    }
}

/* Keep the v9 conversation geometry last in the cascade on compact screens. */
@media (max-width: 700px) {
    body.frontend-body .kitano-hero.chat-active .kitano-thread {
        padding-left: var(--kitano-conversation-gutter) !important;
        padding-right: var(--kitano-conversation-gutter) !important;
    }
}

/* Professional conversation surface v10
 * Keep every turn in normal document flow, make the assistant immediately
 * recognizable, and keep the full action set attached to the answer it owns.
 */
body.frontend-body .kitano-hero.chat-active {
    background:
        radial-gradient(circle at 50% -18%, color-mix(in srgb, var(--kitano-brand-accent) 7%, transparent), transparent 44%),
        var(--kitano-bg) !important;
}

body.frontend-body .kitano-hero.chat-active .kitano-thread {
    display: flex !important;
    flex-flow: column nowrap !important;
    justify-content: flex-start !important;
    align-content: stretch !important;
    align-items: stretch !important;
    gap: clamp(14px, 1.7vh, 20px) !important;
    padding-top: clamp(18px, 2.4vh, 28px) !important;
}

body.frontend-body .kitano-hero.chat-active .kitano-thread > .kitano-message,
body.frontend-body .kitano-hero.chat-active .kitano-thread > .kitano-message + .kitano-message {
    position: relative !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: flex-start !important;
}

body.frontend-body .kitano-message.assistant .kitano-message-wrap {
    width: min(100%, 800px) !important;
    max-width: 100% !important;
    padding: 17px 18px 13px;
    border: 1px solid color-mix(in srgb, var(--kitano-answer-accent, var(--kitano-brand-accent)) 18%, var(--kitano-line));
    border-radius: 20px;
    background:
        linear-gradient(145deg,
            color-mix(in srgb, var(--kitano-answer-accent, var(--kitano-brand-accent)) 4%, var(--kitano-panel)),
            color-mix(in srgb, var(--kitano-panel) 96%, var(--kitano-bg)));
    box-shadow: 0 12px 36px rgba(17, 24, 39, .065);
}

body.frontend-body .kitano-message-identity {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 30px;
    margin-bottom: 11px;
    color: var(--kitano-ink);
}

body.frontend-body .kitano-message-identity-mark {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--kitano-answer-accent, var(--kitano-brand-accent)) 28%, var(--kitano-line));
    border-radius: 10px;
    background: color-mix(in srgb, var(--kitano-answer-accent, var(--kitano-brand-accent)) 11%, var(--kitano-panel));
    color: var(--kitano-answer-accent, var(--kitano-brand-accent));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

body.frontend-body .kitano-message-identity-mark svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.frontend-body .kitano-message-identity-copy {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

body.frontend-body .kitano-message-identity-copy strong {
    color: var(--kitano-ink);
    font-size: 13px;
    font-weight: 780;
    letter-spacing: -.01em;
}

body.frontend-body .kitano-message-identity-copy small {
    color: var(--kitano-muted);
    font-size: 11px;
    font-weight: 600;
}

body.frontend-body .kitano-message.assistant .bubble {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow-wrap: anywhere;
}

body.frontend-body .kitano-message.user {
    justify-content: flex-end !important;
}

body.frontend-body .kitano-message.user .kitano-message-wrap {
    width: auto !important;
    max-width: min(72%, 680px) !important;
}

body.frontend-body .kitano-message.user .bubble {
    width: auto !important;
    max-width: 100% !important;
    padding: 12px 16px !important;
    border: 1px solid color-mix(in srgb, var(--kitano-line) 76%, var(--kitano-ink)) !important;
    border-radius: 19px 19px 6px 19px !important;
    background: color-mix(in srgb, var(--kitano-soft) 88%, var(--kitano-panel)) !important;
    box-shadow: 0 8px 24px rgba(17, 24, 39, .055) !important;
}

body.frontend-body .kitano-message .kitano-message-actions {
    position: relative !important;
    left: auto !important;
    width: fit-content;
    max-width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 2px !important;
    margin-top: 9px !important;
    padding: 3px;
    overflow-x: auto;
    border: 1px solid color-mix(in srgb, var(--kitano-line) 86%, transparent);
    border-radius: 11px;
    background: color-mix(in srgb, var(--kitano-panel) 88%, transparent);
    scrollbar-width: none;
}

body.frontend-body .kitano-message .kitano-message-actions::-webkit-scrollbar {
    display: none;
}

body.frontend-body .kitano-message.assistant .kitano-message-actions {
    opacity: .72 !important;
    visibility: visible !important;
    transform: none !important;
    transition: opacity .16s ease, border-color .16s ease, background-color .16s ease;
}

body.frontend-body .kitano-message.assistant:hover .kitano-message-actions,
body.frontend-body .kitano-message.assistant:focus-within .kitano-message-actions {
    opacity: 1 !important;
    border-color: color-mix(in srgb, var(--kitano-answer-accent, var(--kitano-brand-accent)) 24%, var(--kitano-line));
}

body.frontend-body .kitano-message.user .kitano-message-actions {
    margin-left: auto;
    opacity: 0 !important;
    visibility: hidden;
    transform: translateY(-2px);
}

body.frontend-body .kitano-message.user:hover .kitano-message-actions,
body.frontend-body .kitano-message.user:focus-within .kitano-message-actions {
    opacity: .86 !important;
    visibility: visible;
    transform: none;
}

body.frontend-body .kitano-message .kitano-message-action {
    flex: 0 0 30px;
    width: 30px !important;
    height: 30px !important;
    border: 0 !important;
    border-radius: 8px !important;
}

body.frontend-body .kitano-message .kitano-message-action:hover,
body.frontend-body .kitano-message .kitano-message-action:focus-visible {
    background: color-mix(in srgb, var(--kitano-answer-accent, var(--kitano-brand-accent)) 10%, var(--kitano-soft)) !important;
}

html[data-kitano-theme="dark"] body.frontend-body .kitano-message.assistant .kitano-message-wrap {
    border-color: #2d323c;
    background: linear-gradient(145deg, #181b21, #14161a);
    box-shadow: 0 14px 38px rgba(0, 0, 0, .2);
}

html[data-kitano-theme="dark"] body.frontend-body .kitano-message.user .bubble {
    border-color: #3a3f49 !important;
    background: linear-gradient(145deg, #2b2f37, #252831) !important;
}

html[data-kitano-theme="dark"] body.frontend-body .kitano-message .kitano-message-actions {
    border-color: #2d323c;
    background: #191c22;
}

@media (max-width: 700px) {
    body.frontend-body .kitano-hero.chat-active .kitano-thread {
        gap: 13px !important;
        padding-top: 12px !important;
    }

    body.frontend-body .kitano-message.assistant .kitano-message-wrap {
        width: 100% !important;
        padding: 14px 13px 11px;
        border-radius: 17px;
    }

    body.frontend-body .kitano-message.user .kitano-message-wrap {
        max-width: 86% !important;
    }

    body.frontend-body .kitano-message.user .bubble {
        padding: 10px 13px !important;
        border-radius: 17px 17px 5px 17px !important;
    }

    body.frontend-body .kitano-message-identity {
        margin-bottom: 9px;
    }

    body.frontend-body .kitano-message.user .kitano-message-actions {
        opacity: .74 !important;
        visibility: visible;
        transform: none;
    }
}

@media (max-width: 390px) {
    body.frontend-body .kitano-message-identity-copy small {
        display: none;
    }
}

/* Integrated code and preview workspace v11
 * HTML output changes mode inside one durable frame. The header and tools
 * remain available in code, preview, and fullscreen views.
 */
body.frontend-body .kitano-message.assistant .bubble pre.kitano-code-block {
    position: relative;
    isolation: isolate;
    width: 100% !important;
    min-height: 210px;
    max-height: min(560px, calc(100dvh - 230px));
    padding-top: 58px !important;
    border: 1px solid #30363d !important;
    border-radius: 18px !important;
    background: #0d1117 !important;
    box-shadow: 0 20px 54px rgba(0, 0, 0, .28) !important;
}

body.frontend-body .kitano-code-block .kitano-code-head {
    z-index: 8;
    height: 58px !important;
    display: flex;
    gap: 14px;
    padding: 0 10px 0 14px !important;
    border-bottom: 1px solid #2f363f !important;
    background: linear-gradient(180deg, #191f27, #14191f) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, .22) !important;
}

body.frontend-body .kitano-code-title {
    flex: 1 1 auto;
    overflow: hidden;
}

body.frontend-body .kitano-code-type {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border: 1px solid #38414d;
    border-radius: 10px;
    background: linear-gradient(145deg, #232b35, #191f27);
    color: #a8c7fa;
    box-shadow: inset 0 1px rgba(255, 255, 255, .04);
}

body.frontend-body .kitano-code-type svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.frontend-body .kitano-code-file {
    display: grid;
    gap: 3px;
    color: #f0f6fc !important;
    font-size: 13px !important;
    line-height: 1.1;
}

body.frontend-body .kitano-code-file small {
    margin: 0 !important;
    color: #8b949e !important;
    font-size: 10.5px !important;
    line-height: 1.1;
}

body.frontend-body .kitano-code-tools {
    flex: 0 0 auto;
    gap: 5px !important;
}

body.frontend-body .kitano-code-view-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid #303945;
    border-radius: 11px;
    background: #0f141a;
}

body.frontend-body .kitano-code-block .kitano-code-copy {
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 7px 9px !important;
    border: 1px solid transparent !important;
    border-radius: 9px !important;
    background: transparent !important;
    color: #b8c0cc !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    line-height: 1;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease !important;
}

body.frontend-body .kitano-code-block .kitano-code-copy:hover,
body.frontend-body .kitano-code-block .kitano-code-copy:focus-visible {
    border-color: #414b58 !important;
    background: #252d37 !important;
    color: #fff !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
    transform: translateY(-1px);
}

body.frontend-body .kitano-code-block .kitano-code-copy.active,
body.frontend-body .kitano-code-block .kitano-code-copy[aria-pressed="true"] {
    border-color: #4a5e78 !important;
    background: linear-gradient(145deg, #2b3745, #202a35) !important;
    color: #fff !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, .05);
}

body.frontend-body .kitano-code-block .kitano-code-copy svg {
    width: 18px !important;
    height: 18px !important;
    flex: 0 0 18px !important;
    stroke-width: 1.85 !important;
}

body.frontend-body .kitano-code-preview-only {
    display: none !important;
}

body.frontend-body .kitano-code-block.is-previewing .kitano-code-preview-only {
    display: inline-flex !important;
}

body.frontend-body .kitano-code-preview-pane {
    display: none;
    width: 100%;
    height: min(520px, calc(100dvh - 288px));
    min-height: 350px;
    overflow: hidden;
    white-space: normal;
    background:
        linear-gradient(45deg, #f4f5f7 25%, transparent 25%),
        linear-gradient(-45deg, #f4f5f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f4f5f7 75%),
        linear-gradient(-45deg, transparent 75%, #f4f5f7 75%),
        #fff;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}

body.frontend-body .kitano-code-preview-pane iframe {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    border: 0;
    background: #fff;
}

body.frontend-body .kitano-code-block.is-previewing {
    height: min(578px, calc(100dvh - 210px));
    max-height: min(578px, calc(100dvh - 210px)) !important;
    padding: 58px 0 0 !important;
    overflow: hidden !important;
}

body.frontend-body .kitano-code-block.is-previewing > code {
    display: none !important;
}

body.frontend-body .kitano-code-block.is-previewing > .kitano-code-preview-pane {
    display: block;
    height: 100%;
}

body.frontend-body .kitano-code-block:fullscreen,
body.frontend-body .kitano-code-block.is-code-fullscreen {
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding-top: 64px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #0d1117 !important;
}

body.frontend-body .kitano-code-block:fullscreen .kitano-code-head,
body.frontend-body .kitano-code-block.is-code-fullscreen .kitano-code-head {
    height: 64px !important;
}

body.frontend-body .kitano-code-block:fullscreen .kitano-code-preview-pane,
body.frontend-body .kitano-code-block.is-code-fullscreen .kitano-code-preview-pane {
    height: 100% !important;
    max-height: none !important;
}

body.frontend-body .kitano-code-block:fullscreen > code,
body.frontend-body .kitano-code-block.is-code-fullscreen > code {
    min-height: calc(100dvh - 64px);
}

@media (max-width: 760px) {
    body.frontend-body .kitano-message.assistant .bubble pre.kitano-code-block {
        min-height: 220px;
        max-height: min(480px, calc(100dvh - 245px));
        padding-top: 54px !important;
        border-radius: 15px !important;
    }

    body.frontend-body .kitano-code-block .kitano-code-head {
        height: 54px !important;
        gap: 6px;
        padding-inline: 9px 6px !important;
    }

    body.frontend-body .kitano-code-type {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    body.frontend-body .kitano-code-file {
        font-size: 12px !important;
    }

    body.frontend-body .kitano-code-file small,
    body.frontend-body .kitano-code-copy > span {
        display: none !important;
    }

    body.frontend-body .kitano-code-tools {
        gap: 2px !important;
    }

    body.frontend-body .kitano-code-view-switch {
        gap: 1px;
        padding: 2px;
    }

    body.frontend-body .kitano-code-block .kitano-code-copy {
        min-width: 34px !important;
        min-height: 34px !important;
        padding: 6px 7px !important;
    }

    body.frontend-body .kitano-code-block.is-previewing {
        height: min(500px, calc(100dvh - 206px));
        max-height: min(500px, calc(100dvh - 206px)) !important;
        padding-top: 54px !important;
    }

    body.frontend-body .kitano-code-preview-pane {
        min-height: 300px;
    }
}

@media (max-width: 430px) {
    body.frontend-body .kitano-code-title {
        flex-basis: 32px;
    }

    body.frontend-body .kitano-code-file {
        display: none;
    }

    body.frontend-body .kitano-code-block [data-code-copy] {
        display: none !important;
    }
}
