/* Custom styles for DjangoBase */

/* General */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
}

/* Dropdown menu scrollable */
.dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
}

/* Forms */
.form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Alerts */
.alert ul {
    margin: 0;
    padding-left: 1rem;
}

/* Pricing */
.pricing-card {
    border-radius: 0.5rem;
    transition: transform 0.2s;
}

.pricing-card:hover {
    transform: translateY(-5px);
}

.pricing-card.featured {
    border: 2px solid var(--bs-primary);
}

/* Payment form */
#card-element {
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    border-radius: 0.375rem;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }
}

/* =================================================================
   yout.chat — professional polish
   ================================================================= */
:root {
    /* Slate scale — more refined than pure greys */
    --yt-bg: #ffffff;
    --yt-bg-soft: #fafafa;
    --yt-bg-subtle: #f4f4f5;
    --yt-sidebar-bg: #fafafa;
    --yt-border: #e5e7eb;
    --yt-border-soft: #f3f4f6;
    --yt-text: #111827;
    --yt-subtle: #4b5563;
    --yt-muted: #9ca3af;
    --yt-accent: #4f46e5;
    --yt-accent-hover: #4338ca;
    --yt-accent-soft: #eef2ff;
    --yt-bubble-user: #f3f4f6;
    --yt-bubble-assistant: transparent;
    --yt-danger: #ef4444;
    --yt-success: #10b981;
    --yt-warn: #f59e0b;

    --yt-shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --yt-shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --yt-shadow-lg: 0 8px 30px rgba(0,0,0,0.10);

    --yt-radius-sm: 6px;
    --yt-radius-md: 10px;
    --yt-radius-lg: 14px;

    --yt-font: 'Inter var', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { font-family: var(--yt-font); }
body {
    background: var(--yt-bg);
    color: var(--yt-text);
    overflow: hidden;
    font-feature-settings: "cv11", "ss01", "ss03";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body.chat-mode main { padding: 0; }
body.chat-mode footer { display: none; }

/* Brand mark — ".ai" uses the same indigo gradient as the logo dot */
.brand-mark {
    font-size: 1.12rem;
    letter-spacing: -0.03em;
    color: var(--yt-text);
    font-weight: 600;
}
.brand-mark .dot,
.brand-mark .accent,
.ai-accent {
    background: linear-gradient(135deg, #059669, #065f46);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    font-weight: 700;
}
.sister-link {
    color: var(--yt-muted);
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 999px;
    transition: background 0.12s, color 0.12s;
}
.sister-link:hover { color: var(--yt-text); background: var(--yt-bg-subtle); }
.sister-link .ext-arrow {
    display: inline-block;
    opacity: 0.6;
    margin-left: 2px;
    font-size: 0.95em;
    transition: transform 0.15s, opacity 0.15s;
}
.sister-link:hover .ext-arrow { opacity: 1; transform: translate(2px, -2px); }

/* Universal icon sizing */
.i {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    color: currentColor;
}

/* Kill native button appearance on every custom control — otherwise
   `appearance: button` collapses buttons to font-height and ignores padding. */
.new-btn, .icon-btn, .send-btn, .model-pill, .tag,
.filter-chip, .sugg, .btn-cta-sm, .fav-btn {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    line-height: 1;
}
.sugg, .new-btn { line-height: 1.2; }
.tag, .filter-chip { line-height: 1.4; }

/* Override bootstrap navbar a bit */
.navbar {
    border-bottom: 1px solid var(--yt-border-soft);
}
.navbar .nav-link { font-size: 0.88rem; color: var(--yt-subtle) !important; }
.navbar .nav-link:hover { color: var(--yt-text) !important; }
.navbar .btn-primary {
    background: var(--yt-text) !important;
    border-color: var(--yt-text) !important;
    font-weight: 500;
}
.navbar .btn-primary:hover { background: #000 !important; border-color: #000 !important; }

kbd {
    font-family: var(--yt-font);
    font-size: 0.68rem;
    background: var(--yt-bg-subtle);
    border: 1px solid var(--yt-border);
    border-radius: 3px;
    padding: 1px 5px;
    margin: 0 1px;
    color: var(--yt-subtle);
    font-weight: 500;
}
.kbd-hint { display: inline-flex; align-items: center; font-size: 0.72rem; color: var(--yt-muted); }
.kbd-hint kbd { margin-right: 1px; }

#app-shell {
    display: flex;
    height: calc(100vh - 56px);
    background: var(--yt-bg);
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: 264px;
    flex-shrink: 0;
    background: var(--yt-sidebar-bg);
    border-right: 1px solid var(--yt-border-soft);
    display: flex;
    flex-direction: column;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s;
    overflow: hidden;
}
.sidebar.collapsed { width: 0; border-right: none; }

.sidebar-head {
    display: flex;
    gap: 4px;
    padding: 10px;
}
.new-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--yt-border);
    background: #fff;
    padding: 8px 12px;
    border-radius: var(--yt-radius-md);
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--yt-text);
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--yt-shadow-sm);
    font-family: inherit;
}
.new-btn:hover { background: var(--yt-accent-soft); border-color: var(--yt-accent); color: var(--yt-accent); }
.new-btn .i { color: var(--yt-subtle); }
.new-btn:hover .i { color: var(--yt-accent); }

.icon-btn {
    border: none;
    background: transparent;
    width: 34px;
    height: 34px;
    border-radius: var(--yt-radius-sm);
    cursor: pointer;
    color: var(--yt-subtle);
    display: inline-grid;
    place-items: center;
    transition: all 0.12s;
    padding: 0;
}
.icon-btn:hover { background: var(--yt-bg-subtle); color: var(--yt-text); }

