/* ==========================================================================
   TechyChat UI
   A dark, glassy AI workspace that follows the Quick Tech Plus language used by
   Recent Events: deep canvas, soft blue/violet light, pill controls and crisp
   white type. Light theme is a first-class option, not an afterthought.
   ========================================================================== */

:root {
    color-scheme: dark;
    --tc-bg: #07080d;
    --tc-bg-soft: #0a0c13;
    --tc-panel: #0f121b;
    --tc-panel-2: #141824;
    --tc-panel-3: #1a1f2d;
    --tc-border: #252b3a;
    --tc-border-strong: #343c50;
    --tc-text: #eef1f8;
    --tc-muted: #9aa4b9;
    --tc-dim: #6b7488;
    --tc-faint: #4b5468;
    --tc-accent: #4d8dff;
    --tc-accent-2: #8b5cf6;
    --tc-accent-3: #22d3ee;
    --tc-accent-soft: rgba(77, 141, 255, .14);
    --tc-accent-glow: rgba(77, 141, 255, .28);
    --tc-green: #34d399;
    --tc-amber: #fbbf24;
    --tc-danger: #f87171;
    --tc-danger-soft: rgba(248, 113, 113, .12);
    --tc-user-bubble: linear-gradient(135deg, #2c62df 0%, #6d3eec 100%);
    --tc-input: #10131c;
    --tc-hover: rgba(255, 255, 255, .055);
    --tc-hover-strong: rgba(255, 255, 255, .09);
    --tc-glass: rgba(11, 14, 22, .82);
    --tc-code-bg: #0b0e16;
    --tc-scroll-thumb: #2b3243;
    --tc-shadow: 0 24px 70px rgba(0, 0, 0, .5);
    --tc-shadow-soft: 0 12px 34px rgba(0, 0, 0, .28);
    --tc-sidebar-w: 292px;
    --tc-radius: 18px;
    --tc-radius-sm: 12px;
    --tc-radius-lg: 26px;
    --tc-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --tc-display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --tc-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-tc-theme="light"] {
    color-scheme: light;
    --tc-bg: #f5f7fc;
    --tc-bg-soft: #eef2fa;
    --tc-panel: #ffffff;
    --tc-panel-2: #f6f8fd;
    --tc-panel-3: #eef2fa;
    --tc-border: #dde4f0;
    --tc-border-strong: #c6d0e2;
    --tc-text: #111827;
    --tc-muted: #5b667a;
    --tc-dim: #7b869b;
    --tc-faint: #77839a;
    --tc-accent: #2563eb;
    --tc-accent-2: #7c3aed;
    --tc-accent-3: #0891b2;
    --tc-accent-soft: rgba(37, 99, 235, .1);
    --tc-accent-glow: rgba(37, 99, 235, .2);
    --tc-user-bubble: linear-gradient(135deg, #2563eb 0%, #6d28d9 100%);
    --tc-input: #ffffff;
    --tc-hover: rgba(17, 24, 39, .045);
    --tc-hover-strong: rgba(17, 24, 39, .075);
    --tc-glass: rgba(255, 255, 255, .88);
    --tc-code-bg: #f2f5fb;
    --tc-scroll-thumb: #c7d1e2;
    --tc-shadow: 0 24px 70px rgba(30, 45, 80, .16);
    --tc-shadow-soft: 0 12px 34px rgba(30, 45, 80, .09);
    --tc-danger-soft: rgba(220, 38, 38, .08);
}

/* --------------------------------------------------------------------------
   Page + shell
   -------------------------------------------------------------------------- */

html, body.tc-page {
    height: 100%;
}

/* Keep the `hidden` attribute authoritative over component display rules. */
[hidden] {
    display: none !important;
}

body.tc-page {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: var(--tc-bg) !important;
    color: var(--tc-text);
    font-family: var(--tc-font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.tc-page *,
body.tc-page *::before,
body.tc-page *::after {
    box-sizing: border-box;
}

body.tc-page button,
body.tc-page input,
body.tc-page textarea,
body.tc-page select {
    font: inherit;
    color: inherit;
}

body.tc-page button {
    cursor: pointer;
}

body.tc-page a {
    color: inherit;
    text-decoration: none;
}

body.tc-page svg {
    max-width: 100%;
}

.tc-shell {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    background: var(--tc-bg);
    overflow: hidden;
}

body.tc-has-site-header .tc-shell {
    left: 76px;
}

body.tc-standalone .tc-shell {
    left: 0;
}

.tc-main {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    background:
        radial-gradient(900px 500px at 18% -8%, rgba(77, 141, 255, .13), transparent 60%),
        radial-gradient(760px 460px at 92% 4%, rgba(139, 92, 246, .1), transparent 62%),
        var(--tc-bg);
    overflow: hidden;
}

html[data-tc-theme="light"] .tc-main {
    background:
        radial-gradient(900px 500px at 18% -8%, rgba(37, 99, 235, .09), transparent 60%),
        radial-gradient(760px 460px at 92% 4%, rgba(124, 58, 237, .07), transparent 62%),
        var(--tc-bg);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

.tc-sidebar {
    position: relative;
    flex: 0 0 var(--tc-sidebar-w);
    width: var(--tc-sidebar-w);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 14px 14px;
    background: color-mix(in srgb, var(--tc-panel) 82%, transparent);
    border-right: 1px solid var(--tc-border);
    backdrop-filter: blur(22px);
    z-index: 5;
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .tc-sidebar {
        background: var(--tc-panel);
    }
}

.tc-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 4px 6px;
}

.tc-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.tc-brand-orb {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 13px;
    background: linear-gradient(140deg, var(--tc-accent), var(--tc-accent-2) 68%, #ec4899);
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 10px 24px rgba(77, 141, 255, .32);
}

.tc-brand-orb.large {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
    border-radius: 18px;
    font-size: 1.35rem;
}

.tc-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tc-brand-text strong {
    font-family: var(--tc-display);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.tc-brand-text small {
    color: var(--tc-dim);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.tc-sidebar-close {
    display: none !important;
}

.tc-new-chat {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(77, 141, 255, .22), rgba(139, 92, 246, .17));
    color: var(--tc-text);
    font-weight: 700;
    font-size: .9rem;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

html[data-tc-theme="light"] .tc-new-chat {
    border-color: rgba(37, 99, 235, .18);
    background: linear-gradient(135deg, rgba(37, 99, 235, .12), rgba(124, 58, 237, .1));
}

.tc-new-chat:hover {
    transform: translateY(-1px);
    border-color: var(--tc-accent);
    background: linear-gradient(135deg, rgba(77, 141, 255, .3), rgba(139, 92, 246, .22));
}

.tc-new-chat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .14);
    font-size: .75rem;
}

.tc-new-chat kbd {
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid var(--tc-border-strong);
    background: rgba(0, 0, 0, .18);
    color: var(--tc-dim);
    font-family: var(--tc-font);
    font-size: .64rem;
    font-weight: 600;
}

.tc-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tc-nav button {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--tc-muted);
    text-align: left;
    font-size: .88rem;
    font-weight: 600;
    transition: background .16s ease, color .16s ease;
}

.tc-nav button i {
    width: 18px;
    text-align: center;
    font-size: .92rem;
    color: var(--tc-dim);
    transition: color .16s ease;
}

.tc-nav button:hover {
    background: var(--tc-hover);
    color: var(--tc-text);
}

.tc-nav button.active {
    background: var(--tc-accent-soft);
    color: var(--tc-text);
}

.tc-nav button.active i {
    color: var(--tc-accent);
}

.tc-nav-count {
    margin-left: auto;
    min-width: 24px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--tc-hover);
    color: var(--tc-dim);
    font-size: .66rem;
    font-weight: 700;
    text-align: center;
}

.tc-nav button.active .tc-nav-count {
    background: rgba(77, 141, 255, .18);
    color: var(--tc-accent);
}

.tc-search {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 2px;
    padding: 0 11px;
    min-height: 38px;
    border: 1px solid var(--tc-border);
    border-radius: 11px;
    background: var(--tc-panel-2);
    transition: border-color .16s ease, box-shadow .16s ease;
}

.tc-search:focus-within {
    border-color: var(--tc-accent);
    box-shadow: 0 0 0 3px var(--tc-accent-soft);
}

.tc-search i {
    color: var(--tc-dim);
    font-size: .78rem;
}

.tc-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: .84rem;
}

.tc-search input::placeholder {
    color: var(--tc-faint);
}

.tc-search button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: var(--tc-hover);
    color: var(--tc-muted);
    font-size: .65rem;
}

.tc-chat-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0 -6px;
    padding: 2px 6px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--tc-scroll-thumb) transparent;
}

.tc-chat-list::-webkit-scrollbar {
    width: 6px;
}

.tc-chat-list::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: var(--tc-scroll-thumb);
}

.tc-group-label {
    margin: 14px 8px 6px;
    color: var(--tc-faint);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.tc-group-label:first-child {
    margin-top: 4px;
}

.tc-chat-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
    border-radius: 11px;
    transition: background .14s ease;
}

.tc-chat-item:hover,
.tc-chat-item.menu-open {
    background: var(--tc-hover);
}

.tc-chat-item.active {
    background: linear-gradient(90deg, rgba(77, 141, 255, .16), rgba(139, 92, 246, .08));
    box-shadow: inset 2px 0 0 var(--tc-accent);
}

.tc-chat-item-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px 8px 11px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    text-align: left;
}

