:root {
    --primary: #800080;
    --accent: #A020F0;
    --background: #FFFFFF;
    --text: #333333;
    --error: #FF0000;
    --light-bg: #F5F5F5;
    /* New theme tokens */
    --bg: #f7f7fb;
    --panel: #ffffff;
    --card: #ffffff;
    --muted: #6b7280;
    --brand: #800080;
    --danger: #ef4444;
    --warn: #f59e0b;
    --ok: #10b981;
    --radius: 10px;
    --font: 'Poppins', sans-serif;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #f5f5ff 0%, #ffffff 100%);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

header {
    background: linear-gradient(90deg, var(--brand), #9a1dd8);
    color: var(--background);
    padding: 0.75rem 0;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

.logo {
    width: 56px;
    height: auto;
    margin-bottom: 0.25rem;
    border-radius: 10px;
    vertical-align: middle;
}
header h1 { display: inline-block; vertical-align: middle; margin-left: 12px; }

h1, h2, h3 {
    margin: 0;
    font-weight: 600;
}

.logout, .back {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    color: var(--background);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.logout:hover, .back:hover {
    color: var(--accent);
}

.back {
    left: 1.5rem;
    right: auto;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    background: var(--background);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

form {
    display: flex;
    flex-direction: column;
}

input {
    margin: 0.5rem 0;
    padding: 0.75rem;
    border: 1px solid var(--primary);
    border-radius: 5px;
    font-size: 1rem;
}

select {
    padding: 0.45rem 0.9rem;
    padding-right: 2rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 0.95rem;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12"><path d="M2 4l4 4 4-4" stroke="%23777" fill="none" stroke-width="2"/></svg>');
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 12px;
}

button {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: var(--primary);
    color: var(--background);
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

button:hover {
    background-color: var(--accent);
    transform: translateY(-2px);
}

.error {
    color: var(--error);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem 1.25rem;
}

.card {
    background: linear-gradient(135deg, #faf7ff 0%, #f5e9ff 100%);
    padding: 1.5rem 1.5rem 1.25rem 1.5rem;
    text-align: left;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(128,0,128,0.10), 0 1.5px 8px rgba(160,32,240,0.08);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
    position: relative;
}

.card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 12px 32px rgba(128,0,128,0.18), 0 2px 12px rgba(160,32,240,0.12);
    background: linear-gradient(135deg, #f5e9ff 0%, #faf7ff 100%);
}

.card i {
    color: var(--primary);
    margin-bottom: 0.25rem;
}

/* Dashboard tile enhancements */
.card .icon-circle { width:38px; height:38px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; background: rgba(128,0,128,0.08); color: var(--brand); }
/* Add a subtle icon animation */
.card:hover .icon-circle {
    background: linear-gradient(135deg, #a020f0 0%, #f5e9ff 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(160,32,240,0.12);
    transform: scale(1.12) rotate(-8deg);
    transition: all 0.3s;
}
.card h3 { margin: 6px 0 4px 0; }
/* Add a highlight bar under the title */
.card h3::after {
    content: '';
    display: block;
    width: 32px;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    border-radius: 2px;
    margin-top: 6px;
}
.card .meta { color: var(--muted); font-size: .9rem; }
.card .value { font-size: 1.4rem; font-weight: 600; }
.card { border-left: 6px solid var(--brand); }

.search-container {
    margin-bottom: 1rem;
}

#searchInput {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--primary);
    border-radius: 5px;
    font-size: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--background);
    border-radius: 10px;
    overflow: hidden;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.topbar-pro { background: linear-gradient(90deg, var(--brand), #9a1dd8); color:#fff; padding: 12px 0; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.topbar-pro .inner { display:flex; align-items:center; gap:12px; }
.topbar-pro .filters { margin-left:auto; display:flex; gap:8px; }

.view-spacing { padding-top: 16px; padding-bottom: 32px; }
.tiles-lg { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 20px; }
.tile { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }

/* Horizontal KPI card layout */
.tile.row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.tile .k-label { color: var(--muted); font-weight:500; }
.tile .k-value { font-size: 1.6rem; font-weight: 600; }

/* Dashboard hero and chips */
.hero {
    background: linear-gradient(90deg, rgba(154,29,216,.1), rgba(128,0,128,.05));
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    margin-bottom: 16px;
}
.chips { display:flex; flex-wrap:wrap; gap:10px; margin: 16px 0; }
.chip { background:#fff; border:1px solid #e9e5ff; color:#5130a6; border-radius:999px; padding:6px 12px; cursor:pointer; box-shadow:0 1px 4px rgba(0,0,0,.05); }
.chip:hover { background:#faf7ff; }
/* Population view hero KPI header */
.hero-kpi {
    background:#fff;
    border:1px solid var(--border, #e5e7eb);
    border-radius:14px;
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
    padding:16px 20px;
    margin: 0 0 20px 0;   /* space below header card */
}
.hero-kpi .kicker {
    font-weight: 800;
    font-size: 18px;
    line-height: 1.35;
    margin: 0;
}
.hero-kpi .brand-accent {
    color: var(--brand, #800080);
}
.hero-kpi .kicker-sub {
    margin: 6px 0 0 0;
    color: #444;
    font-size: 14px;
}

th, td {
    padding: 1rem;
    text-align: left;
}

th {
    background-color: var(--primary);
    color: var(--background);
    cursor: pointer;
}

th i {
    margin-left: 0.5rem;
}

tr:nth-child(even) {
    background-color: var(--light-bg);
}

tr:hover {
    background-color: rgba(160, 32, 240, 0.1);
}

@media (max-width: 600px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    th, td {
        padding: 0.5rem;
    }
}
