:root {
    --brand: #2c5f8a;
    --brand-dark: #1e4363;
    --bg: #f7f8fa;
    --card-bg: #ffffff;
    --border: #dde2e8;
    --text: #262b33;
    --muted: #6b7280;
    --danger: #b3261e;
    --success: #1e6b3a;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--brand); }

img { max-width: 100%; }

/* ---------- Alerts ---------- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin: 1rem 0;
}
.alert-success { background: #e6f4ea; color: var(--success); border: 1px solid #b7dfc4; }
.alert-error { background: #fbe9e7; color: var(--danger); border: 1px solid #f2b8b5; }
.alert ul { margin: 0; padding-left: 1.2rem; }

/* ---------- Auth pages ---------- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.auth-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 360px;
}
.auth-box h1 { margin-top: 0; font-size: 1.3rem; }
.auth-box h2 { margin-top: 0; font-size: 1rem; color: var(--muted); font-weight: 500; }
.auth-box label { display: block; margin-bottom: 1rem; font-size: 0.9rem; }
.auth-box input {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.55rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}
.auth-box button, form.entry-form button, .button {
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.auth-box button:hover, form.entry-form button:hover, .button:hover { background: var(--brand-dark); }

/* ---------- Admin nav ---------- */
/* Spacing in the flex rows below is done with margins on children rather
   than the flexbox `gap` property. Flexbox gap wasn't supported until
   Chrome 84 (mid-2020) — on an older bundled browser (e.g. Chromium 79,
   seen on some Android-based interactive displays) it's silently
   dropped and every item collapses flush against its neighbor with no
   spacing at all. Margins work identically on any version. Grid gap
   (used on .dash-grid below) doesn't have this problem and is left
   as-is. */
.admin-nav {
    background: var(--brand-dark);
    color: #fff;
    padding: 0.75rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.admin-nav > * { margin: 0 1.5rem 1rem 0; }
.admin-nav a { color: #fff; text-decoration: none; }
.admin-nav a:hover { text-decoration: underline; }
.admin-nav-brand a { font-weight: 700; font-size: 1.05rem; }
.admin-nav-links { list-style: none; display: flex; flex-wrap: wrap; margin: 0; padding: 0; }
.admin-nav-links > li { margin: 0 1rem 0.25rem 0; }
.admin-nav-user { margin-left: auto; font-size: 0.9rem; opacity: 0.9; }

.admin-main { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

/* ---------- Dashboard ---------- */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.dash-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    text-decoration: none;
    color: var(--text);
}
.dash-card:hover { border-color: var(--brand); }
.dash-count { display: block; font-size: 1.8rem; font-weight: 700; color: var(--brand); }
.dash-label { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.9rem; }

/* ---------- Admin tables ---------- */
.admin-table { width: 100%; border-collapse: collapse; background: var(--card-bg); margin-top: 1rem; }
.admin-table th, .admin-table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    font-size: 0.92rem;
}
.admin-table th { background: #eef1f5; }
.row-actions { white-space: nowrap; }
.inline-form { display: inline; }
.link-danger { background: none; border: none; color: var(--danger); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

/* Sortable column headers on admin list views (admin/entry.php). */
.admin-table th a.sortable-col {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
}
.admin-table th a.sortable-col:hover { text-decoration: underline; }
.admin-table th a.sortable-col.sorted-asc,
.admin-table th a.sortable-col.sorted-desc { color: var(--brand); }
.admin-table th a.sortable-col .sort-arrow { margin-left: 0.35rem; font-size: 0.7em; }

/* "Find by date" lookup above an admin list view. */
.admin-date-lookup { display: flex; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.admin-date-lookup > * { margin-right: 0.6rem; margin-bottom: 0.4rem; }
.admin-date-lookup > *:last-child { margin-right: 0; }
.admin-date-lookup label { font-weight: 600; font-size: 0.9rem; }
.admin-date-lookup input[type=text] {
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
    width: 9.5rem;
}
.admin-date-lookup button {
    padding: 0.45rem 0.9rem;
    border: none;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    font: inherit;
}
.admin-date-lookup button:hover { background: var(--brand-dark); }
.admin-date-clear { font-size: 0.9rem; }

.pagination { margin-top: 1rem; display: flex; }
.pagination > * { margin-right: 0.4rem; }
.pagination > *:last-child { margin-right: 0; }
.pagination a { padding: 0.3rem 0.65rem; border: 1px solid var(--border); border-radius: 4px; text-decoration: none; }
.pagination a.current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Entry form ---------- */
.entry-form { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-top: 1rem; }
.entry-form .field { display: block; margin-bottom: 1.1rem; font-weight: 600; font-size: 0.9rem; }
.entry-form input[type=text], .entry-form input[type=number], .entry-form input[type=file], .entry-form textarea, .entry-form select {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
    font-weight: 400;
}
.entry-form textarea { min-height: 4rem; }
.image-preview img { max-height: 160px; display: block; margin-bottom: 0.5rem; border-radius: 4px; }
.form-actions { display: flex; align-items: center; margin-top: 1rem; }
.form-actions > * { margin-right: 1rem; }
.form-actions > *:last-child { margin-right: 0; }

/* ---------- Public agenda ---------- */
.site-header {
    background: var(--brand-dark);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.site-header a { color: #fff; text-decoration: none; }
.site-header h1 { margin: 0; font-size: 1.3rem; }
.site-header-links { display: flex; align-items: center; }
.site-header-links > * { margin-right: 1.25rem; }
.site-header-links > *:last-child { margin-right: 0; }
.admin-link { font-size: 0.9rem; opacity: 0.85; }

.date-bar {
    max-width: 700px;
    margin: 1.5rem auto 0;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}
.date-bar > * { margin: 0 0.5rem 0.5rem; }
.date-form { display: flex; }
.date-form > * { margin-right: 0.4rem; }
.date-form > *:last-child { margin-right: 0; }
.date-form input {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    width: 140px;
}
.date-form button {
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}
.nav-arrow { text-decoration: none; font-size: 0.95rem; white-space: nowrap; }

.date-shortcuts { text-align: center; margin-top: 0.5rem; font-size: 0.9rem; }

.agenda { max-width: 700px; margin: 1.5rem auto 3rem; padding: 0 1.25rem; }
.agenda-date { text-align: center; color: var(--muted); font-weight: 500; margin-bottom: 1.5rem; }

.agenda-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}
.agenda-section h3 { margin-top: 0; color: var(--brand-dark); }
.rich-content img { border-radius: 4px; }
.entry-image { margin-top: 0.75rem; border-radius: 4px; max-height: 320px; }
.launch-quote { margin: 0; font-style: italic; font-size: 1.1rem; }
.launch-quote footer { margin-top: 0.5rem; font-style: normal; color: var(--muted); font-size: 0.9rem; }
.due-date { font-size: 0.85rem; color: var(--muted); }
.standards-list { margin: 0; padding-left: 1.2rem; }
.no-content { text-align: center; color: var(--muted); margin-top: 3rem; }

/* ---------- Captioned / aligned images from the editor ----------
   The editor wraps a captioned image in <figure class="image"> with an
   optional align-left / align-center / align-right class. */
.rich-content figure { display: table; max-width: 100%; margin: 1rem 0; }
.rich-content figure img { display: block; max-width: 100%; }
.rich-content figcaption { display: table-caption; caption-side: bottom; padding-top: 0.4rem;
    font-size: 0.85em; opacity: 0.8; text-align: center; }
.rich-content figure.align-left { float: left; margin: 0.25rem 1.25rem 0.75rem 0; }
.rich-content figure.align-right { float: right; margin: 0.25rem 0 0.75rem 1.25rem; }
.rich-content figure.align-center { margin-left: auto; margin-right: auto; }
.rich-content::after { content: ""; display: block; clear: both; }
