/* ==================================================================
   INFORMES MENSUALES SEO — OFERTASPC
   Design System v2.0 basado en la identidad corporativa de OfertasPC
   ==================================================================
   Colores oficiales:
     Primary:   #63EEBA (verde menta)
     Secondary: #7130F0 (morado)
     Blue:      #0224DE (azul eléctrico)
     Accent:    #A5FFDD (verde claro)
   Tipografías: DM Sans (body/heading), Cormorant Garamond (editorial)
   ================================================================== */

/* ── RESET & BASE ─────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colores corporativos */
  --color-primary: #63EEBA;
  --color-primary-dark: #3DD49A;
  --color-primary-light: #A5FFDD;
  --color-secondary: #7130F0;
  --color-secondary-light: #9B6AF5;
  --color-blue: #0224DE;
  --color-blue-soft: #6C7EE1;
  --color-bg: #FFFFFF;
  --color-bg-subtle: #F3F5FA;
  --color-foreground: #1A1D24;
  --color-muted: #6B7A99;
  --color-border: #E1E5EE;
  --color-success: #3DD49A;
  --color-warning: #F5A623;
  --color-destructive: #E84A4A;

  /* Grises */
  --gray-50:  #F3F5FA;
  --gray-100: #E8EBF3;
  --gray-200: #D6DBE7;
  --gray-300: #B0B8CC;
  --gray-400: #8A94A8;
  --gray-500: #6B7A99;
  --gray-600: #4D5A73;
  --gray-700: #343D52;
  --gray-800: #1A1D24;
  --gray-900: #0F1115;

  /* Gradientes */
  --gradient-tech: linear-gradient(90deg, #A899FE 0%, #0224DE 100%);
  --gradient-brand: linear-gradient(105deg, #0d1f1a 0%, #0a2e20 35%, #0d2b3d 70%, #0a1e30 100%);

  /* Tipografía */
  --font-body: 'DM Sans', -apple-system, system-ui, sans-serif;
  --font-heading: 'DM Sans', -apple-system, sans-serif;
  --font-editorial: 'Cormorant Garamond', Georgia, serif;

  /* Espaciado */
  --sidebar-width: 260px;
  --header-height: 0px;

  /* Sombras */
  --shadow-xs:   0 1px 3px 0 rgba(0,0,0,0.04);
  --shadow-sm:   0 2px 6px 0 rgba(0,0,0,0.05);
  --shadow-md:   0 4px 16px 0 rgba(0,0,0,0.07);
  --shadow-lg:   0 8px 32px 0 rgba(0,0,0,0.09);
  --shadow-card: 0 2px 12px 0 rgba(0,0,0,0.06);
  --shadow-card-hover: 0 6px 24px 0 rgba(0,0,0,0.1);

  /* Radios */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  /* Transiciones */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  color: var(--color-foreground);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.02em;
  display: flex;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  letter-spacing: -0.03em;
  font-weight: 600;
  line-height: 1.15;
}

a {
  color: var(--color-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-secondary);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ==================================================================
   LOADING OVERLAY
   ================================================================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}
.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-text {
  font-size: 14px;
  color: var(--color-muted);
  font-weight: 500;
}

/* ==================================================================
   SIDEBAR
   ================================================================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-bg);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-base);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.sidebar-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--color-foreground);
  line-height: 1.2;
}

.sidebar-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  background: var(--gray-50);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  width: fit-content;
}

/* ── Navigation ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.month-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  position: relative;
}

.month-nav-item:hover {
  background: var(--gray-50);
}

.month-nav-item.active {
  background: linear-gradient(90deg, rgba(99,238,186,0.12) 0%, transparent 100%);
  border-left-color: var(--color-primary);
}

.month-nav-item.active .month-nav-short {
  color: var(--color-primary-dark);
  font-weight: 700;
}

.month-nav-item.active .month-nav-label {
  color: var(--color-foreground);
  font-weight: 600;
}

.month-nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gray-300);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.month-nav-item.active .month-nav-dot {
  background: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99,238,186,0.3);
}

.month-nav-item.month-past .month-nav-dot {
  background: var(--color-primary-light);
}

.month-nav-short {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-400);
  width: 32px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.month-nav-label {
  font-size: 14px;
  color: var(--gray-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Timeline connector ── */
.month-nav-item::after {
  content: '';
  position: absolute;
  left: 29px;
  top: 22px;
  width: 2px;
  height: calc(100% - 10px);
  background: var(--gray-100);
  z-index: -1;
}

.month-nav-item:last-child::after {
  display: none;
}

/* ── Footer ── */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
}

