:root {
    --bg: #111009;
    --bg-alt: #0d0b09;
    --text: #eae7e0;
    --text-secondary: #8a8278;
    --border: #252018;
    --border-light: #302820;
    --link: #8a7a6a;
    --earth: #8a7a6a;
    --earth-dark: #5c4e40;
    --earth-light: #a09080;
    --earth-subtle: rgba(138, 122, 106, 0.08);
    --app-height: 100dvh;
}

* {
    box-sizing: border-box;
}

html {
    scrollbar-width: thin;
    scrollbar-color: #2a2520 transparent;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #2a2520;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3028;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 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: hidden;
    min-height: 100vh;
    min-height: 100dvh;
}

body.has-app {
    height: var(--app-height, 100dvh);
}

body.has-app .app-layout {
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

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

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

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(17, 16, 9, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    width: 100%;
    padding: 8px 20px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ─── Brand dropdown (inner pages) ───────────────────────── */
.brand-menu {
    position: relative;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: var(--text);
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

/* Hide native <details> disclosure triangle in all browsers */
.logo::-webkit-details-marker { display: none; }
.logo::marker { display: none; }

.brand-caret {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-top: -1px;
    opacity: 0.7;
    border-right: 1.7px solid currentColor;
    border-bottom: 1.7px solid currentColor;
    transform: rotate(45deg);
    text-indent: -9999px;
    overflow: hidden;
    transition: transform 0.15s ease;
}

.brand-menu[open] .brand-caret {
    transform: rotate(225deg);
}

.brand-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: min(280px, 84vw);
    padding: 6px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
    display: grid;
    gap: 1px;
    z-index: 500;
}

.brand-menu-link {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 8px 10px;
    border-radius: 6px;
    transition: color 0.12s, background 0.12s;
}

.brand-menu-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

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

.nav.chat-header-tools {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chat-header-tool {
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
    padding: 7px 12px;
    background: linear-gradient(180deg, #2b231b 0%, #201911 100%);
    border: 1px solid #4a3a2b;
    border-radius: 10px;
    color: #f2e7d8;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 244, 225, 0.08);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
}

.chat-header-tool:hover {
    background: linear-gradient(180deg, #392d22 0%, #281d15 100%);
    border-color: #5a4735;
    color: #fff5e8;
    transform: translateY(-1px);
}

.chat-header-tool.active {
    background: linear-gradient(180deg, #5f4a36 0%, #433122 100%);
    border-color: #8e7458;
    color: #fff7eb;
    box-shadow: inset 0 1px 0 rgba(255, 246, 230, 0.15), 0 0 0 1px rgba(138, 122, 106, 0.25);
}

.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(--earth-light);
}

/* 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: 160px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 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: 10px 16px;
    cursor: pointer;
}

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

/* 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;
}

.workspace-focusbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 6px;
    padding: 6px 8px;
    border: 1px solid #3a3027;
    border-radius: 10px;
    background: #1a1511;
}

.focus-tab {
    border: 1px solid #3d3227;
    background: #231c16;
    color: #b7a48f;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.15;
    cursor: pointer;
}

.focus-tab-active {
    border-color: #6b5742;
    background: #30251b;
    color: #f4e6d6;
}

.focus-sidebar-toggle {
    min-width: 30px;
    padding: 5px 8px;
    text-align: center;
}

.doc-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
}

.doc-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 280px;
    border: 1px solid #3d3227;
    border-radius: 8px;
    padding: 4px 8px;
    color: #b9a68f;
    background: #211a14;
    cursor: pointer;
    font-size: 0.6875rem;
}

.doc-tab-active {
    border-color: #6b5742;
    color: #f5e8d9;
    background: #2b2118;
}

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

.doc-tab-close {
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
}

.canvas-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.canvas-zoom-controls[hidden] {
    display: none !important;
}

.canvas-zoom-btn {
    border: 1px solid #3f3328;
    background: #241c16;
    color: #d8c4ad;
    border-radius: 6px;
    width: 26px;
    height: 24px;
    cursor: pointer;
}

.canvas-zoom-level {
    min-width: 44px;
    text-align: center;
    font-size: 0.6875rem;
    color: #b8a48e;
}

.canvas-pane,
.document-viewer-pane {
    height: 45vh;
    min-height: 300px;
    margin: 0 0 10px;
    border: 1px solid #4f3d2d;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(49, 38, 28, 0.6) 0%, rgba(36, 28, 21, 0.8) 100%);
    overflow: hidden;
}

.canvas-drop-zone {
    width: 100%;
    height: 100%;
    position: relative;
}

.canvas-empty-hint {
    position: absolute;
    top: 10px;
    left: 12px;
    font-size: 0.75rem;
    color: #bea78d;
}

.canvas-cards-wrap {
    width: 100%;
    height: 100%;
    overflow: auto;
    transform-origin: top left;
}

.canvas-cards {
    position: relative;
    min-width: 100%;
    min-height: 100%;
}

.canvas-card {
    width: 180px;
    min-height: 220px;
    border: 1px solid #5a4735;
    border-radius: 10px;
    background: linear-gradient(180deg, #2f241b 0%, #241a13 100%);
    color: #ecdcc8;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    user-select: none;
    cursor: grab;
}

.canvas-card-preview {
    height: 160px;
    background: rgba(0, 0, 0, 0.2);
}

.canvas-card-preview iframe,
.canvas-card-preview img {
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover;
}

.canvas-card-preview-text {
    padding: 8px;
    font-size: 0.6875rem;
    color: #d8c6b2;
    overflow: hidden;
}

.canvas-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    font-size: 0.6875rem;
}

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

.canvas-card-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
}

.document-viewer-content {
    width: 100%;
    height: 100%;
    overflow: auto;
}

.dv-viewer-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #4f3d2d;
}

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

.dv-pill,
.dv-btn {
    border: 1px solid #5a4735;
    border-radius: 6px;
    background: linear-gradient(180deg, #3a2d22 0%, #2a2018 100%);
    color: #e7d4be;
    padding: 5px 9px;
    font-size: 0.75rem;
    cursor: pointer;
}

.dv-pill-active {
    border-color: #8e7458;
    background: linear-gradient(180deg, #5f4a36 0%, #433122 100%);
    color: #fff4e8;
}

.dv-body {
    flex: 1;
    overflow: auto;
    padding: 10px;
}

.dv-code-editor {
    width: 100%;
    height: 100%;
    min-height: 220px;
    border: 1px solid #5a4735;
    border-radius: 8px;
    background: #221911;
    color: #f0e2d1;
    padding: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
}

.dv-csv-table {
    width: 100%;
    border-collapse: collapse;
}

.dv-csv-table th,
.dv-csv-table td {
    border: 1px solid #4f3d2d;
    padding: 6px 8px;
    font-size: 0.75rem;
}

.dv-pdf-wrap iframe {
    width: 100%;
    height: calc(45vh - 70px);
    border: none;
}

.dv-img-wrap {
    width: 100%;
    height: calc(45vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.dv-img-wrap img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: none;
}

.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;
}

/* Hero */
.hero {
    padding: 80px 0 60px;
    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);
}

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

.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);
}

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

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

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

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

#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;
}

body.sidebar-collapsed .projects-sidebar,
body.sidebar-collapsed .sidebar-resize-handle {
    display: none !important;
}

.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: hidden;
}

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

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

