/* Inicio (/home). Logical px from lib/presentation/screens/home/** (the page
 * is zoomed to 90% globally). Colors are tokens from app.css; the status
 * accents come in through --c (see .c-*). */

.c-error { --c: var(--error); }
.c-warning { --c: var(--warning); }
.c-success { --c: var(--success); }
.c-muted { --c: var(--muted); }

/* ── Page frame: two scrolling columns, or one page scroll under 1150 ───── */

.page.home-page { padding: 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: auto; container: homepage / inline-size; }
.home { height: 100%; display: flex; flex-direction: column; gap: 14px; padding: 16px 28px 20px; }
.h-cols { flex: 1; min-height: 0; display: flex; align-items: stretch; gap: 20px; }
.h-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.h-col-queue { flex: 1; }
.h-col-side { flex: none; width: 360px; }
.h-head { flex: none; height: 34px; margin-bottom: 14px; display: flex; align-items: center; gap: 12px; }
.h-head-title { display: inline-flex; align-items: center; gap: 5px; font-size: 15px; font-weight: 700; white-space: nowrap; letter-spacing: .25px; }
.h-head-title[data-tip] { cursor: default; }
.h-head-info { color: var(--muted); }

.h-list, .h-side-scroll {
  flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 20px;
  scrollbar-width: thin; scrollbar-color: transparent transparent;
  /* The (thin, 11px in Chrome) scrollbar sits in the column gap, so the cards line up with the header. */
  scrollbar-gutter: stable; margin-right: -11px;
}
.h-list:hover, .h-side-scroll:hover { scrollbar-color: var(--border) transparent; }
.h-list { display: flex; flex-direction: column; gap: 10px; }
.h-list > * { flex: none; }

@container homepage (max-width: 1149.98px) {
  .home { display: block; height: auto; padding: 16px var(--gutter) 40px; }
  .h-cols { display: block; }
  .h-top { margin-bottom: 14px; }
  .h-col { display: block; }
  .h-col-side { width: auto; margin-top: 10px; }
  .h-list, .h-side-scroll { overflow: visible; margin-right: 0; scrollbar-gutter: auto; }
  .h-list { padding-bottom: 10px; }
  .h-side-scroll { padding-bottom: 0; }
}

/* Top bar action: OutlinedButton, compact density */
.h-open-plan {
  display: inline-flex; align-items: center; height: 36px; padding: 0 24px; border-radius: 8px;
  border: 1px solid var(--border); color: var(--text); font-size: 14px; font-weight: 500; letter-spacing: .1px; white-space: nowrap;
  transition: background-color 80ms linear;
}
.h-open-plan:hover { background: var(--hover); }
.h-open-plan:active { background: var(--pressed); }

/* ── Filter bar (QueueFilterBar) ─────────────────────────────────────── */

.h-head-filters { flex: 1; min-width: 0; display: flex; overflow-x: auto; scrollbar-width: none; }
.h-head-filters::-webkit-scrollbar { display: none; }
.h-seg { margin-left: auto; flex: none; display: inline-flex; padding: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; }
.h-seg-btn {
  display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 6px;
  font-size: 11.5px; color: var(--muted); white-space: nowrap; transition: background-color 60ms linear;
}
.h-seg-btn:hover { background: var(--hover); }
.h-seg-btn:active { background: var(--pressed); }
.h-seg-btn.is-on { background: var(--selected); color: var(--text); font-weight: 600; }
.h-seg-n { margin-left: 5px; font-size: 10.5px; font-weight: 600; color: var(--muted); }

/* Recommendations strip */
.h-strip {
  flex: none; display: flex; align-items: center; gap: 7px; margin-bottom: 12px; padding: 9px 9px 9px 12px;
  border-radius: 8px; background: var(--selected); font-size: 12px; color: var(--text-2);
}
.h-strip .ic { color: var(--muted); }

/* ── Cards ───────────────────────────────────────────────────────────── */

