/* ============================================================
   Deshmatri — shared stylesheet (public + admin)
   ============================================================ */

/* ---------- Fonts (self-hosted, no CDN needed) ----------
   Body/UI : Noto Sans Bengali — clearest Bangla on small screens
   Headings: Noto Serif Bengali — editorial, news-style headings
   ------------------------------------------------------ */
@font-face {
  font-family: "Noto Sans Bengali";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/noto-sans-bengali-bengali-400.woff2") format("woff2");
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: "Noto Sans Bengali";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/noto-sans-bengali-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Sans Bengali";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/noto-sans-bengali-bengali-500.woff2") format("woff2");
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: "Noto Sans Bengali";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/noto-sans-bengali-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Sans Bengali";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/noto-sans-bengali-bengali-600.woff2") format("woff2");
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: "Noto Sans Bengali";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/noto-sans-bengali-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Sans Bengali";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/noto-sans-bengali-bengali-700.woff2") format("woff2");
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: "Noto Sans Bengali";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/noto-sans-bengali-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Noto Serif Bengali";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/noto-serif-bengali-bengali-600.woff2") format("woff2");
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: "Noto Serif Bengali";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/noto-serif-bengali-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Serif Bengali";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/noto-serif-bengali-bengali-700.woff2") format("woff2");
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: "Noto Serif Bengali";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/noto-serif-bengali-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --green-900: #064e3b;
  --green-800: #065f46;
  --green-700: #047857;
  --green-600: #059669;
  --green-500: #10b981;
  --green-100: #d1fae5;
  --green-50: #ecfdf5;
  --gold-500: #f59e0b;
  --gold-100: #fef3c7;
  --ink-900: #111827;
  --ink-700: #374151;
  --ink-500: #6b7280;
  --ink-300: #d1d5db;
  --ink-100: #f3f4f6;
  --bg: #f6f7f9;
  --card: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow-lg: 0 12px 28px rgba(16, 24, 40, .12);
  --danger: #dc2626;
  --wa: #25d366;
}

* { box-sizing: border-box; }

html {
  /* 18px root on desktop — every rem-based size below scales from here */
  font-size: 112.5%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
  html { font-size: 109.375%; } /* 17.5px root */
}
/* Phones: biggest scale for comfortable reading */
@media (max-width: 767px) {
  html { font-size: 125%; } /* 20px root on small phones */
}
@media (min-width: 480px) and (max-width: 767px) {
  html { font-size: 118.75%; } /* 19px root on large phones */
}

html, body { margin: 0; padding: 0; }

body {
  font-family: "Noto Sans Bengali", "Nirmala UI", "Vrinda", "Kalpurush", "SolaimanLipi", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink-900);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* Form controls don't inherit the font by default */
button, input, select, textarea, optgroup {
  font-family: inherit;
}

img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
  font-family: "Noto Serif Bengali", "Noto Sans Bengali", "Nirmala UI", "Segoe UI", Georgia, serif;
  line-height: 1.35;
  margin: 0 0 .5em;
  letter-spacing: -.005em;
}
p { margin: 0 0 1em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: .6rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  transition: filter .15s, background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:hover { filter: brightness(1.06); }
.btn-primary { background: var(--green-700); color: #fff; }
.btn-gold { background: var(--gold-500); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border-color: var(--ink-300); color: var(--ink-700); }
.btn-ghost { background: transparent; color: var(--ink-500); }
.btn-sm { padding: .4rem .8rem; font-size: .9rem; }
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .35rem; color: var(--ink-700); }
.field .hint { font-size: .9rem; color: var(--ink-500); margin-top: .3rem; }
.input, .select, .textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 1rem;
  color: var(--ink-900);
}
.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid var(--green-500);
  outline-offset: 0;
  border-color: var(--green-500);
}
.textarea { min-height: 160px; resize: vertical; }
.checkbox-row { display: flex; align-items: center; gap: .5rem; }

