/*
|--------------------------------------------------------------------------
| CampusBD AI — End User Web V3
|--------------------------------------------------------------------------
| Premium AI Workspace
*/

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    color: var(--cbd-text);
    background: var(--cbd-page);
    font-family: var(--cbd-font-sans);
    font-size: var(--cbd-font-md);
    line-height: var(--cbd-leading-normal);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* =====================================================================
   SHELL
   ===================================================================== */

.v3-shell {
    width: 100%;
    height: 100vh;
    min-height: 0;

    display: grid;

    grid-template-columns:
        284px
        minmax(0, 1fr)
        304px;

    background:
        radial-gradient(
            circle at 52% -15%,
            rgba(59, 130, 246, 0.08),
            transparent 34%
        ),
        var(--cbd-page);
}

/* =====================================================================
   SIDEBAR
   ===================================================================== */

.v3-sidebar {
    min-height: 0;

    display: flex;
    flex-direction: column;

    padding:
        18px
        14px
        14px;

    color: #ffffff;

    background:
        radial-gradient(
            circle at 0% 0%,
            rgba(59, 130, 246, 0.24),
            transparent 35%
        ),
        linear-gradient(
            180deg,
            #0b1f4d 0%,
            #081a3e 52%,
            #06142f 100%
        );

    box-shadow:
        inset -1px 0
        rgba(255, 255, 255, 0.045);

    position: relative;
    z-index: 30;
}

.v3-brand {
    min-height: 50px;

    display: flex;
    align-items: center;

    gap: 11px;

    padding:
        2px
        7px
        17px;
}

.v3-brand-logo {
    width: 40px;
    height: 40px;

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    border:
        1px
        solid
        rgba(255, 255, 255, 0.15);

    border-radius: 14px;

    color: #ffffff;

    background:
        linear-gradient(
            145deg,
            #60a5fa,
            #2563eb
        );

    box-shadow:
        0 12px 30px
        rgba(37, 99, 235, 0.32);
}

.v3-brand-copy {
    min-width: 0;
}

.v3-brand-copy strong {
    display: block;

    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.v3-brand-copy span {
    display: block;

    margin-top: 2px;

    color: #8fa5d0;

    font-size: 10px;
}

.v3-new-chat {
    width: 100%;
    min-height: 44px;

    display: flex;
    align-items: center;

    gap: 9px;

    padding:
        0
        12px;

    border: 0;
    border-radius: 12px;

    color: #102454;
    background: #ffffff;

    font-weight: 750;

    box-shadow:
        0 10px 26px
        rgba(0, 0, 0, 0.13);

    transition:
        transform 160ms var(--cbd-ease),
        box-shadow 180ms var(--cbd-ease);
}

.v3-new-chat:hover {
    transform: translateY(-1px);

    box-shadow:
        0 13px 30px
        rgba(0, 0, 0, 0.17);
}

.v3-new-chat .v3-shortcut {
    margin-left: auto;

    color: #8c98ad;

    font-size: 9px;
    font-weight: 700;
}

.v3-search-wrap {
    min-height: 40px;

    display: flex;
    align-items: center;

    gap: 8px;

    margin:
        13px
        0
        8px;

    padding:
        0
        11px;

    border:
        1px
        solid
        rgba(255, 255, 255, 0.09);

    border-radius: 11px;

    color: #7890bd;

    background:
        rgba(255, 255, 255, 0.055);

    transition:
        border-color 180ms var(--cbd-ease),
        background 180ms var(--cbd-ease);
}

.v3-search-wrap:focus-within {
    border-color:
        rgba(147, 197, 253, 0.38);

    background:
        rgba(255, 255, 255, 0.075);
}

.v3-search-wrap input {
    width: 100%;
    min-width: 0;

    border: 0;
    outline: 0;

    color: #ffffff;
    background: transparent;

    font-size: 11px;
}

.v3-search-wrap input::placeholder {
    color: #7187b2;
}

.v3-history-header {
    min-height: 34px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding:
        0
        8px;

    color: #667ead;

    font-size: 9px;
    font-weight: 800;

    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.v3-history {
    flex: 1;
    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding-bottom: 8px;

    scrollbar-width: thin;
    scrollbar-color:
        rgba(255, 255, 255, 0.14)
        transparent;
}

.v3-history-row {
    display: flex;
    align-items: center;

    gap: 4px;

    margin: 2px 0;

    border-radius: 10px;

    transition:
        background 150ms var(--cbd-ease);
}

.v3-history-row:hover,
.v3-history-row.active {
    background:
        rgba(255, 255, 255, 0.075);
}

.v3-history-row.active {
    box-shadow:
        inset 3px 0
        #60a5fa;
}

.v3-history-main {
    flex: 1;
    min-width: 0;

    padding:
        9px
        8px
        9px
        11px;

    border: 0;

    color: #dce6f9;
    background: transparent;

    text-align: left;
}

.v3-history-main strong {
    display: block;

    overflow: hidden;

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

    font-size: 11px;
    font-weight: 600;
}

.v3-history-main span {
    display: block;

    margin-top: 2px;

    color: #7087b5;

    font-size: 9px;
}

.v3-history-more {
    width: 31px;
    height: 31px;

    display: grid;
    place-items: center;

    margin-right: 4px;

    border: 0;
    border-radius: 9px;

    color: #7289b7;
    background: transparent;

    opacity: 0;

    transition:
        opacity 150ms var(--cbd-ease),
        background 150ms var(--cbd-ease),
        color 150ms var(--cbd-ease);
}

.v3-history-row:hover .v3-history-more,
.v3-history-row.active .v3-history-more,
.v3-history-more:focus-visible {
    opacity: 1;
}

.v3-history-more:hover {
    color: #ffffff;
    background:
        rgba(255, 255, 255, 0.08);
}

.v3-history-empty {
    padding:
        22px
        10px;

    color: #7187b2;

    text-align: center;

    font-size: 10px;
}

.v3-history-skeleton {
    padding:
        8px
        6px;
}

.v3-history-skeleton span {
    display: block;

    height: 34px;

    margin-bottom: 6px;

    border-radius: 9px;

    background:
        linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.04) 25%,
            rgba(255, 255, 255, 0.09) 50%,
            rgba(255, 255, 255, 0.04) 75%
        );

    background-size: 200% 100%;

    animation:
        v3-side-shimmer
        1.4s
        infinite linear;
}

