/* ── County Map Pro — Admin CSS ──────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Design Tokens — Dark (default) ─────────────────────────────────── */
:root {
  /* Core palette */
  --bg:          #0f1117;
  --surface:     #1a1d27;
  --surface-2:   #242736;
  --surface-3:   #2d3144;
  --border:      #2d3144;
  --border-2:    #3d4260;
  --green:       #4a7c59;
  --green-l:     #5d9970;
  --green-bg:    rgba(74,124,89,.12);
  --green-dim:   rgba(74,124,89,.08);
  --primary:     #4a7c59;
  --primary-hover: #5d9970;
  --primary-rgb: 74, 124, 89;
  --accent:      #6ee7b7;
  --text:        #e8eaf0;
  --muted:       #8b92a8;
  --danger:      #ef4444;
  --danger-bg:   rgba(239,68,68,.12);
  --warn:        #f59e0b;
  --warn-bg:     rgba(245,158,11,.1);
  /* Structural */
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --shadow:      0 4px 24px rgba(0,0,0,.35);
  --sidebar-w:   240px;
  --transition:  .18s ease;
  /* Toast backgrounds */
  --toast-success-bg:   #1a3d2a;
  --toast-success-text: #86efac;
  --toast-error-bg:     #3d1a1a;
  --toast-error-text:   #fca5a5;
  --toast-warn-bg:      #3d2e0a;
  --toast-warn-text:    #fcd34d;
  /* Hint warning */
  --hint-warn-bg:        #1e2a1f;
  --hint-warn-border:    #f59e0b;
  --hint-warn-text:      #fcd34d;
  --hint-warn-code-bg:   rgba(245,158,11,.15);
  --hint-warn-code-text: #fbbf24;
  /* Status pills */
  --vis-public:  #86efac;
  --vis-private: #fca5a5;
  --vis-locked:  #fcd34d;
  /* Audit badge text */
  --audit-badge-success-bg:   rgba(22,163,74,.12);
  --audit-badge-success-text: #86efac;
  --audit-badge-danger-bg:    rgba(220,38,38,.1);
  --audit-badge-danger-text:  #fca5a5;
  --audit-badge-warn-bg:      rgba(245,158,11,.12);
  --audit-badge-warn-text:    #fcd34d;
  --audit-badge-info-bg:      rgba(59,130,246,.1);
  --audit-badge-info-text:    #93c5fd;
  /* Badge role colors */
  --badge-danger-text: #fca5a5;
  --badge-warn-text:   #fcd34d;
  --badge-super-bg:    rgba(139,92,246,.15);
  --badge-super-text:  #c4b5fd;
  --badge-admin-bg:    rgba(59,130,246,.15);
  --badge-admin-text:  #93c5fd;
}

/* ── Design Tokens — Light ───────────────────────────────────────────── */
[data-theme="light"] {
  --bg:          #f0f2f7;
  --surface:     #ffffff;
  --surface-2:   #eef1f6;
  --surface-3:   #e4e8f0;
  --border:      #d8dce8;
  --border-2:    #c4cad8;
  --green:       #2d6a4f;
  --green-l:     #1b4332;
  --green-bg:    rgba(45,106,79,.10);
  --green-dim:   rgba(45,106,79,.06);
  --primary:     #2d6a4f;
  --primary-hover: #1b4332;
  --primary-rgb: 45, 106, 79;
  --accent:      #1b4332;
  --text:        #111827;
  --muted:       #4b5563;
  --danger:      #dc2626;
  --danger-bg:   rgba(220,38,38,.08);
  --warn:        #d97706;
  --warn-bg:     rgba(217,119,6,.10);
  --shadow:      0 4px 24px rgba(0,0,0,.10);
  /* Toast backgrounds */
  --toast-success-bg:   #dcfce7;
  --toast-success-text: #15803d;
  --toast-error-bg:     #fee2e2;
  --toast-error-text:   #b91c1c;
  --toast-warn-bg:      #fef3c7;
  --toast-warn-text:    #92400e;
  /* Hint warning */
  --hint-warn-bg:        #fffbeb;
  --hint-warn-border:    #f59e0b;
  --hint-warn-text:      #92400e;
  --hint-warn-code-bg:   rgba(245,158,11,.15);
  --hint-warn-code-text: #78350f;
  /* Status pills */
  --vis-public:  #15803d;
  --vis-private: #b91c1c;
  --vis-locked:  #92400e;
  /* Audit badge text */
  --audit-badge-success-bg:   rgba(22,163,74,.12);
  --audit-badge-success-text: #15803d;
  --audit-badge-danger-bg:    rgba(220,38,38,.10);
  --audit-badge-danger-text:  #b91c1c;
  --audit-badge-warn-bg:      rgba(245,158,11,.12);
  --audit-badge-warn-text:    #92400e;
  --audit-badge-info-bg:      rgba(59,130,246,.10);
  --audit-badge-info-text:    #1d4ed8;
  /* Badge role colors */
  --badge-danger-text: #b91c1c;
  --badge-warn-text:   #92400e;
  --badge-super-bg:    rgba(109,40,217,.10);
  --badge-super-text:  #6d28d9;
  --badge-admin-bg:    rgba(37,99,235,.10);
  --badge-admin-text:  #1d4ed8;
}

/* ── OS-level preference (used before user manually picks) ───────────── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:          #f0f2f7;
    --surface:     #ffffff;
    --surface-2:   #eef1f6;
    --surface-3:   #e4e8f0;
    --border:      #d8dce8;
    --border-2:    #c4cad8;
    --green:       #3a7a50;
    --green-l:     #4d9964;
    --green-bg:    rgba(58,122,80,.10);
    --green-dim:   rgba(58,122,80,.06);
    --accent:      #1a6640;
    --text:        #1a1d27;
    --muted:       #5a6278;
    --danger:      #dc2626;
    --danger-bg:   rgba(220,38,38,.08);
    --warn:        #d97706;
    --warn-bg:     rgba(217,119,6,.10);
    --shadow:      0 4px 24px rgba(0,0,0,.10);
    --toast-success-bg:   #dcfce7;
    --toast-success-text: #15803d;
    --toast-error-bg:     #fee2e2;
    --toast-error-text:   #b91c1c;
    --toast-warn-bg:      #fef3c7;
    --toast-warn-text:    #92400e;
    --hint-warn-bg:        #fffbeb;
    --hint-warn-border:    #f59e0b;
    --hint-warn-text:      #92400e;
    --hint-warn-code-bg:   rgba(245,158,11,.15);
    --hint-warn-code-text: #78350f;
    --vis-public:  #15803d;
    --vis-private: #b91c1c;
    --vis-locked:  #92400e;
    --audit-badge-success-bg:   rgba(22,163,74,.12);
    --audit-badge-success-text: #15803d;
    --audit-badge-danger-bg:    rgba(220,38,38,.10);
    --audit-badge-danger-text:  #b91c1c;
    --audit-badge-warn-bg:      rgba(245,158,11,.12);
    --audit-badge-warn-text:    #92400e;
    --audit-badge-info-bg:      rgba(59,130,246,.10);
    --audit-badge-info-text:    #1d4ed8;
    --badge-danger-text: #b91c1c;
    --badge-warn-text:   #92400e;
    --badge-super-bg:    rgba(109,40,217,.10);
    --badge-super-text:  #6d28d9;
    --badge-admin-bg:    rgba(37,99,235,.10);
    --badge-admin-text:  #1d4ed8;
  }
}

/* ── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg);
       color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ══════════════════════════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════════════════════════ */
#app { display: flex; min-height: 100vh; }
#sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
           display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
           transition: transform var(--transition); }