.sidebar-sites {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.sidebar-site-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  transition: color var(--transition-fast);
}

.sidebar-site-link:hover {
  color: var(--color-blue);
}

.sidebar-site-link svg {
  flex-shrink: 0;
}

.sidebar-version {
  font-size: 11px;
  color: var(--gray-400);
  letter-spacing: 0.02em;
}

/* ── Toggle button (mobile) ── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-foreground);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--gray-50);
  box-shadow: var(--shadow-lg);
}

/* ==================================================================
   MAIN CONTENT
   ================================================================== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--color-bg-subtle);
  padding: 40px 48px;
  transition: margin-left var(--transition-base);
}

/* ── Month header ── */
.month-report {
  max-width: 960px;
  margin: 0 auto;
}

.report-header {
  position: relative;
  margin-bottom: 36px;
}

.report-month-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-secondary);
  background: rgba(113,48,240,0.08);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.report-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--color-foreground);
  margin-bottom: 8px;
  line-height: 1.1;
}

.report-subtitle {
  font-size: 16px;
  color: var(--color-muted);
  font-weight: 400;
  line-height: 1.6;
}

/* ── Summary card ── */
.summary-card {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-card);
  margin-bottom: 32px;
  border: 1px solid var(--color-border);
}

.summary-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.summary-card p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--gray-700);
}

/* ── Section titles ── */
.section-title {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  color: var(--color-foreground);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .section-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-title .section-icon.site-icon {
  background: rgba(2,36,222,0.1);
  color: var(--color-blue);
}

.section-title .section-icon.blog-icon {
  background: rgba(113,48,240,0.1);
  color: var(--color-secondary);
}

.section-title .section-icon.metrics-icon {
  background: rgba(99,238,186,0.2);
  color: var(--color-primary-dark);
}

.section-title .section-site {
  font-size: 13px;
  font-weight: 400;
  color: var(--color-muted);
  letter-spacing: 0;
  margin-left: auto;
}

/* ── Action table ── */
.action-table-wrapper {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  overflow: hidden;
  margin-bottom: 36px;
}

.action-table {
  width: 100%;
  border-collapse: collapse;
}

.action-table thead {
  background: var(--gray-50);
}

.action-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
  padding: 12px 20px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.action-table td {
  padding: 14px 20px;
  font-size: 14px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.action-table tr:last-child td {
  border-bottom: none;
}

.action-table tr:hover {
  background: var(--gray-50);
}

/* Category pill */
.category-pill {
  display: inline-flex;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.category-pill.tech {
  background: rgba(2,36,222,0.08);
  color: var(--color-blue);
}
.category-pill.content {
  background: rgba(113,48,240,0.08);
  color: var(--color-secondary);
}
.category-pill.onpage {
  background: rgba(99,238,186,0.2);
  color: #1A7A5A;
}
.category-pill.perf {
  background: rgba(245,166,35,0.15);
  color: #B87A10;
}
.category-pill.links {
  background: rgba(2,36,222,0.08);
  color: var(--color-blue-soft);
}
.category-pill.ux {
  background: rgba(113,48,240,0.08);
  color: var(--color-secondary);
}

/* Impact badge */
.impact-badge {
  display: inline-flex;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.impact-badge.high {
  background: rgba(61,212,154,0.15);
  color: #1A7A5A;
}
.impact-badge.medium {
  background: rgba(245,166,35,0.12);
  color: #B87A10;
}
.impact-badge.low {
  background: var(--gray-100);
  color: var(--gray-500);
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-badge.completed {
  color: #1A7A5A;
}
.status-badge.completed::before {
  background: var(--color-success);
}
.status-badge.in-progress {
  color: #B87A10;
}
.status-badge.in-progress::before {
  background: var(--color-warning);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.status-badge.planned {
  color: var(--gray-400);
}
.status-badge.planned::before {
  background: var(--gray-300);
}

/* ── Metrics grid ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}








/* ── Next steps ── */
.next-steps-card {
  background: linear-gradient(135deg, #0d1f1a 0%, #0a2e20 35%, #0d2b3d 70%, #0a1e30 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: #fff;
  margin-bottom: 48px;
}

.next-steps-card h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.next-steps-card ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.next-steps-card li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255,255,255,0.85);
}

.next-steps-card li::before {
  content: '→';
  color: var(--color-primary);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Navigation between months ── */
.report-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.report-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
}

.report-nav-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-foreground);
  box-shadow: var(--shadow-sm);
}

.report-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.report-nav-dots {
  display: flex;
  gap: 6px;
}

.report-nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-200);
  transition: all var(--transition-fast);
}

.report-nav-dot.active {
  background: var(--color-primary);
  width: 24px;
  border-radius: var(--radius-pill);
}

/* ── Animation ── */
.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================================================================
   RESPONSIVE
   ================================================================== */

/* Tablet */
@media (max-width: 1024px) {
  .main-content {
    padding: 32px 28px;
  }
  .metrics-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}

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

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 24px 16px;
    padding-top: 72px;
  }

  .sidebar-toggle.open {
    left: calc(var(--sidebar-width) + 8px);
  }

  .report-title {
    font-size: 1.6rem;
  }

  .action-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }



  .summary-card,
  .next-steps-card {
    padding: 20px;
  }

  .report-nav {
    flex-direction: column;
    gap: 12px;
  }

  .report-nav-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================================================================
   ADMIN / EDIT MODE
   ================================================================== */

