﻿/*
 * assets/css/style.css
 *
 * Primary stylesheet for FundingRadar UI screens:
 * - dashboard layout and cards
 * - login/register forms
 * - admin interface and utility components
 * - responsive behavior and visual tokens
 */

/* ===== Design tokens ===== */
:root {
  --bg: #f6fbf6;
  --panel: #ffffff;
  --accent: #2e8b57;
  --accent-light: rgba(46,139,87,0.08);
  --accent-border: rgba(46,139,87,0.12);
  --muted: #6b6b6b;
  --danger: #c23a3a;
  --card-shadow: 0 2px 6px rgba(0,0,0,0.06);
  --radius: 8px;
  --max-width: 1600px;
  --footer-height: 32px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif; color: #0b2a1a; background: var(--bg); min-height: 100vh; padding-bottom: calc(var(--footer-height) + 8px); }
h2 { margin: 0 0 12px; }

html,
body {
  max-width: 100%;
}

/* ===== Layout ===== */
.app { max-width: var(--max-width); margin: 28px auto; display: flex; gap: 20px; padding: 18px; }
.sidebar { width: 210px; background: var(--panel); border-radius: var(--radius); padding: 16px; box-shadow: var(--card-shadow); flex-shrink: 0; }
.main { flex: 1; background: var(--panel); border-radius: var(--radius); padding: 18px; box-shadow: var(--card-shadow); min-width: 0; }

/* ===== Brand / logo ===== */
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.brand-link { text-decoration: none; color: inherit; }
.logo { width: 56px; height: 56px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.logo img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius); display: block; }
.has-logo-img { width: 56px; height: 56px; max-width: 56px; max-height: 56px; }
.brand h2 { line-height: 1; font-size: 1.05rem; margin: 0; }

/* ===== Dashboard admin-like theme ===== */
.dashboard-admin-theme {
  background: linear-gradient(160deg, #f1f7f2 0%, #e8f2ea 55%, #f6fbf6 100%);
  padding-bottom: 0;
}
.dashboard-admin-theme .app {
  max-width: none;
  margin: 0;
  min-height: 100vh;
  padding: 0;
  gap: 0;
  align-items: flex-start;
}
.dashboard-admin-theme .main {
  flex: 1;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 22px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.dashboard-admin-theme .sidebar {
  width: 240px;
  border-radius: 0;
  background: #112e1a;
  color: #c8e6d5;
  box-shadow: none;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}
.dashboard-admin-theme .brand h2 { color: #ffffff; }
.dashboard-admin-theme .brand .small { color: rgba(200,230,213,0.65); }
.dashboard-admin-theme .section-title {
  color: rgba(200,230,213,0.8);
  border-bottom-color: rgba(255,255,255,0.12);
}
.dashboard-admin-theme .filter-btn {
  border-color: rgba(255,255,255,0.16);
  color: rgba(200,230,213,0.86);
}
.dashboard-admin-theme .filter-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.28);
  color: #ffffff;
}
.dashboard-admin-theme .filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}
.dashboard-admin-theme .filter-btn--all {
  color: rgba(200,230,213,0.72);
  border-color: rgba(255,255,255,0.28);
}
.dashboard-admin-theme .filter-btn--all.active {
  background: rgba(255,255,255,0.18);
  color: #ffffff;
  border-color: rgba(255,255,255,0.34);
}
.dashboard-admin-theme .filter-drawer-header {
  border-bottom-color: rgba(255,255,255,0.1);
}
.dashboard-admin-theme .filter-drawer-title {
  color: #ffffff;
}
.dashboard-admin-theme .filter-drawer-close {
  color: rgba(200,230,213,0.8);
}
.dashboard-admin-theme .filter-drawer-footer {
  border-top-color: rgba(255,255,255,0.1);
  background: #112e1a;
}
.dashboard-admin-theme .filter-drawer-reset {
  color: rgba(200,230,213,0.85);
  border-color: rgba(255,255,255,0.2);
}
.dashboard-admin-theme .filter-drawer-reset:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
}
.dashboard-admin-theme .topbar {
  background: var(--panel);
  border: 1px solid #e6f0ea;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* ===== Top bar ===== */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* Favorites toggle — lives inside the user-menu dropdown */
.topbar-fav-btn { display: flex; align-items: center; gap: 6px; font-family: inherit; border-bottom: 1px solid #eaf2ed; }
.topbar-fav-btn--active { color: #b87a10; }
.topbar-fav-btn--active svg { fill: #f5a623; stroke: #f5a623; }
.topbar .has-logo-img { width: 40px; height: 40px; }
.signed-in { color: var(--muted); font-weight: 700; margin-right: 6px; }
.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #cde0d4;
  border-radius: 8px;
  background: #fff;
  color: #163625;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.topbar-link:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

/* ===== Email digest frequency control (dashboard topbar) ===== */
.email-freq-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  background: #fff;
  border: 1px solid #cde0d4;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(16,40,24,0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  user-select: none;
}
.email-freq-control:hover { border-color: var(--accent); }
.email-freq-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(46,139,87,0.18);
}
.email-freq-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.65;
  color: var(--accent);
}
.email-freq-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.email-freq-value {
  font-size: 12px;
  font-weight: 700;
  color: #0b2a1a;
  white-space: nowrap;
}
.email-freq-caret {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.75;
}
/* Invisible native select covers the full pill so the whole area is clickable */
.email-freq-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}
.email-freq-select:disabled { cursor: progress; }

@media (max-width: 900px) {
  .email-freq-control .email-freq-label { display: none; }
}
@media (max-width: 640px) {
  .email-freq-control { padding: 5px 7px; }
}

/* ===== Sort control — drawer (mobile only, hidden on desktop) ===== */
.sort-control--drawer { display: none; }
.sort-select--drawer {
  width: 100%;
  padding: 9px 32px 9px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='rgba(200,230,213,0.7)' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 10px 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #c8e6d5;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: border-color 0.15s, background 0.15s;
}
.sort-select--drawer:hover { border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.12); }
.sort-select--drawer:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(46,139,87,0.25);
}
.sort-select--drawer option { color: #0b2a1a; background: #fff; }

/* ===== Sort control (topbar) ===== */
.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.sort-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.sort-select {
  padding: 6px 28px 6px 10px;
  border: 1px solid #d6e6dc;
  border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 10px 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #0b2a1a;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 100px;
}
.sort-select:hover { border-color: var(--accent-border); }
.sort-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(46,139,87,0.15);
}