#main    { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
#content { flex: 1; padding: 32px; max-width: 1100px; width: 100%; }

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar-brand { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo  { display: flex; align-items: center; gap: 10px; }
.sidebar-logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg,var(--green),var(--green-l));
                     border-radius: 8px; display: flex; align-items: center; justify-content: center;
                     font-size: 18px; flex-shrink: 0; }
.sidebar-logo-text { font-size: .95rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.sidebar-logo-sub  { font-size: .7rem; color: var(--muted); font-weight: 400; }
.sidebar-nav   { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section   { padding: 8px 16px 4px; font-size: .68rem; text-transform: uppercase;
                 letter-spacing: .1em; color: var(--muted); }
.nav-item      { display: flex; align-items: center; gap: 10px; padding: 9px 16px;
                 color: var(--muted); font-size: .875rem; font-weight: 500; cursor: pointer;
                 border-radius: 0; transition: all var(--transition); position: relative;
                 border-left: 3px solid transparent; }
.nav-item:hover { background: var(--green-dim); color: var(--text); }
.nav-item.active { background: var(--green-bg); color: var(--accent); border-left-color: var(--green); }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.sidebar-user   { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius);
                  cursor: pointer; transition: background var(--transition); }
.sidebar-user:hover { background: var(--surface-2); }
.user-avatar   { width: 32px; height: 32px; border-radius: 50%; background: var(--green);
                 display: flex; align-items: center; justify-content: center; font-weight: 700;
                 font-size: .85rem; color: #fff; flex-shrink: 0; }
.user-info     { flex: 1; min-width: 0; }
.user-name     { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role     { font-size: .72rem; color: var(--muted); text-transform: capitalize; }

/* ── Top bar ──────────────────────────────────────────────────────────── */
#topbar { padding: 0 32px; height: 56px; display: flex; align-items: center; justify-content: space-between;
          border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 50; }
.topbar-title  { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.topbar-right  { display: flex; align-items: center; gap: 12px; }

/* ══════════════════════════════════════════════════════════════════════
   COMPONENTS
══════════════════════════════════════════════════════════════════════ */

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius);
       font-size: .875rem; font-weight: 500; border: 1px solid transparent; transition: all var(--transition); }
.btn-primary  { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-l); border-color: var(--green-l); }
.btn-ghost    { background: transparent; color: var(--muted); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger   { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.2); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-xs { padding: 3px 8px; font-size: .75rem; border-radius: 5px; }
.btn-icon { padding: 7px; border-radius: var(--radius); background: transparent; border: 1px solid var(--border-2);
            color: var(--muted); transition: all var(--transition); }
.btn-icon:hover { background: var(--surface-2); color: var(--text); }

[data-theme="light"] .btn-ghost {
  background: #ffffff;
  color: #374151;
  border-color: #d1d5db;
}
[data-theme="light"] .btn-ghost:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #9ca3af;
}
[data-theme="light"] .btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}
[data-theme="light"] .btn-danger:hover {
  background: #fecaca;
  color: #991b1b;
  border-color: #f87171;
}

/* ── Notice & Alert Boxes ─────────────────────────────────────────────── */
.notice-box {
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: .84rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 8px;
}
.notice-box-success {
  background: var(--audit-badge-success-bg);
  border: 1px solid color-mix(in srgb, var(--audit-badge-success-text) 30%, transparent);
  color: var(--audit-badge-success-text);
}
.notice-box-warn {
  background: var(--audit-badge-warn-bg);
  border: 1px solid color-mix(in srgb, var(--audit-badge-warn-text) 35%, transparent);
  color: var(--audit-badge-warn-text);
}
.notice-box-danger {
  background: var(--audit-badge-danger-bg);
  border: 1px solid color-mix(in srgb, var(--audit-badge-danger-text) 35%, transparent);
  color: var(--audit-badge-danger-text);
}
.notice-box-info {
  background: var(--audit-badge-info-bg);
  border: 1px solid color-mix(in srgb, var(--audit-badge-info-text) 35%, transparent);
  color: var(--audit-badge-info-text);
}

[data-theme="light"] .notice-box-success {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #14532d;
  font-weight: 500;
}
[data-theme="light"] .notice-box-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #854d0e;
  font-weight: 500;
}
[data-theme="light"] .notice-box-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-weight: 500;
}
[data-theme="light"] .notice-box-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-weight: 500;
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title  { font-size: 1rem; font-weight: 600; }
.card-subtitle { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* ── Stats grid ───────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
              padding: 20px; position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, var(--green-dim), transparent); }
.stat-number { font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-label  { font-size: .78rem; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; }
.stat-icon   { position: absolute; right: 16px; top: 16px; font-size: 1.5rem; opacity: .3; }

/* ── Table ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th { padding: 12px 16px; text-align: left; font-size: .72rem; font-weight: 600; color: var(--muted);
           text-transform: uppercase; letter-spacing: .07em; background: var(--surface-2);
           border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody td { padding: 13px 16px; vertical-align: middle; }
.td-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }

/* ── Layer transfer action menu (⋮ button per row) ─────────────────────── */
.cl-action-wrap { position: relative; display: inline-block; }
.cl-action-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 600;
  min-width: 200px; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.35); padding: 4px 0;
  animation: fadeInDown .12s ease;
}
/* Open upward — for row menus near the bottom of the table */
.cl-action-menu--up {
  top: auto;
  bottom: calc(100% + 4px);
  animation-name: fadeInUp;
}
@keyframes fadeInUp { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }
.cl-action-menu-section { padding: 4px 10px 2px; font-size: .68rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cl-action-menu button {
  display: block; width: 100%; padding: 7px 14px; background: none; border: none;
  text-align: left; font-size: .8rem; color: var(--text); cursor: pointer;
  transition: background .12s;
}
.cl-action-menu button:hover { background: var(--surface-3); }
.cl-action-menu button.danger { color: var(--danger); }
.cl-action-menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
@keyframes fadeInDown { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:none; } }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
         font-size: .72rem; font-weight: 600; letter-spacing: .02em; }
.badge-green  { background: var(--green-bg); color: var(--accent); }
.badge-muted  { background: var(--surface-3); color: var(--muted); }
.badge-danger { background: var(--danger-bg); color: var(--badge-danger-text); }
.badge-warn   { background: var(--warn-bg); color: var(--badge-warn-text); }
.badge-role-superadmin { background: var(--badge-super-bg); color: var(--badge-super-text); }
.badge-role-admin      { background: var(--badge-admin-bg); color: var(--badge-admin-text); }
.badge-role-editor     { background: var(--green-bg); color: var(--accent); }
.badge-role-viewer     { background: var(--surface-3); color: var(--muted); }

