/* ============================================================
   ALARA — dusk room (web)
   Warm dark · pink accent · editorial greeting
   UI: Plus Jakarta Sans · Greeting: Newsreader
   ============================================================ */

:root {
    --sidebar-rail: 56px;
    --sidebar-expanded: 260px;

    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
    --font-code: 'JetBrains Mono', ui-monospace, monospace;

    --pink: #ec4899;
    --pink-light: #f472b6;
    --pink-dim: rgba(236, 72, 153, 0.12);
    --purple: #8b5cf6;

    --bg-body: #121214;
    --bg-sidebar: #0e0e11;
    --bg-rail: #0e0e11;
    --surface-1: #19191c;
    --surface-2: #202024;
    --surface-3: #2a2a30;
    --hover: rgba(255, 244, 240, 0.055);
    --hover-strong: rgba(255, 244, 240, 0.09);

    --text-1: #eceae8;
    --text-2: rgba(236, 234, 232, 0.58);
    --text-3: rgba(236, 234, 232, 0.36);
    --text: var(--text-1);
    --text-primary: var(--text-1);
    --text-muted: var(--text-2);

    --border: rgba(255, 236, 230, 0.11);
    --border-soft: rgba(255, 236, 230, 0.07);

    --user-bubble: #1f1f23;
    --ai-bubble: transparent;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;
    --r-pill: 999px;

    --shadow-pop: 0 12px 40px rgba(6, 4, 8, 0.55);
    --shadow-composer: 0 8px 28px rgba(8, 4, 10, 0.32);
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);

    --ok: #4ade80;
    --warn: #fbbf24;
    --err: #f87171;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
    font-family: var(--font-sans);
    background: var(--bg-body);
    color: var(--text-1);
    overflow: hidden;
    display: flex;
    -webkit-font-smoothing: antialiased;
}

body::after { display: none; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 500; color: var(--text-1); }

a { color: var(--text-2); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--text-1); }

button { font-family: inherit; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(236, 72, 153, 0.35); }

.bg-light { background: var(--surface-2) !important; }
.text-muted, .text-secondary { color: var(--text-2) !important; }
.text-purple { color: var(--purple) !important; }
.text-emerald { color: #10b981 !important; }
.form-control {
    background: var(--surface-2) !important;
    color: var(--text-1) !important;
    border-color: var(--border) !important;
}
.dropdown-item { color: var(--text-1) !important; }
.dropdown-item:hover { background: var(--hover) !important; color: var(--text-1) !important; }
.btn-close { filter: invert(1) grayscale(1) brightness(1.4); }
.modal-content { color: var(--text-1) !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Ambient — off for minimal look */
.ambient-bg { display: none; }

/* ============================================================
   SIDEBAR
   ============================================================ */
#sidebar {
    position: relative;
    z-index: 50;
    width: var(--sidebar-rail);
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-soft);
    display: flex;
    transition: width 0.2s ease;
    overflow: hidden;
}
#sidebar:not(.expanded) { overflow: visible; z-index: 60; }
#sidebar.expanded { width: var(--sidebar-expanded); }
#sidebar:not(.expanded) { width: var(--sidebar-rail); }

.sidebar-rail {
    width: var(--sidebar-rail);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    padding: 12px 0;
    gap: 2px;
}
#sidebar.expanded .sidebar-rail {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
#sidebar:not(.expanded) .sidebar-panel { display: none !important; }

.rail-footer {
    margin-top: auto;
    width: 100%;
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

.rail-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.12s, background 0.12s;
    font-size: 0.82rem;
    text-decoration: none;
    padding: 0;
    flex-shrink: 0;
}
.rail-btn i { font-size: 0.78rem; }
.rail-btn:hover { background: var(--hover); color: var(--text-1); }
.rail-btn.active { color: var(--pink-light); background: var(--pink-dim); }
.rail-btn--logo { width: 36px; height: 36px; margin-bottom: 8px; }
.rail-btn--logo:hover { background: var(--hover); }

.rail-btn[data-tip]::after { display: none; }

.rail-signin-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.12s, background 0.12s;
}
.rail-signin-btn:hover { background: var(--hover); color: var(--text-1); }

.rail-logo-image {
    width: 29px;
    height: 29px;
    display: block;
}
.sidebar-brand-lockup {
    width: 108px;
    height: auto;
    display: block;
}
#alara-avatar.is-thinking .rail-logo-image { animation: logoPulse 1.4s ease-in-out infinite; }
@keyframes logoPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.04); }
}

.user-rail-avatar { background: transparent; }
.user-rail-avatar::after { display: none !important; }
.user-avatar, .sidebar-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: var(--surface-3);
    color: #fff;
    font-weight: 600;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-menu-area { width: 100%; display: flex; justify-content: center; }

@media (min-width: 768px) {
    #toggle-sidebar-btn { display: none !important; }
    .chat-header { padding-left: 16px; }
    #sidebar.expanded ~ #workspace .chat-header { padding-left: 12px; }
}

.sidebar-panel {
    display: none;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 14px 10px 12px;
    opacity: 0;
    overflow: hidden;
}
#sidebar.expanded .sidebar-panel {
    display: flex;
    opacity: 1;
    animation: panelIn 0.2s var(--ease) forwards;
}
@keyframes panelIn {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: none; }
}

.sidebar-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1px 4px 12px;
    flex-shrink: 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; }
.sidebar-brand-text { display: flex; flex-direction: column; gap: 1px; }
.sidebar-brand-name {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.02em;
    color: var(--text-1);
    line-height: 1.2;
}
.sidebar-brand-tag {
    font-size: 0.72rem;
    color: var(--text-3);
    font-weight: 400;
}
.sidebar-panel-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.sidebar-panel-close:hover { background: var(--hover); color: var(--text-1); }