.sidebar-search {
    padding: 0 10px 10px;
    position: relative;
}
.sidebar-search .search-i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--yt-muted);
    pointer-events: none;
    width: 15px;
    height: 15px;
}
.sidebar-search input {
    width: 100%;
    padding: 7px 10px 7px 32px;
    border: 1px solid var(--yt-border-soft);
    background: #fff;
    border-radius: var(--yt-radius-sm);
    font-size: 0.84rem;
    outline: none;
    color: var(--yt-text);
    transition: border-color 0.12s, box-shadow 0.12s;
    font-family: inherit;
}
.sidebar-search input:focus {
    border-color: var(--yt-accent);
    box-shadow: 0 0 0 3px var(--yt-accent-soft);
}
.sidebar-search input::placeholder { color: var(--yt-muted); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 12px;
}
.sidebar-section-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--yt-muted);
    padding: 12px 10px 6px;
    font-weight: 600;
}
.convo-list { list-style: none; padding: 0; margin: 0; }
.convo-list li {
    padding: 7px 10px;
    border-radius: var(--yt-radius-sm);
    cursor: pointer;
    font-size: 0.86rem;
    color: var(--yt-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.1s;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.convo-list li .convo-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.convo-list li .convo-time {
    font-size: 0.7rem;
    color: var(--yt-muted);
    flex-shrink: 0;
}
.convo-list li:hover { background: rgba(0,0,0,0.04); }
.convo-list li.active { background: rgba(79,70,229,0.08); color: var(--yt-accent); font-weight: 500; }
.convo-list li.active .convo-time { color: var(--yt-accent); opacity: 0.7; }
.empty-history { padding: 16px 10px; color: var(--yt-muted); line-height: 1.55; font-size: 0.82rem; }

.sidebar-foot {
    padding: 10px;
    border-top: 1px solid var(--yt-border-soft);
}
.account-chip, .signup-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--yt-radius-md);
    text-decoration: none;
    color: var(--yt-text);
    font-size: 0.85rem;
    transition: background 0.12s;
}
.account-chip:hover { background: rgba(0,0,0,0.04); color: var(--yt-text); }
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.82rem;
    font-weight: 600;
    flex-shrink: 0;
}
.account-text { min-width: 0; flex: 1; }
.account-text .email {
    font-size: 0.82rem;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--yt-text);
}
.account-text .balance-sm { color: var(--yt-muted); font-size: 0.72rem; margin-top: 1px; }
.signup-chip {
    color: var(--yt-text);
    border: 1px solid var(--yt-border);
    background: #fff;
    justify-content: center;
    font-weight: 500;
    box-shadow: var(--yt-shadow-sm);
}
.signup-chip:hover { background: var(--yt-accent-soft); border-color: var(--yt-accent); color: var(--yt-accent); }
.signup-chip .i { width: 16px; height: 16px; }

/* ============ MAIN CHAT AREA ============ */
#chat-shell {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: var(--yt-bg);
}
.chat-topbar {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    gap: 4px;
    min-height: 52px;
    position: relative;
    z-index: 3;
    flex-shrink: 0;
}
.flex-grow { flex: 1; }

.welcome {
    text-align: center;
    max-width: 700px;
    padding: 0 24px;
    margin: 0 auto;
    width: 100%;
}

/* EMPTY STATE — welcome vertically centered, composer always stays anchored at bottom */
#chat-shell.is-empty .messages { display: none; }
#chat-shell.is-empty .welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px 24px 180px;  /* bottom pad so centered content doesn't collide with composer */
    width: 100%;
    max-width: none;
}
#chat-shell.is-empty .welcome > * { width: 100%; max-width: 700px; }
#chat-shell:not(.is-empty) .welcome { display: none; }
.welcome-title {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: 10px;
    color: var(--yt-text);
    line-height: 1.2;
}
.welcome-sub {
    color: var(--yt-subtle);
    margin-bottom: 32px;
    font-size: 0.95rem;
    line-height: 1.5;
}
.suggestions {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 10px;
    max-width: 540px;
    margin: 0 auto;
}
@media (max-width: 520px) {
    .suggestions { grid-template-columns: 1fr; }
}
.sugg {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--yt-border);
    background: #fff;
    padding: 12px 14px;
    border-radius: var(--yt-radius-md);
    font-size: 0.86rem;
    color: var(--yt-text);
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    font-family: inherit;
    box-shadow: var(--yt-shadow-sm);
}
.sugg:hover {
    border-color: var(--yt-accent);
    background: var(--yt-accent-soft);
    color: var(--yt-accent);
    transform: translateY(-1px);
}
.sugg-icon {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    background: var(--yt-bg-subtle);
    color: var(--yt-subtle);
    border-radius: var(--yt-radius-sm);
    font-size: 0.95rem;
    flex-shrink: 0;
}
.sugg:hover .sugg-icon { background: #fff; color: var(--yt-accent); }

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 200px;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    scroll-behavior: smooth;
}
.msg {
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
}
.msg-role { display: none; }  /* role is implied by alignment, like ChatGPT/Claude */
.msg-body {
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.95rem;
    color: var(--yt-text);
}
.msg-user {
    align-items: flex-end;
}
.msg-user .msg-body {
    background: var(--yt-bg-subtle);
    padding: 10px 16px;
    border-radius: 18px;
    max-width: 85%;
    border: 1px solid var(--yt-border-soft);
}
.msg-assistant .msg-body {
    background: transparent;
    padding: 0;
    width: 100%;
}
.msg-body.limit-msg {
    color: var(--yt-muted);
    font-style: italic;
    font-size: 0.88rem;
}
.msg-assistant .msg-body:empty::after {
    content: "";
    display: inline-block;
    width: 10px;
    height: 16px;
    background: var(--yt-muted);
    border-radius: 2px;
    animation: blink 1s steps(2) infinite;
    vertical-align: -3px;
}
@keyframes blink { 50% { opacity: 0; } }

