:root {
    --bg: #15120f;
    --bg-alt: #1d1914;
    --text: #efe8dd;
    --text-secondary: #b4a692;
    --border: #332a22;
    --accent: #bb9871;
    --accent-soft: rgba(187, 152, 113, 0.24);
    --link: #efe8dd;
    --scrollbar-thumb: #5a4a3b;
    --scrollbar-thumb-hover: #75624f;
}

/* Dark scrollbars for app (sidebar, chat, etc.) */
.projects-sidebar,
.projects-sidebar .documents-list,
.projects-sidebar .projects-list,
.chat-messages,
.tool-panel-content,
.model-dropdown {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

.projects-sidebar::-webkit-scrollbar,
.projects-sidebar .documents-list::-webkit-scrollbar,
.projects-sidebar .projects-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.tool-panel-content::-webkit-scrollbar,
.model-dropdown::-webkit-scrollbar {
    width: 6px;
}

.projects-sidebar::-webkit-scrollbar-track,
.projects-sidebar .documents-list::-webkit-scrollbar-track,
.projects-sidebar .projects-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.tool-panel-content::-webkit-scrollbar-track,
.model-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

/* Force dark scrollbar on dropdown (Electron can show white default) */
#settings-dropdown {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}
#settings-dropdown::-webkit-scrollbar {
    width: 6px;
}
#settings-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
#settings-dropdown::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}
#settings-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.projects-sidebar::-webkit-scrollbar-thumb,
.projects-sidebar .documents-list::-webkit-scrollbar-thumb,
.projects-sidebar .projects-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.tool-panel-content::-webkit-scrollbar-thumb,
.model-dropdown::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.projects-sidebar::-webkit-scrollbar-thumb:hover,
.projects-sidebar .documents-list::-webkit-scrollbar-thumb:hover,
.projects-sidebar .projects-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover,
.tool-panel-content::-webkit-scrollbar-thumb:hover,
.model-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

html.has-app,
body.has-app {
    overflow: auto;
    min-height: 100vh;
}

/* App UI uses SF Pro (system font on macOS) for a native feel */
body.has-app,
body.page-try {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
}

body.has-app .landing-content {
    flex: 0 0 auto;
}

#chat-section {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
}

#chat-section .chat-section-layout {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Try page – full app layout, no landing content */
.page-try {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.page-try .try-app-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-try .try-app-wrapper .chat-section-layout {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

.container.narrow {
    max-width: 640px;
}

/* Chat document window mode: sidebar hidden, right panel hidden, chat fills the window */
body.chat-window-mode .projects-sidebar {
    display: none !important;
}
body.chat-window-mode #header-web-fallback {
    display: none !important;
}
body.chat-window-mode .settings-dropdown-portal {
    display: none !important;
}

/* Header */
/* Desktop app: traffic lights, centered project name, sidebar + settings on right */
.desktop-title-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: #1e1e20;
    -webkit-app-region: drag;
    padding-left: 65px;
    padding-right: 8px;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
}
.desktop-title-bar:not([hidden]) {
    display: flex;
}
.desktop-title-bar-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    -webkit-app-region: no-drag;
}
body.has-desktop-title-bar #header-web-fallback {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
}
.desktop-title-bar-name {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    pointer-events: none;
    -webkit-app-region: drag;
}
.desktop-title-bar-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    -webkit-app-region: no-drag;
}
.btn-title-bar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}
.btn-title-bar-icon:hover {
    color: #fff;
}
.btn-title-bar-icon:focus,
.btn-title-bar-icon:active {
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}
.settings-dropdown-portal {
    position: fixed;
    top: 0;
    right: 16px;
    z-index: 1302;
    pointer-events: none;
}
.settings-dropdown-portal .dropdown-menu {
    pointer-events: auto;
    margin-top: 0;
}
.settings-dropdown-portal .dropdown-menu[hidden] {
    display: none !important;
}

/* Compact settings dropdown */
.dropdown-menu-compact {
    min-width: 180px;
    max-height: 420px;
    padding: 4px 0 !important;
    border-radius: 8px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.dropdown-menu-compact::-webkit-scrollbar { width: 4px; }
.dropdown-menu-compact::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.dropdown-menu-compact .dropdown-item {
    font-size: 0.8125rem;
    padding: 5px 12px;
    border-radius: 0;
}
.dropdown-menu-compact .dropdown-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 6px 12px 3px;
    opacity: 0.6;
}
/* First label needs no extra top space */
.dropdown-menu-compact .dropdown-label:first-child {
    padding-top: 4px;
}
.dropdown-menu-compact .dropdown-separator {
    margin: 4px 0;
    border-color: rgba(255,255,255,0.06);
}
/* Web header bar – matches desktop title bar (black, minimal) */
.header.header-web-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    min-height: 32px;
    background: #111111;
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 1000;
    border: none;
}
.header-web-bar .btn-title-bar-icon {
    color: rgba(255, 255, 255, 0.8);
}
/* Web view: no hover shadow/background (matches desktop app fix) */
.header-web-bar .btn-title-bar-icon:hover,
.header-web-bar .btn-title-bar-icon:focus,
.header-web-bar .btn-title-bar-icon:active {
    color: rgba(255, 255, 255, 0.8);
    background: none !important;
    box-shadow: none !important;
}
.header-web-bar-name {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}
.header-web-bar-actions {
    display: flex;
    align-items: center;
}
body.has-web-bar {
    padding-top: 32px;
}
body.has-desktop-title-bar {
    padding-top: 32px;
}

/* Unified top navigation (matches homepage) */
.lp-nav {
    position: sticky;
    top: 0;
    z-index: 1201;
    padding: 8px 20px;
    min-height: 44px;
    background: rgba(21, 18, 15, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.lp-brand-menu {
    position: relative;
}

.lp-nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.lp-nav-logo::-webkit-details-marker {
    display: none;
}

.lp-nav-logo-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

.lp-nav-caret {
    display: inline-flex;
    align-items: center;
    opacity: 0.9;
}

.lp-brand-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: min(300px, 86vw);
    background: #1d1914;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    display: grid;
    gap: 2px;
}

.lp-brand-menu-panel a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 8px 10px;
    border-radius: 6px;
}

.lp-brand-menu-panel a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

/* On /try, keep lp-nav as the true top bar above desktop title bar */
body.page-try.has-desktop-title-bar {
    padding-top: 79px;
}

body.page-settings.has-desktop-title-bar {
    padding-top: 0;
}

body.page-try.has-desktop-title-bar .lp-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding-left: 84px;
    padding-right: 16px;
    display: flex;
    align-items: center;
}

body.page-settings.has-desktop-title-bar .lp-nav {
    padding-left: 84px;
    padding-right: 16px;
    display: flex;
    align-items: center;
}

body.page-try.has-desktop-title-bar .lp-nav .lp-brand-menu {
    flex-shrink: 0;
}

body.page-settings.has-desktop-title-bar .lp-nav .lp-brand-menu {
    flex-shrink: 0;
}

body.page-try.has-desktop-title-bar .lp-nav-drag-fill {
    flex: 1;
    min-width: 0;
    -webkit-app-region: drag;
    align-self: stretch;
}

body.page-settings.has-desktop-title-bar .lp-nav-drag-fill {
    flex: 1;
    min-width: 0;
    -webkit-app-region: drag;
    align-self: stretch;
}

body.page-try.has-desktop-title-bar .lp-nav a,
body.page-try.has-desktop-title-bar .lp-nav button,
body.page-try.has-desktop-title-bar .lp-nav summary,
body.page-try.has-desktop-title-bar .lp-nav details,
body.page-try.has-desktop-title-bar .lp-nav input,
body.page-try.has-desktop-title-bar .lp-nav select,
body.page-try.has-desktop-title-bar .lp-nav textarea,
body.page-try.has-desktop-title-bar .lp-nav [role="button"] {
    -webkit-app-region: no-drag;
}

body.page-settings.has-desktop-title-bar .lp-nav a,
body.page-settings.has-desktop-title-bar .lp-nav button,
body.page-settings.has-desktop-title-bar .lp-nav summary,
body.page-settings.has-desktop-title-bar .lp-nav details,
body.page-settings.has-desktop-title-bar .lp-nav input,
body.page-settings.has-desktop-title-bar .lp-nav select,
body.page-settings.has-desktop-title-bar .lp-nav textarea,
body.page-settings.has-desktop-title-bar .lp-nav [role="button"] {
    -webkit-app-region: no-drag;
}

body.page-try.has-desktop-title-bar .desktop-title-bar {
    top: 47px;
    padding-left: 12px;
}

body.page-try .desktop-title-bar-left {
    width: 32px;
    justify-content: center;
}

body.page-try .desktop-title-bar .btn-sidebar-toggle-bar,
body.page-try .desktop-title-bar .btn-sidebar-toggle-bar:hover,
body.page-try .desktop-title-bar .btn-sidebar-toggle-bar:focus,
body.page-try .desktop-title-bar .btn-sidebar-toggle-bar:active {
    background: transparent !important;
    border-radius: 0;
    box-shadow: none;
}

/* Try page uses lp-nav in web; desktop keeps native title bar */
body.page-try #header-web-fallback {
    display: none !important;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(21, 18, 15, 0.88);
    backdrop-filter: blur(12px);
    padding: 8px 0;
    min-height: 44px;
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.has-app .header-inner {
    max-width: none;
    width: 100%;
    display: grid;
    grid-template-columns: var(--sidebar-width, 220px) 1fr;
    align-items: center;
    padding: 0 20px;
}

.has-app .header-inner .logo {
    justify-self: start;
}

.has-app .header-inner .nav,
.has-app .header-inner .header-actions {
    justify-self: end;
}

.header-minimal .header-inner {
    padding: 8px 20px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}

.btn-icon:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.logo .logo-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.logo-text {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text);
    text-transform: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav a, .btn-text {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: inherit;
    font-size: 0.9375rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav a:hover, .btn-text:hover {
    color: var(--text);
}

.nav-auth-link {
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
}

.nav-auth-link:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-settings {
    font-size: 0.9375rem;
    opacity: 0.9;
}

.btn-settings:hover {
    opacity: 1;
}

/* Tools dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown .btn-text {
    display: flex;
    align-items: center;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 180px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 50;
}

.dropdown-menu-right {
    left: auto;
    right: 0;
    min-width: 180px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 50;
}

.dropdown-menu[hidden] {
    display: none !important;
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
}

.dropdown-item:hover {
    color: var(--text);
    background: rgba(255,255,255,0.05);
}

.dropdown-label {
    padding: 6px 20px 8px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dropdown-separator {
    height: 1px;
    margin: 8px 0;
    background: var(--border);
}

.dropdown-user-email {
    padding: 6px 20px 2px;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.7;
}

.dropdown-item.dropdown-item-active {
    color: var(--accent);
    background: var(--accent-soft);
}

/* Inline tool panel in chat */
.chat-tool-panel {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    background: var(--bg-alt);
    overflow: hidden;
}

.chat-tool-panel[hidden] {
    display: none !important;
}

.tool-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.tool-panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.btn-close-tool {
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 4px;
}

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

.tool-panel-content {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.tool-form-wrap {
    display: none;
}

.tool-form-wrap.active {
    display: block;
}

.tool-panel-content .form-row {
    margin-bottom: 12px;
}

.tool-panel-content .modal-actions {
    margin-top: 16px;
}

/* Chat threads sidebar */
.chats-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.chats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.chats-header h3 {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.chats-header-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
}

.chats-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.chat-thread-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.chat-thread-item:hover {
    color: var(--text);
    background: rgba(255,255,255,0.04);
}

.chat-thread-item.active {
    color: var(--text);
    background: rgba(255,255,255,0.06);
    box-shadow: inset 2px 0 0 var(--accent);
}

/* Active tool pills */
.active-tools-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 6px;
    flex-wrap: wrap;
}

.active-tools-bar[hidden] {
    display: none !important;
}

.tool-active-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(99,102,241,0.12);
    border-radius: 999px;
    letter-spacing: 0.02em;
    animation: pill-fade-in 0.2s ease;
}