@keyframes v3-side-shimmer {
    to {
        background-position: -200% 0;
    }
}

.v3-side-footer {
    padding-top: 10px;

    border-top:
        1px
        solid
        rgba(255, 255, 255, 0.07);
}

.v3-account {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 9px;

    padding: 8px;

    border:
        1px
        solid
        transparent;

    border-radius: 12px;

    color: #ffffff;
    background:
        rgba(255, 255, 255, 0.05);

    text-align: left;

    transition:
        border-color 160ms var(--cbd-ease),
        background 160ms var(--cbd-ease);
}

.v3-account:hover {
    border-color:
        rgba(255, 255, 255, 0.08);

    background:
        rgba(255, 255, 255, 0.075);
}

.v3-account-avatar {
    width: 36px;
    height: 36px;

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    border-radius: 11px;

    color: #174797;
    background:
        linear-gradient(
            145deg,
            #e9f1ff,
            #ffffff
        );

    font-size: 11px;
    font-weight: 850;
}

.v3-account-copy {
    flex: 1;
    min-width: 0;
}

.v3-account-copy strong,
.v3-account-copy span {
    display: block;

    overflow: hidden;

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

.v3-account-copy strong {
    font-size: 11px;
}

.v3-account-copy span {
    margin-top: 1px;

    color: #7890bd;

    font-size: 9px;
}

/* =====================================================================
   MAIN WORKSPACE
   ===================================================================== */

.v3-workspace {
    min-width: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    position: relative;

    background:
        radial-gradient(
            circle at 50% -8%,
            rgba(96, 165, 250, 0.08),
            transparent 30%
        ),
        var(--cbd-page);
}

.v3-topbar {
    min-height: 70px;
    height: 70px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    padding:
        0
        22px;

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

    background:
        color-mix(
            in srgb,
            var(--cbd-surface) 92%,
            transparent
        );

    backdrop-filter: blur(16px);

    position: relative;
    z-index: 20;
}

.v3-topbar-left {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 11px;
}

.v3-title-block {
    min-width: 0;
}

.v3-title-row {
    display: flex;
    align-items: center;

    gap: 8px;
}

.v3-title-row strong {
    max-width: 500px;

    overflow: hidden;

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

    font-size: 13px;
    font-weight: 750;
    letter-spacing: -0.01em;
}

.v3-title-block > span {
    display: block;

    margin-top: 2px;

    color: var(--cbd-text-muted);

    font-size: 9px;
}

.v3-conversation-state {
    display: inline-flex;
    align-items: center;

    min-height: 20px;

    padding:
        0
        7px;

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

    border-radius: 999px;

    color: var(--cbd-text-muted);
    background: var(--cbd-surface-soft);

    font-size: 8px;
    font-weight: 700;
}

.v3-conversation-state.busy {
    color: var(--cbd-blue-700);
    background: var(--cbd-blue-50);
    border-color: var(--cbd-blue-100);
}

.v3-top-actions {
    display: flex;
    align-items: center;

    gap: 7px;
}

.v3-mode-badge {
    min-height: 32px;

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

    gap: 7px;

    padding:
        0
        10px;

    border:
        1px
        solid
        var(--cbd-blue-200);

    border-radius: 999px;

    color: var(--cbd-blue-700);
    background: var(--cbd-blue-50);

    font-size: 9px;
    font-weight: 800;
}

.v3-status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--cbd-success-500);

    box-shadow:
        0 0 0 4px
        rgba(16, 185, 129, 0.1);
}