/* ============ MARKDOWN inside assistant messages ============ */
.msg-body { white-space: normal; }      /* markdown handles wrapping */
.msg-user .msg-body { white-space: pre-wrap; }  /* but user text stays verbatim */

.msg-body p { margin: 0 0 12px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body h1, .msg-body h2, .msg-body h3, .msg-body h4 {
    margin: 18px 0 8px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
.msg-body h1 { font-size: 1.5rem; }
.msg-body h2 { font-size: 1.25rem; }
.msg-body h3 { font-size: 1.1rem; }
.msg-body h4 { font-size: 1rem; }
.msg-body ul, .msg-body ol { margin: 0 0 12px; padding-left: 26px; }
.msg-body li { margin-bottom: 4px; }
.msg-body li > p { margin-bottom: 4px; }
.msg-body a {
    color: var(--yt-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.msg-body a:hover { color: var(--yt-accent-hover); }
.msg-body blockquote {
    border-left: 3px solid var(--yt-border);
    padding: 0 0 0 14px;
    margin: 0 0 12px;
    color: var(--yt-subtle);
}
.msg-body hr {
    border: 0;
    border-top: 1px solid var(--yt-border-soft);
    margin: 18px 0;
}
.msg-body table {
    border-collapse: collapse;
    margin: 0 0 12px;
    font-size: 0.88rem;
    width: 100%;
}
.msg-body th, .msg-body td {
    border: 1px solid var(--yt-border);
    padding: 6px 10px;
    text-align: left;
}
.msg-body th { background: var(--yt-bg-subtle); font-weight: 600; }
.msg-body strong { font-weight: 600; color: var(--yt-text); }
.msg-body em { font-style: italic; }

/* Inline code */
.msg-body :not(pre) > code {
    background: var(--yt-bg-subtle);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.86em;
    color: #c7254e;
    border: 1px solid var(--yt-border-soft);
}

/* Code blocks */
.msg-body pre {
    background: #f6f8fa;
    border: 1px solid var(--yt-border-soft);
    border-radius: 10px;
    padding: 14px 14px 14px 16px;
    margin: 0 0 14px;
    overflow-x: auto;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.86rem;
    line-height: 1.55;
    position: relative;
}
.msg-body pre code {
    background: none;
    padding: 0;
    border: 0;
    color: #24292f;
    font-size: inherit;
    white-space: pre;
}
.msg-body pre .code-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #fff;
    border: 1px solid var(--yt-border);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--yt-subtle);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, all 0.12s;
    font-family: var(--yt-font);
}
.msg-body pre:hover .code-copy { opacity: 1; }
.msg-body pre .code-copy:hover { color: var(--yt-text); border-color: var(--yt-subtle); }

/* ============ COMPOSER ============ */
.composer {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 0 24px;
    pointer-events: none;
    z-index: 4;
}
.composer::before {
    content: "";
    position: absolute;
    inset: -40px 0 0 0;
    background: linear-gradient(to top, var(--yt-bg) 60%, transparent);
    pointer-events: none;
    z-index: -1;
}
.composer-inner {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 10px 10px 12px;
    background: #fff;
    border: 1px solid var(--yt-border);
    border-radius: var(--yt-radius-lg);
    box-shadow: var(--yt-shadow-md);
    max-width: 780px;
    margin: 0 auto;
    pointer-events: auto;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-inner:focus-within {
    border-color: var(--yt-accent);
    box-shadow: 0 0 0 3px var(--yt-accent-soft), var(--yt-shadow-md);
}
.model-pill {
    border: 1px solid var(--yt-border-soft);
    background: var(--yt-bg-subtle);
    border-radius: var(--yt-radius-md);
    padding: 6px 8px 6px 12px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 220px;
    flex-shrink: 0;
    color: var(--yt-text);
    transition: all 0.12s;
    white-space: nowrap;
    font-family: inherit;
    height: 34px;
    align-self: center;
}
.model-pill:hover { background: var(--yt-bg-soft); border-color: var(--yt-border); }
.model-pill .caret { width: 14px; height: 14px; color: var(--yt-muted); }
.model-pill #model-name { overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.model-meta {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--yt-bg-subtle);
    color: var(--yt-subtle);
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}
.model-meta.is-pro { background: rgba(245,158,11,0.12); color: #b45309; }

#input-box {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 7px 4px;
    max-height: 200px;
    min-width: 0;
    background: transparent;
    font-family: inherit;
    color: var(--yt-text);
}
#input-box::placeholder { color: var(--yt-muted); }
.send-btn {
    border: none;
    background: var(--yt-text);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: var(--yt-radius-md);
    cursor: pointer;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    transition: all 0.15s;
    align-self: center;
}
.send-btn:hover { background: var(--yt-accent); transform: translateY(-1px); }
.send-btn:disabled { background: var(--yt-border); cursor: wait; transform: none; }
.send-btn .i { width: 16px; height: 16px; }

.composer-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 780px;
    margin: 8px auto 0;
    padding: 0 6px;
    font-size: 0.76rem;
    color: var(--yt-muted);
    pointer-events: auto;
    gap: 12px;
    flex-wrap: wrap;
}
.tasks { display: flex; gap: 2px; flex-wrap: wrap; }
.tag {
    display: inline-flex;
    align-items: center;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--yt-muted);
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.1s;
    font-family: inherit;
}
.tag:hover { color: var(--yt-text); }
.tag.active { background: var(--yt-bg-subtle); color: var(--yt-text); font-weight: 500; }
.status { display: flex; align-items: center; gap: 12px; }
.usage-indicator {
    font-size: 0.76rem;
    color: var(--yt-subtle);
    font-variant-numeric: tabular-nums;
    padding: 2px 8px;
    background: var(--yt-bg-subtle);
    border-radius: 999px;
    white-space: nowrap;
}
.usage-indicator.warn { background: rgba(245,158,11,0.15); color: #92400e; }
.usage-indicator.empty { background: rgba(239,68,68,0.12); color: #991b1b; }
.msg-usage {
    font-size: 0.72rem;
    color: var(--yt-muted);
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.msg-usage .sep { color: var(--yt-border); }
.sync-toggle { cursor: pointer; display: flex; gap: 5px; align-items: center; font-size: 0.75rem; color: var(--yt-subtle); }
.sync-toggle input { cursor: pointer; }

/* ============ MODEL PICKER POPOVER ============ */
.model-popover {
    position: fixed;
    left: 50%;
    bottom: 100px;
    transform: translateX(-50%);
    width: min(760px, calc(100vw - 40px));
    max-height: min(640px, calc(100vh - 180px));
    background: #fff;
    border: 1px solid var(--yt-border);
    border-radius: var(--yt-radius-lg);
    box-shadow: var(--yt-shadow-lg);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.picker-head {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--yt-border-soft);
    gap: 10px;
    flex-shrink: 0;
}
.picker-head .search-i { color: var(--yt-muted); width: 20px; height: 20px; }
.picker-head input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 4px 2px;
    background: transparent;
    font-family: inherit;
    color: var(--yt-text);
}
.picker-head input::placeholder { color: var(--yt-muted); }
.picker-filters {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--yt-border-soft);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
    min-height: 58px;
    box-sizing: border-box;
    align-items: center;
}
.picker-filters::-webkit-scrollbar { display: none; }
.filter-chip {
    display: inline-flex;
    align-items: center;
    height: 34px;
    border: 1px solid var(--yt-border);
    background: #fff;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--yt-text);
    white-space: nowrap;
    transition: all 0.12s;
    font-family: inherit;
    flex-shrink: 0;
}
.filter-chip.active { background: var(--yt-text); color: #fff; border-color: var(--yt-text); }
.filter-chip:hover:not(.active) { background: var(--yt-bg-subtle); color: var(--yt-text); }

.model-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}
.provider-group { margin-bottom: 4px; }
.provider-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--yt-muted);
    padding: 10px 10px 4px;
    font-weight: 600;
}
.model-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--yt-radius-sm);
    cursor: pointer;
    transition: background 0.08s;
    position: relative;
}
.model-row:hover, .model-row.focused { background: var(--yt-bg-subtle); }
.model-row.selected { background: var(--yt-accent-soft); }
.model-row.selected .name { color: var(--yt-accent); }
.model-row .check-col {
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    color: var(--yt-accent);
    flex-shrink: 0;
}
.model-row:not(.selected) .check-col { visibility: hidden; }
.model-row .name-col { flex: 1; min-width: 0; }
.model-row .name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--yt-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.model-row .desc {
    font-size: 0.74rem;
    color: var(--yt-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 1px;
}
.model-row .chips {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    align-items: center;
}
.chip {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--yt-bg-subtle);
    color: var(--yt-subtle);
    white-space: nowrap;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.chip.pro { background: rgba(245,158,11,0.12); color: #b45309; }
.chip.ctx { background: rgba(79,70,229,0.08); color: #4338ca; }
.model-row .fav-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    opacity: 0.25;
    color: var(--yt-muted);
    padding: 4px;
    display: grid;
    place-items: center;
    transition: all 0.12s;
    border-radius: 4px;
}
.model-row .fav-btn .i { width: 15px; height: 15px; }
.model-row .fav-btn.on { opacity: 1; color: #f59e0b; }
.model-row:hover .fav-btn { opacity: 0.6; }
.model-row .fav-btn:hover { opacity: 1; background: rgba(0,0,0,0.05); transform: scale(1.1); }
.empty-state {
    padding: 40px 16px;
    text-align: center;
    color: var(--yt-muted);
    font-size: 0.88rem;
}

.picker-foot {
    display: flex;
    gap: 16px;
    padding: 8px 14px;
    border-top: 1px solid var(--yt-border-soft);
    font-size: 0.7rem;
    color: var(--yt-muted);
    background: var(--yt-bg-soft);
    flex-shrink: 0;
}
.picker-foot kbd { font-size: 0.66rem; padding: 0 4px; }

.model-popover-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,0.2);
    backdrop-filter: blur(2px);
    z-index: 99;
    animation: fade-in 0.15s ease-out;
}
.model-popover {
    animation: pop-in 0.15s ease-out;
}
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes pop-in {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ SHARE / INVITE MODAL ============ */
.share-modal {
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,0.4);
    backdrop-filter: blur(3px);
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 16px;
    animation: fade-in 0.15s ease-out;
}
.share-modal[hidden] { display: none; }
.share-modal-card {
    background: #fff;
    width: 100%;
    max-width: 460px;
    border-radius: var(--yt-radius-lg);
    padding: 22px;
    box-shadow: var(--yt-shadow-lg);
    animation: pop-in 0.2s cubic-bezier(0.2, 0, 0.2, 1);
}
.share-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.share-modal-head strong { font-size: 1.02rem; font-weight: 600; color: var(--yt-text); }
.share-modal-sub {
    color: var(--yt-subtle);
    font-size: 0.86rem;
    margin-bottom: 16px;
    line-height: 1.55;
}
.share-modal-sub strong { color: var(--yt-text); font-weight: 600; }
.share-url-row {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}
.share-url-row input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--yt-border);
    border-radius: var(--yt-radius-md);
    font-size: 0.82rem;
    background: var(--yt-bg-soft);
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    outline: none;
    color: var(--yt-text);
}
.share-url-row input:focus { border-color: var(--yt-accent); }
.btn-cta-sm {
    background: var(--yt-text);
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: var(--yt-radius-md);
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.12s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-cta-sm:hover { background: var(--yt-accent); }
.btn-cta-sm .i { width: 14px; height: 14px; }
.share-networks {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.share-net {
    flex: 1;
    min-width: 110px;
    text-align: center;
    padding: 10px 12px;
    border: 1px solid var(--yt-border);
    border-radius: var(--yt-radius-md);
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--yt-text);
    text-decoration: none;
    background: #fff;
    transition: all 0.12s;
}
.share-net:hover {
    background: var(--yt-bg-subtle);
    border-color: var(--yt-text);
    color: var(--yt-text);
    transform: translateY(-1px);
}
.share-note {
    font-size: 0.78rem;
    color: var(--yt-success);
    min-height: 20px;
    margin-top: 10px;
    font-weight: 500;
}

/* Upgrade modal — action grid + secondary row */
.upgrade-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 8px 0 12px;
}
.upgrade-grid .upgrade-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--yt-border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--yt-text);
    background: #fff;
    transition: all 0.12s;
}
.upgrade-grid .upgrade-btn:hover {
    border-color: var(--yt-text);
    transform: translateY(-1px);
    box-shadow: var(--yt-shadow-sm);
    color: var(--yt-text);
}
.upgrade-grid .upgrade-btn.primary {
    background: var(--yt-text);
    color: #fff;
    border-color: var(--yt-text);
}
.upgrade-grid .upgrade-btn.primary:hover { background: var(--yt-accent); border-color: var(--yt-accent); color: #fff; }
.upgrade-grid .upgrade-btn strong { font-weight: 600; font-size: 0.94rem; }
.upgrade-grid .upgrade-btn small { color: var(--yt-muted); font-size: 0.78rem; }
.upgrade-grid .upgrade-btn.primary small { color: rgba(255,255,255,0.7); }
.upgrade-secondary {
    text-align: center;
    font-size: 0.82rem;
    color: var(--yt-muted);
}
.upgrade-secondary a { color: var(--yt-subtle); text-decoration: underline; }
@media (max-width: 420px) {
    .upgrade-grid { grid-template-columns: 1fr; }
}

/* Toast stack */
.toast-stack {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: calc(100vw - 48px);
}
.toast {
    pointer-events: auto;
    background: var(--yt-text);
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: var(--yt-shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.88rem;
    min-width: 260px;
    max-width: 360px;
    animation: toast-in 0.25s cubic-bezier(0.2, 0, 0.2, 1);
}
.toast.warn  { background: #92400e; }
.toast.good  { background: #065f46; }
.toast-body { flex: 1; line-height: 1.45; }
.toast-body strong { font-weight: 600; }
.toast-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.toast-actions a, .toast-actions button {
    color: #fff;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.toast-actions a:hover, .toast-actions button:hover { background: rgba(255,255,255,0.25); color: #fff; }
.toast-dismiss {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 0;
    font-size: 1.2rem;
    line-height: 1;
}
.toast-dismiss:hover { color: #fff; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ MOBILE ============ */
@media (max-width: 768px) {
    .sidebar { position: absolute; top: 0; bottom: 0; left: 0; z-index: 50; box-shadow: 2px 0 8px rgba(0,0,0,0.1); }
    .sidebar.collapsed { transform: translateX(-100%); width: 260px; }
    .welcome-title { font-size: 1.6rem; }
    .suggestions .sugg { font-size: 0.82rem; padding: 8px 12px; }
    .composer { padding: 0 10px; bottom: 10px; }
    .messages { padding: 16px 12px 160px; }
    .model-popover { bottom: 80px; max-height: calc(100vh - 140px); }
}

/* Minimal nav override for homepage chat */
body.chat-mode .navbar {
    box-shadow: none;
    border-bottom: 1px solid var(--yt-border-soft);
}
.balance { font-variant-numeric: tabular-nums; }

/* ======================================================================
   INNER PAGES — shared primitives
   ====================================================================== */
body:not(.chat-mode) { overflow: auto; }
body:not(.chat-mode) main { padding: 0; }

.page-shell {
    max-width: 1120px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}
.page-hero {
    text-align: center;
    padding: 40px 0 48px;
}
.page-hero .eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--yt-accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 14px;
    padding: 4px 12px;
    background: var(--yt-accent-soft);
    border-radius: 999px;
}
.page-hero h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.08;
    margin-bottom: 14px;
    color: var(--yt-text);
}
.page-hero p {
    color: var(--yt-subtle);
    font-size: 1.1rem;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.55;
}

.section-head { text-align: center; margin-bottom: 32px; }
.section-head h2 {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}
.section-head p { color: var(--yt-subtle); margin: 0; font-size: 1.02rem; }

/* Page-wide section headers */
.compare-section h2, .faq-section h2, .final-cta h2 {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: center;
    margin-bottom: 28px;
}

/* ======================================================================
   PRICING PAGE
   ====================================================================== */

/* Billing toggle */
.billing-toggle {
    display: inline-flex;
    background: var(--yt-bg-subtle);
    border: 1px solid var(--yt-border);
    border-radius: 999px;
    padding: 4px;
    margin-top: 24px;
    gap: 2px;
}
.billing-toggle .bt {
    border: none;
    background: transparent;
    padding: 8px 20px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--yt-subtle);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.billing-toggle .bt.active {
    background: #fff;
    color: var(--yt-text);
    box-shadow: var(--yt-shadow-sm);
}
.billing-toggle .save {
    font-size: 0.72rem;
    color: #059669;
    background: rgba(16,185,129,0.12);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 600;
}

/* Plan cards grid */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 60px;
}
.plan-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--yt-border);
    border-radius: 16px;
    padding: 32px 24px 24px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
}
.plan-card:hover { transform: translateY(-2px); box-shadow: var(--yt-shadow-md); }
.plan-featured {
    border-color: var(--yt-accent);
    box-shadow: 0 8px 32px rgba(79,70,229,0.15);
}
.plan-lifetime {
    border-color: #059669;
    background: linear-gradient(180deg, #fff 0%, rgba(16,185,129,0.03) 100%);
}
.plan-ribbon {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--yt-accent);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.plan-ribbon.gold {
    background: linear-gradient(135deg, #059669, #065f46);
}
.plan-head { margin-bottom: 16px; }
.plan-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
    color: var(--yt-text);
}
.plan-tagline {
    color: var(--yt-muted);
    font-size: 0.86rem;
    margin: 0;
    line-height: 1.5;
}
.plan-price { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--yt-border-soft); }
.plan-price .amount {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--yt-text);
    font-variant-numeric: tabular-nums;
}
.plan-price .period { color: var(--yt-muted); font-size: 1rem; font-weight: 500; margin-left: 2px; }
.plan-price .billed { font-size: 0.78rem; color: var(--yt-muted); margin-top: 4px; }