@keyframes pill-fade-in {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* Bid document card */
.bid-doc-card {
    margin-top: 12px;
    padding: 14px 16px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.bid-doc-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
    font-size: 0.875rem;
}

.bid-doc-card-header svg {
    flex-shrink: 0;
    color: var(--accent);
}

.bid-doc-card-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bid-doc-card-desc {
    margin: 6px 0 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Serif headings on landing pages */
.landing-simple h1,
.landing-simple h2,
.landing-simple .hero-tagline {
    font-family: 'Merriweather', Georgia, serif;
}

/* Hero */
.hero {
    padding: 80px 0 24px;
    text-align: center;
}

.hero h1 {
    margin: 0 0 16px;
    font-size: 2.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.hero-sub {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.hero-cta {
    margin: 24px 0 0;
}

.hero-cta .btn-download {
    display: inline-block;
}

/* Simple landing (coming soon) */
.landing-simple {
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.hero-simple {
    flex: 1;
    padding: 100px 0 72px;
}

.hero-badge {
    display: inline-block;
    margin: 0 0 20px;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
}

.hero-tagline {
    margin: 0 0 24px;
    font-size: 1.2rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.hero-desc {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 36px;
    line-height: 1.7;
}

.hero-cta-sep {
    margin: 0 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.container-narrow {
    max-width: 740px;
}

.features-simple .feature-item {
    text-align: center;
}

.footer-simple {
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid var(--border);
}

.footer-simple p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.section-title {
    text-align: center;
    margin: 0 0 12px;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}

.section-intro {
    text-align: center;
    margin: 0 auto 32px;
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 560px;
    line-height: 1.6;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
}

.example-card {
    padding: 20px 22px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
}

.example-label {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 8px;
}

.example-text {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-style: italic;
}

.automation-list-landing {
    max-width: 600px;
    margin: 0 auto 24px;
}

.automation-list-landing li {
    margin-bottom: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.section-cta {
    text-align: center;
    margin: 0;
}

.project-types {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.project-type-tag {
    padding: 10px 18px;
    font-size: 0.875rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--text-secondary);
}

.section-cta-block {
    padding-bottom: 96px;
}

/* Landing page animations */
@media (prefers-reduced-motion: reduce) {
    .landing-simple .hero-badge,
    .landing-simple .hero h1,
    .landing-simple .hero-tagline,
    .landing-simple .hero-desc,
    .landing-simple .hero-cta,
    .landing-simple .landing-observe .section-title,
    .landing-simple .landing-observe .section-intro,
    .landing-simple .landing-observe .example-card,
    .landing-simple .landing-observe .feature-item,
    .landing-simple .landing-observe .project-type-tag,
    .landing-simple .landing-observe .automation-list-landing li {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

@keyframes landing-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes landing-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.landing-simple .hero-badge {
    animation: landing-fade-in-up 0.6s ease-out both;
}

.landing-simple .hero h1 {
    animation: landing-fade-in-up 0.6s ease-out 0.1s both;
}

.landing-simple .hero-tagline {
    animation: landing-fade-in-up 0.6s ease-out 0.2s both;
}

.landing-simple .hero-desc {
    animation: landing-fade-in-up 0.6s ease-out 0.3s both;
}

.landing-simple .hero-cta {
    animation: landing-fade-in-up 0.6s ease-out 0.4s both;
}

.landing-simple .landing-observe .section-title,
.landing-simple .landing-observe .section-intro {
    opacity: 0;
    transform: translateY(16px);
}

.landing-simple .landing-observe .example-card,
.landing-simple .landing-observe .feature-item,
.landing-simple .landing-observe .project-type-tag {
    opacity: 0;
    transform: translateY(12px);
}

.landing-simple .landing-observe .automation-list-landing li {
    opacity: 0;
    transform: translateX(-8px);
}

.landing-simple .landing-observe.landing-visible .section-title {
    animation: landing-fade-in-up 0.5s ease-out both;
}

.landing-simple .landing-observe.landing-visible .section-intro {
    animation: landing-fade-in-up 0.5s ease-out 0.06s both;
}

.landing-simple .landing-observe.landing-visible .example-card {
    animation: landing-fade-in-up 0.45s ease-out both;
}

.landing-simple .landing-observe.landing-visible .example-card:nth-child(1) { animation-delay: 0.1s; }
.landing-simple .landing-observe.landing-visible .example-card:nth-child(2) { animation-delay: 0.15s; }
.landing-simple .landing-observe.landing-visible .example-card:nth-child(3) { animation-delay: 0.2s; }
.landing-simple .landing-observe.landing-visible .example-card:nth-child(4) { animation-delay: 0.25s; }
.landing-simple .landing-observe.landing-visible .example-card:nth-child(5) { animation-delay: 0.3s; }

.landing-simple .landing-observe.landing-visible .feature-item {
    animation: landing-fade-in-up 0.45s ease-out both;
}

.landing-simple .landing-observe.landing-visible .feature-item:nth-child(1) { animation-delay: 0.08s; }
.landing-simple .landing-observe.landing-visible .feature-item:nth-child(2) { animation-delay: 0.14s; }
.landing-simple .landing-observe.landing-visible .feature-item:nth-child(3) { animation-delay: 0.2s; }
.landing-simple .landing-observe.landing-visible .feature-item:nth-child(4) { animation-delay: 0.26s; }
.landing-simple .landing-observe.landing-visible .feature-item:nth-child(5) { animation-delay: 0.32s; }

.landing-simple .landing-observe.landing-visible .project-type-tag {
    animation: landing-fade-in 0.35s ease-out both;
}

.landing-simple .landing-observe.landing-visible .project-type-tag:nth-child(1) { animation-delay: 0.04s; }
.landing-simple .landing-observe.landing-visible .project-type-tag:nth-child(2) { animation-delay: 0.08s; }
.landing-simple .landing-observe.landing-visible .project-type-tag:nth-child(3) { animation-delay: 0.12s; }
.landing-simple .landing-observe.landing-visible .project-type-tag:nth-child(4) { animation-delay: 0.16s; }
.landing-simple .landing-observe.landing-visible .project-type-tag:nth-child(5) { animation-delay: 0.2s; }
.landing-simple .landing-observe.landing-visible .project-type-tag:nth-child(6) { animation-delay: 0.24s; }
.landing-simple .landing-observe.landing-visible .project-type-tag:nth-child(7) { animation-delay: 0.28s; }
.landing-simple .landing-observe.landing-visible .project-type-tag:nth-child(8) { animation-delay: 0.32s; }

.landing-simple .landing-observe.landing-visible .automation-list-landing li {
    animation: landing-fade-in-up 0.4s ease-out both;
}

.landing-simple .landing-observe.landing-visible .automation-list-landing li:nth-child(1) { animation-delay: 0.06s; }
.landing-simple .landing-observe.landing-visible .automation-list-landing li:nth-child(2) { animation-delay: 0.12s; }
.landing-simple .landing-observe.landing-visible .automation-list-landing li:nth-child(3) { animation-delay: 0.18s; }
.landing-simple .landing-observe.landing-visible .automation-list-landing li:nth-child(4) { animation-delay: 0.24s; }

.landing-simple .landing-observe.landing-visible .section-cta,
.landing-simple .landing-observe.landing-visible .hero-tagline,
.landing-simple .landing-observe.landing-visible .hero-cta {
    animation: landing-fade-in-up 0.5s ease-out 0.15s both;
}

.landing-simple .example-card {
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.landing-simple .example-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.15);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.landing-simple .feature-item {
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.landing-simple .feature-item:hover {
    transform: translateY(-1px);
}

.landing-simple .project-type-tag {
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.landing-simple .project-type-tag:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.22);
    color: var(--text);
    transform: translateY(-2px);
    z-index: 1;
}

.landing-simple .hero-cta .btn-primary,
.landing-simple .hero-cta .btn-secondary,
.landing-simple .section-cta-block .btn-primary,
.landing-simple .section-cta-block .btn-secondary {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.landing-simple .hero-cta .btn-primary:hover,
.landing-simple .section-cta-block .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(184, 168, 138, 0.25);
}

.landing-simple .hero-cta .btn-secondary:hover,
.landing-simple .section-cta-block .btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.landing-simple .automation-list-landing li {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.landing-simple .automation-list-landing li:hover {
    opacity: 1;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 28px;
    max-width: 900px;
    margin: 0 auto;
}

.feature-item h3 {
    margin: 0 0 8px;
    font-size: 1.125rem;
    font-weight: 600;
    font-family: 'Merriweather', Georgia, serif;
}

.feature-item p {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.pricing-tier {
    display: flex;
    flex-direction: column;
}

.pricing-tier h3 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 600;
}

.pricing-tier .pricing-price {
    margin: 0 0 4px;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.pricing-tier .pricing-price span {
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.pricing-tier .pricing-desc {
    margin: 0 0 16px;
    font-size: 0.875rem;
}

.pricing-tier .pricing-features {
    flex: 1;
    margin: 0 0 20px;
}

.pricing-tier .btn-download,
.pricing-tier .btn-secondary {
    margin-top: auto;
}

/* Sections */
.section {
    padding: 48px 0 64px;
}

.section-alt {
    background: var(--bg-alt);
}

.section h2 {
    margin: 0 0 16px;
    font-size: 1.25rem;
    font-weight: 600;
}

.section p {
    margin: 0;
    color: var(--text-secondary);
}

.about-community-copy a,
.about-community-copy a:visited {
    color: rgba(214, 193, 164, 0.9);
    text-decoration-color: rgba(214, 193, 164, 0.65);
    text-underline-offset: 2px;
    transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

.about-community-copy a:hover {
    color: #e6d6bc;
    text-decoration-color: #e6d6bc;
}

.link {
    color: var(--link);
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

.link-cta {
    font-weight: 700;
}

.contech-status {
    margin-bottom: 8px;
}

.about-quote {
    margin: 16px 0 0;
    padding-left: 20px;
    border-left: 3px solid var(--border);
    font-style: italic;
    color: var(--text-secondary);
}

#api-status.status-ok {
    color: #6ee7b7;
}

#api-status.status-error {
    color: #f87171;
}

/* App layout: sidebar + chat */
body {
    min-height: 100vh;
}

.app-layout {
    display: flex;
    flex: 1;
    min-height: 0;
}

.projects-sidebar {
    flex: 0 0 auto;
    width: var(--sidebar-width, 220px);
    min-width: 160px;
    max-width: 400px;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    padding: 12px 10px;
    background: var(--bg-alt);
    overflow-y: auto;
    overflow-x: hidden;
}

.projects-sidebar .projects-header,
.projects-sidebar .projects-list {
    flex-shrink: 0;
}

.projects-sidebar .tasks-section {
    flex: 0 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.projects-sidebar .documents-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.projects-sidebar .tasks-list,
.projects-sidebar .documents-list {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

.sidebar-resize-handle {
    flex-shrink: 0;
    width: 6px;
    cursor: col-resize;
    background: transparent;
    position: relative;
}

.sidebar-resize-handle::after {
    content: '';
    position: absolute;
    top: 0;
    left: 2px;
    width: 2px;
    height: 100%;
    background: transparent;
    transition: background 0.15s;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle:active::after {
    background: var(--border);
}

.sidebar-resize-handle:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Desktop sidebar collapsed */
body.sidebar-collapsed .projects-sidebar {
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    overflow: hidden;
    border-right: none;
}
body.sidebar-collapsed .sidebar-resize-handle {
    width: 0;
    min-width: 0;
    cursor: default;
    pointer-events: none;
}

/* Title bar sidebar toggle button */
.projects-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.projects-header-label {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.projects-header-icons {
    margin-bottom: 6px;
}

.projects-header-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
}

.btn-icon-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
}

.btn-icon-toolbar:hover {
    color: var(--text);
    background: rgba(255,255,255,0.06);
}

.btn-icon-toolbar svg {
    flex-shrink: 0;
}

/* New file button + dropdown — fixed so it escapes sidebar overflow:hidden */
.new-file-menu {
    position: fixed;
    z-index: 9000;
    min-width: 160px;
    padding: 4px 0;
    background: var(--bg-alt, #1e1e1e);
    border: 1px solid var(--border, #333);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}
.new-file-item {
    display: block;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--text-secondary, #aaa);
    background: none;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
}
.new-file-item:hover {
    color: var(--text, #f0f0f0);
    background: rgba(255,255,255,0.06);
}

.projects-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.project-item {
    display: block;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 6px 8px;
    margin: 0;
    border-radius: 0;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.projects-list .project-item:last-child {
    border-bottom: none;
}

.project-item:hover {
    color: var(--text);
    background: rgba(255,255,255,0.04);
}

.project-item.active {
    color: var(--text);
    background: rgba(255,255,255,0.06);
    box-shadow: inset 2px 0 0 var(--accent);
}

.project-rename-input {
    width: 100%;
    font-family: inherit;
    font-size: inherit;
    color: var(--text);
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 4px 6px;
    outline: none;
}

.project-context-menu {
    position: fixed;
    z-index: 1000;
    min-width: 160px;
    padding: 4px 0;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.ctx-kbd {
    float: right;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-left: 8px;
}

/* Toast notification */
.mudrag-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: rgba(30,30,30,0.96);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.8125rem;
    padding: 8px 16px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    white-space: nowrap;
    max-width: 90vw;
    text-overflow: ellipsis;
    overflow: hidden;
}
.mudrag-toast.mudrag-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.project-context-item {
    display: block;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
}

.project-context-item:hover {
    color: var(--text);
    background: rgba(255,255,255,0.06);
}
.project-context-item-danger {
    color: #e57373;
}
.project-context-item-danger:hover {
    color: #ef5350;
    background: rgba(229,115,115,0.08);
}
.project-context-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.projects-empty {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    padding: 8px 0;
    line-height: 1.5;
}

/* ── Data Sync modal ──────────────────────────────────────── */
.modal-data-sync {
    max-width: 440px;
    width: 100%;
}
.data-sync-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}
.data-sync-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    gap: 12px;
}
.data-sync-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.data-sync-info strong {
    font-size: 0.875rem;
    color: var(--text);
}
.data-sync-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.data-sync-note {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}
.btn-sm {
    font-size: 0.75rem;
    padding: 5px 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Resume Builder modal ─────────────────────────────────── */
.modal-resume-overlay .modal-resume-builder {
    max-width: 900px;
    width: 95vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.resume-builder-header {
    padding: 20px 24px 0;
}
.resume-builder-header h3 {
    margin-bottom: 4px;
}
.resume-builder-body {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 0;
    overflow: hidden;
}
.resume-builder-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    border-right: 1px solid var(--border);
}
.resume-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}
.resume-chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.8125rem;
    line-height: 1.55;
    white-space: pre-wrap;
}
.resume-chat-msg-user {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
}
.resume-chat-msg-assistant {
    align-self: flex-start;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    color: var(--text);
}
.resume-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.resume-chat-input {
    flex: 1;
    resize: none;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8125rem;
    color: var(--text);
    font-family: inherit;
    line-height: 1.4;
}
.resume-chat-input:focus {
    outline: none;
    border-color: var(--accent);
}
.resume-chat-send {
    align-self: flex-end;
}
.resume-builder-preview {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.resume-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}
.resume-sections {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.resume-section-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}
.resume-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.resume-section-content {
    font-size: 0.8rem;
    color: var(--text);
    line-height: 1.5;
    white-space: pre-wrap;
}
.resume-builder-footer {
    display: flex;
    justify-content: flex-end;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

/* Tasks and documents sections */
.tasks-section,
.documents-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.tasks-header,
.documents-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.tasks-header {
    cursor: pointer;
    user-select: none;
}

.tasks-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.section-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
}

.tasks-header.section-collapsed .section-chevron {
    transform: rotate(-90deg);
}

/* Chat composer drop zone */
.chat-composer.chat-drop-active {
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
    background: rgba(99,102,241,0.06);
}

/* Attachment chips */
.attachment-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px 0;
}

.attachment-chips[hidden] { display: none !important; }

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 10px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text);
    max-width: 200px;
}

.attachment-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-chip-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
}

.attachment-chip-remove:hover { color: var(--text); }

.attachment-chip-image {
    padding: 3px 6px 3px 3px;
    gap: 5px;
}
.attachment-chip-thumb {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
    display: block;
}
.attachment-chip-icon {
    font-size: 0.875rem;
    flex-shrink: 0;
}
.attachment-chip-meta {
    font-size: 0.68rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    white-space: nowrap;
}

/* @ mention dropdown */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    padding: 4px;
}

.mention-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.8125rem;
    cursor: pointer;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-dropdown-item:hover {
    background: rgba(255,255,255,0.06);
}

/* Documents drop zone */
.documents-drop-active {
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
    border-radius: 8px;
    background: rgba(99,102,241,0.06);
}

.tasks-header h3,
.documents-header h3 {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.documents-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.documents-header-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
}

.tasks-list {
    overflow-y: auto;
    padding: 2px 0 8px;
}

.tasks-body[hidden] {
    display: none;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 4px;
    border-radius: 6px;
}

.task-item:hover {
    background: rgba(255,255,255,0.05);
}

.task-item-done .task-item-title {
    text-decoration: line-through;
    opacity: 0.7;
}

.task-item-toggle,
.task-item-delete {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border-radius: 4px;
    border: 1px solid rgba(187, 152, 113, 0.32);
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.78);
    cursor: pointer;
    font-size: 0.72rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.task-item-toggle:hover,
.task-item-delete:hover {
    color: var(--text);
    background: rgba(255,255,255,0.08);
}

.task-item-body {
    flex: 1;
    min-width: 0;
}

.task-item-title {
    font-size: 0.76rem;
    color: var(--text);
    line-height: 1.3;
}

.task-item-notes {
    margin-top: 1px;
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-item-meta {
    margin-top: 1px;
    font-size: 0.64rem;
    color: var(--text-secondary);
}

/* ── File tree (VS Code-style) ───────────────────────────────────────── */
.documents-list {
    overflow-y: auto;
    padding: 2px 0 8px;
}

/* Folder */
.document-folder {
    margin-bottom: 0;
}

.document-folder-header {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 2px 6px 2px 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    border-radius: 4px;
    user-select: none;
    min-height: 26px;
    position: relative;
}
.document-folder-header:hover {
    background: rgba(255,255,255,0.06);
}
.document-folder-header.document-folder-drop-target {
    background: rgba(255,255,255,0.1);
    outline: 1px dashed rgba(255,255,255,0.25);
    border-radius: 4px;
}

.document-folder-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
    transform: rotate(0deg);
}
.document-folder-toggle svg { display: block; }
.document-folder-header.expanded .document-folder-toggle {
    transform: rotate(90deg);
}

/* Folder icon */
.document-folder-icon {
    display: flex;
    align-items: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-right: 5px;
    color: #c8a96e;
    opacity: 0.85;
}
.document-folder-icon svg { display: block; }

.document-folder-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
}

/* Folder body — indented with a subtle vertical guide */
.document-folder-body {
    padding-left: 20px;
    position: relative;
}
.document-folder-body::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 4px;
    width: 1px;
    background: rgba(255,255,255,0.07);
}

/* Delete button — hidden until hover */
.btn-delete-folder,
.btn-delete-doc {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 0.8rem;
    line-height: 1;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: 3px;
    padding: 0;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.1s, background 0.1s;
    margin-left: auto;
}
.document-folder-header:hover .btn-delete-folder,
.document-item:hover .btn-delete-doc {
    opacity: 0.6;
}
.btn-delete-folder:hover,
.btn-delete-doc:hover {
    opacity: 1 !important;
    background: rgba(255,255,255,0.1);
}

label.btn-upload {
    cursor: pointer;
    margin: 0;
}

/* File row */
.document-item {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 2px 6px 2px 2px;
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    min-height: 26px;
    position: relative;
}
.document-item:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text);
}
.document-item.document-item-active {
    background: rgba(255,255,255,0.09);
    color: var(--text);
}
.document-item.document-item-selected {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}
.document-item.document-item-dragging {
    opacity: 0.5;
}

/* File type icon */
.document-file-icon {
    display: flex;
    align-items: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-right: 5px;
    opacity: 0.7;
}
.document-file-icon svg { display: block; }

.document-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
}

.document-size {
    font-size: 0.7rem;
    color: var(--muted);
    opacity: 0;
    transition: opacity 0.1s;
    flex-shrink: 0;
    margin-left: 4px;
}
.document-item:hover .document-size {
    opacity: 0.7;
}

.btn-download-doc {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--link);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.btn-delete-doc:hover,
.btn-download-doc:hover {
    color: var(--text);
}

.tasks-hint,
.documents-hint {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    margin: 6px 0 0;
    opacity: 0.8;
}

.msg-task-card {
    margin-top: 10px;
    border: 1px solid rgba(187, 152, 113, 0.22);
    border-radius: 10px;
    padding: 10px 11px;
    background: rgba(187, 152, 113, 0.06);
}

.msg-task-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.78rem;
}

.msg-task-card-empty {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.msg-task-group + .msg-task-group {
    margin-top: 8px;
}

.msg-task-group-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.msg-task-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.75rem;
}

.msg-task-item-toggle {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(187, 152, 113, 0.32);
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.82);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.msg-task-item-toggle:hover {
    background: rgba(187, 152, 113, 0.12);
    border-color: rgba(187, 152, 113, 0.5);
}

.msg-task-item-toggle.is-done {
    background: rgba(187, 152, 113, 0.16);
}

.msg-task-item-done .msg-task-item-title {
    text-decoration: line-through;
    opacity: 0.72;
}

.msg-task-item-title {
    flex: 1;
    min-width: 0;
    color: var(--text);
}

.msg-task-item-meta,
.msg-task-card-more {
    color: var(--text-secondary);
    font-size: 0.68rem;
}

/* Main wrapper: content area + chat panel */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 280px; /* ensure chat never collapses below usable width */
    --right-panel-min-width: 400px; /* keep composer controls on one row in desktop split layouts */
    min-height: 0;
    overflow: hidden;
}

.main-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden; /* children handle their own scroll */
}

.main-wrapper.layout-chat-main {
    flex-direction: row;
}

.main-wrapper.layout-chat-main .chat-panel-wrapper {
    order: 1;
    flex: 1;
    height: auto;
    min-height: 0;
    max-height: none;
    border-top: none;
    border-right: 1px solid var(--border);
}

.main-wrapper.layout-chat-main .chat-resize-handle {
    order: 2;
    width: 6px;
    height: auto;
    cursor: col-resize;
}

.main-wrapper.layout-chat-main .chat-resize-handle::after {
    width: 2px;
    height: calc(100% - 32px);
    margin: 16px 2px;
}

.main-wrapper.layout-chat-main .main-content-area {
    order: 3;
    flex: 0 0 var(--right-panel-width, 400px);
    width: var(--right-panel-width, 400px);
    min-width: var(--right-panel-min-width);
    max-width: 60vw; /* never wider than 60% of viewport */
}

.main-wrapper.layout-chat-main .focus-bar {
    padding: 0;
}

.main-wrapper.layout-chat-main .canvas-drop-zone {
    margin: 10px;
    padding: 12px;
}

/* Canvas first: canvas left, chat right */
.main-wrapper.layout-canvas-main {
    flex-direction: row;
}
.main-wrapper.layout-canvas-main .main-content-area {
    order: 1;
    flex: 1;
    min-width: 0;
    width: auto;
    max-width: none;
}
.main-wrapper.layout-canvas-main .chat-resize-handle {
    order: 2;
    width: 6px;
    height: auto;
    cursor: col-resize;
}
.main-wrapper.layout-canvas-main .chat-resize-handle::after {
    width: 2px;
    height: calc(100% - 32px);
    margin: 16px 2px;
}
.main-wrapper.layout-canvas-main .chat-panel-wrapper {
    order: 3;
    flex: 0 0 var(--right-panel-width, 360px);
    width: var(--right-panel-width, 360px);
    min-width: var(--right-panel-min-width);
    max-width: 60vw;
    height: auto;
    min-height: 0;
    max-height: none;
    align-self: stretch;
    border-top: none;
    border-left: 1px solid var(--border);
}

.main-wrapper.right-panel-hidden .main-content-area {
    display: none;
}

.main-wrapper.right-panel-hidden .chat-resize-handle {
    display: none;
}

.main-wrapper.right-panel-hidden .chat-panel-wrapper {
    flex: 1;
    height: auto;
    max-height: none;
    border-top: none;
    border-right: none;
}

/* Hide chat — canvas/document takes full width, chat panel hidden */
.main-wrapper.chat-hidden .chat-panel-wrapper {
    display: none;
}
.main-wrapper.chat-hidden .chat-resize-handle {
    display: none;
}
.main-wrapper.chat-hidden .main-content-area {
    flex: 1;
    width: auto !important;
    max-width: none !important;
    min-width: 0;
}

/* ── Focus / tab bar ──────────────────────────────────────────────────────── */
.focus-bar {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-alt);
    height: 36px;
    overflow: hidden;
}

/* Pinned focus tabs on the left */
.focus-tab {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-right: 1px solid var(--border);
    padding: 0 14px;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    transition: color 0.12s;
}
.focus-tab:hover { color: var(--text); }
.focus-tab.focus-tab-active {
    color: var(--accent);
    background: rgba(184,168,138,0.08);
}

/* Scrollable doc-tabs strip */
.doc-tabs-scroll {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    display: flex;
    align-items: stretch;
}
.doc-tabs-scroll::-webkit-scrollbar { display: none; }

.doc-tabs {
    display: flex;
    align-items: stretch;
    min-width: 0;
}

/* Individual document tab */
.doc-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 10px 0 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-right: 1px solid var(--border);
    white-space: nowrap;
    max-width: 180px;
    min-width: 80px;
    position: relative;
    transition: background 0.1s, color 0.1s;
    user-select: none;
}
.doc-tab:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.doc-tab.doc-tab-active {
    background: var(--bg);
    color: var(--text);
    border-bottom: 2px solid var(--accent);
}

.doc-tab-icon {
    font-size: 0.6875rem;
    flex-shrink: 0;
    opacity: 0.6;
}
.doc-tab-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-tab-close {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.1s, background 0.1s;
}
.doc-tab:hover .doc-tab-close,
.doc-tab.doc-tab-active .doc-tab-close { opacity: 0.6; }
.doc-tab-close:hover { opacity: 1 !important; background: rgba(255,255,255,0.1); color: var(--text); }

/* Zoom controls pinned to the right */
.canvas-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0;
    border-left: 1px solid var(--border);
    padding: 0;
    flex-shrink: 0;
    margin-left: auto;
}

.canvas-pane {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
}

.canvas-pane[hidden] {
    display: none;
}

.document-viewer-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.document-viewer-pane[hidden] {
    display: none;
}

.pm-ops-pane {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 16px;
}

.pm-ops-pane[hidden] {
    display: none;
}

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

.pm-ops-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    gap: 10px;
}