.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);
}

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

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

.btn-new-project {
    color: #b7a48f;
    background: #1f1813;
    border: 1px solid #3b3026;
    border-radius: 6px;
    cursor: pointer;
}

.btn-new-project:hover {
    color: #e6d4bf;
    border-color: #5a4735;
    background: #261e17;
}

.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;
    padding: 6px 8px;
    margin-bottom: 2px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.project-item.active {
    color: var(--text);
    background: var(--border);
}

.project-item-input {
    width: 100%;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--text);
    background: color-mix(in srgb, var(--earth) 12%, var(--bg-alt) 88%);
    border: 1px solid color-mix(in srgb, var(--earth) 45%, var(--border) 55%);
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 2px;
}

.project-item-input:focus {
    outline: none;
    border-color: var(--earth-light);
    box-shadow: 0 0 0 2px rgba(199, 155, 106, 0.18);
}

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

/* Documents section */
.documents-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.documents-section.drop-active {
    border-top-color: var(--earth-light);
    background: rgba(199, 155, 106, 0.08);
}

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

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

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

.btn-upload {
    color: #b7a48f;
    background: #1f1813;
    border: 1px solid #3b3026;
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
}

.btn-upload:hover {
    color: #e6d4bf;
    border-color: #5a4735;
    background: #261e17;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 24px;
    padding: 0;
    border-radius: 6px;
}

