/*!
Theme Name: Purple Moon Systems
Theme URI: https://www.purplemoondesigns.co.uk/
Author: Purple Moon Designs
Author URI: https://www.purplemoondesigns.co.uk
Description: A reusable base theme for Purple Moon Designs application projects — internal operations tools and client login/member portals. Ships the pmd framework (CPT + AJAX + Modal), role-based access, branded email, Cloudflare R2 media offload, Twilio 2FA login, PWA scaffold and an audit log. Brand everything per project from a single style-guide.php. Built on a WordPress + ACF Pro + Tailwind stack.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: purplemoonsystems

This theme is intended as a starting point. Per project: fill in the brand tokens
in the :root block below (this file is the live stylesheet), preview them on the
hub Style tab (renatas/style-guide.php), then build features with pmd_cpt() +
pmd_ajax() + pmd_modal_*(). See CLAUDE.md.
*/

/* =============================================================================
 * DESIGN TOKENS — single source of truth for the whole UI.
 *
 * Every component (including the pmd-modal system) reads these variables with a
 * fallback. Re-skin an entire project by editing ONLY this block, or by setting
 * the same variables inside pages/style-guide.php for that project.
 *
 * The default values below are a deliberately neutral Purple Moon house palette.
 * Swap --ac / --ach / --acbg for the client's brand colour and you're themed.
 * Keep the same block in sync in renatas/style-guide.php (hub Style tab).
 * ============================================================================= */
:root {
	/* BNI Evergreen — tokens from system-demo/src/data/styleGuide.ts (warm stone neutrals, BNI red).
	 * Mirrored in renatas/style-guide.php. */

	/* Surfaces */
	--bg:   #ffffff;   /* surface — cards, modals, header */
	--s1:   #fafaf9;   /* canvas — page background */
	--s2:   #f3f1ee;   /* subtle — hover, neutral chips */
	--s3:   #f3f1ee;   /* app chrome */

	/* Text */
	--t:    #1c1917;   /* ink — primary text */
	--tm:   #44403c;   /* body text */
	--td:   #78716c;   /* muted — labels, secondary text */

	/* Borders */
	--bd:   #e7e5e4;   /* line — hairlines, input borders */

	/* Brand accent — BNI red, spent on the primary action and genuine urgency */
	--ac:   #cf2030;   /* accent */
	--ach:  #b51b29;   /* accent hover */
	--acbg: #fdecee;   /* accent soft — active nav, red chips */
	--ac2:  #cf2030;   /* no gradient in this brand */
	--acline: #f6c7cc; /* accent line — in-person tag border */
	--acwash: #fffbfb; /* accent wash — urgent hero surface only */

	/* Status — each colour means one thing */
	--gn:   #15803d;   --gnbg: #eaf6ee;   --gnline: #bbe3c8;   --gnh: #116631;   /* paid, confirmed, save/confirm buttons */
	--vip: #0f3d2a;   --gold: #d4af37;   /* VIP (visitor) badge: dark green with gold lettering */
	--am:   #b45309;   --ambg: #fbf1e3;                        /* due soon, part paid */
	--rd:   #cf2030;                                           /* danger = accent */
	--bl:   #3a5a78;   --blbg: #eef3f8;                        /* info, planned */

	/* Radius scale */
	--r:    8px;       /* inputs, buttons */
	--rm:   12px;      /* cards, modals */
	--rs:   6px;       /* chips */

	/* Elevation — hairlines separate; shadows are rare */
	--shadow-soft: 0 1px 2px rgba(28,25,23,.04);
	--shadow-md:   0 4px 24px -6px rgba(28,25,23,.12);
	--shadow-xl:   0 12px 40px -8px rgba(28,25,23,.18);

	/* Type — Inter throughout */
	--font-heading: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
	--font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
	--f:  var(--font-body);
	--fd: var(--font-heading);
}

/* =============================================================================
 * MINIMAL RESET / BASE
 * Tailwind (loaded per-page or via build) handles utilities. This file owns
 * brand tokens + the app shell structure so it survives Tailwind JIT purging.
 * ============================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-body); color: var(--t); background: var(--s1); }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ac); text-decoration: none; }
a:hover { color: var(--ach); }

.content_wrap { max-width: 1400px; width: 90%; margin: 0 auto; }
.screen-reader-text { position: absolute !important; clip: rect(1px,1px,1px,1px); width: 1px; height: 1px; overflow: hidden; }

/* =============================================================================
 * APP SHELL — sidebar + main, both fully token-driven.
 * Class prefix: pms-  (rename freely; keep prefixes consistent per project)
 * ============================================================================= */
