/* Vista: Inicio (prefijo hm-). Solo maquetación propia; el aspecto base sale de components.css. */

/* ── Cabecera ── */
.hm-status { display: inline-flex; align-items: center; gap: var(--s2); }
.hm-status .dot { margin: 0 2px; }
.hm-offline { margin-bottom: var(--s5); }

/* ── Rejilla: columna principal + lateral ── */
.hm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: var(--s5); align-items: start; }
.hm-col { display: flex; flex-direction: column; gap: var(--s5); min-width: 0; }
.hm-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--s5); align-items: start; }
.hm-pair > .card { height: 100%; }

/* Orden cuando todo cae en una columna: lo urgente arriba. */
.hm-attn { order: 1; }
.hm-setup { order: 2; }
.hm-ia.is-urgent { order: 3; }
.hm-runway { order: 4; }
.hm-pair { order: 5; }
.hm-ia { order: 6; }
.hm-week { order: 7; }

@media (max-width: 1100px) {
  .hm-grid { grid-template-columns: minmax(0, 1fr); }
  .hm-col { display: contents; }
}

/* ── Tarjeta «Necesita tu atención» ── */
.hm-attn .card-head h2 { display: flex; align-items: center; gap: var(--s2); }
.hm-attn.is-warning { border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.hm-attn.is-danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.hm-blocks { display: flex; flex-direction: column; gap: var(--s6); min-width: 0; }
.hm-block { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.hm-block > .btn { align-self: flex-start; }
.hm-sub { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.hm-sub-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--r-full); display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: 11px; letter-spacing: 0; }
.hm-foot-note { display: flex; align-items: center; gap: var(--s2); width: 100%; font-size: var(--fs-sm); color: var(--text-2); }
.hm-foot-note > .icon { color: var(--accent-text); }
.hm-upcoming .card-foot { justify-content: flex-start; }

/* ── Filas de lista ── */
.hm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; min-width: 0; }
.hm-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--border); min-width: 0; }
.hm-row:first-child { border-top: 0; padding-top: var(--s1); }
.hm-row:last-child { padding-bottom: 0; }
.hm-row-tight { padding: var(--s2) 0; }
.hm-row-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hm-row-actions { flex: none; display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; }
.hm-row-actions .btn .lang { height: 18px; min-width: 24px; font-size: 10px; }

.hm-title {
  display: block; max-width: 100%; padding: 0; border: 0; background: none; color: var(--text);
  font: inherit; font-weight: 600; text-align: left; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hm-title:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.hm-meta { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; min-width: 0; font-size: var(--fs-sm); color: var(--text-2); }

.hm-thumb { width: 40px; border-radius: var(--r-sm); }
.hm-thumb.thumb-empty .icon { width: 16px; height: 16px; }

.hm-err-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r); background: var(--danger-soft); color: var(--danger); }
.hm-err-text { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }

/* Hora de publicación */
.hm-when { flex: none; width: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: var(--s2) 0; border-radius: var(--r); background: var(--info-soft); color: var(--info); line-height: 1.1; }
.hm-when-day { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.hm-when-time { font-size: var(--fs-lg); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.hm-dm { display: inline-flex; align-items: center; gap: 5px; }
.hm-ext { display: inline-flex; align-items: center; gap: 5px; font-weight: 550; }

/* ── Reels listos por cuenta ── */
.hm-accs { display: flex; flex-direction: column; }
.hm-acc-conn { flex: none; display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--fs-xs); color: var(--text-2); }
.hm-acc-days { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s1); }
.hm-acc-num { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.hm-acc-detail { font-size: var(--fs-xs); color: var(--text-3); }
.hm-acc-hint { font-size: var(--fs-sm); color: var(--text-2); }
.hm-acc-warn { display: flex; align-items: flex-start; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s1); padding: var(--s2) var(--s3); border-radius: var(--r); background: var(--warning-soft); font-size: var(--fs-sm); color: var(--text); }
.hm-acc-warn > .icon { color: var(--warning); margin-top: 2px; }
.hm-acc-warn > .btn { align-self: center; }
.hm-acc-warn > .grow { flex: 1 1 180px; }
.hm-tone-success { color: var(--success); }
.hm-tone-warning { color: var(--warning); }
.hm-tone-danger { color: var(--danger); }
.hm-tone-neutral { color: var(--text-2); }

