/* =========================================================
   PRESTIA — Main Styles
   Intelligence, Elevated.
   ========================================================= */

:root {
    --bg: #f8f6f1;
    --bg-secondary: #edf1eb;
    --bg-tertiary: #e3e9e2;
    --surface: #fffdf8;
    --surface-hover: #e8efe8;
    --border: #d9e1d8;
    --text: #18251f;
    --text-secondary: #68766d;
    --text-muted: #8b978e;
    --accent: #183c31;
    --accent-text: #fffdf8;
    --danger: #b5483d;
    --success: #34745d;
    --shadow: 0 16px 45px rgba(39, 47, 39, 0.1);
    --sidebar-width: 270px;
    --topbar-height: 64px;
    --radius: 14px;
}

html.dark {
    --bg: #101714;
    --bg-secondary: #17221c;
    --bg-tertiary: #223129;
    --surface: #1b2821;
    --surface-hover: #26372d;
    --border: #34483b;
    --text: #eef5ef;
    --text-secondary: #aabbb0;
    --text-muted: #819388;
    --accent: #c8e0d0;
    --accent-text: #183c31;
    --danger: #ff6b61;
    --success: #49c27c;
    --shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

/* =========================================================
   RESET
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    transition: background 0.25s ease, color 0.25s ease;
}

body.auth-pending {
    display: grid;
    place-items: center;
    background: var(--bg);
}

body.auth-pending::before {
    content: "PRESTIA";
    color: var(--accent);
    font-size: 14px;
    font-weight: 850;
    letter-spacing: 0.16em;
}

body.auth-pending .app {
    display: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input,
textarea,
select {
    outline: none;
}

.hidden {
    display: none !important;
}

.auth-consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.auth-consent input {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    margin-top: 2px;
}

.auth-consent a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: underline;
}

/* =========================================================
   APP LAYOUT
   ========================================================= */

.app {
    display: flex;
    width: 100%;
    height: 100vh;
    background: var(--bg);
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 18px 12px;
    overflow-y: auto;
    scrollbar-width: auto;
    scrollbar-color: var(--text-muted) transparent;
    transition:
        width 0.25s ease,
        transform 0.25s ease,
        background 0.25s ease;
    z-index: 50;
}

.sidebar-header {
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    margin: 0 8px 20px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 850;
    letter-spacing: 0.14em;
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    background: transparent;
}

.brand-mark img,
.auth-logo img,
.welcome-logo img,
.signup-welcome-mark img {
    width: 100%;
    height: 100%;
    background: transparent;
    object-fit: contain;
    border-radius: inherit;
    mix-blend-mode: multiply;
}

.new-chat-button {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
    border-radius: 11px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 13px;
    font-weight: 750;
    box-shadow: 0 8px 18px rgba(24, 60, 49, 0.14);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.new-chat-button:hover {
    opacity: 0.9;
}

.new-chat-button:active {
    transform: translateY(1px);
}

.recent-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-top: 20px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 9px 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sidebar-scroll-button {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1;
}

.sidebar-scroll-button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.sidebar-collapse-button {
    position: absolute;
    top: 17px;
    right: -13px;
    z-index: 3;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    box-shadow: var(--shadow);
}

.sidebar-collapse-button:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.sidebar.collapsed {
    width: 76px;
}

.sidebar.collapsed .brand span,
.sidebar.collapsed .new-chat-button span:last-child,
.sidebar.collapsed .sidebar-button span:last-child,
.sidebar.collapsed .sidebar-nav-item span:last-child,
.sidebar.collapsed .section-heading,
.sidebar.collapsed .chat-history,
.sidebar.collapsed .sidebar-profile-info,
.sidebar.collapsed .sidebar-profile-arrow,
.sidebar.collapsed .plan-card {
    display: none;
}

.sidebar.collapsed .brand,
.sidebar.collapsed .new-chat-button,
.sidebar.collapsed .sidebar-button,
.sidebar.collapsed .sidebar-nav-item,
.sidebar.collapsed .sidebar-profile {
    justify-content: center;
}

.sidebar.collapsed .sidebar-collapse-button {
    right: -13px;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-top h2 {
    margin: 4px 8px 18px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.new-chat {
    width: 100%;
    min-height: 44px;
    border-radius: 10px;
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 600;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.new-chat:hover {
    opacity: 0.88;
}

.new-chat:active {
    transform: scale(0.98);
}

.sidebar-button {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    text-align: left;
    transition: background 0.15s ease;
}

.sidebar-button:hover {
    background: var(--surface-hover);
}

.sidebar h3 {
    margin: 22px 9px 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.chat-history {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}

.chat-history::-webkit-scrollbar {
    width: 9px;
}

.chat-history::-webkit-scrollbar-thumb {
    min-height: 42px;
    background: var(--text-muted);
    border-radius: 20px;
}

.sidebar::-webkit-scrollbar {
    width: 9px;
}

.sidebar::-webkit-scrollbar-track,
.chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    min-height: 42px;
    border: 2px solid transparent;
    border-radius: 20px;
    background: var(--text-muted);
    background-clip: padding-box;
}

.sidebar-bottom {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.plan-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 2px 10px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.plan-card:hover {
    border-color: var(--success);
    background: var(--surface-hover);
}

.plan-card:active {
    transform: translateY(1px);
}

.plan-card-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.plan-card-label {
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
}

.plan-card-copy small {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 9px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.upgrade-button {
    flex-shrink: 0;
    min-height: 28px;
    padding: 0 9px;
    border-radius: 7px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 10px;
    font-weight: 800;
}

.upgrade-button:hover {
    opacity: 0.86;
}

/* =========================================================
   SIDEBAR NAVIGATION
   ========================================================= */

.sidebar-section {
    margin-top: 8px;
}

.sidebar-nav-item {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 11px;
    margin-bottom: 3px;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    text-align: left;
    transition: background 0.15s ease;
}

.sidebar-nav-item:hover {
    background: var(--surface-hover);
}

.sidebar-nav-item.active {
    background: var(--surface-hover);
    font-weight: 600;
}

.sidebar-nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* =========================================================
   RECENT CHAT ITEMS
   ========================================================= */

.chat-history-section {
    margin-bottom: 10px;
}

.chat-history-label {
    padding: 8px 9px 5px;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 700;
}

.chat-item,
.chat-history-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-height: 40px;
    padding: 6px 7px 6px 10px;
    margin-bottom: 2px;
    border-radius: 9px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease;
}

.chat-item:hover,
.chat-history-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.chat-item.active,
.chat-history-item.active {
    background: var(--surface-hover);
    color: var(--text);
}

.empty-chat-history {
    padding: 12px 9px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

html.dark .chat-history,
html.dark .chat-item,
html.dark .chat-history-item,
html.dark .empty-chat-history {
    color: var(--text-secondary);
}

html.dark .chat-item:hover,
html.dark .chat-item.active,
html.dark .chat-history-item:hover,
html.dark .chat-history-item.active {
    background: var(--surface-hover);
    color: var(--text);
}

.chat-item-title,
.chat-history-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
}

.chat-item-pin,
.pin-indicator {
    flex-shrink: 0;
    font-size: 11px;
}

.chat-item-menu-button,
.chat-history-menu {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.chat-item:hover .chat-item-menu-button,
.chat-history-item:hover .chat-history-menu,
.chat-history-item.active .chat-history-menu {
    opacity: 1;
}

.chat-item-menu-button:hover,
.chat-history-menu:hover {
    background: var(--bg-tertiary);
    color: var(--text);
}

.chat-history-main {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    overflow: hidden;
    background: transparent;
    color: inherit;
    text-align: left;
}

.chat-history-icon {
    flex: 0 0 20px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.chat-history-menu {
    opacity: 0;
    background: transparent;
    color: var(--text-muted);
}

html.dark .chat-history-main {
    color: inherit;
}

/* =========================================================
   MAIN AREA
   ========================================================= */

.main {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
    height: var(--topbar-height);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(16px);
    z-index: 70;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-brand,
.current-section-title {
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
}

.current-section-title {
    color: var(--text-secondary);
    font-weight: 550;
}

.topbar h2 {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 17px;
    font-weight: 750;
    letter-spacing: -0.3px;
}

.icon-button {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font-size: 19px;
    transition: background 0.15s ease;
}

.mobile-menu-button {
    display: none;
}

.icon-button:hover {
    background: var(--surface-hover);
}

/* =========================================================
   PROFILE
   ========================================================= */

.profile-container {
    position: relative;
}

.profile-button {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 12px;
    font-weight: 700;
}

.profile-button img {
    width: 25px;
    height: 25px;
    object-fit: contain;
    border-radius: 50%;
}

.profile-menu {
    position: absolute;
    top: 46px;
    right: 0;
    width: 230px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: var(--shadow);
    z-index: 200;
}

.profile-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    object-fit: contain;
    border-radius: 50%;
}

.profile-name {
    padding: 8px 10px 2px;
    font-size: 14px;
    font-weight: 700;
}

.profile-email {
    padding: 0 10px 9px;
    color: var(--text-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu button {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    text-align: left;
}

.profile-menu button:hover {
    background: var(--surface-hover);
}

/* =========================================================
   MODE SWITCHER
   ========================================================= */

.mode-switcher {
    position: absolute;
    left: 50%;
    top: 73px;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    box-shadow: 0 8px 22px rgba(39, 47, 39, 0.08);
}

.mode-button {
    min-width: 82px;
    height: 32px;
    padding: 0 12px;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.mode-button:hover {
    color: var(--text);
}

.mode-button.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08);
}

html.dark .mode-button.active {
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

/* =========================================================
   CHAT AREA
   ========================================================= */

.chat-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 110px 20px 150px;
    scrollbar-width: auto;
    scrollbar-color: var(--text-muted) transparent;
    background:
        linear-gradient(135deg, color-mix(in srgb, #dfe9df 25%, transparent), transparent 38%),
        var(--bg);
    scroll-behavior: smooth;
}

.chat-area::-webkit-scrollbar {
    width: 11px;
}

.chat-area::-webkit-scrollbar-track {
    background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
    min-height: 54px;
    border: 2px solid transparent;
    border-radius: 20px;
    background: var(--text-muted);
    background-clip: padding-box;
}

.chat-area::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
    background-clip: padding-box;
}

#chat {
    width: min(850px, 100%);
    margin: 0 auto;
}

/* =========================================================
   WELCOME
   ========================================================= */

.welcome {
    width: min(850px, 100%);
    margin: 70px auto 30px;
    text-align: center;
}

.welcome h1 {
    margin: 0 0 10px;
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1.1;
    letter-spacing: -1.5px;
}

.welcome p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 15px;
}

.website-task-form {
    margin: 28px auto 0;
    padding: 22px;
    max-width: 760px;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.website-task-heading {
    display: grid;
    gap: 5px;
    margin-bottom: 18px;
}

.website-task-heading span,
.website-task-form label {
    color: var(--text-secondary);
    font-size: 12px;
}

.website-task-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.website-task-form label {
    display: grid;
    gap: 7px;
}

.website-task-form input,
.website-task-form textarea,
.website-task-form select {
    width: 100%;
    padding: 11px 12px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    resize: vertical;
}

.website-task-wide {
    grid-column: 1 / -1;
}

.website-approval {
    display: flex !important;
    align-items: center;
    gap: 8px !important;
    margin: 16px 0;
}

.website-approval input {
    width: auto;
}

.website-task-submit {
    width: 100%;
    min-height: 42px;
    border-radius: 9px;
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 750;
}

@media (max-width: 620px) {
    .website-task-grid {
        grid-template-columns: 1fr;
    }

    .website-task-wide {
        grid-column: auto;
    }
}

/* =========================================================
   MESSAGES
   ========================================================= */

.message {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0 auto 25px;
}

.message.user-message {
    justify-content: flex-end;
    align-items: flex-end;
}

.message.assistant-message {
    justify-content: flex-start;
    align-items: flex-start;
}

.message-content {
    max-width: 82%;
    line-height: 1.65;
    font-size: 15px;
}

.message.user-message .message-content {
    padding: 11px 15px;
    border-radius: 17px 17px 5px 17px;
    background: var(--bg-secondary);
}

.message.user-message .file-attachment {
    width: min(320px, 100%);
    margin-top: 10px;
}

.file-attachment-button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
}

.file-attachment-button:hover {
    background: var(--surface-hover);
}

.file-info {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.file-info strong,
.file-info small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-info strong {
    font-size: 12px;
}

.file-info small {
    color: var(--text-secondary);
    font-size: 10px;
}

.message.assistant-message .message-content {
    max-width: 850px;
    color: var(--text);
}

.message-content p {
    margin: 0 0 12px;
}

.message-content p:last-child {

.message-content h3 {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 14px;
}
    margin-bottom: 0;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    margin: 18px 0 8px;
    line-height: 1.3;
}

.message-content ul,
.message-content ol {
    padding-left: 24px;
}

.message-content li {
    margin-bottom: 5px;
}

.message-content blockquote {
    margin: 12px 0;
    padding-left: 14px;
    border-left: 3px solid var(--border);
    color: var(--text-secondary);
}

.message-content a {
    color: inherit;
    text-decoration: underline;
}

.message-content code {
    padding: 2px 5px;
    border-radius: 5px;
    background: var(--bg-secondary);
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9em;
}

.message-content pre {
    position: relative;
    overflow-x: auto;
    margin: 14px 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.message-content pre code {
    padding: 0;
    background: transparent;
    font-size: 13px;
    line-height: 1.6;
}

/* =========================================================
   MESSAGE ACTIONS
   ========================================================= */

.message-actions,
.response-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-3px);
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.message:hover .message-actions,
.message:focus-within .message-actions,
.message:hover .response-actions,
.message:focus-within .response-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.assistant-message .response-actions,
.user-message .user-actions {
    position: relative;
    align-self: flex-start;
}

.user-message .user-actions {
    align-self: flex-end;
}

.message-edit-input {
    width: min(82%, 850px);
    min-height: 72px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    resize: vertical;
    background: var(--surface);
    color: var(--text);
    line-height: 1.5;
}

.message-edit-input:focus {
    border-color: var(--text);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 10%, transparent);
}

.message-edit-controls {
    display: flex;
    gap: 6px;
    margin-top: 7px;
}

.message-edit-controls button {
    min-height: 30px;
    padding: 0 10px;
    border-radius: 7px;
    background: var(--surface-hover);
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
}

.message-edit-controls .message-edit-save {
    background: var(--accent);
    color: var(--accent-text);
}

.response-more-menu {
    position: absolute;
    top: 34px;
    left: 0;
    min-width: 145px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    box-shadow: var(--shadow);
    z-index: 20;
}

.response-more-menu button {
    display: block;
    width: 100%;
    padding: 8px 9px;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-size: 12px;
}

.response-more-menu button:hover {
    background: var(--surface-hover);
}

.message-action,
.response-actions button {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
}

.message-action:hover,
.response-actions button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.message-action.more,
.response-actions .response-more-button {
    font-size: 17px;
}

.ai-activity {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 30px;
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
}

.activity-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.activity-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: activityBounce 1.1s ease-in-out infinite;
}

.activity-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.activity-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes activityBounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* =========================================================
   INPUT AREA
   ========================================================= */

.input-area {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: min(850px, calc(100% - 36px));
    min-height: 62px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 7px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 14px 35px rgba(39, 47, 39, 0.13);
    z-index: 30;
}

.composer-attachments {
    flex: 0 0 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.composer-attachments.hidden {
    display: none;
}

.composer-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 190px;
    max-width: 280px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    box-shadow: 0 7px 18px rgba(39, 47, 39, 0.1);
}

.composer-attachment-icon {
    flex-shrink: 0;
}

.composer-attachment-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.composer-attachment-copy strong,
.composer-attachment-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.composer-attachment-copy strong {
    color: var(--text);
    font-size: 12px;
}

.composer-attachment-copy small,
.composer-attachment-status {
    color: var(--text-muted);
    font-size: 10px;
}

.composer-attachment-status {
    margin-left: auto;
    white-space: nowrap;
}

.composer-attachment-remove {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
}

.composer-attachment-remove:hover {
    background: var(--surface-hover);
    color: var(--danger);
}

.composer-attachment.uploaded .composer-attachment-status {
    color: var(--success);
}

.composer-attachment.upload-failed .composer-attachment-status {
    color: var(--danger);
}

.input-footer {
    width: min(850px, calc(100% - 36px));
    margin: 0 auto;
    padding: 0 8px 9px;
    color: var(--text-muted);
    font-size: 10px;
    text-align: center;
}

html.dark .input-area {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.plus-menu-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.plus-menu {
    position: absolute;
    left: 0;
    bottom: 52px;
    display: flex;
    flex-direction: column;
    min-width: 180px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
    z-index: 40;
}

.plus-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    text-align: left;
}

.plus-menu-item:hover {
    background: var(--surface-hover);
}

#messageInput {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    max-height: 180px;
    padding: 11px 8px;
    border: 0;
    resize: none;
    background: transparent;
    color: var(--text);
    font-size: 15px;
}

#messageInput::placeholder {
    color: var(--text-muted);
}

.input-button,
.send-button {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.15s ease;
}

.input-button {
    background: transparent;
    color: var(--text-secondary);
}

.input-button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.send-button {
    background: var(--accent);
    color: var(--accent-text);
    font-size: 18px;
    font-weight: 700;
}

.send-button:hover {
    opacity: 0.85;
}

.stop-button {
    background: #b5483d;
    color: #ffffff;
    font-size: 13px;
}

.stop-button:hover {
    background: #96392f;
}

.call-button {
    font-size: 17px;
    color: var(--text);
    animation: pulseVoice 1.6s ease-in-out infinite;
}

.call-button.active {
    background: rgba(255, 102, 102, 0.08);
    color: #ff5d5d;
}

.dictation-button {
    font-size: 18px;
}

.screen-share-button {
    font-size: 18px;
}

.plus-button {
    font-size: 22px;
    line-height: 1;
}

@keyframes pulseVoice {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.78;
    }
}

/* =========================================================
   ATTACHMENT PREVIEW
   ========================================================= */

.attachment-preview {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 69px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 220px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.attachment-card img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 7px;
}

.attachment-card-info {
    min-width: 0;
}

.attachment-card-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;
    font-weight: 600;
}

.attachment-card-size {
    color: var(--text-muted);
    font-size: 10px;
}

.attachment-remove {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* =========================================================
   GENERATED MEDIA
   ========================================================= */

.media-result {
    margin-top: 12px;
    max-width: 100%;
}

.media-result img,
.media-result video {
    display: block;
    max-width: min(700px, 100%);
    max-height: 650px;
    border: 1px solid var(--border);
    border-radius: 12px;
    object-fit: contain;
    background: var(--bg-secondary);
}

.media-result-caption {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

/* =========================================================
   OVERLAYS
   ========================================================= */

.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(5px);
    z-index: 200;
}

.modal {
    width: min(560px, 100%);
    max-height: min(750px, 90vh);
    overflow-y: auto;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.modal h2 {
    margin-top: 0;
}

.modal p {
    color: var(--text-secondary);
}

.modal-input,
.modal textarea,
.modal select,
.modal input[type="text"],
.modal input[type="datetime-local"] {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
}

.modal textarea {
    min-height: 120px;
    resize: vertical;
}

.modal-field {
    margin-bottom: 14px;
}

.modal-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

.modal-actions button,
.primary-button {
    min-height: 40px;
    padding: 0 15px;
    border-radius: 9px;
    background: var(--bg-secondary);
    color: var(--text);
    font-weight: 600;
}

.modal-actions .primary-button,
.primary-button {
    background: var(--accent);
    color: var(--accent-text);
}

.modal-actions button:hover {
    opacity: 0.85;
}

/* =========================================================
   SETTINGS
   ========================================================= */

.setting-row {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    padding: 0 12px;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    text-align: left;
}

.setting-row:hover {
    background: var(--surface-hover);
}

.setting-row.active {
    background: var(--surface-hover);
    font-weight: 700;
}

.setting-row.danger {
    color: var(--danger);
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 10px 0 18px;
}

.theme-button {
    min-height: 55px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
}

.theme-option {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.theme-option:hover,
.theme-option.selected,
.theme-option:focus-visible {
    border-color: var(--text);
    background: var(--surface-hover);
    transform: translateY(-1px);
}

/* =========================================================
   SEARCH
   ========================================================= */

.search-results {
    margin-top: 15px;
    max-height: 55vh;
    overflow-y: auto;
}

.search-result {
    padding: 12px;
    border-radius: 9px;
    cursor: pointer;
}

.search-result:hover {
    background: var(--surface-hover);
}

.search-result-title {
    font-weight: 650;
}

.search-result-preview {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
}

/* =========================================================
   LIBRARY
   ========================================================= */

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.library-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.library-card:hover {
    transform: translateY(-2px);
    border-color: var(--text-muted);
}

.library-card-preview {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.library-card-preview img,
.library-card-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.library-file-icon {
    font-size: 38px;
}

.library-card-info {
    min-width: 0;
    padding: 9px;
}

.library-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.library-card-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;
    font-weight: 650;
}

.library-card-type {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 10px;
}

/* =========================================================
   PROJECTS
   ========================================================= */

.projects-list,
.scheduled-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.project-card,
.schedule-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--bg-secondary);
}

.project-card:hover,
.schedule-card:hover {
    background: var(--surface-hover);
}

.project-card-header,
.schedule-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.project-card-title,
.schedule-card-title {
    font-weight: 700;
}

.project-card-description,
.schedule-card-prompt {
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 12px;
}

.project-card-meta,
.schedule-card-meta {
    margin-top: 9px;
    color: var(--text-muted);
    font-size: 11px;
}

/* =========================================================
   FILE VIEWER
   ========================================================= */

.file-viewer-modal {
    width: min(1000px, 96vw);
    height: min(850px, 92vh);
}

.file-viewer-body {
    height: calc(100% - 55px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.file-viewer-body img,
.file-viewer-body video,
.file-viewer-body iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: contain;
}

.file-viewer-body pre {
    margin: 0;
    min-height: 100%;
    padding: 18px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.6;
}

/* =========================================================
   CALL OVERLAY
   ========================================================= */

.call-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(12px);
    z-index: 500;
}

.call-card {
    width: min(390px, calc(100% - 30px));
    padding: 38px 25px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 25px;
    background: var(--surface);
    color: var(--text);
    text-align: center;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.5);
}

.call-avatar {
    width: 82px;
    height: 82px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 35px;
}

.call-card h2 {
    margin: 0;
}

.call-card p {
    color: var(--text-secondary);
    font-size: 13px;
}

.call-animation {
    width: 80px;
    height: 80px;
    margin: 25px auto;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: callSpin 1s linear infinite;
}

@keyframes callSpin {
    to {
        transform: rotate(360deg);
    }
}

.end-call {
    width: 100%;
    min-height: 45px;
    border-radius: 10px;
    background: #e5484d;
    color: white;
    font-weight: 700;
}

.end-call:hover {
    opacity: 0.88;
}

.mute-call {
    margin-bottom: 8px;
    width: 100%;
    min-height: 42px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text);
}

/* =========================================================
   SCREEN SHARING
   ========================================================= */

.screen-share-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 450;
}

.screen-share-card {
    width: min(1100px, 96vw);
    max-height: 92vh;
    padding: 18px;
    border-radius: 17px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.screen-share-card video {
    width: 100%;
    max-height: 72vh;
    border-radius: 10px;
    background: #000;
    object-fit: contain;
}

.screen-share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.screen-share-header h2 {
    margin: 0;
    font-size: 18px;
}

.screen-share-status {
    margin: 7px 0 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.stop-screen-share {
    margin-top: 12px;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 9px;
    background: var(--danger);
    color: white;
    font-weight: 650;
}

/* =========================================================
   CONTEXT MENUS
   ========================================================= */

.context-menu {
    position: fixed;
    min-width: 170px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
    z-index: 600;
}

.context-menu button {
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-size: 13px;
}

.context-menu button:hover {
    background: var(--surface-hover);
}

.context-menu button.danger {
    color: var(--danger);
}

/* =========================================================
   TOASTS
   ========================================================= */

#toastContainer {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    max-width: 320px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
    font-size: 13px;
    animation: toastIn 0.2s ease;
}

.toast.success {
    border-color: rgba(24, 134, 75, 0.35);
}

.toast.error {
    border-color: rgba(217, 45, 32, 0.35);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   LOADING
   ========================================================= */

.loading-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: loadingDot 1.2s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes loadingDot {
    0%,
    60%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/* =========================================================
   EMPTY STATES
   ========================================================= */

.empty-state {
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
    font-size: 13px;
}

.empty-state-icon {
    margin-bottom: 10px;
    font-size: 30px;
}

/* =========================================================
   FILE CARDS INSIDE CHAT
   ========================================================= */

.chat-file-card {
    display: flex;
    align-items: center;
    gap: 11px;
    width: fit-content;
    max-width: 100%;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--bg-secondary);
    cursor: pointer;
}

.chat-file-card:hover {
    background: var(--surface-hover);
}

.chat-file-icon {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.chat-file-info {
    min-width: 0;
}

.chat-file-name {
    max-width: 350px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;
    font-weight: 650;
}

.chat-file-type {
    color: var(--text-muted);
    font-size: 10px;
}

/* =========================================================
   CODEX MODE
   ========================================================= */

.codex-mode #messageInput::placeholder {
    content: "Describe the code you want to build...";
}

.codex-badge {
    display: inline-flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 800px) {
    :root {
        --sidebar-width: 280px;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: var(--sidebar-width);
        transform: translateX(-100%);
        box-shadow: var(--shadow);
    }

    .sidebar.collapsed {
        width: var(--sidebar-width);
    }

    .sidebar.collapsed .brand span,
    .sidebar.collapsed .new-chat-button span:last-child,
    .sidebar.collapsed .sidebar-button span:last-child,
    .sidebar.collapsed .sidebar-nav-item span:last-child,
    .sidebar.collapsed .section-heading,
    .sidebar.collapsed .chat-history,
    .sidebar.collapsed .sidebar-profile-info,
    .sidebar.collapsed .sidebar-profile-arrow,
    .sidebar.collapsed .plan-card {
        display: initial;
    }

    .sidebar.collapsed .brand,
    .sidebar.collapsed .new-chat-button,
    .sidebar.collapsed .sidebar-button,
    .sidebar.collapsed .sidebar-nav-item,
    .sidebar.collapsed .sidebar-profile {
        justify-content: initial;
    }

    .sidebar-collapse-button {
        display: none;
    }

    .mobile-menu-button {
        display: inline-flex;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .topbar {
        padding: 0 10px;
    }

    .topbar h2 {
        font-size: 15px;
    }

    .mode-switcher {
        position: static;
        transform: none;
        max-width: 42vw;
        overflow: hidden;
    }

    .mode-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        max-width: calc(100vw - 24px);
    }

    .mode-button {
        min-width: 0;
        max-width: 42vw;
        padding: 0 8px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .chat-area {
        padding: 105px 12px 145px;
    }

    .message-content {
        max-width: 94%;
        font-size: 14px;
    }

    .input-area {
        left: 9px;
        transform: none;
        width: calc(100% - 18px);
        bottom: 9px;
        padding: 7px;
        border-radius: 15px;
    }

    .input-button,
    .send-button {
        width: 36px;
        height: 36px;
    }

    #messageInput {
        min-width: 60px;
        font-size: 14px;
    }

    .screen-share-button,
    .call-button {
        display: none;
    }

    .message-actions {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
    }

    .response-actions {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
    }

    .theme-options {
        grid-template-columns: 1fr;
    }

    .library-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .workspace-hub-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .workspace-feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .modal {
        padding: 17px;
    }

    .plan-grid {
        grid-template-columns: 1fr;
    }

    .activity-metrics {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 480px) {
    .welcome {
        margin-top: 55px;
    }

    .welcome h1 {
        font-size: 29px;
    }

    .mode-button {
        min-width: 75px;
    }

    .input-area {
        gap: 3px;
    }

    .message.user-message .message-content {
        max-width: 88%;
    }

    .library-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    #toastContainer {
        right: 10px;
        bottom: 10px;
        left: 10px;
        align-items: stretch;
    }

    .toast {
        max-width: none;
    }
}

@media (max-width: 560px) {
    .workspace-feature-grid {
        grid-template-columns: 1fr;
    }

    .workspace-feature-card {
        min-height: 160px;
    }

    .workspace-inline-form,
    .connection-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .workspace-inline-form .primary-button {
        width: 100%;
    }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================
   SYSTEM THEME
   ========================================================= */

@media (prefers-color-scheme: dark) {
    html.system-theme {
        --bg: #101714;
        --bg-secondary: #17221c;
        --bg-tertiary: #223129;
        --surface: #1b2821;
        --surface-hover: #26372d;
        --border: #34483b;
        --text: #eef5ef;
        --text-secondary: #aabbb0;
        --text-muted: #819388;
        --accent: #c8e0d0;
        --accent-text: #183c31;
        --danger: #ff8176;
        --success: #70c49e;
        --shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    }
}

@media (prefers-color-scheme: light) {
    html.system-theme {
        --bg: #f8f6f1;
        --bg-secondary: #edf1eb;
        --bg-tertiary: #e3e9e2;
        --surface: #fffdf8;
        --surface-hover: #e8efe8;
        --border: #d9e1d8;
        --text: #18251f;
        --text-secondary: #68766d;
        --text-muted: #8b978e;
        --accent: #183c31;
        --accent-text: #fffdf8;
        --danger: #b5483d;
        --success: #34745d;
        --shadow: 0 10px 35px rgba(39, 47, 39, 0.1);
    }
}

/* =========================================================
   AUTHENTICATION — LOGIN & SIGNUP
   ========================================================= */

.auth-page {
    position: relative;
    isolation: isolate;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 32px 18px;
    background: #f1eee8;
    color: #18251f;
}

html.dark .auth-page {
    background: #101714;
    color: #eef5ef;
}

.auth-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(125deg, rgba(255, 255, 255, 0.5), transparent 45%),
        radial-gradient(circle at 12% 18%, rgba(213, 127, 72, 0.23) 0 10%, transparent 28%),
        radial-gradient(circle at 88% 82%, rgba(49, 111, 91, 0.25) 0 12%, transparent 30%);
}

html.dark .auth-background {
    background:
        linear-gradient(125deg, rgba(255, 255, 255, 0.04), transparent 45%),
        radial-gradient(circle at 12% 18%, rgba(213, 127, 72, 0.2) 0 10%, transparent 28%),
        radial-gradient(circle at 88% 82%, rgba(49, 111, 91, 0.28) 0 12%, transparent 30%);
}

.auth-card {
    position: relative;
    z-index: 1;
    width: min(470px, 100%);
    margin: auto;
    padding: 42px 42px 34px;
    border: 1px solid rgba(24, 37, 31, 0.12);
    border-radius: 28px;
    background: rgba(255, 253, 248, 0.88);
    box-shadow: 0 25px 80px rgba(39, 47, 39, 0.16);
    backdrop-filter: blur(20px);
}

html.dark .auth-card {
    border-color: rgba(238, 245, 239, 0.12);
    background: rgba(24, 35, 30, 0.9);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.42);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 38px;
    color: #183c31;
    font-size: 14px;
    font-weight: 850;
    letter-spacing: 0.16em;
}

html.dark .auth-brand {
    color: #c8e0d0;
}

.auth-logo {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    background: #183c31;
    color: #fffdf8;
    font-size: 19px;
    font-weight: 900;
    letter-spacing: 0;
    box-shadow: 0 8px 18px rgba(24, 60, 49, 0.22);
}

.signup-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 420px;
    padding: 34px 10px 8px;
    text-align: center;
}

.signup-welcome-mark {
    display: grid;
    width: 96px;
    height: 96px;
    place-items: center;
    margin: 4px auto 28px;
    background: transparent;
}

.signup-welcome-name {
    color: #244da8;
    font-size: clamp(30px, 8vw, 43px);
    font-weight: 900;
    letter-spacing: 0.02em;
}

.signup-welcome-name strong {
    display: block;
    margin-top: -3px;
    color: #79cfe0;
    font-size: 0.72em;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-align: right;
}

.signup-welcome-tagline {
    max-width: 250px;
    margin: 26px auto 34px;
    color: #7893aa;
    font-size: 13px;
    line-height: 1.55;
}

.signup-welcome-button {
    position: relative;
    z-index: 2;
    width: min(230px, 100%);
    margin-top: auto;
    background: #244da8;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.signup-welcome-login {
    margin: 20px 0 0;
    color: #758078;
    font-size: 12px;
}

.signup-welcome-login a {
    color: #244da8;
    font-weight: 800;
    text-decoration: none;
}

.auth-heading {
    margin-bottom: 28px;
}

.auth-heading h1,
.welcome-back h1 {
    margin: 0 0 9px;
    color: inherit;
    font-size: clamp(29px, 5vw, 38px);
    font-weight: 820;
    line-height: 1.15;
    letter-spacing: -1.4px;
}

.auth-heading p,
.welcome-back p {
    margin: 0;
    color: #68766d;
    font-size: 14px;
    line-height: 1.55;
}

html.dark .auth-heading p,
html.dark .welcome-back p {
    color: #aabbb0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label,
.password-label-row label {
    color: inherit;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.02em;
}

.form-group input,
.verification-input {
    width: 100%;
    height: 50px;
    padding: 0 14px;
    border: 1px solid #d9ddd5;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.74);
    color: #18251f;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

html.dark .form-group input,
html.dark .verification-input {
    border-color: #3b4b42;
    background: rgba(11, 18, 15, 0.45);
    color: #eef5ef;
}

.form-group input:focus,
.verification-input:focus {
    border-color: #34745d;
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(52, 116, 93, 0.13);
}

.password-label-row,
.password-input-wrapper {
    display: flex;
    align-items: center;
}

.password-label-row {
    justify-content: space-between;
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    padding-right: 62px;
}

.text-button,
.password-toggle {
    background: transparent;
    color: #34745d;
    font-size: 12px;
    font-weight: 750;
}

.password-toggle {
    position: absolute;
    right: 13px;
}

.text-button:hover,
.password-toggle:hover {
    color: #c15f36;
}

.field-help {
    color: #7c887f;
    font-size: 11px;
}

.auth-message {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.45;
}

.auth-message.error {
    background: rgba(193, 95, 54, 0.1);
    color: #a04b2a;
}

.auth-message.success {
    background: rgba(52, 116, 93, 0.1);
    color: #28654e;
}

.development-code {
    margin-top: 10px;
    border: 1px dashed #34745d;
    background: rgba(52, 116, 93, 0.08);
    color: #28654e;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 17px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.auth-field label {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.auth-field input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 48px;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.auth-field input::placeholder {
    color: var(--text-muted);
}

.auth-field input:hover {
    border-color: var(--text-muted);
}

.auth-field input:focus {
    border-color: var(--text);
    background: var(--surface);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 10%, transparent);
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -2px 0 2px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.auth-options label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
}

.auth-options input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.auth-options a,
.auth-footer a,
.auth-terms a {
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}

.auth-options a:hover,
.auth-footer a:hover,
.auth-terms a:hover {
    text-decoration: underline;
}

.auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    margin-top: 3px;
    padding: 0 18px;
    border-radius: 11px;
    background: #183c31;
    color: #fffdf8;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.3;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.auth-submit:hover {
    opacity: 0.88;
    box-shadow: 0 8px 20px rgba(24, 60, 49, 0.2);
}

.auth-submit:active {
    transform: translateY(1px);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 25px 0 17px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-social {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.auth-social:hover {
    border-color: var(--text-muted);
    background: var(--surface-hover);
}

.auth-footer {
    margin: 25px 0 0;
    color: var(--text-secondary);
    text-align: center;
    font-size: 13px;
    line-height: 1.6;
}

.auth-terms {
    max-width: 330px;
    margin: 18px auto 0;
    color: var(--text-muted);
    text-align: center;
    font-size: 11px;
    line-height: 1.6;
}

.auth-error {
    padding: 11px 13px;
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--danger) 8%, transparent);
    color: var(--danger);
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 480px) {
    .auth-page {
        align-items: flex-start;
        padding: 18px 12px;
    }

    .auth-card {
        padding: 30px 20px 25px;
        border-radius: 19px;
    }

    .auth-brand {
        margin-bottom: 25px;
    }

    .auth-options {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
}

.welcome-logo {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    margin: 0 auto 18px;
    border-radius: 17px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 24px;
    box-shadow: 0 12px 25px rgba(24, 60, 49, 0.18);
}

.upgrade-modal {
    width: min(720px, 100%);
    padding: 26px;
}

.eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.usage-summary,
.activity-preview {
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-secondary);
}

.usage-heading,
.activity-preview-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.usage-heading strong,
.activity-preview-heading strong {
    display: block;
    font-size: 15px;
}

.plan-status,
.activity-period {
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--success);
    font-size: 10px;
    font-weight: 750;
}

