/*
 * QUOTIFY (quote maker): the tool's own components, styled in the site's design language (6 Oct 2026, on the
 * UltraCompress Pro template, after InvoiceForge). Base: /libs/site-pages.css (tokens, Inter and Space Grotesk, buttons,
 * theme toggle, focus rings) and /libs/shared-nav.css (the site's header and footer). This file holds only what the tool
 * itself needs: the toolbar, the collapsible editor sections beside the sticky live preview, the line-item grid, the logo
 * and signature drop zones, the signature pad, the theme buttons, the windows (quotes, clients, catalog, analytics,
 * shortcuts), the settings panel and the toasts. Light is the default; dark applies when <html> has no data-theme. Every
 * class and id the script touches keeps its name, and the variable names the script's markup uses (--gray-500, --warning,
 * --primary-bg ...) are aliases of the site's tokens below.
 *
 * The quote document itself (.quote-preview with its five themes) keeps fixed paper colours on purpose: it is the page
 * the PDF and the PNG are made from and must look the same in both page themes.
 */

/* ----- Tokens the tool adds, and the aliases the original rules use ----- */
:root {
    --surface: #ffffff;                 /* cards are true white in the light theme */
    --surface-2: #f3f4f8;               /* a quiet inset inside a card */
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --primary: var(--brand);
    --primary-dark: var(--link);
    --primary-bg: var(--tint-brand);
    --gray-50: var(--surface-2);
    --gray-100: var(--surface-2);
    --gray-200: var(--surface-border);
    --gray-300: var(--field-border);
    --gray-400: var(--text-3);
    --gray-500: var(--text-3);
    --gray-600: var(--text-2);
    --gray-700: var(--text);
    --gray-800: var(--text-strong);
    --gray-900: var(--text-strong);
    --success: #059669;
    --warning: #d97706;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --error: #dc2626;
    --error-bg: rgba(220, 38, 38, 0.1);
    --info: #0369a1;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition-fast: 0.15s ease;
    --transition: 0.2s ease;
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --success: #4ade80;
    --warning: #fbbf24;
    --error: #f87171;
    --info: #38bdf8;
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container {
    max-width: calc(var(--app-max) + 2 * var(--content-gutter));
    margin-top: 16px;
}
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- Tools back link above the header, as on every other tool: the bar scrolls away under the sticky header ----- */
body { padding-top: 0; }
.back-bar { height: 48px; display: flex; align-items: center; padding: 0 var(--zdu-gutter, 24px); }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: calc(90px + var(--bar-offset, 48px)); }
@media (max-width: 768px) { .theme-toggle { top: calc(75px + var(--bar-offset, 48px)); } }

/* ----- Hero: brand row, headline, tagline ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.25rem;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-strong);
}
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Buttons: the site's pills in the tool's sizes (.btn is the class the script writes) ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 9999px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    padding: 12px 24px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary, .btn-ghost { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled), .btn-ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-success { background: linear-gradient(135deg, #059669, #10b981); color: #fff; box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3); }
.btn-success:hover:not(:disabled) { transform: translateY(-2px); }
.btn-danger { background: var(--danger-strong); color: #fff; box-shadow: 0 4px 15px rgba(185, 28, 28, 0.25); }
.btn-danger:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(185, 28, 28, 0.35); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-secondary.btn-sm, .btn-ghost.btn-sm { padding: 8px 15px; }
.btn-sm.btn-ghost { padding: 6px 10px; }

/* ----- The app: the toolbar above the two panels ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; margin: 0 0 1.25rem; }
.app-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ----- The two panels: the editor and the live preview ----- */
.main-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--surface-shadow);
    overflow: hidden;
}
.panel-header { padding: 14px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-title { margin: 0; font-size: 1.05rem; font-weight: 700; }
.preview-note { font-size: 0.8125rem; color: var(--text-3); }
.preview-panel { position: sticky; top: 100px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; }
.preview-scroll { flex: 1; overflow-y: auto; padding: 20px; background: var(--surface-2); }
.preview-container { max-width: 760px; margin: 0 auto; }

/* Editor sections (collapsible) */
.editor-section { border-bottom: 1px solid var(--surface-border); }
.editor-section:last-child { border-bottom: none; }
.editor-section-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}
.editor-section-header:hover { background: var(--surface-2); }
.editor-section-header:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.editor-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
}
.editor-section-title svg { width: 18px; height: 18px; color: var(--link); flex-shrink: 0; }
.editor-section-toggle { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; color: var(--text-3); transition: transform 0.2s ease; }
.editor-section.collapsed .editor-section-toggle { transform: rotate(-90deg); }
.editor-section-content { padding: 4px 20px 20px; display: grid; gap: 14px; }
.editor-section.collapsed .editor-section-content { display: none; }
.section-hint { margin: 0; font-size: 0.85rem; color: var(--text-3); }

