/* =====================================================================
   Immigration Horizons — Admin CMS Design System
   Navy + gold brand, light-gray canvas, white cards, soft shadows only.
   Inspired by Vercel / Stripe / Linear / Payload / Notion dashboards.

   This file is written against the ACTUAL markup in views/admin/**, not an
   idealised one — selectors were verified against every template before
   being written. No JavaScript behaviour, route, or data model is touched
   by anything in this file.
   ===================================================================== */

:root {
  /* ---------- Brand: navy ---------- */
  --navy-950: #0a1526;
  --navy-900: #0f1f3d;
  --navy-800: #152c54;
  --navy-700: #1c3a6b;
  --navy-600: #234a85;
  --navy-500: #2c5ca1;
  --navy-400: #4d7ec2;
  --navy-100: #e4ebf6;
  --navy-50: #f4f7fb;

  /* ---------- Brand: gold ---------- */
  --gold-700: #8a6816;
  --gold-600: #a67c1e;
  --gold-500: #c9992e;
  --gold-400: #dcae4a;
  --gold-300: #e8c374;
  --gold-100: #f7ecd3;
  --gold-50: #fbf6ea;

  /* ---------- Neutrals ---------- */
  --gray-950: #10151f;
  --gray-900: #161d2b;
  --gray-800: #212a3b;
  --gray-700: #384357;
  --gray-600: #4f596c;
  --gray-500: #6b7688;
  --gray-400: #97a1b2;
  --gray-300: #c2c9d4;
  --gray-200: #e0e4ea;
  --gray-100: #edf0f4;
  --gray-50: #f7f8fa;
  --white: #ffffff;

  /* ---------- Semantic aliases (kept from the previous theme so any
     selector still referencing them keeps working) ---------- */
  --admin-bg: var(--gray-50);
  --card-bg: var(--white);
  --card-border: var(--gray-200);
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-500);
  --accent-gold: var(--gold-500);
  --accent-gold-light: var(--gold-100);
  --accent-blue: var(--navy-600);
  --accent-blue-light: var(--navy-100);

  /* ---------- Sidebar (dark ground) ----------
     The sidebar is the one surface in this app with a dark background, so
     its text colours cannot come from the light-surface aliases above.
     Gold is deliberately NOT used for the nav labels: per the project's
     gold contrast rule, gold is for fills, rules, and ornament, never for
     a column of body-sized text. It stays on the active indicator, the
     active icon, and the badges. */
  --sidebar-text: var(--navy-100);        /* 13.6:1 on --navy-900 */
  --sidebar-text-hover: var(--white);
  --sidebar-surface-hover: rgba(255, 255, 255, .07);
  --sidebar-plate: rgba(255, 255, 255, .96);

  /* ---------- Status colours — each state gets a distinct, legible pair ---------- */
  --status-new-bg: #eaf1ff;       --status-new-text: #1d4ed8;
  --status-contacted-bg: #f3ecff; --status-contacted-text: #6d28d9;
  --status-scheduled-bg: #e5fbfb; --status-scheduled-text: #0e7490;
  --status-progress-bg: #fef6e6;  --status-progress-text: #b45309;
  --status-closed-bg: var(--gray-100); --status-closed-text: var(--gray-600);
  --status-published-bg: #e9f9ef; --status-published-text: #15803d;
  --status-draft-bg: var(--gray-100); --status-draft-text: var(--gray-600);
  --status-on-bg: #e9f9ef;        --status-on-text: #15803d;
  --status-off-bg: #fdeeee;       --status-off-text: #b91c1c;

  /* ---------- Radius (12–16px on cards/panels per brief; smaller on controls) ---------- */
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;
  --r-pill: 999px;

  /* back-compat aliases used by a few older selectors */
  --admin-radius: var(--r-md);
  --admin-radius-sm: var(--r-sm);

  /* ---------- Shadows — soft only, never a hard border+shadow combo ---------- */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 6px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 10px -2px rgba(15, 23, 42, .09), 0 2px 4px -2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 16px 32px -8px rgba(15, 23, 42, .16), 0 4px 10px -4px rgba(15, 23, 42, .08);
  --focus-ring: 0 0 0 3px rgba(201, 153, 46, .32);

  /* back-compat */
  --admin-shadow: var(--shadow-sm);
  --admin-shadow-md: var(--shadow-md);
  --admin-shadow-lg: var(--shadow-lg);

  /* ---------- Layout ---------- */
  --sidebar-width: 276px;
  --topbar-height: 76px;

  /* ---------- Motion ---------- */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --t-fast: 120ms;
  --t-base: 180ms;
}

/* =====================================================================
   Reset / base
   ===================================================================== */
