/* ============================================================
   ETL Dashboard — Design System
   Fuente: Inter (Google Fonts)
   Paleta: Slate dark sidebar + Emerald accent (tema ambiental)
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --sidebar-bg:           #0c1322;
  --sidebar-hover:        #131d30;
  --sidebar-active-bg:    rgba(16, 185, 129, 0.12);
  --sidebar-active-text:  #10b981;
  --sidebar-text:         #94a3b8;
  --sidebar-width-open:   240px;
  --sidebar-width-closed: 64px;

  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --border-soft: #f8fafc;

  --text-primary:   #0f172a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;

  --accent:       #10b981;
  --accent-dark:  #059669;
  --accent-light: rgba(16, 185, 129, 0.08);

  --blue:       #3b82f6;
  --blue-light: rgba(59, 130, 246, 0.08);
  --amber:      #f59e0b;
  --red:        #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 32px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);

  --transition: 0.2s ease;
}

/* ── Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  width: var(--sidebar-width-closed);
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,0.04);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar:hover {
  width: var(--sidebar-width-open);
  overflow-y: auto;
}

.sidebar .logo-container {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.sidebar .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
  color: #fff;
}

.sidebar .logo-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.02em;
  margin-left: 10px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.sidebar:hover .logo-name { opacity: 1; visibility: visible; }

.sidebar .nav-section-label {
  padding: 20px 18px 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3d5068;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.sidebar:hover .nav-section-label { opacity: 1; visibility: visible; }

.sidebar .nav-link {
  display: flex;
  align-items: center;
  padding: 9px 18px;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.sidebar .nav-link:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar .nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.sidebar .nav-link i {
  font-size: 1.0625rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar .nav-text {
  margin-left: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.sidebar:hover .nav-text { opacity: 1; visibility: visible; }

.sidebar .sidebar-footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar .sidebar-avatar {
  width: 28px;
  height: 28px;
  background: #1e293b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--sidebar-text);
  flex-shrink: 0;
}

.sidebar .sidebar-user-email {
  font-size: 0.75rem;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.sidebar:hover .sidebar-user-email { opacity: 1; visibility: visible; }

/* ── Navbar ─────────────────────────────────────────────────── */
.top-navbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.top-navbar .page-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-grow: 1;
}

.top-navbar .nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background var(--transition);
}
.top-navbar .nav-user:hover { background: var(--bg); color: var(--text-primary); }

.top-navbar .nav-avatar {
  width: 30px;
  height: 30px;
  background: var(--accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--accent-dark);
  font-weight: 600;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}