.v3-icon-button,
.v3-mini-icon-button {
    display: grid;
    place-items: center;

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

    color: var(--cbd-text-secondary);
    background: var(--cbd-surface);

    transition:
        border-color 160ms var(--cbd-ease),
        background 160ms var(--cbd-ease),
        color 160ms var(--cbd-ease),
        transform 160ms var(--cbd-ease);
}

.v3-icon-button {
    width: 36px;
    height: 36px;

    border-radius: 10px;
}

.v3-mini-icon-button {
    width: 29px;
    height: 29px;

    border-radius: 9px;
}

.v3-icon-button:hover,
.v3-mini-icon-button:hover {
    color: var(--cbd-text);

    border-color:
        var(--cbd-border-strong);

    background:
        var(--cbd-surface-soft);

    transform: translateY(-1px);
}

.v3-mobile-menu {
    display: none;
}

/* =====================================================================
   MESSAGES / HERO
   ===================================================================== */

.v3-messages {
    flex: 1;
    min-height: 0;

    overflow-y: auto;

    padding:
        34px
        max(
            22px,
            calc((100% - 850px) / 2)
        )
        190px;

    scroll-behavior: smooth;
}

.v3-empty {
    width: min(100%, 720px);

    margin:
        clamp(36px, 7vh, 86px)
        auto
        0;

    text-align: center;
}

.v3-hero-mark {
    width: 66px;
    height: 66px;

    display: grid;
    place-items: center;

    margin:
        0
        auto
        20px;

    border:
        1px
        solid
        var(--cbd-blue-100);

    border-radius: 22px;

    color: var(--cbd-blue-600);

    background:
        linear-gradient(
            145deg,
            #f5f9ff,
            #e5efff
        );

    box-shadow:
        0 18px 42px
        rgba(37, 99, 235, 0.12);
}

.v3-empty h1 {
    margin: 0;

    color: var(--cbd-text);

    font-size:
        clamp(
            30px,
            3.2vw,
            40px
        );

    line-height: 1.15;
    letter-spacing: -0.045em;
}

.v3-empty > p {
    width: min(100%, 570px);

    margin:
        12px
        auto
        24px;

    color: var(--cbd-text-muted);

    font-size: 13px;
    line-height: 1.65;
}

.v3-capability-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;

    gap: 7px;

    margin-bottom: 24px;
}

.v3-capability {
    min-height: 27px;

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

    gap: 5px;

    padding:
        0
        9px;

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

    border-radius: 999px;

    color: var(--cbd-text-muted);
    background: var(--cbd-surface);

    font-size: 9px;
    font-weight: 650;
}

.v3-quick-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 10px;

    width: min(100%, 670px);

    margin: 0 auto;
}

.v3-quick-card {
    min-height: 92px;

    display: flex;
    align-items: flex-start;

    gap: 11px;

    padding: 14px;

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

    border-radius: 14px;

    color: var(--cbd-text);
    background:
        color-mix(
            in srgb,
            var(--cbd-surface) 92%,
            transparent
        );

    text-align: left;

    box-shadow:
        var(--cbd-shadow-xs);

    transition:
        border-color 180ms var(--cbd-ease),
        box-shadow 180ms var(--cbd-ease),
        transform 180ms var(--cbd-ease);
}

.v3-quick-card:hover {
    border-color: var(--cbd-blue-200);

    box-shadow:
        var(--cbd-shadow-md);

    transform:
        translateY(-2px);
}

.v3-quick-icon {
    width: 35px;
    height: 35px;

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    border-radius: 10px;

    color: var(--cbd-blue-600);
    background: var(--cbd-blue-50);
}

.v3-quick-copy strong {
    display: block;

    font-size: 11px;
    font-weight: 750;
}

.v3-quick-copy span {
    display: block;

    margin-top: 4px;

    color: var(--cbd-text-muted);

    font-size: 9px;
    line-height: 1.5;
}

/* Messages */

.v3-message {
    width: min(100%, 850px);

    display: flex;
    align-items: flex-start;

    gap: 11px;

    margin:
        0
        auto
        24px;
}

.v3-message.user {
    flex-direction: row-reverse;
}

.v3-message-avatar {
    width: 34px;
    height: 34px;

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    border-radius: 11px;

    font-size: 9px;
    font-weight: 850;
}

.v3-message.assistant .v3-message-avatar {
    color: var(--cbd-blue-700);
    background: var(--cbd-blue-50);

    border:
        1px
        solid
        var(--cbd-blue-100);
}

