/* Audette Report Generator - Dark Mode, Audette Brand */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
    --brand-pink: #EB02AD;
    --brand-purple: #7700FF;
    --brand-teal: #CCFAE5;
    --brand-concrete: #E3E5DE;
    --bg: #111111;
    --bg-elevated: #1a1a1a;
    --bg-surface: #222222;
    --bg-hover: #2a2a2a;
    --text: #f0f0f0;
    --text-secondary: #999999;
    --text-muted: #666666;
    --border: #333333;
    --border-light: #2a2a2a;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }

/* Layout */
.app-layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
    width: 280px; min-width: 280px; background: var(--bg-elevated);
    border-right: 1px solid var(--border); display: flex; flex-direction: column;
    overflow: hidden;
}
.sidebar-header {
    padding: 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-header .logo { height: 28px; width: auto; }
.sidebar-header .logo-text { }
.sidebar-header h1 { font-size: 15px; font-weight: 600; color: var(--text); }
.sidebar-header span { font-size: 11px; color: var(--text-secondary); display: block; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px; }
.sidebar-footer {
    padding: 12px 16px; border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-footer-link {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-muted); text-decoration: none;
    padding: 6px 8px; border-radius: var(--radius); transition: all 0.15s;
}
.sidebar-footer-link:hover { color: var(--text-secondary); background: var(--bg-hover); }
.nav-section { margin-bottom: 16px; }
.nav-section-title {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-muted); padding: 4px 8px; margin-bottom: 4px;
}
.nav-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    border-radius: var(--radius); cursor: pointer; font-size: 13px;
    color: var(--text-secondary); transition: all 0.15s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: rgba(204, 250, 229, 0.1); color: var(--brand-teal); font-weight: 500; }
.nav-item .icon { width: 18px; text-align: center; flex-shrink: 0; }
.nav-item .badge {
    margin-left: auto; background: var(--brand-pink); color: white;
    font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600;
}

/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.main-header {
    padding: 16px 24px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-elevated); min-height: 56px;
}
.main-header h2 { font-size: 16px; font-weight: 600; }
.main-body { flex: 1; overflow-y: auto; padding: 24px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius); font-size: 13px;
    font-weight: 500; cursor: pointer; border: 1px solid transparent;
    transition: all 0.15s; font-family: var(--font);
}
.btn-primary { background: var(--brand-pink); color: white; }
.btn-primary:hover { background: #d001a0; }
.btn-secondary { background: var(--bg-surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: rgba(239,68,68,0.1); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; min-width: 32px; justify-content: center; }

/* Cards */
.card {
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 14px; font-weight: 600; }

/* Forms */
input, select, textarea {
    font-family: var(--font); font-size: 13px; padding: 8px 12px;
    border: 1px solid var(--border); border-radius: var(--radius);
    outline: none; width: 100%; transition: border-color 0.15s;
    background: var(--bg-surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-pink); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
label { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; display: block; }
.form-group { margin-bottom: 14px; }

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius-lg);
    padding: 40px; text-align: center; cursor: pointer;
    transition: all 0.2s; background: var(--bg-surface);
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--brand-pink); background: rgba(235, 2, 173, 0.05);
}
.upload-zone .icon { font-size: 32px; color: var(--brand-pink); margin-bottom: 8px; }
.upload-zone p { color: var(--text-secondary); font-size: 13px; }
.upload-zone input { display: none; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
    text-align: left; padding: 8px 12px; background: var(--bg-surface);
    font-weight: 600; color: var(--text-secondary); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td {
    padding: 8px 12px; border-bottom: 1px solid var(--border-light);
    white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}
.data-table tr:hover td { background: var(--bg-hover); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Report Preview - scales to fit viewport */
.report-preview {
    margin: 0 auto; padding: 16px;
    display: flex; flex-direction: column; align-items: center; gap: 20px;
}

/* Physical page appearance on screen */
.report-page {
    width: 8.5in; height: 11in; padding: 0.6in 0.75in;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: 4px; box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    position: relative;
    box-sizing: border-box;
    transform-origin: top center;
    overflow: hidden;
}
.report-page.landscape {
    width: 11in; height: 8.5in; overflow: hidden;
}
.report-page.landscape::before {
    content: 'LANDSCAPE'; position: absolute; top: 6px; right: 10px;
    font-size: 8px; letter-spacing: 0.06em; color: var(--text-muted); opacity: 0.4;
}

/* Flowing section within a page (no forced page break) */
.report-section {
    margin-bottom: 28px;
}
.report-section:last-child { margin-bottom: 0; }
.report-cover {
    min-height: 200px; display: flex; flex-direction: column; justify-content: center;
}
.report-cover .property-name { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.report-cover .address { font-size: 15px; color: var(--text-secondary); margin-bottom: 8px; }
.report-cover .date { font-size: 13px; color: var(--text-muted); }
.report-cover .divider { height: 3px; background: var(--brand-pink); margin: 16px 0; border-radius: 2px; }

.report-section-title {
    font-size: 20px; font-weight: 700; color: var(--text);
    margin-bottom: 20px; padding-bottom: 8px;
    border-bottom: 2px solid var(--brand-pink);
}

/* Baseline stats grid */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
    margin-bottom: 12px;
}
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--brand-teal); }
.stat-unit { font-size: 12px; color: var(--text-secondary); margin-left: 4px; }
.stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; display: flex; justify-content: space-between; }

