/* ==========================================================================
   نظام العوائل والقبائل (Family CMS) — Admin & role dashboards
   هوية هادئة متناغمة مع الثيم التقليدي لموقع العائلة:
   Sidebar أخضر مزرق عميق #173f39 بمؤشر ذهبي، خلفية كريمية، بطاقات بيضاء، لمسات ذهبية.
   Builds on ../../../shared/css/base.css
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Aref+Ruqaa:wght@400;700&display=swap");

:root {
  --brand: #1f6b5c;          /* deep teal-green — links, tabs, focus, active states */
  --brand-600: #1d5c52;
  --brand-700: #174a42;
  --brand-soft: #e5f0ec;
  --gold: #c9a14a;
  --gold-light: #e6c97f;
  --gold-soft: #f6eedb;
  --brown: #2b2118;
  --navy: #173f39;           /* var names kept from the family of systems */
  --navy-2: #1e4d45;
  --navy-3: #1f6b5c;
  --teal: #1f6b5c;
  --teal-soft: #dcefe9;
  --accent: #c9a14a;
  --accent-soft: #f6eedb;
  --sidebar: #173f39;
  --sidebar-2: #1e4d45;
  --sidebar-text: #a9c4bd;
  --bg: #f8f4ea;
  --surface-2: #fbf8f1;
  --border: #ebe3d0;
  --text: #2b2118;
  --text-2: #6b5d4f;
  --muted: #a3988a;
  --success: #1f7a5c; --success-soft: #dcefe6;
  --sidebar-w: 268px;
  --header-h: 70px;
  --gradient-brand: linear-gradient(135deg, #e6c97f 0%, #c9a14a 50%, #a8842f 100%);
  --gradient-navy: linear-gradient(135deg, #1f6b5c 0%, #173f39 55%, #2b2118 100%);
  --sadu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='1.2'%3E%3Cpath d='M22 2 42 22 22 42 2 22Z'/%3E%3Cpath d='M22 11 33 22 22 33 11 22Z'/%3E%3C/g%3E%3Cpath d='M22 19l3 3-3 3-3-3z' fill='%23c9a14a' fill-opacity='.18'/%3E%3C/svg%3E");
  --dots: radial-gradient(circle, #2b2118 1.6px, transparent 2.1px) center/12px 8px repeat-x, #c9a14a;
  /* website theme preset (overridden at runtime by CP.fam.applyTheme) */
  --fm-primary: #1f6b5c; --fm-primary-2: #1d5c52; --fm-dark: #2b2118; --fm-gold: #c9a14a; --fm-cream: #faf6ee; --fm-cream-2: #f3ead8;
}
html { overflow-x: clip; }

body.app { background: var(--bg); overflow-x: hidden; }
.hidden { display: none !important; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }

/* ---------- Layout ---------- */
.sidebar {
  position: fixed; inset-block: 0; right: 0; width: var(--sidebar-w); z-index: 40;
  background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.main { margin-right: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.content { padding: 28px 32px 40px; flex: 1; width: 100%; max-width: 1600px; margin-inline: auto; }

/* ---------- Sidebar ---------- */
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; color: #fff; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--gradient-brand); display: grid; place-items: center; box-shadow: 0 8px 20px rgba(201,161,74,.35), inset 0 1px 0 rgba(255,255,255,.35); }
.brand-mark svg { width: 22px; height: 22px; color: var(--navy); stroke-width: 2.2; }
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: .4px; line-height: 1.1; }
.brand-name small { display: block; font-size: 11px; font-weight: 500; color: var(--sidebar-text); letter-spacing: 0; margin-top: 3px; }
.role-chip { margin: 0 18px 12px; padding: 10px 12px; border-radius: 12px; background: var(--sidebar-2); border: 1px solid rgba(201,161,74,.14); display: flex; align-items: center; gap: 10px; font-size: 13px; }
.role-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(201,161,74,.18); }
.role-chip b { color: #fff; font-weight: 600; }
.nav-scroll { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: #2b5a52 transparent; }
.nav-section { font-size: 11px; font-weight: 700; color: #c9a14a; padding: 16px 12px 8px; letter-spacing: .3px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--sidebar-text); font-weight: 600; font-size: 14px; transition: .15s; position: relative; }
.nav-link:hover { background: var(--sidebar-2); color: #e2e8f0; }
.nav-link.active { background: linear-gradient(90deg, rgba(201,161,74,0), rgba(201,161,74,.18)); color: #fff; }
.nav-link.active::before { content: ""; position: absolute; right: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 4px 0 0 4px; background: var(--gold); }
.nav-link.active svg { color: var(--gold-light); }
.nav-link .count { margin-right: auto; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 999px; line-height: 18px; }
.nav-link .count.soft { background: rgba(201,161,74,.18); color: var(--gold-light); }
.sidebar-foot { padding: 14px 18px 18px; border-top: 1px solid rgba(201,161,74,.16); font-size: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-foot a { color: #cbd5e1; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.sidebar-foot a:hover { color: #fff; }
.by-almgrat { display: inline-flex; align-items: center; gap: 6px; color: #64748b; }
.by-almgrat img { width: 18px; height: 18px; }

/* ---------- Header ---------- */
.topbar-app {
  position: sticky; top: 0; z-index: 30; height: var(--header-h);
  background: rgba(255,255,255,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 32px;
}
.menu-toggle { display: none; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: #fff; display: grid; place-items: center; color: var(--text-2); cursor: pointer; position: relative; transition: .15s; }
.icon-btn:hover { color: var(--brand); border-color: #e8d6a6; background: var(--brand-soft); }
.icon-btn .dot-count { position: absolute; top: -6px; left: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }

.global-search { position: relative; flex: 1; max-width: 520px; }
.global-search input { width: 100%; height: 44px; border: 1px solid var(--border); background: var(--surface-2, #f8fafc); border-radius: 12px; padding: 0 44px 0 70px; font: inherit; font-size: 14px; transition: .15s; }
.global-search input:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.global-search > svg { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.global-search kbd { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font: 600 11px var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; background: #fff; }
.search-results { position: absolute; top: calc(100% + 8px); inset-inline: 0; }

.header-actions { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 12px; border-radius: 14px; border: 1px solid transparent; background: none; cursor: pointer; font: inherit; text-align: right; }
.user-btn:hover { background: var(--surface-2, #f8fafc); border-color: var(--border); }
.user-btn .meta b { display: block; font-size: 14px; color: var(--text); line-height: 1.2; }
.user-btn .meta small { font-size: 12px; color: var(--muted); }
.user-btn > svg { color: var(--muted); width: 16px; }

/* ---------- Dropdowns ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 10px); left: 0; min-width: 240px; z-index: 50;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .16s ease;
}
.dropdown.open > .dropdown-menu, .dropdown-menu.show { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu a, .dropdown-menu button.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 9px; color: var(--text); font: inherit; font-size: 14px; font-weight: 500; background: none; border: 0; cursor: pointer; text-align: right; }
.dropdown-menu a:hover, .dropdown-menu button.item:hover { background: var(--surface-2, #f8fafc); }
.dropdown-menu a svg, .dropdown-menu button.item svg { color: var(--muted); }
.dropdown-menu .danger, .dropdown-menu .danger svg { color: var(--danger); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.dropdown-head { padding: 12px 12px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dropdown-head b { font-size: 15px; }
.notif-menu { width: 380px; padding: 0; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); position: relative; }
.notif-item.unread { background: #fbf6e9; }
.notif-item.unread::after { content: ""; position: absolute; left: 14px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.notif-item p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.notif-item b { font-size: 14px; display: block; }
.notif-item small { font-size: 12px; color: var(--muted); }
.notif-foot { display: block; text-align: center; padding: 12px; border-top: 1px solid var(--border); font-weight: 600; font-size: 14px; }

.search-panel { background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; max-height: 420px; overflow-y: auto; z-index: 60; }
.search-group { font-size: 11px; font-weight: 700; color: var(--muted); padding: 8px 10px 4px; }
.search-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; color: var(--text); }
.search-item:hover, .search-item.focus { background: var(--brand-soft); }
.search-item .sub { font-size: 12px; color: var(--muted); }
.search-item .tail { margin-right: auto; }
.search-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Page header ---------- */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb svg { width: 14px; height: 14px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons (extend base) ---------- */
.btn { border-radius: 10px; padding: 9px 16px; font-size: 14px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 12px; }
.btn-soft { background: var(--brand-soft); color: var(--brand-700); }
.btn-soft:hover { background: #f0e3c1; }
.btn-dark { background: var(--sidebar); color: #fff; }
.btn-dark:hover { background: var(--navy-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-3); color: #fff; }
.btn-accent { background: var(--gradient-brand); color: var(--navy); font-weight: 700; }
.btn-accent:hover { filter: brightness(1.05); color: var(--navy); }
.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover { background: #0f766e; color: #fff; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 9px; border: 1px solid var(--border); background: #fff; color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; }
.btn-icon:hover { color: var(--brand); border-color: #e8d6a6; background: var(--brand-soft); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-block { width: 100%; }
button:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 20px; }
.grid > *, .stack > *, .row-between > *, .card { min-width: 0; } /* let wide tables scroll inside .table-wrap instead of stretching the page */
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--muted); } .text-2 { color: var(--text-2); }
.text-success { color: var(--teal); } .text-gold { color: var(--gold); } .text-navy { color: var(--navy); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); } .text-brand { color: var(--brand); }
.fw-7 { font-weight: 700; } .fw-8 { font-weight: 800; }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; } .fs-14 { font-size: 14px; }
.nowrap { white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }

/* ---------- Cards ---------- */
.card { border-radius: 16px; border-color: var(--border); box-shadow: 0 1px 2px rgba(23,63,57,.04); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.card-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card-body { padding: 20px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }

/* KPI */
.kpi { padding: 20px; display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--c-soft, var(--brand-soft)); color: var(--c, var(--brand)); }
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -.3px; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.trend svg { width: 13px; height: 13px; }
.trend.up { color: #0f766e; background: var(--teal-soft); }
.trend.down { color: var(--danger); background: var(--danger-soft); }
.trend.flat { color: var(--text-2); background: #f1f5f9; }
.kpi-foot { font-size: 12px; color: var(--muted); }
.c-gold   { --c: #a8842f; --c-soft: #f8f1e0; }
.c-navy   { --c: #173f39; --c-soft: #e3efec; }
.c-green  { --c: #0d9488; --c-soft: #ccfbf1; }
.c-blue   { --c: #0284c7; --c-soft: #e0f2fe; }
.c-amber  { --c: #d97706; --c-soft: #fef3c7; }
.c-red    { --c: #dc2626; --c-soft: #fee2e2; }
.c-violet { --c: #7c3aed; --c-soft: #ede9fe; }
.c-slate  { --c: #334155; --c-soft: #eef2f6; }
.c-teal   { --c: #0d9488; --c-soft: #ccfbf1; }
.c-orange { --c: #ea580c; --c-soft: #ffedd5; }

/* Hero/welcome banner */
.welcome {
  border-radius: 20px; padding: 28px 30px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(90% 140% at 0% 0%, rgba(201,161,74,.42) 0%, rgba(201,161,74,0) 55%), var(--gradient-navy);
}
.welcome::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 36px 36px; mask-image: linear-gradient(90deg, transparent, #000 70%); pointer-events: none; }
.welcome::after { content: ""; position: absolute; left: -60px; bottom: -80px; width: 280px; height: 280px; border-radius: 50%; border: 40px solid rgba(201,161,74,.10); }
.welcome h2 { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.welcome p { margin: 0; opacity: .85; }
.welcome .gold { color: var(--gold-light); }
.welcome .btn-outline { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; }
.welcome .btn-outline:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- Badges ---------- */
.badge { font-size: 12px; padding: 3px 10px; gap: 6px; white-space: nowrap; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-slate { background: #eef2f6; color: #475569; }
.badge-violet { background: #ede9fe; color: #6d28d9; }
.badge-accent { background: var(--accent-soft); color: #8c6d22; }
.badge-gold { background: #f8f1e0; color: #8c6d22; }
.badge-navy { background: #e3efec; color: #173f39; }
.badge-success { background: #ccfbf1; color: #0f766e; }
.badge-lg { font-size: 13px; padding: 5px 12px; }

/* ---------- Avatars ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0; background: var(--av, var(--brand)); }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 96px; height: 96px; font-size: 34px; border: 4px solid #fff; box-shadow: var(--shadow); }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person b { display: block; font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { display: block; font-size: 12px; color: var(--muted); }
a.person:hover b { color: var(--brand); }

/* ---------- Tables ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .search-input { position: relative; flex: 1; min-width: 220px; max-width: 340px; }
.toolbar .search-input input { padding-right: 40px; }
.toolbar .search-input svg { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; }
.toolbar .spacer { flex: 1; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: right; font-weight: 700; font-size: 12px; color: var(--text-2); background: #fbf8f1; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid #f0e9da; vertical-align: middle; white-space: nowrap; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fdfaf3; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .num { font-weight: 700; font-variant-numeric: tabular-nums; }
.table .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--text-2); direction: ltr; display: inline-block; }
.pagination { display: flex; align-items: center; gap: 6px; }
.pagination button { min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font: inherit; font-size: 13px; cursor: pointer; color: var(--text-2); }
.pagination button.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px;
  font: inherit; font-size: 14px; background: #fff; color: var(--text); transition: .15s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239aa3b5' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 34px; }
.toolbar .select { width: auto; min-width: 140px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); }
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; right: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(-20px); }
.check { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.choice { border: 1.5px solid var(--border); border-radius: 14px; padding: 16px; cursor: pointer; transition: .15s; background: #fff; position: relative; text-align: center; }
.choice:hover { border-color: #e8d6a6; }
.choice.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(201,161,74,.14); }
.choice.selected::after { content: "✓"; position: absolute; top: 8px; left: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; display: grid; place-items: center; }
.choice .emoji { font-size: 30px; line-height: 1; margin-bottom: 8px; display: block; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 12px 16px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text-2); background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .2s ease; }
.seg { display: inline-flex; padding: 4px; background: #f0e9da; border-radius: 11px; gap: 2px; }
.seg button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.seg button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(15,23,42,.1); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(23,63,57,.55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .18s; }
.modal-backdrop.show { opacity: 1; }
.modal { background: #fff; border-radius: 20px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.25); transform: translateY(12px) scale(.98); transition: transform .2s ease; }
.modal-backdrop.show .modal { transform: none; }
.modal.lg { max-width: 820px; }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-start; }
.success-mark { width: 76px; height: 76px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: grid; place-items: center; margin: 4px auto 16px; animation: pop .35s ease; }
.success-mark svg { width: 38px; height: 38px; stroke-width: 2.5; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; left: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 280px; max-width: 380px; background: var(--sidebar); color: #fff; border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-lg); font-size: 14px; animation: toastIn .25s ease; }
.toast .t-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(201,161,74,.2); color: var(--gold-light); flex-shrink: 0; }
.toast.error .t-icon { background: rgba(239,68,68,.2); color: #f87171; }
.toast.info .t-icon { background: rgba(56,189,248,.2); color: #38bdf8; }
.toast.warning .t-icon { background: rgba(245,158,11,.2); color: #fbbf24; }
.toast.hide { animation: toastOut .25s ease forwards; }

/* ---------- Lists / Feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed .f-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.feed p { margin: 0; font-size: 14px; }
.feed small { color: var(--muted); font-size: 12px; }
.t-info { background: var(--info-soft); color: var(--info); }
.t-success { background: var(--teal-soft); color: var(--teal); }
.t-warning { background: var(--warning-soft); color: var(--warning); }
.t-danger { background: var(--danger-soft); color: var(--danger); }
.t-brand { background: var(--brand-soft); color: var(--brand); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f0e9da; }
.list-row:last-child { border-bottom: 0; }

/* Progress */
.progress { height: 8px; background: #f0e9da; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--brand)); transition: width .6s ease; }
.ring { --p: 75; --c: var(--brand); width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), #f0e9da 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 12px; background: #fff; border-radius: 50%; }
.ring > * { position: relative; text-align: center; }
.ring b { font-size: 26px; font-weight: 800; display: block; line-height: 1; }
.ring small { font-size: 12px; color: var(--muted); }

/* Chart containers */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.chart-box.lg { height: 340px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Empty state */
.empty-state { padding: 48px 24px; }
.empty-state .empty-icon { background: var(--brand-soft); color: var(--brand); }

/* Info list */
.info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.info-list div small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.info-list div b { font-size: 14px; font-weight: 600; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal .day { aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: #f8fafc; color: var(--text-2); position: relative; }
.cal .day.p { background: var(--teal-soft); color: #0f766e; }
.cal .day.a { background: var(--danger-soft); color: #b91c1c; }
.cal .day.today { outline: 2px solid var(--brand); outline-offset: 1px; }
.cal .day.future { background: transparent; color: #cbd5e1; }
.cal .day.empty { background: transparent; }

/* Schedule timeline */
.session { display: flex; gap: 14px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: #fff; align-items: center; border-right: 4px solid var(--c, var(--brand)); }
.session .time { text-align: center; min-width: 64px; }
.session .time b { display: block; font-size: 16px; font-weight: 800; }
.session .time small { font-size: 12px; color: var(--muted); }
.session h4 { margin: 0 0 2px; font-size: 15px; }
.session .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.session .meta span { display: inline-flex; align-items: center; gap: 4px; }
.session .meta svg { width: 14px; height: 14px; }

/* Emoji/icon tile */
.sport-tile { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: color-mix(in srgb, var(--c, var(--brand)) 12%, #fff); flex-shrink: 0; }

/* QR (pseudo) */
.qr { width: 132px; height: 132px; background: #fff; padding: 8px; border-radius: 12px; display: grid; grid-template-columns: repeat(21, 1fr); gap: 0; }
.qr i { display: block; aspect-ratio: 1; }
.qr i.on { background: #173f39; }


/* ==========================================================================
   Family CMS components
   ========================================================================== */
.brand-mark { background: linear-gradient(145deg, #1f6b5c, #12352f); border: 1.5px solid rgba(201,161,74,.55); box-shadow: 0 8px 20px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.12); }
.brand-mark svg { color: var(--gold-light); }
.sidebar { background: var(--sidebar) var(--sadu); background-size: 44px 44px; }
.sidebar::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 4px; background: radial-gradient(circle, #c9a14a 1.4px, transparent 1.9px) center/4px 10px repeat-y; opacity: .55; pointer-events: none; }
.role-chip { border-color: rgba(201,161,74,.22); background: rgba(0,0,0,.14); }
.role-chip .tfa { margin-right: auto; color: var(--gold-light); display: inline-grid; }
.role-chip .tfa svg { width: 16px; height: 16px; }
.nav-section { color: #c9a14a; opacity: .8; }
.nav-link:hover { background: rgba(255,255,255,.06); }
.nav-link .ext { margin-right: auto; width: 14px; opacity: .5; }
.nav-link .count.soft { background: rgba(201,161,74,.2); color: var(--gold-light); }
.by-almgrat { color: #7fa39b; }
.topbar-app { background: rgba(251,248,241,.9); }
.term-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; background: var(--gold-soft); color: #7a5c1c; font-size: 13px; font-weight: 700; border: 1px dashed #dcc38a; white-space: nowrap; }
.term-chip svg { width: 15px; height: 15px; }
.btn-primary { background: var(--brand); }
.btn-primary:hover { background: var(--brand-700); }
.btn-accent { color: #2b2118; border-radius: 999px; }
.btn-accent:hover { color: #2b2118; }
.btn-gold { background: var(--gradient-brand); color: #2b2118; font-weight: 700; border-radius: 999px; box-shadow: 0 8px 18px rgba(201,161,74,.28); }
.btn-gold:hover { filter: brightness(1.05); color: #2b2118; }
.btn-soft { background: var(--brand-soft); color: var(--brand-700); }
.btn-soft:hover { background: #d3e7e0; }
.btn-soft-gold { background: var(--gold-soft); color: #7a5c1c; }
.btn-soft-gold:hover { background: #efe2bf; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-pill { border-radius: 999px; }
.badge-teal { background: var(--teal-soft); color: #175a4c; }
.badge-success { background: #dcefe6; color: #17684e; }
.badge-gold { background: var(--gold-soft); color: #7a5c1c; }
.badge-brown { background: #efe6dc; color: #4a3828; }
.c-teal  { --c: #1f6b5c; --c-soft: #dcefe9; }
.c-gold  { --c: #a8842f; --c-soft: #f6eedb; }
.c-brown { --c: #5b4636; --c-soft: #efe6dc; }
.c-deep  { --c: #173f39; --c-soft: #e3efec; }
.c-green { --c: #17684e; --c-soft: #dcefe6; }
.ltr-input { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; letter-spacing: 2px; }
.card.gold-top { border-top: 3px solid var(--gold); }
.kpi { border-top: 3px solid transparent; transition: .15s; }
.kpi:hover { border-top-color: var(--gold); }
.f-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }

/* Dotted gold separators (from the family website) */
.dots-band { height: 8px; background: var(--dots); border-radius: 2px; }
.dot-sep { border: 0; height: 2px; margin: 18px 0; background: radial-gradient(circle, #c9a14a 1.2px, transparent 1.6px) center/8px 2px repeat-x; }

/* Welcome banner — teal→dark with sadu pattern + dotted gold border */
.welcome { background: var(--sadu), radial-gradient(80% 140% at 0% 0%, rgba(201,161,74,.30) 0%, rgba(201,161,74,0) 55%), var(--gradient-navy); background-size: 44px 44px, auto, auto; padding-bottom: 36px; }
.welcome::before { mask-image: none; -webkit-mask-image: none; inset: auto 0 0 0; height: 8px; background: var(--dots); opacity: .95; }
.welcome::after { border-color: rgba(201,161,74,.12); }
.welcome .chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); font-size: 13px; }
.welcome .chip svg { width: 15px; height: 15px; color: var(--gold-light); }
.welcome .btn-outline { border-radius: 999px; }

/* Date tile (teal square: day / number / month) */
.date-tile { width: 54px; min-width: 54px; height: 58px; border-radius: 12px; background: linear-gradient(160deg, var(--fm-primary, #1f6b5c), #173f39); color: #fff; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; box-shadow: 0 6px 14px rgba(23,63,57,.22); flex-shrink: 0; }
.date-tile small { font-size: 10px; opacity: .85; font-weight: 600; }
.date-tile b { font-size: 20px; font-weight: 800; }
.date-tile.sm { width: 46px; min-width: 46px; height: 50px; }
.date-tile.sm b { font-size: 17px; }
.date-tile.gold { background: linear-gradient(160deg, #d8b45f, #a8842f); color: #2b2118; }
.remain-pill { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--gold-soft); color: #7a5c1c; border: 1px solid #e6d3a3; white-space: nowrap; }
.remain-pill.soon { background: linear-gradient(135deg, #e6c97f, #c9a14a); color: #2b2118; border-color: transparent; }
.remain-pill.past { background: #f1ede5; color: var(--muted); border-color: transparent; }
.prayer-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--gold-soft); color: #7a5c1c; border: 1px solid #ead9ae; white-space: nowrap; }
.prayer-chip svg { width: 13px; height: 13px; }
.type-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 11%, #fff); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.type-tag svg { width: 13px; height: 13px; }
.branch-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.branch-tag::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--c, var(--muted)); }

/* Event / gathering row */
.ev-row { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: #fff; transition: .15s; color: inherit; }
.ev-row + .ev-row { margin-top: 10px; }
.ev-row:hover { border-color: #dcc38a; box-shadow: 0 8px 20px rgba(43,33,24,.05); }
.ev-row.featured { background: linear-gradient(90deg, #fff, #fdf7e8); border-color: #e6d3a3; }
.ev-row .ev-body { flex: 1; min-width: 0; }
.ev-row h4 { margin: 0 0 3px; font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ev-row .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-2); }
.ev-row .meta span { display: inline-flex; align-items: center; gap: 4px; }
.ev-row .meta svg { width: 13px; height: 13px; color: var(--muted); }
.g-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(160deg, #1f6b5c, #173f39); color: #fff; font-size: 20px; flex-shrink: 0; }

/* Suggestion queue */
.sugg { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: #fff; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; transition: .2s; }
.sugg + .sugg { margin-top: 10px; }
.sugg.done { opacity: .55; }
.sugg h4 { margin: 0 0 4px; font-size: 14px; font-weight: 800; }
.sugg .by { font-size: 12px; color: var(--muted); }
.sugg .note { font-size: 12.5px; color: var(--text-2); margin-top: 6px; background: #fbf8f1; border-radius: 8px; padding: 6px 10px; border-right: 3px solid var(--gold); }
.sugg-actions { display: flex; gap: 6px; }

/* Privacy panel */
.privacy-card { background: linear-gradient(180deg, #fff, #fbf8f1); }
.lock-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: #f1f6f4; border: 1px dashed #b9d4cc; font-size: 13px; color: #2f5e54; }
.lock-note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.access-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.access-row:last-child { border-bottom: 0; }
.access-row b { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.access-row small { color: var(--muted); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mask { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; unicode-bidi: embed; display: inline-block; letter-spacing: .5px; color: var(--text-2); }

/* Plugins mini grid */
.plug-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.plug { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--border); background: #fff; font-size: 13px; font-weight: 700; min-width: 0; }
.plug span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plug .pi { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.plug .pi svg { width: 15px; height: 15px; }
.plug.off { background: #faf8f4; color: var(--muted); }
.plug.off .pi { background: #f1ede5; color: var(--muted); }
.plug .switch { transform: scale(.82); }
.core-chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--gradient-navy); color: #fff; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.core-chip svg { color: var(--gold-light); }

/* Term & theme quick switch + mini site preview */
.term-preview { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--fm-cream); }
.tp-top { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #fff; font-size: 12px; font-weight: 800; color: var(--fm-dark); }
.tp-top span { font-size: 11px; color: var(--muted); font-weight: 600; }
.tp-nav { display: flex; gap: 6px; padding: 6px 10px; background: #fff; border-top: 1px solid #f0e9da; overflow: hidden; }
.tp-nav i { font-style: normal; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; color: var(--fm-dark); }
.tp-nav i:first-child { background: var(--fm-gold); }
.tp-hero { padding: 16px 12px 18px; text-align: center; color: #fff; background: var(--sadu), linear-gradient(90deg, var(--fm-primary), var(--fm-dark)); background-size: 30px 30px, auto; position: relative; }
.tp-hero::before, .tp-hero::after { content: ""; position: absolute; inset-inline: 0; height: 5px; background: radial-gradient(circle, var(--fm-dark) 1.2px, transparent 1.6px) center/9px 5px repeat-x, var(--fm-gold); }
.tp-hero::before { top: 0; } .tp-hero::after { bottom: 0; }
.tp-hero b { display: block; font-size: 14px; }
.tp-hero small { font-size: 11px; opacity: .8; }
.tp-body { padding: 10px; display: grid; gap: 6px; }
.tp-card { background: #fff; border-radius: 10px; padding: 8px 10px; border-top: 2px solid var(--fm-gold); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; color: var(--fm-dark); min-width: 0; }
.tp-card span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-card em { font-style: normal; font-size: 10px; padding: 2px 8px; border-radius: 999px; background: var(--fm-gold); color: var(--fm-dark); white-space: nowrap; }
.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.swatch { border: 2px solid transparent; border-radius: 12px; padding: 4px; cursor: pointer; background: #fff; box-shadow: 0 0 0 1px var(--border); transition: .15s; font: inherit; }
.swatch i { display: block; height: 30px; border-radius: 8px; }
.swatch.active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,161,74,.2); }
.swatch small { display: block; text-align: center; font-size: 10px; font-weight: 700; color: var(--text-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Quick actions */
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: #fff; cursor: pointer; font: inherit; font-weight: 700; font-size: 14px; color: var(--text); text-align: right; transition: .15s; min-width: 0; }
.quick:hover { border-color: var(--gold); background: #fdf9ef; transform: translateY(-2px); }
.quick .qi { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--c-soft, var(--brand-soft)); color: var(--c, var(--brand)); flex-shrink: 0; }
.quick small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }

/* Mini genealogy tree */
.mini-tree { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.mt-node { padding: 6px 12px; border-radius: 10px; border: 1.5px solid #dcc38a; background: #fff; font-size: 12px; font-weight: 800; white-space: nowrap; }
.mt-node.root { background: linear-gradient(135deg, #1f6b5c, #2b2118); color: #fff; border-color: var(--gold); }
.mt-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* Charts helpers */
.chart-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #2f5e54; background: #f1f6f4; padding: 4px 10px; border-radius: 999px; border: 1px dashed #b9d4cc; }
.chart-note svg { width: 14px; height: 14px; }
.top-pages .tp-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 52px; gap: 10px; align-items: center; font-size: 13px; padding: 6px 0; }
.top-pages .tp-row b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-pages .tp-row span:last-child { text-align: left; font-weight: 700; font-variant-numeric: tabular-nums; }
.text-teal { color: var(--teal); } .text-brown { color: var(--brown); }

/* Tab bar (member — mobile-first) */
.tabbar { display: none; }
@media (max-width: 1024px) {
  body.mobile-role .content { padding-bottom: 104px; }
  body.mobile-role .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; bottom: 0; inset-inline: 0; z-index: 45;
    background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1px solid var(--border); padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(43,33,24,.06);
  }
  body.mobile-role .tabbar::before { content: ""; position: absolute; top: -4px; inset-inline: 0; height: 4px; background: radial-gradient(circle, #c9a14a 1.3px, transparent 1.7px) center/9px 4px repeat-x; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--text-2); padding: 4px 2px; border-radius: 10px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tabbar a .ti { width: 40px; height: 30px; border-radius: 999px; display: grid; place-items: center; transition: .15s; position: relative; }
  .tabbar a .ti em { position: absolute; top: -2px; left: 2px; min-width: 16px; height: 16px; border-radius: 999px; background: #b42318; color: #fff; font-size: 10px; font-style: normal; display: grid; place-items: center; padding: 0 4px; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a.active { color: var(--brand); }
  .tabbar a.active .ti { background: var(--brand-soft); }
  .tabbar a.primary { overflow: visible; }
  .tabbar a.primary .ti { width: 52px; height: 52px; margin-top: -24px; background: var(--gradient-brand); color: #2b2118; box-shadow: 0 8px 20px rgba(201,161,74,.4); border: 4px solid #fff; }
  body.mobile-role .toast-wrap { bottom: 96px; }
}
@media (max-width: 720px) {
  .sugg { grid-template-columns: auto minmax(0, 1fr); }
  .sugg-actions { grid-column: 1 / -1; }
  .sugg-actions .btn { flex: 1; }
  .swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-grid { grid-template-columns: minmax(0, 1fr); }
  .ev-row { flex-wrap: wrap; }
  .ev-row .ev-body { flex-basis: calc(100% - 70px); }
  .ev-row > .remain-pill, .ev-row > .prayer-chip { margin-right: 68px; }
  .top-pages .tp-row { grid-template-columns: minmax(0, 1fr) 60px 44px; }
}

/* Animations */
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px); } }
.fade-in { animation: fade .3s ease both; }

/* Mobile overlay */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(23,63,57,.5); z-index: 35; opacity: 0; visibility: hidden; transition: .2s; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(100%); box-shadow: none; }
  body.nav-open .sidebar { transform: none; box-shadow: -20px 0 60px rgba(0,0,0,.3); }
  body.nav-open .sidebar-overlay { opacity: 1; visibility: visible; }
  .main { margin-right: 0; }
  .menu-toggle { display: grid; }
  .topbar-app { padding: 0 20px; }
  .content { padding: 24px 20px 36px; }
  .user-btn .meta { display: none; }
}
@media (max-width: 720px) {
  .kanban-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-strip { grid-template-columns: minmax(0, 1fr); }
  .occ-row { grid-template-columns: minmax(0, 1fr) 80px 40px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .info-list { grid-template-columns: 1fr; }
  .topbar-app { gap: 10px; padding: 0 16px; }
  .global-search kbd { display: none; }
  .global-search input { padding-left: 12px; }
  .content { padding: 20px 16px 32px; }
  .page-head h1 { font-size: 22px; }
  .card-pad, .card-body { padding: 18px 16px; }
  .card-head, .toolbar, .card-foot { padding-inline: 16px; }
  .notif-menu { width: calc(100vw - 32px); left: -90px; }
  .toast-wrap { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
  .welcome { padding: 22px 20px; }
  .welcome h2 { font-size: 22px; }
  .header-actions .hide-sm { display: none; }
  .hide-sm { display: none !important; }
}
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 16px; }
  .kpi-value { font-size: 22px; }
  .kpi-icon { width: 38px; height: 38px; }
}
@media print {
  .sidebar, .topbar-app, .page-actions, .toolbar, .toast-wrap { display: none !important; }
  .main { margin: 0; }
}

/* Segmented controls never widen the page on phones */
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex-shrink: 0; }
.page-actions { max-width: 100%; }


/* ==========================================================================
   Heritage refinement (light polish — identity unchanged)
   شريط سدو هندسي أعلى الشريط الجانبي وتحت عناوين الصفحات · فواصل ذهبية رفيعة
   Aref Ruqaa للعناوين الزخرفية فقط (اسم العائلة، عنوان الصفحة، الترحيب، شهر بطاقة التاريخ)
   بطاقات بحد كريمي وخط ذهبي علوي رفيع · أيقونات KPI في دوائر خضراء مزرقة بحلقة ذهبية
   كل القواعد محصورة في body.app حتى لا يتأثر موقع العائلة أو صفحة الدخول.
   ========================================================================== */
:root {
  --sadu-band: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Crect width='24' height='12' fill='%2312352f'/%3E%3Cpath d='M0 10.5 6 1.5 12 10.5Z M12 10.5 18 1.5 24 10.5Z' fill='%23c9a14a'/%3E%3Cpath d='M6 1.5 18 1.5 12 10.5Z' fill='%238c2f22'/%3E%3Cpath d='M18 1.5 24 1.5 24 10.5Z M0 1.5 6 1.5 0 10.5Z' fill='%238c2f22'/%3E%3Cpath d='M12 4.2 13.6 6 12 7.8 10.4 6Z' fill='%23f3ead8'/%3E%3Crect width='24' height='1.5' fill='%23e6c97f'/%3E%3Crect y='10.5' width='24' height='1.5' fill='%23e6c97f'/%3E%3C/svg%3E");
  --font-deco: "Aref Ruqaa", var(--font);
  --gold-hair: linear-gradient(to left, rgba(201,161,74,.08), rgba(201,161,74,.55) 50%, rgba(201,161,74,.08));
}

/* Sidebar: Sadu strip on top */
body.app .sidebar::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 10px; background: var(--sadu-band) repeat-x; background-size: 20px 10px; box-shadow: 0 2px 6px rgba(0,0,0,.18); pointer-events: none; z-index: 1; }
body.app .sidebar .brand { padding-top: 30px; }
body.app .brand-name { font-family: var(--font-deco); font-weight: 700; font-size: 22px; letter-spacing: 0; line-height: 1.25; }
body.app .brand-name small { font-family: var(--font); font-size: 11px; font-weight: 500; }

/* Header: gold hairline under the top bar */
body.app .topbar-app::after { content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 1px; background: var(--gold-hair); pointer-events: none; }

/* Page heads: decorative title + faded Sadu strip */
body.app .page-head { position: relative; padding-bottom: 18px; }
body.app .page-head::after { content: ""; position: absolute; bottom: 0; inset-inline: 0; height: 8px; background: var(--sadu-band) repeat-x; background-size: 16px 8px; opacity: .5; border-radius: 2px; -webkit-mask-image: linear-gradient(to left, #000 0%, rgba(0,0,0,.5) 35%, transparent 75%); mask-image: linear-gradient(to left, #000 0%, rgba(0,0,0,.5) 35%, transparent 75%); pointer-events: none; }
body.app .page-head h1 { font-family: var(--font-deco); font-weight: 700; letter-spacing: 0; line-height: 1.35; color: var(--navy); }
body.app .welcome h2 { font-family: var(--font-deco); font-weight: 700; letter-spacing: 0; line-height: 1.35; }

/* Cards: soft cream border + gold top hairline; gold hairline dividers */
body.app .card { border-color: #ece3cc; border-top-color: #dcc38a; }
body.app .card.gold-top { border-top-color: var(--gold); }
body.app .card.kpi { border-top-color: rgba(201,161,74,.4); }
body.app .card.kpi:hover { border-top-color: var(--gold); }
body.app .card.kpi.ob-kpi { border-top-color: transparent; }
body.app .card.kpi.ob-kpi:hover { border-top-color: #bdb4a6; }
body.app .card .card { border-top-color: #ece3cc; }
body.app .card-head { border-bottom: 1px solid transparent; border-image: var(--gold-hair) 1; }
body.app .card-foot { border-top: 1px solid transparent; border-image: var(--gold-hair) 1; }

/* KPI icons: teal circle with a gold ring */
body.app .card:not(.ob-kpi) .kpi-icon { border-radius: 50%; background: linear-gradient(160deg, #1f6b5c, #173f39); color: var(--gold-light); box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px rgba(201,161,74,.85), 0 6px 14px rgba(23,63,57,.18); }
body.app .card.c-red .kpi-icon, body.app .card.c-orange .kpi-icon { color: #fdba9a; }

/* Date tiles: gold inner hairline + month in Ruqaa */
body.app .date-tile { box-shadow: 0 6px 14px rgba(23,63,57,.22), inset 0 0 0 1px rgba(230,201,127,.45); }
body.app .date-tile small:last-child { font-family: var(--font-deco); font-size: 11.5px; font-weight: 400; opacity: .95; }
body.app .date-tile.gold { box-shadow: 0 6px 14px rgba(168,132,47,.25), inset 0 0 0 1px rgba(255,255,255,.4); }

@media (max-width: 720px) {
  body.app .page-head { padding-bottom: 16px; }
  body.app .brand-name { font-size: 20px; }
}
@media print {
  body.app .page-head::after, body.app .sidebar::before { display: none; }
}

/* Product logo (Family CMS) */
.brand-logo { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-mark.has-logo { padding: 3px; background: #fffdf7; border: 1.5px solid rgba(201,161,74,.55); }
