/* ---------- ERP Tablero and Predictivo (erp/view-board.js), imported by styles/erp.css ----------
   Tablero (S25): kit kanban with 5 cards per column and a "+N más" toggle; card tags, the
   "Mover a…" menu, "Reabrir", "Ver equipo" and the touch drag grip; the toast and the closing
   checklist dialog. Under 640 px the board scrolls sideways. Predictivo: a 3-column grid of
   trends (2 under 1200 px, 1 under 640 px). */
.erp-link {
  margin-top: var(--sp-1, 8px);
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--surface, #fff);
  box-shadow: var(--raised, 0 1px 2px rgb(0 0 0 / 0.15));
  color: var(--accent-strong, #7a4a00);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.erp-link:active {
  box-shadow: var(--inset, none);
}
/* An expanded column's toggle is a selected state: extrusion (S23). */
.erp-board .kanban-more[aria-expanded='true'] {
  background: var(--selected-bg, var(--accent));
  color: var(--selected-ink, #1b1c20);
  box-shadow: var(--selected, 3px 3px 0 #5c3800);
  transform: translate(-1px, -1px);
}
.erp-board .kanban-more:active {
  background: var(--selected-bg, var(--accent));
  color: var(--selected-ink, #1b1c20);
  box-shadow: var(--selected-pressed, 1px 1px 0 #5c3800);
  transform: translate(1px, 1px);
}
.erp-board .kit-kanban {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.erp-board .kanban-card {
  cursor: grab;
  user-select: none;
}
.kanban-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  width: 100%;
}
.kanban-move,
.kanban-act {
  padding: 3px 8px;
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text-strong, var(--hud-text));
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.kanban-move {
  max-width: 100%;
}
.kanban-act:hover,
.kanban-move:hover {
  color: var(--accent-strong, #7a4a00);
}
.kanban-grip {
  margin-left: auto;
  padding: 2px 6px;
  color: var(--hud-muted);
  font-size: 16px;
  line-height: 1;
  cursor: grab;
  touch-action: none; /* touch drags start here; the rest of the card scrolls the page */
}
.erp-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1200;
  max-width: min(92vw, 520px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #1b1c20;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 24px rgb(0 0 0 / 0.35);
  transform: translateX(-50%);
}
.erp-toast[data-tone='error'] {
  border-left: 4px solid #ff6b63;
}
.erp-toast[data-tone='ok'] {
  border-left: 4px solid #2fbf7a;
}
.erp-dialog {
  max-width: min(92vw, 420px);
  padding: var(--sp-3, 21px);
  border: 0;
  border-radius: var(--radius, 12px);
  background: var(--surface, #fff);
  color: var(--text-strong, var(--hud-text));
  box-shadow: 0 20px 40px rgb(0 0 0 / 0.35);
}
.erp-dialog::backdrop {
  background: rgb(20 2 8 / 0.55);
}
.erp-dialog h2 {
  margin: 0 0 4px;
  font-size: var(--fs-2, 21px);
}
.erp-dialog fieldset {
  display: grid;
  gap: 8px;
  margin: var(--sp-2, 13px) 0;
  padding: var(--sp-2, 13px);
  border: 1px solid var(--hud-border);
  border-radius: 10px;
}
.erp-dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
}
.erp-dialog menu button {
  padding: 7px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--surface, #fff);
  box-shadow: var(--raised, 0 1px 2px rgb(0 0 0 / 0.15));
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.erp-dialog menu .is-primary {
  background: var(--selected-bg, var(--accent));
  color: var(--selected-ink, #1b1c20);
  box-shadow: var(--selected, 3px 3px 0 #5c3800);
}
.erp-dialog menu button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.erp-toolbar .erp-note {
  margin: 0;
}
.erp-toolbar .erp-link {
  margin: 0 0 0 auto;
}
.erp-lead {
  margin: 0 2px var(--sp-3, 21px);
}
.erp-trends {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3, 21px);
}
.erp-trend {
  padding: var(--sp-2, 13px);
  cursor: pointer;
  transition: box-shadow var(--t-fast, 120ms) var(--ease, ease);
}
.erp-trend:hover {
  box-shadow: var(--raised-hover, var(--raised));
}
.erp-trend:active {
  box-shadow: var(--inset, none);
}
.erp-trend figure {
  margin: 0;
}
/* Kit workaround: `.kit-vibration svg` (chart size) also matches the status icon; keep it 14px. */
.erp-trend .kit-vibration .kit-icon {
  width: 14px;
  height: 14px;
}
.view-erp :is(.kanban-card, .erp-trend):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
@media (max-width: 1000px) {
  .erp-board .kit-kanban {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 1200px) {
  .erp-trends {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .erp-trends {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Phone: the board scrolls sideways, one column per swipe. */
  .erp-board .kit-kanban {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 82%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: var(--sp-1, 8px);
  }
  .erp-board .kanban-col {
    scroll-snap-align: start;
  }
}

/* Overdue (S29): a small red due date in the card corner instead of a full-width chip. */
.kanban-card {
  position: relative;
}
.kanban-card:has(.kanban-late) > b {
  padding-right: 58px; /* room for the red due date, so long titles never run under it */
}
.kanban-late {
  position: absolute;
  top: 8px;
  right: 10px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #b3261e; /* 5.6:1 on the light card */
}
.kanban-late::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