/* ── Admin toggle in sidebar ── */
.sidebar-admin-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--gray-600);
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  text-align: left;
}

.sidebar-admin-toggle:hover {
  background: var(--gray-50);
}

.sidebar-admin-toggle.active {
  color: var(--color-secondary);
  background: rgba(113,48,240,0.06);
}

.sidebar-admin-toggle .toggle-track {
  width: 36px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--gray-200);
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.sidebar-admin-toggle.active .toggle-track {
  background: var(--color-secondary);
}

.sidebar-admin-toggle .toggle-knob {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.sidebar-admin-toggle.active .toggle-knob {
  transform: translateX(16px);
}

/* ── Admin toolbar (appears on top of main content) ── */
.admin-toolbar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
  flex-wrap: wrap;
}

body.admin-mode .admin-toolbar {
  display: flex;
}

.admin-toolbar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-right: 8px;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.admin-btn:hover {
  border-color: var(--color-secondary);
  color: var(--color-secondary);
  box-shadow: var(--shadow-xs);
}

.admin-btn.primary {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: #fff;
}

.admin-btn.primary:hover {
  background: var(--color-secondary-dark, #5A20C8);
}

.admin-btn.danger {
  border-color: var(--color-destructive);
  color: var(--color-destructive);
}

.admin-btn.danger:hover {
  background: rgba(232,74,74,0.06);
}

.admin-btn.success {
  border-color: var(--color-success);
  color: #1A7A5A;
}

.admin-btn.success:hover {
  background: rgba(61,212,154,0.1);
}

.admin-btn.small {
  padding: 3px 10px;
  font-size: 11px;
}

.admin-toolbar-separator {
  width: 1px;
  height: 24px;
  background: var(--color-border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── Edit controls on table rows ── */
.edit-row-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.edit-row-btn:hover {
  background: rgba(232,74,74,0.1);
  color: var(--color-destructive);
}

body.admin-mode .edit-row-btn {
  display: inline-flex;
}

.action-table .edit-col {
  width: 0;
  padding: 0;
}

body.admin-mode .action-table td.edit-col {
  width: 40px;
  padding: 8px 4px;
  text-align: center;
}

/* ── Add action row ── */
.add-action-row {
  display: none;
}

body.admin-mode .add-action-row {
  display: table-row;
}

.add-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--gray-300);
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.add-action-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
  background: rgba(99,238,186,0.06);
}

/* ── Clickable status in admin mode ── */
body.admin-mode .status-badge {
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

body.admin-mode .status-badge:hover {
  background: var(--gray-50);
}

/* ── Editable text fields ── */
.editable-text {
  cursor: default;
}

body.admin-mode .editable-text {
  cursor: text;
}

body.admin-mode .editable-text:hover {
  outline: 1px dashed var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

.editable-input {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--gray-700);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  width: 100%;
  transition: border-color var(--transition-fast);
}

.editable-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(99,238,186,0.2);
}

.editable-textarea {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  color: var(--gray-700);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  min-height: 80px;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.editable-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(99,238,186,0.2);
}

/* ── Metric inline edit ── */






/* ── Next steps admin ── */
body.admin-mode .next-steps-card li {
  cursor: pointer;
  position: relative;
  padding-right: 24px;
  transition: opacity var(--transition-fast);
}

body.admin-mode .next-steps-card li:hover {
  opacity: 0.7;
}

body.admin-mode .next-steps-card li:hover::after {
  content: '×';
  position: absolute;
  right: 0;
  top: 0;
  color: var(--color-destructive);
  font-size: 16px;
  font-weight: 700;
}

.next-steps-add {
  display: none;
  margin-top: 12px;
}

body.admin-mode .next-steps-add {
  display: flex;
  gap: 8px;
}

.next-steps-add input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  color: #fff;
  outline: none;
}