/* Breakdown bars */
.breakdown-chart { margin-bottom: 24px; }
.breakdown-row { display: flex; align-items: center; margin-bottom: 6px; gap: 8px; }
.breakdown-label { width: 120px; font-size: 11px; color: var(--text-secondary); text-align: right; flex-shrink: 0; }
.breakdown-bar-container { flex: 1; height: 24px; background: var(--bg-surface); border-radius: 4px; overflow: hidden; position: relative; }
.breakdown-bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; display: flex; align-items: center; padding-left: 8px; }
.breakdown-bar span { font-size: 10px; color: white; font-weight: 600; white-space: nowrap; }
.breakdown-value { width: 80px; font-size: 11px; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Measures table */
.measures-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.measures-table th {
    background: var(--brand-pink); color: white; padding: 8px 10px;
    text-align: left; font-weight: 600; font-size: 10px;
    text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap;
}
.measures-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.measures-table tr:nth-child(even) td { background: var(--bg-surface); }
.measures-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Reduction potential box */
.reduction-box {
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; margin-bottom: 16px; width: 240px;
}
.reduction-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 12px; color: var(--text); }
.reduction-row.header { font-weight: 700; background: var(--brand-pink); color: white; margin: -16px -16px 8px; padding: 10px 16px; border-radius: var(--radius) var(--radius) 0 0; }

/* Decarb chart */
.decarb-chart-container { position: relative; }
.decarb-chart-container canvas { width: 100%; max-height: 300px; }

