:root {
    --bg: #f4efe6;
    --bg-strong: #e5d7bf;
    --surface: rgba(255, 252, 246, 0.78);
    --surface-strong: #fffaf2;
    --text: #1f2b26;
    --text-soft: #55635d;
    --line: rgba(31, 43, 38, 0.12);
    --brand: #1d6a56;
    --brand-deep: #12493b;
    --accent: #c86c41;
    --shadow: 0 24px 60px rgba(34, 42, 38, 0.12);
    --radius: 22px;
    --radius-sm: 14px;
    --container: 1180px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(200, 108, 65, 0.18), transparent 32%),
        radial-gradient(circle at top right, rgba(29, 106, 86, 0.16), transparent 30%),
        linear-gradient(180deg, #f8f1e6 0%, #f3ece0 45%, #f7f2ea 100%);
    font-family: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

.container {
    width: min(var(--container), calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(14px);
    background: rgba(244, 239, 230, 0.74);
    border-bottom: 1px solid rgba(31, 43, 38, 0.08);
}

.site-header.compact {
    position: static;
}

.nav-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}

.brand-mark {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.top-nav a {
    color: var(--text-soft);
    font-weight: 600;
}

.hero-section {
    padding: 5rem 0 3rem;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
    gap: 2rem;
    align-items: center;
}

.hero-copy h1,
.section-heading h2,
.toolbar h1,
.results-meta h2,
.panel-heading h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.08;
}

.hero-copy h1 {
    font-size: clamp(2.5rem, 4vw, 4.5rem);
    max-width: 11ch;
}

.hero-copy p,
.section-heading p,
.feature-card p,
.helper-text,
.results-meta p,
.empty-state p,
.message-card p,
.setup-success p {
    color: var(--text-soft);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.8rem;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero-actions,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 1.5rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.85rem 1.3rem;
    border-radius: 999px;
    font-weight: 700;
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
    color: #fff;
    box-shadow: 0 16px 34px rgba(18, 73, 59, 0.22);
}

.button-secondary {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(29, 106, 86, 0.16);
    color: var(--brand-deep);
}

.glass-card,
.toolbar,
.results-panel,
.panel-card,
.form-card,
.message-card,
.setup-shell,
.dashboard-grid .glass-card {
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: var(--surface);
    backdrop-filter: blur(16px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 1.6rem;
}

.metric-chip {
    display: inline-flex;
    margin: 0 0.5rem 0.7rem 0;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(29, 106, 86, 0.14);
    color: var(--brand-deep);
    font-size: 0.92rem;
    font-weight: 700;
}

.hero-table-preview {
    margin-top: 1.2rem;
    overflow: hidden;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(31, 43, 38, 0.1);
}

.preview-row {
    display: grid;
    grid-template-columns: 0.45fr 1fr 0.65fr 0.65fr;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.62);
    font-size: 0.95rem;
}

.preview-row + .preview-row {
    border-top: 1px solid rgba(31, 43, 38, 0.08);
}

.preview-head {
    background: rgba(29, 106, 86, 0.92);
    color: #fff;
    font-weight: 700;
}

.feature-section {
    padding: 1rem 0 4rem;
}

.section-heading {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 2rem;
}

.section-heading.left-aligned {
    text-align: left;
    max-width: none;
    margin: 0;
}

.feature-grid,
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.2rem;
}

.feature-card,
.panel-card {
    padding: 1.4rem;
}

.feature-card h3,
.empty-state h3,
.form-card h2,
.panel-card h2,
.setup-success h2,
.message-card h3 {
    margin-top: 0;
    font-family: Georgia, "Times New Roman", serif;
}

.app-shell,
.admin-shell,
.setup-page {
    padding: 2rem 0 3rem;
}

.toolbar,
.results-panel,
.form-card,
.panel-card,
.setup-shell {
    padding: 1.4rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.field-group span {
    font-weight: 700;
}

select,
input[type="text"],
input[type="password"],
input[type="search"],
input[type="file"] {
    width: 100%;
    min-height: 48px;
    padding: 0.8rem 0.95rem;
    border-radius: 14px;
    border: 1px solid rgba(31, 43, 38, 0.15);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font: inherit;
}

select:focus,
input:focus {
    outline: 2px solid rgba(29, 106, 86, 0.24);
    border-color: rgba(29, 106, 86, 0.4);
}

.helper-text {
    margin-bottom: 0;
}

.results-panel {
    margin-top: 1.4rem;
}

.results-meta {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.table-wrap {
    overflow-x: auto;
}

.rate-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 18px;
    background: var(--surface-strong);
}

.rate-table th,
.rate-table td {
    padding: 0.95rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.rate-table th {
    background: rgba(29, 106, 86, 0.9);
    color: #fff;
    font-size: 0.92rem;
    white-space: nowrap;
}

.rate-table tbody tr:nth-child(even) {
    background: rgba(29, 106, 86, 0.04);
}

.rate-table td small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-soft);
}

.empty-state,
.message-card,
.setup-success {
    padding: 1.5rem;
    text-align: center;
}

.loading-strip {
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--brand), transparent);
    background-size: 200% 100%;
    animation: loadingShift 1.2s linear infinite;
}

.admin-shell {
    display: grid;
    gap: 1.2rem;
}

.dashboard-grid {
    align-items: start;
}

.stats-list,
.district-reference {
    display: grid;
    gap: 0.85rem;
}

.stat-line,
.district-reference li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px dashed rgba(31, 43, 38, 0.12);
}

.district-reference {
    list-style: none;
    padding: 0;
    margin: 0;
}

.message-card.success {
    background: rgba(239, 255, 248, 0.85);
}

.message-card.error {
    background: rgba(255, 242, 239, 0.9);
}

.setup-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.setup-shell {
    width: min(720px, calc(100% - 2rem));
}

.setup-grid,
.login-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.span-2 {
    grid-column: span 2;
}

.note-box,
.alert-box {
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-soft);
}

.alert-box {
    background: rgba(255, 243, 238, 0.88);
    color: #8a4022;
}

.muted-link {
    color: var(--brand);
    font-weight: 700;
}

@keyframes loadingShift {
    from {
        background-position: 200% 0;
    }
    to {
        background-position: -200% 0;
    }
}

@media (max-width: 960px) {
    .hero-grid,
    .feature-grid,
    .dashboard-grid,
    .filter-grid,
    .setup-grid,
    .login-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

    .results-meta {
        align-items: start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .hero-section {
        padding-top: 3.5rem;
    }

    .nav-shell,
    .top-nav,
    .hero-actions,
    .button-row {
        flex-direction: column;
        align-items: stretch;
    }

    .button {
        width: 100%;
    }

    .container {
        width: min(var(--container), calc(100% - 1rem));
    }
}