/* ── Unsaved / Dirty Field Highlighting ────────────────────────────── */
.is-dirty-field,
.rte-wrap.is-dirty-field .rte-editor,
.rte-wrap.is-dirty-field textarea.rte-raw {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2) !important;
}
.form-group.is-dirty-group > .form-label::after {
  content: " ● modified";
  font-size: 0.72rem;
  font-weight: 600;
  color: #f59e0b;
  margin-left: 6px;
  animation: fadeIn 0.2s ease;
}
.unsaved-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  margin-left: 10px;
  vertical-align: middle;
  animation: fadeIn 0.2s ease;
}
.unsaved-modal-list {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 14px 0;
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.84rem;
  list-style: none;
}
.unsaved-modal-list li {
  padding: 4px 0;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.unsaved-modal-list li::before {
  content: "•";
  color: #f59e0b;
  font-size: 1.1rem;
  line-height: 1;
}

/* ── Forms ────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 18px; }
.form-label  { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.form-input  { width: 100%; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border-2);
               border-radius: var(--radius); color: var(--text); font-size: .9rem; transition: border-color var(--transition); }
.form-input:focus { outline: none; border-color: var(--green); }
.form-select { width: 100%; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border-2);
               border-radius: var(--radius); color: var(--text); font-size: .9rem; appearance: none;
               background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%238b92a8'/%3E%3C/svg%3E");
               background-repeat: no-repeat; background-position: right 12px center; }
.form-select:focus { outline: none; border-color: var(--green); }
.form-hint   { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 20px;
               border-top: 1px solid var(--border); }

/* ── Breadcrumb ───────────────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted);
              margin-bottom: 20px; }
.breadcrumb-sep { color: var(--border-2); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }
.breadcrumb-current { color: var(--text); font-weight: 500; }

/* ── Page header ──────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between;
               margin-bottom: 28px; gap: 16px; }
.page-title  { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.page-desc   { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-shrink: 0; }
/* Actions bar that lives BELOW the page title on map detail pages */
.map-actions-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; align-items: center; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 1000;
                 display: flex; align-items: center; justify-content: center; padding: 24px;
                 backdrop-filter: blur(4px); animation: fadeIn .15s ease; }
.modal   { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-xl);
           width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
           animation: slideUp .2s ease; }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex;
                align-items: center; justify-content: space-between; }
.modal-title  { font-size: 1rem; font-weight: 600; }
.modal-close  { background: none; border: none; color: var(--muted); font-size: 1.2rem; padding: 4px;
                border-radius: 4px; transition: color var(--transition); }
.modal-close:hover { color: var(--text); }
.modal-body   { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Alert / Toast ────────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000;
                   display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 16px; border-radius: var(--radius); font-size: .875rem; font-weight: 500;
         box-shadow: var(--shadow); animation: slideInRight .2s ease; max-width: 320px; }
.toast-success { background: var(--toast-success-bg); border: 1px solid var(--green); color: var(--toast-success-text); }
.toast-error   { background: var(--toast-error-bg); border: 1px solid var(--danger); color: var(--toast-error-text); }
.toast-warn    { background: var(--toast-warn-bg); border: 1px solid var(--warn); color: var(--toast-warn-text); }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .5; }
.empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: .85rem; margin-bottom: 20px; }

/* ── Field definition rows (ported from plugin) ───────────────────────── */
.fdr { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.fdr-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.fdr-drag  { cursor: grab; color: var(--muted); font-size: 1.1rem; padding: 4px; user-select: none; }
/* Drag-and-drop states */
.fdr--dragging { opacity: 0.35; box-shadow: 0 0 0 2px var(--accent); }
.fdr--over-top { border-top: 3px solid var(--accent) !important; }
.fdr--over-bot { border-bottom: 3px solid var(--accent) !important; }
/* County name double-click hint */
.td-county-dblclick { cursor: pointer; }
.td-county-dblclick:hover strong { text-decoration: underline; text-decoration-style: dashed; text-underline-offset: 3px; }
.fdr-type-icon { width: 28px; height: 28px; background: var(--green-bg); border-radius: 5px;
                 display: flex; align-items: center; justify-content: center; font-size: .8rem;
                 font-weight: 700; color: var(--accent); flex-shrink: 0; }
.fdr-content { flex: 1; min-width: 0; }
.fdr-label-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fdr-label-input { background: none; border: none; color: var(--text); font-size: .95rem;
                   font-weight: 500; width: auto; max-width: 100%; field-sizing: content; padding: 0; }
.fdr-label-input:focus { outline: none; }
.fdr-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.fdr-type { background: var(--surface-3); border: 1px solid var(--border-2); border-radius: 5px;
            color: var(--muted); font-size: .75rem; padding: 2px 6px; }
.fdr-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.fdr-style-panel { border-top: 1px solid var(--border); padding: 16px; display: none; }
.fdr-style-cols  { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.fdr-style-col-title { font-size: .75rem; font-weight: 600; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em; }
.fdr-preview-row { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--surface-3);
                   border-radius: 6px; margin-top: 10px; }
.fdr-preview-lbl { font-size: .72rem; color: var(--muted); flex-shrink: 0; }
.fdr-preview-sample { font-size: .8rem; }

/* ── Icon row (inside style panel) ───────────────────────────────────────── */
.fdr-icon-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fdr-icon-input { width: 54px !important; text-align: center; font-size: 1.15rem; padding: 4px !important; }
.fdr-icon-pos   { width: 110px; font-size: .78rem; }
.fdr-emoji-toggle { font-size: .72rem; padding: 3px 8px; background: var(--surface-3); border: 1px solid var(--border-2);
                    border-radius: 5px; cursor: pointer; color: var(--muted); transition: background .15s; }
.fdr-emoji-toggle:hover { background: var(--surface-2); color: var(--text); }

/* ── Emoji picker grid ────────────────────────────────────────────────────── */
.cmap-emoji-grid { margin-top: 8px; padding: 10px; background: var(--surface-3); border: 1px solid var(--border);
                   border-radius: 8px; max-height: 220px; overflow-y: auto; }
.cmap-emoji-group { margin-bottom: 8px; }
.cmap-emoji-group-label { display: block; font-size: .63rem; font-weight: 700; text-transform: uppercase;
                           letter-spacing: .07em; color: var(--muted); margin-bottom: 4px; }
.cmap-emoji-btns { display: flex; flex-wrap: wrap; gap: 2px; }
.cmap-emoji-btn { background: var(--surface-2); border: 1.5px solid transparent; border-radius: 5px;
                  cursor: pointer; font-size: 1rem; line-height: 1; padding: 4px 5px; transition: border-color .13s, background .13s; }
.cmap-emoji-btn:hover { background: var(--surface-2); border-color: var(--border-2); }
.cmap-emoji-btn--active { border-color: var(--green) !important; background: var(--green-bg) !important; }

/* ── Hide-label checkbox ──────────────────────────────────────────────────── */
.fdr-hide-lbl-wrap { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); cursor: pointer; margin-top: 6px; }

/* ── Embed code box ───────────────────────────────────────────────────── */
.embed-code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
              padding: 14px; font-family: 'Courier New', monospace; font-size: .78rem; color: var(--accent);
              word-break: break-all; white-space: pre-wrap; }

/* ── Visibility pill ──────────────────────────────────────────────────── */
.vis-public  { color: var(--vis-public); }
.vis-private { color: var(--vis-private); }
.vis-locked  { color: var(--vis-locked); }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
/* Wrapper enables the scroll-fade indicator via ::after */
.tabs-wrap { position: relative; }
.tabs-wrap::after {
  content: '';
  position: absolute; top: 0; right: 0; bottom: 1px; /* stop at border-bottom */
  width: 48px;
  background: linear-gradient(to right, transparent, var(--bg) 85%);
  pointer-events: none;        /* clicks pass through to the tabs */
  opacity: 0;
  transition: opacity .2s ease;
}
/* Visible only when JS confirms there is actually more content to scroll */
.tabs-wrap.has-overflow::after { opacity: 1; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px;
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        /* Hide scrollbar visually while keeping it functional */
        scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab  { padding: 8px 16px; font-size: .875rem; font-weight: 500; color: var(--muted); cursor: pointer;
        border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--transition);
        background: none; border-top: none; border-left: none; border-right: none;
        flex-shrink: 0; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--green); font-weight: 600; }