.plan-feats {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    font-size: 0.88rem;
    color: var(--yt-subtle);
    flex: 1;
}
.plan-feats li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
    line-height: 1.45;
}
.plan-feats li .i {
    color: #059669;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}
.plan-feats li em { font-style: normal; color: #059669; font-weight: 500; }

.plan-cta { margin-top: auto; }
.btn-plan {
    display: block;
    width: 100%;
    text-align: center;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    border: 1px solid transparent;
    font-family: inherit;
    cursor: pointer;
}
.btn-plan.btn-primary {
    background: var(--yt-text);
    color: #fff;
    border-color: var(--yt-text);
}
.btn-plan.btn-primary:hover { background: var(--yt-accent); border-color: var(--yt-accent); color: #fff; transform: translateY(-1px); }
.btn-plan.btn-outline {
    background: #fff;
    color: var(--yt-text);
    border-color: var(--yt-border);
}
.btn-plan.btn-outline:hover { border-color: var(--yt-text); color: var(--yt-text); }

/* Trust row */
.trust-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    padding: 20px 24px;
    background: var(--yt-bg-soft);
    border: 1px solid var(--yt-border-soft);
    border-radius: 14px;
    margin-bottom: 70px;
}
.trust-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 0.86rem;
    color: var(--yt-subtle);
    line-height: 1.45;
}
.trust-item .i { color: #059669; width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.trust-item strong { color: var(--yt-text); font-weight: 600; }
.trust-item code {
    background: var(--yt-bg-subtle);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.82em;
}

/* Topup cards */
.topup-section { margin-bottom: 70px; }
.topup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}
.topup-card {
    display: block;
    padding: 24px 22px;
    background: #fff;
    border: 1px solid var(--yt-border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--yt-text);
    transition: all 0.15s;
}
.topup-card:hover { border-color: var(--yt-text); transform: translateY(-2px); box-shadow: var(--yt-shadow-md); color: var(--yt-text); }
.topup-price {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--yt-text);
    font-variant-numeric: tabular-nums;
    margin-bottom: 2px;
}
.topup-credits {
    font-size: 1rem;
    color: var(--yt-text);
    font-weight: 500;
    margin-bottom: 6px;
}
.topup-note { font-size: 0.8rem; color: var(--yt-muted); margin-bottom: 12px; line-height: 1.45; }
.topup-buy { font-size: 0.86rem; color: var(--yt-accent); font-weight: 500; }

