/* === CreateStage Quoting — v2 Styles === */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --primary: #2d3748;
    --primary-hover: #1a202c;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --max-w: 900px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* --- Navigation --- */
.app-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.nav-brand { font-weight: 700; font-size: 1.1rem; }
.nav-shop-name { font-size: 0.85rem; opacity: 0.7; }

.nav-right {
    display: flex;
    gap: 4px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-family: var(--font);
    transition: all 0.15s;
}
.nav-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-btn.active { background: rgba(255,255,255,0.15); color: white; }

.nav-btn-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.8);
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font);
}
.nav-btn-logout:hover { border-color: white; color: white; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    gap: 6px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text); }
.btn-full { width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-xs { padding: 4px 10px; font-size: 0.75rem; }

/* --- Auth View --- */
.auth-card {
    max-width: 400px;
    margin: 80px auto;
    padding: 40px 32px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.auth-title { font-size: 1.6rem; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-secondary); margin-bottom: 24px; font-size: 0.9rem; }
.auth-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.auth-fields input {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s;
}
.auth-fields input:focus { border-color: var(--accent); }
.auth-buttons { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-buttons .btn { flex: 1; }
.auth-divider {
    display: flex; align-items: center; gap: 12px; margin: 16px 0;
    color: var(--text-secondary); font-size: 0.85rem;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-hint { color: var(--text-secondary); font-size: 0.8rem; margin-top: 8px; }
.auth-hint a { color: var(--accent); text-decoration: none; }
.auth-hint a:hover { text-decoration: underline; }
.auth-error {
    background: #fef2f2; color: var(--error); padding: 10px;
    border-radius: var(--radius); font-size: 0.85rem; margin-bottom: 12px;
}

/* --- Auth Tabs --- */
.auth-tabs {
    display: flex; gap: 0; margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}
.auth-tab {
    flex: 1; padding: 10px; background: transparent; border: none;
    font-size: 0.95rem; font-weight: 600; font-family: var(--font);
    color: var(--text-secondary); cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: all 0.15s;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* --- Invite Code Status --- */
.invite-code-status {
    font-size: 0.85rem; padding: 6px 10px; border-radius: var(--radius);
    margin-bottom: 12px;
}
.invite-code-status.valid {
    background: #ecfdf5; color: var(--success);
}
.invite-code-status.invalid {
    background: #fef2f2; color: var(--error);
}

/* --- Terms Checkbox --- */
.auth-terms {
    margin-bottom: 16px; text-align: left;
}
.terms-checkbox {
    display: flex; align-items: flex-start; gap: 8px;
    font-size: 0.85rem; color: var(--text-secondary); cursor: pointer;
}
.terms-checkbox input[type="checkbox"] {
    margin-top: 3px; cursor: pointer;
}
.terms-checkbox a { color: var(--accent); text-decoration: none; }
.terms-checkbox a:hover { text-decoration: underline; }

/* --- Demo Banner --- */
.demo-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 20px;
    background: #1e40af;
    color: #fff;
    font-size: 14px;
    text-align: center;
}
.demo-banner a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 600;
}
.demo-banner a:hover { text-decoration: underline; }
.demo-banner-expired {
    background: var(--error);
}

/* --- Profile View --- */
.profile-card {
    max-width: 600px;
    margin: 40px auto;
    padding: 32px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.profile-card h2 { margin-bottom: 4px; }
.profile-hint { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 20px; }
.form-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 14px; margin-bottom: 20px;
}
.form-label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
}
.form-label.full-width { grid-column: 1 / -1; }
.form-label input {
    padding: 10px 12px; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 0.9rem; font-family: var(--font);
    outline: none;
}
.form-label input:focus { border-color: var(--accent); }
.profile-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* --- Quote View: Describe Step --- */
.describe-card, .clarify-card, .processing-card, .results-card {
    max-width: var(--max-w);
    margin: 32px auto;
    padding: 32px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.describe-card h2, .clarify-card h2 { margin-bottom: 16px; }

.job-textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    resize: vertical;
    min-height: 80px;
    outline: none;
    margin-bottom: 20px;
}
.job-textarea:focus { border-color: var(--accent); }

.job-type-section { margin-bottom: 24px; }
.job-type-label { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 10px; }
.job-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.job-type-btn {
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.job-type-btn:hover { border-color: var(--accent); background: #eff6ff; }
.job-type-more { border-style: dashed; color: var(--text-secondary); }

/* --- Clarify Step --- */
.clarify-header { margin-bottom: 20px; }
.progress-bar {
    height: 6px; background: var(--bg); border-radius: 3px;
    margin: 8px 0 4px; overflow: hidden;
}
.progress-fill {
    height: 100%; background: var(--accent);
    border-radius: 3px; transition: width 0.3s;
}
.progress-text { font-size: 0.8rem; color: var(--text-secondary); }

.extracted-fields {
    background: #f0fdf4; border: 1px solid #bbf7d0;
    border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px;
}
.extracted-title { font-size: 0.8rem; color: var(--success); margin-bottom: 6px; font-weight: 600; }
.extracted-item { font-size: 0.85rem; color: #166534; padding: 2px 0; }

.question-card {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; margin-bottom: 12px;
}
.q-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.q-label { font-weight: 600; font-size: 0.95rem; }
.required-badge {
    font-size: 0.7rem; background: #fef3c7; color: #92400e;
    padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.q-hint { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

.choice-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.choice-btn {
    padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); font-size: 0.85rem; font-family: var(--font);
    cursor: pointer; transition: all 0.15s;
}
.choice-btn:hover { border-color: var(--accent); }
.choice-btn.selected { background: var(--accent); color: white; border-color: var(--accent); }
.choice-btn-other { border-style: dashed; color: var(--text-secondary); }
.choice-btn-other.selected { border-style: solid; }
.other-input-wrap { margin-top: 8px; }
.other-text-input { margin-top: 0; }

.multi-choice-group { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.checkbox-label {
    display: flex; align-items: center; gap: 8px; font-size: 0.9rem;
    padding: 6px 10px; border-radius: var(--radius); cursor: pointer;
}
.checkbox-label:hover { background: var(--bg); }

.measure-input { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.measure-unit { font-size: 0.85rem; color: var(--text-secondary); }

.text-input {
    width: 100%; padding: 10px 12px; margin-top: 10px;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.9rem; font-family: var(--font); outline: none;
}
.text-input:focus { border-color: var(--accent); }
.measure-input input {
    padding: 10px 12px; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 0.9rem; font-family: var(--font);
    outline: none; width: 120px;
}
.measure-input input:focus { border-color: var(--accent); }

.clarify-actions { margin-top: 20px; display: flex; justify-content: flex-end; }
.all-done { color: var(--success); font-weight: 600; text-align: center; padding: 20px; }

.photo-placeholder {
    margin-top: 10px; padding: 12px; background: var(--bg);
    border: 1px dashed var(--border); border-radius: var(--radius);
    color: var(--text-secondary); font-size: 0.85rem; text-align: center;
}

/* --- Processing Step --- */
.processing-card {
    text-align: center;
    padding: 60px 32px;
}
.processing-card.error { color: var(--error); }
.processing-text { font-size: 1.1rem; margin-top: 16px; color: var(--text-secondary); }
.error-text { font-size: 1rem; margin-bottom: 16px; }

.spinner {
    width: 40px; height: 40px; margin: 0 auto;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Results Step --- */
.results-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.results-header h2 { font-size: 1.4rem; }
.results-meta { color: var(--text-secondary); font-size: 0.85rem; }
.results-actions-top { display: flex; gap: 6px; }

.result-section { margin-bottom: 24px; }
.section-title {
    font-size: 0.95rem; color: var(--primary); padding-bottom: 8px;
    border-bottom: 2px solid var(--primary); margin-bottom: 8px;
}
.empty-section { color: var(--text-secondary); font-size: 0.85rem; font-style: italic; }

/* --- Data Tables --- */
.data-table {
    width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.data-table th {
    text-align: left; padding: 6px 8px; font-weight: 600;
    border-bottom: 1px solid var(--border); font-size: 0.8rem;
    color: var(--text-secondary);
}
.data-table td { padding: 6px 8px; border-bottom: 1px solid #f3f4f6; }
.data-table .r { text-align: right; }
.data-table .subtotal-row td { border-top: 1px solid var(--border); font-weight: 600; }
.alt-row td { font-size: 0.75rem; color: var(--text-secondary); border-bottom: none; padding-top: 0; }
.alt-text { font-style: italic; padding-left: 16px !important; }

/* --- Totals Section --- */
.totals-section {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; margin-top: 24px;
}
.totals-grid { margin-bottom: 16px; }
.total-row {
    display: flex; justify-content: space-between; padding: 4px 0;
    font-size: 0.9rem;
}
.total-row.subtotal {
    border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px;
    font-weight: 700; font-size: 1rem;
}

.markup-section { margin: 16px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.markup-label { font-weight: 600; font-size: 0.9rem; }
.markup-buttons { display: flex; gap: 4px; flex-wrap: wrap; }
.markup-btn {
    padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); font-size: 0.85rem; font-family: var(--font);
    cursor: pointer; transition: all 0.15s;
}
.markup-btn:hover { border-color: var(--accent); }
.markup-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.grand-total {
    display: flex; justify-content: space-between;
    background: var(--primary); color: white;
    padding: 14px 20px; border-radius: var(--radius);
    font-size: 1.2rem; font-weight: 700;
}

/* --- Validation Warnings --- */
.validation-warnings {
    background: #fef2f2; border: 1px solid #fecaca;
    border-radius: var(--radius); padding: 16px; margin-bottom: 20px;
}
.validation-title {
    font-size: 0.95rem; color: #991b1b; margin-bottom: 8px;
    font-weight: 700;
}
.vw-error { color: #991b1b; font-size: 0.85rem; padding: 3px 0; }
.vw-warn { color: #92400e; font-size: 0.85rem; padding: 3px 0; }
.vw-info { color: var(--text-secondary); font-size: 0.85rem; padding: 3px 0; }

/* --- Build Sequence --- */
.build-steps {
    padding-left: 20px; font-size: 0.85rem;
}
.build-step {
    margin-bottom: 10px; padding: 8px 10px;
    border-left: 3px solid var(--border);
}
.build-step strong { display: block; margin-bottom: 2px; }
.build-step p { color: var(--text-secondary); margin: 0; }
.build-step-flagged {
    border-left-color: var(--error); background: #fef2f2;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.safety-note { color: #92400e !important; font-style: italic; font-size: 0.8rem; }

/* --- Cut List --- */
.profile-cell { font-size: 0.8rem; color: var(--text-secondary); }

/* --- Stock Order Summary --- */
.stock-order-summary {
    margin-top: 10px; padding: 10px 12px;
    background: #f0fdf4; border: 1px solid #bbf7d0;
    border-radius: var(--radius); font-size: 0.82rem;
}
.stock-order-summary strong {
    display: block; color: #166534; margin-bottom: 4px; font-size: 0.8rem;
}
.stock-item {
    display: block; color: #166534; padding: 1px 0;
}

/* --- Rate Input --- */
.rate-input-section {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 16px; padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.rate-label { font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.rate-input-wrap {
    display: flex; align-items: center; gap: 2px;
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 4px 8px; background: var(--surface);
}
.rate-prefix, .rate-suffix {
    font-size: 0.85rem; color: var(--text-secondary);
}
.rate-input {
    width: 70px; border: none; outline: none;
    font-size: 0.9rem; font-family: var(--font);
    text-align: center; background: transparent;
}
.rate-input:focus { color: var(--accent); }

/* --- Inline Edit (editable fields in tables) --- */
.inline-edit {
    width: 60px; border: 1px solid var(--border); border-radius: 4px;
    padding: 2px 4px; font-size: 0.85rem; font-family: var(--font);
    text-align: right; background: var(--surface);
    -moz-appearance: textfield;
}
.inline-edit::-webkit-inner-spin-button,
.inline-edit::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.inline-edit:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
.inline-edit-sm { width: 50px; }

/* --- Build Instructions Retry Banner --- */
.build-retry-banner {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius);
    background: #fef3c7; border: 1px solid #f59e0b;
}
.build-retry-icon { font-size: 1.2rem; }
.build-retry-text { flex: 1; font-weight: 500; color: #92400e; }
.build-retry-detail { font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; padding-left: 16px; }

/* --- Notes Section --- */
.notes-section { margin-top: 20px; }
.notes-section h3 {
    font-size: 0.9rem; color: var(--text-secondary);
    margin-bottom: 8px;
}
.notes-section ul {
    list-style: disc; padding-left: 20px;
    font-size: 0.85rem; color: var(--text-secondary);
}
.notes-section li { margin-bottom: 4px; }

.results-footer {
    margin-top: 24px; display: flex; gap: 8px; justify-content: center;
}

/* --- History View --- */
.history-card {
    max-width: var(--max-w);
    margin: 32px auto;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.history-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.history-header h2 { font-size: 1.2rem; }
.history-list { padding: 0; }
.history-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 24px; border-bottom: 1px solid #f3f4f6;
    cursor: pointer; transition: background 0.1s;
    flex-wrap: wrap; gap: 8px;
}
.history-item:hover { background: var(--bg); }
.hi-main { display: flex; align-items: center; gap: 12px; }
.hi-number { font-weight: 700; font-size: 0.9rem; }
.hi-type { color: var(--text-secondary); font-size: 0.85rem; }
.hi-meta { display: flex; align-items: center; gap: 12px; }
.hi-total { font-weight: 700; }
.hi-date { color: var(--text-secondary); font-size: 0.8rem; }
.hi-status { font-size: 0.75rem; padding: 2px 8px; border-radius: 4px; }
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-sent { background: #dbeafe; color: #1e40af; }
.badge-accepted { background: #d1fae5; color: #065f46; }

.history-empty, .history-loading {
    text-align: center; padding: 60px 32px; max-width: var(--max-w);
    margin: 32px auto;
}
.history-empty h2 { margin-bottom: 8px; }
.history-empty p { color: var(--text-secondary); margin-bottom: 16px; }

/* --- Photo Upload --- */
.photo-upload-section {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px; flex-wrap: wrap;
}
.photo-hint {
    font-size: 0.8rem; color: var(--text-secondary);
}
.photo-previews {
    display: flex; gap: 8px; flex-wrap: wrap;
    width: 100%; margin-top: 4px;
}
.photo-preview {
    position: relative;
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 4px; display: flex; align-items: center; gap: 6px;
    background: var(--surface); font-size: 0.8rem;
}
.photo-preview.uploading { opacity: 0.6; }
.photo-preview img {
    width: 48px; height: 48px; object-fit: cover; border-radius: 4px;
}
.photo-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-remove {
    position: absolute; top: -4px; right: -4px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--error); color: white; border: none;
    cursor: pointer; font-size: 12px; line-height: 16px; text-align: center;
    padding: 0;
}
.spinner-sm {
    width: 16px; height: 16px;
    border: 2px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
.photo-q-preview { display: flex; gap: 4px; margin-top: 4px; }
.photo-question-upload { margin-bottom: 6px; }

/* --- Confirmed Fields (extraction) --- */
.confirmed-header {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 1rem 0 0.5rem;
    text-align: center;
}
.confirmed-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}
.confirmed-check {
    color: var(--success);
    font-weight: bold;
}
.confirmed-label {
    color: var(--text-secondary);
}
.confirmed-value {
    color: var(--primary);
    font-weight: 500;
}
.confirmed-edit {
    margin-left: auto;
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-family: var(--font);
}
.confirmed-edit:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* --- Photo Observations --- */
.photo-obs {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: #1e40af;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.photo-obs-icon { font-size: 1.1rem; }

/* --- Customer Section --- */
.customer-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
}
.customer-section .form-grid { margin-bottom: 10px; }
.customer-actions {
    display: flex; align-items: center; gap: 10px;
}
.save-status { font-size: 0.8rem; }
.save-ok { color: var(--success); }
.save-err { color: var(--error); }

/* --- Logo Upload --- */
.logo-upload-section {
    grid-column: 1 / -1;
    display: flex; align-items: center; gap: 16px;
    margin-top: 4px;
}
.logo-preview-img {
    max-width: 120px; max-height: 60px;
    border: 1px solid var(--border);
    border-radius: 4px; object-fit: contain;
}
.logo-upload-btn {
    position: relative; overflow: hidden;
}
.logo-upload-btn input[type="file"] {
    position: absolute; inset: 0;
    opacity: 0; cursor: pointer;
}

/* --- Job Description --- */
.job-description-section { margin-bottom: 20px; }
.job-description-text {
    font-size: 0.9rem; color: var(--text-secondary);
    font-style: italic; line-height: 1.6;
    padding: 8px 0;
}

/* --- Material Swap Modal --- */
.swap-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 200;
}
.swap-modal {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 600px; width: 90%;
    max-height: 80vh; overflow-y: auto;
}
.swap-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.swap-modal-header h3 { font-size: 1rem; margin: 0; }
.swap-close {
    background: none; border: none; font-size: 1.4rem;
    cursor: pointer; color: var(--text-secondary); line-height: 1;
}
.swap-close:hover { color: var(--text); }
.swap-modal-body { padding: 20px; }
.swap-current { margin-bottom: 12px; font-size: 0.9rem; }
.swap-table { margin-top: 8px; }
.swap-btn { white-space: nowrap; }
.delta-savings { color: var(--success); font-weight: 600; }
.delta-increase { color: var(--error); font-weight: 600; }

/* --- Bid Upload --- */
.bid-upload-area {
    border: 2px dashed var(--border);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    transition: border-color 0.15s, background 0.15s;
}
.bid-upload-area:hover { border-color: var(--accent); }
.bid-upload-area.dragover { border-color: var(--accent); background: #eff6ff; }
.bid-results-list { margin-top: 1rem; }
.bid-item {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.bid-item label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.bid-hint { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 0.5rem; }

/* --- Responsive --- */
@media (max-width: 640px) {
    .app-nav { padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
    .auth-card { margin: 40px 16px; padding: 28px 20px; }
    .profile-card { margin: 20px 16px; padding: 24px 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .describe-card, .clarify-card, .processing-card, .results-card {
        margin: 16px; padding: 20px 16px;
    }
    .job-type-grid { grid-template-columns: 1fr 1fr; }
    .results-header { flex-direction: column; }
    .markup-section { flex-direction: column; align-items: flex-start; }
    .grand-total { font-size: 1rem; }
    .history-card { margin: 16px; }
    .history-item { padding: 12px 16px; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 4px 4px; }
}
