/* Al-Aman Sunday School theme — matches ismcss.org
   Fonts: Inter (body) + DM Serif Display (headings)
   Palette: emerald primary, gold secondary, soft green surfaces */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=DM+Serif+Display&display=swap");

:root {
  --background: hsl(150 20% 97%);
  --foreground: hsl(160 40% 8%);
  --card: hsl(0 0% 100%);
  --primary: hsl(158 55% 42%);
  --primary-fg: hsl(0 0% 100%);
  --secondary: hsl(46 85% 58%);          /* gold */
  --secondary-fg: hsl(40 50% 15%);
  --muted: hsl(150 15% 92%);
  --muted-fg: hsl(160 10% 45%);
  --accent: hsl(158 35% 90%);
  --accent-fg: hsl(158 55% 28%);
  --destructive: hsl(0 72% 55%);
  --border: hsl(150 15% 88%);
  --radius: 1rem;
  --green-dark: hsl(158 55% 28%);
  --green-light: hsl(158 35% 92%);
  --gold-light: hsl(46 70% 78%);
  --gradient-hero: linear-gradient(135deg, hsl(158 55% 42%), hsl(170 50% 35%), hsl(145 45% 48%));
  --gradient-gold: linear-gradient(135deg, hsl(46 85% 58%), hsl(38 80% 52%));
  --gradient-mesh: radial-gradient(ellipse at 20% 50%, hsl(158 55% 42% / .15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, hsl(46 85% 58% / .12) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, hsl(170 50% 35% / .1) 0%, transparent 50%);
  --shadow-card: 0 2px 12px hsl(158 40% 20% / .08);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--background); color: var(--foreground);
  font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.95rem; line-height: 1.45;
}
h1, h2, .brand { font-family: "DM Serif Display", Georgia, serif; font-weight: 400; letter-spacing: 0.01em; }
h1 { font-size: 1.7rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.2rem; margin-top: 0; }
main { max-width: 1100px; margin: 1.8rem auto; padding: 0 1.2rem; }
a { color: var(--accent-fg); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top navigation ─────────────────────────────── */
.topnav {
  display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
  background: var(--gradient-hero); color: #fff;
  padding: 0.7rem 1.4rem; box-shadow: var(--shadow-card);
  position: sticky; top: 0; z-index: 50;
}
.topnav .brand { color: #fff; font-size: 1.25rem; text-decoration: none; }
.topnav .brand:hover { text-decoration: none; }
.topnav .links { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.topnav .links a {
  color: hsl(158 35% 92% / .9); padding: 0.3rem 0.75rem; border-radius: 999px;
  font-size: 0.9rem; font-weight: 500;
}
.topnav .links a:hover { background: hsl(0 0% 100% / .12); text-decoration: none; color: #fff; }
.topnav a.accent {
  background: var(--gradient-gold); color: var(--secondary-fg);
  font-weight: 700; box-shadow: 0 1px 6px hsl(40 50% 15% / .25);
}
.topnav .right { margin-left: auto; display: flex; gap: 0.9rem; align-items: center; color: hsl(158 35% 92% / .75); font-size: 0.88rem; }
.topnav .right a { color: #fff; }

/* ── Stat cards ─────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow-card);
}
.stat .num {
  font-family: "DM Serif Display", Georgia, serif; font-size: 2rem;
  background: var(--gradient-hero); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .lbl { color: var(--muted-fg); font-size: 0.82rem; margin-top: 0.1rem; }

/* ── Tables ─────────────────────────────────────── */
table {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-card);
}
th, td { text-align: left; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { background: var(--green-light); font-weight: 600; color: var(--accent-fg); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: hsl(158 35% 92% / .4); }

/* ── Pills ──────────────────────────────────────── */
.pill {
  display: inline-block; padding: 0.12rem 0.6rem; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600;
  background: var(--green-light); color: var(--accent-fg);
}
.pill.gold { background: hsl(46 85% 58% / .2); color: hsl(40 50% 25%); }
.pill.red { background: hsl(0 72% 55% / .12); color: hsl(0 72% 38%); }
.pill.gray { background: hsl(150 10% 90%); color: var(--muted-fg); }

/* ── Buttons & inputs ───────────────────────────── */
.btn, button, input[type=submit] {
  background: var(--primary); color: var(--primary-fg); border: none;
  padding: 0.5rem 1.1rem; border-radius: 999px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: filter .15s ease;
}
.btn:hover, button:hover, input[type=submit]:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: var(--green-light); color: var(--accent-fg); }
.btn.gold { background: var(--gradient-gold); color: var(--secondary-fg); }
.btn.danger { background: var(--destructive); }
input, select, textarea {
  padding: 0.45rem 0.7rem; border: 1px solid var(--border); border-radius: 0.6rem;
  font-size: 0.92rem; background: var(--card); font-family: inherit; color: var(--foreground);
}
input:focus, select:focus, textarea:focus { outline: 2px solid hsl(158 55% 42% / .35); border-color: var(--primary); }
label { display: block; font-size: 0.8rem; color: var(--muted-fg); margin-bottom: 0.15rem; font-weight: 500; }

/* ── Layout helpers ─────────────────────────────── */
form.inline { display: inline; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem; margin-bottom: 1.3rem; box-shadow: var(--shadow-card);
}
.muted { color: var(--muted-fg); font-size: 0.85rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3rem; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

/* ── Scanner page ───────────────────────────────── */
#reader { max-width: 520px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.scan-result { max-width: 520px; margin: 1rem auto; padding: 1rem; border-radius: var(--radius);
  font-size: 1.05rem; text-align: center; box-shadow: var(--shadow-card); }
.scan-result.ok { background: var(--green-light); border: 1px solid var(--primary); color: var(--green-dark); }
.scan-result.warn { background: hsl(46 85% 58% / .15); border: 1px solid var(--secondary); color: var(--secondary-fg); }
.scan-result.err { background: hsl(0 72% 55% / .1); border: 1px solid var(--destructive); color: hsl(0 72% 38%); }

.center-page { max-width: 400px; margin: 3.5rem auto; }
.flash {
  background: hsl(46 85% 58% / .18); border: 1px solid var(--secondary);
  padding: 0.6rem 1rem; border-radius: 0.7rem; margin-bottom: 1rem; color: var(--secondary-fg);
}

/* ── Login page ─────────────────────────────────── */
.login-hero {
  min-height: 100vh; background: var(--gradient-hero); position: relative;
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.login-hero::before {
  content: ""; position: absolute; inset: 0;
  background: var(--gradient-mesh); opacity: .5;
}
.login-card { position: relative; width: 100%; max-width: 400px; }