[data-theme="light"] .tab { color: #4b5563; font-weight: 500; }
[data-theme="light"] .tab:hover { color: #111827; }
[data-theme="light"] .tab.active { color: #15803d; border-bottom-color: #15803d; font-weight: 700; }

/* ── Segmented Sub-Nav Pills (used in Points tab) ─────────────────────── */
.subnav-pills-wrap {
  display: flex;
  align-items: center;
  margin-top: 1rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.subnav-pills-wrap::-webkit-scrollbar { display: none; }
.subnav-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  max-width: 100%;
}
.subnav-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: .84rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
  user-select: none;
}
.subnav-pill:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-3) 60%, transparent);
}
.subnav-pill.active {
  color: var(--text);
  background: var(--surface);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.subnav-pill .badge {
  font-size: .7rem;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--muted);
  font-weight: 600;
}
.subnav-pill.active .badge {
  background: color-mix(in srgb, var(--accent) 15%, var(--surface-2));
  color: var(--accent);
}

/* ── Loading spinner ──────────────────────────────────────────────────── */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border-2);
           border-top-color: var(--green); border-radius: 50%; animation: spin .6s linear infinite; }
.page-loader { display: flex; align-items: center; justify-content: center; min-height: 200px; }

/* ── Theme toggle button ──────────────────────────────────────────────── */
#theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  background: transparent; border: 1px solid var(--border-2);
  border-radius: var(--radius); color: var(--muted);
  cursor: pointer; font-size: 1rem; flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
#theme-toggle:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }
/* Floating variant used on login/auth pages */
#theme-toggle-float {
  position: fixed; top: 16px; right: 16px; z-index: 200;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius); color: var(--muted);
  cursor: pointer; font-size: 1.1rem;
  box-shadow: var(--shadow);
  transition: background var(--transition), color var(--transition);
}
#theme-toggle-float:hover { background: var(--surface-2); color: var(--text); }

/* ── Hint warning pill (ported from plugin) ───────────────────────────── */
.hint-warning { display: inline-block; background: var(--hint-warn-bg); border: 1.5px dashed var(--hint-warn-border);
                border-radius: 999px; color: var(--hint-warn-text); font-size: .65rem; font-weight: 500;
                padding: 3px 10px; margin-top: 5px; line-height: 1.4; }
.hint-warning code { background: var(--hint-warn-code-bg); border-radius: 3px; padding: 0 3px;
                     font-size: .63rem; color: var(--hint-warn-code-text); }

/* ── Animations ───────────────────────────────────────────────────────── */
@keyframes fadeIn     { from { opacity: 0; }          to { opacity: 1; } }
@keyframes slideUp    { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin       { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: none; }
  #main    { margin-left: 0; min-width: 0; }          /* flex min-width fix — prevents content overflow */
  #content { padding: 20px; overflow-x: hidden; }    /* safety catch */
  #topbar  { padding: 0 16px; }                      /* tighten topbar on small screens */
  .form-row { grid-template-columns: 1fr; }
  .fdr-style-cols { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* ── Field Schema — mobile card layout ─────────────────────────────── */
  /* Hide drag handle on touch (drag-to-reorder is desktop only) */
  .fdr-drag { display: none; }

  /* Stack the card: content on top, actions bar below */
  .fdr-card {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 12px 10px;
  }

  /* Content (label + key + type select) fills the full width */
  .fdr-content { flex: 1 1 100%; min-width: 0; }

  /* Actions bar drops to its own row, full width */
  .fdr-actions {
    flex: 1 1 100%;
    width: 100%;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    gap: 10px;
  }

  /* Toggles spread out and wrap if needed */
  .fdr-toggles {
    flex: 1;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding-right: 0;
    margin-right: 0;
    border-right: none;
  }

  /* Make toggle labels slightly easier to read */
  .tgl-label { font-size: .8rem; }

  /* 🎨 and ✕ buttons stay compact at the end */
  .fdr-actions > .btn-icon { flex-shrink: 0; }
}

/* ── Map Styling Section ──────────────────────────────────────────────── */

/* Legacy flat label — kept for any remaining uses */
.style-section-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: .4rem;
  margin-bottom: 1rem;
}

/* ── Section group cards ────────────────────────────────────────────── */
/* Each logical sub-section (County Colors / Popup Colors / Frame / etc.)
   lives in its own slightly elevated box so the boundary is crystal clear. */
.style-group-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 1.1rem;
  margin-bottom: 1rem;
}
.style-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .9rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--border);
}
.style-group-icon {
  font-size: .95rem;
  line-height: 1;
  flex-shrink: 0;
}
/* Tighter row gaps inside group cards */
.style-group-card .form-row { gap: .65rem 1.25rem; }
/* Number inputs inside group cards — slightly narrower */
.style-group-card input[type="number"].form-input { min-width: 70px; }
.style-color-group { min-width: 155px; flex: 0 0 auto; }
.color-swatch-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-swatch-row input[type="color"] {
  width: 40px;
  height: 36px;
  padding: 2px 3px;
  border: 1.5px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  flex-shrink: 0;
}
.color-hex-input {
  width: 100px !important;
  font-family: monospace;
  letter-spacing: .05em;
}
.form-hint {
  font-size: .71rem;
  color: var(--muted);
  font-weight: 400;
}

/* ── Live Style Preview ───────────────────────────────────────────────── */
.sp-preview-layout {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
}
.sp-map-panel { flex: 1.4 1 0; min-width: 0; }
.sp-card-panel { flex: 1 1 0; min-width: 220px; }
.sp-panel-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: .5rem;
}
.sp-map-bg {
  background: var(--cmap-map-bg, #f8f9fa);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: background .25s;
}
.sp-map-bg svg polygon { transition: fill .25s, stroke .25s; }
.sp-map-legend {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 2px; font-size: .67rem; color: var(--muted);
  padding: 5px 9px; background: rgba(0,0,0,.04);
}
.sp-legend-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; vertical-align: middle;
  margin-right: 3px; border: 1px solid rgba(0,0,0,.1);
  transition: background .25s;
}