.v3-message.user .v3-message-avatar {
    color: #ffffff;

    background:
        linear-gradient(
            145deg,
            #1e3a70,
            #0b1f4d
        );
}

.v3-message-body {
    max-width:
        min(
            750px,
            calc(100% - 50px)
        );
}

.v3-message.user .v3-message-body {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.v3-message-meta {
    margin:
        0
        3px
        5px;

    color: var(--cbd-text-subtle);

    font-size: 9px;
}

.v3-message-bubble {
    padding:
        13px
        15px;

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

    border-radius: 16px;

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

    white-space: pre-wrap;
    overflow-wrap: anywhere;

    box-shadow:
        var(--cbd-shadow-xs);
}

.v3-message.user .v3-message-bubble {
    border-color:
        var(--cbd-blue-100);

    background:
        color-mix(
            in srgb,
            var(--cbd-blue-50) 80%,
            var(--cbd-surface)
        );
}

.v3-message-thinking .v3-message-bubble {
    min-width: 58px;
}

.v3-typing {
    display: inline-flex;

    gap: 4px;
}

.v3-typing span {
    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: var(--cbd-text-subtle);

    animation:
        v3-typing
        1.2s
        infinite;
}

.v3-typing span:nth-child(2) {
    animation-delay: 0.12s;
}

.v3-typing span:nth-child(3) {
    animation-delay: 0.24s;
}

@keyframes v3-typing {
    0%,
    70%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }

    35% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/* =====================================================================
   RIGHT RAIL
   ===================================================================== */

.v3-right-rail {
    min-height: 0;

    overflow-y: auto;

    padding:
        16px
        14px;

    border-left:
        1px
        solid
        var(--cbd-border-soft);

    background:
        color-mix(
            in srgb,
            var(--cbd-page) 65%,
            var(--cbd-surface)
        );
}

.v3-rail-card {
    margin-bottom: 11px;

    padding: 14px;

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

    border-radius: 15px;

    background: var(--cbd-surface);

    box-shadow:
        var(--cbd-shadow-xs);
}

.v3-rail-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 9px;
}

.v3-rail-heading strong {
    display: block;

    font-size: 11px;
}

.v3-rail-heading span:not(.v3-mini-badge) {
    display: block;

    margin-top: 1px;

    color: var(--cbd-text-muted);

    font-size: 8px;
}

.v3-tool-row {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 9px;

    padding:
        9px
        4px;

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

    color: var(--cbd-text);
    background: transparent;

    text-align: left;

    transition:
        background 160ms var(--cbd-ease);
}

.v3-tool-row:last-child {
    border-bottom: 0;
}

.v3-tool-row:hover {
    background:
        var(--cbd-surface-soft);
}

.v3-tool-row:disabled {
    opacity: 0.45;
}

.v3-tool-icon {
    width: 32px;
    height: 32px;

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    border-radius: 10px;

    color: var(--cbd-blue-600);
    background: var(--cbd-blue-50);
}

.v3-tool-copy {
    flex: 1;
    min-width: 0;
}

.v3-tool-copy strong,
.v3-tool-copy span {
    display: block;
}

.v3-tool-copy strong {
    font-size: 10px;
}

.v3-tool-copy span {
    margin-top: 1px;

    color: var(--cbd-text-muted);

    font-size: 8px;
}

.v3-tool-arrow,
.v3-tool-state {
    color: var(--cbd-text-subtle);

    font-size: 9px;
    font-weight: 700;
}

.v3-tool-state.active {
    color: var(--cbd-success-600);
}

.v3-mini-badge {
    min-height: 23px;

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

    padding:
        0
        8px;

    border:
        1px
        solid
        var(--cbd-blue-100);

    border-radius: 999px;

    color: var(--cbd-blue-700);
    background: var(--cbd-blue-50);

    font-size: 8px;
    font-weight: 800;
}

.v3-provider-box {
    display: flex;
    align-items: flex-start;

    gap: 9px;

    padding: 11px;

    border-radius: 12px;

    background:
        var(--cbd-surface-soft);
}

.v3-provider-icon {
    width: 31px;
    height: 31px;

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    border-radius: 9px;

    color: var(--cbd-success-600);
    background: var(--cbd-success-50);
}

.v3-provider-box strong,
.v3-provider-box span {
    display: block;
}

.v3-provider-box strong {
    font-size: 10px;
}

.v3-provider-box span {
    margin-top: 3px;

    color: var(--cbd-text-muted);

    font-size: 8px;
    line-height: 1.45;
}

.v3-usage-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 7px;
}

.v3-usage-grid > div {
    padding: 10px;

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

    border-radius: 10px;

    background: var(--cbd-surface-soft);
}

.v3-usage-grid span,
.v3-usage-grid strong {
    display: block;
}

.v3-usage-grid span {
    color: var(--cbd-text-muted);

    font-size: 8px;
}

