:root{
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --shadow-soft: 0 6px 18px rgba(15, 23, 42, .05);
  --radius: 20px;
  --radius-sm: 14px;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: rgba(37,99,235,.10);
  --ok: #16a34a;
  --ok-soft: rgba(22,163,74,.10);
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success-bg: #ecfdf5;
  --success-border: #bbf7d0;
  --success-text: #166534;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-text: #991b1b;
}

*{
  box-sizing:border-box;
}

html,
body{
  margin:0;
  padding:0;
}

body{
  font-family: Inter, Arial, sans-serif;
  color:var(--text);
  min-height:100vh;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.10), transparent 30%),
    radial-gradient(circle at top right, rgba(14,165,233,.08), transparent 25%),
    var(--bg);
}

a{
  color:inherit;
  text-decoration:none;
}

button,
input,
select,
textarea{
  font:inherit;
}

.wrap{
  max-width:1280px;
  margin:0 auto;
  padding:28px 18px 40px;
}

/* =========================
   HEADER / TOPBAR
========================= */

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:24px;
  flex-wrap:wrap;
}

.title h1{
  margin:0 0 8px;
  font-size:clamp(28px, 4vw, 42px);
  line-height:1.05;
  letter-spacing:-.02em;
}

.title p{
  margin:0;
  color:var(--muted);
  font-size:16px;
  line-height:1.5;
}

.actions{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background:var(--ok-soft);
  color:var(--ok);
  padding:10px 14px;
  border-radius:999px;
  font-size:14px;
  font-weight:600;
  border:1px solid rgba(22,163,74,.15);
}

.dot{
  width:9px;
  height:9px;
  border-radius:50%;
  background:var(--ok);
  box-shadow:0 0 0 6px rgba(22,163,74,.10);
}

/* =========================
   BUTTONS
========================= */

.btn{
  border:0;
  background:linear-gradient(135deg, var(--accent), var(--accent-2));
  color:#fff;
  padding:12px 16px;
  border-radius:14px;
  font-size:14px;
  font-weight:700;
  cursor:pointer;
  box-shadow:0 12px 24px rgba(37,99,235,.20);
  transition:.2s ease;
}

.btn:hover{
  filter:brightness(1.03);
  transform:translateY(-1px);
}

.btn:active{
  transform:translateY(1px);
}

.btn-secondary,
.link-btn,
.ghost-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  font-size:14px;
  font-weight:700;
  box-shadow:var(--shadow-soft);
  transition:.2s ease;
}

.btn-secondary:hover,
.link-btn:hover,
.ghost-btn:hover{
  border-color:#bfd0ea;
  background:#f8fbff;
}

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

.section-toggle.is-active{
  background:linear-gradient(135deg, var(--accent), var(--accent-2));
  color:#fff;
  border-color:transparent;
  box-shadow:0 12px 24px rgba(37,99,235,.18);
}

.section-toggle.is-active:hover{
  filter:brightness(1.03);
}

/* =========================
   TOOLBARS / SECTIONS
========================= */

.toolbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  flex-wrap:wrap;
  margin-bottom:18px;
}

.section-title{
  margin:28px 0 14px;
  font-size:24px;
  font-weight:800;
  letter-spacing:-.02em;
}

/* =========================
   GRID / CARDS
========================= */

.grid{
  display:grid;
  grid-template-columns:repeat(5, 1fr);
  gap:16px;
}

.grid-ads{
  grid-template-columns:repeat(5, 1fr);
}