.sidebar-new-chat {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    margin: 0 0 7px;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: transparent;
    color: var(--text-1);
    font-weight: 500;
    font-size: 0.82rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s;
}
.sidebar-new-chat:hover { background: var(--hover); border-color: var(--border); }
.sidebar-new-chat i { width: 16px; color: var(--text-2); font-size: 0.78rem; text-align: center; }

.history-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 7px 10px;
    margin-bottom: 5px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.history-search-wrap:focus-within { background: var(--surface-1); border-color: var(--border-soft); }
.history-search-wrap i { color: var(--text-3); font-size: 0.76rem; width: 16px; text-align: center; }
.history-search-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-1);
    font-size: 0.84rem;
    font-family: var(--font-sans);
    min-width: 0;
}
.history-search-wrap input::placeholder { color: var(--text-3); }

.sidebar-scroll-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1px 2px 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.14) transparent;
}
.sidebar-scroll-body::-webkit-scrollbar { width: 4px; }
.sidebar-scroll-body::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 99px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sidebar-create-well {
    margin: 0 1px;
    padding: 5px 5px 7px;
    border-radius: 13px;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
}
.sidebar-create-well .sidebar-section-label { padding: 4px 7px 6px; }
.sidebar-create-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.sidebar-create-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    min-height: 62px;
    padding: 10px 10px 9px;
    border: none;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-1);
    font-size: 0.78rem;
    font-weight: 550;
    cursor: pointer;
    text-align: left;
    transition: background 0.14s, color 0.14s, box-shadow 0.14s;
}
.sidebar-create-tile i {
    width: auto;
    font-size: 0.82rem;
    color: var(--pink-light);
}
.sidebar-create-tile:hover {
    background: var(--hover-strong);
    color: var(--text-1);
}
.sidebar-create-tile.active {
    background: var(--pink-dim);
    box-shadow: inset 0 0 0 1px rgba(236, 72, 153, 0.28);
}
.sidebar-create-tile.active i { color: var(--pink-light); }
.sidebar-destinations {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 2px 1px 0;
}
.sidebar-destinations .sidebar-section-label { padding-left: 8px; }
.sidebar-destinations .sidebar-connections-label {
    margin-top: 8px;
    padding-top: 9px;
    border-top: 1px solid var(--border-soft);
}
.sidebar-destinations .sidebar-nav-item > i {
    width: 16px;
    text-align: center;
    font-size: 0.76rem;
    color: var(--text-3);
}
.sidebar-destinations .sidebar-nav-item.active > i { color: var(--pink-light); }
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 7px 9px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-2);
    font-size: 0.82rem;
    font-weight: 450;
    cursor: pointer;
    text-align: left;
    transition: background 0.14s, color 0.14s;
}
.sidebar-nav-item i { width: 16px; text-align: center; font-size: 0.76rem; color: var(--text-3); }
.sidebar-nav-item:hover { background: var(--hover); color: var(--text-1); }
.sidebar-nav-item.active { background: var(--hover); color: var(--text-1); }
.sidebar-nav-item.active i { color: var(--pink-light); }

.sidebar-more-wrap { position: relative; }
.sidebar-more-trigger[aria-expanded="true"] {
    background: var(--hover);
    color: var(--text-1);
}
.sidebar-more-trigger.is-active > i:first-child,
.sidebar-more-trigger[aria-expanded="true"] > i:first-child { color: var(--pink-light); }
.sidebar-more-chevron {
    margin-left: auto;
    width: auto !important;
    font-size: 0.56rem !important;
    transition: transform 0.16s var(--ease);
}
.sidebar-more-trigger[aria-expanded="true"] .sidebar-more-chevron { transform: rotate(90deg); }