.tc-chat-item-title {
    overflow: hidden;
    color: var(--tc-muted);
    font-size: .84rem;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-chat-item.active .tc-chat-item-title {
    color: var(--tc-text);
    font-weight: 700;
}

.tc-chat-item-meta {
    overflow: hidden;
    color: var(--tc-faint);
    font-size: .68rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-chat-item-meta i {
    margin-right: 3px;
    font-size: .6rem;
}

.tc-chat-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    padding-right: 4px;
    opacity: 0;
    transition: opacity .14s ease;
}

.tc-chat-item:hover .tc-chat-actions,
.tc-chat-item.active .tc-chat-actions,
.tc-chat-item.menu-open .tc-chat-actions {
    opacity: 1;
}

.tc-chat-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--tc-dim);
    font-size: .67rem;
}

.tc-chat-actions button:hover {
    background: var(--tc-hover-strong);
    color: var(--tc-text);
}

.tc-chat-actions button.is-pinned {
    color: var(--tc-amber);
}

.tc-pin-badge {
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tc-amber);
    font-size: .54rem;
}

.tc-empty-list {
    padding: 30px 16px;
    color: var(--tc-faint);
    text-align: center;
    font-size: .8rem;
    line-height: 1.6;
}

.tc-empty-list i {
    display: block;
    margin-bottom: 10px;
    font-size: 1.4rem;
    opacity: .5;
}

.tc-skeleton {
    height: 46px;
    margin: 0 4px 6px;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--tc-panel-2) 20%, var(--tc-panel-3) 40%, var(--tc-panel-2) 60%);
    background-size: 220% 100%;
    animation: tc-shimmer 1.5s infinite linear;
}

.tc-skeleton.short {
    height: 38px;
    width: 82%;
}

@keyframes tc-shimmer {
    to { background-position: -220% 0; }
}

/* sidebar footer */

.tc-side-foot {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding-top: 10px;
    border-top: 1px solid var(--tc-border);
}

.tc-provider-card {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--tc-border);
    border-radius: 12px;
    background: var(--tc-panel-2);
    text-align: left;
    transition: border-color .16s ease, background .16s ease;
}

.tc-provider-card:hover {
    border-color: var(--tc-border-strong);
    background: var(--tc-panel-3);
}

.tc-provider-dot,
.tc-model-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    border-radius: 9px;
    background: linear-gradient(140deg, var(--tc-accent), var(--tc-accent-2));
    color: #fff;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.tc-provider-copy {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
}

.tc-provider-copy strong {
    overflow: hidden;
    font-size: .78rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-provider-copy small {
    overflow: hidden;
    color: var(--tc-dim);
    font-size: .66rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-provider-card > i {
    color: var(--tc-faint);
    font-size: .62rem;
}

.tc-account {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    text-align: left;
    transition: background .16s ease;
}

.tc-account:hover {
    background: var(--tc-hover);
}

.tc-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 50%;
    background: linear-gradient(140deg, #1d9bf0, #7c3aed);
    color: #fff;
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.tc-account-copy {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
}

.tc-account-copy strong {
    overflow: hidden;
    font-size: .78rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-account-copy small {
    color: var(--tc-dim);
    font-size: .66rem;
}

.tc-account > i {
    color: var(--tc-faint);
    font-size: .72rem;
}

.tc-foot-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 4px 8px 0;
}

.tc-foot-links a {
    color: var(--tc-faint);
    font-size: .66rem;
    font-weight: 600;
}

.tc-foot-links a:hover {
    color: var(--tc-accent);
}

.tc-scrim {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(3, 5, 10, .62);
    backdrop-filter: blur(2px);
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.tc-topbar {
    position: relative;
    flex: 0 0 auto;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    height: 64px;
    padding: 0 20px;
    border-bottom: 1px solid var(--tc-border);
    background: linear-gradient(180deg, rgba(10, 13, 21, .7), rgba(10, 13, 21, .35));
    backdrop-filter: blur(18px);
}

html[data-tc-theme="light"] .tc-topbar {
    background: linear-gradient(180deg, rgba(255, 255, 255, .8), rgba(255, 255, 255, .5));
}

.tc-topbar-left,
.tc-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.tc-topbar-left {
    flex: 1 1 auto;
}

.tc-menu-btn {
    display: none !important;
}

.tc-title-wrap {
    min-width: 0;
}

.tc-title-wrap h1 {
    overflow: hidden;
    margin: 0;
    font-family: var(--tc-display);
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: -.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-title-wrap p {
    overflow: hidden;
    margin: 1px 0 0;
    color: var(--tc-dim);
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--tc-muted);
    font-size: .84rem;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.tc-icon-btn:hover:not(:disabled) {
    background: var(--tc-hover);
    color: var(--tc-text);
}

.tc-icon-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.tc-icon-btn.small {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    font-size: .7rem;
}

.tc-model-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: 260px;
    padding: 5px 10px 5px 6px;
    border: 1px solid var(--tc-border);
    border-radius: 12px;
    background: var(--tc-panel-2);
    text-align: left;
    transition: border-color .16s ease, background .16s ease;
}

.tc-model-pill:hover {
    border-color: var(--tc-border-strong);
    background: var(--tc-panel-3);
}

.tc-model-badge {
    width: 27px;
    height: 27px;
    flex-basis: 27px;
    border-radius: 8px;
    font-size: .62rem;
}

.tc-model-pill-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tc-model-pill-copy strong {
    overflow: hidden;
    max-width: 170px;
    font-size: .74rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-model-pill-copy small {
    overflow: hidden;
    max-width: 170px;
    color: var(--tc-dim);
    font-size: .62rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-model-pill > i {
    color: var(--tc-faint);
    font-size: .58rem;
}

/* --------------------------------------------------------------------------
   Scroll + views
   -------------------------------------------------------------------------- */

.tc-scroll {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--tc-scroll-thumb) transparent;
    scroll-behavior: smooth;
}

.tc-scroll::-webkit-scrollbar {
    width: 8px;
}

.tc-scroll::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: var(--tc-scroll-thumb);
}

.tc-view {
    width: 100%;
}

.tc-chat-view {
    max-width: 880px;
    margin: 0 auto;
    padding: 40px 26px 210px;
}

.tc-page-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 42px 34px 90px;
}

/* welcome */

.tc-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 34px 0 18px;
    text-align: center;
    animation: tc-fade-up .5s ease both;
}

.tc-welcome[hidden] {
    display: none;
}

.tc-welcome-orb {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 92px;
    height: 92px;
    margin-bottom: 22px;
}

.tc-orb-core {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 66px;
    height: 66px;
    border-radius: 22px;
    background: linear-gradient(145deg, var(--tc-accent), var(--tc-accent-2) 65%, #ec4899);
    color: #fff;
    font-size: 1.5rem;
    box-shadow: 0 18px 46px var(--tc-accent-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
    animation: tc-float 5s ease-in-out infinite;
}

.tc-orb-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(77, 141, 255, .28);
    box-shadow: 0 0 50px rgba(77, 141, 255, .2);
    animation: tc-ring 6s ease-in-out infinite;
}

@keyframes tc-float {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-7px) rotate(2deg); }
}

@keyframes tc-ring {
    0%, 100% { transform: scale(1); opacity: .8; }
    50% { transform: scale(1.14); opacity: .35; }
}

@keyframes tc-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.tc-kicker {
    margin: 0 0 8px;
    color: var(--tc-accent);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.tc-welcome h2,
.tc-page-hero h2,
.tc-detail-head h2 {
    margin: 0;
    font-family: var(--tc-display);
    font-size: clamp(1.6rem, 2.8vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -.035em;
    line-height: 1.12;
}

.tc-welcome h2 em {
    font-style: normal;
    background: linear-gradient(100deg, var(--tc-accent), var(--tc-accent-2) 55%, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tc-welcome-sub {
    max-width: 600px;
    margin: 12px 0 0;
    color: var(--tc-muted);
    font-size: .92rem;
    line-height: 1.65;
}

.tc-welcome-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 760px;
    margin-top: 28px;
    text-align: left;
}

.tc-suggest-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 15px;
    border: 1px solid var(--tc-border);
    border-radius: 14px;
    background: linear-gradient(160deg, var(--tc-panel-2), var(--tc-panel));
    text-align: left;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.tc-suggest-card:hover {
    transform: translateY(-2px);
    border-color: var(--tc-border-strong);
    box-shadow: var(--tc-shadow-soft);
}

.tc-suggest-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 11px;
    background: var(--tc-accent-soft);
    color: var(--tc-accent);
    font-size: .92rem;
}

.tc-suggest-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tc-suggest-copy strong {
    font-size: .84rem;
    font-weight: 700;
}

.tc-suggest-copy span {
    color: var(--tc-dim);
    font-size: .73rem;
    line-height: 1.45;
}

.tc-welcome-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
    color: var(--tc-faint);
    font-size: .7rem;
}

.tc-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border: 1px solid var(--tc-border);
    border-radius: 999px;
    background: var(--tc-panel-2);
    color: var(--tc-muted);
    font-size: .68rem;
    font-weight: 600;
}

.tc-status-pill i {
    color: var(--tc-green);
    font-size: .55rem;
}

.tc-status-pill.warn i {
    color: var(--tc-amber);
}

.tc-status-pill button {
    border: 0;
    background: transparent;
    color: var(--tc-accent);
    font-size: inherit;
    font-weight: 700;
    padding: 0;
}

/* --------------------------------------------------------------------------
   Messages
   -------------------------------------------------------------------------- */

.tc-thread {
    display: flex;
    flex-direction: column;
    gap: 26px;
    margin-top: 12px;
}

.tc-thread:empty {
    display: none;
}

.tc-msg {
    display: flex;
    gap: 13px;
    animation: tc-fade-up .3s ease both;
}

.tc-msg.user {
    flex-direction: row-reverse;
    gap: 0;
}

.tc-msg-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    margin-top: 2px;
    border-radius: 10px;
    background: linear-gradient(145deg, var(--tc-accent), var(--tc-accent-2));
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(77, 141, 255, .22);
}