.icon-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-upload.btn-folder {
    color: #b7a48f;
    background: #1f1813;
    border: 1px solid #3b3026;
}

.btn-upload.btn-folder:hover {
    color: #e6d4bf;
    border-color: #5a4735;
    background: #261e17;
}

.documents-list {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #404040 transparent;
}

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

.documents-list::-webkit-scrollbar-track {
    background: transparent;
}

.documents-list::-webkit-scrollbar-thumb {
    background: #404040;
    border-radius: 3px;
}

.documents-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 6px;
    margin-bottom: 2px;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.02);
    border-radius: 4px;
}

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

.document-item[draggable="true"] {
    cursor: pointer;
}

.document-item.document-item-dragging {
    opacity: 0.45;
}

.document-folder {
    margin-bottom: 4px;
}

.document-folder-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 6px;
    background: rgba(255,255,255,0.025);
    color: var(--text-secondary);
    font-size: 0.6875rem;
}

.document-folder-header:hover {
    background: rgba(255,255,255,0.05);
}

.document-folder-header.document-folder-drop-target {
    background: rgba(199, 155, 106, 0.16);
    box-shadow: inset 0 0 0 1px rgba(199, 155, 106, 0.35);
}

.document-folder-toggle {
    width: 12px;
    text-align: center;
    color: color-mix(in srgb, var(--earth-light) 75%, var(--text-secondary) 25%);
    user-select: none;
}

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

.document-folder-body {
    margin-left: 12px;
    margin-top: 3px;
    border-left: 1px dashed rgba(199, 155, 106, 0.25);
    padding-left: 7px;
}

.folder-rename-input {
    flex: 1;
    min-width: 0;
    font-family: inherit;
    font-size: 0.6875rem;
    color: var(--text);
    background: color-mix(in srgb, var(--earth) 12%, var(--bg-alt) 88%);
    border: 1px solid color-mix(in srgb, var(--earth) 45%, var(--border) 55%);
    border-radius: 4px;
    padding: 4px 6px;
}

.folder-rename-input:focus {
    outline: none;
    border-color: var(--earth-light);
    box-shadow: 0 0 0 2px rgba(199, 155, 106, 0.18);
}

.document-rename-input {
    flex: 1;
    min-width: 0;
    font-family: inherit;
    font-size: 0.6875rem;
    color: var(--text);
    background: color-mix(in srgb, var(--earth) 12%, var(--bg-alt) 88%);
    border: 1px solid color-mix(in srgb, var(--earth) 45%, var(--border) 55%);
    border-radius: 4px;
    padding: 4px 6px;
}

.document-rename-input:focus {
    outline: none;
    border-color: var(--earth-light);
    box-shadow: 0 0 0 2px rgba(199, 155, 106, 0.18);
}