/* Form fields */
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-label, .editor-panel label, .sidebar label { font-size: 0.85rem; font-weight: 600; color: var(--text-strong); }
.form-hint { font-size: 0.78rem; color: var(--text-3); font-weight: 400; }
.form-divider { border: 0; border-top: 1px solid var(--surface-border); margin: 4px 0; }
.editor-panel input:not([type="checkbox"]):not([type="color"]), .editor-panel select, .editor-panel textarea,
.sidebar input:not([type="checkbox"]), .sidebar select {
    width: 100%;
    padding: 10px 14px;
    background: var(--field);
    border: 1px solid var(--field-border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.925rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.editor-panel input::placeholder, .editor-panel textarea::placeholder { color: var(--placeholder); }
.editor-panel input:focus, .editor-panel select:focus, .editor-panel textarea:focus, .sidebar input:focus, .sidebar select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.editor-panel textarea { resize: vertical; min-height: 76px; }
.editor-panel select, .sidebar select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b93a1' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.editor-panel select option, .sidebar select option { color: #0a0a14; background: #fff; }
.editor-panel input[type="date"] { color-scheme: light; }
:root:not([data-theme="light"]) .editor-panel input[type="date"] { color-scheme: dark; }
.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-group input[type="checkbox"], .line-item-optional input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; cursor: pointer; }
.checkbox-label { font-size: 0.875rem; color: var(--text-2); cursor: pointer; font-weight: 500; }

/* Drop zones: the site's drop zone in miniature (tint, lift, the icon grows) */
.file-upload {
    border: 2px dashed rgba(139, 92, 246, 0.45);
    border-radius: 14px;
    padding: 18px 16px;
    text-align: center;
    cursor: pointer;
    background: var(--surface-2);
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.file-upload:hover, .file-upload.dragover { border-color: var(--brand); background: var(--tint-brand); transform: translateY(-2px); box-shadow: var(--surface-hover-shadow); }
.file-upload-icon {
    width: 48px;
    height: 48px;
    padding: 12px;
    margin: 0 auto 8px;
    border-radius: 50%;
    background: var(--gradient-brand);
    color: #fff;
    display: block;
    transition: transform 0.25s ease;
}
.file-upload:hover .file-upload-icon, .file-upload.dragover .file-upload-icon { transform: scale(1.1); }
.file-upload-text { font-size: 0.9rem; color: var(--text-2); }
.file-upload-text span { color: var(--link); font-weight: 600; }
.file-upload-hint { font-size: 0.78rem; color: var(--text-3); margin-top: 4px; }
.file-upload-preview:not(:empty) { margin-top: 12px; }
.file-upload-preview img { max-width: 180px; max-height: 80px; border-radius: 8px; background: #fff; padding: 4px; border: 1px solid var(--surface-border); }

/* Line items */
.items-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.line-items-container { border: 1px solid var(--surface-border); border-radius: 12px; overflow: hidden; }
.line-items-header, .line-item { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 0.9fr) 64px 92px 84px minmax(72px, 0.8fr) 32px; gap: 8px; padding: 10px 12px; align-items: start; }
.line-items-header { background: var(--surface-2); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); align-items: center; }
.line-items-header div:nth-child(6) { text-align: right; }
.line-item { border-top: 1px solid var(--surface-border); }
.line-item.optional { background: var(--warning-bg); box-shadow: inset 3px 0 0 var(--warning); }
.line-item input, .line-item select { padding: 8px 10px !important; border-radius: 10px !important; font-size: 0.875rem !important; }
.line-item select { padding-right: 28px !important; background-position: right 8px center !important; }
.line-item-name { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.line-item-description { font-size: 0.8125rem !important; }
.line-item-optional { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-2); cursor: pointer; font-weight: 500; }
.line-item-total { font-weight: 700; color: var(--text-strong); text-align: right; font-size: 0.9rem; overflow-wrap: anywhere; padding-top: 9px; }
.line-item-delete {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(185, 28, 28, 0.3);
    background: rgba(185, 28, 28, 0.08);
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
    margin-top: 2px;
}
.line-item-delete svg { width: 16px; height: 16px; }
.line-item-delete:hover { background: var(--danger-strong); color: #fff; }
.add-line-item-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px;
    border: 2px dashed rgba(139, 92, 246, 0.45);
    border-radius: 12px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.add-line-item-btn:hover { border-color: var(--brand); color: var(--link); background: var(--tint-brand); }
.section-group-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--tint-brand); border-top: 1px solid var(--surface-border); border-left: 3px solid var(--brand); }
.section-group-name { flex: 1; font-weight: 700 !important; color: var(--link) !important; background: transparent !important; border-color: transparent !important; padding: 6px 8px !important; }
.section-group-name:focus { border-color: var(--brand) !important; background: var(--field) !important; }