.usage-bar {
    height: 7px;
    margin: 16px 0 9px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--border);
}

.usage-bar span {
    display: block;
    width: 16%;
    height: 100%;
    border-radius: inherit;
    background: var(--success);
}

.usage-summary p,
.upgrade-plan p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.upgrade-section {
    margin-bottom: 18px;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.upgrade-plan {
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.featured-plan {
    border-color: var(--success);
    box-shadow: 0 8px 20px rgba(52, 116, 93, 0.1);
}

.plan-kicker {
    color: var(--success);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.upgrade-plan h3 {
    margin: 8px 0 10px;
    font-size: 17px;
}

.plan-price {
    display: block;
    margin-bottom: 9px;
    font-size: 22px;
}

.plan-price small {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
}

.upgrade-plan-button {
    width: 100%;
    margin-top: 15px;
}

.activity-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.activity-metrics div {
    padding: 12px;
    border-radius: 10px;
    background: var(--surface);
}

.activity-metrics strong,
.activity-metrics span {
    display: block;
}

.activity-metrics strong {
    margin-bottom: 4px;
    font-size: 20px;
}

.activity-metrics span {
    color: var(--text-muted);
    font-size: 10px;
}

.login-verification {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
}

.login-verification > strong {
    color: var(--text);
    font-size: 13px;
}

.login-verification > span {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.login-verification-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-verification-actions .auth-submit {
    flex: 1;
    min-height: 40px;
    margin-top: 0;
}

.mode-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(290px, calc(100vw - 24px));
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 18px 42px rgba(39, 47, 39, 0.16);
}

.dropdown-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 54px;
    padding: 8px 9px;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-item:hover,
.dropdown-item.active {
    background: var(--surface-hover);
}

.dropdown-item-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--success);
    font-size: 13px;
    font-weight: 800;
}

.dropdown-item > span:nth-child(2) {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dropdown-item strong {
    overflow: hidden;
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dropdown-item small {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 10px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dropdown-check {
    color: var(--success);
    font-size: 14px;
    font-weight: 900;
    text-align: center;
}

.workspace-hub {
    width: min(1080px, 100%);
    margin: 0 auto;
    padding: 6px 0 30px;
}

.workspace-hub-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.workspace-hub-header h1 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: clamp(28px, 4vw, 42px);
    letter-spacing: -1.3px;
}

.workspace-hub-header p {
    max-width: 600px;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.55;
}

.workspace-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.workspace-feature-card {
    position: relative;
    min-height: 190px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    color: var(--text);
    text-align: left;
    box-shadow: 0 8px 24px rgba(39, 47, 39, 0.05);
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.workspace-feature-card:hover {
    border-color: var(--success);
    background: var(--surface);
    transform: translateY(-2px);
}

.workspace-feature-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    margin-bottom: 18px;
    border-radius: 11px;
    background: var(--bg-secondary);
    color: var(--success);
    font-size: 17px;
    font-weight: 800;
}

.workspace-feature-title {
    margin-bottom: 7px;
    font-size: 15px;
    font-weight: 800;
}

.workspace-feature-description {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.workspace-feature-link {
    margin-top: auto;
    padding-top: 14px;
    color: var(--success);
    font-size: 11px;
    font-weight: 800;
}

.workspace-feature-count {
    position: absolute;
    top: 14px;
    right: 14px;
    min-width: 22px;
    padding: 4px 6px;
    border-radius: 999px;
    background: var(--success);
    color: #ffffff;
    font-size: 10px;
    text-align: center;
}

.workspace-detail {
    width: min(900px, 100%);
    margin: 0 auto;
}

.workspace-back-button {
    margin-bottom: 24px;
    padding: 0;
    background: transparent;
    color: var(--success);
    font-size: 12px;
    font-weight: 800;
}

.workspace-detail h1 {
    margin: 0 0 8px;
    font-size: clamp(28px, 4vw, 40px);
    letter-spacing: -1px;
}

.workspace-detail-title-input {
    width: 100%;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 800;
}

.canvas-editor {
    width: 100%;
    min-height: 420px;
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    line-height: 1.6;
    resize: vertical;
}

.workspace-detail-intro {
    margin: 0 0 22px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.guide-page {
    max-width: 1080px;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 28px;
}

.guide-card {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.guide-card h2 {
    margin: 0 0 8px;
    font-size: 16px;
}

.guide-card p {
    margin: 0 0 14px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.guide-card small {
    color: var(--text-muted);
    line-height: 1.5;
}

@media (max-width: 700px) {
    .guide-grid {
        grid-template-columns: 1fr;
    }
}

.work-brief-form {
    display: grid;
    gap: 16px;
    max-width: 820px;
    margin: 28px 0;
}

.work-brief-form label {
    display: grid;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

.work-brief-form textarea {
    width: 100%;
    padding: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    resize: vertical;
}

.work-context-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.work-context-grid label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
}

.work-context-grid input {
    width: auto;
}

.work-context-summary {
    max-width: 820px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.work-context-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.work-context-stats span {
    padding: 7px 9px;
    color: var(--text-secondary);
    background: var(--surface);
    border-radius: 7px;
    font-size: 12px;
}

@media (max-width: 700px) {
    .work-context-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.workspace-inline-form,
.workspace-agent-form {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.workspace-agent-form {
    flex-direction: column;
    max-width: 620px;
}

.workspace-inline-form input,
.workspace-agent-form input,
.workspace-agent-form textarea {
    min-width: 0;
    flex: 1;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
}

.workspace-agent-form textarea {
    min-height: 100px;
    padding: 12px;
    resize: vertical;
}

.workspace-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.workspace-list-item,
.connection-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.workspace-list-item > div,
.connection-card > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.workspace-list-item strong,
.connection-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-list-item small,
.connection-card small {
    color: var(--text-secondary);
    font-size: 11px;
}

.workspace-status {
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--success);
    font-size: 10px;
    font-weight: 800;
}

.connection-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.workspace-feature-card.locked {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.workspace-feature-card.locked .workspace-feature-link {
    color: var(--accent);
}

.website-builder-form {
    display: grid;
    gap: 14px;
    max-width: 820px;
    margin: 26px 0;
}
.website-builder-form textarea,
.website-builder-options input {
    width: 100%;
    padding: 13px 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.website-builder-options {
    display: flex;
    gap: 10px;
}
.website-builder-options input {
    max-width: 240px;
}
.website-builder-result {
    max-width: 1000px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.website-builder-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.website-builder-result-header div {
    display: grid;
    gap: 4px;
}
.website-builder-result-header small {
    color: var(--text-secondary);
}
.website-builder-result iframe {
    width: 100%;
    min-height: 560px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}
.website-file-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 14px;
}
.website-file-links a {
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}
@media (max-width: 620px) {
    .website-builder-options,
    .website-builder-result-header {
        align-items: stretch;
        flex-direction: column;
    }
    .website-builder-options input {
        max-width: none;
    }
}

.chat-history-group-heading {
    margin: 16px 8px 7px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chat-history-group-heading:first-child {
    margin-top: 0;
}

.mobile-brand {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.mobile-brand img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    border-radius: 8px;
    mix-blend-mode: multiply;
}

.brand-mark,
.auth-logo,
.welcome-logo,
.signup-welcome-mark {
    background: transparent;
    box-shadow: none;
}

html.dark .brand-mark img,
html.dark .auth-logo img,
html.dark .welcome-logo img,
html.dark .signup-welcome-mark img,
html.dark .mobile-brand img {
    mix-blend-mode: normal;
}

.api-key-result {
    align-items: flex-start;
    gap: 12px;
}

.api-key-result code {
    display: block;
    width: 100%;
    overflow-wrap: anywhere;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}