.next-steps-add input::placeholder {
  color: rgba(255,255,255,0.4);
}

.next-steps-add input:focus {
  border-color: var(--color-primary);
}

.next-steps-add button {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: var(--color-foreground);
  cursor: pointer;
  white-space: nowrap;
}

/* ── Modal overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px 32px;
  transform: translateY(20px);
  transition: transform var(--transition-base);
}

.modal-overlay.open .modal-box {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--gray-50);
  color: var(--gray-600);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-field label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

.modal-field input,
.modal-field select,
.modal-field textarea {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-foreground);
  transition: border-color var(--transition-fast);
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(99,238,186,0.2);
}

.modal-field textarea {
  min-height: 60px;
  resize: vertical;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.modal-btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-btn:hover {
  border-color: var(--gray-400);
}

.modal-btn.primary {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: #fff;
}

.modal-btn.primary:hover {
  background: #5A20C8;
}

.modal-btn.danger {
  border-color: var(--color-destructive);
  color: var(--color-destructive);
}

/* ── Import/Export zone ── */
.import-zone {
  display: none;
  background: var(--color-bg);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  margin-bottom: 28px;
}

body.admin-mode .import-zone {
  display: block;
}

.import-zone textarea {
  width: 100%;
  min-height: 120px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  resize: vertical;
  margin-bottom: 12px;
}

.import-zone textarea:focus {
  outline: none;
  border-color: var(--color-secondary);
}

.import-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--color-foreground);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease-out forwards;
  pointer-events: auto;
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-destructive); }
.toast.info { border-left: 3px solid var(--color-primary); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.out {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ── Month counter badge ── */
.admin-month-counter {
  display: none;
  font-size: 12px;
  color: var(--color-muted);
  text-align: center;
  padding: 8px;
}

body.admin-mode .admin-month-counter {
  display: block;
}

/* ==================================================================
   LOGIN OVERLAY
   ================================================================== */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9997;
  background: var(--color-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  animation: fadeIn 0.4s ease-out;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: var(--radius-md);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--color-foreground);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--color-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.login-field label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
}

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

.login-input-wrapper input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-foreground);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.login-input-wrapper input:focus {
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(113,48,240,0.12);
}

.login-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.login-eye:hover {
  color: var(--gray-600);
}

.login-error {
  font-size: 13px;
  color: var(--color-destructive);
  text-align: center;
  min-height: 0;
  line-height: 1.4;
  display: none;
}

.login-error.visible {
  display: block;
}

.login-locked {
  font-size: 13px;
  color: var(--color-warning);
  text-align: center;
  min-height: 0;
  line-height: 1.4;
  display: none;
  padding: 8px 12px;
  background: rgba(245,166,35,0.1);
  border-radius: var(--radius-sm);
}

.login-locked.visible {
  display: block;
}

.login-btn {
  width: 100%;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-secondary);
  color: #fff;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  margin-top: 4px;
}

.login-btn:hover {
  background: #5A20C8;
  transform: translateY(-1px);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.login-btn-reset {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-muted);
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition-fast);
  text-align: center;
}

.login-btn-reset:hover {
  color: var(--color-foreground);
  text-decoration: underline;
}

.login-btn-secondary {
  background: none;
  border: 1px solid var(--color-border);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  padding: 10px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-align: center;
  width: 100%;
}

