* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #1a1a1a;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
#sidebar {
    width: 380px;
    min-width: 380px;
    background: #fff;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 20px;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: #b91c1c;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 13px;
    color: #666;
}

/* Summary stats */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-card {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}

.stat-card .value {
    font-size: 24px;
    font-weight: 700;
    color: #b91c1c;
}

.stat-card .label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Legend */
.legend {
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 14px;
}

.legend h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 10px;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-dot.tier1 {
    background: #dc2626;
}

.legend-density {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.density-bar {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, #fca5a5, #dc2626, #7f1d1d);
}

.density-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #888;
}

/* State cards */
#state-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.state-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.state-card:hover {
    border-color: #b91c1c;
}

.state-card .state-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.state-card .law-cite {
    font-size: 12px;
    color: #b91c1c;
    font-weight: 500;
    margin-bottom: 8px;
}

.state-card .state-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    font-size: 12px;
}

.state-card .state-stats dt {
    color: #888;
}

.state-card .state-stats dd {
    font-weight: 600;
    text-align: right;
}

.state-card .provision {
    font-size: 11px;
    color: #555;
    margin-top: 10px;
    line-height: 1.5;
    border-top: 1px solid #eee;
    padding-top: 8px;
}

/* Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.sidebar-footer p {
    font-size: 10px;
    color: #999;
    line-height: 1.6;
}

/* Map */
#map {
    flex: 1;
    z-index: 1;
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    max-width: 220px;
}

.tooltip.hidden {
    display: none;
}

.tooltip .tt-state {
    font-weight: 700;
    color: #b91c1c;
}

.tooltip .tt-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.tooltip .tt-label {
    color: #888;
}

.tooltip .tt-val {
    font-weight: 600;
}

/* Leaflet overrides */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
}

/* Landing page */
.landing {
    max-width: 1000px;
    margin: 0 auto;
    padding: 48px 24px;
}

.landing-header {
    text-align: center;
    margin-bottom: 40px;
}

.landing-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.landing-subtitle {
    font-size: 15px;
    color: #666;
}

.landing-date {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

/* 4 cards = 2x2 grid, no orphan centering needed */

.evidence-card {
    display: block;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.evidence-card:hover {
    border-color: #b91c1c;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.evidence-card h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
    margin-top: 8px;
}

.card-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
}

.card-badge.critical { background: #dbeafe; color: #1e40af; }
.card-badge.violation { background: #fef2f2; color: #b91c1c; }
.card-badge.info { background: #f3f4f6; color: #4b5563; }

.card-stat {
    font-size: 22px;
    font-weight: 700;
    color: #b91c1c;
    margin: 8px 0;
}

.card-desc {
    font-size: 13px;
    color: #555;
    line-height: 1.6;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.landing-summary {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 24px;
}

.landing-summary h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.landing-summary ol {
    padding-left: 20px;
}

.landing-summary li {
    font-size: 13px;
    line-height: 1.8;
    color: #333;
}

/* Back link */
.back-link {
    font-size: 12px;
    color: #666;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 8px;
}

.back-link:hover { color: #b91c1c; }

/* Date controls */
.date-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-controls h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.date-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.5;
    transition: border-color 0.15s;
}

.date-btn:hover { border-color: #999; }
.date-btn.active { border-width: 2px; background: #fafafa; }

/* Info box */
.info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 14px;
    font-size: 12px;
    line-height: 1.6;
}

.info-box h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

/* Clinic list */
#clinic-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#clinic-list h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.clinic-item {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
}

.clinic-item:hover { background: #f5f3ff; }

.clinic-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clinic-stats {
    font-size: 11px;
    color: #888;
}

/* Type breakdown */
#type-breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#type-breakdown h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.type-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

.type-label {
    font-weight: 600;
    color: #333;
}

.type-count {
    color: #888;
}