.card{
  background:var(--panel);
  border:1px solid rgba(226,232,240,.9);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
  min-height:150px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

.label{
  color:var(--muted);
  font-size:14px;
  font-weight:600;
  margin-bottom:14px;
}

.value{
  font-size:clamp(18px, 3vw, 28px);
  font-weight:700;
  line-height:1;
  letter-spacing:-.03em;
  word-break:break-word;
}

.hint{
  margin-top:14px;
  font-size:13px;
  color:var(--muted);
  line-height:1.35;
}

.positive{
  color:var(--ok);
}

.negative{
  color:var(--danger);
}

/* =========================
   PANELS / STATUS
========================= */

.panel{
  margin-top:18px;
  background:var(--panel);
  border:1px solid rgba(226,232,240,.9);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
}

.panel h2{
  margin:0 0 8px;
  font-size:20px;
}

.panel p{
  margin:0;
  color:var(--muted);
  line-height:1.5;
}

.panel-spacer{
  margin-top:8px !important;
}

.status{
  margin-top:16px;
  font-size:14px;
  color:var(--muted);
}

.error{
  margin-top:16px;
  padding:14px 16px;
  border-radius:14px;
  background:var(--error-bg);
  border:1px solid var(--error-border);
  color:var(--error-text);
  display:none;
}

.success{
  margin-top:16px;
  padding:14px 16px;
  border-radius:14px;
  background:var(--success-bg);
  border:1px solid var(--success-border);
  color:var(--success-text);
  display:none;
}

/* =========================
   SKELETON
========================= */

.skeleton{
  position:relative;
  overflow:hidden;
  background:#e2e8f0;
  border-radius:12px;
  height:40px;
  width:80%;
}

.skeleton::after{
  content:"";
  position:absolute;
  inset:0;
  transform:translateX(-100%);
  background:linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
  animation:shimmer 1.2s infinite;
}

@keyframes shimmer{
  100%{
    transform:translateX(100%);
  }
}

/* =========================
   AUTH / LOGIN
========================= */

.auth-page{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.auth-shell{
  width:min(100%, 460px);
  background:rgba(255,255,255,.92);
  border:1px solid rgba(226,232,240,.9);
  border-radius:28px;
  box-shadow:0 18px 40px rgba(15,23,42,.12);
  padding:30px 24px 24px;
  backdrop-filter:blur(10px);
}

.auth-brand{
  margin-bottom:24px;
}

.auth-brand h1{
  margin:0 0 8px;
  font-size:34px;
  line-height:1.05;
  letter-spacing:-.03em;
}

.auth-brand p{
  margin:0;
  color:var(--muted);
  line-height:1.5;
}

.auth-form{
  display:grid;
  gap:14px;
}

.form-group{
  display:grid;
  gap:8px;
}

.form-group label{
  font-size:14px;
  font-weight:700;
  color:var(--text);
}

.form-group input{
  width:100%;
  min-height:52px;
  border:1px solid #dbe4f0;
  border-radius:16px;
  padding:0 14px;
  background:linear-gradient(180deg,#ffffff,#f8fbff);
  color:var(--text);
  box-shadow:var(--shadow-soft);
  transition:.2s ease;
}

.form-group input:hover{
  border-color:#bfd0ea;
}

.form-group input:focus{
  outline:none;
  border-color:#2563eb;
  box-shadow:0 0 0 4px rgba(37,99,235,.12);
}

.auth-submit{
  margin-top:8px;
  min-height:52px;
}

.auth-message{
  margin-top:14px;
  padding:12px 14px;
  border-radius:14px;
  font-size:14px;
}

.auth-message.error{
  display:block;
}

/* =========================
   TABLES / HISTORIAL
========================= */

.table-shell{
  margin-top:18px;
  background:var(--panel);
  border:1px solid rgba(226,232,240,.9);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
}

.table-scroll{
  width:100%;
  overflow-x:auto;
}

.table{
  width:100%;
  border-collapse:collapse;
  min-width:920px;
}

.table thead th{
  background:#f8fbff;
  color:#334155;
  text-align:left;
  font-size:13px;
  font-weight:800;
  letter-spacing:.01em;
  padding:16px 18px;
  border-bottom:1px solid var(--line);
  white-space:nowrap;
}

.table tbody td{
  padding:16px 18px;
  border-bottom:1px solid #eef2f7;
  color:#0f172a;
  font-size:14px;
  vertical-align:top;
}

.table tbody tr:hover{
  background:#fbfdff;
}

.table tbody tr:last-child td{
  border-bottom:0;
}

.empty-state{
  padding:28px 20px;
  text-align:center;
  color:var(--muted);
  font-size:15px;
}

.muted{
  color:var(--muted);
}

.kpi-mini{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  background:#f8fbff;
  border:1px solid var(--line);
  border-radius:999px;
  color:#334155;
  font-size:13px;
  font-weight:700;
}

/* =========================
   PANEL TOGGLES
========================= */

.panel-section{
  display:none;
}

.panel-section.is-visible{
  display:block;
  animation:panelFade .2s ease;
}

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

/* =========================
   ANALISIS DEL MES
========================= */

.analysis-month-panel{
  margin-top:22px;
}

.analysis-toolbar-month{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
  flex-wrap:wrap;
  margin-bottom:20px;
}

.analysis-toolbar-month-pdf{
  align-items:flex-end;
}

.analysis-heading{
  max-width:560px;
}

.analysis-heading h2{
  margin:0 0 8px;
  font-size:28px;
  letter-spacing:-.02em;
}

.analysis-heading p{
  margin:0;
  color:var(--muted);
  line-height:1.5;
  font-size:15px;
}

.month-selectors-pro{
  display:flex;
  gap:12px;
  align-items:flex-end;
  flex-wrap:wrap;
  background:linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.84));
  border:1px solid rgba(226,232,240,.95);
  border-radius:20px;
  padding:14px;
  box-shadow:var(--shadow-soft);
}

.select-group{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.select-group span{
  font-size:12px;
  font-weight:800;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.04em;
}

.month-selectors-pro select{
  min-width:140px;
  min-height:44px;
  border:1px solid rgba(226,232,240,.95);
  border-radius:12px;
  padding:0 36px 0 14px;
  background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  color:var(--text);
  font-size:14px;
  font-weight:600;
  font-family:inherit;
  box-shadow:none;
  transition:border-color .15s, box-shadow .15s;
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  cursor:pointer;
}

.month-selectors-pro select:hover{
  border-color:#93c5fd;
}

.month-selectors-pro select:focus{
  outline:none;
  border-color:#3b82f6;
  box-shadow:0 0 0 3px rgba(59,130,246,.12);
}

.analysis-month-summary{
  display:flex;
  align-items:center;
  min-height:52px;
  padding:14px 16px;
  margin-bottom:18px;
  border-radius:18px;
  background:linear-gradient(180deg,#ffffff,#f8fbff);
  border:1px solid rgba(226,232,240,.95);
  box-shadow:var(--shadow-soft);
  font-size:15px;
  font-weight:700;
  color:var(--text);
}

.month-pdf-meta{
  margin:-4px 0 18px;
  color:var(--muted);
  font-size:14px;
  font-weight:600;
}

.analysis-grid-pro{
  display:grid;
  grid-template-columns:repeat(12, minmax(0, 1fr));
  gap:18px;
  align-items:start;
}

.analysis-grid-pro .analysis-card{
  min-width:0;
}

.analysis-grid-pro .ranking-card-full,
.analysis-grid-pro .weekday-summary-card,
.analysis-grid-pro .heatmap-card,
.analysis-grid-pro .daily-breakdown-card{
  grid-column:1 / -1 !important;
}

.analysis-card{
  background:var(--panel);
  border:1px solid rgba(226,232,240,.9);
  border-radius:24px;
  box-shadow:var(--shadow);
  padding:20px;
}

.analysis-card-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.analysis-card-head h3{
  margin:0;
  font-size:20px;
  letter-spacing:-.02em;
}

.analysis-chip{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  background:#eef4ff;
  color:#1d4ed8;
  font-size:12px;
  font-weight:800;
  letter-spacing:.03em;
  text-transform:uppercase;
}

.neutral-chip{
  background:#f1f5f9;
  color:#475569;
}

.table-wrap-pro,
.heatmap-wrap{
  width:100%;
  overflow:auto;
}

.data-table-pro{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:760px;
}

.data-table-pro thead th{
  background:#f8fbff;
  color:#334155;
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
  padding:14px 16px;
  border-bottom:1px solid var(--line);
  border-right:1px solid #e9eef5;
}

.data-table-pro thead th:last-child{
  border-right:0;
}

.data-table-pro tbody td{
  padding:14px 16px;
  font-size:14px;
  color:var(--text);
  border-bottom:1px solid #eef2f7;
  border-right:1px solid #f1f5f9;
}

.data-table-pro tbody td:last-child{
  border-right:0;
}

.data-table-pro tbody tr:last-child td{
  border-bottom:0;
}

.data-table-pro tbody tr:nth-child(even){
  background:#fcfdff;
}

.data-table-pro tbody tr:hover{
  background:#f8fbff;
}

.heatmap-wrap{
  display:grid;
  gap:10px;
}

.heatmap-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:920px;
}

.heatmap-table th,
.heatmap-table td{
  padding:10px 12px;
  text-align:center;
  border-right:1px solid #eef2f7;
  border-bottom:1px solid #eef2f7;
  font-size:13px;
}

.heatmap-table th{
  background:#f8fbff;
  color:#334155;
  font-weight:800;
  position:sticky;
  top:0;
}

.heatmap-table td:first-child,
.heatmap-table th:first-child{
  text-align:left;
  font-weight:800;
  color:#475569;
  background:#fbfdff;
}

.heatmap-table tr td:last-child,
.heatmap-table tr th:last-child{
  border-right:0;
}

.heat-0{ background:#ffffff; }
.heat-1{ background:#eef4ff; }
.heat-2{ background:#dbeafe; }
.heat-3{ background:#bfdbfe; }
.heat-4{ background:#93c5fd; }
.heat-5{ background:#60a5fa; color:#0f172a; }
.heat-6{ background:#3b82f6; color:#fff; }
.heat-7{ background:#2563eb; color:#fff; }

/* =========================
   COLLAPSIBLES
========================= */

.collapsible-card{
  overflow:hidden;
}

.analysis-collapse-toggle{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border:0;
  background:transparent;
  padding:0;
  margin:0 0 14px;
  cursor:pointer;
  text-align:left;
  color:var(--text);
  font:inherit;
  font-weight:800;
  font-size:18px;
}

.analysis-collapse-toggle:hover .collapse-icon{
  border-color:#cbd5e1;
  background:#f8fafc;
  transform:translateY(-1px);
}

.collapse-icon{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  border-radius:999px;
  background:linear-gradient(180deg, #ffffff, #f8fbff);
  border:1px solid #e2e8f0;
  box-shadow:0 8px 20px rgba(15,23,42,.06);
  transition:transform .22s ease, background .22s ease, border-color .22s ease;
}

.collapse-icon-svg{
  width:18px;
  height:18px;
  stroke:#475569;
  stroke-width:2.2;
  fill:none;
  stroke-linecap:round;
  stroke-linejoin:round;
  transition:transform .22s ease;
}

.collapsible-card:not(.is-expanded) .collapse-icon-svg{
  transform:rotate(-90deg);
}

.analysis-collapse-body{
  display:block;
}

.collapsible-card:not(.is-expanded) .analysis-collapse-body{
  display:none;
}

/* =========================
   COMPARACION
========================= */

.comparison-panel{
  margin-top:22px;
}

.comparison-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
  flex-wrap:wrap;
  margin-bottom:18px;
}

.month-compare-wrap-pro{
  display:flex;
  gap:12px;
  align-items:flex-end;
  flex-wrap:wrap;
  background:linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.84));
  border:1px solid rgba(226,232,240,.95);
  border-radius:20px;
  padding:14px;
  box-shadow:var(--shadow-soft);
}

.month-compare-group-pro{
  display:flex;
  gap:12px;
  align-items:flex-end;
  flex-wrap:wrap;
  background:transparent;
  border:0;
  padding:0;
}

.month-compare-group-pro .select-group{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.month-compare-group-pro .select-group span{
  font-size:12px;
  font-weight:800;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.04em;
}

.month-compare-group-pro select{
  min-width:140px;
  min-height:44px;
  border:1px solid rgba(226,232,240,.95);
  border-radius:12px;
  padding:0 36px 0 14px;
  background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  color:var(--text);
  font-size:14px;
  font-weight:600;
  font-family:inherit;
  box-shadow:none;
  transition:border-color .15s, box-shadow .15s;
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  cursor:pointer;
}

.month-compare-group-pro select:hover{
  border-color:#93c5fd;
}

.month-compare-group-pro select:focus{
  outline:none;
  border-color:#3b82f6;
  box-shadow:0 0 0 3px rgba(59,130,246,.12);
}

.comparison-summary{
  display:flex;
  align-items:center;
  min-height:52px;
  padding:14px 16px;
  margin-bottom:18px;
  border-radius:18px;
  background:linear-gradient(180deg,#ffffff,#f8fbff);
  border:1px solid rgba(226,232,240,.95);
  box-shadow:var(--shadow-soft);
  font-size:15px;
  font-weight:700;
  color:var(--text);
}

.compare-grid-pro{
  display:grid;
  grid-template-columns:repeat(5, 1fr);
  gap:18px;
}

.compare-metric-card{
  min-height:190px;
}

.compare-card-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:8px;
}

.compare-month-values{
  display:grid;
  gap:8px;
  margin-top:14px;
}

.compare-month-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border:1px solid #eef2f7;
  border-radius:14px;
  background:#fbfdff;
}

.compare-month-label{
  font-size:13px;
  font-weight:800;
  color:var(--muted);
}

.compare-month-value{
  font-size:14px;
  font-weight:800;
  color:var(--text);
  text-align:right;
}

.compare-diff{
  margin-top:14px;
  font-size:15px;
  font-weight:800;
}

.compare-secondary{
  margin-top:12px;
  font-size:14px;
  color:var(--muted);
  font-weight:600;
  line-height:1.45;
}

/* =========================
   PDF EXPORT
========================= */

.pdf-export-btn{
  white-space:nowrap;
}

.month-pdf-export{
  display:none;
}

.month-pdf-sheet{
  background:#fff;
  color:#0f172a;
  padding:32px;
  font-family: Inter, Arial, sans-serif;
}

.month-pdf-header{
  margin-bottom:24px;
  border-bottom:1px solid #dbe4f0;
  padding-bottom:16px;
}

.month-pdf-header h1{
  margin:0 0 8px;
  font-size:28px;
  line-height:1.1;
}

.month-pdf-header p{
  margin:0;
  color:#64748b;
  font-size:14px;
  font-weight:600;
}

.month-pdf-block{
  margin-bottom:28px;
  break-inside:avoid;
  page-break-inside:avoid;
}

.month-pdf-block h2{
  margin:0 0 12px;
  font-size:18px;
}

.month-pdf-sheet table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}

.month-pdf-sheet th,
.month-pdf-sheet td{
  border:1px solid #dbe4f0;
  padding:8px 10px;
  text-align:left;
  vertical-align:top;
}

.month-pdf-sheet th{
  background:#f8fafc;
  font-weight:800;
}

.month-pdf-sheet .heatmap-table td{
  text-align:center;
  font-size:11px;
  padding:6px;
}

.month-pdf-summary-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
}

.month-pdf-summary-card{
  border:1px solid #dbe4f0;
  border-radius:14px;
  padding:14px 16px;
  background:#fff;
}

.month-pdf-summary-card .label{
  display:block;
  margin-bottom:8px;
  color:#64748b;
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.month-pdf-summary-card .value{
  font-size:20px;
  font-weight:800;
  color:#0f172a;
}

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

@media (max-width: 1100px){
  .grid{
    grid-template-columns:repeat(3, 1fr);
  }

  .grid-ads{
    grid-template-columns:repeat(3, 1fr);
  }

  .compare-grid-pro{
    grid-template-columns:repeat(3, 1fr);
  }
}

@media (max-width: 760px){
  .grid{
    grid-template-columns:repeat(2, 1fr);
  }

  .grid-ads{
    grid-template-columns:repeat(2, 1fr);
  }

  .topbar{
    align-items:stretch;
  }

  .actions{
    width:100%;
  }

  .analysis-toolbar-month,
  .comparison-toolbar{
    align-items:stretch;
  }

  .month-selectors-pro,
  .month-compare-wrap-pro{
    width:100%;
  }

  .month-selectors-pro .select-group,
  .month-selectors-pro select,
  .month-compare-group-pro,
  .month-compare-group-pro .select-group,
  .month-compare-group-pro select{
    width:100%;
  }

  .compare-grid-pro{
    grid-template-columns:repeat(2, 1fr);
  }
}

@media (max-width: 520px){
  .grid{
    grid-template-columns:1fr;
  }

  .grid-ads{
    grid-template-columns:1fr;
  }

  .compare-grid-pro{
    grid-template-columns:1fr;
  }

  .card{
    min-height:130px;
  }

  .wrap{
    padding:22px 14px 36px;
  }

  .title h1{
    font-size:32px;
  }

  .auth-shell{
    padding:24px 18px 20px;
    border-radius:24px;
  }
}

/* =========================
   PRINT
========================= */

/* =========================
   PDF: ORIENTACIÓN DE PÁGINA
   A4 landscape con márgenes reducidos
   para maximizar el ancho útil del heatmap.
========================= */

@page {
  size: A4 landscape;
  margin:10mm 12mm;
}

@media print {
  body.print-month-only *{
    visibility:hidden !important;
  }

  body.print-month-only #monthPdfExport,
  body.print-month-only #monthPdfExport *{
    visibility:visible !important;
  }

  body.print-month-only #monthPdfExport{
    display:block !important;
    position:absolute !important;
    inset:0 auto auto 0 !important;
    width:100% !important;
    background:#fff !important;
  }

  /* ── Bloques: permitir corte de página ── */
  body.print-month-only .month-pdf-block{
    break-inside:auto !important;
    page-break-inside:auto !important;
    overflow:visible !important;
  }

  /* ── Heatmap wrapper: sin overflow, sin ancho fijo ── */
  body.print-month-only #pdfHeatmapWrap,
  body.print-month-only .month-pdf-sheet,
  body.print-month-only .month-pdf-export{
    overflow:visible !important;
    width:100% !important;
    max-width:none !important;
  }

  /* ── Tablas del heatmap (splitteadas en JS en dos mitades) ── */
  body.print-month-only .heatmap-table-pdf{
    min-width:0 !important;
    width:100% !important;
    table-layout:fixed !important;
    border-collapse:collapse !important;
  }

  body.print-month-only .heatmap-table-pdf th,
  body.print-month-only .heatmap-table-pdf td{
    font-size:9px !important;
    padding:5px 3px !important;
    text-align:center !important;
    border:1px solid #dbe4f0 !important;
    overflow:hidden !important;
    white-space:nowrap !important;
  }

  body.print-month-only .heatmap-table-pdf th:first-child,
  body.print-month-only .heatmap-table-pdf td:first-child{
    text-align:left !important;
    font-weight:700 !important;
    padding-left:6px !important;
    width:72px !important;
  }

  body.print-month-only .heatmap-table-pdf thead th{
    background:#f8fafc !important;
    font-weight:800 !important;
  }

  /* ── Colores de calor en print ── */
  body.print-month-only .heat-0{ background:#f8fafc !important; color:#94a3b8 !important; }
  body.print-month-only .heat-1{ background:#dbeafe !important; color:#1e40af !important; }
  body.print-month-only .heat-2{ background:#bfdbfe !important; color:#1d4ed8 !important; }
  body.print-month-only .heat-3{ background:#93c5fd !important; color:#1e3a8a !important; }
  body.print-month-only .heat-4{ background:#3b82f6 !important; color:#fff !important; }
  body.print-month-only .heat-5{ background:#1d4ed8 !important; color:#fff !important; }
}

@media print {
  body.print-ads-only *{
    visibility:hidden !important;
  }

  body.print-ads-only #adsPdfExport,
  body.print-ads-only #adsPdfExport *{
    visibility:visible !important;
  }

  body.print-ads-only #adsPdfExport{
    display:block !important;
    position:absolute !important;
    inset:0 auto auto 0 !important;
    width:100% !important;
    background:#fff !important;
  }
}

.spend-history-card{
  margin-top:20px;
}

.spend-history-card .table-wrap-pro{
  margin-top:4px;
}
/* =========================
   EXPORTAR DATOS
========================= */

.export-panel{
  padding-bottom:32px;
}

.export-grid{
  display:grid;
  grid-template-columns:repeat(2, 1fr);
  gap:20px;
  margin-top:20px;
}

.export-card{
  background:var(--panel);
  border:1px solid rgba(226,232,240,.9);
  border-radius:24px;
  box-shadow:var(--shadow);
  padding:24px;
  display:flex;
  gap:18px;
  align-items:flex-start;
  transition:box-shadow .18s;
}

.export-card:hover{
  box-shadow:0 4px 24px rgba(30,64,175,.09);
}

.export-card-icon{
  flex-shrink:0;
  width:52px;
  height:52px;
  border-radius:16px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.export-card-icon--leads{
  background:linear-gradient(135deg,#eff6ff,#dbeafe);
  color:#2563eb;
}

.export-card-icon--convertidos{
  background:linear-gradient(135deg,#f0fdf4,#dcfce7);
  color:#16a34a;
}

.export-card-body{
  flex:1;
  min-width:0;
}

.export-card-body h3{
  margin:0 0 6px;
  font-size:17px;
  font-weight:800;
  letter-spacing:-.01em;
}

.export-card-body p{
  margin:0 0 16px;
  font-size:14px;
  color:var(--muted);
  line-height:1.45;
}

.export-date-row{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:16px;
}

.export-field{
  display:flex;
  flex-direction:column;
  gap:4px;
  flex:1;
  min-width:140px;
  /* Necesario para que el popover del calendario
     se posicione relativo a este campo */
  position:relative;
}

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

/* El date-picker custom dentro de export-field hereda el ancho completo */
.export-field .date-picker{
  width:100%;
}

.export-field .date-input-wrap{
  width:100%;
}

.export-field .date-text-input{
  width:100%;
  box-sizing:border-box;
}

/* El popover se abre hacia abajo sin salirse de la card */
.export-field .calendar-popover{
  position:absolute;
  top:calc(100% + 4px);
  left:0;
  z-index:200;
  min-width:280px;
}

/* Clase legada — ya no se usa pero se deja para compatibilidad */
.export-date-input{
  display:none;
}

.export-actions{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.export-btn{
  display:inline-flex;
  align-items:center;
  gap:7px;
  background:linear-gradient(135deg,#1e40af,#2563eb);
  color:#fff;
  border:none;
  border-radius:12px;
  padding:9px 18px;
  font-size:14px;
  font-weight:700;
  cursor:pointer;
  transition:opacity .15s, box-shadow .15s;
  white-space:nowrap;
}

.export-btn:hover{
  opacity:.88;
  box-shadow:0 4px 16px rgba(37,99,235,.3);
}

.export-btn:active{
  opacity:.75;
}

.export-btn:disabled{
  opacity:.5;
  cursor:not-allowed;
}

.export-feedback{
  font-size:13px;
  font-weight:600;
  color:var(--muted);
  transition:color .2s;
}

.export-feedback.success{
  color:#16a34a;
}

.export-feedback.error{
  color:#dc2626;
}

.export-hint{
  margin-top:20px;
  font-size:13px;
  color:var(--muted);
  line-height:1.5;
  padding:12px 16px;
  background:rgba(248,250,252,.8);
  border:1px solid rgba(226,232,240,.7);
  border-radius:12px;
}

@media (max-width:760px){
  .export-grid{
    grid-template-columns:1fr;
  }

  .export-card{
    flex-direction:column;
  }

  .export-card-icon{
    width:44px;
    height:44px;
  }
}

/* =========================
   PICKER MES / AÑO
   (Análisis del mes)
========================= */

.month-picker-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:8px;
  margin-top:4px;
}

.month-picker-btn{
  border:1px solid #e2e8f0;
  background:#fff;
  border-radius:12px;
  padding:10px 4px;
  font-size:13px;
  font-weight:700;
  color:#334155;
  cursor:pointer;
  transition:.18s ease;
  font-family:inherit;
}

.month-picker-btn:hover{
  background:#eef4ff;
  border-color:#93c5fd;
  color:#1d4ed8;
}

.month-picker-btn.is-selected{
  background:linear-gradient(135deg, var(--accent), var(--accent-2));
  color:#fff;
  border-color:transparent;
  box-shadow:0 6px 14px rgba(37,99,235,.25);
}

/* =========================
   PICKERS DE COMPARACIÓN
========================= */

.compare-picker-col{
  display:flex;
  flex-direction:column;
  gap:6px;
  position:relative;
}

.compare-picker-label{
  font-size:12px;
  font-weight:800;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.04em;
}

.compare-picker-col .date-picker{
  min-width:0;
  width:100%;
}

.compare-picker-col .calendar-popover{
  position:absolute;
  top:calc(100% + 4px);
  left:0;
  z-index:200;
  min-width:280px;
}

@media(max-width:760px){
  .compare-picker-col{
    width:100%;
  }
}