.sidebar-more-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    padding: 5px;
    border: 1px solid var(--border-soft);
    border-radius: 11px;
    background: var(--surface-1);
    box-shadow: 0 12px 32px rgba(0,0,0,.24);
}
.sidebar-more-menu[hidden] { display: none !important; }
.sidebar-menu-label {
    margin: 0;
    padding: 6px 7px 4px;
    color: var(--text-3);
    font-size: 0.58rem;
    font-weight: 650;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 34px;
    padding: 6px 7px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 450;
    text-align: left;
    cursor: pointer;
}
.sidebar-menu-item:hover,
.sidebar-menu-item:focus-visible {
    outline: none;
    background: var(--hover);
    color: var(--text-1);
}
.sidebar-menu-item.active { background: var(--hover); color: var(--text-1); }
.sidebar-menu-item > i {
    width: 15px;
    color: var(--text-3);
    font-size: 0.7rem;
    text-align: center;
}
.sidebar-menu-item.active > i { color: var(--pink-light); }
.sidebar-item-note,
.sidebar-beta-badge {
    margin-left: auto;
    font-size: 0.56rem;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.sidebar-item-note { color: var(--text-3); }
.sidebar-beta-badge {
    padding: 2px 5px;
    border-radius: 99px;
    background: var(--pink-dim);
    color: var(--pink-light);
}
.sidebar-menu-divider {
    height: 1px;
    margin: 5px 7px;
    background: var(--border-soft);
}

.sidebar-section-label {
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 6px 9px 5px;
    margin: 0;
}

.sidebar-recents { min-height: 0; }
.history-list { padding: 0; min-height: 40px; overflow: visible; }
.history-empty { color: var(--text-3); font-size: 0.8rem; text-align: center; padding: 1.25rem 0.5rem; line-height: 1.5; }
.history-load-more {
    display: block;
    width: calc(100% - 18px);
    margin: 8px 9px;
    padding: 7px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: transparent;
    color: var(--text-3);
    font: inherit;
    font-size: 0.72rem;
    cursor: pointer;
}
.history-load-more:hover { background: var(--hover); color: var(--text-2); }
.history-load-more:disabled { opacity: 0.55; cursor: wait; }

.chat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 9px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.84rem;
    color: #fff;
    transition: background 0.14s, color 0.14s;
    position: relative;
}
.chat-item:hover { background: var(--hover); color: var(--text-1); }
.chat-item.active { background: var(--pink-dim); color: var(--text-1); }
.chat-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 2px;
    border-radius: 99px;
    background: var(--pink);
}
.chat-item-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
    color: #fff;
}
.chat-item-actions { display: flex; opacity: 0; transition: opacity 0.14s; flex-shrink: 0; }
.chat-item:hover .chat-item-actions { opacity: 1; }
.chat-item-leading {
    position: relative;
    flex-shrink: 0;
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-item.is-pinned .pin-icon {
    display: block;
    font-size: 0.62rem;
    color: var(--pink-light);
    transform: rotate(32deg);
}
.chat-item.is-pinned .menu-icon { display: none; }
.chat-item.is-pinned:hover .pin-icon { display: none; }
.chat-item.is-pinned:hover .menu-icon,
.chat-item.is-pinned.menu-open .menu-icon { display: block; }
.chat-item.is-pinned.menu-open .pin-icon { display: none; }
.chat-item-menu-btn {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    padding: 0;
}
.chat-item-menu-btn:hover { background: var(--hover-strong); color: var(--text-1); }
.chat-item-menu {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    min-width: 128px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-pop);
    padding: 4px;
    z-index: 20;
}
.chat-item.menu-open .chat-item-menu { display: block; }
.chat-item-menu button {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-1);
    text-align: left;
    font-size: 0.8rem;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.chat-item-menu button:hover { background: var(--hover); }
.chat-item-menu button.is-danger { color: var(--err); }
.chat-item-menu button.is-danger:hover { background: rgba(239, 68, 68, 0.12); }
.chat-item-action {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
}
.chat-item-action:hover { background: var(--hover-strong); color: var(--text-1); }
.chat-item-action.delete-action:hover { color: var(--err); }

.sidebar-footer {
    margin-top: 0;
    padding-top: 8px;
    border-top: 1px solid var(--border-soft);
    flex-shrink: 0;
}
.sidebar-social {
    display: flex;
    justify-content: center;
    margin: 0 0 8px;
}
.sidebar-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--r-md);
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    color: var(--text-1);
    font-size: 0.84rem;
    font-weight: 500;
    transition: background 0.16s, border-color 0.16s;
}
.sidebar-nav-item--disabled,
.sidebar-nav-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: var(--r-md);
}
.sidebar-user-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.25;
}
.sidebar-user-name { font-size: 0.84rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.sidebar-plan-badge { font-size: 0.72rem; color: var(--text-3); display: block; }
.sidebar-plan-badge.is-elite { color: #c4b5fd; }
.sidebar-plan-badge.is-luxury { color: #6ee7b7; }
.sidebar-user-menu-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-user-menu-btn:hover { background: var(--hover); color: var(--text-1); }
.sidebar-dropdown { background: var(--surface-2) !important; border: 1px solid var(--border) !important; min-width: 200px; box-shadow: var(--shadow-pop); }

/* ============================================================
   WORKSPACE
   ============================================================ */
#workspace {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    z-index: 1;
    min-width: 0;
    background:
        radial-gradient(ellipse 80% 48% at 50% -8%, rgba(236, 72, 153, 0.05), transparent 58%),
        var(--bg-body);
}
#workspace.resizing { user-select: none; cursor: col-resize; }

#chat-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

#chat-pane.is-welcome::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
    width: min(880px, 92vw);
    height: min(480px, 52vh);
    background: radial-gradient(
        ellipse 68% 58% at 50% 48%,
        rgba(236, 72, 153, 0.22) 0%,
        rgba(236, 72, 153, 0.08) 38%,
        rgba(139, 92, 246, 0.04) 58%,
        transparent 72%
    );
    filter: blur(48px);
    pointer-events: none;
    z-index: 0;
}

.chat-header {
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    gap: 4px;
}
.chat-header.has-title { border-bottom: 1px solid var(--border-soft); }

#chat-pane.is-welcome {
    justify-content: center;
    align-items: center;
}
#chat-pane.is-welcome .chat-header {
    position: absolute;
    inset: 0 0 auto 0;
    border-bottom: none;
    background: transparent;
}
#chat-pane.is-welcome #chat-stream {
    flex: 0 0 auto;
    width: 100%;
    max-width: 680px;
    overflow: visible;
    padding: 0 1.25rem;
}
#chat-pane.is-welcome #welcome-message {
    flex: 0 0 auto;
    width: 100%;
    padding: 0;
    margin-bottom: 4px;
}
#chat-pane.is-welcome .input-container {
    flex: 0 0 auto;
    width: 100%;
    max-width: 680px;
    padding-top: 0;
    padding-bottom: max(1.5rem, 5vh);
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text-1); }

