/* Dark is the default theme; [data-theme="light"] on <html> switches to light. */
:root {
    color-scheme: dark;
    --green: #3fae2a;
    --green-dark: #6fcf5b;
    --green-tint: rgba(63, 174, 42, .16);
    --ink: #e8eae8;
    --text-soft: #c4c8c4;
    --muted: #a2a8a2;
    --line: #2d322d;
    --bg: #121412;
    --bg-alt: #191c19;
    --surface: #1f231f;
    --header-bg: rgba(18, 20, 18, .95);
    --nav-ink: rgba(255, 255, 255, .72);
    --image-panel: #e9ece9;
    --cta-bg: #23701a;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 16px 40px rgba(0, 0, 0, .6);
    --max: 1100px;
}

:root[data-theme="light"] {
    color-scheme: light;
    --green-dark: #2b8a1b;
    --green-tint: #eef8ec;
    --ink: #222;
    --text-soft: #555;
    --muted: #666;
    --line: #e6e6e6;
    --bg: #fff;
    --bg-alt: #f7f8f7;
    --surface: #fff;
    --header-bg: rgba(255, 255, 255, .97);
    --nav-ink: rgba(0, 0, 0, .65);
    --image-panel: #f7f8f7;
    --cta-bg: var(--green);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 16px 40px rgba(0, 0, 0, .16);
}

/* Each logo variant only shows in its own theme. */
:root:not([data-theme="light"]) .logo-for-light,
:root[data-theme="light"] .logo-for-dark { display: none; }

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--green-dark); }
a:hover { color: var(--green); }

h1, h2, h3 { line-height: 1.25; font-weight: 600; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

.skip-link { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* Header */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--header-bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .02);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 70px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.brand img { width: 72px; height: auto; }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
    color: var(--nav-ink); text-decoration: none; font-weight: 600; font-size: .92rem;
    padding: 8px 12px; border-radius: 8px;
}
.site-nav a:hover, .site-nav a.active { color: var(--green-dark); background: var(--green-tint); }

/* Theme slider: knob sits on the moon (right) in dark mode, on the sun (left) in light mode. */
.theme-switch {
    position: relative; display: inline-flex; align-items: center; justify-content: space-between;
    width: 58px; height: 30px; padding: 0 7px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--line); background: var(--bg-alt); color: var(--muted); flex-shrink: 0;
}
.theme-switch svg { width: 15px; height: 15px; position: relative; z-index: 1; }
.theme-switch::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--green); transform: translateX(28px); transition: transform .2s ease;
}
.theme-switch[aria-checked="false"]::after { transform: translateX(0); }
.theme-switch[aria-checked="true"] .icon-moon,
.theme-switch[aria-checked="false"] .icon-sun { color: #fff; }
.theme-switch:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.header-logout { display: flex; margin: 0; }
.logout-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0;
    border-radius: 50%; cursor: pointer; border: 1px solid var(--line); background: var(--bg-alt); color: var(--muted); flex-shrink: 0;
}
.logout-btn svg { width: 15px; height: 15px; }
.logout-btn:hover { color: var(--green-dark); background: var(--green-tint); }
.logout-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle .bar { display: block; width: 24px; height: 2px; background: var(--ink); margin: 5px 0; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(4) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 820px) {
    .nav-toggle { display: block; }
    .site-nav {
        display: none; position: absolute; top: 70px; left: 0; right: 0;
        flex-direction: column; align-items: stretch; background: var(--bg);
        border-bottom: 1px solid var(--line); padding: 8px 20px 16px;
    }
    .site-nav.open { display: flex; }
}

/* Sections */
.section { padding: 70px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 40px; }
.section-head p { color: var(--muted); }
.lead { font-size: 1.15rem; color: var(--muted); }

/* Hero */
.hero { text-align: center; padding: 28px 0 32px; }
/* The logo images have empty space above and below the artwork, so crop it off. */
.hero-logo { width: min(690px, 92%); aspect-ratio: 1250 / 480; object-fit: cover; object-position: 50% 44%; margin: 0 auto 8px; }
.hero .tagline { font-size: clamp(1.15rem, 2.4vw, 1.45rem); color: var(--text-soft); margin: 0 0 26px; }

.btn {
    display: inline-block; padding: 12px 26px; border-radius: 999px; font-weight: 600;
    text-decoration: none; border: 2px solid var(--green); cursor: pointer; font: inherit; font-weight: 600;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--green-dark); }
.btn-outline:hover { background: var(--green-tint); }
.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Service cards */
.grid { display: grid; gap: 30px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
    background: var(--surface); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); display: flex; flex-direction: column;
    transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card-img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.card-img.contain { object-fit: contain; padding: 18px; background: var(--image-panel); }
