.profile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(34, 24, 16, 0.55);
    backdrop-filter: blur(3px);
    z-index: 4200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.profile-overlay.open { display: flex; }
.profile-modal {
    position: relative;
    width: min(720px, 100%);
    max-height: min(90vh, 740px);
    overflow: auto;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}
.profile-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 6;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--cream);
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}
.profile-modal-close:hover { background: var(--cream-dark); }
.profile-card {
    display: grid;
    grid-template-columns: 220px 1fr;
    background: var(--surface);
    border-radius: 16px;
    overflow: hidden;
}
.profile-aside {
    background: var(--brown-dark);
    color: #fff;
    padding: 28px 22px;
    text-align: center;
}
.profile-avatar {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--on-gold);
    font-weight: 800;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.profile-aside h3 {
    font-family: Inter, Arial, sans-serif;
    font-size: 20px;
    margin-bottom: 4px;
}
.profile-aside p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.78);
    word-break: break-word;
}
.profile-form-wrap {
    padding: 28px 28px 24px;
}
.profile-form-wrap h2 {
    font-family: Inter, Arial, sans-serif;
    font-size: 24px;
    color: var(--ink);
    margin-bottom: 6px;
}
.profile-lead {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}
.profile-form-wrap .form-group { margin-bottom: 14px; }
.profile-form-wrap label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.profile-form-wrap label small {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--text-muted);
}
.profile-form-wrap input {
    width: 100%;
    border: 1.5px solid var(--cream-dark);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 15px;
    background: var(--surface);
}
.profile-form-wrap input:disabled {
    background: var(--cream);
    color: var(--text-muted);
}
.profile-form-wrap .pw-wrap { position: relative; }
.profile-form-wrap .pw-wrap input {
    padding-right: 44px;
    color: var(--ink) !important;
    letter-spacing: 0;
}
.profile-form-wrap .pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    background: var(--cream);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 6px;
}
.profile-form-wrap .pw-toggle img,
.profile-form-wrap .pw-toggle svg.icon {
    pointer-events: none;
    width: 20px;
    height: 20px;
    display: block;
}
.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.profile-form-wrap .btn-primary {
    margin-top: 0;
    width: 100%;
    padding: 12px 18px;
    border-radius: 12px;
}
.profile-close-btn {
    width: 100%;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1.5px solid var(--cream-dark);
    background: var(--surface);
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.profile-close-btn:hover { background: var(--cream); }
.profile-signout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1.5px solid var(--danger-line);
    background: var(--danger-bg);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.profile-signout:hover {
    background: var(--danger-bg);
    border-color: var(--danger-line);
    color: var(--ink);
}
.profile-signout .icon { width: 16px; height: 16px; }
a.user-pill { text-decoration: none; }
a.user-pill:hover { background: rgba(255, 255, 255, 0.18); }

.quote-panel {
    margin: 14px 0 18px;
    padding: 18px 18px 16px;
    border-radius: 14px;
    background:
        radial-gradient(ellipse 70% 60% at 100% 0%, rgba(217, 207, 188, 0.12), transparent 55%),
        linear-gradient(180deg, var(--surface), var(--surface-2));
    border: 1.5px solid var(--border);
}
.quote-panel.is-actionable {
    border-color: var(--gold);
    box-shadow: 0 8px 24px rgba(43, 31, 23, 0.06);
}
.quote-panel-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}
.quote-panel-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.quote-panel-price {
    font-family: var(--font-num);
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.15;
}
.quote-status-chip {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 6px 10px;
    border-radius: 999px;
}
.quote-status-action {
    background: var(--warn-bg);
    color: var(--warn-ink);
}
.quote-status-wait {
    background: var(--info-bg);
    color: var(--info-ink);
}
.quote-panel-copy {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0 0 14px;
}
.quote-panel-foot { margin: 12px 0 0; }
.quote-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.quote-checklist li {
    position: relative;
    padding: 10px 12px 10px 36px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.4;
    color: var(--ink);
}
.quote-checklist li::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 12px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border);
}
.quote-checklist li.is-done::before {
    border-color: var(--success, #2F7D4A);
    background: var(--success, #2F7D4A);
    box-shadow: inset 0 0 0 2px #fff;
}
.quote-checklist li.is-todo {
    color: var(--text-muted);
}
.quote-step {
    margin: 0 0 12px;
    padding: 14px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.quote-step-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}
.quote-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brown-mid);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.quote-step-head strong {
    display: block;
    font-size: 14px;
    color: var(--ink);
}
.quote-step-head p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}
.quote-step-body { margin: 0; }
.quote-pay-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 12px;
    padding: 12px;
    background: var(--surface-2);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.quote-pay-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.quote-pay-row strong { color: var(--ink); font-weight: 750; }
