:root {
    --primary-color: #EE9B00;
    --primary-dark: #c27d00;
    --secondary-color: #5C4D3C;
    --body-bg: #F7F5F0;
    --card-bg: #FFFFFF;
    --text-color: #3D3D3D;
    --light-text: #7a7a7a;
    
    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #FF5252;

    --border-radius: 12px;
    --shadow: 0 10px 25px rgba(0,0,0,0.06);
    --line: rgba(92, 77, 60, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(238, 155, 0, 0.12), transparent 28%),
        linear-gradient(180deg, #fcfbf8 0%, var(--body-bg) 100%);
    color: var(--text-color);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    backdrop-filter: blur(16px);
    background: rgba(247, 245, 240, 0.94);
    border-bottom: 1px solid var(--line);
}

.header-inner,
.footer-inner {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.header-inner {
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}

.logo-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff8f0;
    box-shadow: 0 14px 28px rgba(238, 155, 0, 0.18);
    flex: 0 0 auto;
}

.logo-mark svg {
    width: 28px;
    height: 28px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-kicker,
.nav-link,
.footer-note {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.brand-kicker {
    margin: 0;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 700;
}

.brand-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    font-family: Georgia, "Times New Roman", serif;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-link {
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--secondary-color);
    border: 1px solid transparent;
    transition: 0.25s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    border-color: rgba(92, 77, 60, 0.14);
    background: rgba(255, 250, 244, 0.86);
}

.nav-link.active {
    background: var(--primary-color);
    color: #fffaf4;
    box-shadow: 0 12px 24px rgba(238, 155, 0, 0.22);
}

.dashboard-shell {
    width: min(1200px, calc(100% - 20px));
    margin: 22px auto;
    background: var(--card-bg);
    border-radius: 24px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.page-intro {
    padding: 25px;
    background: var(--secondary-color);
    color: var(--body-bg);
    text-align: center;
    box-shadow: var(--shadow);
    border-bottom: 5px solid var(--primary-color);
}

.page-intro h1 {
    margin: 0;
    color: var(--body-bg);
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 0.98;
    font-family: Georgia, "Times New Roman", serif;
}

.filter-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) 160px;
    gap: 16px;
    align-items: end;
    padding: 14px;
    background: #f3eee6;
    border-bottom: 1px solid rgba(92, 77, 60, 0.08);
}

.filter-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.92rem;
    color: var(--secondary-color);
}

.filter-group select,
.filter-actions button {
    width: 100%;
    height: 40px;
    border: 1px solid rgba(92, 77, 60, 0.14);
    background: #fff;
    color: var(--text-color);
    font: inherit;
    border-radius: 8px;
    padding: 0 12px;
}

.filter-actions button {
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--primary-color);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(238, 155, 0, 0.2);
}

.filter-actions button:hover {
    background: var(--primary-dark);
}

.hero-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    padding: 18px 14px 14px;
}

.stats-panel,
.chart-panel,
.notes-panel {
    background: transparent;
    min-width: 0;
}

.large-panel {
    grid-column: auto;
}

.bottom-grid-trend .large-panel {
    grid-column: 1 / -1;
}

.hero-metric strong,
.feature-metric strong,
.detail-metrics strong {
    display: block;
    line-height: 1;
}

.hero-metric {
    margin-bottom: 10px;
}

.hero-metric strong {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 800;
    color: var(--secondary-color);
}