body.admin-body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at 88% 2%, rgba(44, 92, 161, .08), transparent 28rem),
    radial-gradient(circle at 12% 92%, rgba(201, 153, 46, .07), transparent 24rem),
    var(--admin-bg);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.admin-body *,
.admin-body *::before,
.admin-body *::after {
  box-sizing: border-box;
}

.admin-body a { color: inherit; }
.admin-body img { max-width: 100%; }

/* One consistent, brand-coloured focus style for every interactive element.
   Keeps keyboard navigation clearly visible without relying on the browser
   default (which varies wildly and often disappears against dark surfaces). */
.admin-body a:focus-visible,
.admin-body button:focus-visible,
.admin-body input:focus-visible,
.admin-body select:focus-visible,
.admin-body textarea:focus-visible,
.admin-body [tabindex]:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
  border-radius: 4px;
}

.admin-body ::selection {
  background: var(--navy-800);
  color: #fff;
}

/* =====================================================================
   Shell layout
   ===================================================================== */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

.admin-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--t-base) var(--ease);
}

.admin-content {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 36px clamp(24px, 3vw, 48px);
  flex: 1;
}

.admin-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 32px;
  border-top: 1px solid var(--card-border);
  font-size: .8rem;
  color: var(--text-muted);
  background: var(--white);
}

/* =====================================================================
   SIDEBAR
   ===================================================================== */
.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--navy-950), var(--navy-900) 55%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--t-base) var(--ease);
}

.admin-sidebar::-webkit-scrollbar { width: 5px; }
.admin-sidebar::-webkit-scrollbar-track { background: transparent; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 4px; }

/* ---- Brand ---- */
.sidebar-brand {
  padding: 18px 16px 14px;
  flex-shrink: 0;
}

/* The website logo is a navy wordmark on transparency — it was drawn for
   the marketing site's white header and disappears on this dark sidebar.
   Rather than commission a second, lighter mark (and risk the two drifting
   apart), the real logo is placed on a light plate: same asset as
   public/images/logo-header.png, byte for byte, shown on the ground it was
   designed for. */
.sidebar-brand > a {
  display: block;
  padding: 10px 14px;
  background: var(--sidebar-plate);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.sidebar-brand > a:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
}
.sidebar-brand > a:focus-visible {
  outline: 2px solid var(--gold-400);
  outline-offset: 3px;
}

.sidebar-brand .brand-logo {
  height: 44px;
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

.sidebar-brand-caption {
  margin: 10px 4px 0;
  color: rgba(228, 235, 246, .68);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-align: center;
  text-transform: uppercase;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, .08);
  margin: 4px 20px;
}

/* ---- Nav ---- */
.sidebar-nav {
  padding: 10px 0 16px;
  flex: 1;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-label {
  margin: 15px 10px 5px;
  color: rgba(228, 235, 246, .64);
  font-size: .61rem;
  font-weight: 800;
  letter-spacing: .16em;
  line-height: 1.2;
  text-transform: uppercase;
}

.sidebar-section-label:first-child { margin-top: 5px; }

.nav-item { position: relative; }

.admin-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: .875rem;
  font-weight: 500;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.admin-sidebar .nav-link:hover {
  background: var(--sidebar-surface-hover);
  color: var(--sidebar-text-hover);
}

.admin-sidebar .nav-link:focus-visible {
  outline: 2px solid var(--gold-400);
  outline-offset: -2px;
}

.nav-item.active .nav-link:hover {
  color: var(--sidebar-text-hover);
}

.nav-item.active .nav-link {
  background: linear-gradient(90deg, rgba(201, 153, 46, .22), rgba(201, 153, 46, .04));
  color: var(--sidebar-text-hover);
  font-weight: 600;
}

/* Active indicator bar, drawn without needing an extra element */
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: var(--r-pill);
  background: var(--gold-500);
}

.nav-icon {
  width: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  color: var(--gold-400);
  opacity: .9;
}
.nav-link:hover .nav-icon { opacity: 1; }
.nav-item.active .nav-icon { opacity: 1; color: var(--gold-400); }

.nav-label {
  flex: 1;
  color: inherit;
}

.nav-badge {
  background: var(--gold-500);
  color: var(--navy-900);
  font-size: .68rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  min-width: 18px;
  text-align: center;
  line-height: 1.5;
}

/* ---- Footer / utility section ---- */
.sidebar-footer {
  padding: 8px 0 18px;
  flex-shrink: 0;
}
.sidebar-footer .nav-link { margin: 0 12px; width: calc(100% - 24px); }

/* =====================================================================
   TOPBAR
   ===================================================================== */
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-height);
  padding: 0 24px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--card-border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

