:root {
    color-scheme: dark;

    --background: #08090b;
    --sidebar: #090a0c;
    --surface: #101216;
    --surface-raised: #14171c;
    --surface-soft: #191c22;
    --border: #282c34;
    --border-soft: #20242b;

    --text: #f5f6f8;
    --muted: #9ca2ad;
    --muted-dark: #686e79;

    --primary: #f4f5f7;
    --primary-text: #101114;

    --success: #49d38a;
    --danger: #f06e72;
    --danger-soft: rgba(240, 110, 114, 0.12);

    --radius-large: 18px;
    --radius-medium: 13px;
    --radius-small: 9px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(
            circle at 76% 0%,
            rgba(37, 43, 52, 0.2),
            transparent 33%
        ),
        var(--background);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.hidden {
    display: none !important;
}


/* APP LAYOUT */

.app-layout {
    display: grid;
    grid-template-columns: 255px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 22px 16px;
    border-right: 1px solid var(--border-soft);
    background: rgba(8, 9, 11, 0.94);
    backdrop-filter: blur(18px);
}

.main-content {
    width: min(100%, 1080px);
    margin: 0 auto;
    padding: 32px 36px 70px;
}


/*
   SIDEBAR */

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 2px 6px 24px;
}

.logo-shell {
    display: grid;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #050608;
}

.app-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-fallback {
    font-size: 1.55rem;
}

.sidebar-brand strong {
    display: block;
    font-size: 1.08rem;
}

.sidebar-brand span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.75rem;
}

.new-conversation-button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    text-align: left;
}

.new-conversation-button:hover {
    background: var(--surface-raised);
}

.sidebar-section {
    margin-top: 28px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}
.sidebar-section::-webkit-scrollbar {
    width: 5px;
}

.sidebar-section::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-section::-webkit-scrollbar-thumb {
    background: #30343b;
    border-radius: 10px;
}

.sidebar-section::-webkit-scrollbar-thumb:hover {
    background: #464b55;
}
.sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 7px 10px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.active-prompt-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-sidebar-message {
    margin: 5px 7px;
    color: var(--muted-dark);
    font-size: 0.8rem;
}

.sidebar-prompt-entry {
    display: grid;
    gap: 7px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
}

.sidebar-prompt-entry:hover {
    border-color: #3b414c;
    background: var(--surface-raised);
}

.sidebar-prompt-text {
    overflow: hidden;
    font-size: 0.82rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-prompt-timer {
    color: var(--muted);
    font-family:
        "SFMono-Regular",
        Consolas,
        monospace;
    font-size: 0.72rem;
}

.sidebar-spacer {
    flex: 0;
}

.privacy-card {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
}

.privacy-icon {
    display: inline-grid;
    width: 25px;
    height: 25px;
    margin-bottom: 10px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--muted);
}

.privacy-card strong {
    display: block;
    font-size: 0.83rem;
}

.privacy-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.55;
}

.ollama-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 13px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.76rem;
}


/* TOP AREA */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.9rem, 4vw, 2.65rem);
    letter-spacing: -0.045em;
}

.topbar p {
    margin: 7px 0 0;
    color: var(--muted);
}

.local-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.78rem;
}

.connection-dot,
.status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #838994;
}

.connection-dot.checking {
    background: #d8ae57;
    animation: status-pulse 1.1s ease-in-out infinite;
}

.connection-dot.connected,
.status-dot {
    background: var(--success);
    box-shadow: 0 0 12px rgba(73, 211, 138, 0.55);
}

.connection-dot.error {
    background: var(--danger);
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-top: 26px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    background: rgba(16, 18, 22, 0.82);
}

.notice-icon {
    display: grid;
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    place-items: center;
    border: 1px solid var(--muted-dark);
    border-radius: 50%;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.notice p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}


/*  COMPOSER*/

.composer-card {
    margin-top: 26px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    background: rgba(16, 18, 22, 0.92);
}

.model-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.model-row label,
.field-heading label {
    font-weight: 750;
}

.warm-status {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.72rem;
}