.chat-title-display {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.86rem;
    font-weight: 700;
    color: #fff;
    max-width: 40%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.chat-header.has-title .chat-title-display { opacity: 1; }

.chat-action-dialog {
    position: fixed;
    inset: 0;
    width: min(420px, calc(100vw - 32px));
    margin: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-1);
    color: var(--text-1);
    box-shadow: var(--shadow-pop);
}
.chat-action-dialog::backdrop {
    background: rgba(5, 5, 7, 0.72);
    backdrop-filter: blur(4px);
}
.chat-action-form {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 14px;
    padding: 22px;
}
.chat-action-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--pink-dim);
    color: var(--pink-light);
}
.chat-action-dialog.is-delete .chat-action-icon {
    color: var(--err);
    background: rgba(248, 113, 113, 0.1);
}
.chat-action-form h2 {
    margin: 1px 0 5px;
    font-size: 1rem;
    font-weight: 650;
}
.chat-action-form p {
    margin: 0;
    color: var(--text-2);
    font-size: 0.82rem;
    line-height: 1.5;
}
.chat-action-field {
    grid-column: 1 / -1;
    color: var(--text-3);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.chat-action-field input {
    width: 100%;
    margin-top: 7px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: var(--surface-2);
    color: var(--text-1);
    font: inherit;
    font-size: 0.86rem;
    letter-spacing: normal;
    text-transform: none;
}
.chat-action-field input:focus {
    border-color: rgba(236, 72, 153, 0.4);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}
.chat-action-field[hidden] { display: none !important; }
.chat-action-buttons {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
}
.chat-action-buttons button {
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.chat-action-cancel {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
}
.chat-action-confirm {
    border: none;
    background: var(--pink);
    color: #fff;
}
.chat-action-dialog.is-delete .chat-action-confirm { background: var(--err); }

.chat-header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; z-index: 6; }
.header-pill-btn {
    border: 1px solid var(--pink);
    background: var(--pink);
    color: #fff;
    border-radius: var(--r-pill);
    padding: 5px 12px;
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.header-pill-btn:hover { background: var(--pink-light); border-color: var(--pink-light); color: #fff; }
.credit-wallet { display: none; }

#chat-stream {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem 1.25rem;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.chat-history-loading,
.chat-history-load-error {
    margin: auto;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-3);
    font-size: 0.84rem;
}
.chat-history-load-error { flex-direction: column; }
.chat-history-load-error p { margin: 0; }
.chat-history-load-error button {
    border: 1px solid var(--border-soft);
    border-radius: 9px;
    padding: 7px 12px;
    background: var(--surface-1);
    color: var(--text-2);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}
.chat-history-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--pink-light);
    border-radius: 50%;
    animation: chat-history-spin 0.75s linear infinite;
}
@keyframes chat-history-spin { to { transform: rotate(360deg); } }

#welcome-message {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem;
}
.welcome-inner {
    text-align: center;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
}
.hero-greeting {
    margin: 0;
    font-family: var(--font-sans);
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 450;
    line-height: 1.35;
    color: var(--text-1);
    letter-spacing: -0.02em;
    text-align: center;
}
.name-accent {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    color: var(--pink-light);
    padding-inline: 0.18em;
    margin-inline: 0.06em;
}
.hero-tagline {
    margin: 0.7rem 0 0;
    font-family: var(--font-sans);
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    font-weight: 400;
    color: var(--text-2);
    letter-spacing: -0.01em;
    line-height: 1.4;
}

.message {
    width: 100%;
    max-width: 720px;
    margin: 0 auto 1.1rem;
    display: flex;
    animation: msgIn 0.22s var(--ease);
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.message.user { justify-content: flex-end; }
.message.ai { justify-content: flex-start; }

.msg-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: min(100%, 520px);
}
.message.user .msg-body { align-items: flex-end; }
.message.ai .msg-body { align-items: flex-start; max-width: min(100%, 640px); }

.avatar { display: none; }

.msg-content {
    line-height: 1.65;
    font-size: 0.94rem;
    max-width: 100%;
    word-break: break-word;
}
.message.ai .msg-content {
    padding: 0;
    color: var(--text-1);
}
.message.user .msg-content {
    background: var(--user-bubble);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 0.6rem 0.9rem;
    color: var(--text-1);
    max-width: 300px;
}

.response-meta {
    font-size: 0.72rem;
    color: var(--text-3);
    padding-left: 2px;
}

.msg-content pre {
    background: #101014;
    border-radius: 10px;
    overflow-x: auto;
    margin: 0.75rem 0;
    border: 1px solid var(--border-soft);
    position: relative;
}
.msg-content pre code { font-family: var(--font-code); font-size: 0.84em; }
.msg-content pre code .code-line-wrapper { display: grid; grid-template-columns: auto 1fr; gap: 0.65rem; padding: 0 0.85rem; }
.msg-content pre code .line-number { text-align: right; color: rgba(255,255,255,0.2); user-select: none; min-width: 1.8em; }
.code-copy-btn {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    background: rgba(255,255,255,0.08);
    color: #f8f8f2;
    border: none;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    font-size: 0.72rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.18s;
}
.msg-content pre:hover .code-copy-btn { opacity: 1; }
.msg-content img, .msg-content video,
.msg-media {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 0.25rem;
    border: 1px solid var(--border-soft);
}
.document-attachment {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 220px;
    max-width: 340px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-1);
}
.message.user .document-attachment { background: var(--user-bubble); }
.document-attachment-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}
.document-attachment-copy { min-width: 0; }
.document-attachment-copy strong,
.document-attachment-copy small { display: block; }
.document-attachment-copy strong {
    overflow: hidden;
    color: var(--text-1);
    font-size: 0.82rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.document-attachment-copy small {
    margin-top: 2px;
    color: var(--text-3);
    font-size: 0.68rem;
}

.msg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    margin-top: 2px;
    padding: 0;
    border: none;
}
.message.user .msg-actions { justify-content: flex-end; }
.message.ai .msg-actions { justify-content: flex-start; }