/* Page title, injected by topbar.ejs from the existing `title` local */
.topbar-page-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-heading-group {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-context {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.topbar-search {
  flex: 1;
  max-width: 380px;
  min-width: 0;
}

.search-form { width: 100%; }

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrapper .search-icon {
  position: absolute;
  left: 13px;
  color: var(--text-muted);
  font-size: .85rem;
  pointer-events: none;
}

.search-wrapper .search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--card-border);
  border-radius: var(--r-pill);
  font-size: .84rem;
  font-family: inherit;
  background: var(--gray-50);
  color: var(--text-primary);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

.search-wrapper .search-input:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: var(--focus-ring);
  background: var(--white);
}

.search-wrapper .search-input::placeholder { color: var(--text-muted); }

/* The submit button is a visually-hidden-but-functional fallback for
   no-JS/no-hover contexts; the icon + Enter key are the primary affordance. */
.search-wrapper .search-submit {
  position: absolute;
  right: 4px;
  border: none;
  background: var(--navy-800);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--t-fast);
}
.search-wrapper .search-submit:hover { background: var(--navy-900); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.topbar-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--card-border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  position: relative;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.topbar-btn:hover {
  background: var(--navy-50);
  color: var(--navy-800);
  border-color: var(--navy-100);
}

.notification-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-500);
  border: 2px solid var(--white);
}

/* ---- User dropdown ---- */
.topbar-user.dropdown { position: relative; }

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.topbar-user-btn:hover { background: var(--navy-50); border-color: var(--card-border); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-500));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
  min-width: 0;
}

.user-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.user-role {
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.dropdown-arrow {
  font-size: .68rem;
  color: var(--text-muted);
  transition: transform var(--t-fast);
}
.topbar-user-btn[aria-expanded="true"] .dropdown-arrow { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--white);
  border: 1px solid var(--card-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 160;
}
.dropdown-menu.show {
  display: block;
  animation: dropdown-in var(--t-base) var(--ease);
}

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

.dropdown-header { padding: 8px 10px 10px; }
.dropdown-user-info { display: flex; flex-direction: column; gap: 1px; }
.dropdown-user-info strong { font-size: .88rem; color: var(--text-primary); }
.dropdown-user-info span { font-size: .74rem; color: var(--text-muted); text-transform: capitalize; }

.dropdown-divider {
  height: 1px;
  background: var(--card-border);
  margin: 6px 4px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.dropdown-item:hover { background: var(--navy-50); color: var(--navy-800); }
.dropdown-item.logout-btn:hover { background: #fdeeee; color: #b91c1c; }
.dropdown-logout-form { width: 100%; }

/* =====================================================================
   PAGE HEADER
   ===================================================================== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -.01em;
}

.page-header .page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: .9rem;
  margin: 4px 0 24px;
}

/* =====================================================================
   ALERTS
   ===================================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  font-size: .875rem;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.alert i { margin-top: 2px; flex-shrink: 0; }
.alert span { flex: 1; }

.alert-close {
  border: none;
  background: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: .55;
  padding: 0 2px;
}
.alert-close:hover { opacity: 1; }

.alert-danger { background: #fdeeee; border-color: #f6cfcf; color: #b91c1c; }
.alert-success { background: #eaf9ef; border-color: #c8ecd3; color: #15803d; }
.alert-warn,
.alert-warning { background: #fef8e9; border-color: #f5e3b3; color: #92400e; }
.alert-info { background: var(--navy-50); border-color: var(--navy-100); color: var(--navy-800); }

/* =====================================================================
   CARDS
   ===================================================================== */
.admin-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 24px;
  border-bottom: 1px solid var(--card-border);
}

.admin-card-header h2,
.admin-card-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-card-header h2 i,
.admin-card-header h3 i { color: var(--gold-600); font-size: .92em; }

.admin-card-body { padding: 24px; }
.admin-card-body.no-padding { padding: 0; }

.admin-card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--card-border);
  background: var(--gray-50);
  font-size: .85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* =====================================================================
   STAT CARDS  (two markup shapes exist across the templates — both
   are supported without touching either template)
   ===================================================================== */
.stats-grid,
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-base), transform var(--t-base), border-color var(--t-base);

  /* Default shape: dashboard's icon + value + label as direct siblings.
     Grid areas let three siblings lay out as "icon | value / label"
     without any wrapper element in the markup. */
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 16px;
  row-gap: 0;
  align-items: center;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--navy-100);
}