.pms-app { display: flex; min-height: 100vh; background: var(--s1); }

.pms-sidebar {
	width: 248px; flex: 0 0 248px;
	background: var(--bg);
	border-right: 1px solid var(--bd);
	padding: 20px 14px;
	display: flex; flex-direction: column; gap: 4px;
	position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.pms-sidebar__brand { font-family: var(--font-heading); font-weight: 700; font-size: 18px; color: var(--ac); padding: 6px 10px 18px; letter-spacing: -.3px; }

.pms-sidebar__item {
	display: flex; align-items: center; gap: 12px;
	padding: 10px 12px; border-radius: var(--r);
	color: var(--tm); font-weight: 500; font-size: 14px;
	transition: background .15s ease, color .15s ease;
}
.pms-sidebar__item:hover { background: var(--s2); color: var(--t); }
.pms-sidebar__item--active,
.pms-sidebar__item--active:hover {
	background: linear-gradient(to right, var(--ac), var(--ac2));
	color: #fff;
}
.pms-sidebar__icon { width: 18px; height: 18px; flex: 0 0 18px; color: currentColor; }

.pms-sidebar__user { margin-top: auto; padding: 12px 10px; border-top: 1px solid var(--bd); font-size: 13px; color: var(--tm); }
.pms-sidebar__user-name { color: var(--t); font-weight: 600; }
.pms-sidebar__user-role { color: var(--td); font-size: 12px; }

.pms-main { flex: 1 1 auto; min-width: 0; padding: 28px 32px; }

/* Generic card surface */
.pms-card { background: var(--bg); border: 1px solid var(--bd); border-radius: var(--rm); box-shadow: var(--shadow-soft); padding: 24px; }

/* Buttons (also documented in style-guide.php). Variants are .pms-btn.pms-btn--x so they beat
   Tailwind's preflight [type=submit] { background-color: initial }, which loads after this file. */
.pms-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--r); font-family: var(--font-body); font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid transparent; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.pms-btn.pms-btn--primary { background: var(--ac); color: #fff; }
.pms-btn.pms-btn--primary:hover { background: var(--ach); color: #fff; }
.pms-btn.pms-btn--secondary { background: var(--bg); color: var(--t); border-color: var(--bd); }
.pms-btn.pms-btn--secondary:hover { background: var(--s2); }
.pms-btn.pms-btn--ghost { background: transparent; color: var(--tm); }
.pms-btn.pms-btn--ghost:hover { background: var(--s2); color: var(--t); }
.pms-btn.pms-btn--destructive { background: var(--rd); color: #fff; }
.pms-btn.pms-btn--destructive:hover { filter: brightness(.92); }

/* Badges / status pills */
.pms-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4; }
.pms-pill--green { background: rgba(21,128,61,.10); color: var(--gn); }
.pms-pill--amber { background: rgba(180,83,9,.10);  color: var(--am); }
.pms-pill--red   { background: rgba(185,28,28,.10); color: var(--rd); }
.pms-pill--blue  { background: rgba(29,78,216,.10); color: var(--bl); }
.pms-pill--gray  { background: var(--s2); color: var(--tm); }

/* Action-menu portal target (see CLAUDE.md — dropdowns are portalled to body) */
.pms-dropdown { position: fixed; z-index: 9999; min-width: 176px; background: var(--bg); border: 1px solid var(--bd); border-radius: var(--r); box-shadow: var(--shadow-md); padding: 6px; }

/* Responsive: collapse sidebar to top bar on narrow / mobile (PWA views) */
@media (max-width: 880px) {
	.pms-app { flex-direction: column; }
	.pms-sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; overflow-x: auto; }
	.pms-sidebar__user { margin-top: 0; border-top: 0; }
	.pms-main { padding: 18px 16px; }
}

/* =============================================================================
 * BNI EVERGREEN — chapter operations UI (evg-*)
 * Component styles for pages/evg-*.php. Translated from system-demo
 * (Magic Patterns) — see renatas/style-guide.php for the rendered reference.
 * Principles: action before status · money is exact and derived ·
 * phone in the meeting, laptop for the month · one accent, spent on urgency.
 * ============================================================================= */
body.pms-app-body { background: var(--s1); color: var(--t); -webkit-font-smoothing: antialiased; font-size: 14px; }
.pms-app--topbar { flex-direction: column; }
.pms-app--topbar .pms-main { padding: 0; }
.evg-num, .evg-table td.num, .evg-kpi__value { font-variant-numeric: tabular-nums; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.evg-topbar { position: sticky; top: 0; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--bd); }
.evg-topbar__inner { max-width: 1400px; margin: 0 auto; height: 48px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.evg-topbar__brand { display: flex; align-items: baseline; gap: 8px; color: var(--t); white-space: nowrap; }
.evg-topbar__brand:hover { color: var(--t); }
.evg-topbar__name { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.evg-topbar__kicker { font-size: 11px; font-weight: 500; color: var(--td); }
.evg-nav { display: flex; align-items: center; gap: 2px; }
.evg-nav__link { white-space: nowrap; border-radius: var(--rs); padding: 6px 8px; font-size: 12px; font-weight: 500; color: var(--td); transition: background-color .15s ease-out, color .15s ease-out; }
.evg-nav__link:hover { background: var(--s2); color: var(--t); }
.evg-nav__link.is-active { background: var(--acbg); color: var(--ac); font-weight: 700; }
.evg-topbar__right { display: flex; align-items: center; gap: 12px; }
.evg-topbar__sys { color: var(--td); display: inline-flex; }
.evg-topbar__sys svg, .evg-menubtn svg { width: 18px; height: 18px; }
.evg-usermenu { position: relative; }
.evg-usermenu summary { list-style: none; cursor: pointer; }
.evg-usermenu summary::-webkit-details-marker { display: none; }
.evg-avatar { width: 28px; height: 28px; border-radius: 999px; background: var(--ac); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.evg-usermenu__panel { position: absolute; right: 0; top: 36px; min-width: 200px; background: var(--bg); border: 1px solid var(--bd); border-radius: var(--rm); box-shadow: var(--shadow-md); padding: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--td); z-index: 50; }
.evg-usermenu__panel strong { color: var(--t); font-size: 13px; }
.evg-usermenu__panel a { margin-top: 8px; display: flex; align-items: center; gap: 6px; color: var(--t); font-weight: 600; }
.evg-usermenu__panel a svg { width: 14px; height: 14px; }
.evg-menubtn { display: none; background: none; border: 0; padding: 6px; border-radius: var(--rs); color: var(--t); cursor: pointer; }
.evg-menubtn:hover { background: var(--s2); }
.evg-mobilenav { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 12px 16px; border-top: 1px solid var(--bd); }
.evg-mobilenav[hidden] { display: none; }
.evg-mobilenav__group { grid-column: 1 / -1; padding: 8px 12px 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--td); }
.evg-navgroup { position: relative; }
.evg-navgroup summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.evg-navgroup summary::-webkit-details-marker { display: none; }
.evg-navgroup summary svg { width: 13px; height: 13px; transition: transform .15s ease-out; }
.evg-navgroup[open] summary svg { transform: rotate(180deg); }
.evg-navgroup__panel { position: absolute; left: 0; top: calc(100% + 6px); min-width: 180px; background: var(--bg); border: 1px solid var(--bd); border-radius: var(--rm); box-shadow: var(--shadow-md); padding: 6px; display: flex; flex-direction: column; gap: 2px; z-index: 50; }
.evg-navgroup__link { display: block; padding: 8px 10px; border-radius: var(--rs); font-size: 13px; font-weight: 500; color: var(--t); white-space: nowrap; }
.evg-navgroup__link:hover { background: var(--s2); color: var(--t); }
.evg-navgroup__link.is-active { background: var(--acbg); color: var(--ac); font-weight: 700; }
.evg-mobilenav .evg-nav__link { font-size: 13px; padding: 8px 12px; color: var(--t); }
@media (max-width: 1279px) { .evg-nav { display: none; } .evg-menubtn { display: inline-flex; } }
@media (min-width: 640px) { .evg-mobilenav { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 639px) { .evg-topbar__kicker { display: none; } .evg-topbar__inner { padding: 0 16px; } }

/* ── Page ────────────────────────────────────────────────────────────────── */
.evg-page { max-width: 1400px; margin: 0 auto; padding: 16px 24px 48px; }
@media (max-width: 639px) { .evg-page { padding: 12px 16px 40px; } }
.evg-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding-bottom: 12px; }
.evg-pagehead__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.evg-h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin: 0; color: var(--t); }
.evg-sub { margin: 2px 0 0; font-size: 12px; color: var(--td); }
.evg-back { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--td); margin-bottom: 6px; }
.evg-back:hover { color: var(--t); }
.evg-back svg { width: 14px; height: 14px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.evg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r); border: 1px solid transparent; font-family: var(--font-body); font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap; transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out; text-decoration: none; }
.evg-btn svg { width: 15px; height: 15px; }
.evg-btn.evg-btn--primary { background: var(--gn); color: #fff; }
.evg-btn.evg-btn--primary:hover { background: var(--gnh); color: #fff; }
/* Save / confirm in every pmd modal = green. Destructive submits use primary_variant => 'danger'. */
.pmd-modal .pmd-modal__btn--primary { background: var(--gn); border-color: var(--gn); }
.pmd-modal .pmd-modal__btn--primary:hover:not(:disabled) { background: var(--gnh); border-color: var(--gnh); }
.pmd-modal .pmd-modal__btn--solid-danger { background: var(--rd); border-color: var(--rd); color: #fff; }
.pmd-modal .pmd-modal__btn--solid-danger:hover:not(:disabled) { filter: brightness(.92); }
.evg-btn.evg-btn--secondary { background: var(--bg); color: var(--t); border-color: var(--bd); }
.evg-btn.evg-btn--secondary:hover { background: var(--s2); color: var(--t); }
.evg-btn.evg-btn--ghost { background: transparent; color: var(--td); padding: 0 8px; }
.evg-btn.evg-btn--ghost:hover { background: var(--s2); color: var(--t); }
.evg-btn.evg-btn--danger { background: var(--bg); color: var(--ac); border-color: var(--acline); }
.evg-btn.evg-btn--danger:hover { background: var(--acbg); }
.evg-btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }
.evg-btn--lg { height: 40px; padding: 0 18px; font-size: 14px; }
.evg-btn[disabled] { opacity: .5; cursor: default; }

/* ── Chips ───────────────────────────────────────────────────────────────── */
.evg-chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--s2); color: var(--tm); }
.evg-chip--ok { background: var(--gnbg); color: var(--gn); }
.evg-chip--warn { background: var(--ambg); color: var(--am); }
.evg-chip--accent { background: var(--acbg); color: var(--ac); }
.evg-chip--info { background: var(--blbg); color: var(--bl); }
.evg-chip--vip { background: var(--vip); color: var(--gold); font-weight: 800; letter-spacing: .06em; }
.evg-chip--new { background: var(--gn); color: #fff; font-weight: 700; }
.evg-chip--solid { background: var(--ac); color: #fff; font-weight: 800; letter-spacing: .03em; }
.evg-chip--inperson { background: var(--bg); color: var(--ac); border: 1px solid var(--acline); }
.evg-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; display: inline-block; }
@media (prefers-reduced-motion: no-preference) { .evg-dot--pulse { animation: evg-pulse 1.6s ease-in-out infinite; } }
@keyframes evg-pulse { 50% { opacity: .35; } }

/* ── Cards, KPIs, layout ─────────────────────────────────────────────────── */
.evg-card { background: var(--bg); border: 1px solid var(--bd); border-radius: var(--rm); padding: 16px; min-width: 0; }
@media (min-width: 640px) { .evg-card { padding: 20px; } }
.evg-card--flush { padding: 0; overflow: hidden; }
.evg-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.evg-card--flush .evg-card__head { padding: 16px 20px 0; }
.evg-card__title { font-size: 14px; font-weight: 700; margin: 0; color: var(--t); }
.evg-card__meta { font-size: 12px; color: var(--td); margin: 2px 0 0; }
.evg-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.evg-grid { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1024px) { .evg-grid--main { grid-template-columns: 1.7fr 1fr; } .evg-grid--2 { grid-template-columns: 1fr 1fr; } .evg-grid--side { grid-template-columns: 2fr 1fr; } }
.evg-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--bd); border: 1px solid var(--bd); border-radius: var(--rm); overflow: hidden; margin-bottom: 16px; }
@media (min-width: 640px) { .evg-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .evg-kpis { grid-template-columns: repeat(6, 1fr); } }
.evg-kpi { background: var(--bg); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.evg-kpi__label { font-size: 11px; font-weight: 600; color: var(--td); }
.evg-kpi__value { font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: var(--t); }
.evg-kpi__note { font-size: 11px; color: var(--td); }
.evg-kpi--accent .evg-kpi__value { color: var(--ac); }
.evg-kpi--ok .evg-kpi__value { color: var(--gn); }

/* ── Status banner (e.g. kitty transfer on Budget) ───────────────────────── */
.evg-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--bg); border: 1px solid var(--bd); border-radius: var(--rm); padding: 12px 16px; margin-bottom: 16px; font-size: 13px; }
.evg-banner--warn { border-color: var(--am); background: var(--ambg); }
.evg-banner--ok { border-color: var(--gnline); background: var(--gnbg); }
.evg-banner__text { flex: 1; min-width: 220px; color: var(--t); }
.evg-banner__text strong { font-weight: 700; }
.evg-banner__meta { display: block; font-size: 12px; color: var(--tm); margin-top: 2px; }
.evg-banner__actions { display: flex; align-items: center; gap: 8px; }