.quote-proof-label {
    display: block;
    font-size: 12px;
    font-weight: 750;
    color: var(--ink);
    margin-bottom: 6px;
}
.quote-proof-label span { color: var(--danger-ink)); }
.quote-proof-input {
    display: block;
    width: 100%;
    margin-bottom: 4px;
    font-size: 13px;
    font-family: inherit;
}
.quote-schedule-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 640px) {
    .quote-schedule-grid { grid-template-columns: 1fr; }
}
.quote-field { min-width: 0; }
.btn-accept-quote {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: 10px;
    background: var(--brown-mid);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
}
.btn-accept-quote:hover { background: var(--brown-dark); }
.quote-accept-form { margin: 0; }
.quote-submit-bar {
    margin-top: 4px;
    padding-top: 4px;
}
.quote-submit-note {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
    margin: 0 0 10px;
}
.quote-pref-date,
.quote-pref-time,
.quote-pref-address {
    display: block;
    width: 100%;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    font: inherit;
    color: var(--ink);
    box-sizing: border-box;
}
.quote-field .quote-pref-date,
.quote-field .quote-pref-time { margin-bottom: 0; }
.quote-pref-address {
    resize: vertical;
    min-height: 72px;
    line-height: 1.45;
}
.pref-date-hint {
    display: block;
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
}
.pref-schedule-card {
    margin: 14px 0 0;
    padding: 14px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
}
.pref-schedule-card.is-required {
    border-color: #F0C36A;
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
}
.pref-schedule-card-head,
.pref-schedule-card > summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
    cursor: pointer;
    list-style: none;
}
.pref-schedule-card > summary::-webkit-details-marker { display: none; }
.pref-schedule-card-head strong,
.pref-schedule-card > summary strong {
    font-size: 14px;
    color: var(--ink);
}
.pref-schedule-card-head span,
.pref-schedule-card > summary span {
    font-size: 12px;
    color: var(--text-muted);
}
.pref-date-form { margin: 0; display: block; width: 100%; }
.pref-date-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.pref-date-field-full { grid-column: 1 / -1; }
@media (max-width: 640px) {
    .pref-date-grid { grid-template-columns: 1fr; }
}
.pref-date-field label {
    display: block;
    font-size: 12px;
    font-weight: 750;
    color: var(--ink);
    margin-bottom: 6px;
}
.pref-date-field label span { color: var(--danger-ink)); }
.pref-date-field input,
.pref-date-field select,
.pref-date-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    font: inherit;
    color: var(--ink);
    box-sizing: border-box;
}
.pref-date-field textarea {
    resize: vertical;
    min-height: 72px;
    line-height: 1.45;
}
.pref-date-save {
    margin-top: 12px;
    width: 100%;
    padding: 11px 14px;
    border: none;
    border-radius: 10px;
    background: var(--brown-mid);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}
.pref-date-save:hover { background: var(--brown-dark); }

.pay-accounts-box {
    margin: 0 0 14px;
    padding: 14px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
}
.pay-accounts-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 10px;
}
.pay-accounts-rows { display: flex; flex-direction: column; gap: 10px; }
.pay-accounts-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}
.pay-accounts-k {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 72px;
}
.pay-accounts-v {
    text-align: right;
    font-size: 14px;
    color: var(--ink);
}
.pay-accounts-v strong {
    display: block;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}
.pay-accounts-v small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}
.pay-accounts-due {
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}
.pay-accounts-empty {
    margin: 0;
    font-size: 13px;
    color: var(--warn-ink);
    line-height: 1.45;
}