.login-btn-secondary:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

.login-footer-text {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 20px;
  letter-spacing: 0.02em;
}

/* Change password modal: specifically for fields outside the wrapper */
#cp-old, #cp-new, #cp-confirm {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-foreground);
  transition: border-color var(--transition-fast);
  outline: none;
  box-sizing: border-box;
}

#cp-old:focus, #cp-new:focus, #cp-confirm:focus {
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(113,48,240,0.12);
}

/* ── Auth state ── */
body.authenticated .login-overlay:not(#change-password-modal) {
  display: none !important;
}

#change-password-modal {
  display: none;
  z-index: 9998;
}

/* ── Responsive admin ── */
@media (max-width: 768px) {
  .admin-toolbar {
    padding: 10px 14px;
    gap: 6px;
  }

  .admin-btn {
    font-size: 11px;
    padding: 5px 10px;
  }

  .modal-box {
    padding: 20px;
    max-width: 100%;
  }

  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    max-width: 100%;
  }
}

/* ── Inline select en acciones (admin mode) ── */
.inline-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--color-bg);
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-sm);
  padding: 4px 24px 4px 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--color-text);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  min-width: 100px;
}

.inline-select:focus {
  outline: none;
  border-color: var(--color-accent-hover);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ── Config modal ── */
.config-modal .modal-box {
  max-width: 600px;
}

.config-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}

.config-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.config-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.config-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-row-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-bg);
}

.config-row-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.config-row-del {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-400);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.config-row-del:hover {
  color: var(--color-destructive);
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}

.config-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-add-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--gray-500);
  background: transparent;
}

.config-add-input:focus {
  outline: none;
  border-color: var(--color-accent);
  border-style: solid;
  color: var(--color-text);
  background: var(--color-bg);
}

.config-add-btn {
  white-space: nowrap;
}

/* ── Viewer logout button (solo viewers, arriba derecha) ── */
.viewer-logout-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--gray-500);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.viewer-logout-btn:hover {
  background: var(--color-border);
  border-color: var(--red-500);
  color: var(--red-500);
}

/* ── CSP-compatible utility classes (moved from inline styles) ── */
.empty-hint-text {
  font-size: 18px;
  color: var(--gray-500);
}
.empty-hint-sub {
  font-size: 14px;
  color: var(--gray-400);
  margin-top: 8px;
}
.error-text {
  font-size: 18px;
  color: var(--color-destructive);
}
.error-hint {
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 8px;
}
.modal-hint {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 16px;
}
.import-hint {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 12px;
}
.import-textarea {
  min-height: 200px;
  font-family: monospace;
  font-size: 12px;
}
.month-hint {
  font-size: 12px;
  color: var(--gray-400);
}

/* CSP-safe: center padding for error/empty states */
.empty-hint-text, .error-text {
  margin: 0;
}
.empty-hint-sub, .error-hint {
  margin-top: 8px;
}
.month-report:has(.empty-hint-text),
.month-report:has(.error-text) {
  text-align: center;
  padding: 80px 20px;
}

/* ── Destructive modal elements ── */
.destructive-warning {
  font-size: 14px;
  color: var(--gray-600);
}
.destructive-field {
  margin-top: 8px;
}
.destructive-label {
  color: var(--color-destructive);
}

/* ═══════════════════════════════════════════
   Rich Text Editor (summary)
   ═══════════════════════════════════════════ */
.rte-toolbar {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  flex-wrap: wrap;
  align-items: center;
}
.rte-toolbar .rte-sep {
  width: 1px;
  height: 24px;
  background: var(--gray-300);
  margin: 0 4px;
}
.rte-toolbar button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--gray-700);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.rte-toolbar button:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}
.rte-toolbar button.active {
  background: var(--primary);
  color: #fff;
}
.rte-toolbar button[title]::after {
  content: attr(title);
}
.rte-color-input {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid var(--gray-300);
  border-radius: 4px;
  cursor: pointer;
  background: none;
}
.rte-color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.rte-color-input::-webkit-color-swatch { border: none; border-radius: 2px; }

