:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --primary-50: #f0fdfa;
  --accent: #f59e0b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --bg: #f6f8fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.04);
  --shadow: 0 1px 3px 0 rgba(0,0,0,.06), 0 1px 2px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(13,148,136,.08), 0 4px 6px -4px rgba(13,148,136,.05);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ========== LAYOUT ========== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-light);
}
.brand-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(13,148,136,.25);
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.nav-section {
  padding: 16px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-light);
}

.nav { padding: 4px 12px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2px;
  transition: all .15s;
}
.nav-item:hover { background: var(--primary-50); color: var(--primary-dark); }
.nav-item.active {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 10px -3px rgba(13,148,136,.45);
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}
.nav-item.active .badge { background: rgba(255,255,255,.25); }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex: 0 0 36px;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.purple { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.avatar.blue { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.avatar.pink { background: linear-gradient(135deg, #f472b6, #db2777); }
.avatar.green { background: linear-gradient(135deg, #34d399, #059669); }
.avatar.teal { background: linear-gradient(135deg, #2dd4bf, var(--primary)); }

.user-meta { line-height: 1.25; }
.user-meta .name { font-weight: 600; font-size: 13px; }
.user-meta .role { font-size: 11px; color: var(--text-muted); }

/* ========== MAIN ========== */
.main { min-width: 0; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.page-title { font-size: 18px; font-weight: 600; }
.page-sub { font-size: 12px; color: var(--text-muted); }

.search {
  flex: 1;
  max-width: 380px;
  margin-left: auto;
  position: relative;
}
.search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 13px;
  outline: none;
  transition: all .15s;
}
.search input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(13,148,136,.1); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-light); }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-muted);
  position: relative;
  transition: all .15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid #fff;
}

.content { padding: 24px 28px 60px; }

/* ========== KPI CARDS ========== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border-light);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex: 0 0 44px;
}
.kpi-icon.teal { background: var(--primary-light); color: var(--primary-dark); }
.kpi-icon.amber { background: #fef3c7; color: #d97706; }
.kpi-icon.violet { background: #ede9fe; color: #7c3aed; }
.kpi-icon.rose { background: #fce7f3; color: #db2777; }
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-size: 22px; font-weight: 700; margin-top: 2px; letter-spacing: -.01em; }
.kpi-delta { font-size: 11px; margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }

/* ========== CARDS / SECTIONS ========== */
.row { display: grid; gap: 18px; margin-bottom: 18px; }
.row.split-2 { grid-template-columns: 2fr 1fr; }
.row.split-3 { grid-template-columns: 1fr 1fr 1fr; }
.row.split-1-1 { grid-template-columns: 1fr 1fr; }

.card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.card-head {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .meta { font-size: 12px; color: var(--text-muted); }
.card-body { padding: 18px 20px; }
.card-body.flush { padding: 0; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  border: 1px solid transparent;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-outline { border-color: var(--border); background: #fff; color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ========== TABLES ========== */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left;
  padding: 11px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--primary-50); }
.tbl .who { display: flex; align-items: center; gap: 10px; }
.tbl .who .name { font-weight: 500; }
.tbl .who .sub { font-size: 11px; color: var(--text-muted); }

/* ========== PILLS / BADGES ========== */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.success { color: #047857; background: #d1fae5; }
.pill.warning { color: #b45309; background: #fef3c7; }
.pill.danger  { color: #b91c1c; background: #fee2e2; }
.pill.info    { color: #1d4ed8; background: #dbeafe; }
.pill.neutral { color: #475569; background: #e2e8f0; }
.pill.violet  { color: #6d28d9; background: #ede9fe; }
.pill.teal    { color: var(--primary-dark); background: var(--primary-light); }

/* ========== APPOINTMENTS / TIMELINE ========== */
.appt-list { display: flex; flex-direction: column; }
.appt {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  padding: 14px 20px;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
}
.appt:last-child { border-bottom: 0; }
.appt-time {
  text-align: center;
  padding: 6px 0;
  border-radius: 8px;
  background: var(--primary-50);
  border: 1px solid var(--primary-light);
}
.appt-time .h { font-weight: 700; font-size: 14px; color: var(--primary-dark); }
.appt-time .m { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.appt-main { min-width: 0; }
.appt-main .who { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.appt-main .who .name { font-weight: 600; }
.appt-main .detail { font-size: 12px; color: var(--text-muted); }

/* ========== CALENDAR ========== */
.cal-grid {
  display: grid;
  grid-template-columns: 80px repeat(5, 1fr);
  gap: 0;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.cal-head {
  padding: 12px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
}
.cal-head .day { font-size: 18px; color: var(--text); }
.cal-head.today .day { color: var(--primary); }
.cal-head .label { color: var(--text-muted); font-weight: 500; margin-top: 2px; }
.cal-time {
  padding: 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  border-bottom: 1px solid var(--border-light);
}
.cal-cell {
  padding: 6px;
  min-height: 64px;
  border-bottom: 1px solid var(--border-light);
  border-left: 1px solid var(--border-light);
  position: relative;
}
.cal-event {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 11px;
  margin-bottom: 4px;
}
.cal-event .ev-name { font-weight: 600; color: var(--primary-dark); }
.cal-event .ev-dr { color: var(--text-muted); }
.cal-event.amber { background: #fef3c7; border-color: var(--accent); }
.cal-event.amber .ev-name { color: #b45309; }
.cal-event.violet { background: #ede9fe; border-color: #7c3aed; }
.cal-event.violet .ev-name { color: #6d28d9; }
.cal-event.rose { background: #fce7f3; border-color: #db2777; }
.cal-event.rose .ev-name { color: #be185d; }

/* ========== CHART (CSS-based) ========== */
.bars {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  height: 180px;
  align-items: end;
  padding: 8px 0 24px;
  position: relative;
}
.bar {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  border-radius: 4px 4px 0 0;
  position: relative;
  min-height: 4px;
  transition: all .25s;
}
.bar:hover { filter: brightness(1.1); }
.bar .bar-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
}

.donut {
  width: 160px; height: 160px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0 55%, var(--accent) 55% 78%, #a78bfa 78% 92%, #cbd5e1 92% 100%);
  position: relative;
  margin: 0 auto;
}
.donut::after {
  content: '';
  position: absolute;
  inset: 22px;
  background: #fff;
  border-radius: 50%;
}
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  z-index: 1;
}
.donut-center .big { font-size: 22px; font-weight: 700; }
.donut-center .small { font-size: 11px; color: var(--text-muted); }
.legend { margin-top: 16px; display: grid; gap: 8px; font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-item .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ========== PROFILE LAYOUT ========== */
.profile-head {
  display: flex;
  gap: 22px;
  align-items: center;
  padding: 22px;
  background: linear-gradient(135deg, var(--primary-50), #fff);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  margin-bottom: 18px;
}
.profile-head h2 { font-size: 20px; }
.profile-head .meta-row { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--text-muted); }
.profile-head .meta-row span { display: inline-flex; gap: 6px; align-items: center; }

.tab-strip {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--primary-dark); border-color: var(--primary); }
.tab:hover:not(.active) { color: var(--text); }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
.kv dd { color: var(--text); font-weight: 500; }

/* ========== ALERT BANNER ========== */
.banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .row.split-2, .row.split-3, .row.split-1-1 { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  .sidebar.open { left: 0; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ========================================================================
 * ROLE-AWARE EXTENSIONS — Pass 1 (Users & Roles, role switcher, drawer, CAMP)
 * ====================================================================== */

/* ---------- Sidebar footer becomes role switcher ---------- */
.sidebar-footer { position: relative; cursor: pointer; user-select: none; transition: background .12s; }
.sidebar-footer:hover { background: var(--bg); }
.sidebar-footer .rs-chev {
  margin-left: auto;
  width: 14px; height: 14px;
  color: var(--text-light);
  flex-shrink: 0;
  transition: transform .15s;
}
.sidebar-footer.is-open .rs-chev { transform: rotate(180deg); color: var(--primary); }

.role-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 10px; right: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px -6px rgba(15,23,42,.18), 0 4px 10px -4px rgba(15,23,42,.08);
  padding: 6px;
  z-index: 60;
  display: flex; flex-direction: column; gap: 1px;
}
.role-popover[hidden] { display: none; }
.rp-head {
  font-size: 10px;
  color: var(--text-light);
  padding: 8px 10px 4px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}
.rp-item {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text);
  font-weight: 500;
}
.rp-item:hover { background: var(--primary-50); }
.rp-item.active { background: var(--primary-50); color: var(--primary-dark); }
.rp-item .rp-text { flex: 1; min-width: 0; line-height: 1.25; }
.rp-item .rp-sub { font-size: 11px; color: var(--text-light); font-weight: 400; margin-top: 1px; }
.rp-item.active .rp-sub { color: var(--primary-dark); opacity: .75; }
.rp-item .rp-check {
  width: 14px; height: 14px;
  color: var(--primary);
  opacity: 0;
  flex-shrink: 0;
}
.rp-item.active .rp-check { opacity: 1; }

/* ---------- Drawer (right-side detail panel) ---------- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.35);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(460px, calc(100vw - 24px));
  height: 100vh;
  background: #fff;
  box-shadow: -12px 0 30px rgba(15,23,42,.14);
  z-index: 80;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s ease;
}
.drawer.open { transform: translateX(0); }
.drawer[hidden] { display: flex; } /* keep transitioned; class controls visibility */

.drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.drawer-head h3 {
  font-size: 14px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-head .icon-btn {
  font-size: 22px;
  line-height: 1;
  font-weight: 300;
  color: var(--text-muted);
  width: 32px; height: 32px;
}
.drawer-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

/* Compact profile-head variant for drawer hero */
.drawer-hero {
  display: flex; gap: 14px; align-items: center;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--primary-50), #fff);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
}
.drawer-hero .dh-main { flex: 1; min-width: 0; }
.drawer-hero h4 { font-size: 15px; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.drawer-hero .dh-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.drawer-hero .meta-row { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--text-muted); }

.drawer-section { margin-top: 18px; }
.drawer-section h5 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.drawer-footer {
  border-top: 1px solid var(--border-light);
  padding: 14px 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
  background: var(--bg);
}

/* ---------- New pill variants ---------- */
.pill.camp {
  color: var(--primary-dark);
  background: transparent;
  border: 1px dashed var(--primary);
  padding: 2px 8px;
}
.pill.camp::before { background: var(--primary); }

.pill.is-active {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* ---------- Timeline (drawer activity, camp journey, audit log) ---------- */
.tl { display: flex; flex-direction: column; }
.tl-row {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}
.tl-row + .tl-row::before {
  content: '';
  position: absolute;
  left: 11px;
  top: -8px;
  height: 16px;
  border-left: 2px dashed var(--border);
}
.tl-row.solid + .tl-row::before { border-left-style: solid; border-left-color: var(--border); }
.tl-marker {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  display: grid; place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-light);
}
.tl-marker.camp { background: #fff; border-color: var(--primary); border-style: dashed; color: var(--primary-dark); }
.tl-marker.paid { background: #d1fae5; border-color: #047857; color: #047857; }
.tl-marker.event { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.tl-marker.warn { background: #fef3c7; border-color: #f59e0b; color: #b45309; }
.tl-body { flex: 1; min-width: 0; font-size: 13px; line-height: 1.45; }
.tl-body .tl-head { font-weight: 500; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-body .tl-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tl-body .tl-time { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ---------- Camp journey sparkline (compact horizontal, for #/users) ---------- */
.camp-journey { padding: 12px 0; }
.camp-journey + .camp-journey { border-top: 1px solid var(--border-light); }
.cj-who { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.cj-who .name { font-weight: 500; }
.cj-who .id { font-size: 11px; color: var(--text-light); margin-left: auto; }
.cj-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0 6px 38px;
  flex-wrap: wrap;
}
.cj-step { display: inline-flex; align-items: center; gap: 6px; }
.cj-link {
  width: 22px;
  border-top: 2px dashed var(--border);
  flex-shrink: 0;
}
.cj-link.solid { border-top-style: solid; }
.cj-note { padding-left: 38px; font-size: 11px; color: var(--text-muted); }

/* ---------- Role-aware visibility ---------- */
[data-role-dashboard] { display: none; }
[data-role-dashboard].is-role-active { display: block; }
/* Element-level visibility — JS toggles a 'role-hidden' class */
.role-hidden { display: none !important; }

/* ---------- Users page — toolbar + permission matrix ---------- */
.users-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.users-toolbar > .search { flex: 0 1 280px; min-width: 200px; }
.users-toolbar .filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.users-toolbar .filter-pills .pill { cursor: pointer; user-select: none; }
.users-toolbar .spacer { flex: 1; }

.matrix { font-size: 12px; }
.matrix th, .matrix td {
  text-align: center;
  vertical-align: middle;
  padding: 10px 8px;
}
.matrix th:first-child,
.matrix td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text);
  padding-left: 18px;
}
.matrix th {
  background: var(--border-light);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 11px;
  color: var(--text);
}
.matrix .role-head {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.matrix .role-head .role-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.tbl tr.is-clickable { cursor: pointer; }
.tbl tr.is-clickable:hover td { background: var(--primary-50); }

/* ---------- Stub page (for queue/my-panel/campaigns/my-visits in Pass 1) ---------- */
.stub-card { padding: 48px 24px; text-align: center; color: var(--text-muted); }
.stub-card h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; font-weight: 600; }
.stub-card .sub { font-size: 13px; }
.stub-card .stub-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary-dark);
  display: grid; place-items: center;
  margin: 0 auto 14px;
}

/* ---------- Preview-mode banner styling tweak ---------- */
.banner.preview { margin-bottom: 18px; }
.banner.preview a {
  color: #92400e;
  text-decoration: underline;
  margin-left: 6px;
  font-weight: 500;
  cursor: pointer;
}
.banner.preview strong { font-weight: 600; }

/* ---------- Role-specific drawer tab content — channel + template helpers ---------- */
.chan-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; }
.chan-row + .chan-row { border-top: 1px solid var(--border-light); }
.chan-row .chan-name { flex: 1; font-weight: 500; }

/* ---------- Personalized greeting on profile-head when role-aware ---------- */
.profile-head .greet-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* HTML hidden attribute must beat the .banner display:flex base */
.banner[hidden], .role-popover[hidden] { display: none !important; }