/* Rich text editor */
.rte { border: 1px solid var(--ink-300); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.rte:focus-within { outline: 2px solid var(--green-500); border-color: var(--green-500); }
.rte[data-invalid] { border-color: #dc2626; }
.rte[data-invalid] .rte-editor { background: #fef2f2; }
.rte-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  padding: .35rem .4rem; border-bottom: 1px solid var(--ink-300);
  background: var(--ink-100);
}
.rte-toolbar button {
  min-width: 30px; height: 30px; padding: 0 .45rem;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--ink-700); font-size: .92rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.rte-toolbar button:hover { background: var(--ink-300); }
.rte-toolbar button svg { width: 16px; height: 16px; }
.rte-sep { width: 1px; height: 18px; background: var(--ink-300); margin: 0 .3rem; display: inline-block; }
.rte-editor {
  padding: .65rem .8rem; min-height: 220px; overflow-y: auto;
  font-size: 1.05rem; color: var(--ink-900); line-height: 1.6;
}
.rte-editor:empty::before { content: attr(data-placeholder); color: var(--ink-500); }
.rte-editor p { margin: 0 0 .6rem; }
.rte-editor p:last-child { margin-bottom: 0; }
.rte-editor h2 { font-size: 1.3rem; margin: .6rem 0 .4rem; }
.rte-editor h3 { font-size: 1.1rem; margin: .5rem 0 .3rem; }
.rte-editor blockquote { border-left: 3px solid var(--green-500); margin: .5rem 0; padding: .3rem .7rem; color: var(--ink-500); }
.rte-editor ul, .rte-editor ol { margin: 0 0 .6rem; padding-left: 1.4rem; }
.rte-editor ul { list-style: disc; }
.rte-editor ol { list-style: decimal; }
.rte-editor a { color: var(--green-700); text-decoration: underline; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--green-600); }
.error-text { color: var(--danger); font-size: .9rem; margin-top: .3rem; }
.alert {
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 1rem;
}
.alert-success { background: var(--green-50); border: 1px solid var(--green-100); color: var(--green-800); }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }

/* ---------- Public layout ---------- */
.site-header {
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
  color: #fff;
}
.site-header .inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: .9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; }
.brand svg { width: 26px; height: 26px; }
.brand img { height: 32px; width: auto; border-radius: 6px; }
.admin-sidebar .brand img { height: 26px; }
.main-nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.main-nav a {
  padding: .5rem .95rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  opacity: .85;
}
.main-nav a:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.main-nav a.active { background: #fff; color: var(--green-800); opacity: 1; }

.page-hero {
  background: linear-gradient(135deg, var(--green-800), var(--green-600));
  color: #fff;
  padding: 2.6rem 1.25rem;
  text-align: center;
}
.page-hero h1 { font-size: 2rem; margin: 0 0 .3rem; }
.page-hero p { margin: 0; opacity: .92; max-width: 640px; margin-inline: auto; }
.page-hero .crumbs { font-size: .95rem; opacity: .85; margin-bottom: .6rem; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
.container.narrow { max-width: 720px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; font-size: 1.4rem; }
.section-head .link { color: var(--green-700); font-weight: 600; font-size: .95rem; }

/* Category cards on home */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.cat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  display: block;
  border: 1px solid transparent;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.cat-card:hover { border-color: var(--green-500); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.cat-card .icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .8rem;
}
.cat-card .icon svg { width: 24px; height: 24px; }
.cat-card h3 { margin: 0 0 .3rem; font-size: 1.15rem; }
.cat-card p { margin: 0; color: var(--ink-500); font-size: .95rem; }

/* Card grids & cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, transform .1s;
}
.card.hoverable:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card .card-body { padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.card .card-body h3 { font-size: 1.15rem; margin: 0; }
.card .card-body p { color: var(--ink-500); font-size: .97rem; margin: 0; }
.card .meta { font-size: .87rem; color: var(--ink-500); display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.card .card-foot { padding: .75rem 1.2rem; border-top: 1px solid var(--ink-100); font-size: .93rem; }
.card.plain { padding: 1.2rem 1.3rem; }
.card.plain h2 { font-size: 1.22rem; margin-bottom: .4rem; }

.badge {
  display: inline-block;
  background: var(--green-100);
  color: var(--green-800);
  font-size: .83rem;
  font-weight: 700;
  padding: .15rem .6rem;
  border-radius: 999px;
}
.badge.gold { background: var(--gold-100); color: #92400e; }
.badge.gray { background: var(--ink-100); color: var(--ink-700); }

/* Article / post detail */
.article { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.8rem 2rem; }
.article h1 { font-size: 1.8rem; margin-bottom: .4rem; }
.article .meta { color: var(--ink-500); font-size: .93rem; margin-bottom: 1.4rem; display: flex; gap: .8rem; }
.article .content { font-size: 1.1rem; line-height: 1.8; }
.article .content h2, .article .content h3 { margin-top: 1.4rem; }

/* Q&A */
.qa-list { display: flex; flex-direction: column; gap: 1rem; }
.qa-item { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1.5rem; }
.qa-item h3 { margin: 0 0 .6rem; font-size: 1.15rem; display: flex; gap: .6rem; align-items: baseline; }
.qa-item .q-mark { color: var(--green-600); font-weight: 800; }
.qa-item .a { color: var(--ink-700); }
.qa-item .a .a-mark { font-weight: 800; color: var(--gold-500); }

/* Filter chips */
.chips { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.chips a {
  padding: .35rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--ink-300);
  background: var(--card);
  color: var(--ink-700);
  font-size: .95rem;
  font-weight: 600;
}
.chips a.active { background: var(--green-700); border-color: var(--green-700); color: #fff; }

/* Footer */
.site-footer { background: var(--green-900); color: rgba(255, 255, 255, .75); padding: 1.5rem 1.25rem; }
.site-footer .inner { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .95rem; }
.site-footer a { color: #fff; }
.site-footer .credit {
  max-width: 1100px;
  margin: 1rem auto 0;
  padding-top: .9rem;
  border-top: 1px solid rgba(255, 255, 255, .12);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  flex-wrap: wrap;
  font-size: .9rem;
}
.site-footer .credit-label { color: rgba(255, 255, 255, .6); }
.site-footer .credit-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  font-weight: 600;
  letter-spacing: .01em;
  text-decoration: none;
  transition: background .18s, border-color .18s, transform .18s;
}
.site-footer .credit-link:hover {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .3);
  transform: translateY(-1px);
}
.site-footer .credit-mark { width: 15px; height: 15px; opacity: .85; }

/* WhatsApp floating button */
.wa-float {
  position: fixed;
  right: 30px;
  bottom: 50px;
  z-index: 90;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: var(--wa);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(37, 211, 102, .45);
  transition: transform .15s;
}
.wa-float:hover { transform: scale(1.08); }
.wa-float svg { width: 34px; height: 34px; }

/* ---------- Quiz (public) ---------- */
.quiz-intro { text-align: center; max-width: 640px; margin: 0 auto; }
.quiz-timer-wrap {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: .8rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.quiz-timer { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.3rem; color: var(--green-700); }
.quiz-timer.warn { color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.quiz-q { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1.5rem; margin-bottom: 1.1rem; }
.quiz-q h3 { font-size: 1.15rem; }
.quiz-q .num { color: var(--green-600); }
.quiz-options { display: flex; flex-direction: column; gap: .55rem; margin-top: .8rem; }
.quiz-option {
  display: flex; align-items: center; gap: .7rem;
  border: 1.5px solid var(--ink-300);
  border-radius: var(--radius-sm);
  padding: .7rem .95rem;
  cursor: pointer;
  font-size: 1.05rem;
  transition: border-color .12s, background .12s;
}
.quiz-option:hover { border-color: var(--green-500); background: var(--green-50); }
.quiz-option input { accent-color: var(--green-600); width: 17px; height: 17px; flex-shrink: 0; margin: 0; }
.quiz-option.selected { border-color: var(--green-600); background: var(--green-50); }
.quiz-ad {
  background: var(--card);
  border: 1px dashed var(--ink-300);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1.4rem 0;
  text-align: center;
  color: var(--ink-500);
  font-size: .93rem;
}
.quiz-ad-sample { color: var(--ink-500); font-size: .93rem; }

/* ---------- Admin ---------- */
.admin-body { background: var(--bg); min-height: 100vh; }
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--green-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-sidebar .brand { padding: 1.2rem 1.3rem; border-bottom: 1px solid rgba(255, 255, 255, .12); font-size: 1.15rem; }
.admin-sidebar nav { flex: 1; padding: .8rem; display: flex; flex-direction: column; gap: .15rem; overflow-y: auto; }
.admin-sidebar nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .8rem;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .78);
  font-size: .97rem;
  font-weight: 600;
}
.admin-sidebar nav a svg { width: 18px; height: 18px; opacity: .85; }
.admin-sidebar nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.admin-sidebar nav a.active { background: var(--green-600); color: #fff; }
.admin-sidebar .side-foot { padding: 1rem 1.3rem; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .8rem; opacity: .7; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
  background: var(--card);
  border-bottom: 1px solid var(--ink-100);
  padding: .8rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 30;
}
.admin-topbar h1 { font-size: 1.15rem; margin: 0; }
.admin-content { padding: 1.6rem; }

/* Stat cards (dashboard) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.4rem; }
.stat-card .label { font-size: .88rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-500); font-weight: 700; }
.stat-card .value { font-size: 2rem; font-weight: 800; color: var(--green-700); line-height: 1.2; }
.stat-card .sub { font-size: .9rem; color: var(--ink-500); }

/* Data table */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1.6rem; }
.panel-head { padding: 1rem 1.3rem; border-bottom: 1px solid var(--ink-100); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 1.15rem; }
.panel-body { padding: 1.3rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th {
  text-align: left;
  padding: .7rem 1.3rem;
  background: var(--ink-100);
  color: var(--ink-700);
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--ink-300);
  white-space: nowrap;
}
.data-table td { padding: .75rem 1.3rem; border-bottom: 1px solid var(--ink-100); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: var(--green-50); }
.row-actions { display: flex; gap: .45rem; flex-wrap: wrap; }

.empty-state { text-align: center; color: var(--ink-500); padding: 2.4rem 1rem; }
.empty-state svg { width: 44px; height: 44px; margin-bottom: .6rem; opacity: .4; }

.pill { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .83rem; font-weight: 700; }
.pill.on { background: var(--green-100); color: var(--green-800); }
.pill.off { background: var(--ink-100); color: var(--ink-500); }

/* Login page */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(135deg, var(--green-900), var(--green-600)); }
.login-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 2rem 2.2rem; width: 100%; max-width: 400px; }
.login-card .brand { justify-content: center; color: var(--green-800); margin-bottom: .4rem; }

