/**
 * MHFCare Admin Panel — Prism / CMR design language
 * Admin-only styles (admin.html). Patient pages use custom.css.
 */

:root {
  --admin-font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --page-bg-top: #eef3fa;
  --page-bg-bottom: #e9f0fb;
  --text-primary: #33455c;
  --text-secondary: #3e536c;
  --text-muted: #5b6b80;
  --text-subtle: #9195a1;
  --accent-blue: #5c9afd;
  --accent-blue-dark: #3e7ce0;
  --accent-orange: #ef971c;
  --accent-green: #2f9e5b;
  --accent-red: #e5484d;
  --border-card: #eef2f7;
  --border-input: rgba(15, 23, 42, 0.12);
  --border-nav: #e2eaf5;
  --surface-filter: #f4f8fe;
  --surface-hover: #eaf4ff;
  --surface-input: #f5f5f5;
  --card-bg: #ffffff;
  --nav-bg: #1a2744;
  --nav-bg-hover: rgba(255, 255, 255, 0.06);
  --radius-card: 16px;
  --radius-input: 14px;
  --radius-btn: 14px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 3px rgba(62, 83, 108, 0.05), 0 8px 22px rgba(62, 83, 108, 0.06);
  --shadow-card-hover: 0 14px 30px rgba(62, 83, 108, 0.1);
  --shadow-btn-primary: 0 8px 20px rgba(47, 104, 255, 0.28);
  --focus-ring: 0 0 0 3px rgba(47, 104, 255, 0.15);
  --gradient-primary: linear-gradient(135deg, rgba(47, 104, 255, 0.92), rgba(245, 151, 42, 0.88));
  --gradient-brand: linear-gradient(135deg, #5c9afd, #ef971c);
}

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

html, body {
  height: 100%;
  font-family: var(--admin-font);
  background: linear-gradient(180deg, var(--page-bg-top), var(--page-bg-bottom));
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

[x-cloak] { display: none !important; }

/* ── Layout shell ── */
.admin-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.admin-sidebar {
  width: 248px;
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.08);
}

.admin-sidebar.collapsed { width: 68px; }
.admin-sidebar.collapsed .sidebar-text,
.admin-sidebar.collapsed .sidebar-section-label,
.admin-sidebar.collapsed .sidebar-logo-text { display: none; }
.admin-sidebar.collapsed .sidebar-item {
  padding: 11px 0;
  justify-content: center;
  border-left-color: transparent !important;
}
.admin-sidebar.collapsed .sidebar-item.active {
  border-left-color: transparent !important;
  border-right: 3px solid var(--accent-blue);
}
.admin-sidebar.collapsed .sidebar-logo { justify-content: center; padding: 18px 0 14px; }
.admin-sidebar.collapsed .sidebar-footer { padding: 16px 0; }
.admin-sidebar.collapsed .sidebar-footer .sidebar-item { padding: 9px 0; }

.sidebar-collapse-btn {
  position: fixed;
  top: 26px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--nav-bg);
  border: 2px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  z-index: 200;
  transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1;
}
.sidebar-collapse-btn:hover {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--gradient-brand);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(92, 154, 253, 0.35);
}
.sidebar-logo-text { min-width: 0; }
.sidebar-logo-title { font-size: 1.05rem; font-weight: 800; color: white; line-height: 1.2; letter-spacing: -0.02em; }
.sidebar-logo-sub {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 3px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-section-label {
  padding: 18px 20px 8px;
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  margin: 2px 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  border-left: 3px solid transparent;
  border-radius: 12px;
  transition: all 0.18s ease;
  user-select: none;
  white-space: nowrap;
}
.sidebar-item:hover { background: var(--nav-bg-hover); color: white; }
.sidebar-item.active {
  background: linear-gradient(135deg, rgba(92, 154, 253, 0.28), rgba(239, 151, 28, 0.12));
  color: white;
  border-left-color: var(--accent-blue);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(92, 154, 253, 0.15);
}
.sidebar-item .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Main area ── */
.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── Top bar ── */
.admin-topbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-card);
  padding: 0 28px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(62, 83, 108, 0.04);
}
.topbar-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar-user {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
  line-height: 1.45;
}
.topbar-user strong { color: var(--text-primary); font-weight: 700; }
.topbar-user .role-note { color: var(--accent-orange); font-weight: 600; }
.admin-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 0 4px 12px rgba(92, 154, 253, 0.35);
}