.stat-card-icon {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-card-icon.blue { background: var(--navy-100); color: var(--navy-600); }
.stat-card-icon.gold { background: var(--gold-100); color: var(--gold-600); }
.stat-card-icon.green { background: #e2f8e9; color: #15803d; }
.stat-card-icon.purple { background: #f0ebfd; color: #6d28d9; }
.stat-card-icon.cyan { background: #e2f8f8; color: #0e7490; }
.stat-card-icon.rose { background: #fce9ec; color: #be123c; }
.stat-card-icon.orange { background: #fdedd9; color: #b45309; }

.stat-card-value {
  grid-column: 2;
  grid-row: 1;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -.01em;
}

.stat-card-label {
  grid-column: 2;
  grid-row: 2;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Second shape: label / value(badge) / sub stacked vertically, used by the
   integrations status page. Applied whenever a card has no icon child. */
.stat-card:not(:has(.stat-card-icon)) {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card > .label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.stat-card > .label i { color: var(--gold-600); }
.stat-card > .sub {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* =====================================================================
   BUTTONS
   Self-sufficient — this app does not load style.css, so every base
   property a button needs lives here, not just admin-specific overrides.
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn[disabled],
.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.btn-sm { padding: 6px 13px; font-size: .78rem; border-radius: var(--r-sm); }
.btn-xs { padding: 4px 10px; font-size: .72rem; border-radius: 6px; }
.btn-lg { padding: 12px 26px; font-size: .95rem; border-radius: var(--r-md); }

/* Primary — brand gold, per design-system brief */
.btn-primary {
  background: var(--gold-500);
  color: var(--navy-900);
  border-color: var(--gold-500);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: var(--gold-400); box-shadow: var(--shadow-sm); }

/* Secondary — navy solid (kept as .btn-blue for the one template using it) */
.btn-blue,
.btn-secondary {
  background: var(--navy-800);
  color: #fff;
  border-color: var(--navy-800);
}
.btn-blue:hover,
.btn-secondary:hover { background: var(--navy-900); }

/* Ghost — quiet default action */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--card-border);
}
.btn-ghost:hover {
  background: var(--navy-50);
  color: var(--navy-800);
  border-color: var(--navy-100);
}

/* Semantic variants */
.btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover { background: #15803d; }

.btn-warning { background: var(--gold-100); color: #92400e; border-color: #f3dfa8; }
.btn-warning:hover { background: #f8e6bd; }

.btn-danger { background: #fdeeee; color: #b91c1c; border-color: transparent; }
.btn-danger:hover { background: #fbdcdc; color: #991b1b; }

.btn-outline-blue {
  background: transparent;
  color: var(--navy-600);
  border-color: var(--navy-600);
}
.btn-outline-blue:hover { background: var(--navy-50); }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--card-border);
  background: var(--white);
  color: var(--text-secondary);
}
.btn-icon:hover { background: var(--navy-50); color: var(--navy-800); }
.btn-icon.btn-icon-danger:hover { background: #fdeeee; color: #b91c1c; border-color: #f6cfcf; }

/* Submit-in-flight state (progressive enhancement, see layout.ejs script) */
.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
  position: relative;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  color: var(--navy-900);
  animation: btn-spin .6s linear infinite;
}
.btn-primary.is-loading::after,
.btn-blue.is-loading::after,
.btn-secondary.is-loading::after,
.btn-success.is-loading::after { color: #fff; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* =====================================================================
   BADGES
   ===================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 11px;
  border-radius: var(--r-pill);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-new { background: var(--status-new-bg); color: var(--status-new-text); }
.badge-contacted { background: var(--status-contacted-bg); color: var(--status-contacted-text); }
.badge-consultation-scheduled,
.badge-consultation_scheduled { background: var(--status-scheduled-bg); color: var(--status-scheduled-text); }
.badge-in-progress,
.badge-in_progress { background: var(--status-progress-bg); color: var(--status-progress-text); }
.badge-closed { background: var(--status-closed-bg); color: var(--status-closed-text); }

.badge-published { background: var(--status-published-bg); color: var(--status-published-text); }
.badge-draft { background: var(--status-draft-bg); color: var(--status-draft-text); }
.badge-archived { background: var(--gray-100); color: var(--gray-600); }
.badge-featured { background: var(--gold-100); color: var(--gold-700); }

.badge-on { background: var(--status-on-bg); color: var(--status-on-text); }
.badge-off { background: var(--status-off-bg); color: var(--status-off-text); }

.badge-default { background: var(--gray-100); color: var(--gray-600); }
.badge-success { background: var(--status-published-bg); color: var(--status-published-text); }
.badge-warning { background: var(--status-progress-bg); color: var(--status-progress-text); }
.badge-danger { background: var(--status-off-bg); color: var(--status-off-text); }
.badge-info { background: var(--status-new-bg); color: var(--status-new-text); }

/* =====================================================================
   TABLES
   ===================================================================== */
.admin-table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: .875rem;
}

.admin-table th {
  text-align: left;
  padding: 12px 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--gray-50);
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

.admin-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr { transition: background var(--t-fast); }
.admin-table tbody tr:hover { background: var(--navy-50); }

.admin-table tr.clickable-row { cursor: pointer; }

.admin-table .cell-title {
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

.admin-table .cell-sub,
.admin-table .cell-email {
  font-size: .8rem;
  color: var(--text-muted);
  display: block;
  margin-top: 1px;
}

.admin-table td.cell-actions {
  text-align: right;
  white-space: nowrap;
}
.admin-table td.cell-actions .action-row,
.admin-table td.cell-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.admin-table th.shrink,
.admin-table td.shrink {
  width: 1%;
  white-space: nowrap;
}

/* =====================================================================
   FILTER BAR
   ===================================================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--card-border);
  background: var(--gray-50);
}

.filter-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .82rem;
}
.search-input-wrap .search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--card-border);
  border-radius: var(--r-sm);
  font-size: .84rem;
  font-family: inherit;
  background: var(--white);
}
.search-input-wrap .search-input:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: var(--focus-ring);
}

.filter-select {
  padding: 8px 30px 8px 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--r-sm);
  font-size: .82rem;
  font-family: inherit;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7688' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 6px center / 16px;
  color: var(--text-primary);
  appearance: none;
  cursor: pointer;
}
.filter-select:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: var(--focus-ring);
}

.filter-date {
  padding: 8px 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--r-sm);
  font-size: .82rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text-primary);
}
.filter-date:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: var(--focus-ring);
}

.filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--text-primary);
  white-space: nowrap;
  cursor: pointer;
}
.filter-checkbox input[type="checkbox"] {
  cursor: pointer;
}

/* =====================================================================
   FORMS
   ===================================================================== */
.admin-form-group { margin-bottom: 20px; }

.admin-form-group > label {
  display: block;
  font-size: .84rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 7px;
}

.form-hint,
.admin-form-group .hint {
  display: block;
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.admin-form-group input[type="text"],
.admin-form-group input[type="email"],
.admin-form-group input[type="password"],
.admin-form-group input[type="number"],
.admin-form-group input[type="url"],
.admin-form-group input[type="date"],
.admin-form-group input[type="datetime-local"],
.admin-form-group input[type="file"],
.admin-form-group select,
.admin-form-group textarea,
.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--card-border);
  border-radius: var(--r-sm);
  font-size: .875rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text-primary);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.admin-form-group input:focus,
.admin-form-group select:focus,
.admin-form-group textarea:focus,
.form-control:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: var(--focus-ring);
}

.admin-form-group textarea,
textarea.form-control { resize: vertical; min-height: 110px; line-height: 1.55; }

.admin-form-group select,
select.form-control {
  cursor: pointer;
  appearance: none;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7688' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  padding-right: 34px;
}

.admin-form-group input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  accent-color: var(--gold-500);
}

.admin-form-group input[type="file"] {
  padding: 8px 13px;
  cursor: pointer;
}
.admin-form-group input[type="file"]::file-selector-button {
  border: none;
  background: var(--navy-100);
  color: var(--navy-800);
  font-weight: 600;
  font-size: .8rem;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  margin-right: 10px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.admin-form-group input[type="file"]::file-selector-button:hover { background: var(--navy-100); filter: brightness(.96); }

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
}
.admin-form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.admin-form-grid .full-width { grid-column: 1 / -1; }

.admin-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 20px;
  margin-top: 4px;
  border-top: 1px solid var(--card-border);
}

.fieldset-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gold-700);
  margin: 28px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
}
.fieldset-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* ---- Toggle switch ----
   Scoped as `.admin-form-group > label.toggle-switch` (not just
   `.toggle-switch`) so it out-specifies the generic form label rule above —
   without this, `display:block` from that rule wins and the whole control
   collapses instead of laying out as a flex row. */
.toggle-switch,
.admin-form-group > label.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-primary);
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  width: 40px;
  height: 23px;
  background: var(--gray-300);
  border-radius: var(--r-pill);
  transition: background var(--t-base);
  position: relative;
  flex-shrink: 0;
}
.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--t-base) var(--ease);
  box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .toggle-slider { background: var(--gold-500); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(17px); }
.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

/* =====================================================================
   PAGINATION
   ===================================================================== */
.admin-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-buttons { display: flex; gap: 4px; }

.page-link,
.admin-pagination .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--card-border);
  border-radius: var(--r-sm);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--white);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.page-link:hover { background: var(--navy-50); color: var(--navy-800); border-color: var(--navy-100); }