.pm-ops-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pm-ops-card h3 {
    font-size: 0.9rem;
    margin: 0;
    font-weight: 600;
}

.pm-ops-hint {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.pm-ops-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.pm-ops-stat {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.18);
    text-align: center;
}

.pm-ops-stat-label {
    font-size: 0.66rem;
    color: var(--text-secondary);
    display: block;
}

.pm-ops-stat-value {
    margin-top: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.pm-ops-actions,
.pm-intel-actions,
.pm-inbox-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pm-ops-board {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 120px;
    max-height: 320px;
    overflow-y: auto;
}

.pm-ops-row {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    padding: 8px;
}

.pm-ops-row-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.pm-ops-row-title {
    font-size: 0.77rem;
    font-weight: 600;
    color: var(--text);
}

.pm-ops-row-meta {
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.pm-ops-badge {
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.62rem;
    padding: 2px 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pm-ops-row-actions {
    margin-top: 7px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pm-intel-input-row {
    display: flex;
    gap: 6px;
}

.pm-intel-input-row input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 8px;
    background: var(--bg);
    color: var(--text);
}

.pm-intel-results,
.pm-inbox-results {
    margin-top: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    min-height: 72px;
    max-height: 280px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.18);
}

.pm-intel-citation {
    border: 1px solid rgba(184, 168, 138, 0.25);
    border-radius: 7px;
    padding: 8px;
    margin-bottom: 6px;
    background: rgba(184, 168, 138, 0.08);
}

.pm-intel-citation:last-child {
    margin-bottom: 0;
}

.pm-intel-citation-title {
    font-size: 0.74rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.pm-intel-citation-snippet {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* No separate header — tabs live in focus-bar */

/* ── Document viewer content shell ─────────────────────────────────────── */
.document-viewer-content {
    flex: 1;
    overflow: hidden; /* children manage own scroll */
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.document-viewer-pane {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

/* ── dv-viewer-wrap: full-height column host ──────────────────────────── */
.dv-viewer-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    flex: 1;
}

/* ── Toolbar ─────────────────────────────────────────────────────────── */
.dv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-alt);
    min-height: 36px;
}
.dv-toolbar-left  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dv-toolbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.dv-pill {
    font-family: inherit;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.dv-pill:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.dv-pill.dv-pill-active { background: rgba(184,168,138,0.12); color: var(--accent); border-color: rgba(184,168,138,0.35); }

.dv-btn {
    font-family: inherit;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.dv-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.dv-btn.dv-btn-save { background: rgba(184,168,138,0.15); color: var(--accent); border-color: rgba(184,168,138,0.4); }
.dv-btn.dv-btn-save:hover { background: rgba(184,168,138,0.25); }

.dv-type-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    border: 1px solid var(--border);
}

.dv-empty { color: var(--text-secondary); font-size: 0.875rem; padding: 24px; }

/* ── Body — scrollable content area ──────────────────────────────────── */
.dv-body {
    flex: 1;
    overflow: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.dv-body::-webkit-scrollbar { width: 5px; height: 5px; }
.dv-body::-webkit-scrollbar-track { background: transparent; }
.dv-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 4px; }
.dv-body::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ── MD rendered ─────────────────────────────────────────────────────── */
.dv-body .doc-viewer-md {
    padding: 20px 24px;
}

/* ── PDF ────────────────────────────────────────────────────────────── */
.dv-pdf-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
.dv-pdf-wrap iframe {
    flex: 1;
    border: none;
    width: 100%;
    min-height: 0;
}

/* ── Image ──────────────────────────────────────────────────────────── */
.dv-img-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    min-height: 200px;
}
.dv-img-wrap img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ── Code/text editor ────────────────────────────────────────────────── */
.dv-code-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
.dv-code-editor {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    resize: none;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--font-mono, 'SF Mono', Monaco, monospace);
    font-size: 0.8125rem;
    line-height: 1.6;
    padding: 16px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    tab-size: 2;
    -moz-tab-size: 2;
}
.dv-code-editor::-webkit-scrollbar { width: 5px; }
.dv-code-editor::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.dv-md-editor { font-family: inherit; font-size: 0.9rem; }

/* ── JSON highlight ──────────────────────────────────────────────────── */
.doc-viewer-json { padding: 16px 20px; white-space: pre; overflow: auto; }
.json-key  { color: #9ecbff; }
.json-str  { color: #a8d8a8; }
.json-num  { color: #f0c674; }
.json-bool { color: #cc99cd; }
.json-null { color: #f9856a; }

/* ── Spreadsheet ─────────────────────────────────────────────────────── */
.dv-spreadsheet {
    overflow: auto;
    height: 100%;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.dv-spreadsheet::-webkit-scrollbar { width: 6px; height: 6px; }
.dv-spreadsheet::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
.dv-spreadsheet::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 4px; }

.dv-csv-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
    width: max-content;
    min-width: 100%;
}
.dv-rn-col { width: 36px; }
.dv-rn-corner {
    position: sticky; top: 0; left: 0; z-index: 3;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.dv-col-header {
    position: sticky; top: 0; z-index: 2;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    border-right: 1px solid rgba(255,255,255,0.05);
    padding: 4px 8px;
    font-weight: 500;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-align: center;
    user-select: none;
    min-width: 80px;
}
.dv-rn {
    position: sticky; left: 0; z-index: 1;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    padding: 4px 6px;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-align: right;
    user-select: none;
    min-width: 36px;
}
.dv-cell {
    border-bottom: 1px solid rgba(255,255,255,0.05);
    border-right: 1px solid rgba(255,255,255,0.04);
    padding: 4px 8px;
    color: var(--text);
    min-width: 80px;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    outline: none;
    vertical-align: middle;
}
.dv-cell:focus {
    background: rgba(184,168,138,0.08);
    outline: 1px solid var(--accent);
    outline-offset: -1px;
    overflow: visible;
    white-space: normal;
    word-break: break-word;
    z-index: 1;
    position: relative;
}
.dv-cell-header {
    background: rgba(255,255,255,0.03);
    font-weight: 600;
    color: var(--text);
}
.dv-csv-table tr:hover .dv-cell:not(:focus) {
    background: rgba(255,255,255,0.025);
}

/* ── Excel sheet tabs ─────────────────────────────────────────────────── */
.dv-sheet-tabs { display: flex; gap: 4px; align-items: center; }
.dv-sheet-tab {
    font-family: inherit;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 4px 4px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
}
.dv-sheet-tab-active { background: rgba(255,255,255,0.06); color: var(--text); }

/* ── DOCX content ─────────────────────────────────────────────────────── */
.doc-viewer-docx { padding: 20px 24px; font-size: 0.9375rem; line-height: 1.7; color: var(--text); }
.doc-viewer-docx h1,.doc-viewer-docx h2,.doc-viewer-docx h3 { margin: 1em 0 0.5em; font-weight: 600; }
.doc-viewer-docx p { margin: 0 0 0.75em; }
.doc-viewer-docx ul,.doc-viewer-docx ol { margin: 0 0 0.75em; padding-left: 1.5em; }
.doc-viewer-docx table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.doc-viewer-docx th,.doc-viewer-docx td { border: 1px solid var(--border); padding: 7px 10px; }
.doc-viewer-docx th { background: rgba(255,255,255,0.04); font-weight: 600; }

/* ── Save flash ───────────────────────────────────────────────────────── */
.dv-save-flash {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(60,160,80,0.9);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 100;
}
.dv-save-flash.dv-save-flash-show { opacity: 1; }

/* ── Dirty indicator dot ──────────────────────────────────────────────── */
.doc-tab-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-left: -2px;
}

/* Image centering in viewer — legacy alias */
.doc-viewer-img-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 16px;
}
.doc-viewer-img-wrap img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}
.doc-load-error {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 24px;
}

.doc-viewer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.doc-viewer-table th,
.doc-viewer-table td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.doc-viewer-table th {
    background: var(--bg-alt);
    font-weight: 600;
}

.doc-viewer-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.doc-viewer-text {
    font-family: var(--font-mono, 'SF Mono', Monaco, monospace);
    font-size: 0.8125rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Markdown rendered view */
.doc-viewer-md {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text);
    max-width: 680px;
}
.doc-viewer-md .md-h1 { font-size: 1.5rem; font-weight: 700; margin: 0.2em 0 0.5em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.doc-viewer-md .md-h2 { font-size: 1.2rem; font-weight: 700; margin: 1.4em 0 0.4em; }
.doc-viewer-md .md-h3 { font-size: 1rem; font-weight: 600; margin: 1.2em 0 0.35em; }
.doc-viewer-md .md-h4 { font-size: 0.9375rem; font-weight: 600; margin: 1em 0 0.3em; color: var(--text-secondary); }
.doc-viewer-md .md-h5, .doc-viewer-md .md-h6 { font-size: 0.875rem; font-weight: 600; margin: 0.8em 0 0.25em; color: var(--text-secondary); }
.doc-viewer-md .md-p { margin: 0 0 0.75em; }
.doc-viewer-md .md-spacer { height: 0.4em; }
.doc-viewer-md .md-hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }
.doc-viewer-md .md-ul, .doc-viewer-md .md-ol { margin: 0 0 0.75em; padding-left: 1.6em; }
.doc-viewer-md .md-ul li, .doc-viewer-md .md-ol li { margin-bottom: 0.25em; }
.doc-viewer-md .md-blockquote {
    border-left: 3px solid var(--accent);
    margin: 0.75em 0;
    padding: 0.5em 1em;
    background: rgba(184,168,138,0.06);
    border-radius: 0 4px 4px 0;
    color: var(--text-secondary);
}
.doc-viewer-md .md-blockquote p { margin: 0; }
.doc-viewer-md code {
    font-family: var(--font-mono, 'SF Mono', Monaco, monospace);
    font-size: 0.8125rem;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 1px 5px;
}
.doc-viewer-md .doc-viewer-code-block {
    font-family: var(--font-mono, 'SF Mono', Monaco, monospace);
    font-size: 0.8125rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 12px 16px;
    margin: 0.75em 0;
    overflow-x: auto;
    white-space: pre;
    position: relative;
}
.doc-viewer-md .doc-viewer-code-block[data-lang]::before {
    content: attr(data-lang);
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.doc-viewer-md a { color: var(--accent); text-decoration: underline; }
.doc-viewer-md strong { font-weight: 700; }
.doc-viewer-md em { font-style: italic; }
.doc-viewer-md del { text-decoration: line-through; color: var(--text-secondary); }
.doc-viewer-md .md-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin: 1em 0;
}
.doc-viewer-md .md-table th,
.doc-viewer-md .md-table td {
    border: 1px solid var(--border);
    padding: 7px 12px;
    text-align: left;
    vertical-align: top;
}
.doc-viewer-md .md-table th {
    background: rgba(255,255,255,0.04);
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text);
}
.doc-viewer-md .md-table tr:hover td {
    background: rgba(255,255,255,0.03);
}

.doc-viewer-docx {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text);
}

.doc-viewer-docx h1, .doc-viewer-docx h2, .doc-viewer-docx h3 {
    margin: 1em 0 0.5em;
    font-weight: 600;
}

.doc-viewer-docx p {
    margin: 0 0 0.75em;
}

.doc-viewer-docx ul, .doc-viewer-docx ol {
    margin: 0 0 0.75em;
    padding-left: 1.5em;
}

.doc-viewer-docx table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.doc-viewer-docx th, .doc-viewer-docx td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.doc-viewer-docx th {
    background: var(--bg-alt);
    font-weight: 600;
}

.canvas-pane {
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
    /* Pane is the scroll root — it must not be clipped by parent */
    min-width: 0;
    min-height: 0;
}
.canvas-pane::-webkit-scrollbar { width: 6px; height: 6px; }
.canvas-pane::-webkit-scrollbar-track { background: transparent; }
.canvas-pane::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.13); border-radius: 4px; }
.canvas-pane::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