.v3-usage-grid strong {
    margin-top: 3px;

    font-size: 15px;
}

.v3-token-row,
.v3-limit-row {
    display: flex;
    justify-content: space-between;

    gap: 10px;

    margin-top: 10px;

    color: var(--cbd-text-muted);

    font-size: 9px;
}

.v3-token-row strong,
.v3-limit-row strong {
    color: var(--cbd-text);
}

.v3-progress {
    height: 6px;

    overflow: hidden;

    margin-top: 9px;

    border-radius: 999px;

    background:
        var(--cbd-surface-muted);
}

.v3-progress div {
    width: 0;
    height: 100%;

    border-radius: 999px;

    background:
        linear-gradient(
            90deg,
            var(--cbd-blue-600),
            var(--cbd-blue-400)
        );

    transition:
        width 280ms var(--cbd-ease);
}

.v3-text-button {
    width: 100%;

    margin-top: 11px;

    padding:
        9px
        0
        0;

    border: 0;
    border-top:
        1px
        solid
        var(--cbd-border-soft);

    color: var(--cbd-blue-700);
    background: transparent;

    font-size: 9px;
    font-weight: 750;

    text-align: left;
}

.v3-secondary-action {
    width: 100%;

    min-height: 36px;

    display: flex;
    align-items: center;

    gap: 8px;

    padding:
        0
        9px;

    border: 0;
    border-radius: 9px;

    color: var(--cbd-text-secondary);
    background: transparent;

    font-size: 9px;
    font-weight: 650;

    transition:
        background 150ms var(--cbd-ease);
}

.v3-secondary-action:hover {
    color: var(--cbd-text);
    background: var(--cbd-surface-soft);
}

.v3-logout-action:hover {
    color: var(--cbd-danger-700);
    background: var(--cbd-danger-50);
}

.v3-rail-account {
    padding: 8px;
}

/* =====================================================================
   COMPOSER
   ===================================================================== */

.v3-composer-zone {
    position: fixed;

    left: 284px;
    right: 304px;
    bottom: 0;

    z-index: 25;

    pointer-events: none;

    padding:
        32px
        22px
        15px;

    background:
        linear-gradient(
            180deg,
            transparent,
            color-mix(
                in srgb,
                var(--cbd-page) 94%,
                transparent
            ) 24%,
            var(--cbd-page) 58%
        );
}

.v3-composer-shell {
    width: min(850px, 100%);

    margin: 0 auto;

    pointer-events: auto;
}

.v3-composer {
    overflow: hidden;

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

    border-radius: 17px;

    background: var(--cbd-surface);

    box-shadow:
        0 17px 45px
        rgba(15, 23, 42, 0.11);

    transition:
        border-color 180ms var(--cbd-ease),
        box-shadow 180ms var(--cbd-ease);
}

.v3-composer:focus-within {
    border-color:
        var(--cbd-blue-300);

    box-shadow:
        0 19px 50px
        rgba(37, 99, 235, 0.12),
        var(--cbd-focus);
}

.v3-composer textarea {
    width: 100%;
    min-height: 59px;
    max-height: 190px;

    display: block;

    padding:
        14px
        15px
        6px;

    resize: none;

    border: 0;
    outline: 0;

    color: var(--cbd-text);
    background: transparent;

    font-size: 12px;
    line-height: 1.55;
}

.v3-composer textarea::placeholder {
    color: var(--cbd-text-subtle);
}

.v3-composer-bottom {
    min-height: 49px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    padding:
        7px
        8px
        8px;
}

.v3-compose-tools {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 5px;
}

.v3-compose-button {
    min-height: 32px;

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

    gap: 6px;

    padding:
        0
        9px;

    border: 0;
    border-radius: 9px;

    color: var(--cbd-text-muted);
    background: var(--cbd-surface-soft);

    font-size: 9px;
    font-weight: 700;

    cursor: pointer;

    transition:
        color 150ms var(--cbd-ease),
        background 150ms var(--cbd-ease);
}

.v3-compose-button:hover {
    color: var(--cbd-text);
    background: var(--cbd-surface-muted);
}

.v3-compose-button.active {
    color: var(--cbd-blue-700);
    background: var(--cbd-blue-50);
}

.v3-compose-button.disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.v3-send-button {
    width: 39px;
    height: 39px;

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    border: 0;
    border-radius: 12px;

    color: #ffffff;

    background:
        linear-gradient(
            145deg,
            var(--cbd-blue-500),
            var(--cbd-blue-700)
        );

    box-shadow:
        0 8px 20px
        rgba(37, 99, 235, 0.25);

    transition:
        transform 150ms var(--cbd-ease),
        box-shadow 150ms var(--cbd-ease);
}

.v3-send-button:hover:not(:disabled) {
    transform: translateY(-1px);

    box-shadow:
        0 11px 25px
        rgba(37, 99, 235, 0.31);
}