.hero-metric span {
    display: block;
    margin-top: 6px;
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.feature-metric {
    background: var(--secondary-color);
    color: #fff;
    padding: 12px 12px 6px;
    margin-bottom: 4px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.feature-metric strong {
    font-size: 2rem;
    font-weight: 800;
}

.feature-metric span {
    display: block;
    margin-top: 4px;
    font-size: 0.95rem;
    font-weight: 700;
}

.detail-metrics {
    background: #8d7b67;
    color: #fff;
    padding: 12px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.detail-metrics div + div {
    margin-top: 10px;
}

.detail-metrics strong {
    font-size: 1.2rem;
    font-weight: 800;
}

.detail-metrics span {
    display: block;
    margin-top: 2px;
    font-size: 0.95rem;
    font-weight: 700;
}

.panel-header {
    display: flex;
    justify-content: center;
    gap: 12px;
    align-items: end;
    margin-bottom: 12px;
    text-align: center;
}

.panel-header > div:first-child {
    flex: 1;
    text-align: center;
}

.panel-kicker {
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    font-weight: 700;
    margin: 0;
}

.panel-question {
    margin: 8px 0 0;
    color: var(--light-text);
    font-size: 0.94rem;
    line-height: 1.55;
}

.panel-header h2,
.notes-panel h3 {
    margin: 0;
    color: var(--secondary-color);
    font-family: Georgia, "Times New Roman", serif;
}

.panel-header h2 {
    font-size: clamp(1.35rem, 2.2vw, 2rem);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.panel-header > div {
    width: 100%;
}

.notes-panel {
    color: var(--secondary-color);
    font-size: 1.05rem;
    line-height: 1.5;
}

.notes-panel p {
    margin: 14px 0 0;
    color: var(--secondary-color);
    font-weight: 600;
}

.notes-panel strong {
    font-weight: 800;
}

.notes-panel h3 {
    font-size: 2rem;
    color: var(--secondary-color);
}

.chart-container {
    width: 100%;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.chart-is-updating {
    opacity: 0.7;
    transform: translateY(4px);
}

.chart-large {
    min-height: 400px;
}

.chart-medium {
    min-height: 350px;
}

.bottom-grid {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
    padding: 0 14px 18px;
}

.bottom-grid-trend {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    padding: 0 14px 18px;
} 

#chart3 svg,
#chart1 svg,
#chart2 svg,
#map svg {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.toggle-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    width: fit-content;
    flex-shrink: 0;
}

.line-camera { 
    fill: none; 
    stroke: var(--primary-color); 
    stroke-width: 3.5px; 
    stroke-linecap: round;
}

.line-police { 
    fill: none; 
    stroke: var(--secondary-color); 
    stroke-width: 3.5px; 
    stroke-linecap: round;
}

.dot {
    stroke-width: 2px;
    fill: white; 
    cursor: pointer;
    transition: r 0.1s ease-out, stroke-width 0.1s ease-out; 
}

.dot-camera { stroke: #3D3D3D }
.dot-police { stroke: var(--secondary-color); }

.dot:hover {
    r: 7px; 
    stroke-width: 3px;
}

.tooltip {
    position: absolute;
    visibility: hidden; 
    min-width: 150px;
    background: rgba(43, 43, 43, 0.95);
    color: var(--body-bg); 
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    pointer-events: none; 
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip-header {
    font-weight: bold;
    color: var(--primary-color); 
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 3px;
}

.tooltip-body strong {
    font-size: 1.1rem;
    color: var(--success); 
}

.chart-header-inline {
    display: none;
}

.map-header {
    display: none;
}

.toggle-group {
    display: flex;
    gap: 5px;
    background: #eae3db;
    padding: 4px;
    border-radius: 8px;
}

.toggle-btn {
    border: none;
    background: transparent;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    color: var(--light-text);
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.toggle-btn:hover {
    color: var(--text-color);
}

.toggle-btn.active[data-view="All"] { 
    background: white; 
    color: var(--text-color); 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
}
.toggle-btn.active[data-view="Camera Issued"] { 
    background: var(--primary-color); 
    color: white; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); 
}
.toggle-btn.active[data-view="Police Issued"] { 
    background: var(--secondary-color); 
    color: white; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); 
}

.state {
    stroke: #ffffff; 
    stroke-width: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.state:hover {
    stroke: #000000;
    stroke-width: 2.5px;
}

.state.active {
    fill: var(--primary-color); 
    stroke: var(--secondary-color); 
    stroke-width: 2.5px;
    filter: drop-shadow(0px 4px 8px rgba(238, 155, 0, 0.4));
}

#map-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#map {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 480px;
}

.extra-filters {
    display: none;
}

.filter-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-item label {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--secondary-color); 
    text-transform: uppercase;
}

.filter-item select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background-color: white;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.filter-item select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(238, 155, 0, 0.2);
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eae3db;
    margin-bottom: 10px;
    padding-bottom: 5px;
}

.map-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}

.site-footer {
    margin-top: 26px;
    background: var(--primary-dark);
    color: #fffaf4;
}

.footer-inner {
    padding: 24px 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.footer-title {
    margin: 0 0 6px;
    font-size: 1.04rem;
    font-family: Georgia, "Times New Roman", serif;
}

.footer-note {
    color: rgb(255, 255, 255);
    line-height: 1.7;
}

@media (max-width: 980px) {
    .filter-bar {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .hero-grid {
        grid-template-columns: 1fr;
    }

    .bottom-grid {
        grid-template-columns: 1fr;
    }

    .bottom-grid-trend {
        grid-template-columns: 1fr 1fr;
    }

    .bottom-grid .notes-panel {
        grid-column: 1 / -1;
    }

    .chart-header-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .toggle-group {
        flex-wrap: wrap;
        width: fit-content;
    }

    .toggle-btn {
        padding: 8px 16px;
        text-align: center;
    }

    .extra-filters {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 640px) {
    .filter-bar {
        grid-template-columns: 1fr;
    }

    .dashboard-shell {
        width: calc(100% - 20px);
        margin: 16px auto;
        border-radius: 16px;
    }

    .page-intro {
        padding: 20px;
    }

    .page-intro h1 {
        font-size: 1.8rem;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        padding: 14px 10px 10px;
    }

    .bottom-grid {
        grid-template-columns: 1fr;
        padding: 0 10px 14px;
    }

    .bottom-grid-trend {
        grid-template-columns: 1fr;
        padding: 0 10px 14px;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .toggle-group {
        padding: 3px;
    }

    .toggle-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

.title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chart-desc {
    font-size: 1; 
    color: var(--light-text); 
    font-weight: 400;
    font-style: italic; 
    margin-bottom: 0;
}

h2 + .chart-desc {
    margin-top: 10px;
}