.admin-topbar button[class*="Logout"],
.admin-topbar .btn-logout {
  padding: 9px 16px;
  border: 1px solid var(--border-nav);
  border-radius: 11px;
  background: white;
  font-family: var(--admin-font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.admin-topbar button[class*="Logout"]:hover,
.admin-topbar .btn-logout:hover {
  background: var(--surface-hover);
  border-color: var(--accent-blue);
  color: var(--accent-blue-dark);
}

/* ── Content scroll area ── */
.admin-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px 32px;
  max-width: 100%;
}

.admin-content > div[x-show] + div,
.admin-content > .a-card + .a-card { margin-top: 20px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ── Cards ── */
.a-card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.a-card:hover { box-shadow: var(--shadow-card-hover); }

.a-card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.a-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.a-card-title::before {
  content: '';
  width: 5px;
  height: 18px;
  border-radius: 3px;
  background: var(--gradient-brand);
  flex-shrink: 0;
}
.a-card-body { padding: 22px; }

/* ── Stat cards ── */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-card);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-val { font-size: 1.75rem; font-weight: 800; color: var(--text-primary); line-height: 1; letter-spacing: -0.03em; }
.stat-lbl { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; font-weight: 500; }
.stat-trend { font-size: 0.72rem; font-weight: 600; margin-top: 4px; }
.stat-trend.up { color: var(--accent-green); }
.stat-trend.down { color: var(--accent-red); }

/* ── Buttons (CMR / Prism auth-button style) ── */
.btn-primary,
.wp-insert-btn {
  background: var(--gradient-primary);
  color: white;
  font-weight: 600;
  font-family: var(--admin-font);
  padding: 10px 20px;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-btn-primary);
  white-space: nowrap;
}
.btn-primary:hover:not(:disabled),
.wp-insert-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(47, 104, 255, 0.35);
}
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-secondary,
.btn-edit,
.wp-cancel-btn {
  background: var(--surface-filter);
  color: var(--accent-blue-dark);
  font-weight: 600;
  font-family: var(--admin-font);
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid var(--border-nav);
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.btn-secondary:hover,
.btn-edit:hover,
.wp-cancel-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent-blue);
}

.btn-danger {
  background: #fef3f2;
  color: var(--accent-red);
  font-weight: 600;
  font-family: var(--admin-font);
  padding: 8px 14px;
  border-radius: 11px;
  border: 1px solid #fecdca;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}
.btn-danger:hover { background: #fee4e2; }

.btn-sm-orange {
  background: #fff8ed;
  color: var(--accent-orange);
  font-weight: 600;
  font-family: var(--admin-font);
  padding: 8px 14px;
  border-radius: 11px;
  border: 1px solid #fde8b0;
  cursor: pointer;
  font-size: 0.8rem;
}

/* ── Data table ── */
.a-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.a-table th {
  background: var(--surface-filter);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid var(--border-card);
  white-space: nowrap;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.a-table td {
  padding: 12px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-card);
  vertical-align: middle;
}
.a-table tr:last-child td { border-bottom: none; }
.a-table tbody tr:hover td { background: var(--surface-hover); }
.a-table tbody tr { transition: background 0.12s; }

/* ── Search input ── */
.a-search {
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  padding: 10px 14px 10px 38px;
  font-size: 0.875rem;
  font-family: var(--admin-font);
  color: var(--text-primary);
  background: var(--surface-input);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  width: min(100%, 260px);
}
.a-search:focus {
  border-color: rgba(47, 104, 255, 0.45);
  box-shadow: var(--focus-ring);
  background: white;
}
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-subtle);
}

