/* ── Admin Panel Styles ── */
:root {
  --green-dark:    #1A2E0E;
  --green-primary: #2D5016;
  --green-medium:  #3D6B20;
  --gold:          #C8A84B;
  --cream:         #F6F0E4;
  --cream-dark:    #EDE3CE;
  --white:         #FFFFFF;
  --text-dark:     #1C1A0F;
  --text-medium:   #4A3A28;
  --text-light:    #7A6A52;
  --border:        #E2D8C4;
  --sidebar-w:     240px;
  --danger:        #dc3545;
  --success:       #28a745;
  --warning:       #ffc107;
  --info:          #17a2b8;
  --font: 'Raleway', sans-serif;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: #F0EBE0; color: var(--text-dark); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ── LOGIN ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-dark), var(--green-primary));
  padding: 24px;
}
.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}
.login-logo { font-size: 3rem; margin-bottom: 16px; }
.login-card h1 {
  font-family: 'Merriweather', serif;
  font-size: 1.6rem;
  margin-bottom: 4px;
}
.login-card > p { color: var(--text-light); margin-bottom: 32px; }
.login-card .form-group { text-align: left; margin-bottom: 16px; }
.back-link {
  display: inline-block;
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--text-light);
  transition: color 0.2s;
}
.back-link:hover { color: var(--green-primary); }

/* ── ADMIN APP LAYOUT ── */
.admin-app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--green-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-icon { font-size: 1.5rem; }
.sidebar-title { color: var(--white); font-weight: 700; font-size: 0.9rem; }
.sidebar-sub { color: var(--gold); font-size: 0.7rem; letter-spacing: 1px; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.nav-item.active { background: var(--green-primary); color: var(--white); }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.badge {
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
}
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-logout {
  width: 100%;
  padding: 9px;
  background: rgba(220,53,69,0.15);
  border: 1px solid rgba(220,53,69,0.3);
  color: #ff8a8a;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover { background: rgba(220,53,69,0.3); }
.view-site-link {
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  transition: color 0.2s;
}
.view-site-link:hover { color: var(--gold); }
.btn-about-link {
  background: none;
  border: none;
  padding: 0;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: color 0.2s;
}
.btn-about-link:hover { color: var(--gold); }

/* ── TRASH PANEL ── */
.trash-group {
  margin-bottom: 28px;
}
.trash-group h3 {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted, #6b6b6b);
  display: flex; align-items: center; gap: 8px;
}
.trash-count {
  background: var(--bg-secondary, rgba(0,0,0,0.06));
  color: var(--text-muted, #6b6b6b);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
}
.trash-list {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-bg, #fff);
}
.trash-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.trash-item:last-child { border-bottom: none; }
.trash-item-info { flex: 1; min-width: 0; }
.trash-item-name {
  font-weight: 500;
  color: var(--text-dark, #1a1a1a);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trash-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted, #6b6b6b);
  margin-top: 2px;
}
.trash-item-actions {
  display: flex; gap: 8px;
  flex-shrink: 0;
}
.trash-retention-note {
  background: rgba(110,168,194,0.10);
  border: 1px solid rgba(110,168,194,0.30);
  color: var(--text-dark, #1a1a1a);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 18px;
  font-size: 0.85rem;
}
.trash-purge-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  vertical-align: middle;
}
.trash-purge-normal {
  background: rgba(110,168,194,0.15);
  color: #2c5b73;
}
.trash-purge-urgent {
  background: rgba(212,90,74,0.15);
  color: #b04030;
}

/* ── BACKUP STATUS CARD (Dashboard) ── */
.backup-status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-bg, #fff);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

/* ── Visitor Stats card (Cloudflare Web Analytics) ─────────────────────────
   Sits below Quick Actions on the Dashboard. Matches the existing card
   visual register (same border + radius + bg). On-demand fetch — see
   loadAnalytics() in admin.js. */
.analytics-card {
  margin-top: 28px;
  padding: 18px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-bg, #fff);
}
.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.analytics-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}
.analytics-window {
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-light);
  font-weight: 400;
}
.analytics-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.analytics-status {
  font-size: 0.78rem;
  color: var(--text-light);
}
.analytics-status-warn  { color: var(--gold); }
.analytics-status-error { color: #b8341a; }

.analytics-totals {
  display: flex;
  gap: 28px;
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.analytics-total {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.analytics-total-val {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-dark);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.analytics-total-label {
  font-size: 0.78rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px 24px;
}
.analytics-col h4 {
  margin: 0 0 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  font-weight: 600;
}
.analytics-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.analytics-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 0.88rem;
}
.analytics-list li:last-child { border-bottom: none; }
.analytics-list li.empty {
  color: var(--text-light);
  font-style: italic;
  border-bottom: none;
  padding: 6px 0;
}
.analytics-list .al-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dark);
}
.analytics-list .al-count {
  color: var(--text-medium);
  font-variant-numeric: tabular-nums;
}

.analytics-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
}
.analytics-footer a {
  color: var(--text-medium);
  text-decoration: none;
}
.analytics-footer a:hover { color: var(--green-primary); }
.analytics-footer-sep {
  color: var(--text-light);
  margin: 0 4px;
}
.analytics-debug-link { cursor: pointer; }

.analytics-debug {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.02);
}
.analytics-debug-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.analytics-debug-bots {
  font-size: 0.82rem;
  color: var(--text-medium);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.analytics-debug-out {
  margin: 0;
  padding: 10px;
  max-height: 360px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-dark);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}