/* ── Headcount hero (the one urgent task) ────────────────────────────────── */
.evg-hero { background: var(--bg); border: 1px solid var(--bd); border-radius: var(--rm); padding: 16px; }
@media (min-width: 640px) { .evg-hero { padding: 20px; } }
.evg-hero--urgent { border: 1.5px solid var(--ac); background: var(--acwash); box-shadow: 0 2px 8px rgba(207,32,48,.10); }
.evg-hero--ok { border-color: var(--gnline); }
.evg-hero__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.evg-hero__due { font-size: 12px; font-weight: 700; color: var(--td); }
.evg-hero__due--tight { color: var(--ac); }
.evg-hero__title { margin: 12px 0 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; color: var(--t); }
.evg-hero__meta { margin: 2px 0 0; font-size: 13px; color: var(--td); }
.evg-hero form { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 24px; }
.evg-hero .pmd-modal__group { margin: 0; }
.evg-hero .pmd-modal__input { width: 110px; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.evg-hero__figure { display: flex; flex-direction: column; gap: 2px; }
.evg-hero__figure strong { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.evg-hero__figure small, .evg-label { font-size: 11px; font-weight: 600; color: var(--td); }
.evg-hero__actions { display: flex; gap: 8px; margin-left: auto; }
.evg-hero .pmd-modal__error { width: 100%; }
@media (max-width: 639px) { .evg-hero__actions { width: 100%; margin-left: 0; } .evg-hero__actions .evg-btn { flex: 1; } }

/* ── Lists (to-dos, announce, events) ────────────────────────────────────── */
.evg-list { list-style: none; margin: 0; padding: 0; }
.evg-list > li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--bd); }
.evg-list > li:first-child { border-top: 0; }
.evg-list__main { flex: 1 1 auto; min-width: 0; }
.evg-list__title { display: block; font-size: 13px; font-weight: 600; color: var(--t); }
.evg-list__meta { display: block; font-size: 12px; color: var(--td); margin-top: 1px; }
.evg-list__aside { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.evg-tone { width: 8px; height: 8px; border-radius: 999px; flex: 0 0 8px; background: var(--bd); }
.evg-tone--urgent { background: var(--ac); }
.evg-tone--warn { background: var(--am); }
.evg-tone--info { background: var(--bl); }
.evg-subhead { font-size: 11px; font-weight: 700; color: var(--td); text-transform: uppercase; letter-spacing: .05em; margin: 16px 0 4px; }
.evg-subhead:first-child { margin-top: 0; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.evg-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.evg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.evg-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--td); padding: 8px 12px; border-bottom: 1px solid var(--bd); white-space: nowrap; background: var(--bg); }
.evg-table td { padding: 9px 12px; border-bottom: 1px solid var(--bd); vertical-align: middle; color: var(--t); }
.evg-table tr:last-child td { border-bottom: 0; }
.evg-table tbody tr:hover td { background: var(--s1); }
.evg-table .num, .evg-table th.num { text-align: right; white-space: nowrap; }
.evg-table .muted { color: var(--td); }
.evg-table tfoot td { font-weight: 700; background: var(--s1); border-top: 1px solid var(--bd); }
.evg-table tr.is-muted td { color: var(--td); }
.evg-table tr.is-voided td { color: var(--td); text-decoration: line-through; }
.evg-table tr.is-inperson td:first-child { box-shadow: inset 3px 0 0 var(--ac); }
.evg-table tr.is-today td { background: #fff8e6; }
.evg-table a { color: var(--t); font-weight: 600; }
.evg-table a:hover { color: var(--ac); }
.evg-table .evg-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* Sortable headers: <button class="evg-sort" data-evg-sort="key"> in a th; rows carry data-sort-key. */
.evg-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.evg-sort:hover, .evg-sort:focus-visible { color: var(--t); }
.evg-sort::after { content: '↕'; font-size: 10px; opacity: .45; }
th[aria-sort="ascending"] .evg-sort::after { content: '↑'; opacity: 1; }
th[aria-sort="descending"] .evg-sort::after { content: '↓'; opacity: 1; }
.evg-only-mobile { display: none; }

/* .evg-table--cards: each row becomes a card under 640px. Cells need data-label; .evg-cards-title is the card heading. */
@media (max-width: 639px) {
	.evg-only-mobile { display: inline-block; }
	.evg-card--cards { background: transparent; border: 0; box-shadow: none; overflow: visible; }
	.evg-card--cards .evg-table-wrap { overflow: visible; }
	.evg-table--cards, .evg-table--cards tbody { display: block; }
	.evg-table--cards thead { display: none; }
	.evg-table--cards tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; background: var(--bg); border: 1px solid var(--bd); border-radius: var(--rm); box-shadow: var(--shadow-soft); padding: 14px 16px; margin-bottom: 10px; }
	.evg-table--cards tr[hidden] { display: none; }
	.evg-table--cards td { display: block; padding: 0; border: 0; min-width: 0; }
	.evg-table--cards tbody tr:hover td { background: transparent; }
	.evg-table--cards td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--td); margin-bottom: 2px; }
	.evg-table--cards .evg-cards-title { grid-column: 1 / -1; font-size: 15px; }
	.evg-table--cards .evg-cards-hide { display: none; }
	.evg-table--cards tr.is-inperson td:first-child { box-shadow: none; }
	.evg-table--cards tfoot { display: block; }
	.evg-table--cards tfoot tr { background: var(--s1); }
	.evg-table--cards tfoot td { background: transparent; border: 0; }
	.evg-table--cards .num { text-align: left; }
	.evg-table--cards .evg-cards-actions { grid-column: 1 / -1; }
	.evg-table--cards .evg-cards-actions .evg-actions { justify-content: flex-start; }
	.evg-table--cards .evg-cards-actions:has(.evg-actions:empty) { display: none; }
}