/* Data check table */
.data-check-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-check-table th { background: var(--bg-surface); color: var(--text); padding: 8px 12px; text-align: left; font-size: 12px; border-bottom: 1px solid var(--border); }
.data-check-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.data-check-table tr:nth-child(even) td { background: var(--bg-surface); }
.indicator { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.indicator.green { background: var(--success); }
.indicator.yellow { background: var(--warning); }
.indicator.red { background: var(--danger); }

/* About section */
.about-section { font-size: 13px; line-height: 1.7; color: var(--text-secondary); }
.about-section h4 { font-size: 15px; font-weight: 700; margin: 16px 0 8px; color: var(--text); }
.about-section p { margin-bottom: 12px; }
.disclaimer { font-style: italic; color: var(--text-muted); font-size: 12px; line-height: 1.6; }

/* Chat Panel */
.chat-panel {
    width: 380px; min-width: 380px; border-left: 1px solid var(--border);
    background: var(--bg-elevated); display: flex; flex-direction: column;
    transition: width 0.2s;
}
.chat-panel.collapsed { width: 0; min-width: 0; overflow: hidden; }
.chat-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.chat-header h3 { font-size: 14px; font-weight: 600; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; }
.chat-msg { margin-bottom: 12px; }
.chat-msg.user .chat-bubble {
    background: var(--brand-pink); color: white; margin-left: 40px;
    border-radius: 12px 12px 4px 12px;
}
.chat-msg.assistant .chat-bubble {
    background: var(--bg-surface); color: var(--text); margin-right: 40px;
    border-radius: 12px 12px 12px 4px; border: 1px solid var(--border);
}
.chat-bubble { padding: 10px 14px; font-size: 13px; line-height: 1.5; word-wrap: break-word; }
.chat-bubble pre { background: rgba(0,0,0,0.3); padding: 8px; border-radius: 4px; margin: 8px 0; overflow-x: auto; font-size: 11px; white-space: pre-wrap; }
.chat-input-container {
    padding: 12px 16px; border-top: 1px solid var(--border);
    display: flex; gap: 8px;
}
.chat-input-container input { flex: 1; }
.chat-input-container .btn { flex-shrink: 0; }
.chat-typing { font-size: 12px; color: var(--text-secondary); padding: 4px 14px; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); }
.tab {
    padding: 10px 20px; font-size: 13px; font-weight: 500; cursor: pointer;
    color: var(--text-secondary); border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand-pink); border-bottom-color: var(--brand-pink); }

/* Empty state */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-secondary);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; color: var(--text-muted); }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 13px; max-width: 400px; margin: 0 auto; }

/* Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); display: flex; align-items: center;
    justify-content: center; z-index: 1000;
}
.modal {
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px;
    min-width: 400px; max-width: 500px; box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* Custom page content (LLM-generated visuals) */
.custom-page-content { font-size: 13px; line-height: 1.6; }
.custom-page-content table { width: 100%; border-collapse: collapse; }
.custom-page-content th, .custom-page-content td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.custom-page-content th { background: var(--bg-surface); font-weight: 600; font-size: 12px; }