.v3-send-button:disabled {
    opacity: 0.45;
}

.v3-composer-foot {
    display: flex;
    justify-content: space-between;

    gap: 12px;

    padding:
        6px
        4px
        0;

    color: var(--cbd-text-subtle);

    font-size: 8px;
}

.v3-attachment-bar {
    padding-bottom: 7px;
}

.v3-attachment-chip {
    width: fit-content;
    max-width: 100%;

    min-height: 31px;

    display: flex;
    align-items: center;

    gap: 7px;

    padding:
        0
        8px
        0
        10px;

    border:
        1px
        solid
        var(--cbd-blue-100);

    border-radius: 10px;

    color: var(--cbd-blue-700);
    background: var(--cbd-blue-50);

    font-size: 9px;
    font-weight: 650;
}

.v3-attachment-chip span {
    max-width: 300px;

    overflow: hidden;

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

.v3-attachment-chip button {
    width: 24px;
    height: 24px;

    display: grid;
    place-items: center;

    border: 0;
    border-radius: 7px;

    color: var(--cbd-blue-700);
    background: transparent;
}

.v3-attachment-chip button:hover {
    background:
        rgba(37, 99, 235, 0.08);
}

/* =====================================================================
   CONTEXT MENU
   ===================================================================== */

.v3-context-menu {
    position: fixed;

    z-index: 70;

    width: 150px;

    padding: 5px;

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

    border-radius: 11px;

    background: var(--cbd-surface);

    box-shadow:
        var(--cbd-shadow-lg);
}

.v3-context-menu button {
    width: 100%;
    min-height: 34px;

    display: flex;
    align-items: center;

    gap: 8px;

    padding:
        0
        9px;

    border: 0;
    border-radius: 8px;

    color: var(--cbd-text-secondary);
    background: transparent;

    font-size: 10px;
    font-weight: 650;

    text-align: left;
}

.v3-context-menu button:hover {
    color: var(--cbd-text);
    background: var(--cbd-surface-soft);
}

.v3-context-menu button.danger {
    color: var(--cbd-danger-600);
}

.v3-context-menu button.danger:hover {
    background: var(--cbd-danger-50);
}

/* =====================================================================
   MODALS
   ===================================================================== */

.v3-modal-backdrop {
    position: fixed;
    inset: 0;

    z-index: 60;

    display: grid;
    place-items: center;

    padding: 20px;

    background:
        rgba(4, 15, 38, 0.52);

    backdrop-filter:
        blur(6px);
}

.v3-modal {
    width: min(580px, 100%);
    max-height: min(780px, 90vh);

    overflow-y: auto;

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

    border-radius: 19px;

    background: var(--cbd-surface);

    box-shadow:
        var(--cbd-shadow-xl);
}

.v3-modal-small {
    width: min(470px, 100%);
}

.v3-modal-head {
    min-height: 72px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 14px;

    padding:
        16px
        18px;

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

.v3-modal-head h2 {
    margin: 0;

    font-size: 15px;
    letter-spacing: -0.02em;
}

.v3-modal-head p {
    margin:
        3px
        0
        0;

    color: var(--cbd-text-muted);

    font-size: 9px;
}

.v3-modal-body {
    padding: 18px;
}

.v3-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 8px;

    margin-top: 15px;
}

.v3-danger-notice {
    display: flex;
    align-items: flex-start;

    gap: 9px;

    padding: 12px;

    border:
        1px
        solid
        var(--cbd-danger-100);

    border-radius: 11px;

    color: var(--cbd-danger-700);
    background: var(--cbd-danger-50);

    font-size: 10px;
}

.v3-danger-button {
    min-height: 40px;

    padding:
        0
        14px;

    border: 0;
    border-radius: 10px;

    color: #ffffff;
    background: var(--cbd-danger-600);

    font-size: 11px;
    font-weight: 750;
}

.v3-image-result {
    margin-top: 14px;

    overflow: hidden;

    border-radius: 13px;

    background: var(--cbd-surface-soft);
}

.v3-image-result img {
    width: 100%;

    display: block;
}

.v3-image-loading {
    padding: 30px;

    color: var(--cbd-text-muted);

    text-align: center;

    font-size: 10px;
}

.v3-profile-card {
    display: grid;

    grid-template-columns:
        auto
        minmax(0, 1fr)
        auto;

    align-items: center;

    gap: 11px;

    padding:
        12px;

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

    border-radius: 13px;

    background: var(--cbd-surface-soft);
}

.v3-profile-avatar {
    width: 42px;
    height: 42px;

    display: grid;
    place-items: center;

    border-radius: 12px;

    color: var(--cbd-blue-700);
    background: var(--cbd-blue-50);

    font-size: 11px;
    font-weight: 850;
}

.v3-profile-card strong,
.v3-profile-card span:not(.v3-mini-badge) {
    display: block;
}

.v3-profile-card strong {
    font-size: 11px;
}

.v3-profile-card span:not(.v3-mini-badge) {
    margin-top: 2px;

    color: var(--cbd-text-muted);

    font-size: 9px;
}

.v3-settings-group {
    margin-top: 14px;

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

    border-radius: 13px;

    overflow: hidden;
}

.v3-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 14px;

    padding: 12px;

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

.v3-setting-row:last-child {
    border-bottom: 0;
}

.v3-setting-row strong,
.v3-setting-row span {
    display: block;
}

.v3-setting-row strong {
    font-size: 10px;
}

.v3-setting-row span {
    margin-top: 2px;

    color: var(--cbd-text-muted);

    font-size: 8px;
}

.v3-security-note {
    display: flex;
    align-items: flex-start;

    gap: 9px;

    margin-top: 14px;

    padding: 11px;

    border:
        1px
        solid
        var(--cbd-success-100);

    border-radius: 11px;

    color: var(--cbd-success-700);
    background: var(--cbd-success-50);

    font-size: 9px;
}

.v3-usage-detail-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 9px;
}