.tc-msg.user .tc-msg-avatar {
    display: none;
}

.tc-msg-body {
    min-width: 0;
    max-width: calc(100% - 44px);
}

.tc-msg.user .tc-msg-body {
    max-width: min(78%, 620px);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.tc-msg-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 5px;
}

.tc-msg.user .tc-msg-head {
    flex-direction: row-reverse;
}

.tc-msg-name {
    color: var(--tc-text);
    font-size: .76rem;
    font-weight: 750;
}

.tc-msg-time {
    color: var(--tc-faint);
    font-size: .65rem;
}

.tc-msg-bubble {
    position: relative;
    border-radius: 16px;
    background: var(--tc-panel-2);
    border: 1px solid var(--tc-border);
}

.tc-msg.user .tc-msg-bubble {
    border: 0;
    background: var(--tc-user-bubble);
    color: #fff;
    box-shadow: 0 10px 28px rgba(60, 80, 220, .2);
}

.tc-msg-content {
    padding: 14px 16px;
    color: var(--tc-text);
    font-size: .92rem;
    line-height: 1.68;
    overflow-wrap: anywhere;
}

.tc-msg.user .tc-msg-content {
    color: #fff;
    white-space: pre-wrap;
}

.tc-msg.assistant .tc-msg-content {
    padding: 0;
}

.tc-msg.assistant .tc-msg-bubble {
    border: 0;
    background: transparent;
}

.tc-msg.assistant .tc-msg-content {
    padding: 2px 0;
}

.tc-msg.pending .tc-msg-content {
    opacity: .92;
}

.tc-msg.error .tc-msg-bubble {
    border-color: rgba(248, 113, 113, .35);
}

.tc-msg-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity .14s ease;
}

.tc-msg:hover .tc-msg-actions,
.tc-msg:focus-within .tc-msg-actions,
.tc-msg.user .tc-msg-actions {
    opacity: 1;
}

.tc-msg.user .tc-msg-actions {
    justify-content: flex-end;
}

.tc-msg-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 7px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--tc-faint);
    font-size: .66rem;
    font-weight: 600;
    transition: background .14s ease, color .14s ease;
}

.tc-msg-action:hover {
    background: var(--tc-hover);
    color: var(--tc-text);
}

.tc-msg-action.danger:hover {
    background: var(--tc-danger-soft);
    color: var(--tc-danger);
}

.tc-msg-action i {
    font-size: .65rem;
}

.tc-reasoning {
    margin: 0 0 12px;
    padding: 9px 12px;
    border: 1px solid var(--tc-border);
    border-radius: 10px;
    background: var(--tc-panel-2);
    color: var(--tc-muted);
    font-size: .78rem;
    line-height: 1.6;
}

.tc-reasoning summary {
    cursor: pointer;
    color: var(--tc-dim);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.tc-reasoning[open] summary {
    margin-bottom: 8px;
}

.tc-stream-cursor {
    display: inline-block;
    width: 7px;
    height: 15px;
    margin-left: 2px;
    border-radius: 2px;
    background: var(--tc-accent);
    vertical-align: -2px;
    animation: tc-blink 1s steps(2) infinite;
}

@keyframes tc-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.tc-thinking {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: var(--tc-muted);
    font-size: .82rem;
}

.tc-thinking-dots {
    display: inline-flex;
    gap: 4px;
}

.tc-thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tc-accent);
    animation: tc-bounce 1.2s infinite ease-in-out;
}

.tc-thinking-dots span:nth-child(2) { animation-delay: .15s; }
.tc-thinking-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes tc-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .45; }
    30% { transform: translateY(-5px); opacity: 1; }
}

.tc-error-banner {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 10px;
    padding: 11px 13px;
    border: 1px solid rgba(248, 113, 113, .3);
    border-radius: 11px;
    background: var(--tc-danger-soft);
    color: #fecaca;
    font-size: .78rem;
    line-height: 1.5;
}

html[data-tc-theme="light"] .tc-error-banner {
    color: #b91c1c;
}

.tc-error-banner i {
    margin-top: 2px;
    color: var(--tc-danger);
}

.tc-error-banner button {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--tc-accent);
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}

/* attachments in messages */

.tc-attachment-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 0 10px;
}

.tc-msg.user .tc-attachment-grid {
    padding: 12px 14px 0;
    justify-content: flex-end;
}

.tc-attach-image {
    display: block;
    max-width: 220px;
    max-height: 180px;
    border-radius: 10px;
    border: 1px solid var(--tc-border);
    object-fit: cover;
}

.tc-attach-file {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--tc-border);
    border-radius: 9px;
    background: var(--tc-panel-2);
    color: var(--tc-muted);
    font-size: .72rem;
}

.tc-msg.user .tc-attach-file {
    border-color: rgba(255, 255, 255, .22);
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.tc-attach-file span {
    overflow: hidden;
    max-width: 190px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* markdown */

.tc-md {
    font-size: .92rem;
    line-height: 1.7;
}

.tc-md > :first-child { margin-top: 0 !important; }
.tc-md > :last-child { margin-bottom: 0 !important; }

.tc-md h1,
.tc-md h2,
.tc-md h3,
.tc-md h4,
.tc-md h5 {
    margin: 1.3em 0 .5em;
    color: var(--tc-text);
    font-family: var(--tc-display);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.25;
}

.tc-md h1 { font-size: 1.5rem; }
.tc-md h2 { font-size: 1.26rem; }
.tc-md h3 { font-size: 1.08rem; }
.tc-md h4 { font-size: .98rem; }
.tc-md h5 { font-size: .92rem; }

.tc-md p {
    margin: .7em 0;
}

.tc-md strong {
    color: var(--tc-text);
    font-weight: 700;
}

.tc-md em {
    color: var(--tc-text);
}

.tc-md a {
    color: var(--tc-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tc-md ul,
.tc-md ol {
    margin: .7em 0;
    padding-left: 1.35em;
}

.tc-md li {
    margin: .28em 0;
}

.tc-md li::marker {
    color: var(--tc-accent);
}

.tc-md blockquote {
    margin: 1em 0;
    padding: 2px 0 2px 14px;
    border-left: 3px solid var(--tc-accent);
    color: var(--tc-muted);
}

.tc-md hr {
    margin: 1.4em 0;
    border: 0;
    border-top: 1px solid var(--tc-border);
}

.tc-md :not(pre) > code {
    padding: 2px 5px;
    border: 1px solid var(--tc-border);
    border-radius: 5px;
    background: var(--tc-panel-3);
    color: #c7d7ff;
    font-family: var(--tc-mono);
    font-size: .85em;
}

html[data-tc-theme="light"] .tc-md :not(pre) > code {
    color: #1d4ed8;
}

.tc-md pre {
    position: relative;
    overflow: hidden;
    margin: 1em 0;
    border: 1px solid var(--tc-border);
    border-radius: 13px;
    background: var(--tc-code-bg);
}

.tc-md pre code {
    display: block;
    overflow-x: auto;
    padding: 16px 16px 14px;
    color: #d7def0;
    font-family: var(--tc-mono);
    font-size: .79rem;
    line-height: 1.65;
    scrollbar-width: thin;
}

html[data-tc-theme="light"] .tc-md pre code {
    color: #1f2937;
}

.tc-code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 10px 7px 13px;
    border-bottom: 1px solid var(--tc-border);
    background: var(--tc-panel-2);
    color: var(--tc-dim);
    font-family: var(--tc-mono);
    font-size: .66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.tc-code-copy {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--tc-muted);
    font-family: var(--tc-font);
    font-size: .64rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.tc-code-copy:hover {
    background: var(--tc-hover);
    color: var(--tc-text);
}

.tc-md table {
    width: 100%;
    margin: 1em 0;
    border-collapse: collapse;
    font-size: .82rem;
}

.tc-md th,
.tc-md td {
    padding: 8px 10px;
    border: 1px solid var(--tc-border);
    text-align: left;
}

.tc-md th {
    background: var(--tc-panel-2);
    font-weight: 700;
}

.tc-md img {
    max-width: 100%;
    border-radius: 10px;
}

.tc-md .tc-table-wrap {
    overflow-x: auto;
}

/* --------------------------------------------------------------------------
   Composer
   -------------------------------------------------------------------------- */

.tc-composer-wrap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 18;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 24px calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent 0%, rgba(7, 8, 13, .72) 26%, var(--tc-bg) 80%);
    pointer-events: none;
}

html[data-tc-theme="light"] .tc-composer-wrap {
    background: linear-gradient(180deg, transparent 0%, rgba(245, 247, 252, .75) 26%, var(--tc-bg) 80%);
}

.tc-composer-wrap > * {
    pointer-events: auto;
}

.tc-context-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    max-width: 860px;
    padding: 7px 9px 7px 10px;
    border: 1px solid var(--tc-border);
    border-radius: 13px;
    background: var(--tc-glass);
    backdrop-filter: blur(16px);
    box-shadow: var(--tc-shadow-soft);
}

.tc-context-bar[hidden] {
    display: none;
}

.tc-context-main {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.tc-context-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 8px;
    background: var(--tc-panel-3);
    font-size: .9rem;
}

.tc-context-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tc-context-copy strong {
    overflow: hidden;
    font-size: .74rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-context-copy small {
    overflow: hidden;
    color: var(--tc-dim);
    font-size: .64rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-context-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.tc-composer {
    width: 100%;
    max-width: 860px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tc-composer-box {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--tc-border);
    border-radius: 19px;
    background: var(--tc-composer, var(--tc-panel));
    box-shadow: 0 18px 44px rgba(0, 0, 0, .24);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.tc-composer-box:focus-within {
    border-color: rgba(77, 141, 255, .55);
    box-shadow: 0 0 0 3px var(--tc-accent-soft), 0 20px 50px rgba(0, 0, 0, .3);
}

html[data-tc-theme="light"] .tc-composer-box {
    background: var(--tc-panel);
    box-shadow: 0 16px 38px rgba(30, 45, 80, .1);
}

.tc-attach-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 10px 12px 0;
}

.tc-attach-strip[hidden] {
    display: none;
}

.tc-attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 220px;
    padding: 5px 6px 5px 8px;
    border: 1px solid var(--tc-border);
    border-radius: 9px;
    background: var(--tc-panel-2);
    color: var(--tc-muted);
    font-size: .7rem;
}

.tc-attach-chip img {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    object-fit: cover;
}

.tc-attach-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-attach-chip button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border: 0;
    border-radius: 50%;
    background: var(--tc-hover);
    color: var(--tc-dim);
    font-size: .55rem;
}

#composerInput {
    width: 100%;
    min-height: 52px;
    max-height: 220px;
    padding: 14px 15px 5px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--tc-text);
    font-size: .93rem;
    line-height: 1.55;
    resize: none;
    scrollbar-width: thin;
}