.page-link.active { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }

.page-info { font-size: .82rem; color: var(--text-muted); }

/* =====================================================================
   EMPTY STATES
   Styled from the real bare markup (icon + optional h3 + p + optional
   link), no wrapper classes required in the templates.
   ===================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
  gap: 4px;
}

.empty-state > i {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--navy-50);
  color: var(--navy-400);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 14px;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.empty-state p {
  font-size: .86rem;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.55;
  margin: 0 0 18px;
}

.empty-state > .btn { margin-top: 4px; }

/* =====================================================================
   MEDIA LIBRARY  (matches the real .media-item > .thumb / .meta markup)
   ===================================================================== */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
}

.media-item {
  border: 1px solid var(--card-border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--white);
  transition: box-shadow var(--t-base), border-color var(--t-base), transform var(--t-base);
}
.media-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--navy-100);
  transform: translateY(-1px);
}

.media-item .thumb {
  aspect-ratio: 4 / 3;
  /* Skeleton shimmer shows through until the image finishes painting —
     zero JavaScript, pure background-vs-foreground timing. */
  background: linear-gradient(100deg, var(--gray-100) 30%, var(--gray-50) 50%, var(--gray-100) 70%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.media-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.media-item .meta { padding: 10px 12px; }
.media-item .meta .name {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-item .meta .actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* =====================================================================
   LEAD / DETAIL PAGE
   ===================================================================== */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.detail-primary,
.detail-side {
  display: flex;
  flex-direction: column;
}
.detail-primary .admin-card:last-child,
.detail-side .admin-card:last-child { margin-bottom: 0; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 4px;
}

.detail-field > label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

.detail-field > span,
.detail-field > span a {
  font-size: .92rem;
  color: var(--text-primary);
  font-weight: 500;
}
.detail-field > span a { color: var(--navy-600); text-decoration: none; }
.detail-field > span a:hover { text-decoration: underline; }

/* ---- Notes timeline ---- */
.notes-timeline {
  position: relative;
  padding-left: 22px;
}

.note-item {
  position: relative;
  padding: 0 0 18px 16px;
  border-bottom: none;
}
.note-item:last-child { padding-bottom: 2px; }

/* Connecting line */
.note-item::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 6px;
  bottom: -18px;
  width: 2px;
  background: var(--card-border);
}
.note-item:last-child::before { display: none; }

/* Dot */
.note-item::after {
  content: "";
  position: absolute;
  left: -6px;
  top: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold-500);
  box-shadow: 0 0 0 3px var(--gold-100);
}

.note-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.note-header strong { font-size: .85rem; color: var(--text-primary); }
.note-date { font-size: .72rem; color: var(--text-muted); }

.note-content {
  font-size: .85rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.55;
}

/* =====================================================================
   DASHBOARD WIDGETS
   ===================================================================== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.quick-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 22px 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--r-md);
  background: var(--white);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: .82rem;
  font-weight: 600;
  text-align: center;
  transition: border-color var(--t-base), box-shadow var(--t-base), color var(--t-base), transform var(--t-base);
}
.quick-action-item:hover {
  border-color: var(--gold-400);
  box-shadow: var(--shadow-md);
  color: var(--navy-800);
  transform: translateY(-2px);
}
.quick-action-item i {
  font-size: 1.4rem;
  color: var(--navy-400);
  transition: color var(--t-base);
}
.quick-action-item:hover i { color: var(--gold-600); }

/* =====================================================================
   SEARCH RESULTS PAGE
   ===================================================================== */
.search-results-section { margin-bottom: 24px; }

/* =====================================================================
   LOGIN PAGE
   Matches the classes used by login.ejs after its restyle.
   ===================================================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  padding: 24px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.login-card {
  width: 100%;
  max-width: 408px;
  background: var(--white);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px 34px;
}

.login-brand { text-align: center; margin-bottom: 30px; }

/* The website logo replaces the old generic globe icon. The login card is
   a light surface, so the navy wordmark reads directly — no plate needed
   (unlike the dark sidebar, see .sidebar-brand). */
.login-brand-logo {
  height: 62px;
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto 18px;
}

.login-brand h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.login-brand p {
  font-size: .84rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.login-error {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fdeeee;
  border: 1px solid #f6cfcf;
  color: #b91c1c;
  padding: 12px 15px;
  border-radius: var(--r-sm);
  font-size: .85rem;
  margin-bottom: 20px;
}
.login-error i { flex-shrink: 0; }

.login-form .form-group { margin-bottom: 18px; }
.login-form label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 7px;
}

.login-form .input-wrap { position: relative; }
.login-form .input-wrap i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .9rem;
}
.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--card-border);
  border-radius: var(--r-sm);
  font-size: .92rem;
  color: var(--text-primary);
  background: var(--gray-50);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.login-form input:focus {
  outline: none;
  border-color: var(--navy-500);
  box-shadow: var(--focus-ring);
  background: var(--white);
}
.login-form input::placeholder { color: var(--gray-400); }

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--gold-500);
  color: var(--navy-900);
  border: none;
  border-radius: var(--r-sm);
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--t-fast), transform var(--t-fast);
  box-shadow: var(--shadow-sm);
}
.login-btn:hover { background: var(--gold-400); }
.login-btn:active { transform: scale(.98); }