.v3-usage-detail {
    padding: 12px;

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

    border-radius: 11px;

    background: var(--cbd-surface-soft);
}

.v3-usage-detail span,
.v3-usage-detail strong {
    display: block;
}

.v3-usage-detail span {
    color: var(--cbd-text-muted);

    font-size: 8px;
}

.v3-usage-detail strong {
    margin-top: 4px;

    font-size: 16px;
}

.v3-voice-orb {
    width: 70px;
    height: 70px;

    display: grid;
    place-items: center;

    margin:
        4px
        auto
        13px;

    border:
        1px
        solid
        var(--cbd-blue-100);

    border-radius: 50%;

    color: var(--cbd-blue-600);
    background: var(--cbd-blue-50);

    box-shadow:
        0 0 0 10px
        rgba(37, 99, 235, 0.045);
}

.v3-voice-status {
    margin:
        0
        0
        13px;

    color: var(--cbd-text-muted);

    text-align: center;

    font-size: 10px;
}

.v3-full-button {
    width: 100%;
}

/* =====================================================================
   TOASTS
   ===================================================================== */

.v3-toast-stack {
    position: fixed;

    right: 18px;
    bottom: 18px;

    z-index: 90;

    display: flex;
    flex-direction: column;

    gap: 8px;
}

.v3-toast {
    width: min(360px, calc(100vw - 32px));

    display: flex;
    align-items: flex-start;

    gap: 9px;

    padding:
        11px
        13px;

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

    border-radius: 11px;

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

    box-shadow:
        var(--cbd-shadow-lg);

    font-size: 10px;

    animation:
        v3-toast-in
        190ms
        var(--cbd-ease);
}

.v3-toast.success {
    border-color: var(--cbd-success-100);
}

.v3-toast.error {
    border-color: var(--cbd-danger-100);
}

.v3-toast-icon {
    width: 25px;
    height: 25px;

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    border-radius: 8px;

    color: var(--cbd-blue-700);
    background: var(--cbd-blue-50);
}

.v3-toast.success .v3-toast-icon {
    color: var(--cbd-success-700);
    background: var(--cbd-success-50);
}

.v3-toast.error .v3-toast-icon {
    color: var(--cbd-danger-700);
    background: var(--cbd-danger-50);
}

@keyframes v3-toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================================================================
   AUTH
   ===================================================================== */

.v3-auth-overlay {
    position: fixed;
    inset: 0;

    z-index: 100;

    display: grid;
    place-items: center;

    padding: 20px;

    background:
        radial-gradient(
            circle at 16% 0%,
            rgba(59, 130, 246, 0.28),
            transparent 34%
        ),
        linear-gradient(
            145deg,
            #07142f,
            #0d2452 58%,
            #123a78
        );
}

.v3-auth-card {
    width: min(430px, 100%);

    padding: 28px;

    border:
        1px
        solid
        rgba(255, 255, 255, 0.55);

    border-radius: 22px;

    background: #ffffff;

    box-shadow:
        0 35px 100px
        rgba(0, 0, 0, 0.28);
}

.v3-auth-brand {
    display: flex;
    align-items: center;

    gap: 10px;
}

.v3-logo-mark {
    width: 43px;
    height: 43px;

    display: grid;
    place-items: center;

    border-radius: 13px;

    color: #ffffff;

    background:
        linear-gradient(
            145deg,
            #60a5fa,
            #2563eb
        );

    box-shadow:
        0 12px 28px
        rgba(37, 99, 235, 0.26);
}

.v3-auth-brand strong,
.v3-auth-brand span {
    display: block;
}