/* ── Form inputs (CMR / Prism auth-input) ── */
.a-input,
.a-select,
.a-textarea,
.param-input,
.q-option-input,
.wp-input,
.wp-select {
  width: 100%;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  padding: 12px 14px;
  font-size: 0.875rem;
  font-family: var(--admin-font);
  color: #141414;
  background: var(--surface-input);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.a-input:focus,
.a-select:focus,
.a-textarea:focus,
.param-input:focus,
.q-option-input:focus,
.wp-input:focus,
.wp-select:focus {
  border-color: rgba(47, 104, 255, 0.45);
  box-shadow: var(--focus-ring);
  background: white;
}
.a-textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
.param-input { width: 110px; text-align: right; }
.a-label,
.wp-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

/* Checkbox / radio labels in admin forms */
.admin-content label { cursor: pointer; }
.admin-content input[type="checkbox"],
.admin-content input[type="radio"] {
  accent-color: var(--accent-blue);
  width: 1rem;
  height: 1rem;
}

/* ── Status badges ── */
.badge-active { background: #ecfdf3; color: #067647; font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill); }
.badge-inactive { background: #f3f4f6; color: var(--text-subtle); font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill); }
.badge-draft { background: #fffaeb; color: #b54708; font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill); }
.badge-cat { background: var(--surface-hover); color: var(--accent-blue-dark); font-size: 0.72rem; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-pill); }
.badge-orange { background: #fff8ed; color: var(--accent-orange); font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: white;
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  border: 1px solid var(--border-card);
}
.modal-box.wide { max-width: 760px; }
.modal-box.wide.user { max-width: 1080px; }
.modal-hdr {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-hdr-title { font-size: 1.05rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; }
.modal-close-btn {
  background: var(--surface-filter);
  border: none;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  transition: all 0.15s;
}
.modal-close-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.modal-body-pad { padding: 22px 24px 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ── Toggle switch ── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: #dbe7f6;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--accent-blue); }
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: left 0.2s;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.15);
}
.toggle.on::after { left: 23px; }

/* ── Nudge patient preview ── */
.nudge-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  justify-content: flex-end;
}
.nudge-preview-panel {
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
}
@media (min-width: 1024px) {
  .nudge-preview-panel { width: 50vw; max-width: 50vw; }
}
.nudge-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-card);
  flex-shrink: 0;
}
.nudge-preview-layout { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
@media (min-width: 1024px) {
  .nudge-preview-layout { flex-direction: row; }
}
.nudge-preview-list {
  flex-shrink: 0;
  overflow-y: auto;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-card);
  max-height: 36vh;
}
@media (min-width: 1024px) {
  .nudge-preview-list {
    width: 36%;
    min-width: 200px;
    max-width: 280px;
    max-height: none;
    border-bottom: none;
    border-right: 1px solid var(--border-card);
  }
}
.nudge-preview-detail { flex: 1; overflow-y: auto; padding: 20px 22px 28px; background: var(--surface-filter); }
.nudge-preview-card {
  width: 100%;
  text-align: left;
  border: 1.5px solid var(--accent-blue);
  border-radius: 14px;
  background: var(--surface-hover);
  padding: 12px 14px;
  cursor: default;
}
.nudge-preview-respond {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--gradient-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  opacity: 0.55;
  cursor: not-allowed;
  margin-top: 8px;
  font-family: var(--admin-font);
}

/* ── Tabs (Prism nav-pill inspired) ── */
.tab-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px;
  background: var(--surface-filter);
  border-radius: 14px;
  border: 1px solid var(--border-card);
  margin-bottom: 22px;
}
.tab-btn {
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--admin-font);
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  border-radius: 11px;
  background: transparent;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.7); }
.tab-btn.active {
  color: white;
  background: var(--gradient-brand);
  box-shadow: 0 4px 12px rgba(92, 154, 253, 0.35);
}

/* ── Config param row ── */
.param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-card);
  gap: 16px;
  flex-wrap: wrap;
}
.param-row:last-child { border-bottom: none; }
.param-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.param-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ── Section header ── */
.section-cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 10px;
}
.section-cat-header.blue { background: var(--surface-hover); }
.section-cat-header.orange { background: #fff8ed; }
.section-cat-header.purple { background: #f5f3ff; }
.section-cat-header.teal { background: #f0fdfa; }

/* ── Report date chip ── */
.date-chip {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--admin-font);
  cursor: pointer;
  border: 1px solid var(--border-nav);
  background: white;
  color: var(--text-muted);
  transition: all 0.15s;
}
.date-chip.active {
  background: var(--gradient-brand);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(92, 154, 253, 0.3);
}

/* ── WYSIWYG editor ── */
.wysiwyg-wrap {
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  overflow: hidden;
  background: white;
}
.wysiwyg-wrap:focus-within {
  border-color: rgba(47, 104, 255, 0.45);
  box-shadow: var(--focus-ring);
}
.wysiwyg-toolbar {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface-filter);
  border-bottom: 1px solid var(--border-card);
}
.wysiwyg-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background 0.1s;
  font-family: var(--admin-font);
  white-space: nowrap;
  line-height: 1.4;
}
.wysiwyg-btn:hover { background: #e2eaf5; }
.wysiwyg-btn.active { background: var(--surface-hover); color: var(--accent-blue-dark); }
.wysiwyg-btn.insert { background: #ecfdf3; color: var(--accent-green); }
.wysiwyg-btn.insert:hover { background: #d1fae5; }
.wysiwyg-btn.source { background: #fffaeb; color: #b54708; }
.wysiwyg-sep { width: 1px; background: var(--border-card); height: 18px; margin: 0 4px; flex-shrink: 0; }
.wysiwyg-select {
  border: 1px solid var(--border-input);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-family: var(--admin-font);
  color: var(--text-secondary);
  background: white;
  cursor: pointer;
  outline: none;
}
.wysiwyg-panel {
  border-top: 1px solid var(--border-card);
  padding: 14px;
  background: var(--surface-filter);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.wysiwyg-panel-title {
  width: 100%;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-blue-dark);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wp-field { display: flex; flex-direction: column; gap: 4px; }

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: border-color 0.1s;
  flex-shrink: 0;
}
.color-swatch.selected { border-color: var(--text-primary); }

.btn-preview {
  display: inline-block;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--admin-font);
  border: 2px solid transparent;
  cursor: pointer;
  margin-right: 6px;
}

.wysiwyg-area {
  padding: 14px 16px;
  min-height: 140px;
  outline: none;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-primary);
  background: white;
}
.wysiwyg-area h1 { font-size: 1.5rem; font-weight: 800; margin: 8px 0 4px; }
.wysiwyg-area h2 { font-size: 1.2rem; font-weight: 700; margin: 6px 0 4px; }
.wysiwyg-area h3 { font-size: 1rem; font-weight: 700; margin: 6px 0 4px; }
.wysiwyg-area p { margin-bottom: 6px; }
.wysiwyg-area ul { list-style: disc; padding-left: 20px; margin-bottom: 6px; }
.wysiwyg-area ol { list-style: decimal; padding-left: 20px; margin-bottom: 6px; }
.wysiwyg-area a { color: var(--accent-blue); text-decoration: underline; }
.wysiwyg-area table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.wysiwyg-area td, .wysiwyg-area th { padding: 7px 10px; }
.wysiwyg-source {
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  border: none;
  outline: none;
  font-size: 0.78rem;
  font-family: 'Courier New', monospace;
  background: #1e2330;
  color: #a5f3fc;
  resize: vertical;
  line-height: 1.6;
}

/* ── Questionnaire builder ── */
.q-block {
  border: 1px solid var(--border-card);
  border-radius: var(--radius-input);
  padding: 16px;
  background: var(--surface-filter);
  margin-bottom: 14px;
}
.q-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.q-type-pill {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--border-nav);
  border-radius: 11px;
  overflow: hidden;
  background: white;
}
.q-type-btn {
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--admin-font);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.12s;
}
.q-type-btn.active {
  background: var(--gradient-brand);
  color: white;
}
.q-option-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.q-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #d1d5db;
  font-size: 1rem;
  padding: 2px 4px;
  transition: color 0.1s;
}
.q-remove-btn:hover { color: var(--accent-red); }
.q-add-option {
  background: none;
  border: none;
  color: var(--accent-blue-dark);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  font-family: var(--admin-font);
}
.q-add-option:hover { text-decoration: underline; }