/* Popup card mockup */
.sp-popup-wrap { padding: 4px 0; }
.sp-popup {
  background: var(--cmap-popup-bg, #fff);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.07);
  overflow: hidden;
  max-width: 270px;
  transition: background .25s;
}
.sp-popup-header {
  height: 52px;
  background: linear-gradient(135deg, var(--cmap-popup-hdr1,#4a7c59), var(--cmap-popup-hdr2,#2e5c3a));
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 8px 10px;
  transition: background .25s;
}
.sp-popup-close-btn {
  background: rgba(0,0,0,.28); border: none; color: #fff;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 11px; cursor: default;
  display: flex; align-items: center; justify-content: center;
}
.sp-popup-body { padding: 12px 14px 14px; }
.sp-county-name {
  color: var(--cmap-popup-title, #1a2e23);
  font-size: 1.02rem; font-weight: 700; margin-bottom: 10px;
  transition: color .25s;
}
.sp-field-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 5px 0; border-bottom: 1px solid rgba(0,0,0,.06); gap: 8px;
}
.sp-field-row:last-child { border-bottom: none; }
.sp-field-label {
  color: var(--cmap-popup-label, #6b7280);
  font-size: .77rem; font-weight: 500; transition: color .25s;
}
.sp-field-value {
  color: var(--cmap-popup-text, #374151);
  font-size: .82rem; text-align: right; transition: color .25s;
}
.sp-toggle-on { color: #16a34a !important; font-weight: 600; }

@media (max-width: 860px) {
  .sp-preview-layout { flex-direction: column; }
  .sp-card-panel { width: 100%; max-width: 320px; }
}

/* ── Audit Log ────────────────────────────────────────────────────────── */
.audit-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  padding: 1rem 1.25rem;
}

.audit-table-wrap { overflow-x: auto; }

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.audit-table thead th {
  padding: .6rem 1rem;
  text-align: left;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.audit-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.audit-table tbody tr:hover { background: var(--surface); }
.audit-table tbody tr:last-child { border-bottom: none; }
.audit-table td { padding: .62rem 1rem; vertical-align: middle; }

.audit-ts   { white-space: nowrap; color: var(--muted); font-size: .76rem; }
.audit-mono { font-family: 'Courier New', monospace; font-size: .78rem; color: var(--muted); }
.audit-ip   { font-family: 'Courier New', monospace; font-size: .74rem; color: var(--muted); }
.audit-detail {
  max-width: 250px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-size: .76rem; cursor: help;
}
.audit-empty { text-align: center; color: var(--muted); padding: 2.5rem; }

/* Action badges */
.audit-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px;
  font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.audit-badge--security { background: rgba(168, 85, 247, .18); color: #c084fc; border: 1px solid rgba(168, 85, 247, .4); }
.audit-badge--danger   { background: var(--audit-badge-danger-bg);  color: var(--audit-badge-danger-text); border: 1px solid rgba(239, 68, 68, .3); }
.audit-badge--warning  { background: var(--audit-badge-warn-bg);    color: var(--audit-badge-warn-text); border: 1px solid rgba(245, 158, 11, .3); }
.audit-badge--success  { background: var(--audit-badge-success-bg); color: var(--audit-badge-success-text); border: 1px solid rgba(34, 197, 94, .3); }
.audit-badge--info     { background: var(--audit-badge-info-bg);    color: var(--audit-badge-info-text); border: 1px solid rgba(59, 130, 246, .3); }
.audit-badge--default  { background: var(--surface);                color: var(--muted); border: 1px solid var(--border); }

[data-theme="light"] .audit-badge--security {
  background: #f3e8ff;
  color: #7e22ce;
  border-color: #d8b4fe;
}

/* Category Filter Pills */
.audit-cat-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.audit-cat-pill {
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.audit-cat-pill:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-2);
}
.audit-cat-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Quick Date Presets */
.audit-date-presets {
  display: flex;
  gap: 4px;
  align-items: center;
}
.audit-preset-btn {
  font-size: .72rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all .12s;
}
.audit-preset-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.audit-filter-bar .btn {
  height: 38px;
  min-height: 38px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* JSON raw box in detail panel */
.audit-json-box {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
  margin-top: 8px;
}

/* Pagination row */
.audit-pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
}
.audit-pager-info { font-size: .8rem; color: var(--muted); }

/* Clickable / expandable audit rows */
.audit-summary-row { transition: background .12s; }
.audit-summary-row:hover { background: rgba(255,255,255,.04); }
.audit-summary-row.audit-row-open { background: rgba(74,124,89,.08); }
.audit-summary-row td:first-child::before {
  content: '▶';
  font-size: .6rem;
  color: var(--muted);
  margin-right: 6px;
  display: inline-block;
  transition: transform .15s;
  vertical-align: middle;
}
.audit-summary-row.audit-row-open td:first-child::before {
  transform: rotate(90deg);
  color: var(--accent);
}
/* Expand detail panel */
.audit-detail-row > td { padding: 0 !important; }
.audit-expand-panel {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  animation: auditExpand .14s ease;
}
@keyframes auditExpand {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.audit-expand-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
}
.audit-expand-section-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);                         /* full text color — not muted */
  background: var(--surface-2);               /* subtle background strip */
  border-bottom: 2px solid var(--border-2);   /* stronger separator line */
  padding: 6px 10px;
  margin-bottom: 10px;
  margin-top: 4px;
  border-radius: 4px 4px 0 0;                 /* rounded top corners only */
}
@media (max-width: 640px) { .audit-expand-grid { grid-template-columns: 1fr; } }


@media (max-width: 720px) {
  .audit-filter-bar { flex-direction: column; }
  .audit-detail { max-width: 140px; }
}

/* ── Export dropdown (reusable) ───────────────────────────────────────── */
.export-dropdown { position: relative; display: inline-block; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 230px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  z-index: 9999;
  overflow: hidden;
  animation: fadeSlideIn .12s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: block; width: 100%; text-align: left;
  padding: .65rem 1rem; background: none; border: none;
  font-size: .85rem; color: var(--text); cursor: pointer;
  transition: background .12s;
}
.dropdown-item:hover { background: var(--surface); }
.dropdown-item + .dropdown-item { border-top: 1px solid var(--border); }

/* ── Pseudo-element collapsible sections ─────────────────────────── */
.fdr-pseudo-details {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.fdr-pseudo-details > summary {
  list-style: none;
  padding: 6px 10px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color .15s, background .15s;
}
.fdr-pseudo-details > summary::before {
  content: '▸';
  font-size: .65rem;
  transition: transform .15s;
}
.fdr-pseudo-details[open] > summary { color: var(--accent); background: var(--surface-2); }
.fdr-pseudo-details[open] > summary::before { transform: rotate(90deg); }
.fdr-pseudo-details > summary::-webkit-details-marker { display: none; }
.fdr-pseudo-inputs {
  padding: 10px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fdr-pseudo-inputs .form-group { margin-bottom: 0; }

/* ══════════════════════════════════════════════════════════════════════
   MOBILE SIDEBAR TOGGLE
══════════════════════════════════════════════════════════════════════ */

/* Hamburger button — hidden on desktop */
#hamburger-btn {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px; padding: 6px;
  background: none; border: 1px solid var(--border-2);
  border-radius: var(--radius); cursor: pointer;
  flex-shrink: 0; margin-right: 10px;
}
#hamburger-btn span {
  display: block; height: 2px; border-radius: 2px;
  background: var(--muted); transition: all .2s ease;
}
#hamburger-btn[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
#hamburger-btn[aria-expanded="true"] span:nth-child(2) {
  opacity: 0; transform: scaleX(0);
}
#hamburger-btn[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Tap-outside overlay */
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 99;
  backdrop-filter: blur(2px);
  animation: fadeIn .18s ease;
}
#sidebar-overlay.visible { display: block; }

/* Show hamburger only on mobile */
@media (max-width: 768px) {
  #hamburger-btn { display: flex; }
  #sidebar { z-index: 100; } /* ensure sidebar sits above the overlay */
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE TABLE → CARD VIEW
══════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .table-wrap { border: none; background: transparent; border-radius: 0; }
  .table-wrap table { border: none; }
  .table-wrap thead { display: none; }

  /* Each row becomes a card */
  .table-wrap tbody tr {
    display: block;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); margin-bottom: 10px;
    overflow: hidden;
  }

  /* Each cell is a stacked block */
  .table-wrap td {
    display: block;
    padding: 9px 16px; border-bottom: 1px solid var(--border);
    font-size: .875rem; text-align: left;
  }
  .table-wrap td:last-child { border-bottom: none; }

  /* Label renders as a small caps line ABOVE the value */
  .table-wrap td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    font-size: .67rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .09em; color: var(--muted);
    margin-bottom: 4px;
  }

  /* Actions cell — flex row of buttons, no label */
  .table-wrap td[data-label=""] {
    display: flex; flex-wrap: wrap; gap: 6px;
    justify-content: flex-end;
  }

  /* Checkbox column — hidden on mobile */
  .county-chk-cell { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════
   AUDIT LOG — MOBILE
══════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Filter bar ──────────────────────────────────────────────────── */
  .audit-filter-bar { gap: .6rem; padding: .75rem 1rem; flex-direction: column; }
  /* Override min-width inline styles so every filter fills full width */
  .audit-filter-bar .form-group {
    width: 100% !important; min-width: 0 !important;
    flex: 1 1 100%; margin: 0 !important;
  }
  .audit-filter-bar .form-input,
  .audit-filter-bar select.form-input { width: 100%; }
  .audit-filter-bar > div:last-child { width: 100%; justify-content: flex-start; }

  /* ── Audit table → card view ─────────────────────────────────────── */
  .audit-table-wrap { overflow-x: hidden; }
  .audit-table { border: none; }
  .audit-table thead { display: none; }

  /* Each summary row becomes a tappable card with clear hierarchy */
  .audit-table .audit-summary-row {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border-2);      /* left accent bar */
    border-radius: var(--radius-lg);
    margin-bottom: 14px;                          /* more breathing room between cards */
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);        /* lift each card off the page */
  }
  .audit-table .audit-summary-row.audit-row-open {
    border-left-color: var(--green);
    box-shadow: 0 2px 10px rgba(74,124,89,.18);
  }

  /* ── TIME cell — acts as the card header ────────────────────────── */
  .audit-table .audit-summary-row td:first-child {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-2);
    padding-bottom: 10px;
  }

  /* ── ACTION cell — most important, slight green tint ────────────── */
  .audit-table .audit-summary-row td:nth-child(3) {
    background: var(--green-dim);
  }

  /* ── IP cell — footer row, de-emphasized ───────────────────────── */
  .audit-table .audit-summary-row td:last-child {
    background: var(--surface-2);
    font-size: .8rem; color: var(--muted);
    border-bottom: none; padding-top: 6px; padding-bottom: 6px;
  }

  /* Individual cells stacked as blocks */
  .audit-table .audit-summary-row td {
    display: block;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    font-size: .875rem; text-align: left;
  }

  /* Override the desktop expand-arrow ::before with the data-label text */
  .audit-table .audit-summary-row td::before,
  .audit-table .audit-summary-row td:first-child::before {
    content: attr(data-label) !important;
    display: block !important;
    font-size: .67rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .09em; color: var(--muted);
    margin-bottom: 4px; margin-right: 0;
    transform: none !important;
    transition: none;
  }
  /* Cancel rotation animation on mobile */
  .audit-table .audit-summary-row.audit-row-open td:first-child::before {
    transform: none !important; color: var(--muted);
  }

  /* Expand detail panel */
  .audit-table .audit-detail-row { display: block; margin-bottom: 14px; }
  .audit-table .audit-detail-row > td { display: block; padding: 0 !important; }
  .audit-expand-grid { grid-template-columns: 1fr !important; }

  /* Pager */
  .audit-pager { flex-direction: column; align-items: center; gap: .5rem; text-align: center; }
}