.canvas-drop-zone {
    /* Must be at least as tall as the pane so drop target works everywhere */
    min-height: 100%;
    min-width: 100%;
    padding: 16px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    margin: 12px;
    display: inline-flex;   /* shrink-wraps to content width */
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    box-sizing: border-box;
    /* NO overflow:hidden — let canvas-pane do the scrolling */
}

.canvas-drop-zone.drag-over {
    border-color: var(--link);
    background: rgba(229, 229, 229, 0.03);
}

.canvas-empty-hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0 0 16px;
}

.canvas-zoom-btn {
    width: 28px;
    height: 36px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-left: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.1s, background 0.1s;
}

.canvas-zoom-btn:hover {
    color: var(--text);
    background: rgba(255,255,255,0.06);
}

.canvas-zoom-level {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    min-width: 38px;
    text-align: center;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    height: 36px;
    line-height: 36px;
}

.canvas-cards-wrap {
    transform-origin: top left;
    /* width/height set dynamically by JS */
}

.canvas-cards {
    position: relative;
    min-height: 200px;
    min-width: 200px;
}

/* ── Canvas card ─────────────────────────────────────────────────────────── */
.canvas-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: grab;
    display: flex;
    flex-direction: column;
    width: 168px;
    position: absolute;
    overflow: hidden;
    transition: box-shadow 0.15s, border-color 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.canvas-card:hover {
    border-color: rgba(255,255,255,0.18);
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

.canvas-card-dragging {
    cursor: grabbing;
    z-index: 100;
    box-shadow: 0 12px 32px rgba(0,0,0,0.55);
    border-color: rgba(255,255,255,0.25);
}

/* Delete button — hidden until hover */
.canvas-card-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 2;
    width: 18px;
    height: 18px;
    font-size: 0.75rem;
    line-height: 18px;
    text-align: center;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.55);
    border: none;
    cursor: pointer;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.12s, background 0.12s;
    padding: 0;
}
.canvas-card:hover .canvas-card-delete { opacity: 1; }
.canvas-card-delete:hover { background: rgba(200,60,60,0.75); color: #fff; }

/* ── Preview area ────────────────────────────────────────────────────────── */
.canvas-card-preview {
    width: 100%;
    height: 180px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.18);
    border-bottom: 1px solid var(--border);
}