.rte-editor {
  min-height: 120px;
  padding: 16px;
  border: 1px solid var(--gray-200);
  border-radius: 0 0 8px 8px;
  background: #fff;
  color: var(--gray-900);
  font-size: 15px;
  line-height: 1.7;
  outline: none;
  overflow-y: auto;
  max-height: 400px;
}
.rte-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
.rte-editor b, .rte-editor strong { font-weight: 700; }
.rte-editor i, .rte-editor em { font-style: italic; }
.rte-editor u { text-decoration: underline; }
.rte-editor s { text-decoration: line-through; }
.rte-editor mark {
  background: #fef08a;
  padding: 1px 4px;
  border-radius: 2px;
}
.rte-editor ul, .rte-editor ol {
  margin: 8px 0;
  padding-left: 24px;
}

/* Summary card with RTE */
.summary-card .summary-display {
  min-height: 60px;
  padding: 12px 16px;
  border-radius: 6px;
  cursor: default;
  line-height: 1.7;
  font-size: 15px;
}
.summary-card .summary-display b,
.summary-card .summary-display strong { font-weight: 700; }
.summary-card .summary-display i,
.summary-card .summary-display em { font-style: italic; }
.summary-card .summary-display u { text-decoration: underline; }
.summary-card .summary-display s { text-decoration: line-through; }
.summary-card .summary-display mark {
  background: #fef08a;
  padding: 1px 4px;
  border-radius: 2px;
}
.summary-card .summary-display ul,
.summary-card .summary-display ol {
  margin: 8px 0;
  padding-left: 24px;
}
.admin-mode .summary-display {
  cursor: pointer;
  border: 1px dashed transparent;
  transition: border-color 0.2s;
}
.admin-mode .summary-display:hover {
  border-color: var(--gray-300);
}

/* ── RTE compact variant (for action rows) ── */
.rte-toolbar.rte-compact {
  border-radius: 6px;
  padding: 4px 6px;
  gap: 1px;
}
.rte-toolbar.rte-compact button {
  width: 26px;
  height: 26px;
  font-size: 12px;
}
.rte-toolbar.rte-compact .rte-sep {
  height: 20px;
  margin: 0 2px;
}
.rte-toolbar.rte-compact .rte-color-input {
  width: 24px;
  height: 24px;
}
.rte-editor.rte-editor-compact {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.5;
  max-height: 200px;
  border-radius: 0 0 6px 6px;
}

/* ── Action text rendered HTML ── */
.action-text-editable b,
.action-text-editable strong { font-weight: 700; }
.action-text-editable i,
.action-text-editable em { font-style: italic; }
.action-text-editable u { text-decoration: underline; }
.action-text-editable s { text-decoration: line-through; }
.action-text-editable mark {
  background: #fef08a;
  padding: 1px 3px;
  border-radius: 2px;
}

/* ═══════════════════════════════════════════
   Metrics Gallery — Image Upload & Display
   ═══════════════════════════════════════════ */
.metrics-gallery {
  margin-bottom: 24px;
}
.metrics-upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--gray-500);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}
.metrics-upload-zone:hover,
.metrics-upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
  color: var(--primary);
}
.metrics-upload-zone input[type="file"] {
  display: none;
}
.metrics-upload-hint {
  font-size: 12px;
  color: var(--gray-400);
}
.metrics-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.metrics-gallery-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--gray-100);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.metrics-gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.metrics-gallery-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}
.metrics-gallery-caption {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--gray-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metrics-gallery-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.metrics-gallery-item:hover .metrics-gallery-delete {
  opacity: 1;
}
.metrics-gallery-delete:hover {
  background: var(--color-destructive);
}

/* ═══════════════════════════════════════════
   Lightbox
   ═══════════════════════════════════════════ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}
.lightbox-img {
  max-width: 85vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}
.lightbox-caption {
  text-align: center;
  color: #fff;
  font-size: 14px;
  padding: 8px 0 0;
  opacity: 0.85;
}
.lightbox-counter {
  text-align: center;
  color: #fff;
  font-size: 12px;
  opacity: 0.6;
  padding: 4px 0;
}
.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  font-size: 36px;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
  line-height: 1;
}
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(0,0,0,0.8); }
.lightbox-prev { left: -50px; }
.lightbox-next { right: -50px; }

@media (max-width: 768px) {
  .metrics-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }
  .metrics-gallery-item img {
    height: 140px;
  }
  .lightbox-prev { left: -5px; }
  .lightbox-next { right: -5px; }
  .lightbox-close { top: -36px; }
}