/* Tabs (signature) */
.tabs { display: flex; gap: 8px; }
.tab {
    padding: 8px 16px;
    border-radius: 9999px;
    border: 1px solid var(--chip-border);
    background: var(--chip);
    color: var(--text-2);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.tab:hover { border-color: var(--brand); color: var(--link); }
.tab.active { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.signature-pad-container { border: 1px solid var(--surface-border); border-radius: 12px; overflow: hidden; }
.signature-pad { display: block; width: 100%; height: 150px; background: #fff; cursor: crosshair; touch-action: none; }
.signature-pad-actions { padding: 10px 12px; background: var(--surface-2); border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 8px; }

/* Theme buttons and the colour picker */
.theme-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.theme-btn { color: #fff; padding: 9px 8px; font-size: 0.8rem; border: 2px solid transparent; }
.theme-btn--corporate { background: #1e40af; }
.theme-btn--minimal { background: #18181b; }
.theme-btn--creative { background: #7c3aed; }
.theme-btn--bold { background: #dc2626; }
.theme-btn--elegant { background: #0d9488; }
.theme-btn:hover { transform: translateY(-2px); }
.theme-btn.active { border-color: var(--text-strong); box-shadow: 0 0 0 3px var(--ring); }
.color-picker { display: flex; align-items: center; gap: 10px; }
.color-picker input[type="color"] { width: 42px; height: 42px; padding: 2px; border: 1px solid var(--surface-border); border-radius: 10px; cursor: pointer; background: var(--surface); }
.color-picker input[type="text"] { width: 120px !important; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ===== The quote document: fixed colours, the same in both page themes (this is the PDF and the PNG) ===== */
.quote-preview {
    --quote-primary: #1e40af;
    --quote-secondary: #3b82f6;
    --quote-accent: #dbeafe;
    --paper-text: #1f2937;
    --paper-muted: #4b5563;
    --paper-faint: #4b5563;
    --paper-light: #5f6775;
    --paper-line: #e5e7eb;
    --paper-inset: #f9fafb;
    background: #ffffff;
    color: var(--paper-text);
    border-radius: 10px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 10px 10px -5px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
    min-height: 760px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}
.quote-preview.theme-corporate { --quote-primary: #1e40af; --quote-secondary: #3b82f6; --quote-accent: #dbeafe; }
.quote-preview.theme-minimal { --quote-primary: #18181b; --quote-secondary: #52525b; --quote-accent: #f4f4f5; }
.quote-preview.theme-creative { --quote-primary: #7c3aed; --quote-secondary: #a78bfa; --quote-accent: #ede9fe; }
.quote-preview.theme-bold { --quote-primary: #dc2626; --quote-secondary: #f87171; --quote-accent: #fee2e2; }
.quote-preview.theme-elegant { --quote-primary: #0d9488; --quote-secondary: #2dd4bf; --quote-accent: #ccfbf1; }
.quote-header { display: flex; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; padding-bottom: 1.25rem; border-bottom: 2px solid var(--quote-primary); }
.quote-company-info { flex: 1 1 0; min-width: 0; }
.quote-company-logo { max-width: 180px; max-height: 80px; object-fit: contain; margin-bottom: 0.75rem; display: block; }
.quote-company-name { font-size: 1.5rem; font-weight: 700; color: var(--quote-primary); margin-bottom: 0.5rem; overflow-wrap: anywhere; }
.quote-company-details { font-size: 0.875rem; color: var(--paper-muted); line-height: 1.6; overflow-wrap: anywhere; }
.quote-meta { text-align: right; flex: 0 0 auto; max-width: 48%; }
.quote-title { font-size: 1.75rem; font-weight: 700; color: var(--quote-primary); margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; line-height: 1.1; }
.quote-meta-grid { display: grid; gap: 0.4rem; font-size: 0.875rem; }
.quote-meta-row { display: flex; justify-content: flex-end; gap: 0.75rem; }
.quote-meta-label { color: var(--paper-faint); }
.quote-meta-value { font-weight: 600; color: var(--paper-text); min-width: 0; text-align: right; }
.quote-client-section { background: var(--quote-accent); padding: 1.25rem 1.5rem; border-radius: 10px; margin-bottom: 2rem; }
.quote-client-title { font-size: 0.75rem; font-weight: 600; color: var(--paper-faint); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
.quote-client-name { font-size: 1.125rem; font-weight: 600; color: var(--paper-text); margin-bottom: 0.4rem; overflow-wrap: anywhere; }
.quote-client-details { font-size: 0.875rem; color: var(--paper-muted); line-height: 1.6; overflow-wrap: anywhere; }
.quote-table { width: 100%; border-collapse: collapse; margin: 0 0 2rem; background: none; border-radius: 0; }
.quote-table th { background: var(--quote-primary); color: #fff; padding: 0.85rem 0.9rem; text-align: left; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border: 0; }
.quote-table th:first-child { border-radius: 8px 0 0 0; }
.quote-table th:last-child { border-radius: 0 8px 0 0; text-align: right; }
.quote-table td { padding: 0.85rem 0.9rem; border: 0; border-bottom: 1px solid var(--paper-line); font-size: 0.9rem; color: var(--paper-text); vertical-align: top; overflow-wrap: anywhere; }
.quote-table td:last-child { text-align: right; font-weight: 500; }
.quote-table tr.section-header td { background: var(--quote-accent); font-weight: 600; color: var(--quote-primary); font-size: 0.875rem; }
.quote-table tr.optional td { color: var(--paper-faint); font-style: italic; }
.quote-item-name { font-weight: 500; color: var(--paper-text); }
.quote-item-description { font-size: 0.8125rem; color: var(--paper-faint); margin-top: 0.25rem; }
.quote-item-hsn { font-size: 0.75rem; color: var(--paper-light); margin-top: 0.25rem; }
.quote-totals { display: flex; justify-content: flex-end; margin-bottom: 1.5rem; }
.quote-totals-table { width: 320px; max-width: 100%; border-collapse: collapse; margin: 0; background: none; }
.quote-totals-table tr { border-bottom: 1px solid var(--paper-line); }
.quote-totals-table td { padding: 0.6rem 1rem; border: 0; color: var(--paper-text); }
.quote-totals-table td:first-child { color: var(--paper-muted); font-size: 0.9375rem; }
.quote-totals-table td:last-child { text-align: right; font-weight: 500; }
.quote-totals-table tr.grand-total { background: var(--quote-primary); border-bottom: none; }
.quote-totals-table tr.grand-total td { color: #fff; font-weight: 700; font-size: 1.125rem; padding: 0.9rem 1rem; }
.quote-totals-table tr.grand-total td:first-child { border-radius: 8px 0 0 8px; }
.quote-totals-table tr.grand-total td:last-child { border-radius: 0 8px 8px 0; }
.amount-in-words { background: var(--paper-inset); padding: 0.9rem 1.25rem; border-radius: 8px; margin-bottom: 1.5rem; font-size: 0.875rem; color: var(--paper-muted); }
.amount-in-words strong { color: var(--paper-text); }
.quote-notes { background: #eff6ff; padding: 1.1rem 1.25rem; border-radius: 8px; margin-bottom: 1.25rem; border-left: 4px solid #3b82f6; }
.quote-notes-title, .quote-terms-title, .quote-bank-title { font-weight: 600; color: var(--paper-text); margin-bottom: 0.5rem; font-size: 0.875rem; }
.quote-notes-content { font-size: 0.875rem; color: var(--paper-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.quote-terms { background: var(--paper-inset); padding: 1.1rem 1.25rem; border-radius: 8px; margin-bottom: 1.25rem; }
.quote-terms-content { font-size: 0.8125rem; color: var(--paper-muted); white-space: pre-wrap; line-height: 1.6; overflow-wrap: anywhere; }
.quote-bank-details { background: #fffbeb; padding: 1.1rem 1.25rem; border-radius: 8px; margin-bottom: 1.25rem; border-left: 4px solid #f59e0b; }
.quote-bank-content { font-size: 0.8125rem; color: var(--paper-muted); line-height: 1.7; overflow-wrap: anywhere; }
.quote-signature { display: flex; justify-content: flex-end; margin-top: 2.5rem; padding-top: 1rem; }
.quote-signature-box { text-align: center; width: 200px; }
.quote-signature-image { height: 60px; margin-bottom: 0.5rem; display: flex; align-items: flex-end; justify-content: center; }
.quote-signature-image img { max-height: 60px; max-width: 150px; }
.quote-signature-line { border-top: 1px solid var(--paper-light); padding-top: 0.5rem; font-size: 0.8125rem; color: var(--paper-muted); }
.quote-signature-name { font-weight: 600; color: var(--paper-text); }
.quote-status-badge { display: inline-flex; align-items: center; padding: 0.3rem 0.7rem; font-size: 0.72rem; font-weight: 700; border-radius: 9999px; text-transform: uppercase; letter-spacing: 0.05em; }
.quote-status-draft { background: #e5e7eb; color: #374151; }
.quote-status-sent { background: #dbeafe; color: #1d4ed8; }
.quote-status-viewed { background: #fae8ff; color: #a21caf; }
.quote-status-accepted { background: #d1fae5; color: #047857; }
.quote-status-rejected { background: #fee2e2; color: #b91c1c; }
.quote-status-expired { background: #fef3c7; color: #b45309; }
.preview-placeholder { color: var(--paper-light); font-style: italic; }

/* ----- Windows (quotes, clients, catalog, analytics, shortcuts) ----- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(12px);
    transition: transform 0.25s ease;
}
.modal--wide { max-width: 760px; }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header, .sidebar-header { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title, .sidebar-title { margin: 0; font-size: 1.15rem; }
.modal-close {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--chip-border);
    background: var(--chip);
    color: var(--text-strong);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.modal-close:hover { border-color: var(--brand); color: var(--link); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-action { margin-top: 16px; }
.modal-hint { display: block; margin: 14px 0 0; }
.modal-body .form-hint { display: block; margin-top: 10px; }
.modal-body .text-center { text-align: center; padding: 24px 12px; color: var(--text-2); }
.modal-body .text-center p { margin: 0 0 4px; }
.modal-body .text-gray-500 { color: var(--text-3); font-size: 0.875rem; }
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    margin-bottom: 8px;
    background: var(--surface-2);
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.list-item:hover { border-color: var(--brand); transform: translateY(-2px); }
.list-item-info { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.list-item-subtitle { font-size: 0.8125rem; color: var(--text-3); overflow-wrap: anywhere; }
.list-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.list-item-actions .btn-sm { padding: 7px 14px; }
.analytics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.analytics-card { background: var(--surface-2); border: 1px solid var(--surface-border); border-radius: 12px; padding: 14px; }
.analytics-card-label { font-size: 0.78rem; color: var(--text-3); margin-bottom: 4px; }
.analytics-card-value { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--text-strong); overflow-wrap: anywhere; }
.shortcuts-list { display: grid; gap: 10px; }
.shortcut-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shortcut-keys { display: flex; gap: 4px; }
.shortcut-key {
    background: var(--surface-2);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 600;
    color: var(--text-2);
}
.shortcut-description { font-size: 0.875rem; color: var(--text-2); }

/* Settings panel */
.sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    background: var(--surface);
    border-left: 1px solid var(--surface-border);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.25);
    z-index: 1001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}
.sidebar.active { right: 0; }
.sidebar-body { padding: 20px; overflow-y: auto; flex: 1; display: grid; gap: 14px; align-content: start; }
.sidebar-subtitle { margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.sidebar-btn { width: 100%; }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(10, 10, 20, 0.5); z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s ease; }
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* ----- Toasts ----- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 32px); }
.toast {
    background: #0a0a14;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-left: 4px solid var(--brand);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    min-width: 260px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { border-left-color: #4ade80; }
.toast-error { border-left-color: #f87171; }
.toast-warning { border-left-color: #fbbf24; }
.toast-info { border-left-color: #38bdf8; }
.toast-icon { width: 24px; height: 24px; flex-shrink: 0; display: inline-flex; }
.toast-icon svg { width: 24px; height: 24px; }
.toast-success .toast-icon { color: #4ade80; }
.toast-error .toast-icon { color: #f87171; }
.toast-warning .toast-icon { color: #fbbf24; }
.toast-info .toast-icon { color: #38bdf8; }
.toast-message { flex: 1; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; }
.toast-close { background: none; border: none; cursor: pointer; color: rgba(255, 255, 255, 0.7); padding: 2px; display: inline-flex; }
.toast-close:hover { color: #fff; }

.hidden { display: none !important; }

/* ----- Information sections below the tool ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section > p { max-width: 70ch; }
/* Three columns on desktops, two on tablets, one on phones: six cards fill two rows without a gap. */
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: var(--surface-shadow);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.info-section article:not(.info-card) p { color: var(--text-2); max-width: 70ch; }
.step-card { position: relative; padding-top: 24px; }
.step-num {
    position: absolute;
    top: -16px;
    left: 20px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gradient-brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary {
    cursor: pointer;
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-strong);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ----- Tablets ----- */
@media (max-width: 1023px) {
    .main-content { grid-template-columns: 1fr; }
    .preview-panel { position: static; max-height: none; order: -1; }
    .preview-scroll { max-height: 560px; }
    .analytics-grid { grid-template-columns: repeat(2, 1fr); }
    .info-section .info-grid, .info-three { grid-template-columns: repeat(2, 1fr); }
}

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .app-actions { width: 100%; }
    .app-actions .btn { flex: 1 1 auto; padding-left: 12px; padding-right: 12px; }
    .panel-header, .editor-section-header { padding-left: 16px; padding-right: 16px; }
    .editor-section-content { padding-left: 16px; padding-right: 16px; }
    .preview-scroll { padding: 12px; }
    .form-row { grid-template-columns: 1fr; }
    .line-items-header { display: none; }
    .line-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; grid-template-areas: "name name name" "hsn qty remove" "unit rate rate" "total total total"; gap: 8px; }
    .line-item > div:nth-child(1) { grid-area: name; }
    .line-item > div:nth-child(2) { grid-area: hsn; }
    .line-item > div:nth-child(3) { grid-area: qty; }
    .line-item > div:nth-child(4) { grid-area: unit; }
    .line-item > div:nth-child(5) { grid-area: rate; }
    .line-item > .line-item-total { grid-area: total; padding-top: 0; }
    .line-item > .line-item-delete { grid-area: remove; justify-self: end; }
    .theme-grid { grid-template-columns: repeat(3, 1fr); }
    .quote-preview { padding: 1.25rem; min-height: 0; }
    .quote-header { flex-direction: column; gap: 1rem; }
    .quote-company-info { max-width: 100%; }
    .quote-meta { text-align: left; }
    .quote-meta-row { justify-content: flex-start; }
    .quote-meta-value { text-align: left; min-width: 0; }
    .quote-title { font-size: 1.5rem; }
    .quote-table th, .quote-table td { padding: 0.55rem 0.45rem; font-size: 0.8rem; }
    /* Phones: the table stays on the white paper and scrolls inside it when narrower (the Amount column ran past the page, 8 Oct 2026) */
    .quote-preview { overflow-x: auto; }
    .quote-table th { padding: 0.55rem 0.3rem; font-size: 0.66rem; letter-spacing: 0; }
    .quote-table td { padding: 0.55rem 0.3rem; }
    .quote-table td:nth-child(n+4) { white-space: nowrap; overflow-wrap: normal; }
    .quote-totals-table { width: 100%; }
    .quote-signature { justify-content: center; }
    .analytics-grid { grid-template-columns: 1fr 1fr; }
    .modal-overlay { padding: 8px; }
    .modal-body, .modal-header, .sidebar-body, .sidebar-header { padding-left: 16px; padding-right: 16px; }
    .list-item { flex-wrap: wrap; }
    .sidebar { width: 100%; right: -100%; }
    .toast-container { bottom: 16px; right: 16px; left: 16px; align-items: flex-end; }
    .toast { min-width: 0; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}

/* ----- Print: only the quote ----- */
@media print {
    .back-bar, body > header, body > footer, .theme-toggle, .app-hero, .app-toolbar, .info-section, .editor-panel, .panel-header, .toast-container, .modal-overlay, .sidebar, .sidebar-overlay, #zdu-cookie-banner, noscript { display: none !important; }
    body { padding: 0; background: #fff; }
    body::before { display: none; }
    .container.app-container { max-width: none; margin: 0; padding: 0; }
    .main-content { display: block; }
    .preview-panel { position: static; max-height: none; border: 0; box-shadow: none; }
    .preview-scroll { padding: 0; background: #fff; max-height: none; overflow: visible; }
    .preview-container { max-width: 100%; }
    .quote-preview { box-shadow: none; border-radius: 0; padding: 0; min-height: 0; }
    .quote-table th, .quote-totals-table tr.grand-total, .quote-client-section, .quote-notes, .quote-terms, .quote-bank-details, .amount-in-words, .quote-status-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .file-upload, .file-upload-icon, .list-item, .info-card, .modal, .toast, .sidebar { transition: none; animation: none; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026) */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]) { min-height: 44px; }
    div#section-company-content.editor-section-content > p.section-hint,
    div.sidebar-body > p.form-hint,
    div.sidebar-body > p.section-hint { font-size: 1rem; }
    .checkbox-group label, label.line-item-optional { display: inline-flex; align-items: center; min-height: 44px; }
    .modal-close { min-width: 44px; min-height: 44px; }
    .sidebar-body .btn { min-height: 44px; }
    main div.line-item > button.line-item-delete { min-width: 44px; }
}