.backup-status-card:hover { filter: brightness(1.03); }
.backup-status-card .bs-icon {
  font-size: 22px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
}
.backup-status-card .bs-text { flex: 1; min-width: 0; }
.backup-status-card .bs-title {
  font-weight: 600; font-size: 0.95rem;
  color: var(--text-dark, #1a1a1a);
}
.backup-status-card .bs-detail {
  font-size: 0.8rem;
  color: var(--text-muted, #6b6b6b);
  margin-top: 2px;
  word-break: break-word;
}
.backup-status-card .bs-details-btn {
  flex-shrink: 0;
  background: rgba(0,0,0,0.05);
  border: 1px solid var(--border);
  color: var(--text-dark, #1a1a1a);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
}
.backup-status-card .bs-details-btn:hover { background: rgba(0,0,0,0.1); }
.backup-status-card .bs-action-btn {
  flex-shrink: 0;
  background: var(--primary, #2D5016);
  border: 1px solid var(--primary, #2D5016);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, opacity 0.15s;
}
.backup-status-card .bs-action-btn:hover { background: var(--gold, #c8a84b); border-color: var(--gold, #c8a84b); }
.backup-status-card .bs-action-btn:disabled { opacity: 0.6; cursor: progress; }

/* Color tones — backgrounds + icon-bubble tints */
.backup-status-card.bs-loading { border-color: var(--border); }
.backup-status-card.bs-loading .bs-icon { background: rgba(0,0,0,0.05); }

.backup-status-card.bs-green {
  background: rgba(45,128,32,0.08);
  border-color: rgba(45,128,32,0.25);
}
.backup-status-card.bs-green .bs-icon { background: rgba(45,128,32,0.15); }

.backup-status-card.bs-yellow {
  background: rgba(200,168,75,0.10);
  border-color: rgba(200,168,75,0.40);
}
.backup-status-card.bs-yellow .bs-icon { background: rgba(200,168,75,0.20); }

.backup-status-card.bs-red {
  background: rgba(212,90,74,0.10);
  border-color: rgba(212,90,74,0.40);
}
.backup-status-card.bs-red .bs-icon { background: rgba(212,90,74,0.20); }

.backup-status-card.bs-gray {
  background: rgba(0,0,0,0.04);
  border-color: var(--border);
}

/* ── ABOUT DIALOG ── */
.about-dialog { padding: 4px 0; }
.about-brand {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.about-logo {
  width: 48px; height: 48px;
  border-radius: 10px;
  flex-shrink: 0;
}
.about-product {
  font-family: var(--font-heading, Merriweather), serif;
  font-size: 1.1rem; font-weight: 700;
  color: var(--text-dark, #1a1a1a);
}
.about-component {
  font-size: 0.85rem;
  color: var(--text-muted, #6b6b6b);
  margin-top: 2px;
}
.about-table {
  display: grid;
  grid-template-columns: 100px 1fr;
  row-gap: 6px; column-gap: 12px;
  font-size: 0.85rem;
}
.about-row { display: contents; }
.about-key {
  color: var(--text-muted, #6b6b6b);
  font-weight: 500;
}
.about-val {
  color: var(--text-dark, #1a1a1a);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  word-break: break-word;
}
.about-val a { color: var(--primary, #2D5016); text-decoration: underline; }
.about-msg {
  font-family: inherit;
}
.about-msg > summary {
  cursor: pointer;
  list-style: none;
  color: var(--text-muted, #6b6b6b);
  font-style: italic;
}
.about-msg > summary::-webkit-details-marker { display: none; }
.about-msg > summary::before {
  content: '▸ ';
  color: var(--text-muted, #6b6b6b);
  display: inline-block;
  width: 12px;
  transition: transform 0.15s;
}
.about-msg[open] > summary::before { content: '▾ '; }
.about-msg[open] > summary {
  margin-bottom: 6px;
  color: var(--text-dark, #1a1a1a);
  font-style: normal;
}
.about-msg > pre {
  margin: 0;
  padding: 8px 10px;
  background: rgba(0,0,0,0.04);
  border-radius: 6px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-dark, #1a1a1a);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
}
.about-copy {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted, #6b6b6b);
  text-align: center;
}

/* ── MAIN CONTENT ── */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

/* ── PANELS ── */
.panel { display: none; }
.panel.active { display: block; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.panel-header h2 {
  font-family: 'Merriweather', serif;
  font-size: 1.5rem;
  color: var(--text-dark);
}
.panel-header p { color: var(--text-light); font-size: 0.9rem; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-primary { background: var(--green-primary); color: #fff; border-color: var(--green-primary); }
.btn-primary:hover { background: var(--green-medium); border-color: var(--green-medium); }
.btn-outline { background: transparent; color: var(--green-primary); border-color: var(--green-primary); }
.btn-outline:hover { background: var(--green-primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #c82333; border-color: #c82333; }
.btn-warning { background: var(--warning); color: var(--text-dark); border-color: var(--warning); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 6px 10px; }

/* ── DASHBOARD STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card.highlight { border: 2px solid var(--danger); }
.stat-icon { font-size: 2rem; margin-bottom: 8px; }
.stat-val {
  font-family: 'Merriweather', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--green-primary);
}
.stat-label { font-size: 0.8rem; color: var(--text-light); margin-top: 4px; font-weight: 500; }

.dashboard-actions { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.dashboard-actions h3 { font-size: 1rem; margin-bottom: 16px; color: var(--text-medium); text-transform: uppercase; letter-spacing: 1px; font-size: 0.8rem; }
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.quick-btn {
  padding: 10px 20px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-medium);
  cursor: pointer;
  transition: all 0.2s;
}
.quick-btn:hover { background: var(--green-primary); color: #fff; border-color: var(--green-primary); }

/* ── ITEMS LIST ── */
.items-list { display: flex; flex-direction: column; gap: 12px; }
.item-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.item-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.12); }
.item-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--cream-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 700; font-size: 1rem; margin-bottom: 3px; }
.item-meta { font-size: 0.8rem; color: var(--text-light); }
.item-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 50px;
  margin-left: 6px;
}
.badge-sire { background: #d4edda; color: #155724; }
.badge-dam  { background: #d1ecf1; color: #0c5460; }
.badge-available { background: #d4edda; color: #155724; }
.badge-upcoming  { background: #fff3cd; color: #856404; }
.badge-reserved  { background: #ffe5d0; color: #7a4724; }
.badge-sold_out  { background: #e2e3e5; color: #383d41; }
.badge-published { background: #d4edda; color: #155724; }
.badge-hidden    { background: #fff3cd; color: #856404; }
.item-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Pending-review banner above the testimonials list */
.pending-banner {
  background: linear-gradient(90deg, #fff3cd, #fff8e1);
  border: 1px solid #f2cf6a;
  color: #6f4c10;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.pending-banner strong { color: #6f4c10; }

/* Highlight pending testimonial cards */
.item-card-pending {
  background: #fffbea;
  border-color: #f2cf6a;
}

/* ── GALLERY ADMIN ── */
.gallery-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.gallery-admin-item {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.gallery-admin-img {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--cream-dark);
  position: relative;
}
.gallery-admin-img img { width: 100%; height: 100%; object-fit: cover; }
.gallery-admin-info { padding: 10px; }
.gallery-admin-caption { font-size: 0.8rem; color: var(--text-medium); margin-bottom: 6px; min-height: 20px; }
.gallery-admin-cat { font-size: 0.72rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.gallery-admin-actions { display: flex; gap: 6px; }

/* ── CONTENT EDITOR ── */
.content-sections { display: flex; flex-direction: column; gap: 24px; }
.content-section-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.content-section-card h3 {
  font-family: 'Merriweather', serif;
  font-size: 1rem;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dark);
}

/* ── HEALTH CERTS EDITOR ── */
.cert-item {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--cream);
  border-radius: var(--radius);
}
.cert-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  margin-top: 22px;
}

/* ── VERIFICATION BADGES EDITOR ─────────────────────────────────────── */
.badge-item {
  /* Override the 1fr 2fr auto grid of .cert-item with a layout that fits
     a thumbnail + fields + action column. */
  grid-template-columns: 120px 1fr auto;
  align-items: center;
}
.badge-thumb {
  width: 120px;
  height: 80px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.badge-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.badge-thumb-empty {
  color: var(--text-light);
  font-size: 0.8rem;
}
.badge-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.badge-fields .form-group { margin-bottom: 0; }
.badge-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.badge-actions .cert-remove { margin-top: 0; }

/* ── MESSAGES ── */
.message-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.message-card.unread { border-left: 3px solid var(--green-primary); }
.message-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.message-from { font-weight: 700; }
.message-date { font-size: 0.8rem; color: var(--text-light); }
.message-subject { font-size: 0.85rem; color: var(--text-light); margin-bottom: 8px; }
.message-contact { font-size: 0.82rem; color: var(--text-medium); margin-bottom: 12px; }
.message-body { font-size: 0.9rem; color: var(--text-medium); line-height: 1.6; margin-bottom: 12px; }
.message-actions { display: flex; gap: 8px; }
.message-forensic {
  margin-bottom: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.message-forensic > summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted, #6b6b6b);
  list-style: none;
  user-select: none;
}
.message-forensic > summary::-webkit-details-marker { display: none; }
.message-forensic > summary::before { content: '▸ '; color: var(--text-muted, #6b6b6b); }
.message-forensic[open] > summary::before { content: '▾ '; }
.message-forensic[open] > summary { margin-bottom: 6px; color: var(--text-dark, #1a1a1a); }
.message-forensic-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px;
  font-size: 0.78rem;
  padding: 2px 0;
}
.message-forensic-row > span { color: var(--text-muted, #6b6b6b); }
.message-forensic-row > code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-dark, #1a1a1a);
  word-break: break-all;
}

/* ── SETTINGS ── */
.settings-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 480px;
  box-shadow: var(--shadow);
}
.settings-card h3 {
  font-family: 'Merriweather', serif;
  font-size: 1rem;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom: 16px; }

/* Inline URL field + Upload button on Page Content cards. The button
   triggers the hidden <input type=file>; the URL field is auto-filled
   when upload completes. */
.url-with-upload {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}
.url-with-upload > input[type="text"] {
  flex: 1;
  min-width: 240px;
}
.url-with-upload > .btn { flex-shrink: 0; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-medium);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text-dark);
  background: var(--white);
  transition: border-color 0.2s;
  outline: none;
}
/* The blanket rule above is built for text/email/file inputs sitting alone
   in a form-group. Checkbox / radio / range need their native sizing
   restored so they don't stretch to fill the row. Same for any input
   that's wrapped inside a .checkbox-row or .radio-row label (where the
   row IS the layout, not the input). */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
  width: auto;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  flex-shrink: 0;
}
.form-group input[type="range"] {
  padding: 0;
  border: none;
  background: transparent;
}
/* Labels that wrap a checkbox or radio (i.e., the LABEL is the row and the
   input is its first child) should not pick up the all-caps "field label"
   treatment from .form-group label below. They behave like inline content,
   not like a section heading. */
.form-group label.checkbox-row,
.form-group label.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-transform: none;
  font-weight: normal;
  font-size: 0.9rem;
  color: var(--text-dark);
  letter-spacing: normal;
  margin-bottom: 0;
  cursor: pointer;
}
/* Radio labels are usually short ("Small", "Medium") and sit on a single
   line — center-aligned, smaller gap, inline so multiple share a row. */
.form-group label.radio-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* Helper text inside a checkbox-row / radio-row label inherits the label's
   uppercase by default. Reset back to normal-case body text. */
.form-group label.checkbox-row .form-hint,
.form-group label.radio-row .form-hint {
  text-transform: none;
  font-weight: normal;
  letter-spacing: normal;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--green-primary);
  box-shadow: 0 0 0 3px rgba(45,80,22,0.08);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.78rem; color: var(--text-light); margin-top: 4px; }

.form-message {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
}
.form-message.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.form-message.error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ── INLINE UPLOAD ZONE ── */
.upload-zone-inline {
  background: var(--cream);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.upload-zone-inline input[type="file"] {
  border: none;
  padding: 0;
  background: none;
  font-size: 0.88rem;
}

/* ── FILE UPLOAD ── */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--cream);
}
.file-upload-area:hover { border-color: var(--green-primary); background: #f0f7ea; }
.file-upload-area.dragover { border-color: var(--green-primary); background: #e8f5e0; }
.upload-icon { font-size: 2.5rem; margin-bottom: 8px; }
.upload-text { font-weight: 600; color: var(--text-medium); margin-bottom: 4px; }
.upload-sub { font-size: 0.8rem; color: var(--text-light); }
/* Photo-chip grid shown on the litter edit form for existing photos */
.photo-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.photo-chip {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--cream);
  aspect-ratio: 1 / 1;
}
.photo-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-chip-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(180, 40, 40, 0.92);
  color: white;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-chip-remove:hover {
  background: rgb(200, 50, 50);
  transform: scale(1.08);
}

.img-preview {
  max-width: 200px;
  max-height: 160px;
  object-fit: contain;
  border-radius: var(--radius);
  margin: 12px auto 0;
  border: 1px solid var(--border);
}

/* ── MODAL ── */
.modal { position: fixed; inset: 0; z-index: 9000; display: none; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.modal-dialog {
  position: relative;
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  margin: 16px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}
.modal-header h3 { font-family: 'Merriweather', serif; font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text-dark); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--green-dark);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s;
}
.toast.show { transform: none; opacity: 1; }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
  background: var(--white);
  border-radius: var(--radius);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* ── THEME EDITOR ── */
.theme-editor {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}
.theme-controls {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.theme-group {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.theme-group:last-of-type { border-bottom: none; }
.theme-group h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-light);
  margin-bottom: 16px;
}
.color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.color-row label {
  font-size: 0.85rem;
  color: var(--text-medium);
  font-weight: 500;
  flex: 1;
}
.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-input-wrap input[type="color"] {
  width: 40px;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  cursor: pointer;
  background: var(--white);
}
.color-hex {
  width: 88px;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--text-dark);
  background: var(--white);
  text-transform: uppercase;
}
.color-hex:focus { border-color: var(--green-primary); outline: none; }
.theme-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── THEME PREVIEW CARD ── */
.theme-preview-card {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--white);
  position: sticky;
  top: 20px;

  --tp-primary:      #2D5016;
  --tp-dark:         #1A2E0E;
  --tp-accent:       #C8A84B;
  --tp-bg:           #F6F0E4;
  --tp-heading-font: 'Merriweather', Georgia, serif;
  --tp-body-font:    'Raleway', sans-serif;
}
.tp-header {
  background: var(--tp-dark);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tp-logo {
  font-family: var(--tp-heading-font);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.tp-nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tp-nav-links span {
  font-family: var(--tp-body-font);
  font-size: 0.7rem;
  color: rgba(255,255,255,0.7);
}
.tp-cta {
  background: var(--tp-accent) !important;
  color: #1c1a0f !important;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700 !important;
}
.tp-hero {
  background: linear-gradient(135deg, var(--tp-dark), var(--tp-primary));
  padding: 24px 16px;
  text-align: center;
}
.tp-hero-title {
  font-family: var(--tp-heading-font);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 6px;
}
.tp-hero-sub {
  font-family: var(--tp-body-font);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.75);
  margin-bottom: 10px;
}
.tp-btn {
  background: var(--tp-primary);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  font-family: var(--tp-body-font);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: default;
}
.tp-body {
  background: var(--tp-bg);
  padding: 16px;
}
.tp-section-label {
  font-family: var(--tp-body-font);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--tp-primary);
  margin-bottom: 4px;
}
.tp-section-title {
  font-family: var(--tp-heading-font);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.tp-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.tp-card {
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.tp-card-img {
  height: 40px;
  background: linear-gradient(135deg, var(--tp-primary), var(--tp-accent));
}
.tp-card-name {
  font-family: var(--tp-heading-font);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 5px 6px 2px;
}
.tp-card-meta {
  font-family: var(--tp-body-font);
  font-size: 0.6rem;
  color: #888;
  padding: 0 6px 6px;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; }
  .admin-main { margin-left: 0; padding: 16px; }
  .admin-app { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
