/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #0f1117; color: #e0e0e0; min-height: 100vh; }
a { color: #7eb8ff; text-decoration: none; }

/* ===== Nav ===== */
.top-nav { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: #161a23; border-bottom: 1px solid #2a2e39; }
.nav-brand { font-size: 18px; font-weight: 700; color: #fff; }
.nav-links { display: flex; gap: 20px; }
.nav-links a { padding: 6px 14px; border-radius: 6px; font-size: 14px; color: #a0a8b8; transition: all .15s; }
.nav-links a:hover, .nav-links a.active { background: #1e2330; color: #fff; }

/* ===== Container ===== */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* ===== Multi-select Filter ===== */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar label { font-size: 14px; font-weight: 600; color: #a0a8b8; }
.multi-select { position: relative; min-width: 320px; }
.multi-select-toggle { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #1a1e28; border: 1px solid #2a2e39; border-radius: 6px; cursor: pointer; font-size: 13px; color: #e0e0e0; min-height: 36px; }
.multi-select-toggle:hover { border-color: #3a4050; }
.multi-select-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; max-height: 360px; overflow-y: auto; background: #1a1e28; border: 1px solid #2a2e39; border-radius: 0 0 6px 6px; z-index: 100; }
.multi-select-dropdown.open { display: block; }
.ms-option { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.ms-option:hover { background: #242838; }
.ms-option input[type="checkbox"] { accent-color: #4a9eff; }
.ms-option.select-all { border-bottom: 1px solid #2a2e39; font-weight: 600; color: #7eb8ff; }

/* ===== Calendar ===== */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-header h2 { font-size: 20px; font-weight: 600; }
.cal-nav { display: flex; gap: 8px; }
.cal-nav button { padding: 6px 14px; background: #1a1e28; border: 1px solid #2a2e39; border-radius: 6px; color: #e0e0e0; cursor: pointer; font-size: 13px; }
.cal-nav button:hover { background: #242838; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 32px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 600; color: #6a7080; padding: 8px 0; text-transform: uppercase; }
.cal-day { position: relative; min-height: 100px; padding: 6px 8px; background: #161a23; border-radius: 4px; cursor: pointer; transition: all .15s; border: 1px solid transparent; }
.cal-day:hover { border-color: #3a4050; }
.cal-day.empty { background: #0f1117; cursor: default; border: none; }
.cal-day.empty:hover { border-color: transparent; }
.cal-day .day-num { font-size: 13px; font-weight: 600; color: #6a7080; }
.cal-day .day-stats { position: absolute; top: 4px; right: 6px; text-align: right; font-size: 11px; line-height: 1.4; }
.cal-day .day-stats .show-rate { font-weight: 700; }
.cal-day .day-stats .show-count { color: #8a90a0; }

/* Color coding */
.cal-day.rate-green { background: #132a1a; border-color: #1a5c2a; }
.cal-day.rate-yellow { background: #2a2510; border-color: #5c4e1a; }
.cal-day.rate-red { background: #2a1313; border-color: #5c1a1a; }
.cal-day.rate-green .day-stats .show-rate { color: #4ade80; }
.cal-day.rate-yellow .day-stats .show-rate { color: #facc15; }
.cal-day.rate-red .day-stats .show-rate { color: #f87171; }

/* ===== Modal ===== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,.6); z-index: 500; justify-content: center; align-items: flex-start; padding-top: 60px; }
.modal-overlay.open { display: flex; }
.modal { background: #161a23; border: 1px solid #2a2e39; border-radius: 10px; width: 700px; max-width: 95vw; max-height: 80vh; overflow-y: auto; padding: 24px; }
.modal h3 { font-size: 18px; margin-bottom: 16px; color: #fff; }
.modal-close { float: right; background: none; border: none; color: #8a90a0; font-size: 22px; cursor: pointer; }
.modal-close:hover { color: #fff; }

/* ===== Tables ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
.data-table th { text-align: left; padding: 8px 10px; background: #1a1e28; color: #8a90a0; font-weight: 600; border-bottom: 1px solid #2a2e39; }
.data-table td { padding: 8px 10px; border-bottom: 1px solid #1e222c; }
.data-table tr:hover td { background: #1a1e28; }

/* ===== Sections ===== */
.section { margin-bottom: 32px; }
.section h3 { font-size: 16px; font-weight: 600; color: #fff; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #2a2e39; }

/* ===== Collapsible ===== */
.collapsible-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: #1a1e28; border-radius: 6px; cursor: pointer; margin-bottom: 2px; font-size: 13px; }
.collapsible-header:hover { background: #1e2330; }
.collapsible-header .arrow { transition: transform .2s; }
.collapsible-header.open .arrow { transform: rotate(90deg); }
.collapsible-body { display: none; padding: 8px 12px 12px; background: #13161e; border-radius: 0 0 6px 6px; margin-bottom: 4px; }
.collapsible-body.open { display: block; }

/* ===== Future Events ===== */
.future-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin-bottom: 16px; }
.future-bucket { background: #1a1e28; border-radius: 6px; padding: 10px; text-align: center; }
.future-bucket .bucket-label { font-size: 11px; color: #6a7080; margin-bottom: 4px; }
.future-bucket .bucket-count { font-size: 20px; font-weight: 700; color: #4a9eff; }

/* ===== Stats Cards ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: #1a1e28; border-radius: 8px; padding: 16px; text-align: center; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #4a9eff; }
.stat-card .stat-label { font-size: 12px; color: #6a7080; margin-top: 4px; }
.stat-card.good .stat-value { color: #4ade80; }
.stat-card.bad .stat-value { color: #f87171; }
.stat-card.warn .stat-value { color: #facc15; }

/* ===== Data Science ===== */
.ds-filters { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 24px; }
.ds-filters .field { display: flex; flex-direction: column; gap: 4px; }
.ds-filters .field label { font-size: 12px; color: #6a7080; font-weight: 600; }
.ds-filters .field input { padding: 8px 10px; background: #1a1e28; border: 1px solid #2a2e39; border-radius: 6px; color: #e0e0e0; font-size: 13px; }
.ds-filters button { padding: 8px 18px; background: #2563eb; border: none; border-radius: 6px; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; height: 36px; }
.ds-filters button:hover { background: #1d4ed8; }

.dow-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 32px; }
.dow-card { background: #1a1e28; border-radius: 8px; padding: 14px; text-align: center; }
.dow-card h4 { font-size: 13px; color: #8a90a0; margin-bottom: 10px; }
.dow-card .dow-value { font-size: 22px; font-weight: 700; margin-bottom: 2px; }
.dow-card .dow-sub { font-size: 11px; color: #6a7080; }

/* ===== Bar chart (CSS-only) ===== */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 180px; padding: 0 4px; margin-bottom: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; border-radius: 3px 3px 0 0; background: #2563eb; min-height: 2px; transition: height .3s; }
.bar-label { font-size: 10px; color: #6a7080; margin-top: 4px; white-space: nowrap; }
.bar-value { font-size: 10px; color: #a0a8b8; margin-bottom: 2px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0f1117; }
::-webkit-scrollbar-thumb { background: #2a2e39; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a4050; }

/* ===== Loading ===== */
.loading { text-align: center; padding: 40px; color: #6a7080; font-size: 14px; }