/* Compare table */
.compare-section { margin-bottom: 70px; }
.compare-table {
    overflow-x: auto;
    border: 1px solid var(--yt-border);
    border-radius: 14px;
    background: #fff;
}
.compare-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.compare-table th, .compare-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--yt-border-soft);
}
.compare-table thead th {
    font-weight: 600;
    background: var(--yt-bg-soft);
    color: var(--yt-text);
    font-size: 0.88rem;
}
.compare-table tbody tr:last-child td { border-bottom: none; }
.compare-table td:first-child, .compare-table th:first-child { color: var(--yt-subtle); min-width: 200px; }
.compare-table td:not(:first-child) { color: var(--yt-text); font-weight: 500; text-align: center; }
.compare-table th.featured, .compare-table td:nth-child(4) {
    background: rgba(16,185,129,0.04);
}
.compare-table th.featured { color: #059669; }

/* FAQ */
.faq-section { margin-bottom: 70px; }
.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
}
.faq-grid details {
    background: #fff;
    border: 1px solid var(--yt-border-soft);
    border-radius: 10px;
    padding: 14px 18px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.faq-grid details[open] {
    border-color: var(--yt-border);
    box-shadow: var(--yt-shadow-sm);
}
.faq-grid summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--yt-text);
    font-size: 0.94rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-grid summary::marker { display: none; }