.doc-context-menu {
    position: fixed;
    z-index: 10000;
    min-width: 170px;
    border: 1px solid #5a4735;
    border-radius: 8px;
    background: linear-gradient(180deg, #2a2119 0%, #1f1812 100%);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
    padding: 6px;
}

.doc-context-menu button {
    display: block;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.8125rem;
    color: #e6d5c1;
    background: transparent;
    border: 0;
    border-radius: 6px;
    padding: 7px 10px;
    cursor: pointer;
}

.doc-context-menu button:hover {
    background: rgba(199, 155, 106, 0.18);
    color: #fff3e5;
}

.doc-context-menu button.danger {
    color: #f2bab0;
}

.doc-context-menu button.danger:hover {
    background: rgba(220, 90, 70, 0.22);
    color: #ffd7d1;
}

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

.document-size {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.btn-delete-doc {
    flex-shrink: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 0 4px;
    cursor: pointer;
    line-height: 1;
}

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

.btn-copy-doc {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--earth-light);
    background: none;
    border: none;
    padding: 0 4px;
    cursor: pointer;
    line-height: 1;
}

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

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

.sidebar-footer-settings {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.btn-sidebar-settings {
    width: 100%;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
}

.btn-sidebar-settings:hover {
    color: var(--text);
    border-color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.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 20px;
}

.chat-quick-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 2px 0 8px;
}

.quick-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.quick-row-label {
    flex: 0 0 auto;
    font-size: 0.5625rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    min-width: 50px;
    opacity: 0.7;
}

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

.quick-tool-btn {
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
    padding: 7px 12px;
    background: linear-gradient(180deg, #2b231b 0%, #201911 100%);
    border: 1px solid #4a3a2b;
    border-radius: 10px;
    color: #f2e7d8;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 244, 225, 0.08);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
}

.quick-tool-btn:hover {
    background: linear-gradient(180deg, #392d22 0%, #281d15 100%);
    border-color: #5a4735;
    color: #fff5e8;
    transform: translateY(-1px);
}

.quick-tool-btn:focus-visible {
    outline: 2px solid rgba(176, 147, 114, 0.45);
    outline-offset: 2px;
}

.quick-tool-btn.active {
    background: linear-gradient(180deg, #5f4a36 0%, #433122 100%);
    border-color: #8e7458;
    color: #fff7eb;
    box-shadow: inset 0 1px 0 rgba(255, 246, 230, 0.15), 0 0 0 1px rgba(138, 122, 106, 0.25);
}

.quick-btn {
    font-family: inherit;
    font-size: 0.6875rem;
    padding: 4px 9px;
    background: #1d1712;
    border: 1px solid #30261e;
    border-radius: 8px;
    color: #a9957e;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.quick-btn:hover {
    color: #ddcbb7;
    border-color: #4a3c2f;
    background: #231c16;
}

.btn-copy-chat {
    font-family: inherit;
    font-size: 0.625rem;
    padding: 4px 8px;
    background: transparent;
    border: 1px dashed #3e3329;
    border-radius: 8px;
    color: #98856f;
    cursor: pointer;
    margin-left: auto;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.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: 16px 0 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #404040 transparent;
}

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

.chat-loading-indicator {
    flex-shrink: 0;
}

.msg-loading-bubbles {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.8;
    animation: loading-bounce 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes loading-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

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

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #404040;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9375rem;
    line-height: 1.5;
}

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

.msg-user {
    align-self: flex-end;
    background: #2a2a2a;
    color: var(--text);
    border: 1px solid var(--border);
}

.msg-assistant {
    align-self: flex-start;
    background: var(--bg-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

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

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

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

.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: 20px !important;
    font-size: 0.875rem;
    background: #1a1a1a;
    color: var(--text);
    border-radius: 6px;
}

.msg-schedule-inner table {
    font-size: 0.8125rem;
    color: var(--text);
}

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

.msg-schedule-inner td {
    border-color: #333 !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-schedule-loading,
.msg-schedule-error {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.chat-input-form {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 4;
    padding: 12px 0 20px;
    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: linear-gradient(180deg, #2a2118 0%, #1f1812 100%);
    border: 1px solid #5a4735;
    border-radius: 10px;
    overflow: visible;
    position: relative;
    z-index: 20;
    box-shadow: inset 0 1px 0 rgba(255, 244, 225, 0.08);
}

.chat-composer:focus-within {
    border-color: #8e7458;
    box-shadow: inset 0 1px 0 rgba(255, 244, 225, 0.1), 0 0 0 2px rgba(142, 116, 88, 0.2);
}

.chat-composer-text-wrap {
    padding: 12px 14px 8px;
}

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

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

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

.chat-composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 10px 8px;
    border-top: 1px solid #4a3a2b;
}

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

.chat-composer-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-family: inherit;
    font-size: 0.8125rem;
    color: #e8d9c7;
    background: linear-gradient(180deg, #3a2d22 0%, #2a2018 100%);
    border: 1px solid #5f4a36;
    border-radius: 6px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.chat-composer-pill:hover {
    color: #fff3e5;
    background: linear-gradient(180deg, #4a392a 0%, #33271d 100%);
    border-color: #8e7458;
}

.mode-select-wrap,
.model-select-wrap {
    position: relative;
    flex-shrink: 0;
}

.chat-composer-pill.chat-composer-model {
    min-width: 0;
    max-width: 160px;
    padding-right: 24px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-composer-pill.chat-composer-model .chat-composer-chevron-up {
    margin-left: auto;
    transform: rotate(180deg);
}

.model-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 4px;
    min-width: 180px;
    max-height: none;
    background: linear-gradient(180deg, #2a2119 0%, #1f1812 100%);
    border: 1px solid #5a4735;
    border-radius: 8px;
    padding: 6px 0;
    box-shadow: 0 -8px 20px rgba(0,0,0,0.35);
    z-index: 60;
    overflow-y: visible;
}

.mode-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 4px;
    min-width: 130px;
    background: linear-gradient(180deg, #2a2119 0%, #1f1812 100%);
    border: 1px solid #5a4735;
    border-radius: 8px;
    padding: 6px 0;
    box-shadow: 0 -8px 20px rgba(0,0,0,0.35);
    z-index: 60;
}

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

.mode-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.875rem;
    color: #cfbaa2;
    background: none;
    border: none;
    padding: 8px 12px 8px 24px;
    cursor: pointer;
}

.mode-dropdown-item:hover {
    color: #fff3e5;
    background: rgba(199, 155, 106, 0.16);
}

.mode-dropdown-item[aria-selected="true"] {
    color: #fff3e5;
    background: rgba(199, 155, 106, 0.24);
}

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

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

.model-dropdown-group:not(:first-child) {
    border-top: 1px solid #4a3a2b;
}

.model-dropdown-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #b9a48c;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 12px 6px;
}

.model-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.875rem;
    color: #cfbaa2;
    background: none;
    border: none;
    padding: 8px 12px 8px 24px;
    cursor: pointer;
}

.model-dropdown-item:hover {
    color: #fff3e5;
    background: rgba(199, 155, 106, 0.16);
}

.model-dropdown-item[aria-selected="true"] {
    color: #fff3e5;
    background: rgba(199, 155, 106, 0.24);
}

.chat-composer-pill-icon {
    font-size: 0.875rem;
    opacity: 0.9;
}

.chat-composer-chevron {
    font-size: 0.625rem;
    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: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.chat-composer-icon {
    color: #e1cfbb;
    background: linear-gradient(180deg, #3a2d22 0%, #2a2018 100%);
    border: 1px solid #5f4a36;
}

.chat-composer-icon:hover {
    color: #fff3e5;
    background: linear-gradient(180deg, #4a392a 0%, #33271d 100%);
    border-color: #8e7458;
}

.chat-composer-send {
    color: #1b120a;
    background: linear-gradient(180deg, #d7b289 0%, #c79b6a 100%);
    border: 1px solid #8e7458;
}

.chat-composer-send:hover:not(:disabled) {
    background: linear-gradient(180deg, #e2bf97 0%, #d3a877 100%);
    border-color: #a07f60;
}

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

.chat-composer-send .chat-icon {
    color: #111;
}

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

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

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

.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;
}

.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(--earth);
    color: #0d0b09;
    font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
    background: var(--earth-light);
}

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

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

.modal input[type="text"],
.modal input[type="number"],
.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 label {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* Tool panel controls (estimate/proposal/schedule) */
#chat-tool-panel .tool-form-wrap input[type="text"],
#chat-tool-panel .tool-form-wrap input[type="number"],
#chat-tool-panel .tool-form-wrap textarea,
#chat-tool-panel .tool-form-wrap select {
    background: linear-gradient(180deg, #30261d 0%, #241c15 100%);
    border: 1px solid #5a4735;
    color: #f4eadf;
}

#chat-tool-panel .tool-form-wrap input[type="text"]::placeholder,
#chat-tool-panel .tool-form-wrap input[type="number"]::placeholder,
#chat-tool-panel .tool-form-wrap textarea::placeholder {
    color: #baa791;
}

#chat-tool-panel .tool-form-wrap input[type="text"]:focus,
#chat-tool-panel .tool-form-wrap input[type="number"]:focus,
#chat-tool-panel .tool-form-wrap textarea:focus,
#chat-tool-panel .tool-form-wrap select:focus {
    outline: none;
    border-color: #8e7458;
    box-shadow: 0 0 0 2px rgba(142, 116, 88, 0.22);
}

#chat-tool-panel .tool-form-wrap .form-row-inline label {
    padding: 8px 10px;
    border: 1px solid #5a4735;
    border-radius: 8px;
    background: linear-gradient(180deg, #30261d 0%, #241c15 100%);
}

#chat-tool-panel .tool-form-wrap .form-row-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #c79b6a;
}

#tool-form-estimate #form-estimate {
    display: grid;
    gap: 14px;
}

.estimator-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #5a4735;
    border-radius: 10px;
    background: linear-gradient(180deg, #2f241b 0%, #241a13 100%);
}

.estimator-topbar-title h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #f8eede;
}

.estimator-topbar-title p {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: #c9b49c;
}

.estimator-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.estimator-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #5a4735;
    background: linear-gradient(180deg, #33271d 0%, #271d15 100%);
    font-size: 0.75rem;
    color: #e8d9c7;
}

.estimator-chat-note {
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid #7c664e;
    background: rgba(199, 155, 106, 0.16);
    color: #f6eadc;
    font-size: 0.8125rem;
}

.estimator-section {
    border: 1px solid #4f3d2d;
    border-radius: 10px;
    padding: 12px 12px 2px;
    background: linear-gradient(180deg, rgba(49, 38, 28, 0.7) 0%, rgba(36, 28, 21, 0.8) 100%);
}

.estimator-section h5 {
    margin: 0 0 10px;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #d7b995;
}

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

#tool-form-estimate .form-row-inline {
    margin-top: 6px;
}

/* 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;
}

.settings-auth-label {
    margin: 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-weight: 700;
}

.settings-auth-status {
    margin: 8px 0 14px;
    font-size: 0.9375rem;
    color: var(--text);
}

.settings-auth-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.settings-auth-actions .btn-secondary {
    width: 100%;
    text-align: left;
}

/* 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);
}

@media (max-width: 768px) {
    /* Nav — allow horizontal scroll instead of overflow */
    .header { padding: 0; }
    .header-inner {
        padding: 0 14px;
        min-height: 42px;
    }
    .nav {
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-shrink: 1;
        max-width: calc(100vw - 120px);
    }
    .nav.chat-header-tools {
        flex-wrap: nowrap;
        justify-content: flex-start;
        max-width: calc(100vw - 150px);
    }
    .nav::-webkit-scrollbar { display: none; }
    .nav a, .btn-text {
        font-size: 0.8rem;
        white-space: nowrap;
        padding: 4px 8px;
    }
    .chat-header-tool {
        white-space: nowrap;
        font-size: 0.75rem;
        padding: 7px 10px;
    }
    /* Chat sidebar — narrow on tablet */
    .projects-sidebar {
        width: 160px !important;
        min-width: 120px;
        max-width: 200px;
    }
    .sidebar-resize-handle { display: none; }
    .projects-header h3,
    .documents-header h3 { font-size: 0.625rem; }
    .estimator-grid { grid-template-columns: 1fr; }
    .estimator-topbar { flex-direction: column; align-items: flex-start; }
    .estimator-topbar .btn-primary { width: 100%; }
}

@media (max-width: 600px) {
    .hero h1 { font-size: 1.75rem; }
    /* Chat — hide sidebar entirely on phones, full-width chat */
    .projects-sidebar { display: none !important; }
    .sidebar-resize-handle { display: none !important; }
    .chat-panel { padding: 0 12px; }
    .msg { max-width: 94%; }
    .nav { gap: 4px; }
    .chat-composer-model { font-size: 0.75rem; max-width: 110px; }
    /* Chat composer bar + safe area on phone */
    .chat-input-form {
        padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
        background: linear-gradient(to top, rgba(17,16,9,0.98), rgba(17,16,9,0.95));
    }
    .chat-composer-bar { padding: 6px 8px 8px; gap: 6px; }
    .chat-composer-text-wrap { padding: 10px 12px 6px; }
    .chat-composer-pill {
        min-height: 40px;
        padding: 7px 10px;
    }
    .chat-composer-icon,
    .chat-composer-send {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }
    .chat-composer-send .chat-icon,
    .chat-composer-icon .chat-icon {
        width: 20px;
        height: 20px;
    }
    .chat-quick-actions {
        gap: 8px;
        padding: 6px 0 10px;
    }
    .quick-actions-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .quick-actions-row::-webkit-scrollbar { display: none; }
    .quick-row-label {
        min-width: auto;
        font-size: 0.625rem;
    }
    .quick-label { display: none; }
    .quick-tool-btn,
    .quick-btn {
        font-size: 0.75rem;
        padding: 8px 12px;
        white-space: nowrap;
        min-height: 40px;
    }
    .btn-copy-chat {
        min-height: 40px;
        margin-left: 0;
        white-space: nowrap;
    }
    .est-actions .btn-sm {
        min-height: 44px;
        width: 100%;
        margin: 0 0 8px;
    }
}