select {
    min-width: 275px;
    padding: 12px 42px 12px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    background: var(--surface-raised);
    color: var(--text);
}

select:focus,
textarea:focus {
    border-color: #505765;
    box-shadow: 0 0 0 3px rgba(100, 110, 126, 0.12);
}

.field-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 11px;
}

#character-count {
    color: var(--muted);
    font-size: 0.76rem;
}

textarea {
    display: block;
    width: 100%;
    min-height: 260px;
    padding: 17px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: #0b0d10;
    color: var(--text);
    line-height: 1.6;
}

textarea::placeholder {
    color: #646a75;
}

.composer-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.primary-button,
.secondary-button {
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 800;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid transparent;
    background: var(--primary);
    color: var(--primary-text);
}

.primary-button:hover:not(:disabled) {
    background: #ffffff;
}

.secondary-button {
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text);
}

.secondary-button:hover:not(:disabled) {
    border-color: #454b56;
}

/* WEB SEARCH BUTTON */

.web-search-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface-raised);
    color: #777d87;

    cursor: pointer;

    transition:
        color 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}


.web-search-button svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;

    pointer-events: none;
}


.web-search-button:hover {
    color: var(--text);
    border-color: #454b56;
}


/* Web search active */

.web-search-button[aria-pressed="true"] {
    color: var(--text);
    border-color: #626975;

    background: var(--surface-raised);

    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 0 14px rgba(255, 255, 255, 0.08);
}


.web-search-button[aria-pressed="true"] svg {
    stroke-width: 1.9;
}


.web-search-button:active {
    transform: scale(0.96);
}

/* ACTIVITY PANEL */
.activity-panel {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    background: var(--surface);
}

.activity-panel strong {
    display: block;
}

.activity-panel p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.activity-bars {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 42px;
    height: 30px;
}

.activity-bars span {
    width: 4px;
    border-radius: 999px;
    background: var(--text);
    animation: sound-bars 900ms ease-in-out infinite;
}

.activity-bars span:nth-child(1) {
    height: 10px;
}

.activity-bars span:nth-child(2) {
    height: 24px;
    animation-delay: 120ms;
}

.activity-bars span:nth-child(3) {
    height: 17px;
    animation-delay: 240ms;
}

.activity-bars span:nth-child(4) {
    height: 27px;
    animation-delay: 360ms;
}


/* PROMPT CARDS */

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 20px;
}

.prompt-item {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    background: rgba(16, 18, 22, 0.94);
    transform-origin: center;
}

.item-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-soft);
}

.item-identity,
.item-controls {
    display: flex;
    align-items: center;
    gap: 11px;
}

.item-identity > div {
    display: flex;
    align-items: center;
    gap: 9px;
}

.item-identity strong {
    font-size: 0.9rem;
}

.item-model {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-family:
        "SFMono-Regular",
        Consolas,
        monospace;
    font-size: 0.7rem;
}

.item-countdown {
    min-width: 84px;
    font-family:
        "SFMono-Regular",
        Consolas,
        monospace;
    font-size: 1.03rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-align: right;
}

.item-purge-button {
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid rgba(240, 110, 114, 0.38);
    border-radius: 9px;
    background: var(--danger-soft);
    color: #ff8d91;
    font-weight: 800;
}

.item-purge-button:hover:not(:disabled) {
    border-color: var(--danger);
    background: rgba(240, 110, 114, 0.19);
}

.message-row {
    display: flex;
    padding: 16px 18px 0;
}

.user-row {
    justify-content: flex-end;
}

.assistant-row {
    justify-content: flex-start;
    padding-bottom: 18px;
}

.message-bubble {
    max-width: 82%;
    padding: 15px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    line-height: 1.62;
}

.user-bubble {
    background: var(--surface-soft);
}

.assistant-bubble {
    width: min(100%, 820px);
    background: #0c0e11;
}

.bubble-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 9px;
}

.bubble-heading strong {
    font-size: 0.8rem;
}

.bubble-heading time {
    color: var(--muted);
    font-size: 0.7rem;
}