.faq-grid summary::-webkit-details-marker { display: none; }
.faq-grid summary::after {
    content: "+";
    color: var(--yt-muted);
    font-weight: 400;
    font-size: 1.2rem;
    transition: transform 0.15s;
}
.faq-grid details[open] summary::after { content: "−"; }
.faq-grid details p {
    color: var(--yt-subtle);
    margin: 12px 0 0;
    line-height: 1.6;
    font-size: 0.9rem;
}
.faq-grid details code {
    background: var(--yt-bg-subtle);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.82em;
}

/* Final CTA */
.final-cta {
    text-align: center;
    padding: 56px 24px;
    background: var(--yt-bg-soft);
    border: 1px solid var(--yt-border-soft);
    border-radius: 18px;
}
.final-cta h2 { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px; }
.final-cta p { color: var(--yt-subtle); margin-bottom: 24px; }
.cta-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.cta-buttons .btn-plan { width: auto; min-width: 180px; }

@media (max-width: 640px) {
    .page-hero h1 { font-size: 2.1rem; }
    .page-shell { padding: 24px 16px 60px; }
    .plan-card { padding: 24px 20px 20px; }
    .plan-price .amount { font-size: 2.1rem; }
}

/* ======================================================================
   API DOCS PAGE
   ====================================================================== */