#composerInput::placeholder {
    color: var(--tc-faint);
}

.tc-composer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 8px 8px;
}

.tc-toolbar-left,
.tc-toolbar-right {
    display: flex;
    align-items: center;
    gap: 3px;
}

.tc-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 31px;
    height: 31px;
    padding: 0 7px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tc-dim);
    font-size: .78rem;
    transition: background .14s ease, color .14s ease;
}

.tc-tool-btn span {
    font-size: .68rem;
    font-weight: 650;
}

.tc-tool-btn:hover {
    background: var(--tc-hover);
    color: var(--tc-text);
}

.tc-tool-btn.active,
.tc-tool-btn[aria-pressed="true"] {
    background: var(--tc-accent-soft);
    color: var(--tc-accent);
}

.tc-tool-btn.recording {
    background: var(--tc-danger-soft);
    color: var(--tc-danger);
    animation: tc-pulse 1.4s infinite;
}

@keyframes tc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, .25); }
    50% { box-shadow: 0 0 0 7px rgba(248, 113, 113, 0); }
}

.tc-char-hint {
    color: var(--tc-faint);
    font-size: .63rem;
    font-weight: 600;
}

.tc-send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--tc-accent), var(--tc-accent-2));
    color: #fff;
    font-size: .84rem;
    transition: transform .16s ease, opacity .16s ease, box-shadow .16s ease;
    box-shadow: 0 7px 16px rgba(77, 141, 255, .3);
}

.tc-send-btn:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.03);
}

.tc-send-btn:disabled {
    opacity: .38;
    cursor: not-allowed;
    box-shadow: none;
}

.tc-send-btn.stop {
    background: linear-gradient(140deg, #ef4444, #b91c1c);
    box-shadow: 0 7px 16px rgba(239, 68, 68, .25);
}

.tc-composer-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 14px;
    padding: 0 6px;
    color: var(--tc-faint);
    font-size: .63rem;
}

#composerStatus {
    color: var(--tc-dim);
}

/* jump to latest */

.tc-jump-latest {
    position: absolute;
    left: 50%;
    bottom: 128px;
    transform: translateX(-50%);
    z-index: 22;
}

.tc-jump-latest button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--tc-border);
    border-radius: 999px;
    background: var(--tc-glass);
    color: var(--tc-muted);
    font-size: .7rem;
    font-weight: 650;
    backdrop-filter: blur(12px);
    box-shadow: var(--tc-shadow-soft);
}

.tc-jump-latest button:hover {
    color: var(--tc-text);
    border-color: var(--tc-border-strong);
}

/* --------------------------------------------------------------------------
   Shared controls
   -------------------------------------------------------------------------- */

.tc-primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--tc-accent), #6d4df0);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 9px 22px rgba(77, 141, 255, .22);
    transition: transform .16s ease, opacity .16s ease, filter .16s ease;
}

.tc-primary-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.tc-primary-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.tc-ghost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 12px;
    border: 1px solid var(--tc-border);
    border-radius: 10px;
    background: var(--tc-panel-2);
    color: var(--tc-muted);
    font-size: .76rem;
    font-weight: 650;
    white-space: nowrap;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.tc-ghost-btn:hover {
    background: var(--tc-panel-3);
    border-color: var(--tc-border-strong);
    color: var(--tc-text);
}

.tc-ghost-btn.danger,
.tc-danger-btn {
    color: var(--tc-danger);
}

.tc-ghost-btn.danger:hover {
    border-color: rgba(248, 113, 113, .4);
    background: var(--tc-danger-soft);
}

.tc-danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
}

.tc-small-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 9px;
    border: 1px solid var(--tc-border);
    border-radius: 8px;
    background: var(--tc-panel-2);
    color: var(--tc-muted);
    font-size: .7rem;
    font-weight: 650;
    white-space: nowrap;
    transition: background .14s ease, color .14s ease, border-color .14s ease;
}

.tc-small-btn:hover {
    background: var(--tc-panel-3);
    border-color: var(--tc-border-strong);
    color: var(--tc-text);
}

.tc-text-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 2px;
    border: 0;
    background: transparent;
    color: var(--tc-accent);
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}

.tc-text-btn:hover {
    color: var(--tc-text);
}

.tc-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--tc-dim);
    font-size: .74rem;
    font-weight: 650;
}

.tc-back-btn:hover {
    color: var(--tc-text);
}

.tc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.tc-field > span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--tc-muted);
    font-size: .71rem;
    font-weight: 700;
}

.tc-field > span small,
.tc-field > span em {
    color: var(--tc-faint);
    font-size: .64rem;
    font-style: normal;
    font-weight: 600;
}

.tc-field input[type="text"],
.tc-field input[type="url"],
.tc-field input[type="password"],
.tc-field input[type="search"],
.tc-field textarea,
.tc-field select,
.tc-inline-field input,
.tc-share-field input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--tc-border);
    border-radius: 10px;
    outline: 0;
    background: var(--tc-input);
    color: var(--tc-text);
    font-size: .82rem;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.tc-field textarea {
    min-height: 88px;
    resize: vertical;
    line-height: 1.55;
}

.tc-field input:focus,
.tc-field textarea:focus,
.tc-field select:focus,
.tc-inline-field input:focus,
.tc-share-field input:focus {
    border-color: var(--tc-accent);
    box-shadow: 0 0 0 3px var(--tc-accent-soft);
}

.tc-field input::placeholder,
.tc-field textarea::placeholder {
    color: var(--tc-faint);
}

.tc-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa4b9' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}

.tc-field-hint {
    color: var(--tc-faint);
    font-size: .66rem;
    line-height: 1.45;
}

.tc-inline-field {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.tc-inline-field input {
    flex: 1 1 auto;
}

.tc-inline-field .tc-small-btn {
    width: 40px;
    flex: 0 0 40px;
    padding: 0;
}

/* --------------------------------------------------------------------------
   Popovers
   -------------------------------------------------------------------------- */

.tc-popover {
    position: fixed;
    z-index: 1200;
    border: 1px solid var(--tc-border-strong);
    border-radius: 16px;
    background: var(--tc-glass);
    backdrop-filter: blur(24px);
    box-shadow: var(--tc-shadow);
    overflow: hidden;
    animation: tc-pop .16s ease both;
}

@keyframes tc-pop {
    from { opacity: 0; transform: translateY(-5px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.tc-popover[hidden] {
    display: none !important;
}

.tc-model-popover {
    width: min(430px, calc(100vw - 24px));
}

.tc-quick-popover {
    width: min(380px, calc(100vw - 24px));
}

.tc-popover-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 14px 9px;
    border-bottom: 1px solid var(--tc-border);
}

.tc-popover-head strong {
    display: block;
    font-family: var(--tc-display);
    font-size: .9rem;
    font-weight: 700;
}

.tc-popover-head small {
    display: block;
    margin-top: 2px;
    color: var(--tc-dim);
    font-size: .67rem;
    line-height: 1.4;
}

.tc-popover-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 9px 12px 4px;
    padding: 0 10px;
    height: 34px;
    border: 1px solid var(--tc-border);
    border-radius: 9px;
    background: var(--tc-panel-2);
}

.tc-popover-search i {
    color: var(--tc-dim);
    font-size: .7rem;
}

.tc-popover-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: .78rem;
}

.tc-model-list {
    max-height: min(56vh, 470px);
    overflow-y: auto;
    padding: 6px 8px 8px;
    scrollbar-width: thin;
}

.tc-model-group {
    margin-bottom: 4px;
}

.tc-model-group-title {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 8px 5px;
    color: var(--tc-faint);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.tc-model-group-title span.tc-mini-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    color: #fff;
    font-size: .52rem;
    font-weight: 800;
    letter-spacing: 0;
}

.tc-model-row {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    text-align: left;
    transition: background .13s ease;
}

.tc-model-row:hover {
    background: var(--tc-hover);
}

.tc-model-row.active {
    background: var(--tc-accent-soft);
}

.tc-model-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 8px;
    color: #fff;
    font-size: .58rem;
    font-weight: 800;
}