.item-prompt,
.item-response {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
/*CODE BLOCKS*/

.code-block {

    margin: 14px 0;

    overflow: hidden;

    border: 1px solid var(--border);

    border-radius: 10px;

    background: #090b0d;

}

.code-block-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 7px 12px;

    border-bottom: 1px solid var(--border-soft);

    color: var(--muted);

    font-size: 0.7rem;

    font-weight: 700;

    letter-spacing: 0.04em;

    text-transform: uppercase;

}

.code-block pre {

    margin: 0;

    padding: 16px;

    overflow-x: auto;

    white-space: pre;

}

.code-block code {

    font-family:

        "SFMono-Regular",

        Consolas,

        "Liberation Mono",

        monospace;

    font-size: 0.82rem;

    line-height: 1.65;

    tab-size: 4;

}
/* SYNTAX HIGHLIGHTING */

.syntax-keyword {
    color: #c792ea;
}

.syntax-string {
    color: #c3e88d;
}

.syntax-comment {
    color: #697098;
    font-style: italic;
}

.syntax-number {
    color: #f78c6c;
}

.syntax-function {
    color: #82aaff;
}

.syntax-builtin {
    color: #89ddff;
}

.syntax-operator {
    color: #89ddff;
}
.response-status {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.82rem;
}

.response-status.stream-error {
    color: #ff9295;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: typing-bounce 1s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 130ms;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 260ms;
}

.item-footer {
    padding: 11px 18px;
    border-top: 1px solid var(--border-soft);
    color: var(--muted);
    font-size: 0.72rem;
}

.message {
    margin-top: 16px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--success);
    font-size: 0.84rem;
}

.message.error {
    color: #ff9497;
}


/* POWER-OFF ANIMATION */

.tv-off-overlay {
    position: absolute;
    z-index: 10;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    background: transparent;
    opacity: 0;
}

.tv-line {
    width: 0;
    height: 2px;
    border-radius: 999px;
    background: white;
    box-shadow:
        0 0 10px rgba(255, 255, 255, 0.9),
        0 0 24px rgba(255, 255, 255, 0.48);
}

.prompt-item.tv-powering-off {
    pointer-events: none;
    animation:
        tv-card-collapse 850ms
        cubic-bezier(0.76, 0, 0.24, 1)
        forwards;
}

.prompt-item.tv-powering-off .tv-off-overlay {
    opacity: 1;
    animation: tv-overlay-flash 650ms ease forwards;
}

.prompt-item.tv-powering-off .tv-line {
    animation:
        tv-line-shut 620ms
        cubic-bezier(0.8, 0, 0.2, 1)
        forwards;
}

.prompt-item.tv-powering-off > *:not(.tv-off-overlay) {
    animation:
        tv-content-shut 560ms
        cubic-bezier(0.8, 0, 0.2, 1)
        forwards;
}

.attention-pulse {
    animation: attention-pulse 700ms ease;
}

/* RATE LIMIT  */

.rate-limit-cooldown {

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    margin-top: 16px;

    padding: 22px 18px 20px;

    border: 1px solid var(--border);

    border-radius: 12px;

    background:

        radial-gradient(

            circle at 50% 0%,

            rgba(255, 255, 255, 0.035),

            transparent 58%

        ),

        #0b0d10;

    text-align: center;

}

.rate-limit-hourglass {

    display: grid;

    width: 34px;

    height: 34px;

    margin-bottom: 8px;

    place-items: center;

    color: var(--muted);

    font-size: 1.35rem;

    transform-origin: center;

}

.rate-limit-title {

    color: var(--text);

    font-size: 0.88rem;

    font-weight: 750;

}

.rate-limit-time {

    margin-top: 7px;

    color: var(--text);

    font-family:

        "SFMono-Regular",

        Consolas,

        monospace;

    font-size: 1.7rem;

    font-weight: 800;

    letter-spacing: 0.08em;

    font-variant-numeric: tabular-nums;

}

.rate-limit-track {

    width: min(100%, 340px);

    height: 3px;

    margin-top: 14px;

    overflow: hidden;

    border-radius: 999px;

    background: var(--border);

}