/* Actions dropdown (evg_actions_menu) — list is portalled to <body> with inline position:fixed */
.evg-menu { display: inline-block; }
.evg-menu__list { display: flex; flex-direction: column; gap: 2px; }
.evg-menu__list[hidden] { display: none; }
.evg-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--rs); background: none; font: inherit; font-size: 13px; font-weight: 500; color: var(--t); text-align: left; cursor: pointer; white-space: nowrap; }
.evg-menu__item:hover, .evg-menu__item:focus-visible { background: var(--s2); outline: none; }
.evg-menu__item svg { width: 16px; height: 16px; color: var(--tm); flex-shrink: 0; }
.evg-menu__item--danger, .evg-menu__item--danger svg { color: var(--rd); }
.evg-menu__item:disabled { opacity: .5; cursor: default; }

/* One-tap payment method buttons (visitor Mark as paid). Logos: drop assets/img/careem.svg / stripe.svg. */
.evg-paybtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px; }
.evg-paybtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px; border: 1.5px solid var(--bd); border-radius: var(--rm); background: var(--bg); color: var(--t); font: inherit; cursor: pointer; transition: border-color .15s ease-out, box-shadow .15s ease-out, background-color .15s ease-out; }
.evg-paybtn svg { width: 22px; height: 22px; color: var(--gn); }
.evg-paybtn:hover, .evg-paybtn:focus-visible { border-color: var(--gn); box-shadow: 0 0 0 3px var(--gnbg); outline: none; }
.evg-paybtn:disabled { opacity: .5; cursor: default; }
.evg-paybtn.is-busy { border-color: var(--gn); background: var(--gnbg); opacity: 1; }
.evg-paylogo { max-width: 88px; max-height: 30px; }
.evg-paymark { font-size: 20px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.evg-paymark--cash { font-size: 13px; color: var(--gn); }
.evg-paymark--dirham { font-size: 22px; color: var(--gn); font-family: 'Noto Naskh Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, sans-serif; direction: rtl; }
.evg-paymark--careem { color: #00b964; }  /* Careem green (brand colour, not a theme token) */
.evg-paymark--stripe { color: #635bff; }  /* Stripe blurple (brand colour, not a theme token) */

/* Bank details modal */
.evg-bank { margin: 0; font-size: 14px; }
.pmd-modal__btn svg { width: 15px; height: 15px; }
.evg-bank dt { color: var(--td); font-size: 12px; font-weight: 600; }
.evg-bank dt:not(:first-child) { margin-top: 12px; }
.evg-bank dd { margin: 2px 0 0; color: var(--t); font-weight: 600; word-break: break-all; }
.evg-owed { color: var(--ac); font-weight: 700; }
.evg-paid { color: var(--gn); font-weight: 600; }
.evg-out { color: var(--rd); font-weight: 600; }
/* Two-figure table cell: main figure (actual) + small sub line (expected). */
.evg-cell-main { font-size: 13px; font-weight: 600; }
.evg-cell-main--total { font-size: 14px; font-weight: 800; }
.evg-cell-sub { font-size: 10.5px; font-weight: 500; color: var(--td); margin-top: 1px; white-space: nowrap; } /* money out — pairs with .evg-paid for money in */

/* ── Filters / inline inputs ─────────────────────────────────────────────── */
.evg-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.evg-input, .evg-select { height: 34px; border: 1px solid var(--bd); border-radius: var(--r); background: var(--bg); padding: 0 10px; font: inherit; font-size: 13px; color: var(--t); }
.evg-input:focus, .evg-select:focus { outline: 2px solid var(--acbg); border-color: var(--ac); }
.evg-input--search { min-width: 220px; }
.evg-input--num { width: 88px; text-align: right; font-variant-numeric: tabular-nums; }
.evg-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.evg-tabs a { padding: 6px 10px; border-radius: var(--rs); font-size: 12px; font-weight: 600; color: var(--td); border: 1px solid var(--bd); background: var(--bg); }
.evg-tabs a.is-active { background: var(--acbg); color: var(--ac); border-color: var(--acline); }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.evg-empty { text-align: center; padding: 28px 16px; color: var(--td); font-size: 13px; }
.evg-empty p { margin: 0; }
.evg-muted { color: var(--td); }
.evg-note { font-size: 12px; color: var(--td); margin: 8px 0 0; }
.evg-bar { height: 6px; border-radius: 999px; background: var(--s2); overflow: hidden; min-width: 60px; }
.evg-bar > span { display: block; height: 100%; background: var(--gn); }
.evg-dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.evg-dl dt { color: var(--td); font-weight: 500; }
.evg-dl dd { margin: 0; color: var(--t); }
.evg-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.evg-stat { border: 1px solid var(--bd); border-radius: var(--r); padding: 8px 10px; }
.evg-stat span { display: block; font-size: 11px; color: var(--td); font-weight: 600; }
.evg-stat strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.evg-intro { font-size: 13px; line-height: 1.6; color: var(--tm); }
.evg-intro p { margin: 0 0 8px; }
.evg-intro b { color: var(--t); }
.evg-intro .evg-blank { color: var(--ac); font-weight: 600; }
.evg-toggle.evg-toggle { width: 28px; height: 28px; border-radius: var(--rs); border: 1px solid var(--bd); background: var(--bg); color: var(--td); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.evg-toggle svg { width: 14px; height: 14px; }
.evg-toggle.evg-toggle.is-on { background: var(--gnbg); border-color: var(--gnline); color: var(--gn); }
/* Chip that is a button (e.g. visitor "Not yet" → click to mark attended) */
button.evg-chip { border: 1px dashed var(--bd); cursor: pointer; font-family: inherit; }
button.evg-chip:hover { border-style: solid; border-color: var(--gn); background: var(--gnbg); color: var(--gn); }
.evg-queue li { padding: 8px 0; }
.evg-queue__n { width: 22px; font-size: 11px; color: var(--td); font-variant-numeric: tabular-nums; text-align: right; }

/* ── Events board + calendar ─────────────────────────────────────────────── */
.evg-board { display: grid; gap: 12px; }
@media (min-width: 900px) { .evg-board { grid-template-columns: repeat(4, 1fr); } }
.evg-board__col { background: var(--s2); border-radius: var(--rm); padding: 10px; min-width: 0; }
.evg-board__col h3 { font-size: 12px; font-weight: 700; margin: 2px 4px 8px; color: var(--tm); display: flex; justify-content: space-between; }
.evg-evcard { display: block; background: var(--bg); border: 1px solid var(--bd); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; color: var(--t); }
.evg-evcard:hover { border-color: var(--acline); color: var(--t); }
.evg-evcard strong { display: block; font-size: 13px; }
.evg-evcard span { display: block; font-size: 12px; color: var(--td); margin-top: 2px; }
.evg-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--bd); border: 1px solid var(--bd); border-radius: var(--rm); overflow: hidden; }
.evg-cal__h { background: var(--s1); font-size: 11px; font-weight: 600; color: var(--td); padding: 6px 8px; }
.evg-cal__d { background: var(--bg); min-height: 84px; padding: 6px 8px; font-size: 11px; color: var(--td); }
.evg-cal__d.is-out { background: var(--s1); }
.evg-cal__d.is-today { box-shadow: inset 0 0 0 2px var(--ac); }
.evg-cal__d a, .evg-cal__d .evg-cal__tag { display: block; margin-top: 4px; font-size: 11px; font-weight: 600; color: var(--t); background: var(--blbg); border-radius: 4px; padding: 2px 4px; line-height: 1.3; }
.evg-cal__d .evg-cal__tag--meet { background: var(--acbg); color: var(--ac); }
@media (max-width: 639px) { .evg-cal__d { min-height: 56px; padding: 4px; } .evg-cal__d a, .evg-cal__d .evg-cal__tag { font-size: 10px; } }

/* ── Payment allocation (record payment modal) ──────────────────────────── */
.evg-alloc { border: 1px solid var(--bd); border-radius: var(--r); padding: 10px 12px; margin-bottom: 14px; }
.evg-alloc__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 13px; }
.evg-alloc__row small { color: var(--td); }
.evg-alloc__sum { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; border-top: 1px solid var(--bd); margin-top: 6px; padding-top: 8px; }
.evg-alloc__sum.is-off { color: var(--ac); }
.evg-preview { background: var(--s1); border: 1px dashed var(--bd); border-radius: var(--r); padding: 10px 12px; font-size: 12px; color: var(--tm); white-space: pre-wrap; margin-bottom: 14px; }

/* ── Printable invoice ───────────────────────────────────────────────────── */
.evg-invoice-body { background: var(--s2); }
.evg-invoice-bar { max-width: 760px; margin: 20px auto 0; display: flex; gap: 8px; justify-content: space-between; padding: 0 16px; }
.evg-invoice { max-width: 760px; margin: 16px auto 40px; background: #fff; border: 1px solid var(--bd); border-radius: var(--rm); padding: 48px; font-family: var(--font-body); color: var(--t); }
.evg-invoice__top { display: flex; justify-content: space-between; align-items: flex-start; }
.evg-invoice__brand { font-size: 26px; font-weight: 800; color: var(--ac); letter-spacing: -.02em; }
.evg-invoice__word { font-size: 22px; font-weight: 800; letter-spacing: .06em; }
.evg-invoice__meta { text-align: right; margin-top: 8px; font-size: 13px; line-height: 1.7; }
.evg-invoice__to { margin: 40px 0; font-size: 14px; line-height: 1.6; }
.evg-invoice__to b { display: block; font-size: 12px; color: var(--td); letter-spacing: .06em; }
.evg-invoice table { width: 100%; border-collapse: collapse; font-size: 14px; }
.evg-invoice th { background: var(--ac); color: #fff; text-align: left; padding: 10px 12px; font-size: 12px; letter-spacing: .06em; }
.evg-invoice td { padding: 12px; border-bottom: 1px solid var(--bd); }
.evg-invoice .num { text-align: right; font-variant-numeric: tabular-nums; }
.evg-invoice__thanks { margin-top: 40px; font-weight: 800; color: var(--ac); letter-spacing: .04em; }
.evg-invoice__void { margin-top: 16px; color: var(--ac); font-weight: 700; }
@media print { .evg-invoice-bar { display: none; } .evg-invoice-body { background: #fff; } .evg-invoice { border: 0; margin: 0 auto; } }