.v3-auth-brand strong {
    color: #0f172a;

    font-size: 14px;
}

.v3-auth-brand span {
    color: #64748b;

    font-size: 9px;
}

.v3-auth-heading {
    margin:
        24px
        0
        18px;
}

.v3-auth-heading h1 {
    margin: 0;

    color: #0f172a;

    font-size: 25px;
    letter-spacing: -0.035em;
}

.v3-auth-heading p {
    margin:
        5px
        0
        0;

    color: #64748b;

    font-size: 11px;
}

.v3-auth-card .cbd-field {
    margin-bottom: 11px;
}

.v3-login-button {
    width: 100%;

    margin-top: 5px;
}

.v3-form-error {
    min-height: 18px;

    margin:
        9px
        0
        0;

    color: var(--cbd-danger-600);

    font-size: 9px;
}

.v3-auth-foot {
    margin-top: 14px;

    color: #94a3b8;

    text-align: center;

    font-size: 8px;
}

/* =====================================================================
   DARK
   ===================================================================== */

body.dark .v3-sidebar {
    background:
        linear-gradient(
            180deg,
            #07132c,
            #050e20
        );
}

body.dark .v3-hero-mark {
    background: #15233b;
}

body.dark .v3-new-chat {
    color: #dce8ff;
    background: #19305f;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

.v3-mobile-backdrop {
    display: none;
}

@media (max-width: 1180px) {

    .v3-shell {
        grid-template-columns:
            270px
            minmax(0, 1fr)
            280px;
    }

    .v3-composer-zone {
        left: 270px;
        right: 280px;
    }
}

@media (max-width: 1020px) {

    .v3-shell {
        grid-template-columns:
            270px
            minmax(0, 1fr);
    }

    .v3-right-rail {
        display: none;
    }

    .v3-composer-zone {
        left: 270px;
        right: 0;
    }
}

@media (max-width: 760px) {

    .v3-shell {
        display: block;
    }

    .v3-sidebar {
        position: fixed;
        inset:
            0
            auto
            0
            0;

        width: 284px;

        transform:
            translateX(-103%);

        transition:
            transform
            220ms
            var(--cbd-ease);
    }

    .v3-sidebar.open {
        transform:
            translateX(0);
    }

    .v3-mobile-backdrop {
        position: fixed;
        inset: 0;

        z-index: 29;

        background:
            rgba(3, 12, 30, 0.48);
    }

    .v3-mobile-backdrop.open {
        display: block;
    }

    .v3-workspace {
        height: 100vh;
    }

    .v3-mobile-menu {
        display: grid;
    }

    .v3-topbar {
        min-height: 64px;
        height: 64px;

        padding:
            0
            11px;
    }

    .v3-title-row strong {
        max-width:
            min(
                46vw,
                280px
            );
    }

    .v3-conversation-state {
        display: none;
    }

    .v3-mode-badge {
        min-width: 31px;
        width: 31px;

        justify-content: center;

        padding: 0;
    }

    .v3-mode-badge #modeBadgeText {
        display: none;
    }

    .v3-messages {
        padding:
            24px
            12px
            178px;
    }

    .v3-empty {
        margin-top: 34px;
    }

    .v3-empty h1 {
        font-size: 29px;
    }

    .v3-empty > p {
        font-size: 12px;
    }

    .v3-quick-grid {
        grid-template-columns:
            1fr;
    }

    .v3-quick-card {
        min-height: 76px;
    }

    .v3-composer-zone {
        left: 0;
        right: 0;

        padding:
            28px
            9px
            9px;
    }

    .v3-compose-button {
        width: 33px;
        height: 33px;

        justify-content: center;

        padding: 0;
    }

    .v3-compose-button span {
        display: none;
    }

    .v3-composer-foot {
        display: none;
    }

    .v3-message {
        gap: 8px;
    }

    .v3-message-avatar {
        width: 30px;
        height: 30px;

        border-radius: 9px;
    }

    .v3-message-body {
        max-width:
            calc(100% - 38px);
    }

    .v3-modal-backdrop {
        align-items: end;

        padding: 0;
    }

    .v3-modal,
    .v3-modal-small {
        width: 100%;
        max-height: 88vh;

        border-radius:
            19px
            19px
            0
            0;
    }

    .v3-toast-stack {
        right: 10px;
        bottom: 10px;
    }

    .v3-key-hint {
        display: none;
    }
}

@media (max-width: 430px) {

    .v3-top-actions {
        gap: 4px;
    }

    .v3-title-block > span {
        max-width: 42vw;

        overflow: hidden;

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

    .v3-capability-strip {
        gap: 5px;
    }

    .v3-capability {
        min-height: 25px;

        padding:
            0
            7px;
    }
}

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

    .v3-history-skeleton span,
    .v3-typing span,
    .v3-toast {
        animation: none !important;
    }
}