.action-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-3);
    padding: 2px 6px;
    font-size: 0.72rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.12s;
}
.action-btn:hover { color: var(--text-2); }

.typing-bubble {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 10px 14px;
    display: inline-flex;
    gap: 10px;
    align-items: center;
    max-width: min(100%, 420px);
}
.typing-bubble-inner { display: inline-flex; align-items: center; gap: 10px; }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; flex-shrink: 0; }
.typing-status-text {
    font-size: 0.82rem;
    color: var(--text-2);
    white-space: nowrap;
}
.message.ai.is-processing .msg-body { align-items: flex-start; }
.message.ai.is-streaming .msg-content::after {
    content: '▍';
    display: inline-block;
    color: var(--pink);
    animation: blink-cursor 0.9s step-end infinite;
    margin-left: 1px;
}
@keyframes blink-cursor { 50% { opacity: 0; } }

.typing-dot {
    width: 4px;
    height: 4px;
    background: var(--text-3);
    border-radius: 50%;
    animation: bounce 1.3s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* Input */
.input-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1.25rem 1.25rem;
    width: 100%;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.chat-input-wrapper {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 4px 6px 4px 4px;
    box-shadow: var(--shadow-composer);
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.mention-suggestions {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: calc(100% + 6px);
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    box-shadow: var(--shadow-pop);
    padding: 4px;
    z-index: 30;
    max-height: 220px;
    overflow-y: auto;
}

.mention-suggestions[hidden] {
    display: none !important;
}

.mention-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
}

.mention-suggestion:hover,
.mention-suggestion.is-active {
    background: var(--surface-3);
}

.mention-suggestion small {
    display: block;
    color: var(--text-muted);
    font-size: 0.74rem;
    margin-top: 1px;
}

.mention-suggestion .mention-tag {
    font-weight: 600;
    color: var(--pink-light);
}

.msg-content .connection-mention {
    display: inline;
    padding: 1px 6px;
    margin: 0 1px;
    border-radius: 6px;
    background: var(--pink-dim);
    color: var(--pink-light);
    font-weight: 600;
    font-size: 0.92em;
}
.chat-input-wrapper:focus-within {
    border-color: rgba(236, 72, 153, 0.38);
    box-shadow: var(--shadow-composer), 0 0 0 1px rgba(236, 72, 153, 0.12);
}

#mode-badge {
    display: none;
    margin: 4px 12px 0;
    padding: 3px 9px;
    border-radius: var(--r-pill);
    background: var(--pink-dim);
    color: var(--pink-light);
    font-size: 0.74rem;
    font-weight: 600;
    align-self: flex-start;
}
#mode-badge.active { display: inline-flex; }

.input-gemini-row { display: flex; align-items: center; gap: 2px; min-height: 46px; }

.pill-icon-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    transition: background 0.15s, color 0.15s;
}
.pill-icon-btn:hover { background: var(--hover); color: var(--text-1); }
#tools-btn { color: var(--pink-light); }
#tools-btn:hover { background: var(--pink-dim); color: var(--pink-light); }
.pill-icon-btn.is-listening {
    color: var(--pink);
    background: var(--pink-dim);
    animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.35); }
    50% { box-shadow: 0 0 0 6px rgba(236, 72, 153, 0); }
}

textarea#chat-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    color: var(--text-1);
    max-height: 160px;
    font-size: 0.96rem;
    font-family: var(--font-sans);
    line-height: 1.5;
    padding: 11px 6px;
}
textarea#chat-input::placeholder { color: var(--text-3); }

.input-trailing { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.header-mode-wrap { position: relative; }

.model-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border: none;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--text-2);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.model-pill-btn:hover { background: var(--hover); color: var(--text-1); }

.send-btn {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: var(--pink);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s, background 0.15s, color 0.15s;
}
.send-btn.bg-gradient,
.send-btn.bg-gradient:hover {
    background: var(--pink);
    color: #fff;
}
.suggestion-row { display: none !important; }
.input-disclaimer { font-size: 0.65rem; color: var(--text-3); }
.input-disclaimer a { color: var(--text-3); text-decoration: underline; text-underline-offset: 2px; }
.input-disclaimer a:hover { color: var(--text-2); }
.send-btn:hover { transform: scale(1.04); background: var(--pink-light); color: #fff; }
.send-btn.btn-danger { background: var(--err) !important; color: #fff !important; }

.suggestion-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}
.suggestion-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-2);
    font-size: 0.8rem;
    font-weight: 450;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, color 0.18s;
}
.suggestion-chip i { color: var(--pink); font-size: 0.78rem; opacity: 0.85; }
.suggestion-chip:hover { border-color: rgba(236, 72, 153, 0.35); background: var(--pink-dim); color: var(--text-1); }

.input-disclaimer {
    text-align: center;
    font-size: 0.68rem;
    color: var(--text-3);
    margin: 0.7rem 0 0;
}
.char-count-wrap { text-align: center; margin-top: 4px; font-size: 0.7rem; color: var(--text-3); }

.custom-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    width: 210px;
    padding: 5px;
    z-index: 130;
    display: none;
    flex-direction: column;
    box-shadow: var(--shadow-pop);
}
.tools-btn-wrap { position: relative; }
.mode-dropdown { right: 0; left: auto; }
.custom-dropdown.show { display: flex; }
.dropdown-item-custom {
    padding: 0.5rem 0.65rem;
    border-radius: var(--r-md);
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    font-size: 0.84rem;
    transition: background 0.14s;
}
.dropdown-item-custom i { color: var(--text-3); width: 1rem; text-align: center; }
.dropdown-item-custom small { display: block; color: var(--text-3); font-size: 0.65rem; margin-top: 1px; }
.dropdown-item-custom:hover, .dropdown-item-custom.active { background: var(--pink-dim); color: var(--pink-light); }
.dropdown-item-custom.disabled {
    color: var(--text-3);
    cursor: not-allowed;
    opacity: 0.55;
    pointer-events: none;
}
.dropdown-item-custom.disabled:hover { background: transparent; color: var(--text-3); }