.login-footer { text-align: center; margin-top: 22px; font-size: .82rem; color: var(--text-muted); }
.login-footer a { color: var(--navy-600); text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }

/* =====================================================================
   Misc reused elements
   ===================================================================== */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.admin-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.admin-breadcrumbs a { color: var(--navy-600); text-decoration: none; }
.admin-breadcrumbs a:hover { text-decoration: underline; }
.admin-breadcrumbs .sep { color: var(--gray-300); }

/* =====================================================================
   SKELETON LOADER (generic utility — CSS only, opt-in via class)
   ===================================================================== */
.skeleton {
  background: linear-gradient(100deg, var(--gray-100) 30%, var(--gray-50) 50%, var(--gray-100) 70%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
  pointer-events: none;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =====================================================================
   ACCESSIBILITY — reduced motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  .admin-body *,
  .admin-body *::before,
  .admin-body *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(182, 174, 174, 0.55);
  z-index: 199;
  opacity: 0;
  transition: opacity var(--t-base) var(--ease);
}
.sidebar-overlay.open { display: block; opacity: 1; }

/* Laptops / small desktops */
@media (max-width: 1180px) {
  .detail-layout { grid-template-columns: 1fr; }
}

/* Tablets */
@media (max-width: 1024px) {
  .admin-content { padding: 24px 20px; }
  .stats-grid, .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-form-grid,
  .admin-form-grid.cols-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar-search { max-width: 260px; }
}

/* Mobile */
@media (max-width: 860px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .admin-main { margin-left: 0; }

  .admin-content { padding: 20px 16px; }
  .stats-grid, .stat-grid { grid-template-columns: 1fr; }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .page-actions { width: 100%; }
  .page-header .page-actions .btn { flex: 1; }

  .admin-table-wrap { margin: 0 -1px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }

  .topbar-search { display: none; }
  .topbar-page-title { font-size: .95rem; }
  .user-info { display: none; }
  .dropdown-arrow { display: none; }

  .admin-form-actions { flex-direction: column-reverse; }
  .admin-form-actions .btn { width: 100%; }

  .filter-form { flex-direction: column; align-items: stretch; }
  .search-input-wrap { min-width: 0; }
}

@media (max-width: 480px) {
  .admin-content { padding: 16px 12px; }
  .stat-card-value { font-size: 1.4rem; }
  .admin-table td, .admin-table th { padding: 10px 14px; font-size: .8rem; }
  .login-card { padding: 30px 22px 26px; }
}

/* Print */
@media print {
  .admin-sidebar, .admin-topbar, .sidebar-overlay, .alert-close { display: none !important; }
  .admin-main { margin-left: 0 !important; }
  .admin-card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}

/* =====================================================================
   PHASE 9 — LEAD OPERATIONS
   Task board, sprint board, notifications, delivery workflow, assignment.
   Reuses the same tokens (--navy-*, --gold-*, --gray-*, --r-*, --shadow-*)
   defined at the top of this file.
   ===================================================================== */

/* ---- Priority badges ---- */
.badge-priority-low { background: var(--gray-100); color: var(--gray-600); }
.badge-priority-medium { background: var(--status-new-bg); color: var(--status-new-text); }
.badge-priority-high { background: var(--status-progress-bg); color: var(--status-progress-text); }
.badge-priority-urgent { background: var(--status-off-bg); color: var(--status-off-text); }

/* ---- Task status badges (sprint task list, etc.) ---- */
.badge-task-todo { background: var(--gray-100); color: var(--gray-600); }
.badge-task-in_progress { background: var(--status-new-bg); color: var(--status-new-text); }
.badge-task-waiting { background: var(--status-progress-bg); color: var(--status-progress-text); }
.badge-task-review { background: var(--status-contacted-bg); color: var(--status-contacted-text); }
.badge-task-completed { background: var(--status-published-bg); color: var(--status-published-text); }

/* ---- Sprint status badges ---- */
.badge-sprint-planning { background: var(--gray-100); color: var(--gray-600); }
.badge-sprint-active { background: var(--status-new-bg); color: var(--status-new-text); }
.badge-sprint-completed { background: var(--status-published-bg); color: var(--status-published-text); }

/* ---- Delivery state badges ---- */
.badge-delivery-drafting { background: var(--gray-100); color: var(--gray-600); }
.badge-delivery-internal_review { background: var(--status-contacted-bg); color: var(--status-contacted-text); }
.badge-delivery-client_review { background: var(--status-scheduled-bg); color: var(--status-scheduled-text); }
.badge-delivery-ready { background: var(--status-progress-bg); color: var(--status-progress-text); }
.badge-delivery-delivered { background: var(--status-published-bg); color: var(--status-published-text); }

/* ---- Generic <details> disclosure used for inline create/edit forms ---- */
.admin-card-body details {
  border-top: 1px solid var(--card-border);
  margin-top: 16px;
  padding-top: 14px;
}
.admin-card-body details summary {
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--navy-600);
  list-style: none;
}
.admin-card-body details summary::-webkit-details-marker { display: none; }
.admin-card-body details[open] summary { margin-bottom: 12px; }