/* Print / PDF - Light mode, exact pagination */
@media print {
    /* Hide all UI chrome */
    .sidebar, .chat-panel, .main-header, .no-print, .toast, .modal-overlay, .sm-prompt,
    .btn-ai, .btn-rotate, .ai-editable-wrap .btn-ai, .report-page.landscape::before, .no-print-cell { display: none !important; }

    /* Reset layout to simple block flow */
    .app-layout { display: block !important; height: auto !important; overflow: visible !important; }
    .main-content { display: block !important; overflow: visible !important; margin: 0 !important; padding: 0 !important; width: 100% !important; max-width: none !important; height: auto !important; }
    .main-body { display: block !important; padding: 0 !important; overflow: visible !important; max-height: none !important; height: auto !important; }
    .report-preview { display: block !important; box-shadow: none !important; border: none !important; background: #E3E5DE !important; margin: 0 !important; padding: 0 !important; max-width: none !important; width: 100% !important; }

    /* Page setup: fixed letter-size pages, light mode */
    @page { size: letter portrait; margin: 0; }
    @page landscape-page { size: letter landscape; margin: 0; }
    body { background: #E3E5DE !important; color: #111 !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;
        --text: #111; --text-secondary: #555; --text-muted: #777; --border: #ccc; --bg-surface: #f5f5f0; --bg-elevated: #E3E5DE; --bg: #E3E5DE;
        margin: 0 !important; padding: 0 !important; }
    html { overflow: visible !important; background: #E3E5DE !important; }

    .report-page {
        display: block !important;
        width: 100% !important; height: auto !important; min-height: 0 !important;
        padding: 0.5in 0.6in !important; margin: 0 !important;
        page-break-after: always !important; break-after: page !important;
        page-break-inside: avoid !important; break-inside: avoid !important;
        border: none !important; border-radius: 0 !important; box-shadow: none !important;
        overflow: visible !important;
        background: #E3E5DE !important; color: #111 !important;
        -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;
    }
    .report-page:last-child { page-break-after: avoid !important; break-after: avoid !important; }
    .report-page.landscape { page: landscape-page; }
    .report-page.landscape::before { display: none !important; }
    .report-preview { padding: 0 !important; gap: 0 !important; }

    /* Editable cells: transparent background, clean borders */
    [contenteditable="true"] { border: none !important; outline: none !important; background: transparent !important; color: #111 !important; }
    .editable-cell { border: none !important; padding: 0 !important; min-height: 0 !important; background: transparent !important; color: #111 !important; }
    .editable-cell p { margin-bottom: 0.5em !important; }
    .editable-cell ul, .editable-cell ol { margin: 0.4em 0 0.4em 1.2em !important; }
    .editable-cell li { margin-bottom: 0.2em !important; }

    /* Light mode overrides */
    .report-section-title { color: #111 !important; }
    .report-cover .property-name { color: #111 !important; }
    .report-cover .address, .report-cover .date { color: #555 !important; }
    .stat-card { background: #f0f0ec !important; border-color: #ccc !important; }
    .stat-value { color: #111 !important; }
    .stat-label { color: #555 !important; }
    .stat-sub { color: #777 !important; }
    .reduction-box { background: #f8f8f8 !important; border-color: #e0e0e0 !important; }
    .reduction-row { color: #111 !important; border-color: #e0e0e0 !important; }
    .reduction-row.header { background: #EB02AD !important; color: white !important; }
    .measures-table th { background: #EB02AD !important; color: white !important; }
    .measures-table td { color: #111 !important; border-color: #d0d0d0 !important; background: #E3E5DE !important; }
    .measures-table tr:nth-child(even) td { background: #dcdeda !important; }
    .data-check-table th { background: #f0f0f0 !important; color: #111 !important; }
    .data-check-table td { color: #111 !important; background: #E3E5DE !important; }
    .about-section, .about-section p, .disclaimer, .disclaimer-footer { color: #333 !important; }
    .about-section h4 { color: #111 !important; }
    h4 { color: #111 !important; }
    .text-muted, .text-sm { color: #666 !important; }
    .custom-page-content { color: #111 !important; }

    /* Decarb chart: dark bg image with rounded corners */
    .print-canvas-img { display: block !important; }
    .decarb-chart-container { overflow: hidden; }

    /* Hide blank editable cells in print */
    .editable-cell:empty { display: none !important; }
    .editable-cell:empty + .btn-ai { display: none !important; }
    .ai-editable-wrap:has(.editable-cell:empty) { display: none !important; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* Utility */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.ml-auto { margin-left: auto; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-secondary); }
.text-right { text-align: right; }
.font-mono { font-family: var(--mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none; }
.w-full { width: 100%; }

/* Customer/Asset list */
.entity-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    border-radius: var(--radius); cursor: pointer; transition: all 0.15s;
}
.entity-item:hover { background: var(--bg-hover); }
.entity-item.active { background: rgba(204, 250, 229, 0.08); }
.entity-item .entity-icon {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.entity-item .entity-icon.customer { background: rgba(235, 2, 173, 0.15); color: var(--brand-pink); }
.entity-item .entity-icon.asset { background: rgba(204, 250, 229, 0.12); color: var(--brand-teal); }
.entity-item .entity-info { flex: 1; min-width: 0; }
.entity-item .entity-name { font-size: 13px; font-weight: 500; color: var(--text); }
.entity-item .entity-sub { font-size: 11px; color: var(--text-muted); }
.entity-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.entity-item:hover .entity-actions { opacity: 1; }

/* Status badges */
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; }
.status.draft { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.status.final { background: rgba(16, 185, 129, 0.15); color: #10b981; }

/* Toast */
.toast {
    position: fixed; bottom: 20px; right: 20px; background: var(--bg-surface); color: var(--text);
    padding: 12px 20px; border-radius: var(--radius); font-size: 13px;
    box-shadow: var(--shadow-lg); z-index: 2000; transition: all 0.3s;
    transform: translateY(100px); opacity: 0; border: 1px solid var(--border);
}
.toast.show { transform: translateY(0); opacity: 1; }

/* Editable cells */
.editable-cell p { margin-bottom: 0.6em; }
.editable-cell p:last-child { margin-bottom: 0; }
.editable-cell ul, .editable-cell ol { margin: 0.4em 0 0.4em 1.4em; }
.editable-cell li { margin-bottom: 0.25em; }
.editable-cell:focus {
    outline: 1px solid var(--brand-pink);
    border-radius: 4px;
}
[contenteditable="true"] {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    color: var(--text);
}
[contenteditable="true"]:focus {
    border-color: var(--brand-pink);
    outline: none;
}

/* ---- Modal overlay for customer mapping ---- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center;
    z-index: 1000; backdrop-filter: blur(4px);
}
.modal-card {
    background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px;
    width: 520px; max-width: 90vw; max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header {
    padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--text); margin: 0; }
.modal-body { padding: 16px 24px; }
.modal-footer { padding: 12px 24px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-section { margin-bottom: 16px; }
.modal-section-title { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.modal-input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-surface); color: var(--text); font-size: 14px; font-family: inherit;
}
.modal-input:focus { border-color: var(--brand-pink); outline: none; }

.customer-option {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 14px; margin-bottom: 6px;
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-size: 14px; font-family: inherit; cursor: pointer; text-align: left; transition: all 0.15s;
}
.customer-option:hover { background: var(--bg-hover); border-color: var(--brand-pink); }
.customer-option.suggested { border-color: var(--brand-pink); }
.customer-option .badge {
    font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--brand-pink); color: white;
    margin-left: auto; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
}
.new-customer-row { display: flex; gap: 8px; }
.new-customer-row .modal-input { flex: 1; }

.upload-summary {
    display: flex; gap: 16px; padding: 12px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.summary-stat { font-size: 13px; color: var(--text-secondary); }
.summary-num { font-weight: 600; color: var(--text); font-size: 16px; margin-right: 4px; }

/* Edit badge in chat */
.edit-badge {
    display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 4px;
    background: rgba(204,250,229,0.15); color: var(--brand-teal); font-size: 11px; font-weight: 500;
}

/* Chat attachments */
.attachment-preview {
    display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px;
}
.attachment-preview:empty { display: none; }
.attachment-chip {
    display: flex; align-items: center; gap: 4px; padding: 4px 8px;
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 6px;
    font-size: 11px; color: var(--text-secondary);
}
.attachment-thumb { width: 24px; height: 24px; object-fit: cover; border-radius: 3px; }
.attachment-icon { font-size: 14px; }
.attachment-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-remove {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 14px; padding: 0 2px; line-height: 1;
}
.attachment-remove:hover { color: var(--danger); }
.chat-attach-btn { flex-shrink: 0; font-size: 16px; padding: 6px 8px; }

/* Supermemory prompt */
.sm-prompt {
    position: fixed; bottom: 24px; right: 24px; z-index: 1500;
    background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 16px 20px; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: slideUp 0.2s ease-out;
}
.sm-prompt-text { font-size: 13px; color: var(--text); margin-bottom: 12px; }
.sm-prompt-actions { display: flex; gap: 8px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* AI populate button */
.ai-editable-wrap { position: relative; }
.btn-ai {
    position: absolute; top: -28px; right: 0;
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 4px;
    color: var(--text-secondary); font-size: 11px; padding: 3px 8px; cursor: pointer;
    font-family: inherit; transition: all 0.15s; z-index: 1;
}
.btn-ai:hover { color: var(--brand-pink); border-color: var(--brand-pink); background: rgba(235,2,173,0.08); }
.no-ai .btn-ai { display: none !important; }

/* Modal textarea */
textarea.modal-input {
    font-family: inherit; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: var(--radius); background: var(--bg-surface); color: var(--text);
    width: 100%; font-size: 13px; line-height: 1.5;
}
textarea.modal-input:focus { border-color: var(--brand-pink); outline: none; }

/* Rotate page button */
.btn-rotate {
    position: absolute; bottom: 12px; right: 12px;
    background: none; border: 1px solid var(--border); border-radius: 4px;
    color: var(--text-muted); font-size: 14px; padding: 4px 6px; cursor: pointer;
    opacity: 0; transition: opacity 0.2s; line-height: 1;
}
.report-page:hover .btn-rotate { opacity: 0.5; }
.btn-rotate:hover { opacity: 1 !important; color: var(--text-secondary); border-color: var(--text-secondary); }

/* Mobile hamburger */
.btn-hamburger {
    display: none; background: none; border: none; color: var(--text); font-size: 22px;
    cursor: pointer; padding: 4px 8px; line-height: 1;
}
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99;
}

/* ===== Mobile / Tablet responsive ===== */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed; left: -300px; top: 0; bottom: 0; z-index: 100;
        width: 280px; min-width: 280px; transition: left 0.25s ease;
    }
    .sidebar.open { left: 0; }
    .sidebar-overlay.open { display: block; }
    .btn-hamburger { display: inline-flex; }
    .main-content { width: 100%; }

    /* Chat panel as overlay on smaller screens */
    .chat-panel {
        position: fixed; right: 0; top: 0; bottom: 0; z-index: 100;
        width: 340px; min-width: 340px;
    }
    .chat-panel.collapsed { right: -340px; width: 340px; min-width: 340px; overflow: visible; }
}

@media (max-width: 768px) {
    /* Header: wrap buttons */
    .main-header { flex-wrap: wrap; gap: 8px; padding: 12px 16px; min-height: auto; }
    .main-header h2 { font-size: 14px; }
    .main-header .flex.gap-2 { flex-wrap: wrap; gap: 6px; }
    .main-header .btn { font-size: 12px; padding: 6px 10px; }

    /* Main body: less padding */
    .main-body { padding: 12px; }

    /* Report pages: scale to fit screen */
    .report-preview { padding: 8px; gap: 12px; }
    .report-page {
        width: 100% !important; height: auto !important; min-height: auto !important;
        padding: 24px 16px; transform: none !important; overflow: visible !important;
    }
    .report-page.landscape { width: 100% !important; height: auto !important; min-height: auto !important; }

    /* Stat cards: 1 column on small screens */
    .stat-card { font-size: 12px; }

    /* Tables: scroll horizontally */
    .data-table { display: block; overflow-x: auto; }
    .measures-table { display: block; overflow-x: auto; font-size: 11px; }

    /* Cards */
    .card { border-radius: var(--radius); }
    .card-header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .card-header h3 { font-size: 14px; }

    /* Property details grid: 1 column */
    .entity-list { max-height: none; }

    /* Chat panel */
    .chat-panel { width: 100%; min-width: 100%; }
    .chat-panel.collapsed { right: -100%; width: 100%; min-width: 100%; }

    /* Modal */
    .modal-card { width: 95vw !important; max-width: 95vw !important; margin: 16px; }

    /* Sidebar */
    .sidebar { width: 260px; min-width: 260px; }

    /* Upload zone */
    .upload-zone { padding: 24px 16px; }
}

@media (max-width: 480px) {
    html { font-size: 13px; }
    .main-header { padding: 10px 12px; }
    .main-body { padding: 8px; }
    .report-page { padding: 16px 12px; }
    .report-section-title { font-size: 16px; }
    .stat-card .stat-value { font-size: 20px; }
}