/* ── Boot overlay ─────────────────────────────────────────────────────────────
   Sits on top of everything while /auth/me is in-flight.
   Prevents the brief flash of dashboard content when loading the page unauthenticated. */
#boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  transition: opacity 0.4s ease;
}
#boot-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}
.boot-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .9rem;
}
.boot-logo span {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--text);
  opacity: .85;
}
#boot-overlay .spinner {
  width: 30px;
  height: 30px;
  border-width: 3px;
}

/* ── Toggle switch component ──────────────────────────────────────────────────
   Usage:
   <label class="tgl-switch">
     <input type="checkbox" class="fdr-req">
     <span class="tgl-track"></span>
     <span class="tgl-label">Label text</span>
   </label> */
.tgl-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.tgl-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.tgl-track {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: var(--border, #3a3f55);
  transition: background .2s;
  flex-shrink: 0;
}
.tgl-track::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.tgl-switch input:checked + .tgl-track {
  background: var(--accent, #4a7c59);
}
.tgl-switch input:checked + .tgl-track::before {
  transform: translateX(14px);
}
.tgl-switch input:disabled + .tgl-track {
  opacity: .45;
  cursor: not-allowed;
}
.tgl-label {
  font-size: .75rem;
  color: var(--muted);
  line-height: 1;
}
/* Field row toggle group — lives inside .fdr-actions on the right */
.fdr-toggles {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 12px;
  margin-right: 4px;
  border-right: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── Map Preview Tab ──────────────────────────────────────────────────────────*/
.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.preview-devices {
  display: flex;
  gap: 4px;
}
.preview-device-btn.active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}
.preview-frame-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 540px;
}
#map-preview-frame {
  width: 100%;
  height: calc(100vh - 230px);
  min-height: 500px;
  border: none;
  border-radius: 8px;
  box-shadow: 0 6px 32px rgba(0, 0, 0, .35);
  background: #fff;
  transition: width .3s cubic-bezier(.4, 0, .2, 1),
              max-width .3s cubic-bezier(.4, 0, .2, 1);
}

/* ── Import Wizard Step Indicator ─────────────────────────────────────────── */
.imp-steps {
  display: flex;
  align-items: center;
  gap: 0;
  padding: .5rem 0 .75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .25rem;
  overflow-x: auto;
  white-space: nowrap;
}

.imp-step {
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
  padding: .25rem .4rem;
  border-radius: 4px;
  transition: color .2s, background .2s;
  flex-shrink: 0;
}

.imp-step--active {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  font-weight: 700;
}