.rate-limit-progress {

    width: 0%;

    height: 100%;

    border-radius: inherit;

    background: var(--muted);

    transition: width 1s linear;

}

.rate-limit-note {

    margin-top: 9px;

    color: var(--muted);

    font-size: 0.72rem;

}


.rate-limit-flip {

    animation:

        rate-limit-hourglass-flip

        700ms

        cubic-bezier(0.65, 0, 0.35, 1);

}


.rate-limit-cooldown.rate-limit-ready {

    border-color:

        rgba(73, 211, 138, 0.28);

}

.rate-limit-cooldown.rate-limit-ready

.rate-limit-hourglass {

    color: var(--success);

}

.rate-limit-cooldown.rate-limit-ready

.rate-limit-progress {

    background: var(--success);

}

textarea:disabled {

    border-color: var(--border-soft);

    background: #090b0d;

    color: var(--muted);

    cursor: not-allowed;

    opacity: 0.68;

}


@keyframes rate-limit-hourglass-flip {

    0% {

        opacity: 1;

        transform: rotate(0deg);

    }

    45% {

        opacity: 0.55;

        transform: rotate(180deg);

    }

    100% {

        opacity: 1;

        transform: rotate(360deg);

    }

}

/* ANIMATIONS */

@keyframes status-pulse {
    0%,
    100% {
        opacity: 0.45;
        transform: scale(0.85);
    }

    50% {
        opacity: 1;
        transform: scale(1.15);
    }
}

@keyframes sound-bars {
    0%,
    100% {
        opacity: 0.4;
        transform: scaleY(0.55);
    }

    50% {
        opacity: 1;
        transform: scaleY(1);
    }
}

@keyframes typing-bounce {
    0%,
    60%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

@keyframes attention-pulse {
    0%,
    100% {
        border-color: var(--border);
    }

    50% {
        border-color: #687182;
        box-shadow: 0 0 0 4px rgba(104, 113, 130, 0.1);
    }
}

@keyframes tv-content-shut {
    0% {
        filter: brightness(1);
        opacity: 1;
        transform: scale(1);
    }

    45% {
        filter: brightness(1.4);
        opacity: 0.95;
        transform: scaleY(0.15) scaleX(1);
    }

    75% {
        filter: brightness(2);
        opacity: 0.7;
        transform: scaleY(0.01) scaleX(0.32);
    }

    100% {
        filter: brightness(2.5);
        opacity: 0;
        transform: scaleY(0.001) scaleX(0.02);
    }
}

@keyframes tv-line-shut {
    0% {
        width: 0;
        opacity: 0;
    }

    24% {
        width: 72%;
        opacity: 1;
    }

    66% {
        width: 34%;
        opacity: 1;
    }

    100% {
        width: 0;
        opacity: 0;
    }
}

@keyframes tv-overlay-flash {
    0% {
        background: transparent;
    }

    30% {
        background: rgba(255, 255, 255, 0.025);
    }

    65% {
        background: rgba(255, 255, 255, 0.01);
    }

    100% {
        background: #08090b;
    }
}

@keyframes tv-card-collapse {
    0% {
        max-height: 1200px;
        margin-bottom: 0;
        opacity: 1;
    }

    72% {
        max-height: 1200px;
        margin-bottom: 0;
        opacity: 1;
    }

    100% {
        max-height: 0;
        margin: 0;
        border-width: 0;
        opacity: 0;
    }
}


/*  RESPONSIVE*/

@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .sidebar-section,
    .privacy-card,
    .sidebar-spacer {
        display: none;
    }

    .main-content {
        padding: 28px 18px 60px;
    }
}

@media (max-width: 620px) {

    .sidebar {

        display: none;

    }

    .app-layout {

        display: block;

        width: 100%;

        min-height: 100vh;

    }

    .main-content {

        width: 100%;

        max-width: none;

        padding: 16px 12px 32px;

    }

    .topbar,

    .model-row,

    .item-toolbar {

        align-items: flex-start;

        flex-direction: column;

    }

    .local-badge {

        display: none;

    }

    select {

        width: 100%;

        min-width: 0;

    }

    .item-controls {

        width: 100%;

        justify-content: space-between;

    }

    .message-bubble {

        max-width: 96%;

    }
    textarea {
        min-height: 210px;
    }

}
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