/* Pagination */
.pagination { display: flex; gap: .4rem; align-items: center; justify-content: center; margin-top: 1.6rem; }
.pagination a, .pagination span { padding: .45rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--ink-300); background: var(--card); font-size: .95rem; }
.pagination .disabled { opacity: .5; }
.pagination .current { background: var(--green-700); color: #fff; border-color: var(--green-700); }

/* Misc */
.muted { color: var(--ink-500); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* Responsive admin */
@media (max-width: 900px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; }
  .admin-sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .admin-sidebar .side-foot { display: none; }
}

/* ---------- Mobile readability & touch targets ---------- */
@media (max-width: 767px) {
  /* narrower side gutters so text uses the whole screen */
  .container { padding: 1rem .7rem 2rem; }
  .site-header .inner { padding: .7rem .7rem; gap: .35rem; }
  .main-nav { gap: .25rem; width: 100%; }
  .main-nav a { padding: .45rem .75rem; text-align: center; font-size: .95rem; }
  .page-hero { padding: 1.4rem .75rem; }
  .page-hero h1 { font-size: 1.6rem; }

  .article { padding: 1rem .85rem; }
  .article h1 { font-size: 1.55rem; }
  .article .content { font-size: 1.05rem; line-height: 1.8; }
  .article .meta { flex-wrap: wrap; gap: .45rem .8rem; }

  .card .card-body, .cat-card, .qa-item, .quiz-q, .card.plain, .panel-body { padding: .9rem .85rem; }
  .card-grid, .cat-grid { gap: .8rem; }
  .btn { padding: .75rem 1.2rem; }
  .chips a { padding: .5rem .9rem; }
  .quiz-option { padding: .8rem .9rem; }
  .field { margin-bottom: 1.1rem; }
  .site-footer { padding: 1.3rem .9rem; }
  .login-card { padding: 1.7rem 1.2rem; }
  .login-card .brand { font-size: 1.15rem; }

  /* keep data tables usable — scroll instead of clipping */
  .panel { overflow-x: auto; }
  .data-table { min-width: 640px; }
}