@media (max-width: 768px) {
    .profile-card { grid-template-columns: 1fr; }
    .profile-overlay { padding: 12px; align-items: flex-start; }
    .profile-modal {
        max-height: 92vh;
        margin-top: 12px;
    }
}

.quote-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.quote-choice { display: flex; align-items: flex-start; gap: 8px; border: 1.5px solid var(--cream-dark); background: var(--surface); border-radius: 10px; padding: 9px 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.quote-choice input { margin-top: 3px; accent-color: var(--brown-mid); flex-shrink: 0; }
.quote-choice strong { display: block; font-size: 13px; color: var(--ink); }
.quote-choice small { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.quote-choice.is-on { border-color: var(--brown-mid); background: var(--cream); }
.quote-live-summary .is-due strong { color: var(--ink-2); font-size: 15px; }
.quote-live-summary strong { font-family: var(--font-num); }
.quote-optional { font-weight: 400; color: var(--text-muted); }
.quote-decline-form { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--cream-dark); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.btn-decline-quote { background: var(--surface); color: var(--danger-ink); border: 1.5px solid var(--danger-line); border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn-decline-quote:hover { background: var(--danger-bg); }
.quote-decline-hint { font-size: 12px; color: var(--text-muted); }
.quote-decline-box { flex-basis: 100%; background: var(--danger-bg); border: 1px solid var(--danger-line); border-radius: 10px; padding: 12px; }
.quote-decline-box label { display: block; font-size: 12px; font-weight: 700; color: var(--danger-ink); margin-bottom: 6px; }
.quote-decline-box label span { font-weight: 400; color: var(--text-muted); }
.quote-decline-box textarea { width: 100%; border: 1.5px solid var(--danger-line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; resize: vertical; background: var(--surface); }
.quote-decline-box p { font-size: 12px; color: var(--danger-ink); margin: 6px 0 10px; }
.quote-decline-actions { display: flex; gap: 8px; }
.quote-decline-actions button { flex: 1; border-radius: 8px; padding: 9px; font-size: 13px; font-weight: 700; cursor: pointer; border: none; font-family: inherit; }
.quote-decline-keep { background: var(--surface); color: var(--ink); border: 1.5px solid var(--cream-dark) !important; }
.quote-decline-go { background: #B91C1C; color: #fff; }
.quote-status-declined { background: var(--danger-bg); color: var(--danger-ink); }
.quote-panel.is-declined { opacity: .92; }
@media (max-width: 520px) { .quote-choice-grid { grid-template-columns: 1fr; } }

.quote-accept-form [hidden], .quote-panel [hidden] { display: none !important; }

.profile-checks { display: flex; flex-direction: column; gap: 8px; }
.form-group label.profile-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    padding: 11px 12px;
    border: 1.5px solid var(--cream-dark);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
    line-height: 1.45;
    transition: border-color .2s, background .2s;
}
.form-group label.profile-check:hover { border-color: var(--brown-light); }
.form-group label.profile-check:has(input:checked) { border-color: var(--gold); background: var(--surface); }
.form-group .profile-check input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    min-height: 0;
    margin: 1px 0 0;
    padding: 0;
    accent-color: var(--brown-mid);
    cursor: pointer;
}
.profile-check small { color: var(--text-muted); font-weight: 400; font-size: 12px; }

/* Profile photo */
.profile-avatar.has-photo { padding: 0; overflow: hidden; background: var(--surface); }
.profile-avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.profile-photo-form { margin: 10px 0 0; display: flex; justify-content: center; }
.profile-photo-form + .profile-photo-form { margin-top: 6px; }
.profile-photo-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.profile-photo-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px; border-radius: 999px;
    background: var(--gold); color: var(--on-gold);
    font-size: 12.5px; font-weight: 700; cursor: pointer;
    transition: filter .2s, transform .15s;
}
.profile-photo-btn:hover { filter: brightness(1.06); }
.profile-photo-form:focus-within .profile-photo-btn { box-shadow: 0 0 0 3px rgba(217, 207, 188, .45); }
.profile-photo-remove {
    background: none; border: none; padding: 2px 6px; cursor: pointer;
    color: rgba(255, 255, 255, .7); font-size: 12px; font-weight: 600; text-decoration: underline;
}
.profile-photo-remove:hover { color: #fff; }
.profile-photo-hint { display: block; margin: 6px 0 16px; font-size: 11px; color: rgba(255, 255, 255, .55); text-align: center; }
.profile-aside .profile-avatar + .profile-photo-form { margin-top: 0; }
.avatar-crop {
    position: fixed; inset: 0; z-index: 4300; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(34, 24, 16, .6);
}
.avatar-crop[hidden] { display: none; }
.avatar-crop-box {
    width: min(380px, 100%); max-height: calc(100vh - 32px); overflow: auto;
    padding: 22px 22px 18px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-lg); text-align: center;
}
.avatar-crop-box h3 { margin: 0 0 4px; font-family: 'Inter', Arial, sans-serif; font-size: 21px; color: var(--ink); }
.avatar-crop-lead { margin: 0 0 14px; font-size: 13px; line-height: 1.45; color: var(--text-muted); }
.avatar-crop-stage {
    position: relative; width: min(280px, 100%); aspect-ratio: 1; margin: 0 auto; overflow: hidden;
    border-radius: 12px; background: var(--brown-dark); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.avatar-crop-stage.is-dragging { cursor: grabbing; }
.avatar-crop-stage:focus { outline: none; }
.avatar-crop-stage:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.avatar-crop-stage img, .avatar-crop-preview img {
    position: absolute; left: 50%; top: 50%; max-width: none; max-height: none;
    transform-origin: center; pointer-events: none; -webkit-user-drag: none;
}
.avatar-crop-ring {
    position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
    border: 2px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 999px rgba(34, 24, 16, .55);
}
.avatar-crop-zoom { display: flex; align-items: center; gap: 10px; width: min(280px, 100%); margin: 14px auto 0; }
.avatar-crop-zoom button {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--cream-dark);
    background: var(--cream); color: var(--ink); font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer;
}
.avatar-crop-zoom button:hover { background: var(--cream-dark); }
.avatar-crop-zoom input { flex: 1; min-width: 0; accent-color: var(--brown-mid); }
.avatar-crop-row { display: flex; align-items: center; gap: 10px; width: min(280px, 100%); margin: 14px auto 0; }
.avatar-crop-preview {
    position: relative; flex: 0 0 auto; width: 44px; height: 44px; overflow: hidden; border-radius: 50%;
    background: var(--cream); box-shadow: 0 0 0 2px var(--cream-dark);
}
.avatar-crop-preview-label { flex: 1; font-size: 12px; color: var(--text-muted); text-align: left; }
.avatar-crop-link {
    padding: 4px 2px; border: none; background: none; cursor: pointer;
    color: var(--ink-2); font-family: inherit; font-size: 12.5px; font-weight: 700; text-decoration: underline;
}
.avatar-crop-actions { display: flex; gap: 10px; margin-top: 18px; }
.avatar-crop-actions button {
    flex: 1; padding: 11px 14px; border-radius: 10px; cursor: pointer;
    font-family: inherit; font-size: 14px; font-weight: 700;
}
.avatar-crop-cancel { border: 1px solid var(--cream-dark); background: var(--cream); color: var(--ink); }
.avatar-crop-save { border: none; background: var(--brown-dark); color: #fff; }
.avatar-crop-save:disabled { opacity: .7; cursor: progress; }

.user-pill.has-photo { padding-left: 4px; }
.user-pill-photo { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; display: block; flex: 0 0 auto; border: 1.5px solid rgba(255, 255, 255, .6); }

.ref-ocr-status { display: block; margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.45; background: var(--cream); color: var(--text-muted); }
.ref-ocr-status[hidden] { display: none; }
.ref-ocr-status.is-busy { background: var(--info-bg); color: var(--info-ink); }
.ref-ocr-status.is-ok { background: var(--ok-bg); color: var(--ok-ink); }
.ref-ocr-status.is-warn { background: var(--warn-bg); color: var(--warn-ink); }