/* ── Activity feed ── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-card);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
  flex-shrink: 0;
  margin-top: 6px;
}
.activity-dot.orange { background: var(--accent-orange); }
.activity-dot.green { background: var(--accent-green); }
.activity-dot.red { background: var(--accent-red); }

/* ── MET slider ── */
input[type="range"].umet-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: var(--radius-pill);
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right,
    var(--accent-orange) 0%, var(--accent-orange) var(--uslider-pct, 20%),
    var(--accent-blue) var(--uslider-pct, 20%), var(--accent-blue) 100%);
}
input[type="range"].umet-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--accent-blue);
  box-shadow: 0 2px 6px rgba(92, 154, 253, 0.35);
  cursor: pointer;
  transition: border-color 0.15s;
}
input[type="range"].umet-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--accent-blue);
  box-shadow: 0 2px 6px rgba(92, 154, 253, 0.35);
  cursor: pointer;
}
input[type="range"].umet-slider::-webkit-slider-thumb:hover { border-color: var(--accent-orange); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .admin-content { padding: 20px 16px 28px; }
  .topbar-title { font-size: 1.1rem; }
}

@media (max-width: 768px) {
  .admin-sidebar {
    width: 52px !important;
    flex-shrink: 0;
  }
  .admin-sidebar .sidebar-text,
  .admin-sidebar .sidebar-section-label,
  .admin-sidebar .sidebar-logo-text { display: none !important; }
  .admin-sidebar .sidebar-item {
    padding: 11px 0 !important;
    justify-content: center !important;
    margin: 2px 4px !important;
    border-left-color: transparent !important;
    border-radius: 10px !important;
  }
  .admin-sidebar .sidebar-item.active {
    border-left-color: transparent !important;
    border-right: 3px solid var(--accent-blue) !important;
  }
  .admin-sidebar .sidebar-logo { justify-content: center; padding: 14px 0; }
  .admin-sidebar .sidebar-footer { padding: 12px 0; }
  .admin-sidebar .sidebar-footer .sidebar-item { padding: 9px 0 !important; }
  .sidebar-collapse-btn { display: none !important; }
  .admin-content { padding: 14px 12px 24px; }
  .admin-topbar { padding: 0 14px; height: 60px; }
  .a-card-header { padding: 14px 16px; }
  .a-card-body { padding: 16px; }
  .a-search { width: 100%; }
  .tab-bar { gap: 4px; padding: 3px; }
  .tab-btn { padding: 8px 12px; font-size: 0.8rem; flex: 1 1 auto; text-align: center; min-width: 0; }
}