.api-page .api-section { margin-bottom: 64px; }
.api-page .section-title {
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 18px;
}

.api-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 16px;
}
.api-steps li {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 20px 22px;
    background: #fff;
    border: 1px solid var(--yt-border-soft);
    border-radius: 14px;
}
.step-num {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--yt-text);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 0.92rem;
}
.api-steps h4 { font-size: 1rem; margin: 0 0 4px; color: var(--yt-text); font-weight: 600; }
.api-steps p { margin: 0; color: var(--yt-subtle); line-height: 1.55; font-size: 0.92rem; }
.api-steps code {
    background: var(--yt-bg-subtle);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.85em;
    color: var(--yt-text);
}
.api-steps a { color: var(--yt-accent); }

.code-block {
    background: #f6f8fa;
    border: 1px solid var(--yt-border-soft);
    border-radius: 12px;
    padding: 16px 18px;
    overflow-x: auto;
}
.code-block pre { margin: 0; font-size: 0.86rem; line-height: 1.55; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.code-caption { color: var(--yt-muted); font-size: 0.86rem; margin-top: 10px; line-height: 1.55; }
.code-caption code {
    background: var(--yt-bg-subtle);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: ui-monospace, monospace;
    font-size: 0.85em;
}

.endpoint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 14px;
}
.endpoint {
    background: #fff;
    border: 1px solid var(--yt-border-soft);
    border-radius: 12px;
    padding: 18px 20px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.endpoint:hover { border-color: var(--yt-border); box-shadow: var(--yt-shadow-sm); }
.endpoint header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.endpoint header code {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--yt-text);
    background: transparent;
}
.endpoint p { color: var(--yt-subtle); font-size: 0.9rem; line-height: 1.55; margin: 0 0 8px; }
.endpoint code {
    background: var(--yt-bg-subtle);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: ui-monospace, monospace;
    font-size: 0.82em;
    color: var(--yt-text);
}
.method {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 4px;
    letter-spacing: 0.03em;
}
.method.get  { background: rgba(16,185,129,0.12); color: #047857; }
.method.post { background: rgba(245,158,11,0.12); color: #b45309; }

.endpoint details { margin-top: 10px; }
.endpoint summary {
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--yt-accent);
    padding: 4px 0;
}
.endpoint summary::marker, .endpoint summary::-webkit-details-marker { display: none; }
.endpoint details[open] summary { color: var(--yt-text); }
.endpoint details pre {
    background: var(--yt-bg-soft);
    border: 1px solid var(--yt-border-soft);
    border-radius: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 6px 0 0;
    font-family: ui-monospace, monospace;
}

.billing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.billing-card {
    background: #fff;
    border: 1px solid var(--yt-border-soft);
    border-radius: 12px;
    padding: 18px 20px;
}
.billing-card h4 { font-size: 0.94rem; margin: 0 0 6px; color: var(--yt-text); font-weight: 600; }
.billing-card p { color: var(--yt-subtle); font-size: 0.88rem; line-height: 1.55; margin: 0; }
.billing-card code {
    background: var(--yt-bg-subtle);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: ui-monospace, monospace;
    font-size: 0.82em;
}

.api-bullets {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}
.api-bullets li {
    padding: 12px 18px 12px 36px;
    background: #fff;
    border: 1px solid var(--yt-border-soft);
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--yt-subtle);
    position: relative;
}
.api-bullets li::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 19px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #059669;
}
.api-bullets li strong { color: var(--yt-text); font-weight: 600; }

/* Code tabs — drop-in replacement block */
.code-tabs {
    background: #fff;
    border: 1px solid var(--yt-border-soft);
    border-radius: 12px;
    overflow: hidden;
}
.code-tab-bar {
    display: flex;
    gap: 2px;
    padding: 6px 6px 0;
    background: var(--yt-bg-soft);
    border-bottom: 1px solid var(--yt-border-soft);
}
.code-tab {
    border: none;
    background: transparent;
    padding: 8px 14px;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--yt-subtle);
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.code-tab:hover:not(.active) { color: var(--yt-text); }
.code-tab.active {
    background: #fff;
    color: var(--yt-text);
    border-bottom-color: var(--yt-accent);
}
.code-tab-body pre {
    margin: 0;
    padding: 18px 20px;
    overflow-x: auto;
    font-size: 0.86rem;
    line-height: 1.55;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    background: #fff;
}
.code-tab-body code { background: transparent !important; padding: 0 !important; }
.api-bullets li code {
    background: var(--yt-bg-subtle);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: ui-monospace, monospace;
    font-size: 0.85em;
    color: var(--yt-text);
}
.api-base-note {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 14px;
    background: var(--yt-bg-soft);
    border: 1px solid var(--yt-border-soft);
    border-radius: 8px;
    font-size: 0.84rem;
    color: var(--yt-subtle);
}
.api-base-note code {
    background: var(--yt-bg-subtle);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    color: var(--yt-text);
    font-weight: 500;
    margin: 0 2px;
}

/* =====================================================================
   Compose modes, Compare, Uploads, Media, Access notice, Mobile sidebar
   (added for the multi-model / multimodal build)
   ===================================================================== */

/* The .composer form has pointer-events:none; every interactive row inside it
   must re-enable them and align to the same 780px column as .composer-inner. */
