/* ═══════════════════════════════════════════════════════════════════
   EARNINGS CALENDAR  —  Alpha Finance
   Usa la base de marketMap.css (layout, pills, stats); aquí solo el calendario.
   ═══════════════════════════════════════════════════════════════════ */

.ec-page { gap: 16px; }

/* ── Semana ────────────────────────────────────────────────────── */
.ec-week {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.ec-week__arrow {
  width: 30px; height: 30px;
  border: none; border-radius: 50%;
  background: transparent; color: #285260;
  cursor: pointer; font-size: 12px;
  transition: background .15s;
}
.ec-week__arrow:hover { background: rgba(84, 140, 146, 0.12); }
.ec-week__label {
  min-width: 150px;
  text-align: center;
  font: 700 13.5px/1 'Inter', sans-serif;
  color: var(--color-texto-prin, #2C3E50);
  padding: 0 6px;
}
#ecToday:disabled { opacity: .45; cursor: default; background: transparent; color: var(--color-azul-medio, #548C92); border-color: rgba(84, 140, 146, 0.45); }

/* ── Filtros ───────────────────────────────────────────────────── */
.ec-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.ec-search {
  flex: 1 1 260px;
  display: flex; align-items: center; gap: 8px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 0 12px;
  color: #8a9aa0;
}
.ec-search:focus-within { border-color: #548C92; box-shadow: 0 0 0 3px rgba(84, 140, 146, .15); }
.ec-search input {
  flex: 1; min-width: 0;
  border: none; outline: none; background: transparent;
  padding: 10px 0;
  font: 500 14px 'Inter', sans-serif; color: #1a1a1a;
}
.ec-select {
  flex: 0 1 220px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  font: 600 13.5px 'Inter', sans-serif; color: #2C3E50;
  cursor: pointer;
}
.ec-select:focus { outline: none; border-color: #548C92; box-shadow: 0 0 0 3px rgba(84, 140, 146, .15); }

.ec-stats .mm-stat { flex: 1 1 140px; }

/* ── Barra fija (semana + buscador + sector) ───────────────────── */
.ec-toolbar {
  --ec-pad: 24px;
  position: sticky;
  top: var(--ec-top, 0px);
  z-index: 50;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: -6px calc(-1 * var(--ec-pad));
  padding: 8px var(--ec-pad);
  background: rgb(255, 252, 255);
  transition: box-shadow .2s;
}
.ec-toolbar.is-stuck { box-shadow: 0 6px 16px -10px rgba(22, 36, 42, 0.25); border-bottom: 1px solid rgba(22, 36, 42, 0.07); }
.ec-toolbar__week { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.ec-toolbar .ec-filters { flex: 1 1 380px; }

.ec-search { position: relative; }
.ec-suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  z-index: 60;
  list-style: none; margin: 0; padding: 6px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(22, 36, 42, 0.16);
  max-height: 360px; overflow-y: auto;
}
.ec-suggest[hidden] { display: none; }
.ec-suggest__i {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px; border-radius: 10px; cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.ec-suggest__i.is-active, .ec-suggest__i:hover { background: rgba(84, 140, 146, 0.09); }
.ec-suggest__tag { font: 600 11.5px 'Inter', sans-serif; color: #548C92; white-space: nowrap; }
.ec-suggest__tag i { font-size: 10px; }
.ec-suggest__tag.is-week { color: #188038; }

.ec-jump {
  flex: 1 1 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 14px;
  background: #eef5f6;
  border: 1px solid rgba(84, 140, 146, 0.25);
  border-radius: 12px;
  font: 500 13.5px 'Inter', sans-serif; color: #2C3E50;
}
.ec-jump[hidden] { display: none; }
.ec-jump span { flex: 1; }
.ec-jump b { font-weight: 700; color: #285260; }
.ec-jump .fa-spinner { color: #548C92; margin-right: 4px; }
.ec-jump button { border: none; background: transparent; color: #6b7b80; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; }
.ec-jump button:hover { background: rgba(84, 140, 146, 0.12); }

/* empresa encontrada con el buscador */
.ec-row.is-hit { background: rgba(84, 140, 146, 0.16); box-shadow: inset 0 0 0 2px #548C92; animation: ec-hit 1s ease-out 2; }
@keyframes ec-hit { 50% { background: rgba(84, 140, 146, 0.32); } }
@media (prefers-reduced-motion: reduce) { .ec-row.is-hit { animation: none; } }

/* ── Calendario ────────────────────────────────────────────────── */
.ec-card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
  overflow: hidden;
}
.ec-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: 360px;
}
.ec-grid[hidden] { display: none; }
.ec-day { --ec-col-bg: #fff; position: relative; border-left: 1px solid rgba(0, 0, 0, 0.06); min-width: 0; display: flex; flex-direction: column; background: var(--ec-col-bg); }
.ec-day:first-child { border-left: none; }
.ec-day__h {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: #fafbfb;
}
.ec-day__dow { font: 800 11px 'Inter', sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #548C92; }
.ec-day__date { font: 700 16px 'Inter', sans-serif; color: #2C3E50; display: flex; align-items: center; gap: 6px; }
.ec-day__date em {
  font-style: normal; font-size: 10.5px; font-weight: 700;
  background: #285260; color: #fff;
  padding: 2px 7px; border-radius: 999px;
}
.ec-day__n { font: 500 11.5px 'Inter', sans-serif; color: #8a9aa0; min-height: 14px; }
.ec-day.is-today .ec-day__h { background: rgba(84, 140, 146, 0.10); }
.ec-day.is-today { --ec-col-bg: #fafcfc; }
.ec-day.is-past .ec-day__h { opacity: .8; }
.ec-day__b {
  padding: 8px 8px 12px; display: flex; flex-direction: column; gap: 10px; flex: 1;
  /* semanas con muchas empresas: la columna hace scroll por dentro */
  max-height: 600px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(84, 140, 146, .35) transparent;
}
.ec-day__b::-webkit-scrollbar { width: 6px; }
.ec-day__b::-webkit-scrollbar-thumb { background: rgba(84, 140, 146, .35); border-radius: 6px; }
.ec-day::after {
  content: ''; position: absolute; left: 0; right: 6px; bottom: 0; height: 44px;
  background: linear-gradient(to bottom, transparent, var(--ec-col-bg) 85%);
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.ec-day.has-more::after { opacity: 1; }

.ec-more {
  display: none;
  align-items: center; justify-content: center; gap: 6px;
  margin: 0 8px 12px; padding: 9px;
  border: 1px solid rgba(84, 140, 146, .35); border-radius: 10px;
  background: #fff; color: #285260;
  font: 700 13px 'Inter', sans-serif; cursor: pointer;
}
.ec-more:hover { background: rgba(84, 140, 146, .08); }
.ec-more i { font-size: 11px; }
.ec-day__none { font: 500 12.5px 'Inter', sans-serif; color: #aab6ba; text-align: center; padding: 22px 0; }

.ec-group { display: flex; flex-direction: column; gap: 2px; }
.ec-group__h {
  display: flex; align-items: center; gap: 6px;
  font: 700 11px 'Inter', sans-serif; color: #6b7b80;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 6px;
  position: sticky; top: -8px; z-index: 1;
  background: var(--ec-col-bg);
}
.ec-group__h .fa-sun { color: #d19a1e; }
.ec-group__h .fa-moon { color: #4f5f9c; }
.ec-group__h span { margin-left: auto; font-weight: 600; color: #aab6ba; }

.ec-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 6px;
  border: none; border-radius: 10px;
  background: transparent;
  text-align: left; cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background .15s;
}
.ec-row:hover { background: rgba(84, 140, 146, 0.08); }
.ec-row:focus-visible { outline: 2px solid #548C92; outline-offset: -2px; }

.ec-logo {
  position: relative;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.07);
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.ec-logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.ec-logo.is-fallback { background: #e8f0f1; border-color: transparent; }
.ec-logo.is-fallback::after {
  content: attr(data-initials);
  font: 800 10px 'Inter', sans-serif; color: #285260; letter-spacing: -.02em;
}
.ec-logo--lg { width: 52px; height: 52px; border-radius: 14px; }
.ec-logo--lg.is-fallback::after { font-size: 15px; }

.ec-co { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ec-co__top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ec-co__t { font-size: 13px; font-weight: 800; color: #1a1a1a; }
.ec-co__n { font-size: 11.5px; color: #7b8a8f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ec-eps { font-size: 11.5px; font-weight: 700; color: #2C3E50; white-space: nowrap; }
.ec-eps small { font-size: 10.5px; color: #8a9aa0; font-weight: 500; }

.ec-chip {
  display: inline-block;
  font: 700 10.5px/1 'Inter', sans-serif;
  padding: 3px 7px; border-radius: 999px;
  white-space: nowrap;
}
.ec-chip--beat { background: rgba(24, 128, 56, 0.10); color: #188038; }
.ec-chip--miss { background: rgba(217, 48, 37, 0.10); color: #d93025; }
.ec-chip--flat { background: #eef1f2; color: #5c6b70; }

/* Esqueleto mientras carga */
.ec-skel {
  display: block; height: 38px; border-radius: 10px; margin: 4px 0;
  background: linear-gradient(90deg, #f1f4f5 0%, #e7eced 50%, #f1f4f5 100%);
  background-size: 200% 100%;
  animation: ec-shimmer 1.2s ease-in-out infinite;
}
@keyframes ec-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .ec-skel { animation: none; } }

.ec-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center;
  padding: 64px 24px;
  font-family: 'Inter', sans-serif;
}
.ec-empty[hidden] { display: none; }
.ec-empty i { font-size: 28px; color: #B4D7D8; }
.ec-empty p { font-size: 15px; font-weight: 700; color: #2C3E50; margin: 4px 0 0; }
.ec-empty span { font-size: 13px; color: #7b8a8f; max-width: 420px; }

.ec-note { font: 500 12px 'Inter', sans-serif; color: #8a9aa0; margin: 0; }

/* ── Detalle ───────────────────────────────────────────────────── */
body.ec-noscroll { overflow: hidden; }
.ec-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ec-modal[hidden] { display: none; }
.ec-modal__backdrop { position: absolute; inset: 0; background: rgba(20, 34, 40, 0.45); }
.ec-modal__panel {
  position: relative;
  width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  font-family: 'Inter', sans-serif;
  display: flex; flex-direction: column; gap: 16px;
}
.ec-modal__close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: #f1f4f5; color: #2C3E50; cursor: pointer;
}
.ec-modal__close:hover { background: #e4eaeb; }
.ec-modal__head { display: flex; align-items: center; gap: 14px; padding-right: 36px; }
.ec-modal__ticker { font-size: 12px; font-weight: 800; color: #548C92; letter-spacing: .08em; }
.ec-modal__name { font-size: 19px; font-weight: 700; color: #1a1a1a; margin: 2px 0; letter-spacing: -.02em; }
.ec-modal__sector { font-size: 12.5px; color: #7b8a8f; }
.ec-modal__when {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  font-size: 13.5px; font-weight: 600; color: #2C3E50;
  background: #f6f9f9; border-radius: 12px; padding: 10px 12px;
}
.ec-modal__when .fa-sun { color: #d19a1e; }
.ec-modal__when .fa-moon { color: #4f5f9c; }
.ec-modal__when span { width: 100%; font-size: 12px; font-weight: 500; color: #7b8a8f; }
.ec-modal__nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ec-modal__nums div { border: 1px solid rgba(0, 0, 0, 0.07); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.ec-modal__nums span { font-size: 10.5px; font-weight: 700; color: #7b8a8f; text-transform: uppercase; letter-spacing: .05em; }
.ec-modal__nums b { font-size: 15px; color: #1a1a1a; }
.ec-modal__nums b.is-beat { color: #188038; }
.ec-modal__nums b.is-miss { color: #d93025; }
.ec-modal__sub { font-size: 12px; font-weight: 700; color: #6b7b80; margin-bottom: 8px; }

.ec-hist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; align-items: end; }
.ec-hist .ec-skel { grid-column: span 2; height: 110px; }
.ec-hist__q { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ec-hist__bars { height: 80px; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.ec-bar { width: 14px; border-radius: 4px 4px 0 0; }
.ec-bar--est { background: #d3dfe1; }
.ec-bar--act { background: #548C92; }
.ec-bar.is-neg { opacity: .55; background-image: repeating-linear-gradient(45deg, transparent 0 3px, rgba(255,255,255,.6) 3px 5px); }
.ec-hist__l { font-size: 11px; color: #7b8a8f; font-weight: 600; }
.ec-hist__v { font-size: 12.5px; font-weight: 700; color: #1a1a1a; }
.ec-hist__key { grid-column: 1 / -1; display: flex; gap: 14px; justify-content: center; font-size: 11.5px; color: #7b8a8f; margin-top: 4px; }
.ec-hist__key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.ec-hist__none { grid-column: 1 / -1; font-size: 13px; color: #7b8a8f; margin: 0; }

.ec-modal__cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #285260; color: #fff; text-decoration: none;
  font-weight: 700; font-size: 14px;
  padding: 12px; border-radius: 12px;
  transition: background .15s;
}
.ec-modal__cta:hover { background: #1d3f4a; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .ec-grid { grid-template-columns: 1fr; min-height: 0; }
  .ec-day { border-left: none; border-top: 1px solid rgba(0, 0, 0, 0.06); scroll-margin-top: 80px; }
  .ec-day__b { max-height: none; overflow: visible; }
  .ec-day::after { display: none; }
  .ec-group__h { position: static; }
  .ec-more { display: flex; }
  .ec-day:not(.is-expanded) .ec-row--extra,
  .ec-day:not(.is-expanded) .ec-group--extra { display: none; }
  .ec-day:first-child { border-top: none; }
  .ec-day__h { flex-direction: row; align-items: baseline; gap: 10px; }
  .ec-day__n { margin-left: auto; }
  .ec-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 12px; }
  .ec-group__h { grid-column: 1 / -1; }
  .ec-day__none { padding: 8px 0 8px 6px; text-align: left; }
}
@media (max-width: 600px) {
  .ec-week__label { min-width: 0; font-size: 13px; }
  .ec-toolbar { --ec-pad: 14px; gap: 8px; }
  .ec-toolbar__week { flex: 1 1 100%; justify-content: space-between; }
  .ec-toolbar .ec-filters { flex: 1 1 100%; min-width: 0; flex-wrap: nowrap; gap: 8px; }
  .ec-search { flex: 1 1 auto; min-width: 0; }
  .ec-select { flex: 0 0 118px; min-width: 0; width: 118px; padding: 10px 8px; font-size: 13px; }
  .ec-suggest__tag { font-size: 11px; }
  .ec-modal__panel { padding: 20px 16px; }
  .ec-modal__nums b { font-size: 13.5px; }
}