.imp-step--done {
  color: var(--success, #4caf76);
}

.imp-step--done::before {
  content: '✓ ';
  font-size: .7rem;
}

.imp-step-sep {
  color: var(--muted);
  font-size: .8rem;
  padding: 0 .1rem;
  opacity: .5;
  flex-shrink: 0;
}

/* Drop zone drag-over highlight */
.pimp-drop-over {
  border-color: var(--primary) !important;
  background: color-mix(in srgb, var(--primary) 8%, transparent) !important;
}

/* ══════════════════════════════════════════════════════════════════════
   RICH TEXT (WYSIWYG) EDITOR
══════════════════════════════════════════════════════════════════════ */
.rte-wrap {
  border: 1px solid var(--border-2, var(--border));
  border-radius: var(--radius, 6px);
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.rte-wrap:focus-within {
  border-color: var(--green, #4a7c59);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green, #4a7c59) 25%, transparent);
}
.rte-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px 6px;
  background: color-mix(in srgb, var(--surface) 60%, var(--surface-2));
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.rte-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  transition: background .12s, border-color .12s, color .12s;
}
.rte-btn:hover {
  background: var(--surface-3, rgba(255,255,255,.08));
  border-color: var(--border);
  color: var(--text-bright, #fff);
}
.rte-btn:active, .rte-btn.active {
  background: color-mix(in srgb, var(--primary, #4a7c59) 25%, transparent);
  border-color: var(--primary, #4a7c59);
  color: var(--primary, #4a7c59);
}
.rte-btn-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 3px;
}
.rte-editor {
  min-height: 90px;
  max-height: 280px;
  overflow-y: auto;
  padding: 8px 12px;
  color: var(--text);
  font-size: .88rem;
  line-height: 1.5;
  outline: none;
}
.rte-editor[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}
.rte-editor p { margin: 0 0 .5rem; }
.rte-editor p:last-child { margin-bottom: 0; }
.rte-editor ul, .rte-editor ol { margin: 0 0 .5rem 1.25rem; padding: 0; }
.rte-editor a { color: var(--accent, #4a7c59); text-decoration: underline; }
.rte-editor blockquote {
  border-left: 3px solid var(--accent, #4a7c59);
  margin: .4rem 0;
  padding: .2rem .6rem;
  color: var(--muted);
}
.rte-raw {
  width: 100%;
  min-height: 90px;
  padding: 8px 12px;
  background: var(--surface-3);
  color: #a5b4fc;
  border: none;
  font-family: 'Courier New', monospace;
  font-size: .82rem;
  line-height: 1.4;
  outline: none;
  resize: vertical;
  display: none;
}

/* ── Point Clustering Badge Preview ─────────────────────────────────────── */
.cmap-cluster-badge-sample {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.78rem;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25), 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, background 0.2s ease;
}

/* ── Animated County Highlight ───────────────────────────────────────────── */
@keyframes cmap-county-pulse {
  0%   { fill-opacity: 1; }
  50%  { fill-opacity: 0.52; }
  100% { fill-opacity: 1; }
}
@keyframes cmap-county-glow {
  0% {
    stroke-opacity: 0.4;
    stroke: var(--cmap-stroke, #fff);
  }
  50% {
    stroke-opacity: 1;
    stroke: var(--cmap-fill-hover, #4a7c59);
    filter: drop-shadow(0 0 4px var(--cmap-fill-hover, #4a7c59));
  }
  100% {
    stroke-opacity: 0.4;
    stroke: var(--cmap-stroke, #fff);
  }
}
@keyframes cmap-county-shimmer {
  0%   { fill: var(--cmap-fill-data, #b8d4bf); }
  50%  { fill: var(--cmap-fill-hover, #4a7c59); }
  100% { fill: var(--cmap-fill-data, #b8d4bf); }
}
.cmap-county.has-data.cmap-animate-pulse,
.sp-county.sp-has-data.cmap-animate-pulse {
  animation: cmap-county-pulse var(--cmap-anim-duration, 2.4s) ease-in-out infinite;
}
.cmap-county.has-data.cmap-animate-glow,
.sp-county.sp-has-data.cmap-animate-glow {
  animation: cmap-county-glow var(--cmap-anim-duration, 2.8s) ease-in-out infinite;
}
.cmap-county.has-data.cmap-animate-shimmer,
.sp-county.sp-has-data.cmap-animate-shimmer {
  animation: cmap-county-shimmer var(--cmap-anim-duration, 2.2s) ease-in-out infinite;
}
.cmap-county.has-data:hover,
.cmap-county.has-data.active,
.sp-county.sp-has-data:hover,
.sp-county.sp-has-data.active {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .cmap-county.cmap-animate-pulse,
  .cmap-county.cmap-animate-glow,
  .cmap-county.cmap-animate-shimmer,
  .sp-county.cmap-animate-pulse,
  .sp-county.cmap-animate-glow,
  .sp-county.cmap-animate-shimmer {
    animation: none !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   FIELD GROUPS & GROUP STYLING
══════════════════════════════════════════════════════════════════════════════ */
.fdr-group-card {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.fdr-group-card:hover {
  border-color: var(--accent);
}
.fdr-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.fdr-group-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.fdr-group-icon {
  font-size: 1.05rem;
}
.fdr-group-name-input {
  font-weight: 600;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  border-radius: 4px;
  padding: 3px 7px;
  width: auto;
  field-sizing: content;
  max-width: 320px;
  transition: all 0.15s;
}
.fdr-group-name-input:hover,
.fdr-group-name-input:focus {
  background: var(--surface);
  border-color: var(--border);
  outline: none;
}
.fdr-group-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fdr-group-body {
  padding: 12px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fdr-group-body:empty::after {
  content: '📁 Drag fields here or select this group in the field dropdown';
  display: block;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 6px;
}
.fdr-ungrouped-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  margin: 14px 0 8px 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.fdr-group-select {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  max-width: 140px;
  cursor: pointer;
}

/* Modal sizes */
.modal.modal-lg {
  max-width: 880px;
}
.modal.modal-import {
  max-width: 860px;
  width: 95vw;
}
.modal.modal-xl {
  max-width: 1040px;
}

/* Import Field Table */
.imp-table-wrap {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  margin-top: 10px;
}
.imp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}
.imp-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-3);
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-2);
  z-index: 2;
}
.imp-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.imp-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
[data-theme="light"] .imp-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}
.imp-table tbody tr:last-child {
  border-bottom: none;
}
.imp-table tbody td {
  padding: 8px 12px;
  vertical-align: middle;
}

/* Group Style Modal (Spacious Layout) */
.gsm-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.75rem;
  align-items: start;
}
@media (max-width: 860px) {
  .gsm-grid {
    grid-template-columns: 1fr;
  }
}
.gsm-section-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 1.25rem;
}
.gsm-section-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.gsm-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
.gsm-preview-sticky {
  position: sticky;
  top: 10px;
}
.gsm-preview-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  margin-top: 8px;
  transition: all 0.15s ease;
  position: relative;
}

/* ── Theme Presets UI ───────────────────────────────────────────────── */
.theme-presets-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px 20px;
  margin-bottom: 1.5rem;
}
.theme-presets-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.theme-presets-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-presets-scope-select {
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}
.theme-presets-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.theme-preset-pill {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.theme-preset-pill:hover {
  color: var(--text);
  border-color: var(--border-2);
}
.theme-preset-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.theme-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
}
.theme-preset-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  user-select: none;
}
.theme-preset-item:hover {
  transform: translateY(-2px);
  border-color: var(--border-2);
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
.theme-preset-item.active-preset {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light, rgba(74, 124, 89, 0.35)), 0 4px 14px rgba(0,0,0,0.08);
}
.theme-preset-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.theme-preset-item-name {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.theme-preset-active-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--green-dim, #e8f5e9);
  color: var(--green, #2e7d32);
}
.theme-preset-swatches {
  display: flex;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
  margin-bottom: 8px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.theme-preset-swatch {
  flex: 1;
  height: 100%;
  transition: transform 0.15s ease;
}
.theme-preset-item:hover .theme-preset-swatch {
  transform: scaleY(1.05);
}
.theme-preset-item-desc {
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.25;
  margin-bottom: 8px;
}
.theme-preset-apply-btn {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: center;
}
.theme-preset-item:hover .theme-preset-apply-btn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.theme-preset-item.active-preset .theme-preset-apply-btn {
  background: var(--surface-3);
  color: var(--muted);
  border-color: transparent;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════════════════
   CONDITIONAL FIELD VISIBILITY
══════════════════════════════════════════════════════════════════════════════ */
.fdr-cond-btn {
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}
.fdr-cond-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--accent);
}
.fdr-cond-btn--active {
  background: rgba(99, 102, 241, 0.15) !important;
  color: #818cf8 !important;
  border-color: rgba(99, 102, 241, 0.4) !important;
  font-weight: 600;
}
.fdr-cond-btn--open {
  border-color: #818cf8 !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}
.fdr-cond-panel {
  border-top: 1px solid var(--border);
  transition: all 0.15s ease;
}
.cond-field-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}
.form-group[data-cond-enabled="1"] {
  transition: opacity 0.2s ease, max-height 0.2s ease;
}

/* ── County List Layer Switcher Pills ── */
.cl-layer-btn {
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .13s, color .13s, border-color .13s;
  font-family: inherit;
  line-height: 1.5;
}
.cl-layer-btn:hover {
  background: var(--surface-3);
  border-color: var(--green-l);
  color: var(--text);
}
.cl-layer-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff !important;
}
[data-theme="light"] .cl-layer-btn {
  background: #ffffff;
  border-color: #d1d5db;
  color: #374151;
}
[data-theme="light"] .cl-layer-btn:hover {
  background: #f3f4f6;
  border-color: #15803d;
  color: #15803d;
}
[data-theme="light"] .cl-layer-btn.active {
  background: #15803d !important;
  border-color: #15803d !important;
  color: #ffffff !important;
}
.cl-layer-btn:focus-visible {
  outline: 3px solid rgba(var(--primary-rgb, 74,124,89), .4);
  outline-offset: 2px;
}

/* ── Map Activity Feed ────────────────────────────────────────────────────────── */
.map-activity-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.map-activity-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .85rem 1.15rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.map-act-cats {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}
.map-act-cat-btn {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
}
.map-act-cat-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-2);
}
.map-act-cat-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
[data-theme="light"] .map-act-cat-btn {
  background: #ffffff;
  border-color: #d1d5db;
  color: #374151;
}
[data-theme="light"] .map-act-cat-btn:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #9ca3af;
}
[data-theme="light"] .map-act-cat-btn.active {
  background: #15803d !important;
  border-color: #15803d !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(21,128,61,.2);
}
.map-activity-search-wrap {
  position: relative;
  min-width: 220px;
}
.map-activity-search-input {
  width: 100%;
  padding: 6px 12px 6px 30px;
  font-size: .8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.map-activity-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .75rem;
  color: var(--muted);
  pointer-events: none;
}
.map-activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.map-activity-date-group {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.map-activity-date-title {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: 4px 0;
}
.map-activity-date-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  opacity: .6;
}
.map-activity-card {
  display: flex;
  gap: .9rem;
  padding: .9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.map-activity-card--info {
  border-left-color: var(--primary, #4a7c59);
}
.map-activity-card--success {
  border-left-color: #22c55e;
}
.map-activity-card--warning {
  border-left-color: #f59e0b;
}
.map-activity-card--danger {
  border-left-color: #ef4444;
}
.map-activity-card--security {
  border-left-color: #a855f7;
}
.map-activity-card:hover {
  border-color: rgba(74,124,89,.4);
  background: color-mix(in srgb, var(--surface) 95%, var(--primary));
}
.map-activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.map-activity-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.map-activity-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
.map-activity-user-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}
.map-activity-user-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: .75rem;
  font-weight: 600;
  color: var(--text);
}
.map-activity-time {
  font-size: .76rem;
  color: var(--muted);
  white-space: nowrap;
}
.map-activity-action-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.map-activity-subtext {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.4;
}
.map-activity-details-btn {
  margin-top: .4rem;
  align-self: flex-start;
  font-size: .74rem;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: all .12s ease;
}
.map-activity-details-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}
.map-activity-details-panel {
  margin-top: .5rem;
  padding: .6rem .8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .78rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.map-act-detail-tag {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .73rem;
  word-break: break-all;
}

/* ── Bulk Edit Modal Styles ─────────────────────────────────────────────────── */
.bulk-edit-scope-box {
  background: color-mix(in srgb, var(--primary) 7%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: 8px;
  padding: .95rem 1.1rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.bulk-layer-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
}
.bulk-layer-tag {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
}
.bulk-layer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(99, 102, 241, 0.24));
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #d8b4fe;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: .92rem;
  letter-spacing: .01em;
  box-shadow: 0 1px 4px rgba(147, 51, 234, 0.15);
}
[data-theme="light"] .bulk-layer-pill,
:root:not([data-theme="dark"]) .bulk-layer-pill {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.1), rgba(124, 58, 237, 0.14));
  border: 1px solid rgba(147, 51, 234, 0.38);
  color: #6b21a8;
}
.bulk-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .8rem;
  color: var(--text);
}
.bulk-scope-selector-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.bulk-scope-label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text);
}
.bulk-scope-radio-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: .84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.bulk-scope-radio-card:hover {
  border-color: var(--primary);
}
.bulk-scope-radio-card input:checked + span {
  color: var(--primary);
  font-weight: 700;
}
.bulk-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
}
@media (max-width: 600px) {
  .bulk-settings-grid {
    grid-template-columns: 1fr;
  }
}
.bulk-setting-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .65rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.bulk-setting-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
}
.bulk-setting-card select {
  width: 100%;
  font-size: .82rem;
  padding: 5px 8px;
}
.bulk-edit-rules-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-bottom: 1rem;
}
.bulk-edit-rule-row {
  display: grid;
  grid-template-columns: 1.4fr 1.1fr 1.6fr auto;
  gap: .6rem;
  align-items: center;
  padding: .65rem .8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
@media (max-width: 640px) {
  .bulk-edit-rule-row {
    grid-template-columns: 1fr;
  }
}
.bulk-value-wrap {
  width: 100%;
}
.bulk-value-wrap input,
.bulk-value-wrap select,
.bulk-value-wrap textarea {
  width: 100%;
}

/* ── Member Invites & Admin Quick-Select ───────────────────────────────────── */
.member-invites-card {
  margin-top: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}
.member-invite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
  flex-wrap: wrap;
}
.member-invite-email {
  font-weight: 600;
  font-size: .88rem;
  color: var(--text);
}
.member-invite-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--muted);
}
.member-invite-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 4px;
  display: none;
}
.user-search-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .82rem;
  border-bottom: 1px solid var(--border);
  transition: background .12s ease;
}
.user-search-item:last-child {
  border-bottom: none;
}
.user-search-item:hover, .user-search-item.highlighted {
  background: var(--surface-3);
}
[data-theme="light"] .user-search-dropdown {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
[data-theme="light"] .user-search-item:hover, [data-theme="light"] .user-search-item.highlighted {
  background: #f1f5f9;
}

/* ── Analytics Tab Dashboard ─────────────────────────────────────────────────── */
.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.analytics-range-selector {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.analytics-range-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all .15s ease;
}
.analytics-range-btn:hover {
  color: var(--text);
}
.analytics-range-btn.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
[data-theme="light"] .analytics-range-btn.active {
  background: #ffffff;
  color: #15803d;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.analytics-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s;
}
.analytics-kpi-card:hover {
  border-color: rgba(74,124,89,.4);
}
.analytics-kpi-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.analytics-kpi-val {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.analytics-kpi-sub {
  font-size: .75rem;
  color: var(--muted);
}
.analytics-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.analytics-chart-wrap {
  width: 100%;
  height: 240px;
  position: relative;
  margin-top: 14px;
}
.analytics-chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.analytics-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}
.analytics-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.analytics-panel-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.analytics-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.analytics-bar-item:last-child {
  margin-bottom: 0;
}
.analytics-bar-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .82rem;
}
.analytics-bar-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
}
.analytics-bar-val {
  font-weight: 700;
  color: var(--muted);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.analytics-bar-track {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
  width: 100%;
}
.analytics-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .4s cubic-bezier(.4, 0, .2, 1);
}
.analytics-empty-panel {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  font-size: .85rem;
}
.analytics-empty-panel .icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