#attachment-preview {
    position: absolute;
    bottom: calc(100% - 2px);
    left: 22px;
    background: var(--surface-1);
    padding: 8px;
    border-radius: 10px;
    box-shadow: var(--shadow-pop);
    border: 1px solid var(--border);
    display: none;
}
#attachment-preview.show { display: block; }
#attachment-preview .remove-btn {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: var(--text-1);
    color: var(--bg-body);
    font-size: 10px;
    cursor: pointer;
}

#drag-drop-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(14, 12, 18, 0.82);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}
#drag-drop-overlay.show { display: flex; }
.drag-drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    padding: 2rem 2.5rem;
    border: 1px dashed rgba(236, 72, 153, 0.45);
    border-radius: var(--r-xl);
    color: var(--pink-light);
}

.scroll-fab {
    position: absolute;
    bottom: 128px;
    right: 24px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-1);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scroll-fab.show { opacity: 1; visibility: visible; }

#resizer { width: 10px; margin: 0 -5px; cursor: col-resize; display: none; position: relative; flex-shrink: 0; z-index: 60; }
#resizer::after { content: ''; position: absolute; inset: 0 auto 0 4px; width: 2px; background: transparent; transition: background 0.2s; }
#resizer:hover::after, #workspace.resizing #resizer::after { background: var(--pink); }

#canvas-pane {
    width: 0;
    background: var(--bg-body);
    border-left: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    transition: width 0.4s var(--ease);
    overflow: hidden;
}
#canvas-pane.open { width: 52%; }
.canvas-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-1);
}
.canvas-header-title { font-weight: 600; font-size: 0.92rem; }
.canvas-tabs {
    display: flex;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-soft);
    background: var(--surface-1);
    overflow-x: auto;
    flex-shrink: 0;
}
.canvas-tabs.hidden { display: none; }
.canvas-tab {
    border: 1px solid var(--border-soft);
    background: transparent;
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.28rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.canvas-tab:hover { color: var(--text-primary); border-color: var(--pink-dim); }
.canvas-tab.active {
    background: var(--pink-dim);
    color: var(--pink-light);
    border-color: transparent;
}
iframe#preview-frame { flex: 1; border: none; background: #fff; width: 100%; }
.preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.9rem;
    margin-top: 0.6rem;
    background: var(--pink-dim);
    border: none;
    border-radius: var(--r-md);
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--pink-light);
    cursor: pointer;
}
.preview-btn:hover { background: var(--pink); color: #fff; }

/* Modals */
.alara-modal { background: var(--surface-1) !important; border: 1px solid var(--border) !important; border-radius: var(--r-xl) !important; }
.alara-modal--wide { background: var(--bg-sidebar) !important; }
.field-label { display: block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.alara-input { border-radius: var(--r-md) !important; padding: 11px 13px !important; }

.settings-modal { overflow: hidden; box-shadow: var(--shadow-pop); }
.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border-soft);
}
.settings-modal-header .modal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.settings-modal-body {
    padding: 18px 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.settings-band { min-width: 0; }
.settings-email-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.settings-email-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
}
.settings-email-copy { min-width: 0; }
.settings-email-copy #settings-email {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-1);
    word-break: break-word;
}
.settings-email-hint {
    margin: 3px 0 0;
    font-size: 0.72rem;
    color: var(--text-3);
}
.settings-email-hint[hidden] { display: none !important; }
.plan-card-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
}
.plan-card-icon { width: 40px; height: 40px; border-radius: var(--r-md); background: var(--pink-dim); color: var(--pink); display: flex; align-items: center; justify-content: center; }
.manage-plan-btn {
    margin-left: auto;
    border: none;
    border-radius: var(--r-pill);
    padding: 7px 16px;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: #fff;
    font-weight: 600;
    font-size: 0.84rem;
    cursor: pointer;
}
.settings-integrations-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    padding: 11px 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    background: transparent;
    color: var(--text-1);
    font-size: 0.86rem;
    font-weight: 550;
    cursor: pointer;
    text-align: left;
    transition: background 0.14s, border-color 0.14s;
}
.settings-integrations-row > i:first-child { color: var(--pink-light); width: 16px; text-align: center; }
.settings-integrations-chevron { margin-left: auto; font-size: 0.62rem; color: var(--text-3); }
.settings-integrations-row:hover {
    background: var(--hover);
    border-color: var(--border);
}
.settings-modal-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    text-align: center;
}
.modal-legal { border-top: 1px solid var(--border-soft); }
.legal-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 0.74rem;
    color: var(--text-3);
}
.legal-links a,
.legal-links button {
    border: none;
    background: none;
    padding: 0;
    color: var(--text-3);
    font: inherit;
    cursor: pointer;
}
.legal-links a:hover,
.legal-links button:hover { color: var(--text-2); }
.copyright { text-align: center; font-size: 0.7rem; color: var(--text-3); margin: 0; }