.btn-logout:hover { background: #fef2f2; border-color: #fecaca; color: var(--red); }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm) !important;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md) !important; }

.card-header {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 16px 20px !important;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}

/* Stat cards */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.stat-card-value {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-card-sub { font-size: 0.75rem; color: var(--text-secondary); }

.stat-card-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.stat-card-accent {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
  border: none !important;
  color: #fff;
}
.stat-card-accent .stat-card-label { color: rgba(255,255,255,0.5); }
.stat-card-accent .stat-card-value { color: #fff; }
.stat-card-accent .stat-card-sub   { color: rgba(255,255,255,0.6); }
.stat-card-accent .stat-card-icon  { background: rgba(255,255,255,0.1); color: #6ee7b7; }

/* ── Progress bar ───────────────────────────────────────────── */
.progress {
  background: #e2e8f0;
  border-radius: 100px;
  height: 5px;
  overflow: hidden;
}
.progress-bar { border-radius: 100px; background: var(--accent); }
.stat-card-accent .progress { background: rgba(255,255,255,0.2); }
.stat-card-accent .progress-bar { background: #6ee7b7; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
}
.badge-green  { background: rgba(16,185,129,0.1);  color: #059669; }
.badge-blue   { background: rgba(59,130,246,0.1);  color: #2563eb; }
.badge-amber  { background: rgba(245,158,11,0.1);  color: #d97706; }
.badge-red    { background: rgba(239,68,68,0.1);   color: #dc2626; }
.badge-slate  { background: rgba(100,116,139,0.1); color: #475569; }

/* ── Status dot ─────────────────────────────────────────────── */
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.green { background: var(--accent); box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }
.status-dot.amber { background: var(--amber);  box-shadow: 0 0 0 3px rgba(245,158,11,0.2); }
.status-dot.red   { background: var(--red);    box-shadow: 0 0 0 3px rgba(239,68,68,0.2);  }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

/* ── Iframe viewer ──────────────────────────────────────────── */
.iframe-container {
  position: relative;
  width: 100%;
  height: 74vh;
  background: var(--bg);
  overflow: hidden;
}
.iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table {
  font-size: 0.8125rem;
  color: var(--text-primary);
  margin: 0;
}
.table thead th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}
.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafbfc; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.form-control, .form-select {
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
  outline: none;
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  padding: 12px 16px;
}
.alert-success { background: rgba(16,185,129,0.08); color: #065f46; }
.alert-danger  { background: rgba(239,68,68,0.08);  color: #991b1b; }
.alert-info    { background: rgba(59,130,246,0.08);  color: #1e40af; }
.alert-warning { background: rgba(245,158,11,0.08); color: #92400e; }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Footer ─────────────────────────────────────────────────── */
.app-footer {
  padding: 6px 28px;
  border-top: 1px solid var(--border);
  font-size: 0.625rem;
  color: var(--text-muted);
  background: var(--surface);
}

/* ── HTMX ───────────────────────────────────────────────────── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request .btn-icon { display: none; }
.htmx-request .review-idle-label { display: none; }
.review-loading-label { display: none; }

.validation-results-host {
  position: relative;
  z-index: 20;
}

#sync-status {
  padding: 8px 16px 0;
  min-height: 8px;
}

.sync-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.sync-status-chip-success {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.18);
}

.sync-status-chip-error {
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.18);
}

.validation-shell {
  position: relative;
}

.validation-toast {
  position: fixed;
  top: 84px;
  right: 22px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(16, 185, 129, 0.22);
  background: rgba(240, 253, 244, 0.97);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.validation-toast.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
}

.validation-toast-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.validation-toast-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #065f46;
  margin-bottom: 2px;
}

.validation-toast-message {
  font-size: 0.78rem;
  line-height: 1.45;
  color: #047857;
}

.validation-summary {
  margin: 10px 16px 0;
  padding: 10px 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.validation-summary-warning {
  background: rgba(245, 158, 11, 0.09);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.validation-summary-danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.18);
}

.validation-summary-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.validation-summary-message {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.validation-summary-action {
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: var(--text-primary);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.validation-summary-action:hover {
  background: var(--bg);
}

.validation-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  z-index: 1080;
}

.validation-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: #fff;
  box-shadow: -16px 0 38px rgba(15, 23, 42, 0.18);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 1090;
  display: flex;
  flex-direction: column;
}

.validation-shell.is-open .validation-drawer {
  transform: translateX(0);
}

.validation-drawer-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.validation-drawer-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.validation-drawer-subtitle {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.validation-drawer-close {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.validation-drawer-body {
  padding: 14px 18px 20px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
}

.validation-drawer-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-primary);
}

.validation-drawer-item i {
  flex-shrink: 0;
  margin-top: 2px;
  color: #d97706;
}

.validation-drawer-item-danger i {
  color: #dc2626;
}

.etl-modal-open {
  overflow: hidden;
}

.etl-modal-shell {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1200;
}

.etl-modal-shell.is-open {
  display: flex;
}

.etl-modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.etl-modal-panel {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  z-index: 1;
}

.etl-modal-panel .card {
  margin: 0 !important;
  box-shadow: var(--shadow-lg) !important;
}

.etl-modal-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1190;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
}

.etl-modal-launcher.is-visible {
  display: inline-flex;
}

.etl-modal-launcher:hover {
  background: var(--accent-dark);
}

.etl-modal-panel .card {
  margin: 0 !important;
  box-shadow: var(--shadow-lg) !important;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Utilities ──────────────────────────────────────────────── */
.text-accent   { color: var(--accent) !important; }
.bg-accent     { background: var(--accent) !important; }
.fw-semibold   { font-weight: 600 !important; }
.tracking-wide { letter-spacing: 0.05em; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── User dashboard — layout sin scroll ─────────────────────── */
main:has(.user-dashboard-page) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.75rem 1.25rem !important;
}

.user-dashboard-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-ops-page {
  gap: 18px;
  overflow-y: auto;
  padding-right: 4px;
}

.ops-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.ops-kicker-sep {
  opacity: 0.45;
}

.ops-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.95fr);
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.ops-topbar-copy {
  min-width: 0;
}

.ops-topbar-title {
  margin: 0;
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.ops-topbar-subtitle {
  margin: 6px 0 0;
  max-width: 64ch;
  font-size: 0.79rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.ops-topbar-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ops-meta-tile {
  min-height: 74px;
  padding: 11px 12px;
  border-radius: 12px;
  background: #fbfcfd;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.ops-meta-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ops-meta-value,
.ops-meta-strong {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.ops-meta-version-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ops-meta-mini {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent-dark);
  font-size: 0.68rem;
  font-weight: 700;
}

.ops-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ops-summary-card {
  padding: 14px 15px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.ops-summary-card-accent {
  border-top: 3px solid var(--accent);
}

.ops-summary-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ops-summary-value {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 16px;
}

.ops-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.ops-panel-feature {
  grid-row: span 2;
  display: grid;
  gap: 16px;
}

.ops-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.ops-panel-head-compact {
  margin-bottom: 10px;
}

.ops-panel-kicker {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ops-panel-title {
  margin: 4px 0 0;
  font-size: 0.98rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.ops-big-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
}

.ops-ledger {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ops-ledger-item {
  padding: 12px 13px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.ops-ledger-item-accent {
  background: rgba(59, 130, 246, 0.08);
}

.ops-ledger-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ops-ledger-value {
  display: block;
  margin-top: 4px;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.ops-chart-wrap {
  position: relative;
  min-height: 260px;
}

.ops-stat-column {
  display: grid;
  gap: 10px;
}

.ops-stat-card {
  padding: 13px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.ops-stat-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ops-stat-value {
  margin-top: 6px;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.ops-table-wrap {
  margin-top: 12px;
  overflow: auto;
}

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

.ops-table thead th {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.ops-table tbody td {
  padding: 10px 0;
  border-bottom: 1px solid rgba(226, 232, 240, 0.92);
  font-size: 0.79rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.ops-table th:not(:first-child),
.ops-table td:not(:first-child) {
  padding-left: 12px;
}

.ops-empty {
  padding: 24px 22px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.ops-empty-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  background: var(--accent-light);
  color: var(--accent-dark);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ops-empty h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.ops-empty p {
  max-width: 60ch;
  margin: 0;
  color: #5f6b66;
}

.ops-sheet-card {
  margin-top: 4px;
}

.user-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.06);
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.user-dashboard-page .compact-cards .stat-card {
  padding: 8px 12px;
  min-height: 68px;
}

.user-dashboard-page .compact-cards .stat-card-icon {
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  font-size: 0.625rem;
}

.user-dashboard-page .compact-cards .stat-card-label {
  font-size: 0.5625rem;
  margin-bottom: 3px;
}

.user-dashboard-page .compact-cards .stat-card-value {
  font-size: 0.9375rem;
  margin-bottom: 2px;
}

.user-dashboard-page .compact-cards .stat-card-sub {
  font-size: 0.5625rem;
}

.user-dashboard-page .compact-cards .progress {
  height: 3px;
}

.user-dashboard-page .compact-cards .tips-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.user-dashboard-page .compact-cards .tip-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.6rem;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 1px 6px;
  line-height: 1.2;
}

/* Sheet card crece para llenar el espacio restante */
.user-dashboard-page .user-sheet-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-dashboard-page .user-sheet-card .card-header {
  padding: 10px 16px !important;
  flex-shrink: 0;
  min-height: 52px;
}

.user-dashboard-page .user-sheet-iframe {
  flex: 1;
  min-height: 0;
  height: auto !important;
}

.sheet-sync-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(2px);
}

.sheet-sync-overlay.is-danger .sheet-sync-overlay-card {
  background: rgba(127, 29, 29, 0.92);
}

.sheet-sync-overlay-card {
  width: min(380px, calc(100% - 32px));
  padding: 22px 20px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
}

.sheet-sync-overlay-title {
  font-size: 0.98rem;
  font-weight: 700;
}

.sheet-sync-overlay-subtitle {
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.82);
}

/* Botón disparador de Apps Script */
.btn-sync {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-sync:hover:not(:disabled) { background: var(--accent-dark); }
.btn-sync:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 768px) {
  main:has(.user-dashboard-page) {
    padding: 0.5rem 0.75rem !important;
    overflow-y: auto;
  }

  .ops-topbar,
  .ops-topbar-meta,
  .ops-summary-strip,
  .ops-grid {
    grid-template-columns: 1fr;
  }

  .ops-ledger {
    grid-template-columns: 1fr;
  }

  .user-dashboard-page .compact-cards .stat-card {
    min-height: auto;
  }

  .user-dashboard-page .user-sheet-iframe {
    flex: none;
    height: 60vh !important;
  }

  .etl-modal-shell {
    padding: 12px;
    align-items: flex-end;
  }

  .etl-modal-panel {
    width: 100%;
    max-height: calc(100vh - 24px);
  }

  .etl-modal-launcher {
    right: 14px;
    bottom: 14px;
    width: calc(100vw - 28px);
    justify-content: center;
  }
}
