/*
 * Church360 admin styles.
 *
 * Hand-written plain CSS, served straight from public/ with no build step. There
 * is no Node/npm on this host, so Tailwind (which Breeze would normally compile)
 * is not an option — and a CDN build would add a network dependency to an internal
 * admin tool. Sprint 1's UI exists to click through the schema, so this is
 * deliberately functional rather than designed.
 *
 * Brand colours come from the organization's resolved branding via CSS custom
 * properties set in the layout, so the inheritance built in Sprint 0 is visible
 * here rather than only in API responses.
 */

:root {
    --brand-primary: #1f2937;
    --brand-secondary: #6b7280;
    --bg: #f7f7f8;
    --surface: #ffffff;
    --border: #dcdfe4;
    --text: #1a1d21;
    --muted: #6b7280;
    --danger: #b42318;
    --success: #067647;
    --radius: 6px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--brand-font, system-ui), system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

/* ---- Layout ---------------------------------------------------------- */

header.topbar {
    background: var(--brand-primary);
    color: #fff;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

header.topbar .brand {
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

header.topbar .brand img { height: 24px; width: auto; border-radius: 4px; }

header.topbar nav { display: flex; gap: 1rem; flex-wrap: wrap; }
header.topbar nav a { color: #fff; text-decoration: none; opacity: 0.85; }
header.topbar nav a:hover, header.topbar nav a[aria-current="page"] { opacity: 1; text-decoration: underline; }

header.topbar .spacer { margin-left: auto; }
header.topbar .whoami { font-size: 0.85rem; opacity: 0.9; text-align: right; }

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

h1 { font-size: 1.4rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 0.5rem; }
.subtitle { color: var(--muted); margin: 0 0 1.25rem; font-size: 0.9rem; }

/* ---- Cards & tables -------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    min-width: 150px;
    flex: 1;
}
.stat .value { font-size: 1.6rem; font-weight: 600; color: var(--brand-primary); }
.stat .label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); }
th { background: #f0f1f3; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tbody tr:hover { background: #fafbfc; }
td.actions { white-space: nowrap; text-align: right; }

.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

.empty { padding: 2rem; text-align: center; color: var(--muted); background: var(--surface); }

/* ---- Forms ----------------------------------------------------------- */

form.stack { display: grid; gap: 0.9rem; max-width: 560px; }
form.inline { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-end; }
form.inline-block { display: inline; }

label { display: block; font-weight: 500; margin-bottom: 0.25rem; font-size: 0.9rem; }
label .hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; }

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=date], input[type=search], select, textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    background: #fff;
}
textarea { min-height: 90px; resize: vertical; }

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--brand-secondary);
    outline-offset: 1px;
    border-color: var(--brand-secondary);
}

.btn {
    display: inline-block;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--brand-primary);
    background: var(--brand-primary);
    color: #fff;
    border-radius: var(--radius);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { filter: brightness(1.15); }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { padding: 0.3rem 0.55rem; font-size: 0.85rem; }

.actions-row { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.4rem; }

/* ---- Feedback -------------------------------------------------------- */

.alert { padding: 0.7rem 0.9rem; border-radius: var(--radius); margin-bottom: 1.1rem; border: 1px solid; }
.alert.success { background: #ecfdf3; border-color: #abefc6; color: var(--success); }
.alert.error { background: #fef3f2; border-color: #fecdc9; color: var(--danger); }

.field-error { color: var(--danger); font-size: 0.83rem; margin-top: 0.2rem; }

.badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: #eef0f3;
    color: var(--muted);
    border: 1px solid var(--border);
}
.badge.leader { background: #eef4ff; color: #2d4fa2; border-color: #c7d7fe; }
.badge.terminal { background: #fef3f2; color: var(--danger); border-color: #fecdc9; }
.badge.active { background: #ecfdf3; color: var(--success); border-color: #abefc6; }

/* ---- Login ----------------------------------------------------------- */

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { text-align: center; margin-bottom: 1.25rem; }

/* ---- Pagination ------------------------------------------------------ */

.pagination-wrap { margin-top: 1rem; }
.pagination-wrap svg { width: 1rem; height: 1rem; vertical-align: middle; }