.billing-toggle-wrap { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 1.25rem; }
.form-check-input:checked { background-color: var(--pink) !important; border-color: var(--pink) !important; }
.save-badge { background: var(--pink); color: #fff; font-size: 0.65rem; border-radius: var(--r-pill); padding: 2px 7px; margin-left: 4px; }

.pricing-card {
    border: 1px solid var(--border);
    background: var(--surface-1);
    border-radius: var(--r-xl);
    padding: 1.35rem;
    text-align: center;
    transition: transform 0.2s var(--ease), border-color 0.2s;
    display: flex;
    flex-direction: column;
}
.pricing-card:hover { transform: translateY(-3px); border-color: rgba(236, 72, 153, 0.25); }
.pricing-card--featured { border-color: rgba(236, 72, 153, 0.45); background: linear-gradient(180deg, var(--surface-1), rgba(236, 72, 153, 0.05)); position: relative; overflow: hidden; }
.fest-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--pink);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 4px;
}
.plan-features { list-style: none; padding: 0; margin: 0 0 1rem; text-align: left; font-size: 0.86rem; flex-grow: 1; }
.plan-features li { margin-bottom: 0.45rem; display: flex; align-items: flex-start; gap: 8px; }
.plan-features i.fa-check { color: var(--ok); margin-top: 3px; }
.price-accent { color: var(--pink) !important; }
.upgrade-btn {
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: #fff;
    border: none;
    border-radius: var(--r-pill);
    padding: 10px 20px;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(236, 72, 153, 0.25);
    transition: transform 0.18s;
}
.upgrade-btn:hover { transform: translateY(-2px); color: #fff; }
.upgrade-btn.disabled-plan, .plan-cta:disabled { background: var(--surface-3) !important; color: rgba(255,255,255,0.35) !important; box-shadow: none !important; transform: none !important; }
.plan-cta--elite { background: #2e1065 !important; color: #c4b5fd !important; border: 1px solid rgba(139,92,246,0.35) !important; }
.plan-cta--luxury { background: #064e3b !important; color: #6ee7b7 !important; border: 1px solid rgba(16,185,129,0.35) !important; }

.toast-anchor {
    position: fixed;
    top: max(72px, calc(env(safe-area-inset-top, 0px) + 64px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1060;
    pointer-events: none;
    width: max-content;
    max-width: min(92vw, 440px);
}
.toast-anchor .toast-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    pointer-events: auto;
}
.toast-anchor .toast {
    pointer-events: auto;
    min-width: 220px;
    max-width: min(92vw, 420px);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-pop);
}
.toast-anchor .toast .toast-flex {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.toast-anchor .toast .toast-body {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    font-size: 0.85rem;
    line-height: 1.35;
    padding: 10px 0 10px 14px;
    color: var(--text-1);
    white-space: normal;
    word-break: normal;
}
.toast-anchor .toast .btn-close {
    flex-shrink: 0;
    margin: 0 10px 0 0;
    opacity: 0.55;
}
.toast { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-pop); }
.toast.toast-success { background: var(--pink-dim); border-color: rgba(236, 72, 153, 0.4); }
.toast.toast-success .toast-body { color: var(--pink-light); }

.quota-banner {
    background: rgba(248, 113, 113, 0.08);
    color: #fca5a5;
    padding: 8px 12px;
    border-radius: var(--r-md);
    margin-bottom: 8px;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(248, 113, 113, 0.18);
}
.quota-banner.d-none { display: none !important; }

/* Consent & cookie notice */
.cookie-banner {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1040;
    width: min(640px, calc(100vw - 24px));
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 14px 16px;
    box-shadow: var(--shadow-pop);
    display: none;
}
.cookie-banner.show { display: block; animation: riseIn 0.35s var(--ease) both; }
.cookie-banner-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cookie-banner-text { flex: 1; min-width: 220px; font-size: 0.82rem; color: var(--text-2); line-height: 1.5; }
.cookie-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cookie-btn {
    border: none;
    border-radius: var(--r-pill);
    padding: 7px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.cookie-btn--ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.cookie-btn--ghost:hover { background: var(--hover); color: var(--text-1); }
.cookie-btn--primary { background: linear-gradient(135deg, var(--pink), var(--purple)); color: #fff; }

.consent-notice-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    margin: 12px 0 16px;
}
.consent-notice-table th,
.consent-notice-table td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}
.consent-notice-table th { background: var(--surface-2); color: var(--text-1); font-weight: 600; }
.consent-notice-table td { color: var(--text-2); }
.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.86rem;
    color: var(--text-2);
    cursor: pointer;
}
.consent-check input { margin-top: 3px; accent-color: var(--pink); flex-shrink: 0; }
.consent-check a { color: var(--pink-light); }
.consent-check--optional { opacity: 0.92; }
.consent-modal-lead { font-size: 0.9rem; color: var(--text-2); line-height: 1.55; margin-bottom: 4px; }
.consent-modal-note { font-size: 0.76rem; color: var(--text-3); margin-top: 12px; line-height: 1.45; }

/* Workspace views — Connections */
#workspace[data-view="chat"] #integrations-pane,
#workspace[data-view="chat"] #connectors-pane { display: none !important; }
#workspace[data-view="integrations"] #chat-pane,
#workspace[data-view="integrations"] #connectors-pane,
#workspace[data-view="integrations"] #resizer,
#workspace[data-view="integrations"] #canvas-pane { display: none !important; }
#workspace[data-view="connectors"] #chat-pane,
#workspace[data-view="connectors"] #integrations-pane,
#workspace[data-view="connectors"] #resizer,
#workspace[data-view="connectors"] #canvas-pane { display: none !important; }
#workspace[data-view="integrations"] #integrations-pane,
#workspace[data-view="connectors"] #connectors-pane { display: flex; flex: 1; min-width: 0; }

.workspace-view-pane {
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: var(--bg-body);
}
.workspace-view-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--surface-1);
    flex-shrink: 0;
}
.workspace-view-header--centered {
    position: relative;
    justify-content: center;
    align-items: center;
    padding-top: 18px;
    padding-bottom: 16px;
}
.workspace-back-btn {
    flex-shrink: 0;
}
.workspace-view-header--centered .workspace-back-btn {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
}
.workspace-view-header--centered .workspace-view-header-text {
    text-align: center;
    max-width: 520px;
}
.workspace-view-header-text { min-width: 0; }
.workspace-view-title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.2;
}
.workspace-view-subtitle {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: var(--text-3);
}
.workspace-view-body {
    flex: 1;
    overflow: auto;
    padding: 14px 16px 24px;
}
.connections-body { width: 100%; }
.connections-page {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}
.connections-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
    width: 100%;
}
.connection-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface-1);
    padding: 12px;
    min-height: 0;
}
.connection-card--setup:not(.is-connected) {
    grid-column: 1 / -1;
}
.connection-card.is-connected { border-color: rgba(236, 72, 153, 0.35); }
.connection-card--soon { opacity: 0.82; }
.connection-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}
.connection-card-meta {
    flex: 1;
    min-width: 0;
}
.connection-card-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.connection-card-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.connection-card-logo--muted img { opacity: 0.85; filter: brightness(1.15); }
.connection-card-title {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.2;
}
.connection-card-desc {
    margin: 6px 0 0;
    font-size: 0.72rem;
    color: var(--text-3);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.connection-tag {
    display: inline-block;
    margin-top: 2px;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-3);
    letter-spacing: 0.02em;
}
.integration-status {
    flex-shrink: 0;
    margin: 0;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--hover);
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.integration-status[data-state="connected"] {
    background: var(--pink-dim);
    color: var(--pink-light);
}
.integration-status--soon {
    background: transparent;
    border: 1px dashed var(--border);
    font-size: 0.58rem;
}
.integration-form {
    margin-top: 10px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.connection-btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--pink), #a855f7);
}
.connection-btn:hover { filter: brightness(1.06); }
.connection-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.connection-btn--ghost {
    color: var(--text-2);
    background: var(--hover);
    border: 1px solid var(--border-soft);
}
.alara-input--sm {
    padding: 7px 10px !important;
    font-size: 0.78rem !important;
    min-height: 0 !important;
}
.higgsfield-api-advanced {
    margin-top: 2px;
    font-size: 0.72rem;
    color: var(--text-3);
}
.higgsfield-api-advanced summary {
    cursor: pointer;
    color: var(--text-3);
    font-size: 0.7rem;
    padding: 2px 0;
}
.higgsfield-api-advanced[open] {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.integration-hint { font-size: 0.68rem; color: var(--text-3); margin: 0; }
.integration-hint a { color: var(--pink-light); }
.integration-hint code, .integration-connected-text code {
    font-size: 0.85em;
    background: var(--hover);
    padding: 1px 5px;
    border-radius: 4px;
}
.integration-connected { margin-top: 8px; width: 100%; }
.integration-connected-text { font-size: 0.7rem; color: var(--text-3); margin: 0 0 6px; }
.workspace-guest-card {
    max-width: 420px;
    margin: 24px auto;
    text-align: center;
    padding: 28px 22px;
    border-radius: var(--r-lg);
    border: 1px solid var(--border-soft);
    background: var(--surface-1);
}
.workspace-guest-card i { font-size: 1.6rem; color: var(--pink-light); margin-bottom: 12px; }
.workspace-guest-card h2 { font-size: 1.1rem; margin-bottom: 8px; }
.workspace-guest-card p { font-size: 0.86rem; color: var(--text-3); margin-bottom: 16px; }
.connections-trademark {
    margin-top: 16px;
    font-size: 0.68rem;
    color: var(--text-3);
    line-height: 1.5;
    text-align: left;
}
.connections-trademark a { color: var(--pink-light); }

@media (max-width: 420px) {
    .connections-grid { grid-template-columns: 1fr; }
    .connection-card--setup:not(.is-connected) { grid-column: auto; }
}

@media (max-width: 767px) {
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        width: var(--sidebar-expanded) !important;
        box-shadow: var(--shadow-pop);
        transition: transform 0.28s var(--ease);
    }
    #sidebar.open { transform: translateX(0); }
    #sidebar.open .sidebar-rail { display: none; }
    #sidebar.open .sidebar-panel { display: flex; opacity: 1; }
    body.sidebar-open-mobile::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 40;
    }
    .hero-line-1 { font-size: clamp(2rem, 8.5vw, 2.6rem); }
    .message { max-width: 96%; }
    #canvas-pane.open { position: fixed; inset: 0; width: 100% !important; height: 100%; z-index: 60; }
    #resizer { display: none !important; }
}

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

/* Bottom-right More menu (API + feedback) */
.chat-more {
    position: fixed;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 35;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}
.chat-more > * { pointer-events: auto; }
.chat-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-2);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-composer);
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.chat-more-btn:hover,
.chat-more-btn[aria-expanded="true"] {
    border-color: rgba(244, 114, 182, 0.45);
    color: var(--text-1);
    background: var(--surface-2);
}
.chat-more-dots {
    font-size: 1.05rem;
    line-height: 1;
    letter-spacing: 0.02em;
}
.chat-more-popover {
    min-width: 168px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    box-shadow: var(--shadow-pop);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chat-more-popover[hidden] { display: none !important; }
.chat-more-link {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-1);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 550;
}
.chat-more-link:hover {
    background: var(--hover);
}

@media (max-width: 720px) {
    .chat-more {
        bottom: max(72px, calc(env(safe-area-inset-bottom) + 64px));
    }
}