/* ── La IA ── */
.hm-ia-status { display: flex; gap: var(--s3); align-items: flex-start; min-width: 0; }
.hm-ia-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r); background: var(--surface-3); color: var(--text-3); }
.hm-ia-success .hm-ia-icon { background: var(--ai-soft); color: var(--ai); }
.hm-ia-warning .hm-ia-icon { background: var(--warning-soft); color: var(--warning); }
.hm-ia-danger .hm-ia-icon { background: var(--danger-soft); color: var(--danger); }
.hm-ia-text { gap: 4px; flex: 1; }
.hm-ia-text > div { margin-top: var(--s1); }
.hm-queue { display: flex; align-items: center; gap: 6px; }

/* ── Últimos 7 días ── */
.hm-week { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.hm-week-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.hm-week-head h2 { font-size: var(--fs-lg); }
.hm-funnel { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: var(--s2); }
.hm-funnel .stat { width: 100%; }
.hm-funnel-arrow { display: grid; place-items: center; color: var(--text-3); }

/* ── Primeros pasos ── */
.hm-setup { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.hm-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hm-step { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--border); min-width: 0; }
.hm-step:first-child { border-top: 0; }
.hm-step:last-child { padding-bottom: 0; }
.hm-step-mark { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border-strong); color: var(--text-2); font-size: var(--fs-xs); font-weight: 700; }
.hm-step.is-done .hm-step-mark { background: var(--success); border-color: var(--success); color: var(--surface); }
.hm-step-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hm-step-title { font-weight: 600; font-size: var(--fs-md); }
.hm-step.is-done .hm-step-title { color: var(--text-3); font-weight: 500; text-decoration: line-through; }
.hm-step > .btn { flex: none; }

/* ── Móvil ── */
@media (max-width: 720px) {
  .hm-grid, .hm-col, .hm-pair { gap: var(--s4); }
  .hm .page-head .page-actions { width: 100%; }
  .hm .page-head .page-actions .btn { flex: 1; }
  .hm-grid .card-body { padding: var(--s4); }
  .hm-grid .card-head { padding: var(--s3) var(--s4); flex-wrap: wrap; }
  /* Botones de la fila bajo el texto, alineados con él (no con la miniatura) */
  .hm-row { flex-wrap: wrap; }
  .hm-row-actions { width: 100%; justify-content: flex-start; padding-left: calc(40px + var(--s3)); }
  .hm-row-actions .btn { min-height: 36px; }
  .hm-funnel { grid-template-columns: minmax(0, 1fr); }
  .hm-funnel-arrow { display: none; }
  .hm-step { flex-wrap: wrap; }
  .hm-step > .btn { margin-left: calc(26px + var(--s3)); min-height: 36px; }
}

/* Tus cuentas */
.hm-accounts { display: flex; flex-direction: column; gap: var(--s3); margin-bottom: var(--s6); }
.hm-accs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.hm-accounts.is-single .hm-accs-grid { grid-template-columns: minmax(0, 1fr); }
.hm-acc { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s5); min-width: 0; }
.hm-acc-name { font-size: var(--fs-lg); }
.hm-acc-facts { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s1); }
.hm-acc-fact { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 var(--s3); border-radius: var(--r-full); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm); font-weight: 550; }
button.hm-acc-fact:hover { border-color: var(--border-strong); color: var(--text); }
.hm-acc-fact.is-warn { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.hm-acc-fact.is-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.hm-acc-foot { margin-top: auto; padding-top: var(--s2); display: flex; justify-content: flex-end; }
@media (max-width: 860px) { .hm-accs-grid { grid-template-columns: minmax(0, 1fr); } }