.attachment-list,
.item-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.attachment-chip,
.display-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-light, #19191d);
    color: var(--muted);
    font-size: 0.75rem;
}

.attachment-chip button {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
}

.attachment-button,
.stop-button,
.item-copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 10px;
    font-weight: 700;
}

.attachment-button,
.item-copy-button {
    border: 1px solid var(--border);
    background: var(--surface-light, #19191d);
    color: var(--text);
    cursor: pointer;
}

.stop-button {
    border: 1px solid rgba(228, 92, 92, 0.45);
    background: rgba(228, 92, 92, 0.13);
    color: #ff9292;
}

.item-copy-button,
.item-purge-button {
    min-height: 35px;
    padding: 7px 11px;
    font-size: 0.77rem;
}

.composer-actions,
.item-controls {
    flex-wrap: wrap;
}

/* v0.6 response-style controls */
.control-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  margin-bottom:23px;
}
.control-group label {display:block;margin-bottom:7px;font-weight:750}
.control-group select {width:100%}
.item-style {margin-left:6px;text-transform:capitalize}
.item-rephrase-button {
  min-height:35px;
  padding:7px 11px;
  border:1px solid var(--border);
  border-radius:9px;
  background:var(--surface-raised);
  color:var(--text);
  font-size:.77rem;
  font-weight:750;
}
.item-rephrase-button:hover:not(:disabled) {border-color:#48505c;background:#1b1f25}
.response-meta {margin-top:12px;color:var(--muted);font-size:.72rem}
@media (max-width:620px){.control-grid{grid-template-columns:1fr}}

.disclaimer {
  margin-top: 10px;
  margin-bottom: 8px;
  padding-top: 2px;
  color: #888;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  opacity: 0.75;

}

/* COMPACT FOLLOW-UP COMPOSER */

.composer-card {
    transition:
        padding 220ms ease,
        border-radius 220ms ease,
        background 220ms ease;
}

.compact-composer-meta {
    display: none;
}

.composer-card.composer-compact {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(16, 18, 22, 0.96);
}

.composer-card.composer-compact .control-grid,
.composer-card.composer-compact .field-heading,
.composer-card.composer-compact .disclaimer,
.composer-card.composer-compact #clear-input-button {
    display: none;
}

.composer-card.composer-compact .compact-composer-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.composer-card.composer-compact textarea {
    min-height: 54px;
    max-height: 132px;
    padding: 14px 15px;
    resize: vertical;
}

.composer-card.composer-compact .composer-actions {
    justify-content: flex-end;
    margin-top: 10px;
}

.composer-card.composer-compact .primary-button,
.composer-card.composer-compact .secondary-button,
.composer-card.composer-compact .stop-button {
    min-height: 38px;
    padding: 8px 12px;
}
.composer-card.composer-compact .web-search-button {
    width: 38px;
    min-width: 38px;
    height: 38px;
}

.composer-card.composer-compact .web-search-button svg {
    width: 18px;
    height: 18px;
}

.compact-expand-button {
    white-space: nowrap;
}

.composer-card.composer-compact .rate-limit-cooldown {
    margin-top: 10px;
}

@media (max-width: 620px) {
    .composer-card.composer-compact {
        padding: 11px;
    }

    .composer-card.composer-compact textarea {
        min-height: 50px;
        padding: 12px 13px;
    }

    .composer-card.composer-compact .composer-actions {
        gap: 7px;
    }

    .composer-card.composer-compact .primary-button,
    .composer-card.composer-compact .secondary-button,
    .composer-card.composer-compact .stop-button {
        min-height: 36px;
        padding: 7px 10px;
        font-size: 0.82rem;
    }
    .composer-card.composer-compact .web-search-button {
        width: 36px;
        min-width: 36px;
        height: 36px;
    }

    .composer-card.composer-compact .web-search-button svg {
        width: 17px;
        height: 17px;
    }
}