/* ── Webhooks Tab & Components ────────────────────────────────────────────── */
.webhook-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 18px;
}
.webhook-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color .2s, box-shadow .2s;
  position: relative;
}
.webhook-card:hover {
  border-color: var(--border-hover, var(--border));
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,.06));
}
.webhook-card--inactive {
  opacity: .75;
  background: var(--surface-2);
}
.webhook-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.webhook-url-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 260px;
}
.webhook-url {
  font-family: monospace;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.webhook-events-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
.webhook-event-pill {
  font-size: .74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
}
.webhook-event-pill--all {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}
.webhook-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--muted);
}
.webhook-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.webhook-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.webhook-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.webhook-log-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
}
.webhook-log-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.webhook-log-detail {
  background: var(--surface-2);
  padding: 12px;
  border-radius: 6px;
  font-family: monospace;
  font-size: .78rem;
  overflow-x: auto;
  max-height: 240px;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--border);
}

/* ── County Styling Mode Selector & Color Rules ────────────────────────── */
.styling-mode-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 1.5rem;
}
.mode-card {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: all .18s ease;
  user-select: none;
}
.mode-card:hover {
  border-color: color-mix(in srgb, var(--primary) 60%, var(--border));
  transform: translateY(-1px);
}
.mode-card.active-mode {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface-2));
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.color-rule-card {
  transition: border-color .15s ease, box-shadow .15s ease;
}
.color-rule-card:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border)) !important;
}
.copy-source-item {
  transition: all .15s ease;
}
.copy-source-item:hover {
  border-color: var(--primary) !important;
  background: color-mix(in srgb, var(--primary) 5%, var(--surface-2)) !important;
  transform: translateY(-1px);
}