/* ---- Quick status row (lead detail sidebar) ---- */
.quick-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}

/* =====================================================================
   TASK BOARD (kanban)
   ===================================================================== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(240px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  background: var(--gray-50);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  min-width: 240px;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--card-border);
}

.kanban-count {
  background: var(--white);
  border: 1px solid var(--card-border);
  border-radius: var(--r-pill);
  font-size: .7rem;
  padding: 1px 8px;
  color: var(--text-muted);
}

.kanban-column-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.kanban-empty {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 20px 0;
}

.task-card {
  background: var(--white);
  border: 1px solid var(--card-border);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--shadow-xs);
}
.task-card.is-overdue { border-color: var(--status-off-text); }

.task-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.task-type {
  font-size: .68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.task-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.task-lead-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  color: var(--navy-600);
  text-decoration: none;
  margin-bottom: 8px;
}
.task-lead-link:hover { text-decoration: underline; }

.task-card-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: .74rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.task-card-meta i { width: 12px; }
.text-danger { color: var(--status-off-text) !important; font-weight: 600; }

.task-quick-status select { width: 100%; }

/* =====================================================================
   SPRINT BOARD
   ===================================================================== */
.sprint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.sprint-goal { font-size: .85rem; color: var(--text-secondary); margin-bottom: 10px; }
.sprint-dates { font-size: .78rem; color: var(--text-muted); margin-bottom: 14px; }