.composer-card {
    box-shadow:
        0 0 18px rgba(232, 229, 220, 0.055),
        0 0 38px rgba(220, 218, 212, 0.035);

    animation:
        composer-aura
        6s
        ease-in-out
        infinite;
}

@keyframes composer-aura {

    0%,
    100% {
        box-shadow:
            0 0 22px rgba(232, 229, 220, 0.045),
            0 0 48px rgba(220, 218, 212, 0.025);
    }

    50% {
        box-shadow:
            0 0 28px rgba(232, 229, 220, 0.085),
            0 0 60px rgba(220, 218, 212, 0.045);
    }

}



.composer-card:focus-within {
    box-shadow:
        0 0 24px rgba(232, 229, 220, 0.10),
        0 0 50px rgba(220, 218, 212, 0.055);
}


@media (prefers-reduced-motion: reduce) {

    .composer-card {
        animation: none;
    }

}
/* SOURCES */

.sources-container {
    margin-top: 8px;
}

.sources-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 6px 10px;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: var(--surface-raised);
    color: var(--text);

    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;

    cursor: pointer;

    transition:
        border-color 0.18s ease,
        background 0.18s ease;
}

.sources-toggle:hover {
    border-color: #555c68;
}

.sources-toggle svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.sources-panel {
    display: flex;
    flex-direction: column;
    gap: 7px;

    margin-top: 9px;
    max-width: 620px;
}


.source-link {
    display: flex;
    flex-direction: column;
    gap: 3px;

    padding: 9px 11px;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: var(--surface-raised);

    color: var(--text);
    text-decoration: none;

    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        transform 0.18s ease;
}


.source-link:hover {
    border-color: #4b515c;
    transform: translateY(-1px);
}