.tc-model-info {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
}

.tc-model-info strong {
    overflow: hidden;
    font-size: .78rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-model-info small {
    overflow: hidden;
    color: var(--tc-dim);
    font-size: .64rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-model-status {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--tc-danger-soft);
    color: var(--tc-danger);
    font-size: .58rem;
    font-weight: 750;
}

.tc-model-status.ready {
    background: rgba(52, 211, 153, .13);
    color: var(--tc-green);
}

.tc-model-row > i.fa-check {
    color: var(--tc-accent);
    font-size: .7rem;
}

.tc-popover-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 13px;
    border-top: 1px solid var(--tc-border);
    background: var(--tc-panel-2);
}

.tc-popover-foot span {
    color: var(--tc-faint);
    font-size: .62rem;
}

.tc-quick-list {
    max-height: min(54vh, 430px);
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
}

.tc-quick-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    width: 100%;
    padding: 9px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    text-align: left;
    transition: background .13s ease;
}

.tc-quick-item:hover {
    background: var(--tc-hover);
}

.tc-quick-item i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    border-radius: 8px;
    background: var(--tc-accent-soft);
    color: var(--tc-accent);
    font-size: .7rem;
}

.tc-quick-item span {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tc-quick-item strong {
    overflow: hidden;
    font-size: .76rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-quick-item small {
    overflow: hidden;
    color: var(--tc-dim);
    font-size: .64rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-quick-empty {
    padding: 20px 12px;
    color: var(--tc-faint);
    text-align: center;
    font-size: .74rem;
}

.tc-item-menu {
    width: 190px;
    padding: 5px;
    border-radius: 12px;
}

.tc-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--tc-muted);
    text-align: left;
    font-size: .74rem;
    font-weight: 600;
}

.tc-menu-item i {
    width: 15px;
    color: var(--tc-dim);
    font-size: .7rem;
    text-align: center;
}

.tc-menu-item:hover {
    background: var(--tc-hover);
    color: var(--tc-text);
}

.tc-menu-item:hover i {
    color: var(--tc-text);
}

.tc-menu-item.danger {
    color: var(--tc-danger);
}

.tc-menu-item.danger i {
    color: var(--tc-danger);
}

.tc-menu-sep {
    margin: 4px 6px;
    border-top: 1px solid var(--tc-border);
}

/* --------------------------------------------------------------------------
   Notebooks + prompts views
   -------------------------------------------------------------------------- */

.tc-page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 28px;
}

.tc-page-hero p:not(.tc-kicker) {
    max-width: 640px;
    margin: 9px 0 0;
    color: var(--tc-muted);
    font-size: .86rem;
    line-height: 1.65;
}

.tc-notebook-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.tc-notebook-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 208px;
    padding: 17px;
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius);
    background: linear-gradient(160deg, var(--tc-panel-2), var(--tc-panel));
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.tc-notebook-card:hover {
    transform: translateY(-3px);
    border-color: var(--tc-border-strong);
    box-shadow: var(--tc-shadow-soft);
}

.tc-notebook-cover {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
    border-radius: 13px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--nb-color, #4d8dff) 30%, transparent), transparent);
    border: 1px solid color-mix(in srgb, var(--nb-color, #4d8dff) 40%, transparent);
    font-size: 1.25rem;
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .tc-notebook-cover {
        border-color: var(--tc-border);
        background: var(--tc-panel-3);
    }
}

.tc-notebook-card h3 {
    margin: 0;
    overflow: hidden;
    font-family: var(--tc-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-notebook-card p {
    display: -webkit-box;
    overflow: hidden;
    margin: 7px 0 14px;
    color: var(--tc-dim);
    font-size: .76rem;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.tc-notebook-card-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--tc-border);
    color: var(--tc-faint);
    font-size: .64rem;
    font-weight: 600;
}

.tc-notebook-card-foot span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tc-notebook-card-foot i {
    font-size: .62rem;
}

.tc-card-menu {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tc-faint);
    opacity: 0;
    transition: opacity .14s ease, background .14s ease;
}

.tc-notebook-card:hover .tc-card-menu,
.tc-card-menu:focus-visible {
    opacity: 1;
}

.tc-card-menu:hover {
    background: var(--tc-hover);
    color: var(--tc-text);
}

.tc-new-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 208px;
    border: 1px dashed var(--tc-border-strong);
    border-radius: var(--tc-radius);
    background: transparent;
    color: var(--tc-dim);
    font-size: .78rem;
    font-weight: 650;
    transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.tc-new-tile i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--tc-accent-soft);
    color: var(--tc-accent);
    font-size: .95rem;
}

.tc-new-tile:hover {
    border-color: var(--tc-accent);
    background: var(--tc-accent-soft);
    color: var(--tc-text);
}

.tc-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 54px 24px;
    border: 1px dashed var(--tc-border);
    border-radius: var(--tc-radius);
    color: var(--tc-dim);
    text-align: center;
    font-size: .82rem;
}

.tc-empty-state i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--tc-accent-soft);
    color: var(--tc-accent);
    font-size: 1.3rem;
}

.tc-empty-state strong {
    color: var(--tc-text);
    font-family: var(--tc-display);
    font-size: 1rem;
}

.tc-empty-state p {
    max-width: 380px;
    margin: 0;
    line-height: 1.6;
}

/* notebook detail */

.tc-detail-head {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.tc-detail-identity {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
    flex: 1 1 auto;
}

.tc-detail-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-radius: 15px;
    border: 1px solid var(--tc-border);
    background: var(--tc-panel-2);
    font-size: 1.5rem;
}

.tc-detail-identity h2 {
    font-size: 1.4rem;
}

.tc-detail-identity p {
    margin: 4px 0 0;
    color: var(--tc-dim);
    font-size: .78rem;
    line-height: 1.5;
}

.tc-detail-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.tc-detail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 16px 0 20px;
}

.tc-detail-stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--tc-border);
    border-radius: 999px;
    background: var(--tc-panel-2);
    color: var(--tc-dim);
    font-size: .68rem;
    font-weight: 600;
}

.tc-detail-stats i {
    color: var(--tc-accent);
    font-size: .62rem;
}

.tc-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr);
    gap: 14px;
    align-items: start;
}

.tc-panel {
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius);
    background: var(--tc-panel);
    overflow: hidden;
}

.tc-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 17px 12px;
    border-bottom: 1px solid var(--tc-border);
}

.tc-panel-head.compact {
    padding: 12px 0 8px;
    border-bottom: 0;
}

.tc-panel-head h3,
.tc-panel-head h4 {
    margin: 0;
    font-family: var(--tc-display);
    font-size: .94rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.tc-panel-head p {
    margin: 3px 0 0;
    color: var(--tc-dim);
    font-size: .68rem;
}

.tc-source-form {
    margin: 12px 14px;
    padding: 12px;
    border: 1px solid var(--tc-border);
    border-radius: 12px;
    background: var(--tc-panel-2);
}

.tc-source-form[hidden] {
    display: none;
}

.tc-source-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    padding: 3px;
    border-radius: 9px;
    background: var(--tc-panel-3);
}

.tc-source-tabs button {
    flex: 1;
    padding: 5px 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--tc-dim);
    font-size: .67rem;
    font-weight: 650;
}

.tc-source-tabs button.active {
    background: var(--tc-panel);
    color: var(--tc-text);
    box-shadow: 0 2px 7px rgba(0, 0, 0, .14);
}

.tc-source-form .tc-field {
    margin-bottom: 9px;
}

.tc-source-form .tc-field textarea {
    min-height: 110px;
}

.tc-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.tc-source-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 12px 14px 16px;
}

.tc-source-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--tc-border);
    border-radius: 11px;
    background: var(--tc-panel-2);
}

.tc-source-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
    background: var(--tc-accent-soft);
    color: var(--tc-accent);
    font-size: .72rem;
}

.tc-source-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.tc-source-copy strong {
    display: block;
    overflow: hidden;
    font-size: .76rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-source-copy small {
    display: block;
    overflow: hidden;
    margin-top: 2px;
    color: var(--tc-faint);
    font-size: .63rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-source-copy p {
    display: -webkit-box;
    overflow: hidden;
    margin: 5px 0 0;
    color: var(--tc-dim);
    font-size: .68rem;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.tc-source-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 2px;
}

.tc-source-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--tc-faint);
    font-size: .64rem;
}

.tc-source-actions button:hover {
    background: var(--tc-danger-soft);
    color: var(--tc-danger);
}

.tc-source-empty {
    padding: 22px 10px;
    color: var(--tc-faint);
    text-align: center;
    font-size: .74rem;
    line-height: 1.55;
}

.tc-studio-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 13px 14px;
}

.tc-studio-card {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--tc-border);
    border-radius: 10px;
    background: var(--tc-panel-2);
    text-align: left;
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.tc-studio-card:hover {
    transform: translateY(-1px);
    border-color: var(--tc-border-strong);
    background: var(--tc-panel-3);
}

