/* fcaster_x — layout & components (verbatim from the deployed source) */

/* HEADER */
header { background: var(--panel); border-bottom: 1px solid var(--border); padding: 0 16px; height: 48px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; z-index: 1000; }
.logo { font-family: 'Space Mono', monospace; font-size: 14px; font-weight: 700; color: var(--accent2); letter-spacing: -0.5px; }
.logo span { color: var(--warn); }
.header-stats { display: flex; gap: 10px; margin-left: auto; font-size: 12px; flex-wrap: wrap; }
.stat-chip { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 3px 8px; display: flex; gap: 6px; align-items: center; }
.stat-chip .val { font-weight: 600; color: var(--accent2); font-family: 'Space Mono', monospace; font-size: 11px; }
.stat-chip .lbl { color: var(--muted); font-size: 10px; }

/* LAYOUT */
.main { display: flex; flex: 1; min-height: 0; }
.panel { width: var(--panel-width); background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden; }

/* TABS */
.tab-bar { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.tab { flex: 1; padding: 10px 4px; font-size: 10px; font-weight: 600; text-align: center; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.5px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent2); border-bottom-color: var(--accent2); }
.tab-content { flex: 1; overflow-y: auto; padding: 12px; display: none; }
.tab-content.active { display: block; }
.tab-content::-webkit-scrollbar { width: 4px; }
.tab-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* FORM */
.section { margin-bottom: 16px; }
.section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
input[type="text"], input[type="number"], select { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; color: var(--text); font-size: 12px; font-family: 'Space Mono', monospace; outline: none; transition: border-color 0.15s; }
input:focus, select:focus { border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.btn { width: 100%; padding: 8px 12px; background: var(--accent); color: #fff; border: none; border-radius: 4px; font-size: 12px; font-weight: 600; cursor: pointer; transition: background 0.15s; font-family: 'DM Sans', sans-serif; }
.btn:hover { background: var(--accent2); }
.btn:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }
.btn-sm { width: auto; padding: 4px 10px; font-size: 11px; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent2); background: transparent; }
.btn-danger { background: #5a1e1e; border: 1px solid var(--warn); color: var(--warn); }
.btn-danger:hover { background: #7a2020; }

/* SLIDERS */
.slider-row { margin-bottom: 10px; }
.slider-header { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 4px; }
.slider-header .name { color: var(--text); font-weight: 500; }
.slider-header .val { color: var(--accent2); font-family: 'Space Mono', monospace; font-size: 10px; }
input[type="range"] { width: 100%; accent-color: var(--accent2); height: 4px; cursor: pointer; }

/* TOGGLES */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #1a1f26; }
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 12px; color: var(--text); }
.toggle-sub { font-size: 10px; color: var(--muted); display: block; }
.switch { position: relative; width: 32px; height: 18px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider-sw { position: absolute; inset: 0; background: var(--border); border-radius: 18px; cursor: pointer; transition: background 0.2s; }
.slider-sw::before { content: ''; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px; background: var(--muted); border-radius: 50%; transition: transform 0.2s, background 0.2s; }
input:checked + .slider-sw { background: var(--accent); }
input:checked + .slider-sw::before { transform: translateX(14px); background: #fff; }

/* PROGRESS / STATUS */
.progress-wrap { margin: 6px 0 2px; }
.progress-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent2); transition: width 0.2s; width: 0%; }
.progress-text { font-size: 10px; color: var(--muted); margin-top: 3px; font-family: 'Space Mono', monospace; }
.status-msg { font-size: 11px; color: var(--muted); padding: 4px 0; display: flex; align-items: center; gap: 6px; line-height: 1.4; }
.status-msg.ok { color: var(--ok); }
.status-msg.err { color: var(--warn); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.dot.pulse { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* DuckDB init status bar */
.db-status { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 6px 10px; margin-bottom: 8px; font-size: 11px; display: flex; align-items: center; gap: 8px; }
.db-status .db-icon { font-size: 14px; }
.db-status .db-text { flex: 1; color: var(--muted); }
.db-status.ready .db-text { color: var(--ok); }
.db-status.error .db-text { color: var(--warn); }
.db-status.loading .db-text { color: var(--accent2); }

/* TILE BADGES */
.tile-badge { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 5px 10px; font-family: 'Space Mono', monospace; font-size: 10px; color: var(--accent2); display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.tile-badge .size-est { color: var(--muted); font-size: 9px; }

/* QUERY BOX */
.query-box { background: #0a0f14; border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; font-family: 'Space Mono', monospace; font-size: 10px; color: #6a9f58; line-height: 1.6; margin-bottom: 8px; white-space: pre-wrap; word-break: break-all; display: none; }
.query-box.visible { display: block; }

/* MONTH GRID */
.month-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; margin-bottom: 8px; }
.month-btn { padding: 4px 2px; font-size: 9px; font-weight: 600; text-align: center; border: 1px solid var(--border); border-radius: 3px; cursor: pointer; background: var(--bg); color: var(--muted); transition: all 0.15s; text-transform: uppercase; }
.month-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* MAP */
#map { flex: 1; position: relative; z-index: 0; }
.map-legend { position: absolute; bottom: 30px; right: 10px; background: rgba(13,17,23,0.92); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; z-index: 1000; font-size: 11px; min-width: 140px; backdrop-filter: blur(4px); }
.map-legend.hidden { display: none; }
.legend-title { font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 8px; }
.legend-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.legend-swatch { width: 14px; height: 14px; border-radius: 2px; flex-shrink: 0; }

/* RINGS OF RISK CARD */
.rings-card { position: absolute; bottom: 30px; left: 10px; background: rgba(13,17,23,0.92); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; z-index: 1000; font-size: 11px; max-width: 260px; backdrop-filter: blur(4px); }
.rings-card.hidden { display: none; }
.rings-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0; }
.rings-legend-item { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--text); }
.rings-legend-swatch { width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }
.rings-summary { font-size: 10px; color: var(--text); line-height: 1.5; margin: 6px 0; padding: 6px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.rings-provenance { font-size: 9px; color: var(--muted); line-height: 1.5; margin-top: 6px; }
.rings-msg { font-size: 11px; color: var(--muted); line-height: 1.5; }
.rings-badge { display: inline-block; background: var(--accent); color: #fff; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 3px; padding: 1px 5px; }

/* POPUP */
.leaflet-popup-content-wrapper { background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: 6px; font-family: 'DM Sans', sans-serif; font-size: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); }
.leaflet-popup-tip { background: var(--panel); }
.leaflet-popup-content { margin: 12px 14px; }
.popup-row { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; border-bottom: 1px solid var(--border); }
.popup-row:last-child { border: none; }
.popup-key { color: var(--muted); font-size: 11px; }
.popup-val { color: var(--accent2); font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 600; }

/* CHARTS */
.chart-box { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px; margin-bottom: 10px; }
.chart-title { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
#charts-tab canvas { max-height: 200px; }

/* DROP ZONE */
.drop-zone { border: 2px dashed var(--border); border-radius: 6px; padding: 20px 16px; text-align: center; cursor: pointer; transition: all 0.15s; margin-bottom: 8px; position: relative; }
#map.drawing-mode { cursor: crosshair !important; }
#map.drawing-mode .leaflet-container { cursor: crosshair !important; }
.drop-zone:hover { border-color: var(--accent); background: rgba(31,111,235,0.03); }
.drop-zone.dragging { border-color: var(--accent2); background: rgba(31,111,235,0.08); }
.drop-zone .dz-icon { font-size: 24px; margin-bottom: 6px; }
.drop-zone strong { color: var(--text); display: block; margin-bottom: 4px; font-size: 12px; }
.drop-zone p { font-size: 11px; color: var(--muted); line-height: 1.5; }
.drop-zone .dz-filename { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--ok); margin-top: 6px; }

/* TOAST */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 8px 16px; font-size: 12px; z-index: 9999; transition: opacity 0.3s; pointer-events: none; max-width: 400px; text-align: center; }
.toast.hidden { opacity: 0; }

/* NO DATA */
.no-data { text-align: center; padding: 30px 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.no-data .icon { font-size: 32px; margin-bottom: 8px; }

/* INFO BOX */
.info-box { background: #0d1e33; border: 1px solid #1f3a5f; border-radius: 4px; padding: 8px 10px; font-size: 11px; color: #7eb8f7; line-height: 1.5; margin-bottom: 8px; }
.info-box.warn { background: #1e1208; border-color: #5f3a1f; color: #f7b87e; }
.info-box strong { display: block; margin-bottom: 3px; }

/* YEAR RANGE */
.year-range { display: flex; gap: 6px; align-items: center; }
.year-range input { width: 70px; }