.card-body { padding: 22px 24px 26px; }
.card-body p { margin: 0 0 .6em; color: var(--text-soft); }

/* About */
.about { display: grid; grid-template-columns: 280px 1fr; gap: 48px; align-items: center; }
.about-photo { border-radius: 50%; aspect-ratio: 1; object-fit: cover; width: 280px; box-shadow: var(--shadow); }
.about .role { color: var(--green-dark); font-weight: 600; margin: -6px 0 12px; }
@media (max-width: 760px) {
    .about { grid-template-columns: 1fr; text-align: center; gap: 24px; }
    .about-photo { width: 200px; margin: 0 auto; }
}

.cta-band { background: var(--cta-bg); color: #fff; text-align: center; padding: 56px 0; }
.cta-band h2 { color: #fff; }
.cta-band p { opacity: .92; margin: 0 0 22px; }
.cta-band .btn { background: #fff; color: #2b8a1b; border-color: #fff; }
.cta-band .btn:hover { background: #eef8ec; color: #2b8a1b; }

/* Automated Students */
.as-hero { text-align: center; padding: 60px 0; background: linear-gradient(180deg, var(--green-tint), var(--bg)); }
.as-hero img { width: min(380px, 80%); margin: 0 auto 18px; }
.as-hero .sub { font-size: 1.15rem; color: var(--text-soft); }
/* The black Automated Students logo and white-background screenshots need help on the dark theme. */
:root:not([data-theme="light"]) .as-hero img { filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, .85)) drop-shadow(0 0 22px rgba(255, 255, 255, .12)); }
:root:not([data-theme="light"]) .feature-media img { background: #fff; padding: 12px; border-radius: var(--radius); }
.questions { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 30px; }
.questions li { padding-left: 30px; position: relative; }
.questions li::before { content: "?"; position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: var(--green); color: #fff; font-size: .8rem; font-weight: 700; display: grid; place-items: center; }
@media (max-width: 700px) { .questions { grid-template-columns: 1fr; } }

.feature { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; align-items: center; padding: 50px 0; border-top: 1px solid var(--line); }
.feature:first-of-type { border-top: 0; }
.feature.reverse .feature-media { order: 2; }
.feature-media img { margin: 0 auto; max-height: 260px; object-fit: contain; }
@media (max-width: 760px) {
    .feature { grid-template-columns: 1fr; gap: 24px; }
    .feature.reverse .feature-media { order: 0; }
}

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 4px 0 4px 28px; position: relative; }
.checklist li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 12px; height: 7px; border-left: 2.5px solid var(--green); border-bottom: 2.5px solid var(--green); transform: rotate(-45deg); }

/* Page header */
.page-head { padding: 50px 0 30px; text-align: center; border-bottom: 1px solid var(--line); background: var(--bg-alt); }
.page-head p { color: var(--muted); margin: 0; }
.page-head-compact { padding: 18px 0 14px; }
.page-head-compact h1 { font-size: clamp(1.4rem, 3vw, 1.75rem); margin-bottom: .15em; }

.prose { max-width: 780px; margin: 0 auto; }
.prose h2 { font-size: 1.25rem; margin-top: 1.6em; }

/* Dashboard */
.panel { max-width: 640px; margin: 0 auto; text-align: center; padding: 40px 30px; border-radius: var(--radius); box-shadow: var(--shadow); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 26px 0; font-size: .9rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.footer-inner nav { display: flex; gap: 18px; }
.footer-inner a { color: var(--muted); text-decoration: none; }
.footer-inner a:hover { color: var(--green-dark); }

/* Dashboard sign-in */
.auth-panel { max-width: 420px; text-align: left; }
.form-error { color: #e66767; background: rgba(208, 59, 59, .12); border-radius: 8px; padding: 10px 12px; margin: 0 0 6px; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.btn-google svg { width: 20px; height: 20px; }
.auth-stat { text-align: center; color: var(--muted); margin: 0 0 18px; }
.auth-stat strong { display: block; font-size: 2rem; line-height: 1.2; color: var(--ink); }
.auth-note { color: var(--muted); font-size: .9rem; text-align: center; margin: 14px 0 0; }

/* Dashboard */
.dash { padding-top: 24px; }
.muted { color: var(--muted); }
.dash-district-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-district-picker label { font-weight: 600; }
.dash-district-picker select { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 100%; }
.dash-flash { background: var(--green-tint); color: var(--green-dark); padding: 10px 14px; border-radius: 8px; }
.dash-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 30px; align-items: start; margin-bottom: 30px; }
@media (max-width: 860px) { .dash-top { grid-template-columns: 1fr; } }
.dash-district { margin-bottom: .2em; }
.dash-user { color: var(--text-soft); margin: 0 0 18px; }
.dash-subhead { font-size: 1rem; margin-bottom: 8px; }
.dash-stats { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dash-stats dt { color: var(--muted); }
.dash-stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.dash-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 30px; min-width: 0; }
.dash-card figcaption { font-weight: 600; margin-bottom: 10px; }
.dash-chart { position: relative; height: 260px; }
.dash-chart-doughnut { height: 300px; }
.dash-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; }
@media (max-width: 860px) { .dash-charts { grid-template-columns: 1fr; } }
.dash-chart-card .dash-table-compact { margin-top: 14px; }
.enrollment-caption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.enrollment-hint { font-size: .82rem; text-align: center; margin: 6px 0 0; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; font-size: .88rem; color: var(--green-dark); cursor: pointer; white-space: nowrap; }
.btn-link:hover { text-decoration: underline; }
.btn-link:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
.dash-table .btn-link { font-weight: 400; font-size: inherit; color: inherit; text-align: left; white-space: normal; }
.dash-table .btn-link:hover { color: var(--green-dark); }

.status { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; border: 1px solid currentColor; }
.status-good { color: #0ca30c; }
.status-running { color: #3987e5; }
.status-bad { color: #e66767; }
:root[data-theme="light"] .status-good { color: #077a07; }
:root[data-theme="light"] .status-running { color: #2a78d6; }
:root[data-theme="light"] .status-bad { color: #c03030; }

.tabs .tab-list { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px -8px 16px; padding: 0 4px; }
.tabs [role="tab"] {
    font: inherit; font-weight: 600; font-size: .92rem; color: var(--muted); background: none; border: 0;
    border-bottom: 3px solid transparent; padding: 10px 12px; cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--green); }
.tabs [role="tab"]:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.tabs .count { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 999px; background: var(--bg-alt); color: var(--muted); font-size: .8rem; text-align: center; }
.tab-panel h4 { margin: 18px 0 6px; font-size: 1rem; }

.link-list { list-style: none; padding: 0; margin: 0; columns: 2 220px; column-gap: 30px; }
.link-list li { padding: 3px 0; break-inside: avoid; }
.link-list-faq { margin-top: 16px; }

.setting { padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting:last-of-type { border-bottom: 0; }
.setting-toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.setting-toggle input { width: 20px; height: 20px; accent-color: var(--green); }
.setting-help { margin: 4px 0 0 30px; color: var(--muted); font-size: .9rem; }
.setting-status { margin: 10px 0 0; color: var(--muted); min-height: 1.5em; }

.json-box { position: relative; }
.copy-btn { position: absolute; top: 8px; right: 8px; padding: 4px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.copy-btn:hover { color: var(--green-dark); border-color: var(--green); }
.copy-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.json-view { max-height: 360px; overflow: auto; margin: 0; padding: 14px; border-radius: 8px; background: var(--bg-alt); font-size: .78rem; line-height: 1.45; white-space: pre; }

.dash-block h2 { margin-bottom: .2em; }
.script-search { font: inherit; width: 100%; max-width: 360px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); margin-bottom: 12px; }
.script { padding: 12px 14px; border-radius: 8px; background: var(--bg-alt); margin-bottom: 10px; }
.script h4 { margin: 0; font-size: .98rem; }
.script p { margin: 6px 0 0; color: var(--text-soft); font-size: .92rem; white-space: pre-line; }
.script-path { color: var(--muted); word-break: break-all; }
.script-error { border-left: 3px solid #d03b3b; }

.table-scroll { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.dash-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dash-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dash-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-table-compact td, .dash-table-compact th { padding: 5px 8px; }
.detail-row td { background: var(--bg-alt); max-width: 0; overflow-wrap: anywhere; }
.row-actions { white-space: nowrap; text-align: right; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 6px; }
.icon-btn svg { width: 18px; height: 18px; display: block; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { color: var(--green-dark); background: var(--green-tint); }

.dash-footer-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

/* Users tab and the add-user dialog */
.users-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.users-head p { margin: 0; }
.btn-small { padding: 7px 18px; font-size: .9rem; }
.icon-btn-danger:hover { color: #e66767; background: rgba(208, 59, 59, .12); }
.row-actions form { display: inline; margin: 0; }
.dash-dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); box-shadow: var(--shadow); }
.dash-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dash-dialog form { display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; }
.dash-dialog h3 { margin: 0 0 8px; font-size: 1.15rem; }
.dash-dialog label { font-weight: 600; font-size: .92rem; margin-top: 8px; }
.dash-dialog input { font: inherit; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-alt); color: var(--ink); }
.dash-dialog input:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.dialog-banner { margin: 0 0 4px; padding: 12px 14px; border-radius: 8px; border-left: 4px solid #d9a21b; background: rgba(217, 162, 27, .12); font-size: .9rem; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