.tc-studio-card i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 7px;
    background: var(--tc-accent-soft);
    color: var(--tc-accent);
    font-size: .66rem;
}

.tc-studio-card span {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.tc-studio-card strong {
    font-size: .71rem;
    font-weight: 700;
}

.tc-studio-card small {
    color: var(--tc-dim);
    font-size: .61rem;
    line-height: 1.35;
}

.tc-notebook-chats {
    padding: 0 14px 15px;
}

.tc-nb-chat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 4px;
    border: 0;
    border-top: 1px solid var(--tc-border);
    background: transparent;
    text-align: left;
}

.tc-nb-chat-row:hover {
    color: var(--tc-accent);
}

.tc-nb-chat-row i {
    color: var(--tc-dim);
    font-size: .65rem;
}

.tc-nb-chat-row span {
    flex: 1;
    overflow: hidden;
    font-size: .72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-nb-chat-row small {
    color: var(--tc-faint);
    font-size: .61rem;
}

/* prompts */

.tc-prompt-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.tc-prompt-filter {
    padding: 6px 11px;
    border: 1px solid var(--tc-border);
    border-radius: 999px;
    background: var(--tc-panel-2);
    color: var(--tc-dim);
    font-size: .7rem;
    font-weight: 650;
}

.tc-prompt-filter:hover {
    border-color: var(--tc-border-strong);
    color: var(--tc-text);
}

.tc-prompt-filter.active {
    border-color: var(--tc-accent);
    background: var(--tc-accent-soft);
    color: var(--tc-accent);
}

.tc-prompt-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.tc-prompt-card {
    display: flex;
    flex-direction: column;
    padding: 15px;
    border: 1px solid var(--tc-border);
    border-radius: 15px;
    background: linear-gradient(160deg, var(--tc-panel-2), var(--tc-panel));
    transition: transform .17s ease, border-color .17s ease, box-shadow .17s ease;
}

.tc-prompt-card:hover {
    transform: translateY(-2px);
    border-color: var(--tc-border-strong);
    box-shadow: var(--tc-shadow-soft);
}

.tc-prompt-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.tc-prompt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--tc-accent-soft);
    color: var(--tc-accent);
    font-size: .85rem;
}

.tc-prompt-category {
    padding: 2px 7px;
    border: 1px solid var(--tc-border);
    border-radius: 999px;
    color: var(--tc-faint);
    font-size: .58rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.tc-prompt-card h3 {
    margin: 0 0 5px;
    font-family: var(--tc-display);
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.tc-prompt-card p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 0 13px;
    color: var(--tc-dim);
    font-size: .71rem;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.tc-prompt-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 11px;
    border-top: 1px solid var(--tc-border);
}

.tc-prompt-card-foot .tc-text-btn {
    font-size: .68rem;
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */

.tc-modal {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
}

.tc-modal.open {
    display: flex;
}

.tc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 4, 10, .72);
    backdrop-filter: blur(8px);
}

.tc-modal-card {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: min(820px, calc(100dvh - 44px));
    border: 1px solid var(--tc-border-strong);
    border-radius: 22px;
    background: var(--tc-panel);
    box-shadow: var(--tc-shadow);
    overflow: hidden;
    animation: tc-modal-in .2s ease both;
}

@keyframes tc-modal-in {
    from { opacity: 0; transform: translateY(10px) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.tc-settings-card {
    max-width: 880px;
}

.tc-small-card {
    max-width: 540px;
}

.tc-confirm-card {
    max-width: 430px;
}

.tc-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--tc-border);
}

.tc-modal-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--tc-accent);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.tc-modal-head h2 {
    margin: 0;
    font-family: var(--tc-display);
    font-size: 1.18rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.tc-modal-body {
    display: flex;
    flex-direction: column;
    gap: 13px;
    padding: 18px 20px 20px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.tc-share-copy {
    margin: 0;
    color: var(--tc-muted);
    font-size: .8rem;
    line-height: 1.6;
}

.tc-share-field {
    display: flex;
    gap: 7px;
}

.tc-share-field input {
    flex: 1;
    min-width: 0;
    font-family: var(--tc-mono);
    font-size: .7rem;
}

.tc-share-field .tc-primary-btn {
    flex: 0 0 auto;
}

/* settings */

.tc-settings-layout {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
}

.tc-settings-tabs {
    display: flex;
    flex: 0 0 186px;
    flex-direction: column;
    gap: 3px;
    padding: 14px 10px;
    border-right: 1px solid var(--tc-border);
    background: var(--tc-bg-soft);
}

.tc-settings-tabs button {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--tc-dim);
    text-align: left;
    font-size: .76rem;
    font-weight: 650;
}

.tc-settings-tabs button i {
    width: 16px;
    font-size: .72rem;
    text-align: center;
}

.tc-settings-tabs button:hover {
    background: var(--tc-hover);
    color: var(--tc-text);
}

.tc-settings-tabs button.active {
    background: var(--tc-accent-soft);
    color: var(--tc-text);
}

.tc-settings-tabs button.active i {
    color: var(--tc-accent);
}

.tc-settings-panels {
    flex: 1 1 auto;
    min-width: 0;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
}

.tc-settings-panel[hidden] {
    display: none;
}

.tc-settings-intro {
    margin-bottom: 16px;
}

.tc-settings-intro h3 {
    margin: 0 0 4px;
    font-family: var(--tc-display);
    font-size: 1rem;
    font-weight: 700;
}

.tc-settings-intro p {
    margin: 0;
    color: var(--tc-dim);
    font-size: .74rem;
    line-height: 1.6;
}

.tc-settings-intro code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--tc-panel-3);
    font-family: var(--tc-mono);
    font-size: .9em;
}

.tc-provider-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 18px;
}

.tc-provider-tile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px;
    border: 1px solid var(--tc-border);
    border-radius: 10px;
    background: var(--tc-panel-2);
    text-align: left;
    transition: border-color .15s ease, background .15s ease;
}

.tc-provider-tile:hover {
    border-color: var(--tc-border-strong);
}

.tc-provider-tile.active {
    border-color: var(--tc-accent);
    background: var(--tc-accent-soft);
}

.tc-provider-tile .tc-model-logo {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
    font-size: .52rem;
}

.tc-provider-tile span {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tc-provider-tile strong {
    overflow: hidden;
    font-size: .7rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-provider-tile small {
    overflow: hidden;
    color: var(--tc-faint);
    font-size: .58rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-provider-tile .tc-ready-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tc-green);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, .12);
}

.tc-settings-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.tc-settings-fields .tc-field.wide {
    grid-column: 1 / -1;
}

.tc-settings-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.tc-settings-actions .tc-text-btn {
    margin-left: auto;
}

.tc-status-box {
    margin-top: 12px;
    padding: 9px 11px;
    border: 1px solid var(--tc-border);
    border-radius: 9px;
    background: var(--tc-panel-2);
    color: var(--tc-muted);
    font-size: .73rem;
    line-height: 1.5;
}

.tc-status-box.success {
    border-color: rgba(52, 211, 153, .3);
    background: rgba(52, 211, 153, .08);
    color: #a7f3d0;
}

html[data-tc-theme="light"] .tc-status-box.success {
    color: #047857;
}

.tc-status-box.error {
    border-color: rgba(248, 113, 113, .3);
    background: var(--tc-danger-soft);
    color: #fecaca;
}

html[data-tc-theme="light"] .tc-status-box.error {
    color: #b91c1c;
}

.tc-provider-note {
    margin: 14px 0 0;
    color: var(--tc-faint);
    font-size: .66rem;
    line-height: 1.55;
}

.tc-pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 0;
    border-bottom: 1px solid var(--tc-border);
}

.tc-pref-row strong {
    display: block;
    font-size: .78rem;
    font-weight: 700;
}

.tc-pref-row small {
    display: block;
    margin-top: 2px;
    color: var(--tc-dim);
    font-size: .67rem;
}

.tc-segmented {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--tc-border);
    border-radius: 9px;
    background: var(--tc-panel-2);
}

.tc-segmented button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--tc-dim);
    font-size: .68rem;
    font-weight: 650;
}

.tc-segmented button.active {
    background: var(--tc-panel);
    color: var(--tc-text);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .14);
}

.tc-pref-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 0;
    border-bottom: 1px solid var(--tc-border);
    cursor: pointer;
}

.tc-pref-toggle strong {
    display: block;
    font-size: .78rem;
    font-weight: 700;
}

.tc-pref-toggle small {
    display: block;
    margin-top: 2px;
    color: var(--tc-dim);
    font-size: .67rem;
}

.tc-pref-toggle input {
    width: 38px;
    height: 21px;
    flex: 0 0 38px;
    appearance: none;
    border-radius: 999px;
    background: var(--tc-panel-3);
    border: 1px solid var(--tc-border-strong);
    position: relative;
    cursor: pointer;
    transition: background .16s ease;
}

.tc-pref-toggle input::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--tc-dim);
    transition: transform .16s ease, background .16s ease;
}

.tc-pref-toggle input:checked {
    background: var(--tc-accent);
    border-color: var(--tc-accent);
}

.tc-pref-toggle input:checked::after {
    transform: translateX(17px);
    background: #fff;
}

.tc-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.tc-stat-card {
    padding: 12px;
    border: 1px solid var(--tc-border);
    border-radius: 11px;
    background: var(--tc-panel-2);
}

.tc-stat-card strong {
    display: block;
    font-family: var(--tc-display);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -.03em;
}

