/* ═══════════════════════════════════════════════════════════
   TOMAS VIEW — CSS
   ─────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/*
   Palette: white bg, gray cards, black text, #2929CE accent
   ═══════════════════════════════════════════════════════════
*/

/* ── Section headers ─────────────────────────────────────── */
.tm-sec-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 12px;
}
.tm-sec-hdr h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #000);
  margin: 0;
  letter-spacing: .02em;
}
.tm-sec-bar {
  width: 3px;
  height: 18px;
  background: #2929CE;
  border-radius: 2px;
  flex-shrink: 0;
}
.tm-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted, #555);
  font-family: 'JetBrains Mono', monospace;
}

/* ── KPI cards ───────────────────────────────────────────── */
.tm-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.tm-kpi-card {
  background: var(--bg2, #fff);
  border: 1px solid var(--border, #e2e2e2);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tm-kpi-card.load {
  align-items: center;
  justify-content: center;
  min-height: 72px;
  grid-column: 1/-1;
}
.tm-kpi-sec-hdr {
  grid-column: 1/-1;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #888);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 4px 0 2px;
  border-bottom: 1px solid var(--border, #e2e2e2);
  margin-bottom: 2px;
}
.tm-loading {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.15s;
}
.tm-nodata {
  padding: 28px 16px;
  color: var(--muted, #888);
  font-size: 12px;
  text-align: center;
}
.tm-kpi-label {
  font-size: 10px;
  color: var(--muted, #888);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.tm-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text, #000);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.1;
}
.tm-kpi-value.accent { color: #2929CE; }
.tm-kpi-sub {
  font-size: 10px;
  color: var(--muted, #888);
  margin-top: 2px;
}

/* ── 2-col grid ──────────────────────────────────────────── */
.tm-cg2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 760px) { .tm-cg2 { grid-template-columns: 1fr; } }

/* ── Toggle buttons ──────────────────────────────────────── */
.tm-toggle {
  margin-left: auto;
  display: flex;
  background: var(--bg3, #f0f0f0);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.tm-tbtn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--muted, #888);
  transition: background .15s, color .15s;
  user-select: none;
}
.tm-tbtn.active {
  background: #2929CE;
  color: #fff;
  font-weight: 600;
}

/* ── Filter bar ──────────────────────────────────────────── */
.tm-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.tm-filter-icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid #2929CE;
  background: transparent;
  color: #2929CE;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.tm-filter-icon-btn:hover { background: rgba(41,41,206,.08); }
.tm-active-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tm-active-pill {
  background: rgba(41,41,206,.1);
  border: 1px solid rgba(41,41,206,.3);
  color: #2929CE;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: default;
}
.tm-active-pill .rm { cursor: pointer; opacity: .7; }
.tm-active-pill .rm:hover { opacity: 1; }
.tm-clear-btn {
  font-size: 11px;
  color: var(--muted, #888);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.tm-clear-btn:hover { color: #c00; }

/* ── Preset pills rows ───────────────────────────────────── */
.tm-preset-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.tm-preset-pill {
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--bg3, #f0f0f0);
  border: 1px solid var(--border, #e0e0e0);
  color: var(--text, #333);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  user-select: none;
}
.tm-preset-pill:hover {
  background: #2929CE;
  border-color: #2929CE;
  color: #fff;
}
.tm-preset-pill.active {
  background: #2929CE;
  border-color: #2929CE;
  color: #fff;
  font-weight: 600;
}
.tm-saved-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px 4px 12px; }
.tm-saved-pill .rm { opacity: .6; font-size: 10px; line-height: 1; }
.tm-saved-pill .rm:hover { opacity: 1; }

/* ── Filter modal ────────────────────────────────────────── */
.tm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.tm-modal-overlay.hidden { display: none !important; }

.tm-modal {
  background: var(--bg2, #fff);
  border-radius: 14px;
  width: min(900px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.tm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border, #e0e0e0);
  flex-shrink: 0;
}
.tm-modal-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--text, #000);
}
.tm-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted, #888);
  padding: 4px 8px;
  border-radius: 6px;
}
.tm-modal-close:hover { background: var(--bg3, #f0f0f0); }

.tm-modal-tabs {
  display: flex;
  gap: 0;
  padding: 12px 24px 0;
  border-bottom: 1px solid var(--border, #e0e0e0);
  flex-shrink: 0;
}
.tm-mtab {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--muted, #888);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tm-mtab.active {
  color: #2929CE;
  border-bottom-color: #2929CE;
}

.tm-modal-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.tm-modal-panel.hidden { display: none; }

.tm-fgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.tm-fgroup { display: flex; flex-direction: column; gap: 6px; }
.tm-fgroup label:first-child {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted, #888);
}
.tm-fgroup input[type="date"],
.tm-fgroup input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--border, #ddd);
  border-radius: 7px;
  font-size: 13px;
  background: var(--bg, #f8f8f8);
  color: var(--text, #000);
  outline: none;
}
.tm-fgroup input:focus { border-color: #2929CE; }
.tm-checks {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tm-checks label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text, #333);
}
.tm-checks input[type="checkbox"] { accent-color: #2929CE; }

.tm-export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg3, #f5f5f5);
  border-radius: 8px;
  margin-top: 8px;
}
.tm-export-label { font-size: 12px; color: var(--muted, #888); }
.tm-export-btn {
  padding: 7px 16px;
  background: #2929CE;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tm-export-btn:hover { background: #1f1fa0; }

.tm-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border, #e0e0e0);
  flex-shrink: 0;
}
.tm-btn-cancel {
  padding: 9px 20px;
  border: 1px solid var(--border, #ddd);
  background: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text, #333);
}
.tm-btn-cancel:hover { background: var(--bg3, #f0f0f0); }
.tm-btn-apply {
  padding: 9px 24px;
  background: #2929CE;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.tm-btn-apply:hover { background: #1f1fa0; }

/* ── Tables ──────────────────────────────────────────────── */
.tm-table-wrap { overflow-x: auto; }
.tm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.tm-table th {
  background: var(--bg3, #f5f5f5);
  padding: 8px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted, #888);
  white-space: nowrap;
  border-bottom: 1px solid var(--border, #e0e0e0);
  cursor: pointer;
  user-select: none;
}
.tm-table th:hover { color: #2929CE; }
.tm-table th.sort-asc::after { content: ' ↑'; color: #2929CE; }
.tm-table th.sort-desc::after { content: ' ↓'; color: #2929CE; }
.tm-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border, #eee);
  color: var(--text, #222);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tm-table tr:hover td { background: rgba(41,41,206,.04); }
.tm-table .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.tm-table .badge-authorized { background: #d1fae5; color: #065f46; }
.tm-table .badge-paused     { background: #fef3c7; color: #92400e; }
.tm-table .badge-pending    { background: #dbeafe; color: #1e40af; }
.tm-table .badge-cancelled  { background: #fee2e2; color: #991b1b; }
.tm-table .badge-mp         { background: #dbeafe; color: #1e40af; }
.tm-table .badge-paypal     { background: #e0e7ff; color: #3730a3; }
.tm-table .badge-tiendanube { background: #f0fdf4; color: #166534; }

/* ── Pagination ──────────────────────────────────────────── */
.tm-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 0 6px;
  flex-wrap: wrap;
}
.tm-pg-btn {
  padding: 4px 10px;
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  background: none;
  font-size: 12px;
  cursor: pointer;
  color: var(--text, #333);
  transition: background .12s;
}
.tm-pg-btn:hover { background: rgba(41,41,206,.08); border-color: #2929CE; color: #2929CE; }
.tm-pg-btn.active { background: #2929CE; color: #fff; border-color: #2929CE; font-weight: 700; }
.tm-pg-btn:disabled { opacity: .35; cursor: default; }
.tm-pg-info { font-size: 11px; color: var(--muted, #888); }

/* ── Resumen mensual table ───────────────────────────────── */
.tm-monthly-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tm-monthly-table th {
  background: var(--bg3, #f5f5f5);
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted, #888);
  text-align: right;
  border-bottom: 1px solid var(--border, #e0e0e0);
}
.tm-monthly-table th:first-child { text-align: left; }
.tm-monthly-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border, #eee);
  text-align: right;
  color: var(--text, #222);
}
.tm-monthly-table td:first-child { text-align: left; font-weight: 600; }
.tm-monthly-table .total-row td { background: var(--bg3, #f5f5f5); font-weight: 700; }

/* ── Proyeccion table ────────────────────────────────────── */
.tm-proj-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tm-proj-table th {
  background: var(--bg3, #f5f5f5);
  padding: 7px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted, #888);
  text-align: left;
  border-bottom: 1px solid var(--border, #e0e0e0);
}
.tm-proj-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border, #eee);
  color: var(--text, #222);
  font-size: 12px;
}
.tm-churn-bar {
  height: 4px;
  background: var(--border, #e0e0e0);
  border-radius: 2px;
  margin-top: 3px;
}
.tm-churn-fill {
  height: 4px;
  background: #AD231A;
  border-radius: 2px;
  transition: width .3s;
}