.mode-bar, .attach-tray, .access-notice { pointer-events: auto; max-width: 780px; margin-left: auto; margin-right: auto; }
/* Mode bar (Chat / Image / Video / Voice + Compare) */
.mode-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.mode-chip {
    appearance: none; -webkit-appearance: none; box-sizing: border-box;
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
    border: 1px solid var(--yt-border); border-radius: 999px; background: var(--yt-bg);
    color: var(--yt-subtle); font-size: 0.85rem; font-weight: 500; cursor: pointer;
}
.mode-chip .i { width: 15px; height: 15px; }
.mode-chip:hover { border-color: var(--yt-accent); color: var(--yt-text); }
.mode-chip.active { background: var(--yt-accent-soft); border-color: var(--yt-accent); color: var(--yt-accent); }
.mode-spacer { flex: 1; }
.compare-toggle {
    appearance: none; -webkit-appearance: none; box-sizing: border-box;
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
    border: 1px solid var(--yt-border); border-radius: 999px; background: var(--yt-bg);
    color: var(--yt-subtle); font-size: 0.85rem; font-weight: 500; cursor: pointer;
}
.compare-toggle .i { width: 15px; height: 15px; }
.compare-toggle:hover { border-color: var(--yt-accent); color: var(--yt-text); }
.compare-toggle.on { background: var(--yt-accent); border-color: var(--yt-accent); color: #fff; }

/* Attachment tray (composer) */
.attach-tray { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.attach-chip { position: relative; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; border: 1px solid var(--yt-border); }
.attach-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-chip button {
    position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
    border: none; background: rgba(0,0,0,0.6); color: #fff; font-size: 13px; line-height: 1; cursor: pointer;
}
.attach-btn { flex-shrink: 0; }
.composer.drag { outline: 2px dashed var(--yt-accent); outline-offset: 4px; border-radius: 14px; }

/* Attachment thumbnails inside a sent message */
.msg-attachments { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.msg-thumb { max-width: 180px; max-height: 180px; border-radius: 10px; border: 1px solid var(--yt-border); }

/* Compare grid = queue strip + cards */
.compare-grid { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 12px 16px; }
.cmp-cards { flex: 1; display: grid; gap: 12px; overflow: auto; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }

/* Queue strip — chips for every model in the roster; click to toggle into view */
.cmp-strip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-bottom: 10px; }
.cmp-strip-label { font-size: 0.78rem; color: var(--yt-muted); margin-right: 4px; }
.cmp-tab {
    appearance: none; -webkit-appearance: none; box-sizing: border-box;
    display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px;
    border: 1px solid var(--yt-border); border-radius: 999px; background: var(--yt-bg);
    color: var(--yt-subtle); font-size: 0.8rem; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.cmp-tab:hover { border-color: var(--yt-accent); }
.cmp-tab.on { background: var(--yt-accent-soft); border-color: var(--yt-accent); color: var(--yt-accent); }
.cmp-tab.add, .cmp-tab.all { color: var(--yt-accent); font-weight: 600; }
.cmp-tab-x { font-size: 13px; opacity: 0.6; }
.cmp-tab-x:hover { opacity: 1; }
.cmp-pane { display: flex; flex-direction: column; border: 1px solid var(--yt-border); border-radius: 12px; background: var(--yt-bg); min-height: 0; overflow: hidden; }
.cmp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--yt-border-soft); background: var(--yt-bg-soft); }
.cmp-model { appearance: none; -webkit-appearance: none; box-sizing: border-box; display: inline-flex; align-items: center; gap: 5px; border: none; background: none; font-size: 0.85rem; font-weight: 600; color: var(--yt-text); cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.cmp-model:hover { background: var(--yt-bg-subtle); }
.cmp-model .caret { width: 13px; height: 13px; }
.cmp-remove { width: 24px; height: 24px; flex-shrink: 0; }
.cmp-body { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.cmp-msg { font-size: 0.92rem; line-height: 1.55; }
.cmp-msg.cmp-user { align-self: flex-end; background: var(--yt-bubble-user); padding: 7px 11px; border-radius: 12px; max-width: 90%; }
.cmp-msg.cmp-assistant { color: var(--yt-text); }
.cmp-add {
    appearance: none; -webkit-appearance: none; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    border: 1.5px dashed var(--yt-border); border-radius: 12px; background: var(--yt-bg-soft);
    color: var(--yt-muted); font-size: 0.85rem; font-weight: 500; cursor: pointer; min-height: 120px;
}
.cmp-add:hover { border-color: var(--yt-accent); color: var(--yt-accent); }

/* Media results */
.media-results { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.media-card { border: 1px solid var(--yt-border); border-radius: 12px; padding: 14px; background: var(--yt-bg); }
.media-prompt { font-weight: 600; margin-bottom: 4px; }
.media-meta { font-size: 0.8rem; color: var(--yt-muted); margin-bottom: 10px; }
.media-out img, .media-out video { max-width: 100%; border-radius: 10px; }
.media-out audio { width: 100%; }
.media-status { color: var(--yt-muted); font-size: 0.9rem; display: inline-flex; align-items: center; gap: 8px; }
.spin-sm, .spin { width: 14px; height: 14px; border: 2px solid var(--yt-border); border-top-color: var(--yt-accent); border-radius: 50%; animation: yt-spin 0.8s linear infinite; display: inline-block; }
@keyframes yt-spin { to { transform: rotate(360deg); } }

/* Inline model-access notice */
.access-notice {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin: 8px 2px 0; padding: 8px 12px; border-radius: 10px;
    background: #fef3c7; border: 1px solid #fde68a; color: #92400e; font-size: 0.85rem;
}
.access-notice .access-upgrade { font-weight: 700; color: #92400e; text-decoration: underline; }
.access-notice .access-switch { appearance: none; -webkit-appearance: none; border: none; background: none; color: #92400e; text-decoration: underline; cursor: pointer; font-size: 0.85rem; padding: 0; }

/* Mobile: sidebar becomes an off-canvas overlay so it never overflows */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 85vw;
        z-index: 60; transform: translateX(0); transition: transform 0.22s ease;
        box-shadow: 0 0 0 100vmax rgba(0,0,0,0.35);
    }
    .sidebar.collapsed { transform: translateX(-100%); width: 280px; box-shadow: none; }
    .compare-grid { grid-template-columns: 1fr; }
}