.tc-stat-card span {
    color: var(--tc-dim);
    font-size: .64rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.tc-data-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.tc-about-hero {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.tc-about-hero h3 {
    margin: 0 0 5px;
    font-family: var(--tc-display);
    font-size: 1.15rem;
    font-weight: 700;
}

.tc-about-hero h3 small {
    color: var(--tc-dim);
    font-size: .66rem;
    font-weight: 600;
}

.tc-about-hero p {
    margin: 0;
    color: var(--tc-muted);
    font-size: .76rem;
    line-height: 1.6;
}

.tc-about-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.tc-about-grid > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--tc-border);
    border-radius: 11px;
    background: var(--tc-panel-2);
}

.tc-about-grid i {
    color: var(--tc-accent);
    font-size: .9rem;
}

.tc-about-grid strong {
    font-size: .76rem;
    font-weight: 700;
}

.tc-about-grid span {
    color: var(--tc-dim);
    font-size: .67rem;
    line-height: 1.5;
}

/* emoji + color picker */

.tc-emoji-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tc-emoji-row button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--tc-border);
    border-radius: 9px;
    background: var(--tc-panel-2);
    font-size: 1.05rem;
    transition: border-color .14s ease, background .14s ease;
}

.tc-emoji-row button:hover {
    border-color: var(--tc-border-strong);
}

.tc-emoji-row button.active {
    border-color: var(--tc-accent);
    background: var(--tc-accent-soft);
}

.tc-color-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tc-color-row button {
    width: 26px;
    height: 26px;
    border: 2px solid transparent;
    border-radius: 50%;
    background: var(--swatch);
    box-shadow: 0 0 0 1px var(--tc-border);
    transition: transform .14s ease, box-shadow .14s ease;
}

.tc-color-row button:hover {
    transform: scale(1.1);
}

.tc-color-row button.active {
    box-shadow: 0 0 0 2px var(--tc-panel), 0 0 0 4px var(--swatch);
}

/* toasts */

.tc-toast-stack {
    position: fixed;
    right: 20px;
    bottom: 22px;
    z-index: 2200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.tc-toast {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    max-width: 360px;
    padding: 10px 13px;
    border: 1px solid var(--tc-border-strong);
    border-radius: 11px;
    background: var(--tc-glass);
    color: var(--tc-text);
    font-size: .76rem;
    line-height: 1.45;
    box-shadow: var(--tc-shadow-soft);
    backdrop-filter: blur(18px);
    animation: tc-toast-in .22s ease both;
    pointer-events: auto;
}

.tc-toast.leaving {
    animation: tc-toast-out .2s ease both;
}

.tc-toast i {
    margin-top: 2px;
    color: var(--tc-accent);
    font-size: .76rem;
}

.tc-toast.success i { color: var(--tc-green); }
.tc-toast.error i { color: var(--tc-danger); }

@keyframes tc-toast-in {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tc-toast-out {
    to { opacity: 0; transform: translateY(5px) scale(.98); }
}

/* --------------------------------------------------------------------------
   Site header compatibility
   -------------------------------------------------------------------------- */

body.tc-page .mobile-header {
    position: fixed !important;
    background: rgba(7, 8, 13, .86) !important;
    border-bottom: 1px solid var(--tc-border) !important;
    backdrop-filter: blur(18px);
    z-index: 9000;
}

html[data-tc-theme="light"] body.tc-page .mobile-header {
    background: rgba(255, 255, 255, .9) !important;
}

body.tc-page .mobile-header .brand-title {
    color: var(--tc-text) !important;
}

body.tc-page .yt-sidebar {
    z-index: 100;
}

body.tc-page .yt-layout {
    height: 100dvh;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (min-width: 1500px) {
    .tc-chat-view {
        max-width: 940px;
    }
    .tc-composer,
    .tc-context-bar {
        max-width: 920px;
    }
}

@media (max-width: 1100px) {
    .tc-notebook-grid,
    .tc-prompt-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .tc-provider-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .tc-detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-height: 720px) {
    .tc-welcome {
        padding-top: 10px;
    }
    .tc-welcome-orb {
        width: 70px;
        height: 70px;
        margin-bottom: 14px;
    }
    .tc-orb-core {
        width: 54px;
        height: 54px;
        border-radius: 18px;
        font-size: 1.2rem;
    }
    .tc-welcome-grid {
        margin-top: 18px;
    }
}

@media (max-width: 900px) {
    body.tc-has-site-header .tc-shell {
        left: 76px;
    }
    .tc-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(310px, 86vw);
        transform: translateX(-104%);
        transition: transform .24s cubic-bezier(.2, .8, .2, 1);
        box-shadow: var(--tc-shadow);
        z-index: 60;
    }
    .tc-shell.sidebar-open .tc-sidebar {
        transform: translateX(0);
    }
    .tc-sidebar-close {
        display: inline-flex !important;
    }
    .tc-menu-btn {
        display: inline-flex !important;
    }
    .tc-chat-view {
        padding-top: 26px;
    }
    .tc-page-inner {
        padding: 30px 20px 90px;
    }
}

@media (max-width: 768px) {
    body.tc-has-site-header .tc-shell {
        left: 0;
        top: 65px;
    }
    .tc-topbar {
        height: 58px;
        padding: 0 10px 0 12px;
    }
    .tc-topbar-right {
        gap: 4px;
    }
    .tc-icon-btn {
        width: 33px;
        height: 33px;
        flex-basis: 33px;
    }
    .tc-model-pill {
        max-width: 190px;
        padding: 4px 8px 4px 5px;
    }
    .tc-model-pill-copy strong,
    .tc-model-pill-copy small {
        max-width: 106px;
    }
    .tc-model-pill > i {
        display: none;
    }
    .tc-title-wrap p {
        display: none;
    }
    .tc-chat-view {
        padding: 18px 13px 210px;
    }
    .tc-welcome {
        padding-top: 16px;
    }
    .tc-welcome h2 {
        font-size: 1.7rem;
    }
    .tc-welcome-sub {
        font-size: .85rem;
    }
    .tc-welcome-grid {
        grid-template-columns: 1fr;
        gap: 7px;
        margin-top: 20px;
    }
    .tc-suggest-card {
        padding: 11px 12px;
    }
    .tc-suggest-icon {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
        font-size: .8rem;
    }
    .tc-page-inner {
        padding: 22px 14px 90px;
    }
    .tc-page-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
    .tc-notebook-grid,
    .tc-prompt-grid {
        grid-template-columns: 1fr;
    }
    .tc-notebook-card {
        min-height: 170px;
    }
    .tc-new-tile {
        min-height: 120px;
    }
    .tc-detail-head {
        align-items: flex-start;
        gap: 10px;
    }
    .tc-detail-identity {
        flex-basis: 100%;
        order: 3;
    }
    .tc-detail-actions {
        margin-left: auto;
    }
    .tc-detail-actions .tc-ghost-btn:not(.danger) {
        display: none;
    }
    .tc-detail-emoji {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
        font-size: 1.2rem;
    }
    .tc-detail-identity h2 {
        font-size: 1.15rem;
    }
    .tc-detail-identity p {
        display: none;
    }
    .tc-detail-layout {
        gap: 10px;
    }
    .tc-studio-grid {
        grid-template-columns: 1fr 1fr;
    }
    .tc-composer-wrap {
        padding: 0 10px calc(10px + env(safe-area-inset-bottom));
    }
    .tc-context-bar {
        padding: 6px 7px;
    }
    .tc-context-copy small {
        display: none;
    }
    .tc-composer-box {
        border-radius: 17px;
    }
    #composerInput {
        min-height: 46px;
        padding: 12px 12px 4px;
        font-size: .9rem;
    }
    .tc-tool-btn span {
        display: none;
    }
    .tc-composer-hint {
        font-size: .58rem;
    }
    #composerHint {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .tc-msg-body {
        max-width: calc(100% - 40px);
    }
    .tc-msg.user .tc-msg-body {
        max-width: 86%;
    }
    .tc-msg-content {
        padding: 12px 13px;
        font-size: .88rem;
    }
    .tc-msg-actions {
        opacity: 1;
    }
    .tc-msg-action span {
        display: none;
    }
    .tc-jump-latest {
        bottom: 118px;
    }
    .tc-modal {
        align-items: flex-end;
        padding: 0;
    }
    .tc-modal-card {
        max-height: 92dvh;
        border-radius: 22px 22px 0 0;
    }
    .tc-settings-layout {
        flex-direction: column;
    }
    .tc-settings-tabs {
        flex: 0 0 auto;
        flex-direction: row;
        overflow-x: auto;
        padding: 8px 10px;
        border-right: 0;
        border-bottom: 1px solid var(--tc-border);
    }
    .tc-settings-tabs button {
        flex: 0 0 auto;
        padding: 7px 9px;
        white-space: nowrap;
    }
    .tc-settings-tabs button i {
        width: auto;
    }
    .tc-settings-panels {
        padding: 15px;
    }
    .tc-settings-fields {
        grid-template-columns: 1fr;
    }
    .tc-provider-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .tc-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .tc-about-grid {
        grid-template-columns: 1fr;
    }
    .tc-pref-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 9px;
    }
    .tc-toast-stack {
        left: 12px;
        right: 12px;
        bottom: 12px;
        align-items: stretch;
    }
    .tc-toast {
        max-width: none;
    }
    .tc-popover {
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        top: auto !important;
        bottom: 12px !important;
        max-height: 74dvh;
        border-radius: 18px;
    }
    .tc-model-list,
    .tc-quick-list {
        max-height: 50dvh;
    }
    .tc-item-menu {
        width: min(240px, calc(100vw - 24px));
    }
}