/* PDF */
.canvas-card-preview-pdf {
    background: #fff;
}
.canvas-card-preview-pdf iframe {
    width: 300%;
    height: 300%;
    border: none;
    pointer-events: none;
    transform: scale(0.333);
    transform-origin: top left;
}

/* Image */
.canvas-card-preview-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

/* Text / Markdown */
.canvas-card-preview-text {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 8px;
}
.canvas-card-text-inner {
    font-family: var(--font-mono, 'SF Mono', Monaco, monospace);
    font-size: 0.4375rem;
    line-height: 1.4;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    overflow: hidden;
    max-height: 164px;
}

/* Generic doc icon */
.canvas-card-preview-icon {
    background: rgba(0,0,0,0.12);
}
.canvas-card-icon-svg {
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
    opacity: 0.4;
    display: flex;
    align-items: center;
    justify-content: center;
}
.canvas-card-icon-svg svg {
    width: 48px;
    height: 48px;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.canvas-card-footer {
    padding: 7px 8px 7px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
}
.canvas-card-name {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.canvas-card-size {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

.chat-resize-handle {
    flex-shrink: 0;
    height: 6px;
    cursor: row-resize;
    background: transparent;
    user-select: none;
}

.chat-resize-handle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.chat-resize-handle::after {
    content: '';
    display: block;
    height: 2px;
    background: var(--border);
    margin: 2px 16px;
    border-radius: 1px;
}

.chat-panel-wrapper {
    flex-shrink: 0;
    height: var(--chat-panel-height, 280px);
    min-height: 120px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    min-width: 280px; /* prevent chat from collapsing so narrow the toolbar clips */
    overflow: hidden;
    border-top: 1px solid var(--border);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    min-width: 0;
    width: 100%;
    padding: 0 16px;
}

.chat-quick-actions {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 8px 0 12px;
    border-bottom: 1px solid var(--border);
}

.quick-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.desktop-tools-wrap {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.quick-btn {
    font-family: inherit;
    font-size: 0.8125rem;
    padding: 6px 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
}

.quick-btn:hover {
    color: var(--text);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.btn-copy-chat {
    font-family: inherit;
    font-size: 0.75rem;
    padding: 6px 10px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-copy-chat:hover {
    color: var(--text);
    border-color: var(--text-secondary);
}

.btn-copy-chat.copied {
    color: #6ee7b7;
    border-color: #6ee7b7;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 0 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overscroll-behavior: contain;
}

.chat-messages-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Compact inline status bar — replaces the old bubble card */
.chat-loading-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 2px 8px;
    flex-shrink: 0;
}
.chat-loading-indicator[hidden] {
    display: none !important;
}

.loading-spinner {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.15);
    border-top-color: var(--text-secondary, #888);
    animation: loading-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes loading-spin {
    to { transform: rotate(360deg); }
}

.chat-loading-status {
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
    letter-spacing: 0.01em;
}

.msg-row {
    max-width: min(760px, 84%);
    display: flex;
    flex-direction: column;
}

.msg-row-user {
    align-self: flex-end;
    align-items: flex-end;
}

.msg-row-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.msg {
    max-width: 100%;
    padding: 8px 11px;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.45;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

.msg p {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-user {
    background: #2c2c2c;
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-right-radius: 8px;
}

.msg-assistant {
    background: var(--bg-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 8px;
}

.msg-content.msg-collapsible.msg-collapsed {
    max-height: 6em;
    overflow: hidden;
}

.msg-toggle {
    display: block;
    margin-top: 4px;
    padding: 2px 0 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
}

.msg-toggle:hover {
    color: var(--text);
}

.msg-meta {
    margin-top: 4px;
    font-size: 0.6875rem;
    line-height: 1.2;
    color: var(--text-secondary);
    opacity: 0.72;
    padding: 0 2px;
    letter-spacing: 0.01em;
}


.msg-bullet-list {
    margin: 8px 0;
    padding-left: 1.25em;
}
.msg-bullet-list li {
    margin: 4px 0;
}

.msg-schedule-card {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: auto;
}

.msg-schedule-inner {
    color: var(--text);
}

.msg-schedule-inner .pdf-doc {
    padding: 16px 20px !important;
    font-size: 0.8125rem;
    max-width: 100%;
    background: #1d1d1d;
    color: var(--text);
    border-radius: 6px;
}

/* Proposal uses fully themed inline styles — do not override backgrounds/borders */
.msg-schedule-inner .pdf-doc-proposal {
    padding: 0 !important;
    max-width: 100%;
    border-radius: 6px;
    overflow: hidden;
}

/* Schedule-only table overrides (not for proposal cards) */
.msg-schedule-card:not(.msg-proposal-card) .msg-schedule-inner table {
    font-size: 0.8125rem;
    color: var(--text);
}

.msg-schedule-card:not(.msg-proposal-card) .msg-schedule-inner th {
    background: #2c2c2c !important;
    color: var(--text) !important;
}

.msg-schedule-card:not(.msg-proposal-card) .msg-schedule-inner td {
    border-color: #363636 !important;
}

.msg-schedule-edit {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.msg-schedule-edit-row {
    margin-bottom: 8px;
}

.msg-schedule-edit-row label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.msg-schedule-edit-row input {
    width: 100%;
    font-family: inherit;
    font-size: 0.875rem;
    padding: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
}

.msg-schedule-edit-row input:focus {
    outline: none;
    border-color: #555;
}

.msg-schedule-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.msg-resume-card {
    margin-top: 12px;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.msg-resume-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.msg-resume-icon {
    font-size: 1.5rem;
}
.msg-resume-filename {
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.msg-resume-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.msg-schedule-loading,
.msg-schedule-error {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.chat-input-form {
    flex-shrink: 0;
    padding: 8px 0 14px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

/* Cursor-style composer: text area on top, controls bar on bottom (per Cursor docs/changelog) */
.chat-composer {
    background: #181818;
    border: 1px solid #2c2c2c;
    border-radius: 12px;
    overflow: visible;
    container-type: inline-size;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.chat-composer:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft), 0 10px 26px rgba(0, 0, 0, 0.22);
}

.chat-composer-text-wrap {
    padding: 10px 12px 6px;
}

.chat-composer-input {
    display: block;
    width: 100%;
    min-height: 22px;
    max-height: 180px;
    padding: 0;
    margin: 0;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text);
    background: transparent;
    border: none;
    resize: none;
    overflow-y: hidden;
}

.chat-composer-input::placeholder {
    color: #6b6b6b;
}

.chat-composer-input:focus {
    outline: none;
}

.chat-composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px 8px;
    border-top: 1px solid #262626;
    min-width: 0;
    overflow: visible;
}

.chat-composer-left {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow: visible;
    flex-wrap: wrap;
}

.chat-composer-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-family: inherit;
    font-size: 0.6875rem;
    color: var(--text);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-composer-pill:hover {
    color: var(--text);
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}

.model-select-wrap {
    position: relative;
}

.chat-composer-pill.chat-composer-model {
    position: relative;
    min-width: 0;
    max-width: 160px;
    padding-right: 22px;
}

.chat-composer-pill.chat-composer-model .chat-composer-chevron-up {
    position: absolute;
    right: 8px;
    margin-left: auto;
    transform: rotate(180deg);
    opacity: 0.7;
}

.model-dropdown {
    position: fixed;
    min-width: 140px;
    max-height: 240px;
    background: var(--bg-alt);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    padding: 2px 0;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.04);
    z-index: 9000;
    overflow-y: auto;
}

.model-dropdown[hidden] {
    display: none !important;
}

.model-dropdown-group {
    padding: 2px 0;
}

.model-dropdown-group:not(:first-child) {
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 2px;
    padding-top: 2px;
}

.model-dropdown-label {
    font-size: 0.5625rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px 2px;
}

.model-dropdown-item {
    display: flex;
    align-items: center;
    width: calc(100% - 8px);
    margin: 0 4px;
    text-align: left;
    font-family: inherit;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.12s, background 0.12s;
    white-space: nowrap;
}

.model-dropdown-item:hover {
    color: var(--text);
    background: rgba(255,255,255,0.08);
}

.model-dropdown-item[aria-selected="true"] {
    color: var(--text);
    background: rgba(255,255,255,0.1);
    font-weight: 500;
}

.model-dropdown-tooltip {
    position: fixed;
    z-index: 10000;
    max-width: 220px;
    padding: 8px 10px;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text);
    background: var(--surface-elevated, rgba(30,30,30,0.98));
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    pointer-events: none;
}

.chat-usage-indicator {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    margin-right: 6px;
    white-space: nowrap;
}

.model-policy-hint {
    margin-top: 8px;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--text-secondary);
    min-height: 1.2em;
}

.chat-composer-chevron {
    font-size: 0.5625rem;
    opacity: 0.8;
}

.chat-composer-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.chat-composer-icon,
.chat-composer-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 9px;
    cursor: pointer;
}

.chat-composer-icon,
.chat-composer-send {
    color: #b8a88a;
    background: transparent;
}

.chat-composer-icon:hover,
.chat-composer-send:hover:not(:disabled) {
    color: #d4c4a8;
    background: rgba(255, 255, 255, 0.05);
}

.chat-composer-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.chat-input { flex: 1; }
.chat-send { flex-shrink: 0; }
.model-select-wrap { flex-shrink: 0; }

@container (max-width: 560px) {
    .chat-composer-bar {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .chat-composer-left {
        flex-wrap: nowrap;
        gap: 3px;
    }

    .chat-composer-right {
        width: auto;
        justify-content: flex-end;
        gap: 2px;
    }

    .chat-composer-pill {
        padding: 4px 7px;
        font-size: 0.71875rem;
    }

    .chat-composer-icon,
    .chat-composer-send {
        width: 28px;
        height: 28px;
    }

    .chat-usage-indicator {
        display: none;
    }
}

@container (max-width: 395px) {
    .chat-composer-bar {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .chat-composer-left {
        flex-wrap: wrap;
        flex: 1 1 100%;
    }

    .chat-composer-right {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12000;
    padding: 20px;
}

.modal-overlay.modal-overlay-top {
    z-index: 12010;
}

.modal-overlay[hidden] {
    display: none !important;
}

.modal {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
}

.modal-wide {
    max-width: 420px;
}

.modal h3 {
    margin: 0 0 20px;
    font-size: 1.25rem;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-desc {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0 0 16px;
}
.modal-profile .profile-form {
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}
.modal-profile .profile-form::-webkit-scrollbar { width: 6px; }
.modal-profile .profile-form::-webkit-scrollbar-track { background: transparent; }
.modal-profile .profile-form::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}
.modal-profile .profile-form::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }
.modal-profile .form-row textarea {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 4px;
    resize: vertical;
}
.modal-profile .profile-resume-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.modal-profile .profile-resume-details summary {
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.modal-rates h4 {
    font-size: 0.75rem;
    font-weight: 600;
    margin: 16px 0 8px;
    color: var(--muted);
}
.modal-rates h4:first-of-type { margin-top: 0; }
.rates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}
.rates-row {
    display: contents;
}
.rates-row label {
    font-size: 0.8125rem;
    text-transform: capitalize;
}
.rates-row input {
    width: 80px;
    padding: 6px 8px;
    font-size: 0.8125rem;
}

.btn-primary, .btn-secondary {
    font-family: inherit;
    font-size: 0.9375rem;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--text);
    color: var(--bg);
    font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
    background: var(--text-secondary);
}

.btn-secondary {
    background: var(--bg-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

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

.btn-danger {
    font-family: inherit;
    font-size: 0.9375rem;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    background: #c0392b;
    color: #fff;
    font-weight: 600;
}
.btn-danger:hover {
    background: #a93226;
}
.btn-danger-sm {
    font-family: inherit;
    font-size: 0.8125rem;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    background: rgba(192,57,43,0.15);
    color: #e74c3c;
    font-weight: 600;
    transition: background 0.15s;
}
.btn-danger-sm:hover:not(:disabled) {
    background: rgba(192,57,43,0.3);
}
.btn-danger-sm:disabled {
    background: transparent;
    color: var(--text-secondary);
    cursor: default;
}

/* Confirm delete modal */
.modal-confirm-delete {
    max-width: 300px;
    padding: 18px 20px 16px;
}
.modal-confirm-delete h3 {
    margin: 0 0 6px;
    font-size: 0.9375rem;
    word-break: break-word;
}
.modal-confirm-delete p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0 0 14px;
    line-height: 1.4;
}
.modal-confirm-delete .modal-actions {
    justify-content: flex-end;
    gap: 8px;
    margin-top: 0;
}

/* Duplicate files modal */
.modal-duplicates {
    max-width: 500px;
    width: 100%;
}
.modal-duplicates h3 {
    margin: 0 0 6px;
}
.modal-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 16px;
}
.duplicates-list {
    max-height: 50vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.duplicates-list::-webkit-scrollbar { width: 5px; }
.duplicates-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 4px; }
.dupe-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.dupe-group-name {
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 8px 12px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}
.dupe-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.dupe-row:last-child { border-bottom: none; }
.dupe-info {
    font-size: 0.8125rem;
    color: var(--text);
}
.dupe-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dupe-select-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    user-select: none;
}
.dupe-select-checkbox {
    accent-color: var(--accent);
}

.modal input[type="text"],
.modal input[type="number"],
.modal input[type="email"],
.modal input[type="tel"],
.modal input[type="url"],
.modal select {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 4px;
}

.form-row {
    margin-bottom: 14px;
}

.form-row label {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-row-inline {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-row-inline label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-row-inline input {
    margin: 0;
}

/* Estimate result */
.estimate-result {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-alt);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.estimate-result h4 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.est-total {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text);
}

.est-range, .est-perlf, .est-duration {
    margin: 4px 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.est-breakdown {
    margin-top: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.est-error {
    color: #f87171;
    margin: 0;
}

.estimate-feedback {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.estimate-feedback h4 {
    margin: 0 0 10px;
    font-size: 0.9375rem;
}

.estimate-feedback input {
    margin-right: 10px;
    margin-bottom: 10px;
}

.feedback-success { color: #6ee7b7; margin: 0; }
.feedback-error { color: #f87171; margin: 0; }

.est-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.est-actions .btn-sm {
    padding: 8px 14px;
    font-size: 0.875rem;
    margin-right: 8px;
}

.modal textarea {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 4px;
    resize: vertical;
}

/* Footer */
.footer {
    padding: 20px 0;
    border-top: 1px solid var(--border);
}

.footer p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer-mini {
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid var(--border);
}

/* Documentation */
.doc-intro {
    margin: 0;
    color: var(--text-secondary);
}

.skill-title {
    margin: 0 0 12px;
    font-size: 1.375rem;
    font-weight: 700;
}

.skill-tip {
    margin: 16px 0 0;
    padding: 12px 14px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--border);
}

.automation-list {
    margin: 0 0 24px;
    padding-left: 1.5rem;
}

.automation-list li {
    margin-bottom: 12px;
}

.download-cta {
    margin: 24px 0 0;
}

.download-cta-centered {
    text-align: center;
}

.download-cta-centered .btn-download {
    margin-top: 8px;
}

.download-version {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.btn-download {
    display: inline-block;
    padding: 12px 24px;
    background: var(--text);
    color: var(--bg);
    font-weight: 700;
    text-decoration: none;
    border-radius: 8px;
    transition: opacity 0.2s;
}

.btn-download:hover {
    opacity: 0.9;
}

.download-hint {
    margin: 12px 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.download-secondary {
    margin: 8px 0 0;
    font-size: 0.875rem;
}

.download-secondary a {
    color: var(--text-secondary);
    text-decoration: underline;
}

.download-secondary a:hover {
    color: var(--link);
}

.pricing-card {
    padding: 32px;
    background: var(--bg-alt);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.pricing-card h2 {
    margin: 0 0 12px;
}

.pricing-desc {
    margin: 0 0 20px;
    color: var(--text-secondary);
}

.pricing-features {
    margin: 0 0 24px;
    padding-left: 1.5rem;
}

.pricing-features li {
    margin-bottom: 8px;
}

.subscribe-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.subscribe-form input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
}

.subscribe-error {
    margin: 12px 0 0;
    color: #e57373;
    font-size: 0.9375rem;
}

.modal-overlay.upgrade-modal .modal {
    max-width: 420px;
    position: relative;
}

.upgrade-modal .modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upgrade-modal .btn-primary {
    padding: 10px 20px;
    font-size: 0.9375rem;
}

#dev-access-section input[type="password"] {
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.upgrade-modal .btn-download {
    text-align: center;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-spaced + .settings-item-spaced {
    margin-top: 20px;
}

.usage-progress-wrap {
    margin-top: 8px;
    margin-bottom: 4px;
}
.usage-progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.usage-progress-fill {
    height: 100%;
    background: var(--accent, #6ee7b7);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.settings-item:hover {
    color: var(--text);
}

.settings-label {
    font-size: 1rem;
}

.settings-arrow {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.settings-item-inline {
    flex-wrap: wrap;
    gap: 12px;
}

.settings-item-inline .settings-inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.settings-item-inline input[type="email"] {
    padding: 8px 12px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    min-width: 180px;
}

.msg-choose-email {
    margin-top: 8px;
}
.msg-choose-email-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.msg-choose-email-btn {
    font-size: 0.8125rem;
    padding: 4px 10px;
}

/* ── Compact email results list ──────────────────────────────────────────── */
.msg-email-results {
    margin-top: 10px;
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 8px;
    overflow: hidden;
}
/* Scrollable list capped at ~8 rows */
.msg-email-results-list {
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb, #404040) transparent;
}
.msg-email-result-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--border, #2a2a2a);
    transition: background 0.12s;
    min-height: 0;
}
.msg-email-result-row:last-child { border-bottom: none; }
.msg-email-result-row:hover { background: rgba(255,255,255,0.04); }
.msg-email-unread { border-left: 2px solid var(--accent, #e8d5b7); padding-left: 6px; }
.msg-email-result-info {
    display: grid;
    grid-template-columns: minmax(80px, 130px) 1fr 48px;
    align-items: center;
    gap: 0 6px;
    min-width: 0;
    overflow: hidden;
}
.msg-email-sender {
    color: var(--text);
    font-weight: 600;
    font-size: 0.76rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-email-result-subject {
    font-size: 0.73rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-email-result-date {
    font-size: 0.68rem;
    opacity: 0.45;
    white-space: nowrap;
    text-align: right;
}
/* Status message appears below the row */
.msg-email-import-status {
    grid-column: 1 / -1;
    font-size: 0.65rem;
    color: var(--accent, #e8d5b7);
    padding: 1px 0 2px;
    display: none;
}
.msg-email-import-status:not(:empty) { display: block; }
/* Hide heavy metadata in compact mode */
.msg-email-result-meta,
.msg-email-mailbox { display: none; }
.msg-email-badge {
    font-size: 0.6rem;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 700;
}
.msg-email-badge-unread { background: rgba(232,213,183,0.18); color: var(--accent, #e8d5b7); }
.msg-email-badge-flagged { background: rgba(255,180,0,0.12); color: #ffa500; }
.msg-email-badge-replied { background: rgba(100,200,100,0.12); color: #7dc97d; }

/* Icon-only action buttons */
.msg-email-result-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.msg-email-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 5px;
    border: 1px solid var(--border, #3a3a3a);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    flex-shrink: 0;
}
.msg-email-icon-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}
.msg-email-icon-btn--import {
    color: var(--accent, #e8d5b7);
    border-color: rgba(232,213,183,0.2);
}
.msg-email-icon-btn--import:hover {
    background: rgba(232,213,183,0.1);
    border-color: rgba(232,213,183,0.4);
}
.msg-email-icon-btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.msg-email-import-panel {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
}
.msg-email-import-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.msg-email-import-top-btn {
    margin-bottom: 6px;
}
.msg-email-import-top-status {
    min-height: 1em;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.msg-citations-card {
    margin-top: 10px;
    border: 1px solid rgba(184,168,138,0.35);
    border-radius: 8px;
    background: rgba(184,168,138,0.08);
    padding: 10px;
}

.msg-citations-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.72rem;
}

.msg-citations-label {
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.msg-citations-confidence {
    color: var(--text-secondary);
}

.msg-citations-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.msg-citation-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.16);
    padding: 7px 8px;
}

.msg-citation-source {
    font-size: 0.7rem;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 4px;
}

.msg-citation-snippet {
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.msg-inline-sources {
    margin-top: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.72rem;
    line-height: 1.25;
}

.msg-inline-sources-label {
    color: var(--text-secondary);
    opacity: 0.68;
}

.msg-inline-source-link {
    color: rgba(206, 188, 157, 0.86);
    text-decoration: none;
    border-bottom: 1px solid rgba(206, 188, 157, 0.38);
    transition: color 0.12s ease, border-color 0.12s ease;
}

.msg-inline-source-link:hover {
    color: rgba(224, 207, 178, 0.98);
    border-bottom-color: rgba(224, 207, 178, 0.82);
}

.msg-inline-source-link-more {
    opacity: 0.9;
}

/* ── Local file results ──────────────────────────────────────────────────── */
.msg-file-results {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.msg-file-result-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid var(--border, #2a2a2a);
    transition: background 0.15s;
}
.msg-file-result-row:hover { background: rgba(255,255,255,0.04); }
.msg-file-result-row--relevant { border-left: 3px solid var(--accent, #e8d5b7); }
.msg-file-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.msg-file-ext-icon { font-size: 1.1rem; flex-shrink: 0; }
.msg-file-result-name {
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-file-result-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Slash Command Menu ───────────────────────────────────────────────────── */
.slash-cmd-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-secondary, #1c1c1c);
    border: 1px solid var(--border, #2e2e2e);
    border-radius: 9px;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.55);
    max-height: 260px;
    overflow-y: auto;
    z-index: 200;
    padding: 3px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.slash-cmd-menu::-webkit-scrollbar {
    width: 4px;
}
.slash-cmd-menu::-webkit-scrollbar-track {
    background: transparent;
}
.slash-cmd-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
}
.slash-cmd-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.22);
}
.slash-cmd-category {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-secondary, #666);
    padding: 6px 12px 2px;
}
.slash-cmd-category:first-child {
    padding-top: 4px;
}
.slash-cmd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 5px;
    margin: 0 3px;
    transition: background 0.08s;
}
.slash-cmd-item:hover,
.slash-cmd-item.active {
    background: rgba(255,255,255,0.07);
}
.slash-cmd-item.active {
    background: rgba(107,122,143,0.22);
}
.slash-cmd-name {
    font-size: 0.775rem;
    font-weight: 600;
    color: var(--accent, #6b7a8f);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 80px;
}
.slash-cmd-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text, #e5e5e5);
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.slash-cmd-desc {
    font-size: 0.72rem;
    color: var(--text-secondary, #666);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* Ensure the chat form wrapper is position:relative so the menu positions correctly */
#chat-form,
.chat-form-wrapper {
    position: relative;
}

/* ── Inline Proposal Document ─────────────────────────────────────────────── */
.msg-proposal-doc {
    margin-top: 12px;
    width: 100%;
    overflow-x: auto;
}
.proposal-paper {
    background: #fff;
    color: #000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 11px;
    line-height: 1.5;
    padding: 40px 48px;
    border-radius: 4px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.proposal-paper-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    background: #f5f5f5;
    border: 1px solid #c8c8c8;
    border-radius: 4px;
    margin-bottom: 24px;
}
.proposal-paper-title {
    font-size: 18px;
    font-weight: 700;
    color: #000;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.proposal-paper-for {
    font-size: 10px;
    color: #444;
    margin-bottom: 2px;
}
.proposal-paper-meta {
    font-size: 9px;
    color: #787878;
}
.proposal-section {
    margin-bottom: 20px;
    page-break-inside: avoid;
}
.proposal-section-title {
    background: #404040;
    color: #fff;
    padding: 5px 10px;
    height: 22px;
    line-height: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}
.proposal-section-body {
    font-size: 10px;
    line-height: 1.6;
    color: #323232;
}
.proposal-section-body p {
    margin: 0;
}
.proposal-section-body ul {
    margin: 0;
    padding-left: 20px;
}
.proposal-section-body li {
    margin-bottom: 4px;
}
.proposal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9px;
}
.proposal-table th,
.proposal-table td {
    padding: 6px 8px;
    border: 1px solid #bbb;
    text-align: left;
}
.proposal-table th {
    background: #c8c8c8;
    font-weight: 600;
    font-size: 9px;
}
.proposal-table tbody tr:nth-child(even) td {
    background: #f5f5f5;
}
.proposal-table tr.proposal-total-row td {
    background: #e6e6e6;
    font-weight: 700;
    font-size: 10px;
}
.proposal-footer {
    margin-top: 32px;
    padding-top: 10px;
    border-top: 1px solid #c8c8c8;
    text-align: center;
}
.proposal-footer-box {
    display: inline-block;
    padding: 8px 16px;
    background: #f9f9f9;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
}
.proposal-footer-name {
    font-size: 9px;
    font-weight: 600;
    color: #000;
}
.proposal-footer-contact {
    font-size: 9px;
    color: #646464;
}

/* ── Suggested Action Pills ───────────────────────────────────────────────── */
.msg-suggested-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.msg-action-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-secondary, rgba(255,255,255,0.06));
    color: var(--text);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    white-space: nowrap;
}
.msg-action-pill:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    transform: translateY(-1px);
}
.msg-action-pill:active {
    transform: translateY(0);
}

/* ── Work Finder Card ─────────────────────────────────────────────────────── */
.msg-work-card {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary, rgba(0,0,0,0.2));
}
.msg-work-header {
    padding: 10px 14px;
    background: var(--accent, #2563eb);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.msg-work-title {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
}
.msg-work-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
    overflow-x: auto;
}
.msg-work-tab {
    padding: 8px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.msg-work-tab:hover {
    color: var(--text);
}
.msg-work-tab.active {
    color: var(--accent, #2563eb);
    border-bottom-color: var(--accent, #2563eb);
}
.msg-work-panel {
    display: none;
    padding: 10px;
    flex-direction: column;
    gap: 6px;
}
.msg-work-panel.active {
    display: flex;
}
.msg-work-empty {
    padding: 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}
.msg-work-result-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 7px;
    border: 1px solid var(--border);
}
.msg-work-result-info {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.msg-work-result-info strong {
    color: var(--text);
    font-weight: 600;
}
.msg-work-meta {
    font-size: 0.75rem;
    opacity: 0.75;
}
.msg-work-badge {
    display: inline-block;
    padding: 1px 6px;
    background: var(--accent, #2563eb);
    color: #fff;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    vertical-align: middle;
    margin-right: 4px;
}
.msg-work-action-btn {
    flex-shrink: 0;
    white-space: nowrap;
}
.msg-work-footer {
    padding: 8px 14px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.1);
    opacity: 0.7;
}
.msg-work-footer a {
    color: var(--accent, #2563eb);
    text-decoration: none;
}
/* ────────────────────────────────────────────────────────────────────────── */

.btn-sm {
    padding: 6px 14px;
    font-size: 0.875rem;
}

.settings-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.settings-status-error {
    color: #e57373;
}

.settings-auth-or {
    margin: 8px 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.settings-auth-email {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
}

/* Settings card (auth block) */
.settings-card {
    background: rgba(29, 25, 20, 0.72);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px 36px;
    margin-bottom: 24px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
}

.settings-card-title {
    margin: 0 0 12px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.settings-auth-hint {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0 0 32px;
    line-height: 1.5;
}

.settings-auth-form {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.settings-auth-form input[type="email"] {
    flex: 1;
    min-width: 0;
    padding: 14px 18px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(21, 18, 15, 0.9);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.settings-auth-form input[type="email"]::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.settings-auth-form input[type="email"]:focus {
    outline: none;
    border-color: rgba(187, 152, 113, 0.55);
    box-shadow: 0 0 0 2px rgba(187, 152, 113, 0.18);
}

.settings-auth-form .btn-primary {
    flex-shrink: 0;
    padding: 14px 24px;
    font-weight: 600;
}

.settings-auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0 20px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.settings-auth-divider::before,
.settings-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.settings-auth-divider span {
    padding: 0 16px;
}

.settings-auth-providers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    background: rgba(21, 18, 15, 0.9);
    color: var(--text);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn-oauth:hover {
    background: rgba(187, 152, 113, 0.12);
    border-color: rgba(187, 152, 113, 0.38);
}

.btn-oauth-google {
    border-color: var(--border);
}

.btn-oauth-google:hover {
    border-color: rgba(187, 152, 113, 0.38);
    background: rgba(187, 152, 113, 0.12);
}

.btn-oauth-google svg {
    color: #4285f4;
}

.btn-oauth-apple:hover {
    border-color: rgba(255, 255, 255, 0.25);
}

.settings-auth-status {
    display: block;
    margin-top: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.settings-auth-status-error {
    color: #e57373;
}

.settings-auth-signed-in {
    display: flex;
    align-items: center;
    gap: 16px;
}

.settings-auth-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--border) 0%, var(--bg) 100%);
    flex-shrink: 0;
}

.settings-item-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: rgba(29, 25, 20, 0.72);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.settings-item-link:hover {
    background: rgba(187, 152, 113, 0.12);
    border-color: rgba(187, 152, 113, 0.36);
}

.settings-item-link .settings-label {
    font-weight: 500;
}

.settings-card-compact-list {
    padding: 18px 20px;
}

.settings-card-compact-list .settings-card-title {
    margin-bottom: 10px;
    font-size: 1.0625rem;
}

.settings-card-compact-list .settings-item-link {
    position: relative;
    inset: auto;
    display: flex;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(187, 152, 113, 0.22);
    background: rgba(21, 18, 15, 0.6);
}

.settings-card-compact-list .settings-item-link + .settings-item-link {
    margin-top: 8px;
}

.settings-card-compact-list .settings-item-link .settings-label {
    font-size: 0.95rem;
    font-weight: 600;
}

.settings-card-compact-list .settings-item-link .settings-arrow {
    font-size: 1rem;
    opacity: 0.7;
}

.settings-card-compact-list .settings-item-link:hover {
    background: rgba(187, 152, 113, 0.12);
    border-color: rgba(187, 152, 113, 0.38);
}

/* Mobile sidebar toggle button (shown only on mobile) */
.btn-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin-right: 8px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-sidebar-toggle:hover {
    color: var(--text);
    background: rgba(255,255,255,0.05);
}

/* Mobile overlay for sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 40;
}

.sidebar-overlay.visible {
    display: block;
}

@media (max-width: 768px) {
    .main-wrapper.layout-chat-main {
        flex-direction: column;
    }

    .main-wrapper.layout-chat-main .chat-panel-wrapper {
        order: 3;
        border-right: none;
        border-top: 1px solid var(--border);
    }

    .main-wrapper.layout-chat-main .main-content-area {
        order: 1;
        width: auto;
        max-width: none;
        min-width: 0;
        flex: 1;
    }

    .main-wrapper.layout-chat-main .chat-resize-handle,
    .main-wrapper.layout-canvas-main .chat-resize-handle {
        display: none;
    }

    .main-wrapper.layout-canvas-main .main-content-area {
        order: 1;
    }
    .main-wrapper.layout-canvas-main .chat-panel-wrapper {
        order: 3;
        width: auto;
        max-width: none;
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .btn-sidebar-toggle {
        display: flex;
    }

    .has-app .header-inner {
        grid-template-columns: auto 1fr;
        gap: 12px;
    }

    .projects-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 50;
        width: 280px !important;
        min-width: 280px;
        max-width: 280px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }

    body.has-desktop-title-bar .projects-sidebar,
    body.has-web-bar .projects-sidebar {
        top: 32px;
    }

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

    .sidebar-resize-handle {
        display: none;
    }

    .projects-header h3,
    .documents-header h3,
    .chats-header h3 {
        font-size: 0.6875rem;
    }

    .container {
        padding: 0 16px;
    }

    .hero {
        padding: 48px 0 20px;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .section {
        padding: 20px 0 40px;
    }

    .chat-panel {
        padding: 0 12px;
    }

    .chat-quick-actions {
        gap: 6px;
        padding: 10px 0;
    }

    .chat-quick-actions .quick-btn {
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    .btn-copy-chat {
        font-size: 0.6875rem;
        padding: 5px 8px;
    }

    .chat-composer-bar {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .chat-composer-left {
        flex-wrap: nowrap;
        order: 1;
    }

    .chat-composer-right {
        order: 2;
        margin-left: auto;
    }

    .chat-composer-model {
        font-size: 0.75rem;
        max-width: 120px;
    }

    .modal-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .modal {
        max-width: none;
        margin-bottom: env(safe-area-inset-bottom, 0);
    }

    .tool-panel-content {
        max-height: min(400px, 60vh);
    }

    .nav {
        gap: 16px;
    }

    .nav a {
        font-size: 0.875rem;
    }

    .nav-dropdown .dropdown-menu {
        left: auto;
        right: 0;
    }

    .nav-dropdown .dropdown-menu-right {
        left: auto;
        right: 0;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .canvas-cards {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }

    .canvas-drop-zone {
        margin: 12px;
        padding: 16px;
    }

    .focus-bar {
        padding: 0;
    }

    .doc-tab {
        min-width: 60px;
        max-width: 140px;
    }

    .chat-panel-wrapper {
        min-height: 100px;
    }
}

@media (max-width: 600px) {
    .hero h1 {
        font-size: 1.5rem;
    }

    .chat-panel {
        padding: 0 10px;
    }

    .msg {
        max-width: 95%;
        padding: 8px 12px;
        font-size: 0.875rem;
    }

    .nav {
        gap: 10px;
    }

    .logo-text {
        font-size: 0.875rem;
    }

    .chat-composer-text-wrap {
        padding: 10px 12px 6px;
    }

    .chat-composer-bar {
        padding: 6px 8px 8px;
    }

    .chat-composer-pill {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .chat-composer-icon,
    .chat-composer-send {
        width: 36px;
        height: 36px;
    }

    .chat-icon {
        width: 16px;
        height: 16px;
    }

    .subscribe-form input {
        min-width: 100%;
    }

    .pricing-card {
        padding: 20px;
    }

    .settings-card {
        padding: 20px;
    }

    .settings-auth-form {
        flex-direction: column;
    }

    .settings-auth-form .btn-primary {
        width: 100%;
    }
}

/* Chat empty state — shown when a chat has no messages */
.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 32px 20px 16px;
}

.chat-empty-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 10px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    opacity: 0.5;
}

.chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 420px;
}

.chat-suggestion-chip {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-family: inherit;
    line-height: 1.4;
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.chat-suggestion-chip:hover {
    background: rgba(184, 168, 138, 0.07);
    border-color: rgba(184, 168, 138, 0.4);
    color: var(--text);
}

@media (max-width: 400px) {
    .header-inner {
        padding: 0 12px;
    }

    .nav a {
        font-size: 0.8125rem;
    }

    .projects-sidebar {
        width: 100% !important;
        min-width: 100%;
        max-width: 100%;
    }
}

/* ── Ollama setup banner ─────────────────────────────────────────────────── */
.ollama-setup-banner {
    margin: 0 12px 10px;
    background: rgba(107, 122, 143, 0.07);
    border: 1px solid rgba(107, 122, 143, 0.25);
    border-radius: 10px;
    font-size: 0.8125rem;
    overflow: hidden;
}
.ollama-banner-top {
    padding: 12px 14px 10px;
}
.ollama-banner-title-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 5px;
}
.ollama-banner-icon-svg {
    color: var(--accent, #6b7a8f);
    flex-shrink: 0;
}
.ollama-banner-title {
    font-weight: 600;
    color: var(--text);
    flex: 1;
}
.ollama-banner-msg {
    color: var(--text-secondary, rgba(255,255,255,0.5));
    line-height: 1.5;
    margin-bottom: 10px;
    font-size: 0.79rem;
}
/* Steps */
.ollama-steps {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}
.ollama-step {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    padding: 3px 8px 3px 4px;
    border-radius: 20px;
    border: 1px solid var(--border);
}
.ollama-step-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    flex-shrink: 0;
}
.ollama-step-done {
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.25);
    background: rgba(34, 197, 94, 0.06);
}
.ollama-step-done .ollama-step-dot { background: rgba(34, 197, 94, 0.15); }
.ollama-step-active {
    color: var(--text);
    border-color: var(--accent, #6b7a8f);
    background: rgba(107, 122, 143, 0.1);
    font-weight: 600;
}
.ollama-step-active .ollama-step-dot { background: var(--accent, #6b7a8f); color: #fff; }
.ollama-step-pending {
    color: var(--text-secondary, #666);
    opacity: 0.6;
}
.ollama-step-pending .ollama-step-dot { background: rgba(255,255,255,0.07); color: var(--text-secondary, #666); }
/* Actions area */
.ollama-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 14px 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.ollama-banner-btn {
    padding: 5px 13px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    font-size: 0.79rem;
    font-family: inherit;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}
.ollama-banner-btn:hover { background: rgba(255,255,255,0.1); }
.ollama-banner-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ollama-banner-btn-primary {
    background: var(--accent, #6b7a8f);
    border-color: var(--accent, #6b7a8f);
    color: #fff;
}
.ollama-banner-btn-primary:hover { opacity: 0.85; background: var(--accent, #6b7a8f); }
.ollama-banner-btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary, #666);
    font-size: 0.85rem;
    padding: 2px 4px;
    cursor: pointer;
    line-height: 1;
    margin-left: auto;
}
.ollama-banner-btn-close:hover { color: var(--text); }
/* Pull command block */
.ollama-pull-cmd {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.79rem;
}
.ollama-pull-cmd code {
    font-family: 'SF Mono', 'Consolas', monospace;
    color: #a5b4fc;
    flex: 1;
}
.ollama-copy-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-secondary, #888);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.72rem;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.15s;
}
.ollama-copy-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.ollama-pull-progress {
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
    font-family: 'SF Mono', monospace;
    padding: 4px 0 0;
    width: 100%;
}

/* ── Document Card (template engine output) ────────────────────────────────── */
.msg-doc-card {
    margin-top: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.msg-doc-card.msg-doc-edit-card {
    padding: 14px 16px;
}
.msg-doc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
}
.msg-doc-header svg {
    opacity: 0.7;
    flex-shrink: 0;
}
.msg-doc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
}
.btn-doc {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background .15s, border-color .15s;
    background: rgba(255,255,255,0.06);
    color: inherit;
}
.btn-doc:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2); }
.btn-doc-open, .btn-doc-pdf { border-color: rgba(59,130,246,0.4); color: #93c5fd; }
.btn-doc-open:hover, .btn-doc-pdf:hover { background: rgba(59,130,246,0.15); }
.btn-doc-edit { border-color: rgba(168,85,247,0.4); color: #c4b5fd; }
.btn-doc-edit:hover { background: rgba(168,85,247,0.15); }
.btn-doc-folder { font-size: 0.75rem; opacity: 0.7; }
.msg-doc-notice {
    margin: 0 14px 12px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
}
.msg-doc-notice-ok { background: rgba(22,163,74,0.15); border: 1px solid rgba(22,163,74,0.3); color: #86efac; }
.msg-doc-notice-err { background: rgba(220,38,38,0.15); border: 1px solid rgba(220,38,38,0.3); color: #fca5a5; }

/* ── Plan Sheet Extraction UI ──────────────────────────────────────────────── */
.msg-extract-bid-items {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.msg-extract-header {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.msg-extract-btn {
    margin-bottom: 8px;
}
.msg-extract-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.msg-extract-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.8rem;
}
.msg-extract-table th {
    background: rgba(255,255,255,0.06);
    text-align: left;
    padding: 6px 8px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}
.msg-extract-table td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.msg-extract-table tr:hover td {
    background: rgba(255,255,255,0.03);
}

/* ── In-app Update Notification (Cursor-style) ────────────────────────────── */
#mudrag-update-pill {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    background: var(--bg-secondary, #1c1c1c);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0,0,0,0.3);
    min-width: 280px;
    max-width: 340px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    overflow: hidden;
}
#mudrag-update-pill.update-pill-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.update-pill-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
}
.update-pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent, #e8d5b7);
    flex-shrink: 0;
    box-shadow: 0 0 6px var(--accent, #e8d5b7);
    animation: update-dot-pulse 2s ease-in-out infinite;
}
@keyframes update-dot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.update-pill-text {
    font-size: 0.82rem;
    color: var(--text-secondary, #aaa);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.update-pill-btn {
    background: var(--accent, #e8d5b7);
    color: #1a1a1a;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.15s;
    font-family: inherit;
}
.update-pill-btn:hover:not(:disabled) { opacity: 0.85; }
.update-pill-btn:disabled { opacity: 0.5; cursor: default; }
.update-pill-dismiss {
    background: transparent;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 4px;
    flex-shrink: 0;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.update-pill-dismiss:hover { color: var(--text, #fff); background: rgba(255,255,255,0.06); }
.update-pill-bar {
    padding: 0 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.update-pill-bar-fill-track {
    height: 3px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}
.update-pill-bar-fill {
    height: 3px;
    background: var(--accent, #e8d5b7);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}
.update-pill-bar-label {
    font-size: 0.72rem;
    color: var(--text-secondary, #888);
}

@media (max-width: 1200px) {
    .pm-ops-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .pm-ops-grid {
        grid-template-columns: 1fr;
    }
    .pm-ops-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .pm-intel-input-row {
        flex-direction: column;
    }
}

/* openmud site-theme color pass for /try (layout unchanged) */
body.page-try {
    --bg: #15120f;
    --bg-alt: #1d1914;
    --text: #efe8dd;
    --text-secondary: #b4a692;
    --border: #332a22;
    --accent: #bb9871;
    --accent-soft: rgba(187, 152, 113, 0.24);
    --link: #efe8dd;
    --scrollbar-thumb: #5a4a3b;
    --scrollbar-thumb-hover: #75624f;
}

body.page-try .desktop-title-bar,
body.page-try .header-web-bar {
    background: rgba(21, 18, 15, 0.9);
    border-bottom: 1px solid var(--border);
}

body.page-try .desktop-title-bar-name,
body.page-try .btn-title-bar-icon {
    color: var(--text-secondary);
}

body.page-try .btn-title-bar-icon:hover,
body.page-try .btn-title-bar-icon:focus {
    color: var(--text);
    background: rgba(187, 152, 113, 0.14);
}

body.page-try .focus-bar,
body.page-try .chat-panel,
body.page-try .canvas-pane,
body.page-try .document-viewer-pane {
    background: var(--bg);
}

body.page-try .focus-tab:hover,
body.page-try .focus-tab.focus-tab-active {
    background: rgba(187, 152, 113, 0.14);
    border-color: rgba(187, 152, 113, 0.35);
}

body.page-try .btn-icon-toolbar:hover,
body.page-try .project-item:hover,
body.page-try .document-item:hover,
body.page-try .chat-thread-item:hover {
    background: rgba(187, 152, 113, 0.12);
}

body.page-try .project-item.active,
body.page-try .document-item.document-item-active,
body.page-try .chat-thread-item.active {
    background: rgba(187, 152, 113, 0.18);
}

body.page-try .msg-user {
    background: rgba(187, 152, 113, 0.12);
    border-color: rgba(187, 152, 113, 0.28);
    color: var(--text);
}

body.page-try .msg-assistant {
    background: #1d1713;
    color: var(--text-secondary);
    border-color: rgba(187, 152, 113, 0.14);
}

body.page-try .chat-composer {
    background: #17120f;
    border-color: #342920;
}

body.page-try .chat-composer-input::placeholder {
    color: #9d8d7a;
}

body.page-try .chat-composer-bar {
    border-top-color: #342920;
}

body.page-try .chat-composer-pill {
    background: rgba(187, 152, 113, 0.1);
    border-color: rgba(187, 152, 113, 0.24);
    color: var(--text-secondary);
}

body.page-try .chat-composer-pill:hover {
    background: rgba(187, 152, 113, 0.16);
    border-color: rgba(187, 152, 113, 0.34);
    color: var(--text);
}

body.page-try .chat-composer-icon,
body.page-try .chat-composer-send {
    color: var(--accent);
}

body.page-try .chat-composer-icon:hover,
body.page-try .chat-composer-send:hover:not(:disabled) {
    color: #d9b790;
    background: rgba(187, 152, 113, 0.12);
}

body.page-try .dropdown-menu,
body.page-try .model-dropdown,
body.page-try .project-context-menu {
    background: #1d1914;
    border-color: var(--border);
}

body.page-try .dropdown-item:hover,
body.page-try .model-dropdown-item:hover,
body.page-try .ctx-item:hover {
    background: rgba(187, 152, 113, 0.12);
    color: var(--text);
}

/* Contact choice buttons (shown when agent needs to clarify which contact) */
.contact-choices-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0 4px 0;
    margin-left: 4px;
}

.contact-choice-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: inherit;
    padding: 6px 16px;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.contact-choice-btn:hover {
    background: rgba(187, 152, 113, 0.12);
    border-color: var(--accent);
    color: var(--accent);
}

body.page-try .contact-choice-btn {
    border-color: rgba(187, 152, 113, 0.35);
    color: #c9a87c;
}

body.page-try .contact-choice-btn:hover {
    background: rgba(187, 152, 113, 0.15);
    border-color: #c9a87c;
    color: #d9b790;
}

/* ── Proposal / Document preview card ─────────────────────────────────────── */

.msg-proposal-preview {
    margin: 10px 0 4px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary, #1e1e1e);
}

.msg-proposal-actions {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary, #1e1e1e);
}

.btn-proposal-dl,
.btn-proposal-open {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: inherit;
    padding: 5px 14px;
    transition: background 0.15s, border-color 0.15s;
}

.btn-proposal-dl {
    background: var(--accent, #c9a87c);
    border-color: var(--accent, #c9a87c);
    color: #111;
    font-weight: 500;
}

.btn-proposal-dl:hover {
    opacity: 0.88;
}

.btn-proposal-open:hover {
    background: rgba(187, 152, 113, 0.1);
    border-color: var(--accent, #c9a87c);
    color: var(--accent, #c9a87c);
}

.msg-proposal-frame {
    display: block;
    width: 100%;
    height: 480px;
    border: none;
    border-radius: 0 0 9px 9px;
    background: #fff;
}