.dashboard-search { display: flex; align-items: center; gap: 8px; width: min(520px, 100%); }
.dashboard-search-input {
  width: 100%;
  min-width: 240px;
  padding: 9px 12px;
  border: 1px solid #d6e6dc;
  border-radius: 8px;
  background: #fff;
  color: #0b2a1a;
  font-size: 14px;
}
.dashboard-search-input:focus {
  outline: 2px solid rgba(46,139,87,0.18);
  border-color: var(--accent);
}
.dashboard-search-btn {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--accent); border-radius: 8px;
  background: var(--accent); color: #fff;
  padding: 9px 12px; cursor: pointer;
  font-size: 14px; font-weight: 700;
  white-space: nowrap; transition: opacity 0.15s;
}
.dashboard-search-btn:hover { opacity: 0.88; }
.dashboard-search-btn .search-icon { display: block; }
.dashboard-search-btn .search-spinner { display: none; }
.dashboard-search-btn.is-loading .search-icon { display: none; }
.dashboard-search-btn.is-loading .search-spinner { display: block; }
.dashboard-search-btn.is-loading { pointer-events: none; opacity: 0.7; }
.search-spinner {
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading state on search input */
.dashboard-search-input.is-loading {
  background-image: linear-gradient(90deg, transparent 0%, rgba(46,139,87,0.06) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: searchShimmer 1.5s ease infinite;
}
@keyframes searchShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.dashboard-search-clear {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  color: #374151;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.dashboard-search-clear:disabled {
  display: none;
}

.dashboard-filter-reset {
  width: 100%;
  border: 1px solid #d6e6dc;
  border-radius: 8px;
  background: #ffffff;
  color: #1f6d3f;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
}
.dashboard-filter-reset:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.sidebar-reset-wrap {
  margin: 8px 0 12px;
}

.dashboard-admin-theme .sidebar-reset-wrap {
  margin: 10px 0 14px;
}

.dashboard-admin-theme .dashboard-filter-reset {
  background: transparent;
  color: rgba(200,230,213,0.9);
  border-color: rgba(255,255,255,0.25);
}

.dashboard-admin-theme .dashboard-filter-reset:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  border-color: rgba(255,255,255,0.35);
}

/* ===== Buttons ===== */
.btn { background: var(--accent); color: white; border: none; padding: 10px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn:hover { opacity: 0.92; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-xs { padding: 2px 6px; font-size: 12px; line-height: 1.4; min-width: 24px; }

/* WYSIWYG email editor — make rendered HTML look like a real email */
.email-wysiwyg {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1a1a1a;
}
.email-wysiwyg:focus { border-color: var(--accent, #2e8b57) !important; box-shadow: 0 0 0 2px rgba(46, 139, 87, 0.15); }
.email-wysiwyg h1, .email-wysiwyg h2, .email-wysiwyg h3 { margin: 0.5em 0 0.3em; line-height: 1.25; }
.email-wysiwyg h2 { font-size: 1.25em; }
.email-wysiwyg p { margin: 0 0 0.6em; }
.email-wysiwyg a { color: #1a6fc4; text-decoration: underline; }
.email-wysiwyg ul, .email-wysiwyg ol { margin: 0 0 0.6em 1.5em; }
.email-wysiwyg img { max-width: 100%; height: auto; }
.email-wysiwyg table { border-collapse: collapse; max-width: 100%; }
/* Quill editor overrides */
.ql-editor { min-height: 320px; font-size: 14px; line-height: 1.6; }
.ql-toolbar { border-radius: 6px 6px 0 0; }
.ql-container { border-radius: 0 0 6px 6px; }

.email-wysiwyg blockquote {
  margin: 0 0 0.6em; padding: 4px 12px;
  border-left: 3px solid #ccc; color: #555;
}
.btn-secondary { background: #e8efe9; color: #1a3a2a; border: 1px solid #c6d6cb; }
.btn-secondary:hover { background: #d6e2d8; opacity: 1; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-disabled,
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn-page { background: #f0f4f1; color: #1a3a2a; border: 1px solid #d0dbd3; min-width: 34px; text-align: center; }
.btn-page:hover { background: #dce6df; opacity: 1; }
.btn-page.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #b02a37; }
.btn-danger:active { background: #96232f; }
.btn.is-loading,
.btn-action.is-loading,
.btn-icon.is-loading {
  opacity: 0.7;
  cursor: wait;
  pointer-events: none;
}

form.is-saving {
  opacity: 0.88;
}

form.is-saving .form-section {
  transition: opacity 0.15s ease;
}

form.is-saving input,
form.is-saving select,
form.is-saving textarea,
form.is-saving button {
  cursor: wait;
}

.form-inline-status {
  display: block;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-4px);
  margin-top: 10px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: 0 solid transparent;
  transition: opacity 0.18s ease, transform 0.18s ease, max-height 0.18s ease, padding 0.18s ease, border-width 0.18s ease;
}

.form-inline-status.is-visible {
  max-height: 64px;
  opacity: 1;
  transform: translateY(0);
  padding: 8px 10px;
  border-width: 1px;
}

.form-inline-status.is-success {
  background: rgba(46, 139, 87, 0.12);
  border: 1px solid rgba(46, 139, 87, 0.25);
  color: #1f6d3f;
}

.form-inline-status.is-error {
  background: rgba(194, 58, 58, 0.1);
  border: 1px solid rgba(194, 58, 58, 0.24);
  color: #8c1f1f;
}

.logout-btn-top { background: var(--accent); color: white; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-weight: 700; }
.admin-link, .admin-btn { background: var(--accent); color: white; padding: 6px 10px; border-radius: 6px; text-decoration: none; font-weight: 700; }
.admin-link:hover, .admin-btn:hover { opacity: 0.92; }

/* ===== User menu (topbar) ===== */
.user-menu { position: relative; }
.user-menu-btn {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  height: 36px; padding: 0 10px 0 12px; border-radius: 18px;
  background: var(--accent-light); border: 1px solid var(--accent-border);
  color: var(--accent); cursor: pointer; flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.user-menu-btn:hover, .user-menu-btn[aria-expanded="true"] {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.user-menu-chevron { transition: transform 0.2s; }
.user-menu-btn[aria-expanded="true"] .user-menu-chevron { transform: rotate(180deg); }
.user-menu-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid #d6e6dc; border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 200px; max-width: calc(100vw - 24px); z-index: 200;
  overflow: hidden;
}
.user-menu-dropdown.is-open { display: block; }
.user-menu-email {
  padding: 10px 14px 8px; font-size: 12px; color: var(--muted);
  font-weight: 600; border-bottom: 1px solid #eaf2ed;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.user-menu-item {
  display: block; width: 100%; padding: 10px 14px; font-size: 14px;
  font-weight: 600; font-family: inherit; color: var(--text); text-decoration: none;
  background: none; border: none; text-align: left; cursor: pointer;
  transition: background 0.1s;
}
.user-menu-item:hover { background: var(--accent-light); color: var(--accent); }
.user-menu-item--admin { color: var(--accent); }
.user-menu-item--logout { color: #c0392b; border-top: 1px solid #eaf2ed; }

/* Expandable parent item + indented submenu (e.g. Group Admin > Research Themes) */
.user-menu-item--parent {
  display: flex; align-items: center; justify-content: flex-start; gap: 6px;
}
.user-menu-sub-chevron { flex-shrink: 0; transition: transform 0.2s; }
.user-menu-item--parent[aria-expanded="true"] .user-menu-sub-chevron { transform: rotate(180deg); }
.user-menu-sub {
  display: none; background: #f6faf7; padding: 4px 0;
}
.user-menu-sub.is-open { display: block; animation: user-menu-sub-in 0.16s ease-out; }
.user-menu-sub .user-menu-item {
  position: relative; padding: 11px 16px 11px 28px;
  font-size: 13px; font-weight: 600; line-height: 1.4;
}
/* Tree guide line: visually connects the sub-items to the parent */
.user-menu-sub .user-menu-item::before {
  content: ''; position: absolute; left: 20px; top: 0; bottom: 0;
  width: 2px; background: var(--accent-border); border-radius: 2px; opacity: 0.55;
}
@keyframes user-menu-sub-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Sidebar filters ===== */
.section-title { font-size: 13px; color: var(--muted); font-weight: 700; margin: 12px 0 8px; padding: 6px 4px; border-bottom: 1px solid rgba(0,0,0,0.04); }
.filters { display: flex; flex-direction: column; gap: 6px; }
.filter-btn { background: transparent; border: 1px solid #e6f0ea; padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); text-align: left; font-size: 13px; transition: background 0.1s, border-color 0.1s, color 0.1s; }
.filter-btn:hover { background: var(--accent-light); border-color: var(--accent-border); color: var(--accent); }
.filter-btn.active { background: var(--accent); color: white; border-color: transparent; }
/* "All" reset chip: neutral secondary style, clearly not a real filter value */
.filter-btn--all { color: #6b7280; border-color: #d1d5db; font-size: 12px; }
.filter-btn--all:hover { background: #f3f4f6; border-color: #9ca3af; color: #374151; }
.filter-btn--all.active { background: #e5e7eb; color: #374151; border-color: #9ca3af; }
.filter-group { margin-bottom: 10px; }
/* Status filter: wrap when too many options */
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-row .filter-btn { flex: 1 1 calc(50% - 3px); min-width: 0; text-align: center; }

/* ===== Calls list & cards ===== */
.calls-wrapper { margin-top: 12px; flex: 1; }
.calls-group { margin-bottom: 24px; }
.calls-group h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 10px; }
.calls-group-toggle { cursor: pointer; user-select: none; }
.calls-group-toggle::before { content: '▶ '; font-size: 0.65em; transition: transform 0.2s; display: inline-block; }
.calls-group--collapsed .calls-grid { display: none; }
.calls-group--collapsed .calls-group-toggle::before { transform: rotate(0deg); }
.calls-group:not(.calls-group--collapsed) .calls-group-toggle::before { transform: rotate(90deg); }
.calls-grid { display: flex; flex-direction: column; gap: 12px; }
.pagination-bar { margin-top: 20px; margin-bottom: 12px; display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: wrap; }
.pagination-info { font-size: 13px; color: var(--muted); }
.pagination-btn { padding: 6px 14px; }
.pagination-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.call-card { border-radius: 10px; padding: 16px 20px; background: #fff; border: 1px solid #e6f0ea; display: grid; grid-template-columns: 48px 1fr auto; grid-template-rows: auto auto; gap: 2px 16px; align-items: start; transition: box-shadow 0.15s ease, border-color 0.15s ease; }
.call-card:hover { box-shadow: 0 6px 20px rgba(16,40,24,0.1); border-color: var(--accent-border); }
.call-card .thumb { grid-row: 1 / 3; width: 48px; height: 48px; border-radius: var(--radius); background: linear-gradient(135deg, #e6f6ea, #c8ecd5); display: flex; align-items: center; justify-content: center; color: var(--accent); font-weight: 700; font-size: 0.8em; }
.call-card .body { grid-column: 2; min-width: 0; }
.call-card .call-title { font-weight: 700; margin: 0 0 4px; font-size: 1rem; line-height: 1.35; }
.call-card .call-title:hover { color: var(--accent); }
.call-card .call-title a { color: inherit; text-decoration: none; }
.call-card .call-title a:hover { text-decoration: underline; color: var(--accent); }
.call-card .description { color: #3a5a46; opacity: 0.85; line-height: 1.4; font-size: 0.88em; display: -webkit-box; line-clamp: 2; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.call-card .description.detail-row-placeholder { color: #6f7e74; font-style: italic; opacity: 1; }
.call-card .call-aside { grid-column: 3; grid-row: 1 / 3; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; white-space: nowrap; min-width: 140px; }
.meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.meta.detail-row-placeholder { color: #78867d; font-style: italic; }
/* Feedback trigger button (bottom-right of card) */
.feedback-trigger-btn {
  grid-column: 1 / -1;
  justify-self: end;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.13);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.feedback-trigger-btn:hover { background: rgba(0,0,0,0.06); color: var(--text); }
.feedback-trigger-btn.is-active { background: var(--accent-light); border-color: var(--accent-border); color: var(--accent); }

/* Feedback popover */
.feedback-popover {
  background: #fff;
  border: 1px solid #c8ddd0;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13);
  overflow: hidden;
}
.feedback-popover-section { padding: 4px 0; }
.feedback-popover-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
  box-sizing: border-box;
}
.feedback-popover-item:hover { background: var(--accent-light); }
.feedback-popover-item.is-selected { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.feedback-popover-item:disabled { opacity: 0.6; cursor: progress; }
.feedback-popover-item--expand::after { content: ' ›'; opacity: 0.5; margin-left: auto; }
.feedback-group-picker { padding: 2px 14px 10px 22px; display: flex; flex-direction: column; gap: 2px; }
.feedback-group-picker-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.feedback-group-check-row {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 2px 0;
  user-select: none;
}
.feedback-group-check-row:hover { color: var(--accent); }
.feedback-group-check { accent-color: var(--accent); cursor: pointer; margin: 0; }
.feedback-group-submit-btn {
  align-self: flex-start;
  margin-top: 6px;
  padding: 4px 12px;
  border-radius: 5px;
  border: 1px solid var(--accent-border);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}
.feedback-group-submit-btn:hover { background: var(--accent); color: #fff; }
.feedback-popover-divider { height: 1px; background: rgba(0,0,0,0.08); margin: 2px 0; }
.feedback-note-label { padding: 8px 14px 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
.feedback-note-textarea {
  display: block;
  box-sizing: border-box;
  width: calc(100% - 16px);
  margin: 0 8px;
  padding: 6px 8px;
  border: 1px solid #c8ddd0;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  min-height: 58px;
  background: #fafffe;
  color: var(--text);
}
.feedback-note-textarea:focus { outline: none; border-color: var(--accent); }
.feedback-note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 8px;
  gap: 8px;
}
.feedback-note-status { font-size: 11px; color: var(--muted); flex: 1; }
.feedback-note-status.is-success { color: var(--accent); }
.feedback-note-status.is-error { color: var(--danger); }
.feedback-note-save-btn {
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid var(--accent-border);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}
.feedback-note-save-btn:hover { background: rgba(46,139,87,0.18); }
.feedback-note-save-btn:disabled { opacity: 0.6; cursor: progress; }
.feedback-popover-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 8px;
  gap: 8px;
  border-top: 1px solid rgba(0,0,0,0.07);
}
.feedback-popover-status { font-size: 11px; color: var(--muted); flex: 1; }
.feedback-popover-status.is-success { color: var(--accent); }
.feedback-popover-status.is-error { color: var(--danger); }
.feedback-popover-undo { border: none; background: none; color: var(--muted); font-size: 11px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; padding: 0; }
.feedback-popover-undo:hover { color: var(--text); }
.feedback-popover-undo:disabled { opacity: 0.5; cursor: progress; }
/* Inline feedback section (modal) */
.feedback-inline { border: 1px solid #c8ddd0; border-radius: 8px; background: #fafffe; margin: 0 0 16px; overflow: hidden; }
.feedback-inline-notes { padding: 12px 14px 8px; }
.feedback-inline-toggle {
  display: block;
  width: 100%;
  padding: 6px 14px;
  border: none;
  border-top: 1px solid rgba(0,0,0,0.07);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.feedback-inline-toggle:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.feedback-inline-toggle.is-active { color: var(--accent); }
.feedback-inline-body { border-top: 1px solid rgba(0,0,0,0.07); }
/* Data-issue explanation sub-panel */
.feedback-data-explain { padding: 4px 14px 8px 22px; display: flex; flex-direction: column; gap: 6px; }
.call-card .call-tags { grid-column: 2 / 4; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.call-card .call-focus-areas { grid-column: 2 / 4; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }

/* Favorite (bookmark) button on card */
.fav-btn { display: inline-flex; align-items: center; gap: 4px; position: absolute; bottom: 10px; left: 10px; background: rgba(255,255,255,0.88); border: 1px solid transparent; cursor: pointer; padding: 3px 7px 3px 5px; color: #8fafa0; border-radius: 999px; line-height: 1; transition: color 0.15s, border-color 0.15s, background 0.15s; backdrop-filter: blur(2px); }
.fav-btn:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-light); }
.fav-btn--active { color: #b87a10; border-color: #f5d080; background: #fff8ec; }
.fav-btn--active:hover { color: #9a6508; border-color: #f5a623; background: #fff0d0; }
.fav-btn-label { font-size: 11px; font-weight: 600; letter-spacing: 0.01em; }
.call-card { position: relative; }
.focus-area-pill { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #e1f3dc; color: #2a5a2a; border: 1px solid #b0d9a8; white-space: nowrap; }
.tag-pill { background: var(--accent-light); color: var(--accent); padding: 4px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--accent-border); cursor: pointer; }
.tag-pill:hover { background: rgba(46,139,87,0.14); }
.tag-pill.active { background: var(--accent); color: white; border-color: transparent; }
.tag-pill--rg { background: #e8f0fe; color: #1a56db; border-color: #c3d4f8; cursor: default; }
.tag-pill--removable { display: inline-flex; align-items: center; gap: 4px; }
.tag-pill-remove { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: none; border-radius: 50%; background: transparent; color: inherit; font-size: 14px; line-height: 1; cursor: pointer; opacity: 0.55; transition: opacity 0.1s, background 0.1s; }
.tag-pill-remove:hover { opacity: 1; background: rgba(0,0,0,0.12); }
.tag-pill-remove:disabled { opacity: 0.25; cursor: not-allowed; }

/* Status dots */
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.status-open { background: #28a745; }
.status-closed { background: var(--danger); }

/* Apply button */
.apply-btn { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: white; padding: 10px 16px; border-radius: 6px; text-decoration: none; font-weight: 700; margin-top: 6px; font-size: 14px; line-height: 1.2; border: none; cursor: pointer; transition: background 0.15s, transform 0.1s; }
.apply-btn:hover { background: #1f6d3f; transform: translateY(-2px); }
.apply-btn:active { transform: translateY(0); }

/* ===== Status badge ===== */
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 5px; }
.status-badge--open     { background: #d4edda; color: #155724; }
.status-badge--closed   { background: #f8d7da; color: #721c24; }
.status-badge--upcoming { background: #d1ecf1; color: #0c5460; }
.status-badge--intake_closed   { background: #fde2cf; color: #7c2d12; }
.status-badge--not-eligible  { background: #f5c2c2; color: #6b1010; margin-left: 4px; }
.status-badge--partner-only  { background: #fff3cd; color: #856404; margin-left: 4px; }

/* HAS-eligibility sidebar toggle — exact same look as .filter-btn */
.filter-toggle { display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 10px; border-radius: 6px; border: 1px solid #e6f0ea; cursor: pointer; font-size: 13px; color: var(--muted); background: transparent; transition: background 0.1s, border-color 0.1s, color 0.1s; box-sizing: border-box; user-select: none; }
.filter-toggle:hover { background: var(--accent-light); border-color: var(--accent-border); color: var(--accent); }
.filter-toggle.active { background: var(--accent) !important; color: #fff !important; border-color: transparent; }
.filter-toggle.active span { color: #fff !important; }
.filter-toggle input[type="checkbox"] { display: none; }
.filter-toggle-indicator { font-size: 12px; opacity: 0; transition: opacity 0.1s; }
.filter-toggle.active .filter-toggle-indicator { opacity: 1; }

/* ===== Geo scope pill ===== */
.geo-pill { display: inline-block; margin-top: 5px; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #e8f4fd; color: #1a5276; border: 1px solid #aed6f1; }

/* ===== Condition badges (consortium / cofinancing / periodic) ===== */
.call-conditions { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.condition-badge { display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #fff3cd; color: #856404; border: 1px solid rgba(133,100,4,0.3); }
.condition-badge--periodic { background: #ede9f8; color: #4527a0; border-color: rgba(69,39,160,0.25); }

/* ===== Deadline urgency ===== */
.deadline-urgent { color: var(--danger) !important; font-weight: 700; }
.deadline-soon { color: #b45309 !important; font-weight: 600; }

/* ===== Urgency chip (DB-computed: HOT/WATCH/PLAN) ===== */
.urgency-chip { display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; margin-top: 4px; }
.urgency-hot { background: #fee2e2; color: #991b1b; border: 1px solid rgba(153,27,27,0.25); }
.urgency-watch { background: #fef3c7; color: #92400e; border: 1px solid rgba(146,64,14,0.25); }
.urgency-plan { background: #ede9f8; color: #4527a0; border: 1px solid rgba(69,39,160,0.25); }

/* ===== Budget total-only indicator ===== */
.budget-total-only { font-style: italic; opacity: 0.85; }

/* ===== Budget amount ===== */
.budget-amount { font-weight: 700; color: var(--accent); font-size: 14px; }

/* ===== PDF download link ===== */
.doc-link { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 1.5px solid #d1d5db; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; background: transparent; cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s; }
.doc-link:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.share-link { display: inline-flex; align-items: center; justify-content: center; padding: 6px; border: none; border-radius: 5px; color: var(--muted); background: transparent; cursor: pointer; transition: color 0.15s, background 0.15s; }
.share-link:hover { color: var(--accent); background: var(--accent-light); }
.delete-call-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1.5px solid #fca5a5; border-radius: 6px; color: #dc2626; font-size: 13px; font-weight: 600; background: transparent; cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s; margin-left: auto; }
.delete-call-btn:hover { border-color: #dc2626; background: #fef2f2; }
.delete-call-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Loading skeleton ===== */
.calls-loading { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.skeleton-card { height: 140px; border-radius: 12px; background: linear-gradient(90deg, #f0f6f0, #fff 50%, #f0f6f0); background-size: 400px 100%; animation: shimmer 1.2s ease infinite; }
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }

/* ===== Login / Register ===== */

/* Centered full-height login page */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  padding-bottom: calc(var(--footer-height) + 24px);
  background: var(--bg);
}

.login-box {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.09);
}

/* Brand header */
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.login-brand-logo { height: 40px; width: auto; }
.login-brand h2 { font-size: 1.2rem; font-weight: 700; color: #0b2a1a; margin: 0; }

/* Tab switcher */
.login-tabs {
  display: flex;
  background: var(--bg);
  border: 1px solid #e6f0ea;
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
  width: 100%;
  margin-bottom: 20px;
}
.login-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.login-tab.active { background: #fff; color: #0b2a1a; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.login-tab:not(.active):hover { color: #0b2a1a; }

/* Panes */
.login-pane { width: 100%; }
.login-pane-title { font-size: 1.15rem; font-weight: 700; color: #0b2a1a; margin-bottom: 18px; }

/* Form groups */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.875rem; color: #0b2a1a; }
.form-group input {
  width: 100%; padding: 0.625rem 0.75rem; border: 1.5px solid #e6f0ea;
  border-radius: var(--radius); font-size: 0.9rem; font-family: inherit;
  transition: border-color 0.15s; background: #fff; box-sizing: border-box;
}
.form-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,139,87,0.1); }
.form-group .password-wrap input { padding-right: 2.8rem; }
.form-group--inline { display: flex; flex-direction: row; align-items: center; gap: 8px; margin-bottom: 0.75rem; }

/* Full-width button */
.btn-full { width: 100%; justify-content: center; padding: 0.65rem 1rem; font-size: 0.9rem; border-radius: var(--radius); font-family: inherit; font-weight: 600; }

/* Form rows (legacy / register page) */
.form-row { display: flex; flex-direction: column; margin-bottom: 10px; }
.form-row input,
.form-row select,
.form-row textarea { padding: 10px; border-radius: 6px; border: 1px solid #e9efe9; font-family: inherit; font-size: inherit; width: 100%; box-sizing: border-box; }
.form-row label { font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.form-row--inline { flex-direction: row; align-items: center; gap: 8px; }
.form-input-group { display: flex; gap: 8px; align-items: stretch; }
.form-input-group input { flex: 1; min-width: 0; width: auto; }
.input-char-counter { display: block; text-align: right; font-size: 12px; color: var(--muted, #888); margin-top: 2px; }
.input--disabled { background: #f3f6f3 !important; color: var(--muted) !important; cursor: not-allowed; }
.btn--active { background: #5a7060; }

/* Required field indicator — red asterisk after label */
label.required::after,
label:has(> input[required], > select[required], > textarea[required])::after {
  content: " *";
  color: #c0392b;
  font-weight: 700;
}
.checkbox-label { display: flex; align-items: center; gap: 6px; font-weight: 400; font-size: 13px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: auto; padding: 0; margin: 0; }
.small { font-size: 13px; color: var(--muted); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 40px; }
.toggle-pw { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--muted); padding: 0; line-height: 1; }
.toggle-pw:hover { color: var(--accent); }
.toggle-pw svg { width: 18px; height: 18px; display: block; }
.msg-error { color: var(--danger); font-weight: 600; }
.msg-success { color: var(--accent); font-weight: 600; }
.msg { margin-bottom: 10px; min-height: 1.2em; }

/* ===== Password strength bar ===== */
.password-strength { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.strength-bar { flex: 1; height: 4px; border-radius: 2px; background: #e9efe9; overflow: hidden; }
.strength-fill { height: 100%; width: 0; border-radius: 2px; transition: width 0.25s ease, background-color 0.25s ease; }
.strength-fill.weak   { background: #c0392b; }
.strength-fill.fair   { background: #e67e22; }
.strength-fill.good   { background: #27ae60; }
.strength-fill.strong { background: #1a8040; }
.strength-label { font-size: 11px; color: var(--muted); min-width: 38px; text-align: right; }

/* ===== Admin full-page layout ===== */
.admin-layout { display: flex; min-height: 100vh; background: #112e1a; }
body:has(.admin-layout) { padding-bottom: 0; }
.admin-mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 25;
  cursor: pointer;
}

/* Sidebar */
.admin-sidebar { width: 220px; background: transparent; color: #c8e6d5; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden; flex-shrink: 0; }
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.admin-brand { text-decoration: none; color: inherit; }
.admin-brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; }
.admin-brand-name { font-weight: 700; font-size: 0.95rem; color: white; display: block; }
.admin-brand-sub { font-size: 11px; color: rgba(200,230,213,0.55); display: block; margin-top: 1px; }
.admin-nav { flex: 1; padding: 10px 0; overflow-y: auto; overscroll-behavior: contain; }
.admin-nav-item { display: flex; align-items: center; gap: 8px; padding: 10px 16px; color: rgba(200,230,213,0.75); text-decoration: none; font-size: 14px; cursor: pointer; border: none; background: none; width: 100%; text-align: left; position: relative; transition: background 0.12s, color 0.12s; }
.admin-nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.admin-nav-item.active { background: rgba(46,139,87,0.22); color: white; font-weight: 600; }
.admin-nav-item.active::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; background: var(--accent); border-radius: 0 2px 2px 0; }

/* Admin nav categories (collapsible submenus) */
.admin-nav-category { border-bottom: 1px solid rgba(255,255,255,0.06); }
.admin-nav-cat-btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 10px 16px 8px;
  background: none; border: none; cursor: pointer;
  color: rgba(200,230,213,0.45); font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase;
  font-weight: 600; transition: color 0.12s;
}
.admin-nav-cat-btn:hover { color: rgba(200,230,213,0.8); }
.admin-nav-cat-btn .cat-icon { font-size: 13px; }
.admin-nav-cat-btn .cat-chevron {
  margin-left: auto; font-size: 9px;
  transition: transform 0.18s ease;
}
.admin-nav-cat-btn[aria-expanded="false"] .cat-chevron {
  transform: rotate(-90deg);
}
.admin-nav-sub { overflow: hidden; transition: max-height 0.22s ease, opacity 0.18s ease; max-height: 600px; opacity: 1; }
.admin-nav-cat-btn[aria-expanded="false"] + .admin-nav-sub {
  max-height: 0; opacity: 0; padding: 0;
}
.admin-nav-sub .admin-nav-item {
  padding-left: 26px; font-size: 13px;
}

.admin-content-footer { font-size: 11px; color: #999; text-align: center; padding: 10px 16px; border-top: 1px solid rgba(0,0,0,0.06); width: 100%; }
.nav-icon { margin-left: auto; font-size: 12px; opacity: 0.6; }
.nav-badge { margin-left: auto; background: var(--danger); color: white; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 10px; min-width: 18px; text-align: center; }

/* Content area */
.admin-content { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.admin-topbar { background: var(--panel); border-bottom: 1px solid #e6f0ea; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.admin-topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.admin-back-btn { display: none; font-size: 13px; color: var(--primary); text-decoration: none; white-space: nowrap; }
.admin-back-btn:hover { text-decoration: underline; }
.admin-mobile-menu-btn {
  display: none;
  border: 1px solid #d6e6dc;
  background: #fff;
  color: #0b2a1a;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.admin-page-title { margin: 0; font-size: 1.15rem; font-weight: 700; color: #0b2a1a; }
.admin-user-badge { font-size: 13px; color: var(--muted); background: var(--bg); padding: 5px 12px; border-radius: 20px; border: 1px solid #e6f0ea; }
.admin-main { flex: 1; padding: 24px; }

/* Panels */
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.panel-header { margin-bottom: 16px; }
.panel-body { overflow-x: auto; }

/* Analytics KPI cards */
.kpi-card { transition: transform 0.15s, box-shadow 0.15s; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

/* Analytics KPI grid */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.analytics-kpi-card {
  background: var(--panel);
  padding: 18px 14px;
  border-radius: 10px;
  border: 1px solid var(--clr-border, #e6f0ea);
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.analytics-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.07);
  border-color: var(--accent-border);
}
.analytics-kpi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.analytics-kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: #0b2a1a;
  line-height: 1.15;
}

/* Analytics filter bar with presets */
.analytics-filter-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px 14px;
  background: var(--panel);
  border-radius: 10px;
  border: 1px solid var(--clr-border, #e6f0ea);
}
.analytics-preset-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.analytics-preset-btn {
  padding: 6px 14px;
  border: 1px solid #e6f0ea;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.analytics-preset-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent);
}
.analytics-preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.analytics-custom-range {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}
.analytics-filter-label {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

/* Analytics chart grid */
.analytics-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .analytics-chart-grid {
    grid-template-columns: 1fr;
  }
}
.analytics-chart-card {
  background: var(--panel);
  padding: 18px;
  border-radius: 10px;
  border: 1px solid var(--clr-border, #e6f0ea);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.analytics-chart-card:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  border-color: var(--accent-border);
}
.analytics-chart-title {
  margin: 0 0 14px 0;
  font-size: 13px;
  font-weight: 700;
  color: #0b2a1a;
}

/* Chart canvas containers */
#chart-by-status,
#chart-by-month,
#chart-by-source,
#chart-by-group {
  max-height: 260px;
  max-width: 100%;
}

/* Active cross-filter bar */
.analytics-crossfilter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: #eef7f0;
  border: 1px solid #b8dcc4;
  border-radius: var(--radius);
  font-size: 13px;
}
.analytics-crossfilter-label {
  font-weight: 600;
  color: #0b2a1a;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.analytics-crossfilter-values {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.analytics-crossfilter-values .filter-chip {
  background: rgba(46,139,87,0.1);
  border: 1px solid #b8dcc4;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.analytics-crossfilter-values .filter-chip .filter-chip-remove {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
  opacity: 0.6;
}
.analytics-crossfilter-values .filter-chip .filter-chip-remove:hover {
  opacity: 1;
  color: #e74c3c;
}
.analytics-crossfilter-clear {
  margin-left: auto;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #ccc;
  border-radius: 14px;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
}
.analytics-crossfilter-clear:hover {
  background: #e74c3c;
  color: #fff;
  border-color: #e74c3c;
}

/* Analytics drill-down panel */
.analytics-drilldown {
  margin: 24px 0;
  background: var(--panel);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.analytics-drilldown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid #e9efe9;
}
.analytics-drilldown-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0b2a1a;
}
.analytics-drilldown-body {
  max-height: 400px;
  overflow-y: auto;
}
.analytics-drilldown-body .calls-list-item {
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
}
.analytics-drilldown-body .calls-list-item:hover {
  background: rgba(46,139,87,0.05);
}
.analytics-drilldown-body .calls-list-item-title {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.analytics-drilldown-body .calls-list-item-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Analytics recent calls section */
.analytics-recent-calls {
  margin: 24px 0;
  background: var(--panel);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.analytics-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid #e9efe9;
  flex-wrap: wrap;
  gap: 8px;
}
.analytics-recent-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0b2a1a;
}
.analytics-recent-filters {
  display: flex;
  gap: 4px;
}
.analytics-recent-filter-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--accent-border);
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.analytics-recent-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.analytics-recent-filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.analytics-recent-body {
  max-height: 500px;
  overflow-y: auto;
}
.analytics-recent-body .calls-list-item {
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
}
.analytics-recent-body .calls-list-item:hover {
  background: rgba(46,139,87,0.05);
}

/* Admin call detail modal rows */
.admin-detail-row {
  padding: 6px 0;
  font-size: 13px;
  line-height: 1.5;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.admin-detail-row:last-child {
  border-bottom: none;
}
.admin-detail-row strong {
  display: inline-block;
  min-width: 100px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Chart cursor pointer for clickable charts */
#chart-by-status,
#chart-by-month,
#chart-by-source,
#chart-by-group {
  cursor: pointer;
}

/* ===== Admin tables ===== */
.admin-table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--card-shadow); }
.admin-table th { background: var(--bg); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 10px 14px; text-align: left; border-bottom: 1px solid #e9efe9; }
.admin-table td { padding: 10px 14px; border-bottom: 1px solid rgba(0,0,0,0.04); font-size: 14px; vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: rgba(46,139,87,0.025); }
.admin-table--compact th { padding: 6px 10px; font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--muted); background: none; border-bottom: none; }
.admin-table--compact td { padding: 6px 10px; font-size: 13px; border-bottom: 1px solid rgba(0,0,0,0.04); }
.admin-table--compact tbody tr:last-child td { border-bottom: none; }
.admin-table--compact tbody tr:hover td { background: none; }
.col-id { color: var(--muted); font-size: 12px; width: 44px; }
.actions-cell { white-space: normal; }
.actions-cell .btn-action { margin: 2px 2px 2px 0; }

/* ===== Inline form ===== */
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input,
.inline-form select { padding: 8px 10px; border-radius: 6px; border: 1px solid #e9efe9; font-size: 14px; background: #fff; color: inherit; }

/* ===== Badges ===== */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-success { background: rgba(40,167,69,0.1); color: #1e7e34; }
.badge-warning { background: rgba(255,193,7,0.15); color: #a07800; }
.badge-muted { background: rgba(0,0,0,0.06); color: var(--muted); }
.badge-info { background: var(--accent-light); color: var(--accent); }
.badge-danger { background: rgba(194,58,58,0.1); color: var(--danger); }
.badge-neutral { background: rgba(0,0,0,0.06); color: #3a5a3a; }
/* Theme detail role badge */
#themes-detail-role-badge { font-size: 11px; font-weight: 500; padding: 3px 10px; }

/* ===== Action buttons ===== */
.btn-action { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 5px; font-size: 12px; font-weight: 500; border: 1px solid #e6f0ea; background: white; cursor: pointer; margin-right: 4px; transition: background 0.1s; }
.btn-action:hover { background: var(--bg); }
/* .btn-action staat verder naar onderen in dit bestand dan .btn-danger (regel ~445) en zet
   background: white; bij gelijke specificiteit wint die, terwijl .btn-danger color: #fff zet.
   Resultaat was witte tekst op wit (contrast 1.0). Samengestelde selector: wint altijd op
   .btn-action, ongeacht de volgorde in dit bestand. */
.btn-action.btn-danger { background: #dc3545; color: #fff; border-color: #dc3545; }
.btn-action.btn-danger:hover { background: #b02a37; }
.btn-action.btn-danger:active { background: #96232f; }
.btn-danger-xs { color: var(--danger); border-color: rgba(194,58,58,0.2); }
.btn-danger-xs:hover { background: rgba(194,58,58,0.05); }
.btn-warning { color: #7a5000; border-color: rgba(194,140,0,0.25); background: rgba(255,200,0,0.06); }
.btn-warning:hover { background: rgba(255,200,0,0.12); }
.btn-muted { color: var(--muted); }
/* .btn-muted zet alleen een tekstkleur (bedoeld voor .btn-action, grijs op wit).
   Op .btn — dat background: var(--accent) zet — werd dat grijs op groen: contrast 1.26.
   Samengestelde selector geeft de neutrale knop dezelfde look als .btn-secondary. */
.btn.btn-muted { background: #e8efe9; color: #1a3a2a; border: 1px solid #c6d6cb; }
.btn.btn-muted:hover { background: #d6e2d8; opacity: 1; }
.btn-icon { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); padding: 0 4px; line-height: 1; }
.btn-icon:hover { color: #0b2a1a; }
.btn-icon-xs { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 13px; padding: 1px 4px; border-radius: 3px; line-height: 1; }
.btn-icon-xs:hover { color: var(--danger); background: rgba(194,58,58,0.08); }

/* ===== Skeleton loading ===== */
.skeleton-rows { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--card-shadow); }
.skeleton-row { height: 38px; border-radius: 6px; background: linear-gradient(90deg, #f0f6f0, #fff 50%, #f0f6f0); background-size: 400px 100%; animation: shimmer 1.2s ease infinite; }

/* ===== Empty / error states ===== */
.empty-state { padding: 48px; text-align: center; color: var(--muted); font-size: 14px; }
.error-state { padding: 24px; text-align: center; color: var(--danger); font-size: 14px; }

/* ===== Admin panel component classes ===== */
/* Consistent error message */
.admin-error-msg {
  font-size: 13px;
  color: var(--danger);
  margin-top: 6px;
}
/* Delete confirmation card */
.admin-delete-confirm {
  margin-top: 16px;
  padding: 14px 16px;
  background: #fff5f5;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
}
.admin-delete-confirm-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid #e0a0a0;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 10px;
}
.admin-delete-confirm-input:focus {
  outline: none;
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(194,58,58,0.15);
}
/* Review form card */
.admin-review-card {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #e9efe9;
  border-radius: 8px;
  background: var(--panel);
}
/* Section divider within admin panels */
.admin-section-divider {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e9efe9;
}
/* Editor section separator */
.admin-editor-sep {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e9efe9;
}
/* Selector row for add-member / add-tag */
.admin-assoc-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
/* Label style used in editor sections */
.admin-editor-label {
  font-weight: 600;
  font-size: 13px;
  display: block;
  margin-bottom: 6px;
}
/* Raw content textarea */
.admin-raw-textarea {
  font-family: monospace;
  font-size: 12px;
  width: 100%;
  box-sizing: border-box;
}

/* ===== Global footer notice ===== */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--footer-height);
  padding: 6px 16px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.01em;
  color: #999;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
/* Footer inside main: static, not fixed */
.main .site-footer {
  position: static;
  display: block;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-top: 1px solid rgba(0,0,0,0.06);
  color: #999;
  padding: 10px 16px;
  text-align: center;
  font-size: 11px;
}
/* Footer version (git commit hash, links to GitHub) */
.site-footer-version {
  margin-left: 8px;
  color: #999;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
a.site-footer-version:hover {
  color: var(--accent);
  text-decoration: underline;
}
/* Footer subsidy info link — subtle, same weight as footer text */
.site-footer-subsidy-link a {
  color: #999;
  text-decoration: none;
}
.site-footer-subsidy-link a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.empty-state-sm, .error-state-sm { font-size: 12px; color: var(--muted); padding: 6px 0; }
.review-quick-overview {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #e6f0ea;
  border-radius: 10px;
  background: #fbfdfb;
}
.review-quick-overview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.review-quick-filter-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 220px;
}
.review-quick-filter-select {
  min-width: 220px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #d6e6dc;
  background: #fff;
}
.review-quick-table td:nth-child(2) {
  min-width: 260px;
}
.review-call-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.review-call-cell span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* ===== Settings page ===== */
.settings-page-body {
  background:
    radial-gradient(circle at top left, rgba(46,139,87,0.12), transparent 28%),
    linear-gradient(180deg, #eef7ef 0%, #f6fbf6 100%);
  padding-bottom: 0;
}
.settings-shell {
  min-height: 100vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.settings-header {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.settings-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #0b2a1a;
}
.settings-brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
}
.settings-brand-name {
  display: block;
  font-size: 1rem;
  font-weight: 800;
}
.settings-brand-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.85rem;
}
.settings-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.settings-header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid #d4e4d7;
  background: rgba(255,255,255,0.9);
  color: #183b27;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.settings-header-link:hover {
  border-color: var(--accent);
  background: #fff;
  color: var(--accent);
}
.settings-layout {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}
.settings-intro-card,
.settings-card {
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(46,139,87,0.1);
  box-shadow: 0 18px 40px rgba(17,46,26,0.08);
  border-radius: 20px;
}
.settings-intro-card {
  padding: 28px;
  margin-bottom: 18px;
}
.settings-eyebrow,
.settings-card-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.settings-title {
  margin: 0;
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
  line-height: 1.1;
}
.settings-description {
  max-width: 680px;
  margin: 12px 0 0;
  color: #365846;
  line-height: 1.6;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.settings-card {
  padding: 24px;
}
.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.settings-card h2 {
  margin: 0;
  font-size: 1.25rem;
}
.settings-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.settings-summary-item {
  padding: 14px;
  border-radius: 14px;
  background: #f5faf5;
  border: 1px solid #e0ece2;
}
.settings-summary-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.settings-summary-value {
  display: block;
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.settings-group-list-wrap {
  margin-top: 18px;
}
.settings-subtitle {
  margin: 0 0 10px;
  font-size: 0.95rem;
}
.settings-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.settings-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #f7fbf8;
  border: 1px solid #dfeae2;
  border-radius: 14px;
}
.settings-group-role {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-help-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.settings-status {
  min-height: 20px;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}
.settings-status--success {
  color: #1f6d3f;
}
.settings-status--error {
  color: var(--danger);
}
.settings-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.settings-footer {
  margin-top: 20px;
  padding: 10px 16px 18px;
  text-align: center;
  color: #6f7e74;
  font-size: 11px;
}

/* ===== Preview Drawer ===== */
.btn-preview {
  background: #f0f7f2 !important;
  border-color: #cde0d3 !important;
  color: #2b6e49 !important;
}

.btn-preview:hover {
  background: #e6f2e9 !important;
  border-color: #b8d4c1 !important;
}

.btn-detail {
  background: white !important;
  border-color: #d6e6dc !important;
  color: var(--accent) !important;
}

.btn-detail:hover {
  background: #fbfdfb !important;
  border-color: var(--accent) !important;
}

/* ===== Panel list (group / sources pages) ===== */
.panel-list { display: flex; flex-direction: column; gap: 8px; }
.panel-list-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; background: #f7fbf8; border: 1px solid #dfeae2; border-radius: 10px; }
.panel-list-item-info { flex: 1; min-width: 0; }
.panel-list-item-name { font-weight: 600; font-size: 14px; }
.panel-list-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.panel-list-item-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; align-items: flex-start; padding-top: 2px; }

/* ===== Sources — compact layout ===== */
.source-list-compact {
  gap: 3px;
}

.source-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #f7fbf8;
  border: 1px solid #dfeae2;
  border-radius: 5px;
  cursor: default;
}

.source-row:hover {
  border-color: #bcd5c4;
}

.source-row.is-selected {
  border-color: rgba(46,139,87,0.45);
  box-shadow: inset 0 0 0 1px rgba(46,139,87,0.2);
}

.source-row-name {
  font-weight: 600;
  font-size: 13px;
  color: #0b2a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  flex-shrink: 1;
}

.source-row-abbr {
  font-size: 10px;
  color: #5a7a68;
  background: #eef5ef;
  border: 1px solid #dbe8df;
  padding: 0 5px;
  border-radius: 3px;
  flex-shrink: 0;
  white-space: nowrap;
}

.source-row-pills {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.source-row-calls {
  flex-shrink: 0;
}

.source-row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.12s;
}

.source-row:hover .source-row-actions {
  opacity: 1;
}

.source-row-actions .btn-sm {
  font-size: 10px;
  padding: 2px 6px;
}

/* Admin sources — proper table layout */
[data-panel="sources"] .sources-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
[data-panel="sources"] .sources-table th {
  text-align: left;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5a7a68;
  padding: 8px 10px;
  border-bottom: 2px solid #dbe8df;
}
[data-panel="sources"] .sources-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef5f0;
  vertical-align: middle;
}
[data-panel="sources"] .sources-table tbody tr:hover {
  background: #f0f8f3;
}
[data-panel="sources"] .sources-table .col-active { width: 30px; text-align: center; }
[data-panel="sources"] .sources-table .col-name { min-width: 180px; }
[data-panel="sources"] .sources-table .col-name span {
  font-weight: 600;
  color: #0b2a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  display: inline-block;
}
[data-panel="sources"] .sources-table .col-abbr { width: 80px; }
[data-panel="sources"] .sources-table .col-status { width: 100px; }
[data-panel="sources"] .sources-table .col-calls { width: 60px; text-align: right; }
[data-panel="sources"] .sources-table .col-actions { width: 130px; white-space: nowrap; text-align: right; }
[data-panel="sources"] .sources-table .col-actions .btn-sm {
  font-size: 10px;
  padding: 3px 10px;
}
[data-panel="sources"] .src-abbr-pill {
  font-size: 10px;
  color: #5a7a68;
  background: #eef5ef;
  border: 1px solid #dbe8df;
  padding: 0 6px;
  border-radius: 3px;
  white-space: nowrap;
}

/* ---- Source pills ---- */
.source-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}

.source-pill--active {
  background: rgba(46,139,87,0.12);
  color: #1f6d3f;
}

.source-pill--inactive {
  background: rgba(107,107,107,0.14);
  color: #4f5e56;
}

.source-pill--count {
  background: #e6f0ea;
  color: #2f5140;
}

.source-pill--warn {
  background: rgba(200,150,40,0.14);
  color: #7d6300;
}

/* ---- Health status in source detail panel ---- */
.detail-health-status {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: #f7fbf8;
  border: 1px solid #dfeae2;
  border-radius: 6px;
  font-size: 12px;
}
.detail-health-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.detail-health-label {
  font-weight: 600;
  color: #3c5a4a;
  min-width: 90px;
  flex-shrink: 0;
}
.detail-health-msg {
  color: #8b3a3a;
  word-break: break-word;
  font-size: 11px;
  line-height: 1.4;
}

/* ---- Collapsible Add source form ---- */
.source-add-wrap {
  margin-bottom: 12px;
  padding: 12px;
  background: #f7fbf8;
  border: 1px solid #dfeae2;
  border-radius: 8px;
}

.source-add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.source-add-grid .form-row--wide {
  grid-column: 1 / -1;
}

.source-add-grid .form-row {
  margin: 0;
}

.source-add-grid label {
  font-size: 12px;
  margin-bottom: 2px;
}

.source-add-grid input {
  font-size: 13px;
  padding: 5px 8px;
}

/* ---- Detail edit form (inline) ---- */
.source-detail-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e3ede6;
}

.source-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.source-detail-grid .form-row--wide {
  grid-column: 1 / -1;
}

.source-detail-grid .form-row {
  margin: 0;
}

.source-detail-grid label {
  font-size: 12px;
  margin-bottom: 2px;
}

.source-detail-grid input,
.source-detail-grid textarea {
  font-size: 13px;
  padding: 5px 8px;
}

.source-detail-grid textarea {
  resize: vertical;
  min-height: 3em;
}

.source-detail-actions {
  margin-top: 10px;
  gap: 6px;
}

/* ---- Inline toggle row ---- */
.form-row--inline {
  display: flex;
  align-items: center;
  padding: 2px 0;
}

.form-row-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

.form-row-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-row-toggle-label {
  font-weight: 500;
  color: #0b2a1a;
}

/* ---- Cancel/outline button ---- */
.btn-outline {
  background: transparent !important;
  border-color: #d6e6dc !important;
  color: #4f6e5e !important;
}

.btn-outline:hover {
  border-color: #b0ccba !important;
  color: #2b5c41 !important;
}

.source-detail-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.prompt-markdown-preview {
  margin-top: 8px;
  border: 1px solid #dfeae2;
  border-radius: 8px;
  background: #fbfdfb;
  padding: 10px 12px;
}

.prompt-markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 8px;
  padding: 6px;
  border: 1px solid #dfeae2;
  border-radius: 8px;
  background: #f7fbf8;
}

.prompt-md-btn {
  border: 1px solid #cfddd3;
  background: #ffffff;
  color: #214033;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}

.prompt-md-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.prompt-markdown-preview-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: #385846;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.prompt-markdown-rendered {
  font-size: 13px;
  color: #233a2f;
  line-height: 1.5;
}

.prompt-markdown-rendered p {
  margin: 0 0 6px;
}

.prompt-markdown-rendered p:last-child {
  margin-bottom: 0;
}

.prompt-markdown-rendered ul,
.prompt-markdown-rendered ol {
  margin: 0 0 6px 20px;
  padding: 0;
}

.prompt-markdown-rendered li {
  margin: 2px 0;
}

.prompt-markdown-rendered code {
  background: #eef5ef;
  border: 1px solid #d4e4d8;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

.prompt-markdown-rendered em {
  font-style: italic;
}

.prompt-markdown-rendered a {
  color: #1f6d3f;
  text-decoration: underline;
  word-break: break-word;
}

.prompt-markdown-empty {
  color: var(--muted);
}

/* Member / user search dropdown */
.panel-search-results { position: absolute; z-index: 200; background: #fff; border: 1px solid #dfeae2; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.10); min-width: 240px; max-height: 220px; overflow-y: auto; }
.panel-search-item { padding: 9px 14px; cursor: pointer; font-size: 14px; border-bottom: 1px solid #f0f4f1; }
.panel-search-item:last-child { border-bottom: none; }
.panel-search-item:hover { background: #f5faf5; }
.panel-search-empty { color: var(--muted); cursor: default; }

/* Invite-owner user selector dropdown (positioned under the email input) */
.invite-owner-picker .panel-search-results { top: calc(100% + 4px); left: 0; width: 100%; min-width: 0; }

/* Create-group banner (shown on the dashboard while a group-owner invitation is pending) */
.create-group-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #eaf6ee; border: 1px solid #cfe8d8; border-radius: 10px;
  padding: 10px 16px; margin: 0 0 12px 0; font-size: 13px; color: #0b2a1a;
}
.create-group-banner .btn { flex-shrink: 0; }

/* Modal overlay (edit source) */
.panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 400; display: flex; align-items: center; justify-content: center; padding: 16px; }
.panel-modal { background: var(--panel); border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,0.18); width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px; }
.panel-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #e9efe9; }
.panel-modal-head h3 { margin: 0; font-size: 1.05rem; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--muted); padding: 2px 6px; border-radius: 4px; }
.btn-icon:hover { background: var(--bg); }

#source-editor.panel-overlay {
  align-items: center;
  justify-content: center;
  background: rgba(17, 46, 26, 0.32);
  backdrop-filter: blur(2px);
  padding: 28px;
}

#source-editor .panel-modal {
  width: min(960px, 94vw);
  max-width: 960px;
  max-height: min(88vh, 980px);
  border: 1px solid #dce9df;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(11, 42, 26, 0.16);
  padding: 26px;
}

#source-editor .panel-modal-head {
  margin-bottom: 20px;
  padding-bottom: 14px;
}

/* ===== Calls split view ===== */
.admin-calls-layout { display: flex; gap: 16px; align-items: flex-start; }
.calls-sidebar-list { width: 240px; flex-shrink: 0; background: var(--panel); border-radius: var(--radius); box-shadow: var(--card-shadow); overflow: hidden; max-height: calc(100vh - 160px); overflow-y: auto; }
.calls-list-item { padding: 12px 14px; border-bottom: 1px solid rgba(0,0,0,0.05); cursor: pointer; display: flex; align-items: center; gap: 10px; transition: background 0.1s; }
.calls-list-item:last-child { border-bottom: none; }
.calls-list-item:hover { background: var(--bg); }
.calls-list-item.active { background: rgba(46,139,87,0.07); border-left: 3px solid var(--accent); padding-left: 11px; }
.calls-list-item-info { flex: 1; min-width: 0; }
.calls-list-item-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calls-list-item-meta { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calls-list-item-rgs  { font-size: 10px; color: var(--primary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.8; }

/* Call editor pane */
.call-editor-pane { flex: 1; background: var(--panel); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 20px; }
.call-editor-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #e9efe9; }
.call-editor-header h3 { margin: 0; font-size: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.form-row-full { grid-column: 1 / -1; }
.form-section { border: 1px solid #e9efe9; border-radius: var(--radius); padding: 12px 14px 6px; margin-bottom: 14px; }
.form-section legend { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding: 0 6px; }
.form-actions { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #e9efe9; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.checkbox-group label { display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; font-weight: normal; }

/* ===== Associations ===== */
.assoc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.assoc-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 16px; }
.assoc-card h3 { margin: 0 0 14px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.assoc-selects { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.assoc-selects select { flex: 1; min-width: 100px; padding: 6px 8px; border-radius: 6px; border: 1px solid #e9efe9; font-size: 13px; }
.assoc-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; padding: 6px 0; }
.assoc-tag { display: inline-flex; align-items: center; gap: 5px; background: var(--accent-light); border: 1px solid var(--accent-border); border-radius: 999px; padding: 3px 8px; font-size: 12px; color: var(--accent); }
.assoc-checkbox { display: flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; white-space: nowrap; font-weight: normal; }
.assoc-checkboxes-row { display: flex; flex-direction: row; flex-wrap: wrap; gap: 16px; }

/* ===== Unmatched ===== */
.unmatched-item { background: var(--panel); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 16px; margin-bottom: 12px; }
.unmatched-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.unmatched-header a { color: var(--accent); text-decoration: none; font-size: 13px; }
.unmatched-header a:hover { text-decoration: underline; }
.unmatched-section-label { font-size: 11px; font-weight: 700; color: var(--muted); margin: 10px 0 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.unmatched-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 0; border-top: 1px solid rgba(0,0,0,0.04); }
.unmatched-name { font-weight: 600; font-size: 13px; min-width: 100px; }
.unmatched-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.unmatched-actions select { padding: 4px 8px; border-radius: 6px; border: 1px solid #e9efe9; font-size: 12px; }

/* ===== Scraping Monitor ===== */
.scrape-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.scrape-period-selector { display: flex; align-items: center; gap: 6px; }
.scrape-period-selector label { font-size: 13px; font-weight: 600; color: var(--muted); }
.scrape-period-selector select { padding: 5px 10px; border-radius: 6px; border: 1px solid #e9efe9; font-size: 13px; }

.scrape-digest-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.scrape-card { background: var(--panel); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--card-shadow); border-left: 3px solid var(--accent); }
.scrape-card-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.1; }
.scrape-card-label { font-size: 12px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.scrape-card-danger { border-left-color: var(--danger); }
.scrape-card-danger .scrape-card-value { color: var(--danger); }
.scrape-card-warn { border-left-color: #e67e22; }
.scrape-card-warn .scrape-card-value { color: #e67e22; }
.scrape-card-ok { border-left-color: var(--accent); }

.scrape-alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 12px; font-size: 13px; }
.scrape-alert ul { margin: 6px 0 0 18px; padding: 0; }
.scrape-alert li { margin-bottom: 4px; }
.scrape-alert a { color: inherit; text-decoration: underline; word-break: break-all; }
.scrape-alert-danger { background: #fdf0ef; border: 1px solid #e8c4c0; color: #6b2620; }

.scrape-log-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.scrape-tab { padding: 6px 14px; border-radius: 6px; border: 1px solid #e9efe9; background: var(--panel); font-size: 13px; cursor: pointer; color: var(--muted); transition: all 0.15s ease; }
.scrape-tab:hover { color: var(--text); border-color: var(--accent); }
.scrape-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.scrape-log-table { font-size: 13px; }
.scrape-log-table td { vertical-align: top; }
.scrape-msg-cell { max-width: 340px; overflow: hidden; text-overflow: ellipsis; word-break: break-word; }
.scrape-log-error td { background: #fdf6f5; }
.scrape-log-warning td { background: #fdf9f0; }
.nowrap { white-space: nowrap; }

.badge-stage { background: #e8eefd; color: #2d5ab8; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }

/* ===== Airflow DAG status & runs ===== */
.airflow-dag-status { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.airflow-dag-card { background: var(--panel); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--card-shadow); border-left: 3px solid var(--accent); }
.airflow-dag-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.airflow-dag-name { font-weight: 700; font-size: 15px; }
.airflow-dag-card-meta { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.airflow-dag-card-meta strong { color: var(--text); }

.scrape-section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.scrape-section-header h4 { margin: 0; font-size: 15px; }
.scrape-dag-filter select { padding: 5px 10px; border-radius: 6px; border: 1px solid #e9efe9; font-size: 13px; }

.airflow-runs-table td { vertical-align: middle; }

.airflow-task-detail { margin-top: 16px; padding: 16px; border: 1px solid #e9efe9; border-radius: var(--radius); background: #fbfdfb; }
.airflow-task-detail .btn-icon { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); padding: 0 4px; }
.airflow-task-detail .btn-icon:hover { color: var(--text); }

.scrape-alert-warn { background: #fdf9f0; border: 1px solid #e8d8a0; color: #6b5a20; }

/* ===== Toast notifications ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 99999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #1a2a20; color: #d4e6dc; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.25); font-size: 13px; line-height: 1.4; max-width: 360px; pointer-events: auto; opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease; border: 1px solid #3a5040; }
.toast.toast-show { opacity: 1; transform: translateY(0); }
.toast-error, .toast--error { border-left: 3px solid var(--danger); }
.toast--success { border-left: 3px solid var(--accent); }
.toast--info { border-left: 3px solid #4a7aaa; }
.toast-close { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: auto; padding: 0; border: none; border-radius: 50%; background: transparent; color: #8aa89a; font-size: 16px; cursor: pointer; flex-shrink: 0; transition: background 0.1s; }
.toast-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ===== Call Detail Modal (Tabbed/Collapsible Layout) ===== */
.call-modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; align-items: center; justify-content: center; padding: 16px; }
.call-modal-overlay.open { display: flex; }
.call-modal { background: var(--panel); border-radius: 12px; max-width: min(800px, 100% - 60px); width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.16); }

/* Modal header (sticky, not scrolling) */
.call-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid #e9efe9; flex-shrink: 0; position: sticky; top: 0; z-index: 10; background: var(--panel); }
.call-modal-header h2 { margin: 0; font-size: 1.2rem; font-weight: 700; flex: 1; word-break: break-word; line-height: 1.35; }
.call-modal-close { background: none; border: none; font-size: 28px; color: var(--muted); cursor: pointer; padding: 0; line-height: 1; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.call-modal-close:hover { color: #0b2a1a; }

/* Modal body: scrollable content area */
.call-modal-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

/* ===== Critical Info (Always visible: Status, Deadline, Budget) ===== */
.detail-critical-info { padding: 16px 24px; background: var(--accent-light); border-bottom: 1px solid var(--accent-border); flex-shrink: 0; }
.detail-critical-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.detail-critical-row { display: flex; flex-direction: column; gap: 2px; }
.detail-critical-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.detail-critical-value { font-size: 15px; font-weight: 700; color: #0b2a1a; }
.detail-critical-value.urgent { color: var(--danger); }

/* ===== Tabs (Desktop only, hidden on mobile) ===== */
.detail-tabs { display: flex; gap: 0; border-bottom: 1px solid #e9efe9; background: var(--panel); flex-shrink: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.detail-tab { padding: 12px 20px; border: none; background: none; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; position: relative; transition: color 0.15s ease, background 0.15s ease; }
.detail-tab:hover { background: var(--accent-light); color: var(--accent); }
.detail-tab[aria-selected="true"] { color: var(--accent); }
.detail-tab[aria-selected="true"]::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 3px; background: var(--accent); }

/* ===== Tab panels ===== */
.detail-tab-panels { position: relative; }
.detail-tab-panel { padding: 20px 24px; display: none; }
.detail-tab-panel[aria-hidden="false"] { display: block; }

/* ===== Collapsible Section (Accordeon) ===== */
.detail-section { margin-bottom: 16px; border: 1px solid #e9efe9; border-radius: 8px; overflow: hidden; }
.detail-section-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--bg); cursor: pointer; user-select: none; transition: background 0.15s ease; }
.detail-section-header:hover { background: rgba(46,139,87,0.04); }
.detail-section-header h3 { margin: 0; font-size: 14px; font-weight: 600; color: #0b2a1a; display: flex; align-items: center; gap: 8px; }
.detail-section-toggle { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; transition: transform 0.2s ease; }
.detail-section-toggle.open { transform: rotate(180deg); }
.detail-section-content { padding: 16px; display: none; }
.detail-section.open .detail-section-content { display: block; }
.detail-section.open .detail-section-header { background: #f0f6f0; }

/* ===== Detail rows & grids ===== */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px 20px; }
.detail-row { display: flex; flex-direction: column; gap: 4px; }
.detail-row-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.detail-row-value { font-size: 14px; color: #0b2a1a; line-height: 1.5; }
.detail-row-placeholder { color: #6f7e74 !important; font-style: italic; }
.detail-row-value strong { font-weight: 700; }
.detail-row-list { list-style: none; margin: 0; padding: 0; }
.detail-row-list li { padding: 4px 0; font-size: 14px; line-height: 1.5; color: #0b2a1a; }
.detail-row-list li::before { content: '•'; margin-right: 8px; color: var(--accent); font-weight: 700; }
.detail-section-content > .detail-row-label:not(:first-child) { margin-top: 12px; }
.call-detail-card > .detail-row-label { margin-bottom: 4px; }
.call-detail-card > .detail-row-label:not(:first-child) { margin-top: 12px; }

/* ===== Description text (preserved whitespace) ===== */
.detail-description { font-size: 14px; line-height: 1.7; color: #0b2a1a; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; }

/* ===== Detail tags ===== */
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== AI Insights section ===== */
.ai-insights-root { font-size: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-insight-group { margin-bottom: 12px; }
.ai-insight-group-title { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.ai-insight-item { padding: 8px; background: var(--accent-light); border-radius: 6px; border-left: 3px solid var(--accent); font-size: 13px; }

/* ===== Sticky footer with action buttons ===== */
.call-modal-footer { display: flex; gap: 12px; padding: 18px 24px; border-top: 2px solid #e9efe9; background: var(--panel); flex-shrink: 0; position: sticky; bottom: 0; flex-wrap: wrap; align-items: center; }
.call-modal-footer .apply-btn { flex: 0 1 auto; min-width: 160px; order: -1; }
.call-modal-footer .doc-link { flex: 0 1 auto; }

/* ===== Desktop: collapsible chrome hidden, tabs are sufficient ===== */
@media (min-width: 901px) {
  .detail-section { border: none; border-radius: 0; margin-bottom: 24px; overflow: visible; }
  .detail-section-header { display: none; }
  .detail-section-content { display: block !important; padding: 0; }
}

/* ===== Mobile: show tabs (scrollable), only active panel visible ===== */
@media (max-width: 900px) {
  .call-modal { max-height: 95vh; }
  .detail-tabs { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; -ms-overflow-style: none; }
  .detail-tabs::-webkit-scrollbar { display: none; }
  .detail-tab { flex: 1; min-width: 80px; padding: 14px 10px; font-size: 13px; text-align: center; }
  .call-modal-footer { gap: 8px; padding: 14px 16px; }
  .call-modal-footer .apply-btn { padding: 9px 12px; font-size: 13px; min-width: 140px; }
  .call-modal-footer .doc-link { padding: 7px 11px; font-size: 12px; }
}

/* ===== Responsive ===== */

/* --- Mobile filter button (hidden on desktop, visible in topbar on mobile) --- */
.mobile-filter-btn { display: none; align-items: center; gap: 6px; background: var(--panel); border: 1px solid #d6e6dc; border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.mobile-filter-btn:hover { background: var(--accent-light); border-color: var(--accent); }
.mobile-filter-btn svg { flex-shrink: 0; }
.mobile-filter-reset-btn { display: none; padding: 8px 11px; border-radius: 8px; border: 1px solid #d1d5db; background: #f9fafb; color: #374151; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.mobile-filter-reset-btn:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.mobile-filter-count { display: none; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; text-align: center; line-height: 18px; padding: 0 5px; }
.mobile-filter-count.has-filters { display: inline-block; }

/* --- Filter drawer backdrop --- */
.filter-drawer-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; opacity: 0; transition: opacity 0.25s ease; }
.filter-drawer-backdrop.is-active { display: block; opacity: 1; }

/* --- Filter drawer header (mobile only) --- */
.filter-drawer-header { display: none; align-items: center; justify-content: space-between; padding: 16px 16px 12px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.filter-drawer-title { font-size: 1.1rem; font-weight: 700; }
.filter-drawer-close { background: none; border: none; font-size: 28px; cursor: pointer; color: inherit; padding: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; opacity: 0.7; }
.filter-drawer-close:hover { opacity: 1; }

/* --- Filter drawer footer (mobile only) --- */
.filter-drawer-footer { display: none; gap: 10px; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.1); background: inherit; }
.filter-drawer-reset { flex: 0 0 auto; padding: 10px 16px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.25); background: transparent; color: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.filter-drawer-reset:hover { background: rgba(255,255,255,0.08); }
.filter-drawer-apply { flex: 1; padding: 10px 16px; border-radius: 8px; border: none; background: var(--accent); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.filter-drawer-apply:hover { background: #1f6d3f; }

.detail-section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 8px; }
.detail-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.detail-value { font-size: 14px; font-weight: 500; color: #0b2a1a; }
.detail-value a { color: var(--accent); text-decoration: none; word-break: break-all; font-weight: 600; }
.detail-value a:hover { text-decoration: underline; }
.detail-prime-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 2px solid #e6f0ea; }
.detail-prime-bar .detail-actions { margin-top: 0; }
.detail-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; padding: 14px; background: #fafffe; border-radius: 8px; margin-bottom: 16px; border: 1px solid #e6f0ea; }
.detail-info-grid .detail-row { gap: 3px; }
.detail-info-grid .detail-label { font-weight: 700; color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.detail-info-grid .detail-value { font-size: 15px; font-weight: 600; color: #0b2a1a; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.detail-actions .apply-btn { font-size: 14px; padding: 8px 16px; }
.detail-actions .doc-link { font-size: 13px; padding: 6px 12px; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }

.ai-expl-group { background: #fbfdfb; border: 1px solid #e6f0ea; border-radius: 8px; padding: 10px; }
.ai-expl-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ai-expl-item { border-top: 1px dashed #e6f0ea; padding-top: 8px; }
.ai-expl-item:first-child { border-top: none; padding-top: 0; }
.ai-expl-name { font-weight: 700; font-size: 13px; color: #0b2a1a; }
.ai-expl-reason { font-size: 13px; color: #3a5a46; margin-top: 3px; line-height: 1.45; }
.ai-expl-highlight { font-weight: 700; color: #0b2a1a; background: #e8f5ed; border-radius: 3px; padding: 0 3px; }
.ai-expl-confidence { font-size: 11px; color: var(--muted); margin-top: 4px; }

.ai-feedback-summary { background: #f9fcfa; border: 1px solid #e6f0ea; border-radius: 8px; padding: 10px; }
.ai-feedback-recent { background: #f9fcfa; border: 1px solid #e6f0ea; border-radius: 8px; padding: 10px; }
.ai-feedback-recent-list { display: flex; flex-direction: column; gap: 4px; margin-top: 5px; }

.ai-feedback-form { border: 1px solid #e6f0ea; border-radius: 8px; padding: 10px; background: #fff; }
.ai-feedback-grid { margin: 8px 0; }
.ai-feedback-select,
.ai-feedback-notes {
  width: 100%;
  border: 1px solid #d6e6dc;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  color: #0b2a1a;
  font-size: 13px;
  font-family: inherit;
}
.ai-feedback-notes { resize: vertical; min-height: 58px; }

/* --- Dedicated call detail page --- */
.call-detail-page { max-width: 980px; margin: 26px auto; padding: 0 16px; }
.call-detail-top { margin-bottom: 12px; }
.call-detail-card { background: var(--panel); border: 1px solid #e6f0ea; border-radius: 12px; box-shadow: var(--card-shadow); padding: 20px; }
.call-detail-header h1 { margin: 0 0 8px; font-size: 1.5rem; line-height: 1.3; }
.share-section { margin-top: 12px; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share-url-input { flex: 1; min-width: 260px; padding: 8px 10px; border: 1px solid #d6e6dc; border-radius: 8px; background: #f8fcf9; color: #153523; }
.call-detail-pill-group { margin-bottom: 10px; }
.call-detail-pill-group:last-child { margin-bottom: 0; }
.call-detail-pill-group .detail-label { display: inline-block; margin-bottom: 4px; }

/* ===== Tablet (≤ 1024px) ===== */
@media (max-width: 1024px) {
  .admin-calls-layout { flex-direction: column; }
  .calls-sidebar-list { width: 100%; max-height: 300px; }
}

/* ===== Medium devices — sidebar becomes slide-in drawer (≤ 900px) ===== */
@media (max-width: 900px) {
  html,
  body,
  .dashboard-admin-theme {
    overflow-x: hidden;
  }

  .dashboard-admin-theme {
    --mobile-drawer-width: min(340px, 92vw);
  }

  .app { flex-direction: column; padding: 12px; margin: 12px auto; gap: 12px; }
  .mobile-filter-btn { display: inline-flex; }
  .mobile-filter-reset-btn.is-visible { display: inline-flex; align-items: center; }
  .sidebar-reset-wrap { display: none; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--mobile-drawer-width);
    height: 100vh;
    height: 100dvh;
    z-index: 101;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0 16px 88px;
    display: flex;
    flex-direction: column;
  }
  .sidebar.drawer-open {
    transform: translateX(0);
  }
  .sidebar .brand { display: none; }
  .filter-drawer-header { display: flex; flex-shrink: 0; position: sticky; top: 0; z-index: 2; background: inherit; }
  .sidebar,
  .dashboard-admin-theme .sidebar { padding-bottom: 88px; }
  .filter-drawer-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: var(--mobile-drawer-width);
    max-width: 100vw;
    z-index: 102;
    gap: 10px;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    background: inherit;
    border-top: 1px solid rgba(0,0,0,0.08);
    margin: 0;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  body.filter-drawer-is-open .filter-drawer-footer,
  .sidebar.drawer-open ~ .filter-drawer-footer {
    display: flex;
    transform: translateX(0);
  }
  .sidebar .filter-group { margin-top: 4px; }
  .sidebar .site-footer { display: none; }

  .dashboard-admin-theme .app { flex-direction: column; padding: 12px; margin: 12px; gap: 12px; }
  .dashboard-admin-theme .sidebar {
    width: var(--mobile-drawer-width);
    border-radius: 0;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 101;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 16px 88px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .dashboard-admin-theme .sidebar.drawer-open { transform: translateX(0); }
  .dashboard-admin-theme .main { border-radius: 10px; padding: 12px; background: var(--panel); }

  .call-card { grid-template-columns: 1fr; }
  .call-card .thumb { display: none; }
  .call-card .body { grid-column: 1; }
  .call-card .call-aside { grid-column: 1; grid-row: auto; align-items: flex-start; flex-direction: row; gap: 10px; flex-wrap: wrap; min-width: 0; }
  .feedback-trigger-btn { align-self: flex-start; }
  .feedback-inline .feedback-popover-section { padding-left: 0; padding-right: 0; }
  .feedback-inline .feedback-popover-footer { justify-content: flex-start; }
  .call-card .call-tags { grid-column: 1; }
  .call-card .call-focus-areas { grid-column: 1; }

  .form-grid { grid-template-columns: 1fr; }
  .admin-layout { position: relative; }
  .admin-mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .admin-back-btn { display: inline-block; }
  .admin-sidebar {
    width: min(320px, 84vw);
    height: calc(100vh - var(--footer-height));
    position: fixed;
    left: 0;
    top: 0;
    z-index: 30;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    background: #112e1a;
  }
  .admin-sidebar.is-open { transform: translateX(0); }
  .admin-mobile-backdrop.is-active { display: block; }
  .admin-content { min-height: calc(100vh - var(--footer-height) - 8px); }
  .admin-main { padding: 16px; }
  .admin-user-badge { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .admin-table { min-width: 0; }
  .scrape-log-table,
  .airflow-runs-table,
  #scrape-queue-list .admin-table { min-width: 760px; }
  .btn-action { margin-bottom: 4px; }
  .assoc-grid { grid-template-columns: 1fr; }

  .call-modal { max-width: 100%; margin: 0; border-radius: 0; max-height: 100vh; }
  .call-modal-overlay { padding: 0; align-items: stretch; }
  .call-modal-header { padding: 14px 16px; }
  .call-modal-header h2 { font-size: 1.05rem; }
  .detail-tab-panel { padding: 14px 16px; }
  .detail-critical-info { padding: 12px 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .ai-feedback-grid { grid-template-columns: 1fr; }
  .call-detail-card { padding: 14px; }
  .call-detail-header h1 { font-size: 1.2rem; }
  .share-url-input { min-width: 0; width: 100%; }

  .topbar { align-items: flex-start; flex-wrap: nowrap; gap: 8px; }
  .topbar-left { flex: 1; min-width: 0; flex-wrap: wrap; gap: 8px; }
  .topbar-right { flex-shrink: 0; }
  .dashboard-search { flex: 1 1 100%; min-width: 0; width: 100%; order: 2; }
  .dashboard-search-input { flex: 1 1 auto; min-width: 0; width: auto; }

  /* User-menu becomes a square icon-button on mobile.
     - aspect-ratio:1 keeps it visually consistent across device pixel ratios
     - min-width/min-height meets WCAG 2.5.8 (>=24px) and Material touch target (>=40px)
     - chevron + label-spacing removed to reclaim horizontal space in the topbar */
  .user-menu-btn {
    min-width: 40px;
    min-height: 40px;
    width: 40px;
    height: 40px;
    aspect-ratio: 1 / 1;
    padding: 0;
    gap: 0;
    border-radius: 50%;
  }
  .user-menu-btn .user-menu-chevron { display: none; }
  .user-menu-dropdown { right: 0; min-width: 200px; }

  /* Settings page: keep brand + user-menu on the same row on mobile
     so the round person icon stays right-aligned (next to the
     'Settings' brand label) instead of dropping to the left edge. */
  .settings-header {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  .settings-header-actions {
    justify-content: flex-end;
    margin-left: auto;
  }

  .settings-shell { padding: 14px; }
  .settings-header,
  .settings-layout { max-width: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-summary-grid { grid-template-columns: 1fr; }

  .source-row {
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 10px;
  }

  .source-row-name {
    flex: 1 1 auto;
    max-width: none;
  }

  .source-row-actions {
    opacity: 1;
  }

  .source-add-grid {
    grid-template-columns: 1fr;
  }

  .source-detail-grid {
    grid-template-columns: 1fr;
  }

  #source-editor.panel-overlay {
    padding: 12px;
  }

  #source-editor .panel-modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 24px);
    padding: 18px;
  }

  /* Sort control: hide topbar version, show drawer version */
  .sort-control { display: none; }
  .sort-control--drawer { display: block; }

  /* Body scroll lock when drawer is open */
  body.filter-drawer-is-open { overflow: hidden; }
}

/* ===== Small phones (≤ 640px) ===== */
@media (max-width: 640px) {
  .app { padding: 8px; margin: 4px; }
  .main { padding: 10px; }

  /* Override the more-specific ≤900px dashboard rules so small-phone
     padding reductions actually take effect. Without these, the higher-
     specificity .dashboard-admin-theme selectors from the ≤900px block
     keep the larger values and make the page slightly wider than the screen. */
  .dashboard-admin-theme .app { margin: 4px; padding: 8px; }
  .dashboard-admin-theme .main { padding: 10px; border-radius: 8px; }
  .dashboard-admin-theme .topbar { padding: 8px 10px; margin-bottom: 8px; }

  /* Prevent the loading-skeleton grid from overflowing on very narrow screens
     (minmax(280px, 1fr) would exceed ~280px available width on sub-350px phones). */
  .calls-loading { grid-template-columns: 1fr; }

  .dashboard-admin-theme {
    --mobile-drawer-width: 92vw;
  }

  .dashboard-search-clear { padding: 8px 9px; }

  /* Settings header on very small phones: still a single row so the
     round person icon stays right-aligned next to the 'Settings' brand.
     The brand label can wrap; the user-menu icon (40px) always fits. */
  .settings-header {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
  }
  .settings-header-actions {
    justify-content: flex-end;
    margin-left: auto;
    flex-wrap: nowrap;
  }
  .settings-header-link { flex: 0 0 auto; }
  .settings-intro-card,
  .settings-card { padding: 18px; border-radius: 16px; }

  .source-row {
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
  }

  .source-row-actions {
    opacity: 1;
    flex-wrap: wrap;
  }

  .source-row-actions .btn {
    flex: 1 1 auto;
  }

  .source-detail-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  #source-editor.panel-overlay {
    padding: 0;
    align-items: stretch;
  }

  #source-editor .panel-modal {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    padding: 14px;
  }

  .source-detail-panel-head .btn {
    width: 100%;
  }

  .call-card { padding: 12px; }
  .call-card .call-title { font-size: 0.92rem; }
  .review-quick-filter-select { min-width: 0; width: 100%; }

  /* Admin panel */
  .admin-sidebar { width: min(340px, 92vw); }
  .admin-topbar { padding: 10px 12px; }
  .admin-topbar-right { max-width: 48%; }
  .admin-main { padding: 12px; }
  .admin-table { font-size: 12px; min-width: 0; }
  .scrape-log-table,
  .airflow-runs-table,
  #scrape-queue-list .admin-table { min-width: 680px; }
  .admin-table th, .admin-table td { padding: 8px 8px; }

  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form input, .inline-form select { width: 100%; }

  .call-modal-header { padding: 14px 16px 10px; }
  .call-modal-body { padding: 14px 16px 18px; }

  .site-footer {
    font-size: 10px;
    min-height: 28px;
    padding: 4px 12px;
  }
}

/* ===== CSS utility classes — reduce inline styles ===== */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 6px; }
.gap-md { gap: 8px; }
.gap-lg { gap: 12px; }
.gap-xl { gap: 16px; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.inline-block { display: inline-block; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-14 { font-size: 14px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-muted { color: var(--muted); }
.text-body { color: #0b2a1a; }
.mt-sm { margin-top: 6px; }
.mt-md { margin-top: 12px; }
.mt-lg { margin-top: 16px; }
.mb-sm { margin-bottom: 6px; }
.mb-md { margin-bottom: 12px; }
.mb-lg { margin-bottom: 16px; }
.p-sm { padding: 10px; }
.p-md { padding: 12px; }
.p-lg { padding: 20px; }
.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.border { border: 1px solid #e6f0ea; }
.bg-panel { background: var(--panel); }
.w-full { width: 100%; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.border-bottom { border-bottom: 1px solid #e9efe9; }
.border-top { border-top: 1px solid #e9efe9; }
.border-danger { border-color: #f5c6cb; }
.bg-danger-light { background: #fff5f5; }
.bg-warning-light { background: #fdf9f0; }
.bg-accent-light { background: var(--accent-light); }
.pt-sm { padding-top: 6px; }
.pt-md { padding-top: 12px; }
.pb-sm { padding-bottom: 6px; }
.pb-md { padding-bottom: 12px; }
.pb-lg { padding-bottom: 16px; }
.pl-lg { padding-left: 16px; }
.pr-lg { padding-right: 16px; }
.my-sm { margin-top: 6px; margin-bottom: 6px; }
.my-md { margin-top: 12px; margin-bottom: 12px; }
.my-lg { margin-top: 16px; margin-bottom: 16px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.ml-auto { margin-left: auto; }
.min-w-300 { min-width: 300px; }
.min-w-120 { min-width: 120px; }

/* ===== Domain tag management (settings & admin) ===== */
.domain-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #e6f0ea;
  border: 1px solid #c8dcd0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: #1a3a1a;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s;
}

/* ===== Email queue subject link ===== */
.emailq-subject-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dotted var(--accent);
  cursor: pointer;
}
.emailq-subject-link:hover {
  color: #1a6b3e;
  border-bottom-style: solid;
}
.emailq-subject-link::after {
  content: ' \279C';
  font-size: 12px;
  opacity: 0.6;
  margin-left: 2px;
}
.emailq-subject-link:hover::after {
  opacity: 1;
}

/* ===== Email preview modal ===== */
#email-preview-overlay.call-modal-overlay .call-modal {
  max-width: min(960px, 100% - 40px);
}
#email-preview-body {
  line-height: 1.6;
  color: #0b2a1a;
}
#email-preview-body table {
  max-width: 100%;
  overflow-x: auto;
}
#email-preview-body img {
  max-width: 100%;
  height: auto;
}
#email-preview-body a {
  color: var(--accent);
  text-decoration: underline;
}
.domain-tag:hover {
  background: #d4e8dc;
  border-color: #a8c8b4;
}
.domain-tag-text {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.domain-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #5a7a6a;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.domain-tag-remove:hover {
  background: #c23a3a;
  color: #fff;
}

.settings-domains-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-domains-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}
.settings-domains-empty {
  color: #999;
  font-size: 13px;
  font-style: italic;
}
.settings-domains-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.settings-domain-input {
  flex: 1;
  max-width: 320px;
  padding: 8px 12px;
  border: 1px solid #d5e0d5;
  border-radius: 6px;
  font-size: 14px;
  font-family: monospace;
  outline: none;
  transition: border-color 0.15s;
}
.settings-domain-input:focus {
  border-color: #2e8b57;
  box-shadow: 0 0 0 2px rgba(46,139,87,0.15);
}

/* ===== HAS-styled admin form controls ===== */
.has-select,
.has-input,
.has-textarea {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #d6e6dc;
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  color: #0b2a1a;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.has-select:hover,
.has-input:hover,
.has-textarea:hover {
  border-color: var(--accent-border);
}
.has-select:focus,
.has-input:focus,
.has-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(46,139,87,0.15);
}
.has-select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 6px;
  padding-right: 28px;
}
.has-select.has-select--small,
.has-input.has-input--small {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}
.has-select.has-select--small {
  padding-right: 26px;
  background-position: right 8px center;
}
.has-select option {
  color: #0b2a1a;
  background: #fff;
}
.has-input[readonly],
.has-textarea[readonly] {
  background: #f3f6f3;
  cursor: not-allowed;
  color: var(--muted);
}
.has-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.has-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #4a6a4a;
  margin-bottom: 4px;
  white-space: nowrap;
}
.has-label--inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #4a6a4a;
  white-space: nowrap;
}
.has-filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0 4px;
  align-items: center;
}
.has-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.has-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid #d6e6dc;
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.has-btn-icon:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}
.has-inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.has-inline-form .has-select,
.has-inline-form .has-input {
  padding: 7px 12px;
  font-size: 13px;
}
.has-search-input {
  width: 100%;
  min-width: 120px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #d6e6dc;
  background: #fff;
  color: #0b2a1a;
  font-family: inherit;
  font-size: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.has-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(46,139,87,0.15);
}
.has-search-input::placeholder {
  color: #94a99c;
}
.has-badge-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Admin panel domain tags */
.admin-domains-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
  padding: 4px 0;
}

/* ==========================================================================
   Research theme accordion items (inline in RG editor)
   ========================================================================== */
.rg-themes-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 28px;
  padding: 4px 0;
}

.rg-theme-item {
  border: 1px solid #e9efe9;
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.rg-theme-item:hover {
  border-color: #c8dcc8;
}

.rg-theme-item.is-open {
  border-color: #4a7c4a;
  background: #fafcfa;
}

.rg-theme-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

.rg-theme-header:hover {
  background: #f3f8f3;
}

.rg-theme-header-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rg-theme-name {
  font-weight: 600;
  font-size: 13px;
  color: #2d4a2d;
}

.rg-theme-desc {
  font-size: 11px;
  color: #7a9a7a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rg-theme-meta {
  font-size: 11px;
  color: #8aad8a;
  white-space: nowrap;
  flex-shrink: 0;
}

.rg-theme-chevron {
  font-size: 9px;
  color: #aac4aa;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.rg-theme-item.is-open .rg-theme-chevron {
  transform: rotate(180deg);
}

.rg-theme-body {
  padding: 12px;
  border-top: 1px solid #e9efe9;
  background: #fafcfa;
}

.rg-theme-body .form-grid {
  margin-bottom: 0;
}

.rg-theme-body .form-row {
  margin-bottom: 8px;
}

.rg-theme-body .form-row:last-child {
  margin-bottom: 0;
}

.rg-theme-body input[type="text"],
.rg-theme-body textarea {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #dce8dc;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
}

.rg-theme-body input[type="text"]:focus,
.rg-theme-body textarea:focus {
  border-color: #4a7c4a;
  outline: none;
  box-shadow: 0 0 0 2px rgba(74,124,74,0.12);
}

.rg-theme-body .form-row label {
  font-size: 11px;
  font-weight: 500;
  color: #5a7a5a;
  margin-bottom: 2px;
  display: block;
}

.rg-theme-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e9efe9;
}

.rg-theme-actions .btn {
  font-size: 12px;
  padding: 4px 12px;
}

.rg-theme-body-label {
  font-size: 11px;
  font-weight: 500;
  color: #5a7a5a;
  margin-bottom: 2px;
  display: block;
}

/* ==========================================================================
   UX Improvements — Skip to content, reduced motion, dark mode, etc.
   ========================================================================== */

/* ---- Skip to content (a11y) ---- */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 4px 0;
  transition: top 0.1s;
}
.skip-to-content:focus {
  top: 0;
  outline: 2px solid #fff;
  outline-offset: -2px;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Active filter chips bar ---- */
.active-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 4px;
  align-items: center;
  min-height: 0;
  transition: min-height 0.2s, padding 0.2s;
}
.active-filters-bar:empty {
  padding: 0;
  min-height: 0;
}
.active-filters-bar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
  white-space: nowrap;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 10px;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.4;
  cursor: default;
  transition: background 0.12s, border-color 0.12s;
}
.filter-chip:hover {
  background: rgba(46,139,87,0.14);
}
.filter-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.1s, background 0.1s;
}
.filter-chip-remove:hover {
  opacity: 1;
  background: rgba(46,139,87,0.2);
}

/* ---- Rich empty states ---- */
.empty-state-rich {
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state-rich-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
  display: block;
}
.empty-state-rich-title {
  font-size: 16px;
  font-weight: 600;
  color: #4a6a4a;
  margin-bottom: 6px;
}
.empty-state-rich-desc {
  font-size: 13px;
  max-width: 360px;
  margin: 0 auto 16px;
  line-height: 1.5;
}
.empty-state-rich-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- Keyboard shortcut hint ---- */
.kbd-hint {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(26,42,32,0.85);
  color: #8aa89a;
  border-radius: 6px;
  font-size: 11px;
  backdrop-filter: blur(4px);
  border: 1px solid #3a5040;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.kbd-hint.is-visible { opacity: 1; }
.kbd-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: rgba(255,255,255,0.1);
  border: 1px solid #5a7a6a;
  border-radius: 3px;
  font-family: inherit;
  font-size: 10px;
  color: #d4e6dc;
  line-height: 1;
}

/* ---- Mobile filter count badge ---- */
.mobile-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.15s, transform 0.15s;
}
.mobile-filter-count.has-filters {
  opacity: 1;
  transform: scale(1);
}

/* ══════════════════════════════════════════════════════════════════════════════
   LOGIN HISTORY — Hourly bar chart & section styles
   ══════════════════════════════════════════════════════════════════════════════ */

.hourly-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: .75rem;
}

.hourly-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
  padding: .5rem;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.hourly-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 24px;
}

.hourly-bar {
  width: 100%;
  max-width: 28px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height .3s ease;
}

.hourly-bar-wrap:hover .hourly-bar {
  opacity: .8;
}

.hourly-label {
  font-size: .6rem;
  color: var(--muted);
  margin-top: 4px;
}

.hourly-count {
  font-size: .6rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 1px;
}

.admin-subtitle {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1.5rem 0 .75rem;
}