.progress-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-400));
  border-radius: var(--r-pill);
  transition: width var(--t-base) var(--ease);
}
.progress-label { font-size: .76rem; color: var(--text-muted); margin-bottom: 12px; }

.sprint-stats {
  display: flex;
  gap: 16px;
  font-size: .78rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.sprint-task-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.sprint-task-list li {
  font-size: .8rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sprint-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}
.sprint-actions select { min-width: 130px; }

/* =====================================================================
   NOTIFICATIONS — inbox page
   ===================================================================== */
.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notification-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-100);
}
.notification-row:last-child { border-bottom: none; }
.notification-row.is-unread { background: var(--navy-50); }

.notification-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: var(--gold-100);
  color: var(--gold-700);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .95rem;
}

.notification-body { flex: 1; min-width: 0; }
.notification-title { font-size: .88rem; font-weight: 600; color: var(--text-primary); margin: 0 0 2px; }
.notification-message { font-size: .82rem; color: var(--text-secondary); margin: 0 0 4px; }
.notification-meta { font-size: .74rem; color: var(--text-muted); margin: 0; }
.notification-meta a { color: var(--navy-600); }

/* ---- Notification dropdown (topbar) ---- */
.notification-dropdown { width: 320px; max-height: 420px; overflow-y: auto; padding: 0; }
.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}
.notification-dropdown-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
  margin: 0;
}
.notification-dropdown-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  white-space: normal;
}
.notification-dropdown-item.is-unread { background: var(--navy-50); }
.notification-dropdown-item.is-unread .notification-dropdown-title { font-weight: 700; }
.notification-dropdown-title { font-size: .82rem; color: var(--text-primary); flex: 1; }
.notification-dropdown-time { font-size: .7rem; color: var(--text-muted); flex-shrink: 0; }

/* =====================================================================
   RESPONSIVE — lead-ops additions
   ===================================================================== */
@media (max-width: 1180px) {
  .kanban-board { grid-template-columns: repeat(3, minmax(220px, 1fr)); }
}
@media (max-width: 860px) {
  .kanban-board { grid-template-columns: 1fr; }
  .sprint-grid { grid-template-columns: 1fr; }
  .notification-dropdown { width: 280px; }
  .quick-status-row { flex-direction: column; align-items: stretch; }
  .quick-status-row form { width: 100%; }
  .quick-status-row .btn { width: 100%; }
}
