
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f0f13; color: #c9c2d6; font-size: 14px; }
a { color: inherit; text-decoration: none; }

header { background: #16131f; border-bottom: 1px solid #2a2440; padding: 14px 24px; display: flex; align-items: center; gap: 12px; }
header h1 { font-size: 18px; font-weight: 700; color: #e8e0f0; }
header .subtitle { font-size: 11px; color: #5a5270; }
.header-back { font-size: 12px; color: #8b5cf6; padding: 5px 12px; border: 1px solid #2a2440; border-radius: 6px; background: #1a1625; }
.header-back:hover { border-color: #8b5cf6; }
.header-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }
.card { background: #16131f; border: 1px solid #221e2e; border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 13px; font-weight: 600; color: #8b5cf6; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 14px; }

.btn { display: inline-block; padding: 9px 20px; border: none; border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; }
.btn-primary { background: #8b5cf6; color: white; }
.btn-primary:hover { background: #7c3aed; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: #1a1625; color: #8b5cf6; border: 1px solid #2a2440; }
.btn-ghost:hover { border-color: #8b5cf6; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-danger { background: #1f0d0d; color: #f87171; border: 1px solid #3a1515; }
.btn-danger:hover { border-color: #f87171; }

.status-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.status-idle { background: #1a1625; color: #5a5270; }
.status-running { background: #1a1a00; color: #facc15; }
.status-done { background: #0d1f0d; color: #4ade80; }
.status-error { background: #1f0d0d; color: #f87171; }
.status-planned { background: #1a1625; color: #5a5270; }

.zip-badge { display: inline-block; background: #1a1625; border: 1px solid #2a2440; color: #a78bfa; border-radius: 4px; padding: 2px 7px; font-size: 11px; font-family: monospace; margin-right: 4px; }
.zip-badge.primary { border-color: #8b5cf6; }

/* Drop zone */
.drop-zone { border: 2px dashed #2a2440; border-radius: 8px; padding: 28px; text-align: center; cursor: pointer; transition: border-color 0.2s; }
.drop-zone:hover, .drop-zone.drag-over { border-color: #8b5cf6; }
.drop-zone input[type=file] { display: none; }
.drop-zone p { color: #5a5270; font-size: 12px; margin-top: 6px; }
.upload-status { margin-top: 8px; font-size: 12px; color: #a78bfa; min-height: 16px; }

/* File list */
.file-list { list-style: none; }
.file-list li { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 6px; margin-bottom: 3px; background: #0f0f13; font-size: 12px; }
.file-list .fname { color: #e8e0f0; font-weight: 500; font-family: monospace; }
.file-list .fname a { color: #a78bfa; text-decoration: underline; text-underline-offset: 2px; }
.file-list .fname a:hover { color: #8b5cf6; }
.file-list .fmeta { color: #5a5270; font-size: 11px; }
.file-list-empty { color: #5a5270; font-style: italic; font-size: 12px; padding: 4px 0; }

/* IO indicators */
.io-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #1a1625; font-size: 12px; }
.io-row:last-child { border-bottom: none; }
.io-check { font-size: 13px; flex-shrink: 0; width: 16px; }
.io-check.ok { color: #4ade80; }
.io-check.missing { color: #f87171; }
.io-path { font-family: monospace; color: #a78bfa; flex: 1; word-break: break-all; }
.io-path a { color: #a78bfa; text-decoration: underline; text-underline-offset: 2px; }
.io-path a:hover { color: #8b5cf6; }
.io-meta { color: #5a5270; font-size: 11px; flex-shrink: 0; }
.io-param-badge { background: #1a1625; color: #8b5cf6; border: 1px solid #2a2440; border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 600; flex-shrink: 0; font-family: monospace; }
.io-section { margin-top: 12px; }
.io-label { font-size: 11px; color: #5a5270; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }

/* Exec block */
.exec-block { background: #0c0a12; border: 1px solid #2a2440; border-radius: 6px; padding: 12px; font-family: monospace; font-size: 11px; color: #c9c2d6; white-space: pre-wrap; word-break: break-all; margin-top: 12px; }

/* Progress bar */
.progress-bar-wrap { margin-top: 10px; height: 6px; background: #1a1625; border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: #8b5cf6; border-radius: 3px; transition: width 0.4s ease; }

.log-box { margin-top: 14px; background: #0a0a0e; border: 1px solid #1e1a2a; border-radius: 6px; padding: 12px; font-family: monospace; font-size: 11px; color: #a78bfa; max-height: 200px; overflow-y: auto; white-space: pre-wrap; display: none; }
.log-box.visible { display: block; }

/* Pipeline card */
.pipeline-card { background: #16131f; border: 1px solid #221e2e; border-radius: 10px; padding: 20px; margin-bottom: 14px; }
.pipeline-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.pipeline-name { font-size: 15px; font-weight: 700; color: #e8e0f0; }
.pipeline-script { font-size: 11px; color: #5a5270; font-family: monospace; margin-top: 2px; }
.pipeline-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Final outputs */
.final-output-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #1a1625; }
.final-output-row:last-child { border-bottom: none; }
.final-output-title { flex: 1; color: #e8e0f0; font-weight: 600; }
.final-output-meta { color: #5a5270; font-size: 11px; }

/* Final output groups */
.fo-group { margin-bottom: 16px; }
.fo-group:last-child { margin-bottom: 0; }
.fo-group-header { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 10px; border-radius: 5px; margin-bottom: 6px; }
.fo-group-header.group-reports { color: #c084fc; background: #1f1630; border-left: 3px solid #8b5cf6; }
.fo-group-header.group-maps { color: #60a5fa; background: #111827; border-left: 3px solid #3b82f6; }
.fo-group-header.group-databases { color: #4ade80; background: #0d1f0d; border-left: 3px solid #22c55e; }
.fo-group-header.group-data { color: #6b7280; background: #16131f; border-left: 3px solid #4b5563; }
.fo-type-badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 600; font-family: monospace; flex-shrink: 0; }
.fo-type-badge.group-reports { background: #1f1630; color: #c084fc; border: 1px solid #3b2860; }
.fo-type-badge.group-maps { background: #111827; color: #60a5fa; border: 1px solid #1e3a5f; }
.fo-type-badge.group-databases { background: #0d1f0d; color: #4ade80; border: 1px solid #16401a; }
.fo-type-badge.group-data { background: #16131f; color: #6b7280; border: 1px solid #2a2440; }

/* Storage */
.path-row { display: flex; gap: 12px; font-size: 12px; margin-bottom: 6px; }
.path-label { color: #5a5270; width: 140px; flex-shrink: 0; }
.path-value { color: #a78bfa; font-family: monospace; word-break: break-all; }
.path-envvar { color: #5a5270; font-size: 11px; font-family: monospace; margin-left: 4px; }

/* Index */
.search-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.search-input { flex: 1; background: #16131f; border: 1px solid #2a2440; border-radius: 8px; padding: 10px 14px; color: #e8e0f0; font-size: 14px; font-family: inherit; outline: none; }
.search-input:focus { border-color: #8b5cf6; }
.search-input::placeholder { color: #5a5270; }
.section-title { font-size: 13px; font-weight: 600; color: #5a5270; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.muni-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.muni-card { background: #16131f; border: 1px solid #221e2e; border-radius: 10px; padding: 18px; cursor: pointer; transition: border-color 0.15s; display: block; }
.muni-card:hover { border-color: #8b5cf6; }
.muni-card .zips { margin-bottom: 8px; }
.muni-card .muni-name { font-size: 16px; font-weight: 700; color: #e8e0f0; margin-bottom: 3px; }
.muni-card .muni-meta { font-size: 12px; color: #5a5270; margin-bottom: 10px; }
.muni-card .analyses { display: flex; flex-wrap: wrap; gap: 5px; }
.analysis-pill { background: #1a1625; border: 1px solid #2a2440; color: #8b5cf6; border-radius: 12px; padding: 2px 10px; font-size: 11px; }
.add-card { background: #16131f; border: 2px dashed #2a2440; border-radius: 10px; padding: 18px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; color: #5a5270; font-size: 13px; min-height: 140px; }
.add-card:hover { border-color: #8b5cf6; color: #8b5cf6; }
.no-results { color: #5a5270; font-style: italic; text-align: center; padding: 40px; display: none; }
.search-match-hint { font-size: 11px; color: #a78bfa; margin-top: 8px; padding-top: 6px; border-top: 1px solid #221e2e; }
.output-filter-bar { margin-bottom: 14px; }
.output-filter-bar .search-input { width: 100%; }

/* Pipelines table */
.pipeline-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pipeline-table th { color: #5a5270; text-align: left; padding: 6px 10px; border-bottom: 1px solid #221e2e; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.pipeline-table td { padding: 8px 10px; border-bottom: 1px solid #1a1625; }
.pipeline-table tr:last-child td { border-bottom: none; }
.pipeline-table .muni-link { color: #a78bfa; }
.pipeline-table .muni-link:hover { color: #8b5cf6; }
.pipeline-table .pipeline-name-cell { color: #e8e0f0; }

/* Pipeline group card */
.pipeline-group-card { background: #16131f; border: 1px solid #221e2e; border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.pipeline-group-header { margin-bottom: 16px; }
.pipeline-desc { font-size: 12px; color: #5a5270; margin-top: 3px; line-height: 1.5; }

/* Step cards */
.pipeline-steps { display: flex; flex-direction: column; }
.step-card { background: #0f0f13; border: 1px solid #1e1a2a; border-radius: 8px; overflow: hidden; }
.step-card.step-placeholder { opacity: 0.55; }
.step-header { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; user-select: none; }
.step-header:hover { background: #12101a; }
.step-num { width: 20px; height: 20px; border-radius: 50%; background: #1a1625; border: 1px solid #2a2440; color: #8b5cf6; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-title { flex: 1; min-width: 0; }
.step-name { font-size: 13px; font-weight: 600; color: #e8e0f0; }
.placeholder-badge { display: inline-block; background: #1a1625; color: #5a5270; border: 1px solid #2a2440; border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; vertical-align: middle; margin-left: 4px; }
.step-script { font-size: 11px; color: #5a5270; font-family: monospace; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.step-chevron { color: #5a5270; font-size: 10px; flex-shrink: 0; transition: transform 0.15s; display: inline-block; }
.step-body { display: none; padding: 0 14px 14px; border-top: 1px solid #1a1625; }
.step-body.open { display: block; padding-top: 12px; }
.step-connector { text-align: center; color: #2a2440; font-size: 14px; line-height: 1; padding: 3px 0; }

/* Pipeline final output (within pipeline group card) */
.pipeline-final-output { margin-top: 14px; padding-top: 14px; border-top: 1px solid #221e2e; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pipeline-final-label { font-size: 10px; color: #5a5270; text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0; }

/* Modal */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 9000; }
.modal-overlay.active { display: flex; align-items: center; justify-content: center; }
.modal-box { background: #16131f; border: 1px solid #2a2440; border-radius: 12px; padding: 24px; max-width: 700px; width: 90%; max-height: 80vh; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-title { font-size: 14px; font-weight: 700; color: #e8e0f0; }
.modal-close { background: none; border: none; color: #5a5270; cursor: pointer; font-size: 20px; padding: 0 4px; line-height: 1; }
.modal-close:hover { color: #e8e0f0; }
.modal-path { font-family: monospace; font-size: 11px; color: #5a5270; margin-bottom: 10px; }
.modal-body { flex: 1; overflow-y: auto; background: #0a0a0e; border: 1px solid #1e1a2a; border-radius: 6px; padding: 12px; font-family: monospace; font-size: 12px; color: #c9c2d6; white-space: pre; }
.modal-footer { margin-top: 12px; display: flex; justify-content: flex-end; }

/* Collapsible section */
.collapsible-header { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.collapsible-header h2 { margin-bottom: 0; }
.collapsible-chevron { color: #5a5270; font-size: 10px; transition: transform 0.15s; display: inline-block; }
.collapsible-body { display: none; margin-top: 14px; }
.collapsible-body.open { display: block; }

/* Runtime badge */
.runtime-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.runtime-badge.runtime-local { background: #1f1a00; color: #facc15; border: 1px solid #3a3000; }

/* Detail header */
.muni-header { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; }
.muni-header-left .zips { margin-bottom: 6px; }
.muni-header-left h2 { font-size: 22px; font-weight: 700; color: #e8e0f0; margin-bottom: 4px; }
.muni-header-left .location { font-size: 13px; color: #5a5270; }

/* Stats bar */
.stats-bar { display: flex; gap: 16px; margin-bottom: 20px; }
.stat-item { background: #16131f; border: 1px solid #221e2e; border-radius: 8px; padding: 12px 20px; display: flex; flex-direction: column; align-items: center; flex: 1; }
.stat-value { font-size: 22px; font-weight: 700; color: #8b5cf6; }
.stat-label { font-size: 11px; color: #5a5270; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* Municipality parcel count */
.muni-parcel-count { font-size: 12px; color: #8b5cf6; font-weight: 600; margin-bottom: 8px; }

/* Pipeline progress indicator */
.pipeline-progress-indicator { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.pipeline-progress-bar { flex: 0 0 48px; height: 5px; background: #1a1625; border-radius: 3px; overflow: hidden; }
.pipeline-progress-fill { height: 100%; background: #4ade80; border-radius: 3px; min-width: 2px; }
.pipeline-progress-text { font-size: 11px; color: #5a5270; white-space: nowrap; }
.pipeline-progress-text .pp-complete { color: #4ade80; font-weight: 600; }

/* Compact zip badges */
.zips-compact { margin-bottom: 6px; }
.zip-sm { padding: 1px 5px; font-size: 0.65rem; margin-right: 3px; }
.zip-overflow { background: #221e2e; color: #5a5270; border-color: #2a2440; }

/* County aggregation cards */
.county-cards { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 24px; }
.county-card { background: linear-gradient(135deg, #1a1630 0%, #16131f 100%); border: 1px solid #3b2860; border-radius: 12px; padding: 20px; cursor: pointer; transition: border-color 0.15s; display: block; }
.county-card:hover { border-color: #8b5cf6; }
.county-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.county-name { font-size: 18px; font-weight: 700; color: #e8e0f0; }
.county-type-badge { background: #1f1630; color: #c084fc; border: 1px solid #3b2860; border-radius: 12px; padding: 3px 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.county-stats { display: flex; gap: 24px; margin-bottom: 12px; }
.county-stat { display: flex; flex-direction: column; }
.county-stat-value { font-size: 20px; font-weight: 700; color: #a78bfa; }
.county-stat-label { font-size: 11px; color: #5a5270; text-transform: uppercase; letter-spacing: 0.04em; }
.county-components { display: flex; flex-wrap: wrap; gap: 6px; }
.county-component-badge { background: #1a1625; border: 1px solid #2a2440; color: #8b5cf6; border-radius: 6px; padding: 3px 10px; font-size: 11px; }

/* Aggregation detail page */
.agg-header { margin-bottom: 24px; }
.agg-header h2 { font-size: 22px; font-weight: 700; color: #e8e0f0; margin-bottom: 4px; }
.agg-header .agg-subtitle { font-size: 13px; color: #5a5270; }
.agg-components-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 24px; }
.agg-component-card { background: #16131f; border: 1px solid #221e2e; border-radius: 8px; padding: 14px; }
.agg-component-card .comp-name { font-size: 14px; font-weight: 600; color: #e8e0f0; margin-bottom: 4px; }
.agg-component-card .comp-stat { font-size: 12px; color: #8b5cf6; }
.agg-component-card .comp-meta { font-size: 11px; color: #5a5270; margin-top: 4px; }
.agg-heatmap-embed { width: 100%; height: 600px; border: 1px solid #221e2e; border-radius: 8px; background: #0f0f13; }
.agg-heatmap-link { display: inline-block; margin-top: 8px; color: #a78bfa; font-size: 12px; }
.agg-heatmap-link:hover { color: #8b5cf6; text-decoration: underline; }
