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

:root {
    --bg: #f4f6fa;
    --text: #222;
    --card: #fff;
    --shadow: rgba(0, 0, 0, 0.06);
    --label: #555;
}

body.dark {
    --bg: #121212;
    --text: #eee;
    --card: #1e1e1e;
    --shadow: rgba(0, 0, 0, 0.3);
    --label: #aaa;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    padding: 2rem;
    line-height: 1.5;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 2rem;
}

.stat {
    background: var(--card);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 2px 5px var(--shadow);
}

.stat label {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    color: var(--label);
}

.stat span {
    font-weight: 400;
    color: var(--text);
}

.charts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
}

.chart {
    position: relative;
    background: var(--card);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 3px 8px var(--shadow);
}

#donut-tooltip {
    position: absolute;
    display: none;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 14px;
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.75);
    color: white;
}

body.dark #donut-tooltip {
    background: rgba(255, 255, 255, 0.95);
    color: #111;
}

.toggle-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
    position: absolute;
    top: 10px; /* Position from the top */
    right: 10px; /* Position from the right */
    z-index: 20; /* Make sure it’s above other elements */
}

.toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 28px;
    margin-right: 10px;
}

.toggle input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    border-radius: 34px;
    transition: 0.3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px; width: 20px;
    left: 4px; bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(32px);
}

.label-text {
    font-size: 0.9rem;
    vertical-align: middle;
    color: var(--text);
}
