/* Samaj Setu Admin — shared design system for every dashboard page.
   Layout: fixed sidebar (built by admin.js) + sticky top bar + content.
   Page markup only uses the component classes below; pages carry no CSS. */

/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ee;
  --border-soft: #edf1f5;
  --text: #0f1b2a;
  --text-2: #3d4b5c;
  --muted: #687586;
  --primary: #0b5e7e;
  --primary-hover: #084b66;
  --primary-soft: #e5f1f6;
  --good: #16794a;
  --good-bg: #e2f5ea;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --warn: #9a6700;
  --warn-bg: #fff4d6;
  --info: #2f6bcb;
  --info-bg: #e7effc;
  --sidebar-bg: #0c2230;
  --sidebar-text: #a9bccb;
  --sidebar-active: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 1px 2px rgba(15, 27, 42, 0.05);
  --shadow: 0 1px 3px rgba(15, 27, 42, 0.06), 0 6px 16px -8px rgba(15, 27, 42, 0.12);
  --shadow-lg: 0 24px 48px -12px rgba(15, 27, 42, 0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --focus-ring: rgba(11, 94, 126, 0.18);

  /* Names the page scripts' inline styles still use. */
  --ink: var(--text);
  --paper: var(--bg);
  --panel: var(--surface);
  --line: var(--border);
  --line-soft: var(--border-soft);
  --navy: var(--primary);
  --navy-deep: var(--primary-hover);
  --accent: var(--primary);
  --chip-bg: var(--primary-soft);
  --chip-fg: var(--primary);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d141b;
  --surface: #151e27;
  --surface-2: #19232e;
  --border: #253241;
  --border-soft: #1e2a36;
  --text: #e6edf3;
  --text-2: #bac6d2;
  --muted: #8b99a8;
  --primary: #4fb3d9;
  --primary-hover: #74c4e3;
  --primary-soft: rgba(79, 179, 217, 0.14);
  --good: #4ade80;
  --good-bg: rgba(74, 222, 128, 0.13);
  --bad: #f87171;
  --bad-bg: rgba(248, 113, 113, 0.13);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.13);
  --info: #7aa7f0;
  --info-bg: rgba(122, 167, 240, 0.13);
  --sidebar-bg: #0a1117;
  --sidebar-text: #8fa2b3;
  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
  --focus-ring: rgba(79, 179, 217, 0.25);
  color-scheme: dark;
}

/* -------------------------------------------------------------------- base */
* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { letter-spacing: -0.01em; }

svg.icon { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 256px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.sidebar-brand .logo {
  width: 40px; height: 40px; border-radius: 11px; padding: 4px;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25);
  display: grid; place-items: center; flex-shrink: 0;
}
.sidebar-brand .logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.auth-card .auth-logo { width: 72px; height: 72px; display: block; margin-bottom: 18px; }
.sidebar-brand strong { display: block; color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.sidebar-brand span { font-size: 12px; color: var(--sidebar-text); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav-search {
  position: relative; margin: 0 12px 4px; display: flex; align-items: center;
}
.nav-search .icon { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--sidebar-text); pointer-events: none; }
.sidebar .nav-search input[type="search"] {
  width: 100%; min-width: 0; padding: 8px 52px 8px 32px; border-radius: 8px; font: inherit; font-size: 13px; box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.06); color: #fff;
}
.sidebar .nav-search input[type="search"]::placeholder { color: var(--sidebar-text); opacity: 0.8; }
.sidebar .nav-search input[type="search"]:focus { outline: none; border-color: #5cc3e8; background: rgba(255, 255, 255, 0.09); }
.nav-search kbd {
  position: absolute; right: 8px; font: 600 10.5px/1 inherit; color: var(--sidebar-text);
  border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 5px; padding: 3px 5px; pointer-events: none;
}
.nav-search input:not(:placeholder-shown) + kbd { display: none; }
.nav-empty { margin: 14px 10px; font-size: 13px; color: var(--sidebar-text); }
.nav-link[hidden], .nav-section[hidden], .nav-empty[hidden] { display: none; }
.nav-link.nav-first { background: rgba(92, 195, 232, 0.14); color: #fff; }
.nav-section { margin-top: 14px; }
.nav-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(169, 188, 203, 0.55); padding: 0 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; margin: 1px 0; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none; font-weight: 500; font-size: 13.5px;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav-link.active { background: var(--sidebar-active); color: #fff; }
.nav-link.active svg { color: #5cc3e8; }

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding: 14px 14px 16px; display: flex; align-items: center; gap: 10px;
}
.sidebar-footer .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(92, 195, 232, 0.18); color: #7fd3f0;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.sidebar-footer .who { flex: 1; min-width: 0; }
.sidebar-footer .who strong { display: block; color: #fff; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer .who span { font-size: 12px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.sidebar-footer .icon-btn { background: transparent; border-color: rgba(255, 255, 255, 0.12); color: var(--sidebar-text); }
.sidebar-footer .icon-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 32px; min-height: 72px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .titles { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 700; color: var(--text); }
.topbar p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.topbar .menu-btn { display: none; }

.content { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 32px 64px; }

.sidebar-backdrop { display: none; }

@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 15, 22, 0.45); z-index: 45; }
  .topbar { padding: 12px 16px; }
  .topbar .menu-btn { display: inline-grid; }
  .content { padding: 20px 16px 48px; }
}

/* ------------------------------------------------------------------ panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.panel h2, .toolbar h2 { font-size: 15px; font-weight: 650; margin: 0 0 4px; color: var(--text); }
.panel > h2 { margin-bottom: 16px; }
.panel > h2 + .hint { margin-top: -10px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.5; }
.panel .hint { margin: 0 0 16px; }
.form-grid + .hint { margin: 10px 0 0; }
.masked-note { font-size: 12px; color: var(--muted); margin-top: 12px; }

.toolbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin: 6px 0 16px;
}
.toolbar .hint { margin: 2px 0 0; max-width: 620px; }
.panel .toolbar { margin-top: 0; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.view-switch { margin-bottom: 18px; }
.log-hint { margin: 0 0 12px; max-width: 680px; }

/* ------------------------------------------------------------------- forms */
label { display: block; font-size: 12.5px; font-weight: 550; color: var(--text-2); margin-bottom: 6px; }

input[type="text"], input[type="tel"], input[type="url"], input[type="date"], input[type="time"],
input[type="password"], input[type="search"], input[type="email"], input[type="number"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input::placeholder, textarea::placeholder { color: #9aa6b4; }
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
input[type="search"] { width: auto; min-width: 240px; padding-left: 36px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23687586' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

/* Referrals: one-row "recommend" form. */
.recommend-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; }

.kw-form, .add-root-form { display: flex; gap: 10px; align-items: flex-end; }
.kw-form input, .add-root-form > div { flex: 1; min-width: 0; }

.community-picker { display: flex; align-items: center; gap: 10px; }
.community-picker select { width: auto; min-width: 260px; }

.logo-field { display: flex; align-items: center; gap: 10px; }
.logo-field input { flex: 1; }
.logo-preview { width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); object-fit: cover; flex-shrink: 0; }
.logo-preview[hidden] { display: none; }

@media (max-width: 760px) {
  .form-grid, .recommend-form { grid-template-columns: 1fr; }
  .kw-form, .add-root-form { flex-direction: column; align-items: stretch; }
  input[type="search"] { width: 100%; }
}

/* Inline status messages under forms. */
#formMsg, #communityMsg, #announcementMsg, #eventMsg, #eduMsg, #kwMsg, #adMsg, #msg {
  font-size: 13px; min-height: 18px; margin-top: 10px; font-weight: 500;
}
#msg { color: var(--bad); margin: 0 0 10px; }
.ok, #formMsg.ok, #kwMsg.ok { color: var(--good); }
.err, #formMsg.err, #kwMsg.err { color: var(--bad); }

/* ----------------------------------------------------------------- buttons */
button {
  cursor: pointer; font-family: inherit;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; padding: 9px 16px; min-height: 38px;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, filter 0.12s ease;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
/* A link styled as a button (e.g. "Open" in a table's actions). */
a.btn-ghost {
  display: inline-flex; align-items: center; text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; padding: 9px 16px; min-height: 38px; box-sizing: border-box;
}

.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .btn-primary { color: #06202b; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-ghost, .refresh, .row-toggle {
  background: var(--surface); border-color: var(--border); color: var(--text);
}
.btn-ghost:hover:not(:disabled), .refresh:hover:not(:disabled), .row-toggle:hover:not(:disabled) {
  border-color: var(--primary); color: var(--primary);
}
.refresh { color: var(--text-2); font-weight: 500; }
.row-toggle { padding: 6px 12px; min-height: 32px; font-size: 12.5px; }
.row-toggle.danger { color: var(--bad); }
.row-toggle.danger:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }

.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }

.btn-approve, .act-good { background: var(--good-bg); color: var(--good); }
.btn-reject, .act-bad { background: var(--bad-bg); color: var(--bad); }
.btn-approve:hover:not(:disabled), .btn-reject:hover:not(:disabled), .act-good:hover:not(:disabled), .act-bad:hover:not(:disabled) { filter: brightness(0.96); border-color: currentColor; }
.act-good, .act-bad { padding: 6px 12px; min-height: 32px; font-size: 12.5px; }

.badge-btn {
  background: var(--bad-bg); color: var(--bad); padding: 3px 10px; min-height: 26px;
  font-size: 12px; border-radius: 999px; white-space: nowrap;
}

.referrer-link { background: none; border: none; padding: 0; min-height: 0; font: inherit; font-weight: 550; color: var(--primary); cursor: pointer; }
.referrer-link:hover { text-decoration: underline; }

/* -------------------------------------------------------------------- tabs */
.tabs {
  display: inline-flex; gap: 2px; padding: 3px; flex-wrap: wrap;
  background: var(--border-soft); border: 1px solid var(--border); border-radius: 10px;
}
.tab {
  background: transparent; border: none; min-height: 32px;
  padding: 6px 14px; font-size: 13px; font-weight: 550; color: var(--muted); border-radius: 7px;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 27, 42, 0.1); }

