/* ──────────────────────────────────────────────────────────────────────────
   Cellovian Master Provider Intake — Stylesheet
   Loaded as a normal <link rel="stylesheet"> from index.html.
   Sits on top of Tailwind utility classes loaded via CDN.
   ────────────────────────────────────────────────────────────────────────── */

:root {
    --brand-primary: #00A862;            /* muted clinical teal-green (was #00D97E) */
    --brand-primary-hover: #008A50;
    --brand-primary-light: rgba(0, 168, 98, 0.10);
    --brand-primary-ring: rgba(0, 168, 98, 0.18);
    --brand-success: #00D97E;            /* bright green reserved for completion / check affirmations only */
    --brand-navy: #00122B;
}

body { font-family: 'Inter', system-ui, sans-serif; background: #F1F5F9; }
h1, h2, h3, .ubuntu { font-family: 'Ubuntu', system-ui, sans-serif; }

.step-hidden { display: none; }

/* ── Section card depth ── */
.step > .bg-white { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06); border-color: #E2E8F0; }

/* ── Section header with icon ── */
.section-head { display: flex; align-items: flex-start; gap: 0.875rem; margin-bottom: 1.5rem; }
.section-head .section-icon {
    flex-shrink: 0; width: 2.5rem; height: 2.5rem; border-radius: 0.625rem;
    background: var(--brand-primary-light); color: var(--brand-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.375rem;
}
.section-head .section-head-text { flex: 1; min-width: 0; }
.section-head h2 { margin-bottom: 0.25rem !important; }
.section-head p { margin-bottom: 0 !important; }

/* ── Progress bar ── */
.step-indicator {
    width: 1.75rem; height: 1.75rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.step-indicator.upcoming { background: white; color: #94A3B8; border: 1.5px solid #CBD5E1; }
.step-indicator.completed { background-color: var(--brand-primary); color: white; }
.step-indicator.active { background-color: var(--brand-primary); color: white; box-shadow: 0 0 0 4px rgba(0,168,98,0.18); transform: scale(1.1); }
.step-indicator.is-incomplete { background: #D92D20 !important; color: white !important; border-color: #D92D20 !important; box-shadow: 0 0 0 4px rgba(217,45,32,0.18) !important; }

.progress-step { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.progress-step-label {
    font-size: 0.65rem; font-weight: 500; color: #94A3B8;
    white-space: nowrap; letter-spacing: 0.015em;
    transition: color 0.2s, font-weight 0.2s;
}
.progress-step-label.label-completed { color: #475569; }
.progress-step-label.label-active { color: #00744A; font-weight: 700; }
.progress-step-label.label-incomplete { color: #B42318; font-weight: 600; }

#progress-bar { overflow-x: auto; scroll-behavior: smooth; padding: 0.25rem 0.5rem 0.5rem; scrollbar-width: thin; }
#progress-bar::-webkit-scrollbar { height: 4px; }
#progress-bar::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 2px; }
#progress-bar::-webkit-scrollbar-track { background: transparent; }
#progress-bar-inner { display: inline-flex; align-items: flex-start; gap: 0.25rem; min-width: 100%; justify-content: center; }
@media (max-width: 1023px) {
    #progress-bar-inner { justify-content: flex-start; }
}

.step-connector { height: 2px; flex: 1; min-width: 1.25rem; background: #E2E8F0; border-radius: 1px; margin-top: 0.8125rem; transition: background-color 0.3s; }
.step-connector.done { background-color: var(--brand-primary); }
.step-connector.pending { background-color: #E2E8F0; }

/* Progress bar new-dot animation */
@keyframes step-pop-in {
    0% { transform: scale(0.4); opacity: 0; }
    70% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.step-indicator.just-added { animation: step-pop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ── Field group ── */
.field-group { display: flex; flex-direction: column; }
.field-group label {
    display: flex; align-items: flex-end; flex-wrap: wrap;
    font-size: 0.8125rem; font-weight: 500;
    color: #374151; line-height: 1.4;
    min-height: 2.8em; /* reserves 2 lines so inputs align across columns */
    margin-bottom: 0.375rem;
}
.field-group label .text-red-400 { font-weight: 600; font-size: 0.875em; margin-left: 2px; align-self: flex-end; }
.field-group input, .field-group select, .field-group textarea {
    width: 100%; height: 2.625rem; padding: 0 0.875rem;
    border: 1px solid #e5e7eb; border-radius: 0.5rem;
    font-size: 0.875rem; color: #111827; background: white; outline: none;
    transition: border-color 0.15s, box-shadow 0.15s; box-sizing: border-box;
}
/* Bare checkboxes inside a field-group (e.g. "same as…" toggles) must NOT inherit
   the full-width text-input box above — reset them to native checkbox size. */
.field-group input[type="checkbox"] {
    width: 18px; height: 18px; padding: 0; border: none; border-radius: 0;
    accent-color: var(--brand-primary); flex-shrink: 0; box-shadow: none;
}
.field-group select {
    padding-right: 2rem; appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3e%3cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 111.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 0.625rem center; background-size: 1rem;
}
.field-group input:focus, .field-group select:focus, .field-group textarea:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-primary-light); }
.field-group textarea { resize: vertical; min-height: 96px; height: auto; padding: 0.625rem 0.875rem; line-height: 1.5; }
.field-group input.error, .field-group select.error, .field-group textarea.error { border-color: #ef4444; }
.field-group .field-hint { font-size: 0.75rem; color: #6b7280; margin-top: 0.375rem; line-height: 1.45; }

/* Form grid: align inputs vertically across columns */
form#onboarding-form .grid { row-gap: 1.5rem; column-gap: 1.25rem; align-items: start; }

.internal-badge { display: inline-flex; align-items: center; gap: 4px; background: #fef3c7; color: #92400e; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 9999px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Review section rows ── */
.review-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid #f3f4f6; }
.review-row:last-child { border-bottom: none; }
.review-label { color: #6b7280; font-size: 0.8rem; flex-shrink: 0; }
.review-value { color: #111827; font-size: 0.875rem; font-weight: 500; text-align: right; max-width: 60%; word-break: break-word; }

/* ── Consent row ── */
.consent-row { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.875rem 1rem; background: #f9fafb; border-radius: 0.5rem; border: 1px solid #e5e7eb; }
.consent-row input[type="checkbox"] { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand-primary); flex-shrink: 0; }
.consent-row label { font-size: 0.875rem; color: #374151; text-transform: none; letter-spacing: normal; font-weight: 400; line-height: 1.45; }

/* ── Service multi-select cards ── */
.service-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
@media (min-width: 768px) { .service-grid { grid-template-columns: 1fr 1fr; } }
.service-card { position: relative; border: 1px solid #e5e7eb; border-radius: 0.75rem; padding: 1rem 2.75rem 1rem 1.125rem; background: white; cursor: pointer; transition: all 0.15s; display: block; }
.service-card:hover { border-color: #00A862; background: rgba(0,168,98,0.04); }
.service-card input[type="checkbox"] { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand-primary); flex-shrink: 0; }
.service-card .sc-title { font-size: 0.9rem; font-weight: 600; color: #111827; line-height: 1.4; }
.service-card .sc-desc { font-size: 0.75rem; color: #6b7280; margin-top: 0.125rem; line-height: 1.4; }
.service-card.selected { border-color: var(--brand-primary); background: rgba(0,168,98,0.07); box-shadow: 0 0 0 3px var(--brand-primary-light); }
.service-card .sc-badge {
    position: absolute; top: 10px; right: 10px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--brand-success); color: white;
    display: none; align-items: center; justify-content: center;
    font-size: 0.875rem; box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.service-card.selected .sc-badge { display: flex; }
.service-card .sc-checkbox { display: none; }

/* ── File upload component ── */
.upload-wrapper { position: relative; }
.upload-toggle { display: flex; gap: 0; margin-bottom: 0.5rem; border: 1px solid #e5e7eb; border-radius: 0.5rem; overflow: hidden; width: fit-content; position: relative; }
.upload-toggle button { padding: 0.35rem 0.85rem; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; background: white; border: none; color: #6b7280; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 4px; }
.upload-toggle button.active { background: var(--brand-primary); color: white; }
.upload-toggle button + button::before { content: ''; position: absolute; left: 50%; top: 8px; bottom: 8px; width: 1px; background: #E2E8F0; transform: translateX(-50%); }
.upload-zone { border: 2px dashed #d1d5db; border-radius: 0.5rem; padding: 1.5rem; text-align: center; cursor: pointer; transition: all 0.2s; background: #fafbfc; }
.upload-zone:hover { border-color: var(--brand-primary); background: rgba(0,168,98,0.05); animation: upload-pulse 1.6s ease-in-out infinite; }
@keyframes upload-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0,168,98,0); }
    50% { box-shadow: 0 0 0 4px rgba(0,168,98,0.12); }
}
.upload-zone.dragover { border-color: var(--brand-primary); background: rgba(0,168,98,0.09); }
.upload-zone.has-file { border-color: var(--brand-primary); border-style: solid; background: rgba(0,168,98,0.05); }
.upload-zone .uz-icon { font-size: 1.75rem; color: #9ca3af; margin-bottom: 0.25rem; }
.upload-zone.has-file .uz-icon { color: var(--brand-primary); }
.upload-zone .uz-text { font-size: 0.8rem; color: #6b7280; }
.upload-zone .uz-text strong { color: var(--brand-primary); }
.upload-zone.has-file .uz-text { color: #059669; }
.upload-zone .uz-hint { font-size: 0.65rem; color: #9ca3af; margin-top: 0.25rem; }
.upload-progress { height: 3px; background: #e5e7eb; border-radius: 2px; margin-top: 0.5rem; overflow: hidden; display: none; }
.upload-progress .bar { height: 100%; background: var(--brand-primary); border-radius: 2px; width: 0%; transition: width 0.3s; }
.upload-file-info { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 0.5rem; margin-top: 0.5rem; font-size: 0.8rem; color: #065f46; }
.upload-file-info .remove-file { margin-left: auto; color: #ef4444; cursor: pointer; font-size: 1rem; }
.upload-file-info .remove-file:hover { color: #dc2626; }
.link-input-pane, .upload-input-pane { display: none; }
.link-input-pane.active, .upload-input-pane.active { display: block; }

/* ── Brand button ── */
.btn-brand { background-color: var(--brand-primary); color: white; }
.btn-brand:hover { background-color: var(--brand-primary-hover); }

/* ── Section subgroup divider ── */
.subgroup-divider { border-top: 1px solid #e5e7eb; padding-top: 1.5rem; margin-top: 0.75rem; }
.subgroup-divider .subgroup-title { font-size: 0.8125rem; font-weight: 700; color: #00122B; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0; position: relative; padding-left: 0.75rem; }
.subgroup-divider .subgroup-title::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 0.875rem; background: var(--brand-primary); border-radius: 2px; }

/* ── Brand color picker cells ── */
.color-picker-cell { display: flex; flex-direction: column; gap: 0.5rem; }
.color-picker-cell .cp-label { font-size: 0.75rem; font-weight: 500; color: #475569; }
.color-picker-cell .cp-row { display: flex; gap: 0.5rem; align-items: center; }
.color-picker-cell input[type="color"] { -webkit-appearance: none; appearance: none; }
.color-picker-cell input[type="color"]::-webkit-color-swatch { border: none; border-radius: 0.375rem; }
.color-picker-cell input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker-cell input[type="text"]:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-primary-light); }

/* ── Chip-style checkboxes ── */
.chip-checkbox-group { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.375rem; }
.chip-label {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 0.875rem; font-size: 0.8125rem; font-weight: 500;
    background: white; color: #475569;
    border: 1px solid #E2E8F0; border-radius: 9999px;
    transition: all 0.15s; cursor: pointer; user-select: none;
    line-height: 1.2;
}
.chip-label:hover { border-color: var(--brand-primary); color: var(--brand-primary); background: var(--brand-primary-light); }
.chip-label input[type="checkbox"] { display: none; }
.chip-label:has(input:checked) {
    background: var(--brand-primary-light);
    border-color: var(--brand-primary);
    color: #00744A; font-weight: 600;
}
.chip-label:has(input:checked)::before {
    content: '\2713'; color: var(--brand-primary); font-weight: 700; margin-right: 1px;
}

/* ── Autosave pill ── */
.autosave-pill { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: #475569; }
.autosave-pill .dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #10b981; flex-shrink: 0; transition: transform 0.15s; }
.autosave-pill.saving .dot { background: #f59e0b; }
.autosave-pill.pulsing .dot { animation: dot-pulse 0.6s ease-out; }
@keyframes dot-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ── Section summary toggle ── */
#section-summary { margin-top: 1.25rem; }
#section-summary .summary-toggle {
    width: 100%; padding: 0.625rem 0.875rem; border: 1px dashed #cbd5e1;
    background: white; border-radius: 0.5rem; font-size: 0.8125rem;
    color: #475569; cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 0.5rem; transition: all 0.15s;
}
#section-summary .summary-toggle:hover { border-color: var(--brand-primary); color: var(--brand-primary); background: var(--brand-primary-light); }
#section-summary .summary-body { display: none; margin-top: 0.625rem; padding: 1rem 1.25rem; background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 0.5rem; }
#section-summary.open .summary-body { display: block; }
#section-summary .summary-toggle .chev { transition: transform 0.2s; }
#section-summary.open .summary-toggle .chev { transform: rotate(180deg); }

/* ── Save & exit banner ── */
#save-exit-banner { display: none; max-width: 36rem; margin: 1.5rem auto 0; padding: 1.25rem 1.5rem; background: white; border: 1px solid #E2E8F0; border-radius: 0.75rem; box-shadow: 0 4px 16px rgba(0,0,0,0.05); }
#save-exit-banner.visible { display: block; }

/* ── Submit-blocked banner ── */
#submit-blocked-banner { display: none; margin-bottom: 1rem; padding: 0.875rem 1rem; background: #FEF3F2; border: 1px solid #FECDCA; border-radius: 0.625rem; align-items: flex-start; gap: 0.75rem; }
#submit-blocked-banner.visible { display: flex; }
#submit-blocked-banner .banner-icon { color: #D92D20; font-size: 1.25rem; flex-shrink: 0; margin-top: 1px; }
#submit-blocked-banner .banner-body { flex: 1; font-size: 0.8125rem; color: #7A271A; line-height: 1.4; }
#submit-blocked-banner .banner-body strong { display: block; font-weight: 600; margin-bottom: 0.375rem; }
#submit-blocked-banner .banner-links { display: flex; flex-wrap: wrap; gap: 0.375rem; }
#submit-blocked-banner .missing-link { display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; font-size: 0.7rem; font-weight: 600; background: white; color: #B42318; border: 1px solid #FECDCA; border-radius: 9999px; cursor: pointer; font-family: inherit; transition: all 0.15s; }
#submit-blocked-banner .missing-link:hover { background: #FEF3F2; border-color: #D92D20; }
#submit-blocked-banner .banner-dismiss { background: transparent; border: none; color: #B42318; cursor: pointer; padding: 2px; font-size: 1rem; }
#submit-blocked-banner .banner-dismiss:hover { color: #7A271A; }

/* Sidenav incomplete-section markers */
.panel-nav-item.nav-incomplete { color: #B42318; }
.panel-nav-item.nav-incomplete .nav-dot { color: #D92D20; }
.panel-nav-item.nav-incomplete:hover { background: #FEF3F2; color: #7A271A; }

/* ── Scope signal banner ── */
#scope-signal {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.75rem; color: #475569; padding: 0.5rem 0.75rem;
    background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 0.5rem;
    margin-bottom: 1rem;
}
#scope-signal .scope-icon { color: var(--brand-primary); font-size: 0.95rem; flex-shrink: 0; }

/* ── Service-grid microcopy ── */
#service-microcopy { font-size: 0.8125rem; color: #475569; margin-top: 1rem; display: none; padding: 0.625rem 0.875rem; background: var(--brand-primary-light); border-radius: 0.5rem; border: 1px solid rgba(0,168,98,0.18); }
#service-microcopy.visible { display: block; }

/* ── Services + section sidenav panel ── */
#services-panel { display: none; }
#services-panel.visible { display: block; }
.svc-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 11px; font-size: 0.7rem; font-weight: 600;
    background: var(--brand-primary-light);
    color: #00744A;
    border: 1px solid rgba(0,168,98,0.25);
    border-radius: 9999px;
    cursor: pointer; transition: all 0.15s;
    font-family: inherit;
}
.svc-chip:hover { background: rgba(0,168,98,0.16); border-color: var(--brand-primary); }
.panel-step-num-row { font-size: 0.65rem; font-weight: 600; color: #64748B; text-transform: uppercase; letter-spacing: 0.06em; }
.panel-step-label { font-weight: 700; color: #00122B; line-height: 1.3; }
.panel-title { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #94A3B8; margin-bottom: 8px; }
.panel-edit {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.7rem; font-weight: 600; color: var(--brand-primary);
    background: transparent; border: none; cursor: pointer;
    padding: 0; font-family: inherit;
}
.panel-edit:hover { color: var(--brand-primary-hover); }

@media (min-width: 1280px) {
    #services-panel.visible {
        position: fixed; right: 24px; top: 120px;
        width: 256px; max-height: calc(100vh - 160px); overflow-y: auto;
        padding: 18px 16px; background: white;
        border: 1px solid #E2E8F0; border-radius: 12px;
        box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
        display: flex; flex-direction: column; gap: 16px;
    }
    .panel-progress { padding-bottom: 14px; border-bottom: 1px solid #E2E8F0; }
    .panel-progress .panel-step-label { font-size: 1.0625rem; margin-top: 4px; }
    .panel-section .panel-chips { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
    .panel-section .svc-chip { justify-content: flex-start; border-radius: 8px; }
    .panel-nav-list { display: flex; flex-direction: column; gap: 1px; max-height: 320px; overflow-y: auto; padding-right: 4px; }
    .panel-nav-item {
        display: flex; align-items: center; gap: 9px;
        padding: 6px 8px; border-radius: 6px;
        font-size: 0.8125rem; color: #64748B;
        background: transparent; border: none; cursor: pointer;
        transition: all 0.15s; text-align: left; width: 100%;
        font-family: inherit; line-height: 1.3;
    }
    .panel-nav-item:hover { background: #F1F5F9; color: #1E293B; }
    .panel-nav-item .nav-dot { font-size: 0.95rem; flex-shrink: 0; line-height: 1; }
    .panel-nav-item.nav-completed { color: #475569; }
    .panel-nav-item.nav-completed .nav-dot { color: var(--brand-primary); }
    .panel-nav-item.nav-active { background: var(--brand-primary-light); color: #00744A; font-weight: 700; }
    .panel-nav-item.nav-active .nav-dot { color: var(--brand-primary); }
    .panel-nav-item.nav-upcoming .nav-dot { color: #CBD5E1; }
    .panel-actions { padding-top: 4px; border-top: 1px solid #E2E8F0; }
}
@media (max-width: 1279px) {
    #services-panel.visible {
        margin-bottom: 16px; padding: 10px 14px;
        background: white; border: 1px solid #E2E8F0; border-radius: 10px;
        display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    }
    .panel-progress { display: flex; flex-direction: column; gap: 1px; margin-right: 4px; }
    .panel-progress .panel-step-label { font-size: 0.875rem; }
    #services-panel .panel-title { display: none; }
    .panel-section .panel-chips { display: flex; gap: 6px; flex-wrap: wrap; }
    .panel-nav-section, .panel-actions-divider { display: none; }
    .panel-actions { margin-left: auto; }
}