@media (max-width: 480px) {
    .tc-model-pill-copy small {
        display: none;
    }
    .tc-model-pill-copy strong {
        max-width: 92px;
    }
    .tc-provider-grid {
        grid-template-columns: 1fr;
    }
    .tc-studio-grid {
        grid-template-columns: 1fr;
    }
    .tc-stat-grid {
        grid-template-columns: 1fr 1fr;
    }
}

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

/* ==========================================================================
   Reading size preference
   ========================================================================== */

html[data-tc-font="compact"] .tc-msg-content,
html[data-tc-font="compact"] .tc-md {
    font-size: .86rem;
    line-height: 1.6;
}

html[data-tc-font="large"] .tc-msg-content,
html[data-tc-font="large"] .tc-md {
    font-size: 1rem;
    line-height: 1.75;
}

html[data-tc-font="large"] .tc-msg-name {
    font-size: .8rem;
}

/* ==========================================================================
   Inline chat rename + message editing
   ========================================================================== */

.tc-rename-input {
    width: 100%;
    min-width: 0;
    padding: 4px 7px;
    border: 1px solid rgba(77, 141, 255, .5);
    border-radius: 8px;
    outline: none;
    background: var(--tc-panel-3);
    color: var(--tc-text);
    font-family: var(--tc-font);
    font-size: .84rem;
    font-weight: 600;
    line-height: 1.35;
    box-shadow: 0 0 0 3px rgba(77, 141, 255, .16);
}

.tc-edit-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px;
}

.tc-edit-input {
    width: 100%;
    min-height: 96px;
    max-height: 46vh;
    resize: vertical;
    padding: 12px 14px;
    border: 1px solid var(--tc-border-strong, rgba(255, 255, 255, .14));
    border-radius: 12px;
    outline: none;
    background: var(--tc-panel-3);
    color: var(--tc-text);
    font-family: var(--tc-font);
    font-size: .92rem;
    line-height: 1.6;
}

.tc-edit-input:focus {
    border-color: rgba(77, 141, 255, .6);
    box-shadow: 0 0 0 3px rgba(77, 141, 255, .15);
}

.tc-edit-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.tc-msg.user .tc-edit-wrap {
    min-width: min(520px, 64vw);
}

/* ==========================================================================
   Public share page (share.php)
   ========================================================================== */

body.tc-sharepage {
    min-height: 100vh;
    overflow-y: auto;
}

body.tc-sharepage::before {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(56vw 42vw at 12% -6%, rgba(77, 141, 255, .2), transparent 62%),
        radial-gradient(46vw 40vw at 92% 4%, rgba(139, 92, 246, .17), transparent 60%);
    content: "";
    pointer-events: none;
}

.tc-share-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px clamp(16px, 4vw, 40px);
    border-bottom: 1px solid var(--tc-border);
    background: color-mix(in srgb, var(--tc-bg) 82%, transparent);
    backdrop-filter: blur(18px);
}

.tc-share-bar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.tc-share-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border: 1px solid var(--tc-border);
    border-radius: 999px;
    background: var(--tc-panel-2);
    color: var(--tc-muted);
    font-size: .72rem;
    font-weight: 650;
    letter-spacing: .02em;
    white-space: nowrap;
}

.tc-share-pill i {
    color: var(--tc-accent);
}

.tc-share-main {
    position: relative;
    z-index: 1;
    width: min(900px, 100%);
    margin: 0 auto;
    padding: clamp(22px, 4vw, 44px) clamp(14px, 4vw, 28px) 60px;
}

.tc-share-card {
    padding: clamp(20px, 3.6vw, 38px);
    border: 1px solid var(--tc-border);
    border-radius: 26px;
    background: color-mix(in srgb, var(--tc-panel) 92%, transparent);
    box-shadow: 0 30px 80px rgba(3, 6, 18, .5);
}

.tc-share-head {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--tc-border);
    margin-bottom: 26px;
}

.tc-share-kicker {
    margin: 0 0 6px;
    color: var(--tc-accent);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.tc-share-head h1 {
    margin: 0 0 14px;
    color: var(--tc-text);
    font-family: var(--tc-display);
    font-size: clamp(1.35rem, 3.4vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.24;
}

.tc-share-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tc-share-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid var(--tc-border);
    border-radius: 999px;
    background: var(--tc-panel-2);
    color: var(--tc-muted);
    font-size: .68rem;
    font-weight: 600;
    white-space: nowrap;
}

.tc-share-tag i {
    color: var(--tc-accent);
    font-size: .64rem;
}

.tc-share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 18px;
}

.tc-share-thread {
    margin-top: 0;
}

.tc-share-raw {
    white-space: pre-wrap;
}

.tc-sharepage .tc-msg-body {
    max-width: calc(100% - 44px);
}

.tc-sharepage .tc-msg-bubble {
    background: var(--tc-panel-2);
}

.tc-sharepage .tc-msg.assistant .tc-msg-bubble {
    background: transparent;
}

.tc-sharepage .tc-attachment-grid {
    padding: 0 0 10px;
}

.tc-share-image {
    display: inline-flex;
    overflow: hidden;
    border-radius: 12px;
    line-height: 0;
}

.tc-share-note {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 8px 0 0;
    color: var(--tc-faint);
    font-size: .72rem;
}

.tc-share-empty {
    margin: 0;
    padding: 18px;
    border: 1px dashed var(--tc-border);
    border-radius: 14px;
    color: var(--tc-muted);
    text-align: center;
}

.tc-share-foot {
    margin-top: 22px;
    color: var(--tc-faint);
    font-size: .74rem;
    text-align: center;
}

.tc-share-foot p {
    margin: 0 0 8px;
    line-height: 1.6;
}

.tc-share-foot strong {
    color: var(--tc-muted);
}

.tc-share-foot-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

.tc-share-foot-links a {
    color: var(--tc-muted);
    font-weight: 600;
    text-decoration: none;
}

.tc-share-foot-links a:hover {
    color: var(--tc-text);
}

.tc-share-problem {
    text-align: center;
}

.tc-share-problem-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 16px;
    border-radius: 18px;
    background: var(--tc-panel-3);
    color: var(--tc-accent);
    font-size: 1.35rem;
}

.tc-share-problem h1 {
    margin: 0 0 10px;
    color: var(--tc-text);
    font-family: var(--tc-display);
    font-size: clamp(1.25rem, 3vw, 1.6rem);
}

.tc-share-problem p {
    margin: 0 0 10px;
    color: var(--tc-muted);
    font-size: .88rem;
    line-height: 1.65;
}

.tc-share-problem .tc-share-actions {
    justify-content: center;
}

@media (max-width: 720px) {
    .tc-share-bar {
        flex-wrap: wrap;
        justify-content: center;
    }
    .tc-share-bar .tc-brand-text small {
        display: none;
    }
    .tc-share-bar-actions .tc-primary-btn {
        padding: 8px 13px;
        font-size: .76rem;
    }
    .tc-sharepage .tc-msg.user .tc-msg-body {
        max-width: 88%;
    }
    .tc-share-foot {
        padding-bottom: 18px;
    }
}

/* ==========================================================================
   Light theme syntax colours (the CDN theme is a dark one)
   ========================================================================== */

html[data-tc-theme="light"] .tc-md .hljs-comment,
html[data-tc-theme="light"] .tc-md .hljs-quote { color: #6e7781; }

html[data-tc-theme="light"] .tc-md .hljs-keyword,
html[data-tc-theme="light"] .tc-md .hljs-selector-tag,
html[data-tc-theme="light"] .tc-md .hljs-literal,
html[data-tc-theme="light"] .tc-md .hljs-doctag,
html[data-tc-theme="light"] .tc-md .hljs-deletion { color: #cf222e; }

html[data-tc-theme="light"] .tc-md .hljs-string,
html[data-tc-theme="light"] .tc-md .hljs-regexp,
html[data-tc-theme="light"] .tc-md .hljs-addition,
html[data-tc-theme="light"] .tc-md .hljs-attribute { color: #0a3069; }

html[data-tc-theme="light"] .tc-md .hljs-number,
html[data-tc-theme="light"] .tc-md .hljs-built_in,
html[data-tc-theme="light"] .tc-md .hljs-type,
html[data-tc-theme="light"] .tc-md .hljs-symbol,
html[data-tc-theme="light"] .tc-md .hljs-bullet { color: #0550ae; }

html[data-tc-theme="light"] .tc-md .hljs-title,
html[data-tc-theme="light"] .tc-md .hljs-title.function_,
html[data-tc-theme="light"] .tc-md .hljs-section,
html[data-tc-theme="light"] .tc-md .hljs-name { color: #8250df; }

html[data-tc-theme="light"] .tc-md .hljs-attr,
html[data-tc-theme="light"] .tc-md .hljs-variable,
html[data-tc-theme="light"] .tc-md .hljs-template-variable,
html[data-tc-theme="light"] .tc-md .hljs-selector-attr { color: #953800; }

html[data-tc-theme="light"] .tc-md .hljs-meta,
html[data-tc-theme="light"] .tc-md .hljs-meta .hljs-keyword { color: #116329; }

html[data-tc-theme="light"] .tc-md .hljs-emphasis { font-style: italic; }
html[data-tc-theme="light"] .tc-md .hljs-strong { font-weight: 700; }