/* ------------------------------------------------------------------- pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--border-soft); color: var(--text-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.pill-code::before { display: none; }
.pill-active, .pill.approved { background: var(--good-bg); color: var(--good); }
.pill-inactive, .pill.rejected, .pill.open { background: var(--bad-bg); color: var(--bad); }
.pill.pending { background: var(--warn-bg); color: var(--warn); }
.pill-status { background: var(--info-bg); color: var(--info); text-transform: capitalize; }
.pill.handled { opacity: 0.7; }
.pill-code { font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; background: var(--border-soft); color: var(--text-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 4px 4px 4px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-size: 12.5px; font-weight: 600;
}
.chip button { background: transparent; color: inherit; padding: 0 7px; min-height: 22px; font-size: 16px; line-height: 1; border-radius: 999px; }
.chip button:hover { color: var(--bad); background: var(--bad-bg); }

/* ------------------------------------------------------------------ tables */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow-x: auto;
}
/* A table inside a panel runs edge to edge and scrolls sideways on narrow screens. */
.table-scroll { margin: 0 -24px; overflow-x: auto; }
.table-scroll table { min-width: 760px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; font-size: 13.5px; }
th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600;
  background: var(--surface-2); border-bottom-color: var(--border); white-space: nowrap;
}
.panel th:first-child, .panel td:first-child { padding-left: 24px; }
.panel th:last-child, .panel td:last-child { padding-right: 24px; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover td { background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
td.title { font-weight: 600; min-width: 200px; word-break: break-word; }
td.date, td.by { white-space: nowrap; color: var(--muted); font-size: 13px; }
td.note { max-width: 280px; word-break: break-word; color: var(--muted); font-size: 13px; }
td.actions { white-space: nowrap; }
/* `.actions` below is a flex row for cards; a table cell must stay a cell or the row borders break. */
td.actions, td.actions.actions { display: table-cell; margin-top: 0; }
td.actions button { margin: 3px 6px 3px 0; min-height: 32px; padding: 6px 12px; font-size: 12.5px; }
tr.detail td, tr.detail:hover td { background: var(--surface-2); }
.none { color: var(--muted); }

.reports { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.reports li { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.reports li:last-child { border-bottom: none; }
.reports .meta { color: var(--muted); font-size: 12px; }
.reports .handled { opacity: 0.55; }

/* -------------------------------------------------------- list / item cards */
.item-list { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.item-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; background: var(--surface);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.item-card:hover { border-color: #c9d3de; box-shadow: var(--shadow); }
:root[data-theme="dark"] .item-card:hover { border-color: #33455a; }
.item-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.item-card-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.item-card-head h3 { margin: 0; font-size: 15px; font-weight: 650; min-width: 0; overflow-wrap: break-word; }
.item-card-body { margin: 8px 0 0; font-size: 14px; color: var(--text-2); white-space: pre-wrap; }
.item-card-meta { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
/* Photo field on announcement / event forms (content.html) */
.image-field { display: flex; flex-direction: column; gap: 8px; }
.image-field-preview { max-width: 320px; max-height: 180px; border-radius: 8px; border: 1px solid var(--border); object-fit: cover; }
.image-field-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; font-size: 13.5px; font-weight: 600; margin: 0; }
.item-card-img { margin-top: 12px; max-width: 100%; max-height: 180px; border-radius: 8px; display: block; border: 1px solid var(--border); }
.post-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.post-thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.item-card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* Submissions: one card per member post. */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px 22px; margin-bottom: 14px;
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card h3 { margin: 12px 0 4px; font-size: 16px; font-weight: 700; word-break: break-word; }
.card .desc { margin: 0 0 12px; font-size: 14px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13px; margin: 0 0 12px; padding: 12px 14px; background: var(--surface-2); border-radius: 8px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; }
.meta { font-size: 12.5px; color: var(--muted); }
.reason { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-size: 12.5px; }
.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* Education tree. */
.edu-tree, .edu-tree ul { list-style: none; margin: 0; padding: 0 0 0 26px; }
.edu-tree { padding-left: 0; margin-top: 20px; }
.edu-tree ul { border-left: 1px dashed var(--border); margin-left: 14px; padding-left: 16px; }
.edu-node { margin: 8px 0; }
.edu-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.edu-row:hover { border-color: #c9d3de; }
.edu-label { font-weight: 600; flex: 1; min-width: 100px; }
.edu-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.edu-inline-form { display: flex; gap: 8px; margin: 8px 0 0 14px; }
.edu-inline-form input { flex: 1; min-width: 0; }
.tree-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 20px; font-size: 13px; color: var(--muted);
}
.tree-toolbar + .edu-tree { margin-top: 12px; }
.tree-toggle {
  width: 28px; height: 28px; padding: 0; flex-shrink: 0; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.tree-toggle:hover { background: var(--bg); color: var(--text); }
.tree-toggle svg { width: 16px; height: 16px; transition: transform .15s ease; }
.tree-toggle.open svg { transform: rotate(90deg); }
.tree-toggle-spacer { width: 28px; flex-shrink: 0; }
.edu-label.has-kids { cursor: pointer; user-select: none; }
.tree-count {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--bg); color: var(--muted); vertical-align: 1px;
}

/* ------------------------------------------------------------ stats + chart */
.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px;
}
.stat-card .stat-icon {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; letter-spacing: -0.02em; }
.stat-card .label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-card.accent-active .stat-icon { background: var(--good-bg); color: var(--good); }
.stat-card.accent-inactive .stat-icon { background: var(--bad-bg); color: var(--bad); }
.stat-card.accent-pending .stat-icon { background: var(--warn-bg); color: var(--warn); }
.stat-card.accent-registered .stat-icon { background: var(--info-bg); color: var(--info); }
.stats-loading { padding: 28px; text-align: center; color: var(--muted); }

.chart-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.chart-head h3 { margin: 0; font-size: 14px; font-weight: 650; }
.chart-head span { font-size: 12.5px; color: var(--muted); }
.chart-wrap { overflow-x: auto; }
.chart-bars {
  display: flex; align-items: flex-end; gap: 8px; height: 170px; min-width: 520px; padding: 8px 2px 0;
  background: repeating-linear-gradient(to top, var(--border-soft) 0 1px, transparent 1px 42px);
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.chart-bar {
  width: 100%; max-width: 30px; min-height: 3px; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #2aa3cf, var(--primary));
  transition: filter 0.12s ease;
}
.chart-col:hover .chart-bar { filter: brightness(1.12); }
.chart-col .day-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.chart-col .count-label { font-size: 11px; color: var(--text); font-weight: 650; }

/* ----------------------------------------------------------- empty states */
.empty, .loading, .error { padding: 40px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.error { color: var(--bad); }
.loading::before {
  content: ""; display: block; width: 22px; height: 22px; margin: 0 auto 10px;
  border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
td.loading::before { display: inline-block; margin: 0 10px -6px 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ modals */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; padding: 20px;
  background: rgba(8, 15, 22, 0.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 24px; width: 100%; max-width: 400px;
  animation: pop 0.14s ease-out;
  /* Long forms (e.g. a story) scroll inside the box instead of running off the window. */
  max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain;
}
/* The buttons stay in view at the bottom while the form scrolls under them. */
.modal-box .modal-actions {
  position: sticky; bottom: -24px; z-index: 1;
  margin-left: -24px; margin-right: -24px; margin-bottom: -24px; padding: 14px 24px 24px;
  background: var(--surface); border-top: 1px solid var(--border-soft);
}
@keyframes pop { from { transform: scale(0.97); opacity: 0; } }
.modal-box h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; color: var(--text); }
.modal-box p { margin: 0 0 16px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.modal-error { font-size: 12.5px; color: var(--bad); min-height: 18px; margin-top: 8px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.referrer-modal { position: relative; text-align: center; }
.modal-close-x {
  position: absolute; top: 12px; right: 12px; min-height: 0;
  background: none; border: none; font-size: 20px; line-height: 1; color: var(--muted); padding: 4px 8px; border-radius: 8px;
}
.modal-close-x:hover { color: var(--text); background: var(--border-soft); }
.referrer-avatar {
  width: 56px; height: 56px; border-radius: 50%; margin: 4px auto 14px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-size: 20px; font-weight: 700;
}
.referrer-name { font-size: 16px; font-weight: 700; color: var(--text); margin: 0 0 2px !important; }
.referrer-tag { font-size: 12px; color: var(--muted); margin: 0 0 16px !important; }
.referrer-row { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font-size: 15px; }
.referrer-row a { color: var(--primary); text-decoration: none; font-weight: 700; letter-spacing: 0.3px; }
.referrer-row a:hover { text-decoration: underline; }
.referrer-empty { padding: 4px 4px 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.referrer-loading { padding: 22px 0 8px; text-align: center; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------------- login */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero {
  position: relative; overflow: hidden; color: #dbeaf2;
  background: radial-gradient(1200px 600px at -10% -20%, #1b8fb8 0%, transparent 55%), linear-gradient(160deg, #0c2230 0%, #0b3a4f 100%);
  padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-hero .sidebar-brand { padding: 0; }
.auth-hero h2 { font-size: 34px; line-height: 1.15; color: #fff; margin: 0 0 14px; max-width: 460px; letter-spacing: -0.02em; }
.auth-hero p { font-size: 15px; max-width: 440px; margin: 0; color: #a9c3d3; }
.auth-hero ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-hero li { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.auth-hero li svg { color: #5cc3e8; }
.auth-hero small { color: #7f9aab; font-size: 12px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; position: relative; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 24px; margin: 0 0 6px; }
.auth-card > p { color: var(--muted); margin: 0 0 28px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card button[type="submit"] { width: 100%; min-height: 44px; margin-top: 6px; font-size: 14.5px; }
#loginMsg { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 12px; text-align: center; }
.auth-main .theme-corner { position: absolute; top: 20px; right: 20px; }
@media (max-width: 860px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}

/* ---------------------------------------------------------- commercial ads */
.ad-stats { margin-bottom: 24px; }
.date-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ad-image-field { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ad-image-field input[type="file"] { font-size: 13px; color: var(--text-2); }
.ad-thumb { width: 120px; height: 68px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); }
.ad-thumb[hidden] { display: none; }
.check-row { display: flex; gap: 24px; flex-wrap: wrap; }
label.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; font-weight: 500; color: var(--text); cursor: pointer; }
label.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }

.ad-card { display: flex; gap: 18px; align-items: flex-start; }
.ad-card-img {
  width: 168px; height: 96px; flex-shrink: 0; border-radius: 10px; object-fit: cover;
  border: 1px solid var(--border); background: var(--bg);
}
.ad-card-noimg { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.ad-card-main { flex: 1; min-width: 0; }
.ad-card .item-card-meta strong { color: var(--text-2); font-weight: 600; }
.ad-contact:empty { display: none; }
.ad-contact a { color: var(--primary); text-decoration: none; overflow-wrap: anywhere; }
.ad-contact a:hover { text-decoration: underline; }
.ad-flag { color: var(--info); font-weight: 600; }
.ad-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.ad-card-foot .item-card-actions { margin-top: 0; }
.ad-metrics { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.pill.ad-live { background: var(--good-bg); color: var(--good); }
.pill.ad-scheduled { background: var(--info-bg); color: var(--info); }
.pill.ad-paused { background: var(--warn-bg); color: var(--warn); }
.pill.ad-ended { background: var(--border-soft); color: var(--muted); }
@media (max-width: 640px) {
  .ad-card { flex-direction: column; }
  .ad-card-img { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .ad-card-noimg { display: none; }
}

/* --------------------------------------------------------------- businesses */
.compact-select { width: auto; min-width: 180px; }
.controls input[type="search"] { flex: 1; min-width: 240px; }
.biz-table td { vertical-align: middle; }
.biz-table small, td.by small { color: var(--muted); font-size: 12px; }
.biz-cell {
  display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 0; min-height: 0;
  text-align: left; color: inherit; cursor: pointer; font: inherit;
}
.biz-cell strong { display: block; font-weight: 600; color: var(--text); }
.biz-cell small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.biz-cell:hover strong { color: var(--primary); }
.biz-thumb {
  position: relative; flex-shrink: 0; overflow: hidden; border-radius: 10px;
  display: inline-grid; place-items: center; background: var(--primary-soft); color: var(--primary);
  font-weight: 700; font-size: 15px; border: 1px solid var(--border);
}
.biz-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.link-btn { background: none; border: 0; padding: 0; min-height: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.danger-text { color: var(--bad) !important; }
body.no-scroll { overflow: hidden; }

.drawer-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(8, 15, 22, 0.45); display: flex; justify-content: flex-end; }
.drawer-overlay[hidden] { display: none; }
.drawer {
  width: min(560px, 100%); height: 100%; background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide-in 0.18s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border-soft); }
.drawer-title { display: flex; gap: 14px; align-items: center; min-width: 0; }
.drawer-title h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.drawer-title p { margin: 4px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 24px; }
.drawer-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border-soft); background: var(--surface-2); }
.drawer-foot:empty { display: none; }
.drawer-section { margin-top: 20px; }
.drawer-section h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
.drawer-section h4 small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.drawer-text { margin: 0; font-size: 14px; color: var(--text-2); line-height: 1.55; white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 7px 0; font-size: 13.5px; border-bottom: 1px dashed var(--border-soft); }
.kv > span { color: var(--muted); }
.kv > div { color: var(--text); overflow-wrap: anywhere; }
.kv a, .drawer-body a { color: var(--primary); text-decoration: none; }
.kv a:hover { text-decoration: underline; }
.notice { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; }
.notice strong { font-weight: 650; }
.notice-bad { background: var(--bad-bg); color: var(--bad); }
.notice-warn { background: var(--warn-bg); color: var(--warn); }
.notice[hidden] { display: none; } /* e.g. the Demo OTP banner while Live */
.photo-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.photo-strip img { width: 132px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); display: block; background: var(--bg); }
.muted-note { color: var(--muted); font-size: 13px; margin: 0; }
.chip-plain { padding: 4px 12px; }
.hours { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.hours-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 4px 0; }
.hours-row span:first-child { color: var(--muted); }
.hours-row em { color: var(--bad); font-style: normal; }
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.mini-row strong { font-size: 13.5px; font-weight: 600; color: var(--text); }
.mini-row small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.mini-row .mini-note { font-style: italic; }
@media (max-width: 640px) {
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .hours { grid-template-columns: 1fr; }
  .compact-select { width: 100%; }
}
#bizList table, #bookingList table { min-width: 880px; }
.biz-table td.actions { min-width: 200px; }
.biz-table td:first-child { min-width: 250px; }
.review-row { align-items: flex-start; }
.review-row.is-hidden { opacity: 0.65; border-style: dashed; }
.review-row .stars { color: #f5b301; letter-spacing: 1px; margin-right: 4px; }
.review-row .stars span { color: var(--border); }
.review-text { margin: 6px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.45; white-space: pre-wrap; }
.review-reply { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); padding-left: 10px; border-left: 2px solid var(--border); }
.review-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* ---------- Villages ---------- */
.village-thumb { background: var(--info-bg); color: var(--info); }
.village-table td:first-child { min-width: 220px; }
.verified { color: var(--good); font-size: 12px; font-weight: 700; margin-left: 2px; }
.admin-chips { display: flex; flex-wrap: wrap; gap: 6px; max-width: 260px; }
.admin-chips .chip { padding: 3px 10px; font-size: 12.5px; }
.chip-warn { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.warn-text { color: var(--warn) !important; }
.member-picker { margin-top: 16px; padding: 14px; border: 1px dashed var(--border); border-radius: 12px; }
.member-picker input[type="search"] { width: 100%; min-width: 0; }
.member-picker #memberResults { margin-top: 10px; max-height: 300px; overflow-y: auto; }
.loading.small { padding: 14px 0; font-size: 13px; }
#placeForm { margin-bottom: 10px; }
#placeForm .form-actions { margin-top: 2px; align-items: center; }
.inline-msg { font-size: 13px; }
.inline-msg.good { color: var(--good); }
.inline-msg.bad { color: var(--bad); }
.dir-group { margin-top: 14px; }
.dir-group h5 { margin: 0 0 8px; font-size: 13px; font-weight: 650; color: var(--text); }
.dir-group h5 small { color: var(--muted); font-weight: 500; }
.dir-empty { margin-top: 10px; }

/* ---------- Free access period ---------- */
.access-card { display: flex; align-items: flex-start; gap: 18px; padding: 20px 22px; }
.access-card .access-text { flex: 1; min-width: 0; }
.access-card h2 { margin: 0 0 4px; font-size: 17px; }
.access-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.access-state { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; }

/* On/off switch: <label class="switch"><input type="checkbox"><span></span></label> */
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex-shrink: 0; margin: 2px 0 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background 0.15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button { padding: 8px 14px; min-height: 36px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg input { width: 90px; min-height: 36px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin: 0 0 8px; font-weight: 500; color: var(--text); font-size: 13.5px; cursor: pointer; }
.choice input { margin-top: 3px; accent-color: var(--primary); }
.choice small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; font-size: 12.5px; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.preview-label { font-size: 12.5px; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }
.pill.state-free { background: var(--good-bg); color: var(--good); }
.pill.state-extended { background: var(--info-bg); color: var(--info); }
.pill.state-lifetime { background: var(--primary-soft); color: var(--primary); }
.pill.state-ended { background: var(--bad-bg); color: var(--bad); }
.pill.state-paid { background: var(--good-bg); color: var(--good); }

/* Paid subscription: member picker in "Record a payment" */
.member-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 220px; overflow-y: auto; }
.member-option { text-align: left; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 500; padding: 8px 12px; min-height: 0; }
.member-option:hover { border-color: var(--primary); }
.terms-text { width: 100%; font-size: 14px; line-height: 1.55; resize: vertical; }
.meta.mono { font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; }
.pill.state-unlimited { background: var(--border-soft); color: var(--muted); }
.extend-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.extend-row { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.extend-row input { flex: 1; }
@media (max-width: 640px) { .access-card { flex-direction: column-reverse; } }
.registered-at { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- Notification bell (top bar) ---------- */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.bell-wrap { position: relative; }
.bell-btn { position: relative; }
.bell-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface); line-height: 1;
}
.bell-badge[hidden] { display: none; }
.bell-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: min(380px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; max-height: min(520px, calc(100vh - 100px)); overflow: hidden;
}
.bell-panel[hidden] { display: none; }
.bell-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.bell-head strong { font-size: 14px; color: var(--text); }
.bell-head .link-btn { font-size: 12.5px; }
.bell-list { overflow-y: auto; }
.bell-item { display: flex; gap: 10px; padding: 11px 14px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--border-soft); }
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { background: var(--primary-soft); }
.bell-item.unread:hover { filter: brightness(0.98); }
.bell-icon { flex-shrink: 0; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--info-bg); color: var(--info); }
.bell-icon.bell-post_reported { background: var(--bad-bg); color: var(--bad); }
.bell-icon.bell-member_joined { background: var(--good-bg); color: var(--good); }
.bell-icon.bell-announcement_request { background: var(--warn-bg); color: var(--warn); }
.bell-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bell-text strong { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; }
.bell-text small { font-size: 12.5px; color: var(--muted); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bell-text em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.bell-empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; }
.bell-more { border: 0; border-top: 1px solid var(--border-soft); background: var(--surface); color: var(--primary); font-weight: 600; padding: 10px; cursor: pointer; }
.bell-more[hidden] { display: none; }
@media (max-width: 640px) { .topbar { padding: 12px 16px; } .bell-panel { right: -44px; } }
#requests { scroll-margin-top: 90px; }

/* ---------- Usage analytics ---------- */
/* Chart mark color: validated steps of the brand teal (chroma + lightness band) for each surface. */
:root { --chart-1: #0a7aa6; --chart-wash: rgba(10, 122, 166, 0.10); }
:root[data-theme="dark"] { --chart-1: #35a0cb; --chart-wash: rgba(53, 160, 203, 0.12); }

.usage-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.usage-filters .seg button { min-height: 38px; }
.usage-privacy { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); margin: 0 0 18px; max-width: 760px; line-height: 1.5; }
.usage-privacy svg { flex-shrink: 0; margin-top: 1px; }
.is-loading { opacity: 0.55; transition: opacity 0.15s; }

.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; min-width: 0; }
.kpi .kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi .kpi-value { font-size: 26px; font-weight: 650; color: var(--text); margin-top: 6px; line-height: 1.15; overflow-wrap: anywhere; }
.kpi .kpi-value.small { font-size: 17px; }
.kpi .kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 600; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }

.chart-card { position: relative; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-head h2 { margin: 0; }
.chart-head p { margin: 0; font-size: 12.5px; color: var(--muted); }
.daily-chart { width: 100%; height: 240px; display: block; touch-action: pan-y; }
.daily-chart .grid { stroke: var(--border-soft); stroke-width: 1; }
.daily-chart .axis-text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.daily-chart .line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.daily-chart .area { fill: var(--chart-wash); }
.daily-chart .crosshair { stroke: var(--muted); stroke-width: 1; }
.daily-chart .dot { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }
.daily-chart .end-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; color: var(--muted); min-width: 150px;
}
.chart-tip[hidden] { display: none; }
.chart-tip .tip-date { font-size: 12px; margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; }
.chart-tip .tip-row strong { color: var(--text); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.chart-tip .key { width: 12px; height: 2px; border-radius: 1px; background: var(--chart-1); }
.chart-table summary { cursor: pointer; font-size: 12.5px; color: var(--primary); font-weight: 600; margin-top: 8px; }
.chart-table table { margin-top: 8px; font-variant-numeric: tabular-nums; }

.feature-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.feature-group + .feature-group { margin-top: 18px; }
.feature-group h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
.feature-group h3 small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.feature-row {
  display: grid; grid-template-columns: minmax(150px, 260px) 1fr 84px; gap: 14px; align-items: center;
  padding: 5px 6px; border-radius: 8px; outline: none;
}
.feature-row:hover, .feature-row:focus-visible { background: var(--surface-2); }
.feature-row:focus-visible { box-shadow: 0 0 0 2px var(--primary); }
.feature-name { font-size: 13.5px; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.feature-name small { display: block; color: var(--muted); font-size: 11.5px; }
.feature-track { display: flex; align-items: center; gap: 8px; min-width: 0; height: 24px; }
.feature-bar { height: 14px; min-width: 2px; background: var(--chart-1); border-radius: 0 4px 4px 0; flex-shrink: 0; transition: width 0.2s; }
.feature-bar.zero { background: var(--border); }
.feature-value { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.feature-delta { text-align: right; }
@media (max-width: 900px) { .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .feature-row { grid-template-columns: 1fr 64px; }
  .feature-track { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- Member warnings ---------- */
.warn-table td { vertical-align: top; }
.warn-table td.by small, .warn-table td.by .danger-text { display: block; margin-top: 2px; }
.warn-reason { max-width: 320px; }
.warn-status small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.warn-table tr.is-revoked td { opacity: 0.6; }
.warn-table tr.is-revoked td.warn-status { opacity: 1; }
.bell-icon.bell-warning_issued { background: var(--bad-bg); color: var(--bad); }
.warn-box { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto; }
.pick-list { margin-top: 8px; max-height: 220px; overflow-y: auto; }
.pick-row { width: 100%; text-align: left; background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.pick-row:hover { border-color: var(--primary); }
.picked { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--primary); border-radius: 10px; background: var(--primary-soft); }
.picked[hidden] { display: none; }
.picked small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.warn-table td:first-child { min-width: 0; white-space: nowrap; }
.warn-table td { padding-left: 14px; padding-right: 14px; }
.warn-table td.given { white-space: normal; min-width: 150px; max-width: 200px; color: var(--text); }
.warn-reason { max-width: 260px; }
.warn-table td.warn-status { min-width: 150px; }
.warn-table td.warn-reason, .warn-table td.warn-reason small { white-space: normal; }

/* ---------- Support tickets ---------- */
.bell-icon.bell-ticket_new, .bell-icon.bell-ticket_reopened { background: var(--warn-bg); color: var(--warn); }
.bell-icon.bell-ticket_escalated { background: var(--bad-bg); color: var(--bad); }
.ticket-table { min-width: 940px; }
.ticket-table td { vertical-align: top; padding-left: 14px; padding-right: 14px; }
.ticket-table td:first-child { min-width: 260px; }
.ticket-table tbody tr { cursor: pointer; }
.ticket-table tbody tr:hover td { background: var(--surface-2); }
.ticket-table tbody tr:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.ticket-table td small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.ticket-subj { max-width: 360px; }
.ticket-subj strong { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.ticket-subj .preview { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.ticket-no { font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; color: var(--muted); font-size: 12px; font-weight: 600; margin-right: 6px; }
.new-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-right: 6px; vertical-align: 1px; }
.pill.st-open { background: var(--info-bg); color: var(--info); }
.pill.st-in_progress { background: var(--warn-bg); color: var(--warn); }
.pill.st-resolved { background: var(--good-bg); color: var(--good); }
.pill.st-closed, .pill.pr-low { background: var(--border-soft); color: var(--muted); }
.pill.pr-high { background: var(--bad-bg); color: var(--bad); }
.pill.pr-normal { background: var(--border-soft); color: var(--text-2); }
.pill.to-admin { background: var(--primary-soft); color: var(--primary); }
.pill.to-village { background: var(--info-bg); color: var(--info); }
.ticket-photo img { max-width: 100%; max-height: 280px; border-radius: 10px; border: 1px solid var(--border); display: block; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-msg { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.tl-msg.from-member { background: var(--bg); }
.tl-msg.from-handler { background: var(--primary-soft); border-color: transparent; }
.tl-msg.internal { background: var(--warn-bg); border: 1px dashed var(--warn); }
.tl-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.tl-head strong { color: var(--text); font-weight: 600; }
.tl-tag { font-weight: 700; color: var(--warn); text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.05em; margin-left: 6px; }
.tl-body { font-size: 13.5px; color: var(--text); white-space: pre-wrap; line-height: 1.5; overflow-wrap: anywhere; }
.tl-event { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; padding: 0 4px; }
.tl-event::before { content: ""; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: 0.6; transform: translateY(-1px); }
.tl-event strong { color: var(--text-2); font-weight: 600; }
.tl-event.internal { font-style: italic; }
.manage-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.manage-row > label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin: 0; }
.manage-row select { min-width: 150px; }
.drawer-foot.reply-foot { flex-direction: column; align-items: stretch; gap: 8px; }
.reply-foot textarea { width: 100%; min-height: 72px; resize: vertical; }
.reply-foot.internal textarea { background: var(--warn-bg); border-color: var(--warn); }
.reply-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin: 0; cursor: pointer; }
.check-inline input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--warn); }

/* ---------- Ad popup frequency ---------- */
.popup-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 14px; border: 1px dashed var(--border); border-radius: 12px; }
.popup-settings.is-off { opacity: 0.55; }
.popup-settings .popup-summary { grid-column: 1 / -1; margin: 0; }
.inline-fields { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-fields select { flex: 1 1 140px; width: auto; }
.inline-fields input[type="number"] { flex: 0 1 110px; width: 110px; }
.inline-fields [hidden] { display: none; }
@media (max-width: 640px) { .popup-settings { grid-template-columns: 1fr; } }

/* ---------- Comments moderation ---------- */
.bell-icon.bell-comment_reported { background: var(--bad-bg); color: var(--bad); }
.comment-table { min-width: 860px; }
.comment-table td { vertical-align: top; padding-left: 14px; padding-right: 14px; }
.comment-table td:first-child { min-width: 260px; white-space: normal; }
.comment-body p { margin: 0 0 4px; font-size: 13.5px; color: var(--text); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 380px; }
.comment-body small, .comment-table td.by small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.comment-on small { white-space: normal; max-width: 220px; }
.comment-table tr.is-revoked td { opacity: 0.6; }
.comment-table tr.is-revoked td.actions, .comment-table tr.is-revoked td.warn-status { opacity: 1; }
.comment-table td.actions { min-width: 150px; }
.comment-table td.actions .row-toggle { margin: 0 6px 6px 0; }

/* ---------- Ad target areas ---------- */
.target-settings { padding: 14px; border: 1px dashed var(--border); border-radius: 12px; }
.target-settings .seg { margin-bottom: 10px; }
.area-search { position: relative; }
.area-search input[type="search"] { width: 100%; min-width: 0; }
.area-results {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px;
}
.area-results[hidden] { display: none; }
.area-option {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.area-option:hover, .area-option:focus-visible { background: var(--primary-soft); outline: none; }
.area-option:disabled { opacity: 0.45; cursor: default; background: none; }
.area-tag { flex-shrink: 0; min-width: 64px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.area-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.area-name small { color: var(--muted); font-size: 12px; margin-left: 4px; }
.area-count { flex-shrink: 0; font-size: 12px; color: var(--muted); }
.area-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.area-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 600;
}
.area-chip em { font-style: normal; font-size: 10.5px; font-weight: 700; text-transform: uppercase; opacity: 0.75; }
.area-chip button { width: 24px; height: 24px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 16px; line-height: 1; cursor: pointer; }
.area-chip button:hover { background: rgba(0, 0, 0, 0.08); }
.reach-text { margin: 10px 0 0; }
.ad-areas { color: var(--text-2); }

/* ---------- Usage: most searched & trending topics ---------- */
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.insight-grid .panel { margin: 0; min-width: 0; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 9px 4px; border-bottom: 1px solid var(--border-soft); }
.rank-row:last-child { border-bottom: 0; }
.rank-no { font-size: 12px; font-weight: 700; color: var(--muted); text-align: right; padding-top: 2px; font-variant-numeric: tabular-nums; }
.rank-main { min-width: 0; }
.rank-name { font-size: 13.5px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.rank-track { height: 6px; margin-top: 6px; border-radius: 3px; background: var(--border-soft); overflow: hidden; }
.rank-bar { height: 100%; background: var(--chart-1); border-radius: 3px; }
.rank-meta { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.rank-value { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; }
.rank-value strong { font-size: 14px; color: var(--text); }
.rank-empty { padding: 18px 4px; color: var(--muted); font-size: 13.5px; }
@media (max-width: 1000px) { .insight-grid { grid-template-columns: 1fr; } }

/* Referrals: filtered result count + clear */
.filter-summary { display: flex; align-items: center; gap: 12px; margin: -4px 0 12px; font-size: 13px; color: var(--muted); }
.filter-summary[hidden] { display: none; }

/* ---------- System health ---------- */
.health-banner {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 18px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
}
.health-banner .health-dot { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--border-soft); color: var(--muted); }
.health-banner .health-dot .icon { width: 20px; height: 20px; }
.health-banner.is-ok .health-dot { background: var(--good-bg); color: var(--good); }
.health-banner.is-warn .health-dot { background: var(--warn-bg); color: var(--warn); }
.health-banner.is-fail { border-color: var(--bad); background: var(--bad-bg); }
.health-banner.is-fail .health-dot { background: var(--bad); color: #fff; }
.health-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.health-text strong { font-size: 16px; color: var(--text); overflow-wrap: anywhere; }
.health-text span { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; margin: 26px 0 12px; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-top: 10px; }
.check-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; min-width: 0; }
.check-card strong { font-size: 13.5px; color: var(--text); }
.check-card p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.check-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.check-icon .icon { width: 15px; height: 15px; }
.check-word { margin-left: 8px; font-size: 11.5px; font-weight: 650; }
.check-card.is-ok .check-icon { background: var(--good-bg); color: var(--good); }
.check-card.is-ok .check-word { color: var(--good); }
.check-card.is-warn { border-color: var(--warn); }
.check-card.is-warn .check-icon { background: var(--warn-bg); color: var(--warn); }
.check-card.is-warn .check-word { color: var(--warn); }
.check-card.is-fail { border-color: var(--bad); background: var(--bad-bg); }
.check-card.is-fail .check-icon { background: var(--bad); color: #fff; }
.check-card.is-fail .check-word { color: var(--bad); }
.check-card.is-info .check-icon { background: var(--info-bg); color: var(--info); }
.check-card.is-info .check-word { color: var(--info); }

.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin: 4px 0 8px; }
.chart-legend span, .disk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key, .chart-tip .key.key-ok, .chart-tip .key.key-err { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.key-ok { background: var(--chart-1) !important; }
.key-err { background: var(--bad) !important; }
.rpm-chart { width: 100%; height: 200px; display: block; touch-action: pan-y; }
.rpm-chart .grid { stroke: var(--border-soft); stroke-width: 1; }
.rpm-chart .axis-text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.rpm-chart .bar-ok { fill: var(--chart-1); }
.rpm-chart .bar-err { fill: var(--bad); }
.rpm-chart .hover-col { fill: var(--text); opacity: 0.06; }

.route-table th.num, .route-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.route-table td { white-space: nowrap; }
.route-table code, .error-list code { font-size: 12.5px; color: var(--text); }
.method { display: inline-block; min-width: 50px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; color: var(--muted); }
.route-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.route-status .icon { width: 14px; height: 14px; }
.route-status.is-ok { color: var(--good); }
.route-status.is-warn { color: var(--warn); }
.route-status.is-fail { color: var(--bad); }
.bad-text { color: var(--bad) !important; font-weight: 600; }
.error-list { list-style: none; margin: 8px 0 0; padding: 0; }
.error-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 2px; border-bottom: 1px solid var(--border-soft); }
.error-list li:last-child { border-bottom: 0; }
.error-when { margin-left: auto; font-size: 12px; color: var(--muted); }

.storage-grid { margin: 0 0 16px; }
.disk-meter { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; background: var(--border-soft); margin-top: 12px; }
.disk-seg { height: 100%; }
.seg-app { background: var(--chart-1); }
.seg-other { background: var(--muted); opacity: 0.55; }
.seg-free { background: var(--border-soft); border: 1px solid var(--border); }
.disk-legend { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.disk-legend .key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.disk-legend strong { color: var(--text); margin-left: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .health-banner { flex-wrap: wrap; }
  .health-banner .refresh { width: 100%; }
  .error-when { margin-left: 0; width: 100%; }
}
/* Terms & Conditions: one tab per language, with a small formatting bar */
.terms-langs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.terms-lang-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.terms-lang-row > div { flex: 1; min-width: 180px; }
.format-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.format-bar .btn-ghost { min-height: 32px; padding: 4px 12px; }
.format-bar .bold-btn { font-weight: 800; }
/* Cities & villages */
.city-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.city-filters input[type="search"] { flex: 1; min-width: 200px; }
.city-filters select { min-width: 160px; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid var(--primary); border-radius: 10px; background: var(--primary-soft); }
.bulk-bar[hidden] { display: none; }
.bulk-bar span { font-weight: 600; margin-right: auto; }
.check-col { width: 36px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; }
/* Comma-separated lists shown as capsules (village festivals, languages) */
.capsules { display: flex; flex-wrap: wrap; gap: 6px; }
.capsule { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--border-soft);
  font-size: 13px; font-weight: 550; color: var(--text); }
/* System health: what went wrong, under each error */
.error-list .error-why { flex-basis: 100%; margin: 2px 0 0; padding: 8px 10px; border-left: 3px solid var(--bad);
  background: var(--bad-bg); border-radius: 6px; }
.error-list .error-msg { font-size: 13px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.error-list .error-meta { font-size: 12px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.privacy-title { margin-top: 26px; }
.tree-search { margin: 14px 0 4px; }
.tree-search input { width: 100%; max-width: 420px; }

/* ---------------------------------------------------------- pill switch */
/* A big two- or three-way switch (content.html: Requests | Announcements | Events):
   a soft track with the chosen option as a dark raised pill. */
.pill-switch { display: inline-flex; gap: 4px; padding: 6px; background: var(--border-soft); border: 1px solid var(--border); border-radius: 20px; }
.pill-switch button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 28px; border: 0; border-radius: 14px;
  background: transparent; color: var(--text); font-size: 15px; font-weight: 500; cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.pill-switch button:hover:not(.active) { background: rgba(127, 127, 127, 0.1); }
.pill-switch button.active { background: var(--text); color: var(--surface); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28); }
.pill-switch-count { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1.5; }
.pill-switch-count[hidden] { display: none; }
@media (max-width: 600px) {
  .pill-switch { display: flex; width: 100%; }
  .pill-switch button { flex: 1; padding: 10px 6px; font-size: 14px; }
}