.source-title {
    display: block;

    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.35;

    color: var(--text);

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.source-domain {
    display: block;

    font-size: 0.76rem;
    line-height: 1.3;

    color: var(--muted);
}


.sources-panel.hidden {
    display: none;
}

/* Custom AI chooser updated for the dropdown */
.control-group { min-width: 0; }
.native-model-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  padding: 0 !important;
  opacity: 0;
  pointer-events: none;
}
.ai-selector { position: relative; width: 100%; }
.ai-selector-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 45px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-raised);
  color: var(--text);
  text-align: left;
}
.ai-selector-button:hover:not(:disabled),
.ai-selector-button[aria-expanded="true"] { border-color: #505765; }
.ai-selector-button:focus-visible,
.ai-selector-option:focus-visible {
  outline: 2px solid #929baa;
  outline-offset: 2px;
}
.ai-selector-arrow { margin-left: 10px; color: var(--muted); transition: transform .16s ease; }
.ai-selector-button[aria-expanded="true"] .ai-selector-arrow { transform: rotate(180deg); }
.ai-selector-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  left: 0;
  width: 100%;
  min-width: min(320px, 85vw);
  overflow: hidden;
  border: 1px solid #3b414c;
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .45);
}
.ai-selector-option {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 15px 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
}
.ai-selector-option:last-child { border-bottom: 0; }
.ai-selector-option:hover, .ai-selector-option:focus-visible { background: var(--surface-soft); }
.ai-selector-option.selected { background: #20242b; }

.ai-option-icon {display: block;width: 28px;height: 28px;flex: 0 0 28px;object-fit: contain;object-position: center;}
.ai-option-body { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 4px; }
.ai-option-body strong { font-size: .88rem; }
.ai-option-powered { color: #c7ccd5; font-size: .77rem; }
.ai-option-description { color: var(--muted); font-size: .76rem; line-height: 1.45; }
.ai-option-check { visibility: hidden; color: var(--success); font-size: .9rem; }
.ai-selector-option.selected .ai-option-check { visibility: visible; }


/* Active conversation: preserve the original welcome screen until first send. */
.main-content.chat-active {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 0;
    padding-bottom: 16px;
    overflow: hidden;
}
.main-content.chat-active .topbar { flex: 0 0 auto; }
.main-content.chat-active #message:not(.hidden) { flex: 0 0 auto; }
.chat-stream { display: contents; }
.main-content.chat-active .chat-stream {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding: 16px 4px 20px;
}
.main-content.chat-active .conversation-list {
    flex: 0 0 auto;
    margin-top: 0;
    padding-bottom: 6px;
}
.main-content.chat-active .activity-panel { flex: 0 0 auto; }
.main-content.chat-active .composer-card {
    flex: 0 0 auto;
    margin-top: 0;
    max-height: min(45dvh, 360px);
    overflow-y: auto;
    box-shadow: 0 -10px 32px rgba(0,0,0,.22);
}
.jump-to-latest { display: none; }
.main-content.chat-active .jump-to-latest:not(.hidden) {
    display: block;
    align-self: center;
    flex: 0 0 auto;
    margin: 0 0 8px;
    padding: 7px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-raised);
    color: var(--text);
    font-size: .8rem;
}
.main-content.chat-active .composer-card.composer-compact .disclaimer {
    display: block;
    margin-top: 9px;
    font-size: .65rem;
}
@media (max-width: 900px) {
    .main-content.chat-active { padding: 14px 18px 12px; }
}
@media (max-width: 620px) {
    .main-content.chat-active { padding: 10px 10px max(10px, env(safe-area-inset-bottom)); }
    .main-content.chat-active .topbar h1 { font-size: 1.4rem; }
    .main-content.chat-active .topbar p { font-size: .75rem; }
    .main-content.chat-active .chat-stream { padding: 12px 0; }
    .main-content.chat-active .composer-card { max-height: 48dvh; }
}


/* Desktop active-chat workspace: use the full area beside the sidebar.
   The original landing layout remains unchanged until the first prompt. */
@media (min-width: 901px) {
    .main-content.chat-active {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 18px clamp(18px, 2.5vw, 44px) 12px;
    }
    .main-content.chat-active .chat-stream {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
    .main-content.chat-active .composer-card {
        width: 100%;
    }
    .main-content.chat-active .assistant-bubble {
        width: min(100%, 1100px);
        max-width: 100%;
    }
    .main-content.chat-active .user-bubble {
        max-width: min(85%, 1000px);
    }
}


/* PURGEGPT refined conversation presentation (active chats only).
   Welcome screen, sidebar and existing interactions remain unchanged. */
.main-content.chat-active {
    --chat-content-width: 980px;
}
.main-content.chat-active .topbar {
    padding-bottom: 12px;
}
.main-content.chat-active .chat-stream {
    padding-top: 12px;
    padding-bottom: 18px;
}
.main-content.chat-active .conversation-list {
    gap: 0;
}
/* Remove the large nested card treatment; keep a light division per prompt. */
.main-content.chat-active .prompt-item {
    border: 0;
    border-bottom: 1px solid rgba(145, 153, 169, .13);
    border-radius: 0;
    background: transparent;
    overflow: visible;
    padding: 13px 0 18px;
}
.main-content.chat-active .prompt-item + .prompt-item {
    padding-top: 22px;
}
.main-content.chat-active .item-toolbar {
    border: 0;
    padding: 5px 10px 13px;
    gap: 12px;
    flex-wrap: wrap;
}
.main-content.chat-active .item-identity strong {
    font-size: .8rem;
    font-weight: 650;
}
.main-content.chat-active .item-identity > div { flex-wrap: wrap; }
.main-content.chat-active .item-countdown {
    font-size: .87rem;
    font-weight: 750;
}
.main-content.chat-active .item-controls { flex-wrap: wrap; }
.main-content.chat-active .item-controls button {
    min-height: 32px;
    padding: 5px 10px;
    font-size: .76rem;
    font-weight: 650;
}
.main-content.chat-active .message-row {
    padding: 8px 10px 0;
}
.main-content.chat-active .assistant-row {
    padding-bottom: 6px;
}
.main-content.chat-active .message-bubble {
    line-height: 1.65;
}
.main-content.chat-active .assistant-bubble {
    width: min(100%, var(--chat-content-width));
    max-width: 100%;
    padding: 12px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
}
.main-content.chat-active .user-bubble {
    max-width: min(78%, 720px);
    padding: 12px 15px;
    border: 1px solid rgba(145, 153, 169, .12);
    border-radius: 15px;
    background: #191c22;
}
.main-content.chat-active .item-footer {
    border: 0;
    padding: 10px 24px 2px;
    color: var(--muted-dark);
    font-size: .71rem;
}
/* Keep a single subtle composer surface rather than a heavy box. */
.main-content.chat-active .composer-card {
    border: 1px solid rgba(145, 153, 169, .16);
    border-radius: 15px;
    background: #101216;
    box-shadow: 0 -7px 25px rgba(0, 0, 0, .12);
}
.main-content.chat-active .composer-card.composer-compact {
    padding: 12px 15px 10px;
}
.main-content.chat-active .composer-card.composer-compact textarea {
    min-height: 62px;
    border-color: rgba(145, 153, 169, .17);
    border-radius: 10px;
    background: #0c0e11;
}
.main-content.chat-active .composer-card.composer-compact .disclaimer {
    opacity: .68;
}
@media (max-width: 620px) {
    .main-content.chat-active .prompt-item { padding: 9px 0 14px; }
    .main-content.chat-active .item-toolbar { padding: 5px 3px 9px; }
    .main-content.chat-active .message-row { padding-left: 0; padding-right: 0; }
    .main-content.chat-active .assistant-bubble { padding: 10px 8px; }
    .main-content.chat-active .user-bubble { max-width: 90%; }
    .main-content.chat-active .item-footer { padding-left: 8px; }
}


/* PURGEGPT desktop polish — active conversation only. */
@media (min-width: 901px) {
  .main-content.chat-active .chat-stream {
    padding-inline: clamp(12px, 3.5vw, 70px);
  }
  .main-content.chat-active .conversation-list,
  .main-content.chat-active .activity-panel {
    width: 100%;
    max-width: 1160px;
    margin-inline: auto;
  }
  .main-content.chat-active .composer-card {
    width: min(100%, 880px);
    margin-inline: auto;
  }
  .main-content.chat-active .assistant-bubble {
    width: min(100%, 830px);
  }
  .main-content.chat-active .user-bubble {
    max-width: min(74%, 620px);
  }
}

/* Expanded follow-up composer is still compact, never a tall landing form. */
.main-content.chat-active .composer-card {
  overflow: visible;
  max-height: none;
}
.main-content.chat-active .composer-card.composer-compact textarea {
  min-height: 58px;
  max-height: 112px;
  resize: vertical;
}
.main-content.chat-active .composer-card.composer-expanded .control-grid {
  display: grid;
  margin-bottom: 12px;
}
.main-content.chat-active .composer-card.composer-expanded .field-heading {
  display: flex;
  margin-bottom: 7px;
}
.main-content.chat-active .composer-card.composer-expanded .compact-composer-meta {
  display: none;
}
.main-content.chat-active .composer-card.composer-expanded textarea {
  min-height: 78px;
  height: 96px;
  max-height: 130px;
}
@media (max-width: 620px) {
  .main-content.chat-active .composer-card.composer-expanded .control-grid {
    grid-template-columns: 1fr;
  }
}


/* Native document scrolling for active chats: no nested conversation scrollbar.
   The compact composer remains visible at the bottom of the viewport. */
.main-content.chat-active {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
  padding-bottom: 0;
}
.main-content.chat-active .chat-stream {
  flex: 1 0 auto;
  min-height: 0;
  overflow: visible;
  overscroll-behavior: auto;
  scrollbar-gutter: auto;
}
.main-content.chat-active .composer-card {
  position: sticky;
  bottom: 0;
  z-index: 15;
  flex-shrink: 0;
  margin-top: 12px;
  margin-bottom: max(10px, env(safe-area-inset-bottom));
}
.main-content.chat-active .jump-to-latest:not(.hidden) {
  position: sticky;
  bottom: 170px;
  z-index: 16;
}
@media (max-width: 620px) {
  .main-content.chat-active .jump-to-latest:not(.hidden) {
    bottom: 150px;
  }
}
.item-response-time {
    display: none;
}