.h-card { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.h-frame { background: var(--card); border: 1px solid var(--border); border-radius: 8px; }

/* PlanReviewCard. The hover wash shows on the card, not inside its white
   frames (Flutter paints ink under a colored Container). */
.h-plan { padding: 13px 16px 12px; cursor: pointer; container-type: inline-size; outline: none; transition: background-color 60ms linear; }
.h-plan:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.h-plan:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.h-plan:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent); }
.h-plan-head { display: flex; align-items: center; gap: 9px; }
.h-status {
  flex: none; padding: 2px 7px; border-radius: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
}
.h-plan-label { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-reason { margin: 7px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }

/* Stacked under 560 of content: plot · metrics · advice · actions. */
.h-plan-body { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.h-plan-left, .h-plan-right { display: contents; }
.h-plot { order: 1; }
.h-metrics { order: 2; }
.h-advice { order: 3; }
.h-actions { order: 4; }
@container (min-width: 558px) {
  .h-plan-body { flex-direction: row; align-items: stretch; gap: 16px; }
  .h-plan-left, .h-plan-right { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
  .h-plan-left { flex: 6 1 0; }
  .h-plan-right { flex: 3 1 0; }
  .h-plot, .h-metrics { flex: 1 0 auto; }
}

.h-plot { position: relative; min-height: 124px; }
.h-plot-canvas { position: absolute; inset: 1px; border-radius: 7px; overflow: hidden; pointer-events: none; }
.h-spin {
  position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 1.5px solid var(--primary); border-right-color: transparent; border-radius: 50%;
  animation: h-spin 900ms linear infinite;
}
.h-plot:has(.plot-ready) .h-spin, .h-plot.is-empty .h-spin { display: none; }
@keyframes h-spin { to { transform: rotate(360deg); } }

.h-advice { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; }
.h-advice-icon { color: var(--text-2); margin-top: 1px; }
.h-advice-main { flex: 1; min-width: 0; }
.h-advice-text {
  margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-2);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.h-more { display: none; padding: 3px 0 1px; font-size: 11.5px; font-weight: 600; color: var(--primary); }
.is-clamped > .h-more { display: inline-block; }

.h-metrics { display: flex; flex-direction: column; justify-content: space-between; padding: 10px 12px; }
.h-metrics-label { font-size: 9px; font-weight: 700; letter-spacing: .7px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-metrics-value { margin-top: 2px; display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.h-metrics-value b { flex: none; font-size: 21px; line-height: 1.1; font-weight: 700; letter-spacing: .25px; }
.h-metrics-value span { min-width: 0; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-metrics hr { margin: 9px 0 8px; border: 0; border-top: 1px solid var(--border); }
.h-metrics-rows { margin: 0; display: flex; flex-direction: column; gap: 5px; }
.h-metrics-rows div { display: flex; align-items: center; gap: 8px; }
.h-metrics-rows dt { flex: 1; min-width: 0; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-metrics-rows dd { margin: 0; font-size: 12.5px; font-weight: 700; white-space: nowrap; }

.h-actions { display: flex; gap: 8px; }
.h-act {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 10px; border-radius: 7px;
  border: 1px solid var(--border); color: var(--text-2); font-size: 11.5px; font-weight: 600; text-align: left;
  transition: background-color 60ms linear;
}
.h-act:first-child { flex: 1; }
.h-act span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-act:hover { background: var(--hover); }
.h-act:active { background: var(--pressed); }
.h-act.is-primary { flex: none; background: var(--primary); border-color: var(--primary); color: #fff; }

/* DecisionCard (events, overrides, perspectives) */
.h-dcard { display: flex; align-items: stretch; padding-right: 16px; }
.h-dcard-main { flex: 1; min-width: 0; padding: 14px 0 14px 16px; }
.h-dcard-meta { display: flex; align-items: center; white-space: nowrap; }
.h-kind { padding: 2px 7px; border-radius: 4px; background: var(--selected); font-size: 10.5px; font-weight: 600; letter-spacing: .4px; color: var(--text-2); }
.h-sev { margin-left: 8px; font-size: 11px; font-weight: 600; color: var(--c); }
.h-dim { margin-left: 10px; font-size: 11.5px; color: var(--muted); }
.h-dcard-title { margin-top: 8px; font-size: 14.5px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.h-dcard-body { margin: 5px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.h-dcard-actor { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.h-dcard-chev { flex: none; display: flex; align-items: center; padding-left: 12px; color: var(--muted); }

/* All clear */
.h-allclear { padding: 34px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.h-allclear .ic { color: var(--muted); }
.h-allclear b { margin-top: 12px; font-size: 15px; font-weight: 600; }
.h-allclear p { margin: 6px 0 0; max-width: 420px; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
/* A new org: no forecast yet, so nothing to review (the all clear would lie). */
.h-empty { padding: 34px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.h-empty .ic { color: var(--muted); }
.h-empty b { margin-top: 12px; font-size: 15px; font-weight: 600; }
.h-empty p { margin: 6px 0 0; max-width: 420px; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.h-empty a { margin-top: 12px; font-weight: 600; }
.h-empty a:hover { text-decoration: underline; }

/* Skeleton (home_skeleton.dart) */
.h-sk { padding: 15px 16px; }
.h-sk-title { height: 13px; width: 140px; }
.h-sk-line { height: 9px; margin-top: 8px; }
.h-sk-title + .h-sk-line { margin-top: 12px; }
.h-sk-line.is-short { width: 62%; }

/* ── Context column ──────────────────────────────────────────────────── */

.h-side { display: flex; flex-direction: column; gap: 14px; }
.h-card-retry-text { margin: 6px 0 8px; color: var(--muted); font-size: 13px; }
.h-side-card { padding: 16px 18px 14px; }
.h-side-title { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.43; letter-spacing: .25px; }
.h-side-title.is-15 { font-size: 15px; }
.h-pill {
  display: inline-block; padding: 2px 7px; border-radius: 20px; font-size: 10.5px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); white-space: nowrap;
}
.h-textbtn {
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 10px; border-radius: 16px;
  font-size: 12.5px; font-weight: 500; color: var(--primary); transition: background-color 80ms linear;
}
.h-textbtn:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.h-textbtn:active { background: color-mix(in srgb, var(--primary) 14%, transparent); }

/* Pulso de ventas */
.h-pulse { margin-top: 12px; display: flex; align-items: center; gap: 14px; }
.h-pulse-main { flex: 1; min-width: 0; }
.h-pulse-delta { display: inline-flex; align-items: center; gap: 6px; color: var(--c); }
.h-pulse-delta b { font-size: 20px; font-weight: 700; }
.h-pulse-caption { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.h-pulse-day { margin-top: 6px; font-size: 11.5px; color: var(--text-2); }
.h-spark { flex: none; overflow: visible; color: var(--text); }
.h-pulse-foot { margin-top: 10px; font-size: 11px; color: var(--muted); }

/* Plan de demanda (the whole card opens the plan; no hover, like Flutter) */
.h-planstat-head { display: flex; align-items: center; gap: 8px; }
.h-planstat-head h3 { flex: 1; }
.h-planstat-head span { font-size: 11px; color: var(--muted); }
.h-planstat-blocks { margin-top: 14px; display: flex; }
.h-planstat-blocks > div { flex: 1; display: flex; flex-direction: column; align-items: flex-start; }
.h-planstat-blocks b { margin-top: 6px; font-size: 20px; font-weight: 700; line-height: 1.43; }
.h-planstat-blocks b.c-error { color: var(--error); }
.h-planstat-hint { margin: 12px 0 0; font-size: 12px; line-height: 1.45; color: var(--text-2); }

/* Próximos eventos */
.h-events { padding-bottom: 10px; }
.h-events-head { display: flex; align-items: center; }
.h-events-head .h-textbtn { margin-left: auto; margin-right: -6px; }
.h-events-head + .h-ev { margin-top: 8px; }
.h-ev { display: flex; align-items: center; padding: 7px 0; border-radius: 8px; transition: background-color 60ms linear; }
.h-ev:hover { background: var(--hover); }
.h-ev:active { background: var(--pressed); }
.h-ev-badge {
  flex: none; width: 46px; padding: 7px 0; display: flex; flex-direction: column; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.h-ev-badge b { font-size: 17px; font-weight: 700; line-height: 1.05; }
.h-ev-badge small { margin-top: 1px; font-size: 10.5px; font-weight: 600; letter-spacing: .4px; color: var(--muted); line-height: 1.43; }
.h-ev-main { flex: 1; min-width: 0; margin-left: 12px; display: flex; flex-direction: column; }
.h-ev-main b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-ev-main small { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.h-ev-prior { flex: none; margin-left: 10px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.h-ev-prior.is-weak { color: var(--muted); }
.h-ev-none { flex: none; margin-left: 10px; font-size: 11.5px; color: var(--muted); }
.h-ev-more { padding: 8px 0 4px; font-size: 11.5px; color: var(--muted); }

/* Señales externas que seguimos */
.h-insights-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.h-insights-head .ic { color: var(--text-2); }
.h-insight { display: block; border-radius: 6px; font-size: 12.5px; line-height: 1.5; color: var(--text-2); transition: background-color 60ms linear; }
.h-insight:hover { background: var(--hover); }
.h-insights-sep { margin: 11px 0; border: 0; border-top: 1px solid var(--border); }

/* Estado del ciclo */
.h-cycle .h-side-title { margin-bottom: 12px; }
.h-cycle-row { display: flex; align-items: flex-start; padding-bottom: 8px; }
.h-cycle-slot { flex: none; width: 62px; }
.h-cycle-slot .h-pill { display: block; text-align: center; overflow: hidden; text-overflow: ellipsis; }
.h-cycle-main { flex: 1; min-width: 0; margin-left: 10px; font-size: 12.5px; }
.h-cycle-main small { display: block; font-size: 11px; color: var(--muted); }
.h-cycle-head { margin: -6px 0 10px; font-size: 12px; color: var(--text-2); }
.h-cycle-off { margin: -4px 0 6px; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.h-textbtn.is-flush { padding: 0; min-height: 0; font-size: 14px; border-radius: 4px; }

/* A refused verdict's reason (home.js toast), as Outputs' snackbar. */
.h-toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.h-toast { min-width: 288px; max-width: 560px; padding: 14px 16px; border-radius: 4px; background: var(--error); color: #fff; font-size: 14px; box-shadow: var(--menu-shadow); }

/* ── The person's layout (app/home/layout.py): the wide row on top, the
   handles, and the drop targets while a card is dragged ──────────────── */

/* The wide row: its cards share the row's height (a pinned KPI next to the
 * plan's card is as tall as it), and a pinned chart stays compact. */
.h-top { flex: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: stretch; }
.h-top > .h-item { display: flex; flex-direction: column; }
.h-top > .h-item > :not(.h-item-tools) { flex: 1 1 auto; }
.h-top.is-empty { display: none; }
.home.is-arranging .h-top.is-empty {
  display: grid; min-height: 64px; border: 1.5px dashed var(--border); border-radius: 12px;
  place-items: center; color: var(--muted); font-size: 12.5px;
}
.h-top-hint { display: none; margin: 0; }
.home.is-arranging .h-top.is-empty .h-top-hint { display: block; }
.home.is-arranging .h-top.is-empty:has(.h-item) .h-top-hint { display: none; }
.home.is-arranging .h-side { min-height: 120px; }
.h-item { position: relative; }
.h-item-tools {
  position: absolute; top: 8px; right: 8px; z-index: 1; display: flex; gap: 2px;
  opacity: 0; transition: opacity 90ms linear;
}
.h-item:hover > .h-item-tools, .h-item:focus-within > .h-item-tools { opacity: 1; }
@media (hover: none) { .h-item-tools { opacity: 1; } }
.h-item-btn {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px;
  color: var(--muted); background: var(--card); transition: background-color 60ms linear;
}
.h-item-btn:hover { background: var(--hover); color: var(--text); }
.h-drag { cursor: grab; touch-action: none; }
.h-item.is-chosen .h-drag { cursor: grabbing; }
.h-item.is-ghost { opacity: .35; }
.h-item.is-ghost > * { box-shadow: none; }
.h-restore { margin-left: auto; min-height: 28px; font-size: 12px; color: var(--muted); }

/* ── The sales pulse: its chip, and the card opening large ──────────────── */

.h-pulse-card { cursor: pointer; transition: border-color 80ms linear; }
.h-pulse-card:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.h-pulse-head { display: flex; align-items: center; gap: 8px; padding-right: 58px; }
.h-pulse-chip { font-size: 10.5px; color: var(--muted); white-space: nowrap; padding: 2px 7px; border: 1px solid var(--border); border-radius: 20px; }
.hp-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.hp-controls { margin-bottom: 18px; }
.hp-seg { display: inline-flex; margin-left: 0; flex-wrap: wrap; }
.hp-seg .h-seg-btn[disabled] { opacity: .4; cursor: not-allowed; }
.hp-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.hp-kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.hp-kpi .sp-label { margin: 0; }
.hp-kpi b { font-size: 22px; font-weight: 700; line-height: 1.3; }
.hp-delta { display: inline-flex; align-items: center; gap: 4px; color: var(--c); }
.hp-dates { font-size: 11px; color: var(--muted); }
.hp-chart { height: 260px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 6px 4px 0; }
.hp-legend { margin: 8px 2px 0; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hp-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: rgba(128, 128, 128, .35); margin-left: 8px; }
.hp-sw:first-child { margin-left: 0; }
.hp-sw.is-cur { background: rgba(25, 118, 210, .95); }
.hp-sw.is-prev { background: rgba(25, 118, 210, .40); }
@media (max-width: 560px) { .hp-kpis { grid-template-columns: 1fr; } }
.hp-panel .psp-foot .sp-outline { display: inline-flex; align-items: center; gap: 6px; }

/* Plan colaborativo, where it needs the person (the three-stage plan). */
.h-collab { padding: 14px 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.h-collab-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.h-collab-h .h-side-title { margin: 0; }
.h-collab-due { font-size: 12px; color: var(--muted); }
.h-collab-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 8px 10px; margin: 0 -10px; border-radius: 8px; color: inherit; text-decoration: none; }
.h-collab-row:hover { background: var(--hover); }
.h-collab-what { font-size: 13px; }
.h-collab-what b { font-weight: 600; }
.h-collab-text { grid-column: 1; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-collab-go { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 12.5px; font-weight: 600; color: var(--primary); }

/* The demo's banner to Plan baseline (views._baseline_card). */
.h-baseline { display: flex; align-items: center; gap: 20px; padding: 14px 16px; color: inherit; text-decoration: none; }
.h-baseline:hover { background: var(--hover); }
.h-baseline-main { flex: 1; min-width: 0; }
.h-baseline-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 10px; }
.h-baseline-stats div { display: flex; flex-direction: column; }
.h-baseline-stats b { font-size: 18px; font-weight: 600; }
.h-baseline-stats span { font-size: 12px; color: var(--muted); }
.h-baseline-go { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 760px) { .h-baseline { flex-direction: column; align-items: stretch; } }
