/* =========================================================
   Brixzly Construction Analyzer – Frontend Styles
   ========================================================= */

:root {
	--bca-primary:       #1d4ed8;
	--bca-primary-dark:  #1e3a8a;
	--bca-success:       #16a34a;
	--bca-warning:       #d97706;
	--bca-danger:        #dc2626;
	--bca-border:        #e5e7eb;
	--bca-surface:       #ffffff;
	--bca-bg:            #f8fafc;
	--bca-text:          #111827;
	--bca-muted:         #6b7280;
	--bca-radius:        12px;
	--bca-radius-sm:     8px;
	--bca-shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
	--bca-shadow-hover:  0 4px 12px rgba(0,0,0,.12);
	--bca-font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Wrap ---------- */
.bca-wrap {
	font-family: var(--bca-font);
	color: var(--bca-text);
	/* max-width: 960px; */
	margin: 0 auto;
	padding: 24px 16px 60px;
}

/* ---------- Header ---------- */
.bca-header { margin-bottom: 32px; text-align: center; }
.bca-header__title { font-size: 2rem; font-weight: 800; margin: 0 0 8px; color: var(--bca-primary-dark); }
.bca-header__sub { font-size: .975rem; color: var(--bca-muted); margin: 0; }

/* ---------- Card ---------- */
.bca-card {
	background: var(--bca-surface);
	border: 1px solid var(--bca-border);
	border-radius: var(--bca-radius);
	box-shadow: var(--bca-shadow);
	padding: 28px;
	margin-bottom: 24px;
}
.bca-card__title { font-size: 1.1rem; font-weight: 700; margin: 0 0 20px; }

/* ---------- Form ---------- */
.bca-form-row { margin-bottom: 20px; }
.bca-field { display: flex; flex-direction: column; gap: 6px; }
.bca-label { font-size: .875rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.bca-label__hint { font-weight: 400; color: var(--bca-muted); font-size: .8rem; }
.bca-input, .bca-textarea {
	width: 100%; box-sizing: border-box;
	padding: 10px 14px;
	border: 1px solid var(--bca-border);
	border-radius: var(--bca-radius-sm);
	font-size: .9rem;
	font-family: inherit;
	color: var(--bca-text);
	transition: border-color .15s;
	outline: none;
}
.bca-input:focus, .bca-textarea:focus { border-color: var(--bca-primary); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.bca-textarea { resize: vertical; min-height: 80px; }
/* ---------- Upload Grid ---------- */
.bca-upload-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-bottom: 20px;
}
@media (max-width: 600px) { .bca-upload-grid { grid-template-columns: 1fr; } }

.bca-upload-zone {
	position: relative;
	border: 2px dashed var(--bca-border);
	border-radius: var(--bca-radius);
	padding: 32px 20px;
	text-align: center;
	cursor: pointer;
	transition: border-color .2s, background .2s;
	background: var(--bca-bg);
}
.bca-upload-zone:hover, .bca-upload-zone.is-dragover {
	border-color: var(--bca-primary);
	background: #eff6ff;
}
.bca-upload-zone__icon { margin: 0 auto 12px; width: 40px; height: 40px; color: var(--bca-muted); }
.bca-upload-zone__icon svg { width: 40px; height: 40px; }
.bca-upload-zone__title { font-weight: 700; font-size: .95rem; margin: 0 0 4px; }
.bca-upload-zone__hint { font-size: .8rem; color: var(--bca-muted); margin: 2px 0; }
.bca-upload-input {
	position: absolute; inset: 0; width: 100%; height: 100%;
	z-index: 1;
	opacity: 0; cursor: pointer;
	pointer-events: none; /* zone JS opens dialog; keeps remove / preview clicks from hitting the input */
}

/* Previews and controls sit above the invisible file input */
.bca-upload-zone .bca-preview {
	position: relative;
	z-index: 2;
}
.bca-upload-zone .bca-preview .bca-preview-remove,
.bca-upload-zone .bca-preview .bca-preview-thumb-remove,
.bca-upload-zone .bca-preview .bca-phase-input {
	pointer-events: auto;
}

/* ---------- Preview ---------- */
.bca-preview { margin-top: 12px; }
.bca-preview img { max-width: 100%; max-height: 180px; border-radius: 8px; border: 1px solid var(--bca-border); object-fit: cover; }
.bca-preview--grid { display: flex; flex-wrap: wrap; gap: 8px; }
.bca-preview--grid img { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; border: 1px solid var(--bca-border); }
.bca-preview-remove {
	display: inline-flex; align-items: center; gap: 4px;
	margin-top: 6px; font-size: .78rem;
	color: var(--bca-danger); cursor: pointer; background: none; border: none; padding: 0;
}

/* PDF preview card */
.bca-pdf-preview {
	display: flex; align-items: center; gap: 10px;
	padding: 12px 14px;
	background: #f0f9ff;
	border: 1px solid #bae6fd;
	border-radius: 8px;
	text-align: left;
}
.bca-pdf-preview svg { width: 32px; height: 32px; flex-shrink: 0; color: #0369a1; }
.bca-pdf-preview__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bca-pdf-preview__info strong { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--bca-text); }
.bca-pdf-preview__info span { font-size: .78rem; color: var(--bca-muted); }
.bca-preview-thumb-wrap { position: relative; display: inline-block; }
.bca-preview-thumb-remove {
	position: absolute; top: -6px; right: -6px;
	width: 18px; height: 18px; border-radius: 50%;
	background: var(--bca-danger); color: #fff; border: none;
	font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ---------- Buttons ---------- */
.bca-btn {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 11px 22px; border-radius: var(--bca-radius-sm);
	font-size: .9rem; font-weight: 600; cursor: pointer;
	border: 1.5px solid transparent; transition: all .15s; font-family: inherit;
}
.bca-btn--primary { background: var(--bca-primary); color: #fff; }
.bca-btn--primary:hover { background: var(--bca-primary-dark); }
.bca-btn--primary:disabled { opacity: .6; cursor: not-allowed; }
.bca-btn--outline { background: transparent; border-color: var(--bca-border); color: var(--bca-text); }
.bca-btn--outline:hover { border-color: var(--bca-primary); color: var(--bca-primary); }
.bca-btn--danger { background: transparent; border-color: var(--bca-danger); color: var(--bca-danger); }
.bca-btn--danger:hover { background: var(--bca-danger); color: #fff; }
.bca-btn--sm { padding: 6px 12px; font-size: .82rem; }
.bca-btn__icon { width: 18px; height: 18px; flex-shrink: 0; }
.bca-btn__icon svg { width: 18px; height: 18px; }

.bca-form-actions { display: flex; justify-content: center; padding-top: 8px; }

/* ---------- Loading ---------- */
.bca-loading { text-align: center; padding: 40px 20px; }
.bca-loading__spinner {
	width: 48px; height: 48px; margin: 0 auto 16px;
	border: 4px solid var(--bca-border);
	border-top-color: var(--bca-primary);
	border-radius: 50%;
	animation: bca-spin .8s linear infinite;
}
@keyframes bca-spin { to { transform: rotate(360deg); } }
.bca-loading p { color: var(--bca-muted); font-size: .9rem; margin: 0; }

/* ---------- Notices ---------- */
.bca-notice {
	padding: 12px 16px; border-radius: var(--bca-radius-sm);
	font-size: .9rem; margin-bottom: 16px;
}
.bca-notice--error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; margin-top: 20px; }
.bca-notice--success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

/* ---------- Results ---------- */
.bca-result-panel { margin-bottom: 24px; }
.bca-result {
	background: var(--bca-surface);
	border: 1px solid var(--bca-border);
	border-radius: var(--bca-radius);
	box-shadow: var(--bca-shadow);
	padding: 28px;
	animation: bca-fadein .3s ease;
}
@keyframes bca-fadein { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* Result header row */
.bca-result__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 24px;
}
.bca-result__name {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
	flex-wrap: wrap;
}
.bca-result__action-btns {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	flex-shrink: 0;
}
.bca-result__action-btns .bca-btn--outline {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}
.bca-result__action-btns .bca-btn--outline svg {
	flex-shrink: 0;
}
.bca-result__title {
	font-size: 1.4rem; font-weight: 800; margin: 0;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

/* Pencil / icon buttons */
.bca-btn-icon {
	display: inline-flex; align-items: center; justify-content: center;
	width: 30px; height: 30px; border-radius: 6px;
	background: transparent; border: 1px solid var(--bca-border);
	cursor: pointer; color: var(--bca-muted); flex-shrink: 0;
	transition: background .15s, color .15s;
}
.bca-btn-icon:hover { background: var(--bca-bg); color: var(--bca-primary); border-color: var(--bca-primary); }
.bca-btn-icon svg { width: 14px; height: 14px; }
.bca-btn-icon--save { color: var(--bca-success); border-color: var(--bca-success); }
.bca-btn-icon--save:hover { background: var(--bca-success); color: #fff; }

/* Inline name editor — hidden by default; JS sets display:flex to show */
.bca-name-editor {
	display: none; align-items: center; gap: 6px; flex-wrap: wrap;
	width: 100%;
}
.bca-name-input {
	flex: 1; min-width: 200px;
	padding: 6px 10px; border: 1.5px solid var(--bca-primary);
	border-radius: 6px; font-size: .95rem; font-family: inherit;
	font-weight: 700; color: var(--bca-text); outline: none;
	box-shadow: 0 0 0 3px rgba(29,78,216,.1);
}
.bca-name-status { font-size: .8rem; }
.bca-name-status.is-error { color: var(--bca-danger); }

/* Completion gauge */
.bca-completion { text-align: center; margin-bottom: 28px; }
.bca-completion__gauge {
	position: relative;
	width: 120px; height: 120px; margin: 0 auto 8px;
	border-radius: 50%;
	background: conic-gradient(var(--color, #22c55e) calc(var(--pct, 0) * 1%), #e5e7eb 0%);
	display: flex; align-items: center; justify-content: center;
}
.bca-completion__gauge::before {
	content: '';
	position: absolute; inset: 14px;
	background: var(--bca-surface);
	border-radius: 50%;
}
.bca-completion__number {
	position: relative; z-index: 1;
	font-size: 1.5rem; font-weight: 800;
}
.bca-completion__label { font-size: .85rem; color: var(--bca-muted); margin: 0; }

/* Sections */
.bca-section { margin-bottom: 24px; }
.bca-section h3 { font-size: 1rem; font-weight: 700; margin: 0 0 12px; }
.bca-section--summary p { font-size: .95rem; line-height: 1.6; color: var(--bca-muted); margin: 0; }

/* Issues */
.bca-issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bca-issue {
	padding: 12px 16px; border-radius: var(--bca-radius-sm);
	display: flex; align-items: baseline; gap: 10px;
	border-left: 4px solid transparent;
}
.bca-issue--critical { background: #fef2f2; border-left-color: #dc2626; }
.bca-issue--major    { background: #fff7ed; border-left-color: #ea580c; }
.bca-issue--minor    { background: #fefce8; border-left-color: #ca8a04; }
.bca-issue__badge {
	font-size: .72rem; font-weight: 700; text-transform: uppercase;
	padding: 2px 7px; border-radius: 4px; flex-shrink: 0; letter-spacing: .04em;
}
.bca-issue--critical .bca-issue__badge { background: #dc2626; color: #fff; }
.bca-issue--major    .bca-issue__badge { background: #ea580c; color: #fff; }
.bca-issue--minor    .bca-issue__badge { background: #ca8a04; color: #fff; }
.bca-issue strong { font-size: .9rem; }
.bca-issue em { font-size: .82rem; color: var(--bca-muted); margin-left: 4px; }

/* Columns */
.bca-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 680px) { .bca-cols { grid-template-columns: 1fr; } }
.bca-col { padding: 16px; border-radius: var(--bca-radius-sm); }
.bca-col h4 { font-size: .9rem; font-weight: 700; margin: 0 0 10px; }
.bca-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bca-col ul li { font-size: .85rem; line-height: 1.4; padding-left: 18px; position: relative; }
.bca-col ul li::before { content: '•'; position: absolute; left: 4px; }
.bca-col--completed  { background: #f0fdf4; }
.bca-col--completed h4 { color: #166534; }
.bca-col--completed li::before { color: #16a34a; }
.bca-col--progress  { background: #fffbeb; }
.bca-col--progress h4 { color: #92400e; }
.bca-col--progress li::before { color: #d97706; }
.bca-col--missing   { background: #fef2f2; }
.bca-col--missing h4 { color: #991b1b; }
.bca-col--missing li::before { color: #dc2626; }

/* Recommendations */
.bca-recs { padding-left: 20px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.bca-recs li { font-size: .9rem; line-height: 1.5; }

/* ---------- Membership gate ---------- */
.bca-gate {
	text-align: center;
	padding: 48px 24px;
	background: var(--bca-surface);
	border: 1px solid var(--bca-border);
	border-radius: var(--bca-radius);
}
.bca-gate__icon { margin-bottom: 16px; }
.bca-gate__icon svg { width: 48px; height: 48px; color: var(--bca-muted); }
.bca-gate__title { font-size: 1.25rem; font-weight: 800; margin: 0 0 10px; }
.bca-gate__msg { color: var(--bca-muted); max-width: 420px; margin: 0 auto; line-height: 1.6; }


/* ---------- History ---------- */
.bca-card--history {}

/* ── Collapsible history section (Bid-Scope style) ───────────────────────── */
.bca-history-section { margin-top: 8px; }

.bca-history-toggle {
	width: 100%; display: flex; justify-content: space-between; align-items: center;
	padding: 11px 16px;
	background: var(--bca-bg); border: 1px solid var(--bca-border); border-radius: 8px;
	cursor: pointer; font-size: .875rem; font-weight: 600; color: var(--bca-primary);
	transition: background .15s;
}
.bca-history-toggle:hover { background: #eff6ff; }
.bca-history-toggle.is-open { border-radius: 8px 8px 0 0; }
.bca-toggle-arrow { color: var(--bca-muted); font-size: .75rem; transition: transform .2s; }
.bca-history-toggle.is-open .bca-toggle-arrow { transform: rotate(180deg); }

.bca-history-dropdown {
	display: none;
	border: 1px solid var(--bca-border); border-top: none;
	border-radius: 0 0 8px 8px; background: #fff; overflow: hidden;
}

/* Bulk bar */
.bca-bulk-bar {
	display: flex; align-items: center; gap: 10px;
	padding: 8px 14px;
	background: var(--bca-bg); border-bottom: 1px solid var(--bca-border);
}
.bca-bulk-select-all {
	display: flex; align-items: center; gap: 6px;
	font-size: .82rem; color: var(--bca-muted); cursor: pointer; user-select: none;
}
.bca-bulk-count { font-size: .82rem; color: var(--bca-muted); }

/* Checkbox column */
.bca-history-item__checkbox {
	display: flex; align-items: center; cursor: pointer; flex-shrink: 0;
}
.bca-history-item__checkbox input[type="checkbox"] {
	width: 15px; height: 15px; cursor: pointer; accent-color: var(--bca-primary);
}

/* Compact list */
.bca-history-list { list-style: none; margin: 0; padding: 0; }
.bca-history-item {
	display: flex; align-items: center; gap: 12px;
	padding: 8px 14px;
	border-bottom: 1px solid var(--bca-border);
	font-size: .82rem;
	transition: background .1s;
}
.bca-history-item:last-child { border-bottom: none; }
.bca-history-item:hover { background: #f8fafc; }

/* Name + date stacked in a flex column */
.bca-history-item__meta { flex: 1; min-width: 0; }
.bca-history-item__name-row {
	display: flex; align-items: center; gap: 6px; min-width: 0;
}
.bca-history-item__name {
	font-weight: 600; font-size: .875rem;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
	color: var(--bca-primary);
}
.bca-history-item__name-row .bca-btn-icon {
	width: 22px; height: 22px; flex-shrink: 0; opacity: 0; transition: opacity .15s;
}
.bca-history-item:hover .bca-btn-icon,
.bca-history-item__name-row .bca-btn-icon:focus { opacity: 1; }
.bca-history-inline-editor {
	display: none; align-items: center; gap: 6px; margin-top: 3px; flex-wrap: wrap;
}
.bca-history-inline-editor .bca-name-input { min-width: 0; flex: 1; font-size: .82rem; padding: 3px 8px; }
.bca-history-item__date {
	font-size: .77rem; color: var(--bca-muted); display: block; margin-top: 1px;
}

/* Badge + actions on right */
.bca-history-item__info { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex-shrink: 0; }
.bca-history-item__actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

/* Badges */
.bca-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.bca-badge--pct    { background: #dbeafe; color: #1d4ed8; }
.bca-badge--issues { background: #fee2e2; color: #991b1b; }

/* ---------- Upload Field Wrapper (for FM tabs) ---------- */
.bca-upload-field {
	display: flex; flex-direction: column; gap: 8px;
}
.bca-upload-field > .bca-upload-zone__title {
	font-size: .9rem; font-weight: 600; color: var(--bca-text);
	margin: 0 0 2px;
}
.bca-label--required { color: var(--bca-danger); }
.bca-label--optional { font-size: .8rem; font-weight: 400; color: var(--bca-muted); }

/* Drawing FM: single-select — use a radio-dot indicator instead of checkmark */
/* ZIP multi-sheet badge */
.bca-fm-zip-note {
	font-size: .7rem; background: #fef3c7; color: #92400e;
	padding: 1px 6px; border-radius: 4px; font-weight: 600;
	margin-left: 4px;
}
/* Drawing upload tip line */
.bca-upload-zone__hint--tip {
	font-style: italic; font-size: .78rem; color: var(--bca-muted);
	margin-top: 2px;
}
/* ZIP preview card — reuses PDF card, just different accent */
.bca-zip-preview { border-color: #fbbf24; background: #fffbeb; }
.bca-zip-preview svg { color: #d97706; }

.bca-fm-item--radio .bca-fm-check {
	width: 18px; height: 18px; border: 2px solid var(--bca-border);
	border-radius: 50%; display: flex; align-items: center; justify-content: center;
	font-size: 0; transition: border-color .15s, background .15s;
	opacity: 1; /* always visible for radio */
	background: transparent;
}
.bca-fm-item--radio.bca-fm-item--selected .bca-fm-check {
	border-color: var(--bca-primary); background: var(--bca-primary);
	font-size: 0; /* dot via box-shadow */
	box-shadow: inset 0 0 0 3px #fff;
}

/* ---------- Source Tabs (Upload | From File Manager) ---------- */
.bca-source-tabs {
	display: flex; gap: 0; border: 1px solid var(--bca-border);
	border-radius: var(--bca-radius-sm); overflow: hidden;
	width: fit-content; margin-bottom: 4px;
}
.bca-source-tab {
	display: inline-flex; align-items: center; gap: 5px;
	padding: 7px 14px; font-size: .83rem; font-weight: 500;
	background: var(--bca-bg); color: var(--bca-muted);
	border: none; cursor: pointer; transition: background .15s, color .15s;
}
.bca-source-tab + .bca-source-tab { border-left: 1px solid var(--bca-border); }
.bca-source-tab.active {
	background: var(--bca-primary); color: #fff;
}
.bca-source-tab:hover:not(.active) {
	background: #e5e7eb; color: var(--bca-text);
}

/* ---------- Save to FM toggle ---------- */
.bca-save-to-fm {
	display: flex; align-items: center; gap: 8px;
	font-size: .83rem; color: var(--bca-muted); cursor: pointer;
	margin-top: 6px; padding: 6px 10px;
	background: var(--bca-bg); border: 1px solid var(--bca-border);
	border-radius: var(--bca-radius-sm);
	width: fit-content;
}
.bca-save-to-fm input[type="checkbox"] { cursor: pointer; }

/* ---------- File Manager Panel ---------- */
.bca-fm-method {
	border: 1px solid var(--bca-border); border-radius: var(--bca-radius-sm);
	overflow: hidden;
}
.bca-fm-toolbar {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
	padding: 10px 12px; background: var(--bca-bg);
	border-bottom: 1px solid var(--bca-border);
}
.bca-btn--sm {
	padding: 5px 12px; font-size: .82rem; font-weight: 500;
	border-radius: 6px; cursor: pointer; border: 1px solid var(--bca-border);
	background: #fff; color: var(--bca-text); transition: background .15s;
}
.bca-btn--sm:hover { background: #f3f4f6; }
.bca-btn--ghost {
	background: transparent; border-color: transparent;
	color: var(--bca-muted);
}
.bca-btn--ghost:hover { background: #f3f4f6; color: var(--bca-text); }
.bca-fm-selection-bar {
	display: flex; align-items: center; gap: 8px; margin-left: auto;
	font-size: .83rem; color: var(--bca-primary); font-weight: 500;
}
#bca-fm-sel-count { }
.bca-fm-list {
	max-height: 280px; overflow-y: auto;
	padding: 8px;
	display: flex; flex-direction: column; gap: 4px;
}
.bca-fm-loading, .bca-fm-error, .bca-fm-empty {
	text-align: center; color: var(--bca-muted); font-size: .87rem;
	padding: 20px; margin: 0;
}
.bca-fm-error { color: var(--bca-danger); }
.bca-fm-item {
	display: flex; align-items: center; gap: 10px;
	padding: 8px 10px; border-radius: var(--bca-radius-sm);
	border: 1px solid transparent; cursor: pointer;
	transition: background .15s, border-color .15s;
}
.bca-fm-item:hover { background: #f0f4ff; border-color: #c7d7fd; }
.bca-fm-item--selected {
	background: #eff6ff; border-color: var(--bca-primary);
}
.bca-fm-icon { font-size: 1.2rem; flex-shrink: 0; }
.bca-fm-info { flex: 1; min-width: 0; }
.bca-fm-name {
	font-size: .87rem; font-weight: 500; color: var(--bca-text);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bca-fm-meta {
	display: flex; align-items: center; gap: 8px;
	font-size: .78rem; color: var(--bca-muted); margin-top: 2px;
}
.bca-fm-type {
	background: #f1f5f9; padding: 1px 6px; border-radius: 4px;
	font-weight: 600; font-size: .72rem;
}
.bca-fm-folder { color: var(--bca-muted); }
.bca-fm-public {
	font-size: .72rem; background: #dcfce7; color: #15803d;
	padding: 1px 6px; border-radius: 4px; font-weight: 600;
}
.bca-fm-check {
	font-size: .9rem; color: var(--bca-primary); font-weight: 700;
	opacity: 0; transition: opacity .15s;
	flex-shrink: 0;
}
.bca-fm-item--selected .bca-fm-check { opacity: 1; }

/* ---------- Phase / Date input (under thumbnails + FM items) ---------- */
.bca-phase-input {
	display: block;
	width: 100%;
	margin-top: 5px;
	padding: 3px 7px;
	font-size: .75rem;
	border: 1px solid var(--bca-border);
	border-radius: 5px;
	background: #fff;
	color: var(--bca-text);
	box-sizing: border-box;
	line-height: 1.4;
}
.bca-phase-input:focus {
	outline: none;
	border-color: var(--bca-primary);
	box-shadow: 0 0 0 2px rgba(29,78,216,.12);
}
.bca-phase-input::placeholder { color: var(--bca-muted); }

/* FM phase input — hidden unless item is selected */
.bca-fm-phase {
	display: none;
	width: 120px;
	flex-shrink: 0;
	margin-top: 0;
}
.bca-fm-item--selected .bca-fm-phase { display: block; }

/* =================================================================
   Progress timeline (sequential photo analysis)
   ================================================================= */

.bca-timeline { }
.bca-timeline h3 { margin-bottom: 18px; }

.bca-timeline__track {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.bca-timeline__step {
	display: grid;
	grid-template-columns: 20px 1fr;
	grid-template-rows: auto 1fr;
	column-gap: 14px;
	position: relative;
}

.bca-timeline__dot {
	grid-column: 1;
	grid-row: 1;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	margin-top: 3px;
	flex-shrink: 0;
	box-shadow: 0 0 0 3px rgba(255,255,255,1), 0 0 0 4px currentColor;
}

.bca-timeline__line {
	grid-column: 1;
	grid-row: 2;
	width: 2px;
	background: var(--bca-border);
	margin: 4px auto 0;
	min-height: 24px;
}

.bca-timeline__content {
	grid-column: 2;
	grid-row: 1 / 3;
	padding-bottom: 20px;
}

.bca-timeline__step:last-child .bca-timeline__content {
	padding-bottom: 4px;
}

.bca-timeline__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 4px;
}

.bca-timeline__label {
	font-weight: 700;
	font-size: .9rem;
	color: var(--bca-text);
}

.bca-timeline__step--current .bca-timeline__label::after {
	content: ' ✦';
	font-size: .7rem;
	color: var(--bca-primary);
	vertical-align: middle;
}

.bca-timeline__pct {
	font-size: .88rem;
	font-weight: 800;
	flex-shrink: 0;
}

.bca-timeline__summary {
	font-size: .85rem;
	color: var(--bca-muted);
	margin: 0 0 6px;
	line-height: 1.5;
}

.bca-timeline__activities {
	margin: 0;
	padding-left: 16px;
	font-size: .82rem;
	color: var(--bca-text);
	list-style: disc;
}
.bca-timeline__activities li { margin-bottom: 2px; }

/* =================================================================
   Status card  [brixzly_construction_analyzer_status]
   ================================================================= */

.bca-status-card {
	background: var(--bca-surface);
	border: 1px solid var(--bca-border);
	border-radius: var(--bca-radius);
	box-shadow: var(--bca-shadow);
	overflow: hidden;
	max-width: 420px;
}

/* Header */
.bca-sc-header {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 16px;
	background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
	color: #fff;
}
.bca-sc-header__left { display: flex; align-items: center; gap: 10px; }
.bca-sc-icon { font-size: 1.4rem; }
.bca-sc-title { font-size: .95rem; font-weight: 700; line-height: 1.2; }
.bca-sc-level {
	font-size: .78rem; opacity: .8; margin-top: 1px;
	font-weight: 500; text-transform: uppercase; letter-spacing: .04em;
}
.bca-sc-refresh-btn {
	background: rgba(255,255,255,.15); border: none; border-radius: 6px;
	color: #fff; padding: 5px; cursor: pointer; display: flex;
	align-items: center; transition: background .15s;
}
.bca-sc-refresh-btn:hover { background: rgba(255,255,255,.28); }
.bca-sc-refresh-btn--spinning svg {
	animation: bca-spin .7s linear infinite;
}
@keyframes bca-spin { to { transform: rotate(360deg); } }

/* Gate (access disabled) */
.bca-sc-gate {
	padding: 18px 16px;
	color: var(--bca-danger);
	font-size: .88rem;
	text-align: center;
}

/* Items list */
.bca-sc-items {
	padding: 12px 16px;
	display: flex; flex-direction: column; gap: 10px;
}
.bca-sc-item {
	background: var(--bca-bg);
	border: 1px solid var(--bca-border);
	border-radius: var(--bca-radius-sm);
	padding: 10px 12px;
}
.bca-sc-item--warn { border-color: #fca5a5; background: #fff5f5; }

/* Simple (one-line) items */
.bca-sc-item--simple {
	display: flex; align-items: center; justify-content: space-between;
	gap: 8px;
}
.bca-sc-item-header {
	display: flex; align-items: center; justify-content: space-between;
	gap: 8px; margin-bottom: 6px;
}
.bca-sc-item-label { font-size: .84rem; color: var(--bca-muted); }
.bca-sc-period { font-size: .78rem; }
.bca-sc-item-value { font-size: .9rem; font-weight: 700; color: var(--bca-text); }
.bca-sc-item-value--unlimited { color: var(--bca-success); }

/* Progress bar */
.bca-sc-bar {
	height: 6px; background: #e5e7eb; border-radius: 999px; overflow: hidden;
	margin-bottom: 4px;
}
.bca-sc-bar-fill {
	height: 100%; background: var(--bca-primary); border-radius: 999px;
	transition: width .4s ease;
}
.bca-sc-bar-fill--warn { background: var(--bca-danger); }

/* Remaining text */
.bca-sc-remaining { font-size: .78rem; color: var(--bca-muted); }
.bca-sc-warn-text { color: var(--bca-danger); font-weight: 600; }
.bca-sc-token-note { font-size: .78rem; }

/* Badges */
.bca-sc-badge {
	font-size: .75rem; font-weight: 700; padding: 2px 8px;
	border-radius: 999px; letter-spacing: .02em;
}
.bca-sc-badge--ok   { background: #dcfce7; color: #15803d; }
.bca-sc-badge--warn { background: #fef3c7; color: #b45309; }
.bca-sc-badge--err  { background: #fee2e2; color: #b91c1c; }
.bca-sc-badge--off  { background: #f1f5f9; color: var(--bca-muted); }

/* Outcome breakdown row */
.bca-sc-item--breakdown {
	display: flex; align-items: flex-start; justify-content: space-between;
	gap: 8px; flex-wrap: wrap;
}
.bca-sc-item-label--sm { font-size: .78rem; padding-top: 2px; }
.bca-sc-badges { display: flex; flex-wrap: wrap; gap: 5px; }

/* Footer */
.bca-sc-footer {
	padding: 12px 16px;
	border-top: 1px solid var(--bca-border);
	text-align: center;
}
.bca-sc-upgrade-btn {
	display: inline-block;
	font-size: .83rem; font-weight: 600;
	color: var(--bca-primary); text-decoration: none;
	padding: 5px 14px; border: 1px solid var(--bca-primary);
	border-radius: 6px; transition: background .15s, color .15s;
}
.bca-sc-upgrade-btn:hover { background: var(--bca-primary); color: #fff; }

/* File Manager partial-save notice (matches Draw Request / Change Order tone) */
.bca-fm-save-warn {
	margin: 0 0 20px;
	padding: 14px 16px;
	border-radius: var(--bca-radius-sm);
	border: 1px solid #fcd34d;
	background: #fffbeb;
	color: #78350f;
	font-size: .9rem;
	line-height: 1.45;
}
.bca-fm-save-warn__title { display: block; margin-bottom: 8px; font-size: .95rem; font-weight: 700; }
.bca-fm-save-warn__intro { margin: 0 0 10px; color: #92400e; }
.bca-fm-save-warn__list { margin: 0; padding-left: 1.2em; }
.bca-fm-save-warn__list li { margin: 6px 0; }
.bca-fm-save-warn__lbl { font-weight: 600; color: #78350f; }
.bca-fm-save-warn__msg { font-weight: 400; color: #92400e; }
