/* =====================================================================
   MOA Specialists Dashboard — v5 (Fase 1)
   Ficha de tarea, solicitudes, roles de solo lectura, bloqueos de fechas
   y ajustes de claridad. Se carga después de styles.css.
   Colores alineados con la marca: teal #178391 protagonista, morado
   #4F1A48 para acentos de texto, naranja/carmín solo como señales.
   ===================================================================== */

:root {
  --v5-teal: #178391;
  --v5-teal-deep: #036870;
  --v5-teal-soft: #e7f5f6;
  --v5-ink: #12383d;
  --v5-muted: #5f7679;
  --v5-line: rgba(3, 104, 112, .14);
  --v5-purple: #4f1a48;
  --v5-amber: #b26a00;
  --v5-amber-soft: #fff4dc;
  --v5-red: #b3123f;
  --v5-red-soft: #fde8ee;
  --v5-green: #17733f;
  --v5-green-soft: #e3f6ea;
  --v5-radius: 16px;
  --v5-shadow: 0 24px 60px rgba(4, 52, 57, .18);
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ─── Dark heroes: the text was dark-on-dark (My Tasks, Historial, Papelera) ─── */
.view-hero--personal,
.view-hero--audit,
.view-hero--trash,
.view-hero--requests { color: #fff; }

.view-hero--personal .view-hero__copy h2,
.view-hero--audit .view-hero__copy h2,
.view-hero--trash .view-hero__copy h2,
.view-hero--requests .view-hero__copy h2 { color: #fff !important; }

.view-hero--personal .view-hero__copy p,
.view-hero--audit .view-hero__copy p,
.view-hero--trash .view-hero__copy p,
.view-hero--requests .view-hero__copy p { color: rgba(255, 255, 255, .86) !important; }

.view-hero--personal .view-hero__eyebrow,
.view-hero--audit .view-hero__eyebrow,
.view-hero--trash .view-hero__eyebrow,
.view-hero--requests .view-hero__eyebrow { color: #f9d05d !important; }

.view-hero--requests {
  background:
    radial-gradient(circle at 84% 12%, rgba(249, 176, 59, .28), transparent 30%),
    linear-gradient(135deg, #3d1538 0%, #4f1a48 45%, #178391 100%);
}

.requests-workspace { display: grid; gap: 18px; padding-top: 20px; }

/* ─── Navigation ─── */
.tab { position: relative; }
.tab__badge {
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px;
  border-radius: 999px; background: #c40847; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.tab__badge[hidden] { display: none; }

/* ─── Read-only banner (C-Level / Operaciones) ─── */
.read-only-banner {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 0 0; padding: 12px 16px;
  border: 1px solid rgba(79, 26, 72, .18); border-radius: 14px;
  background: linear-gradient(90deg, rgba(79, 26, 72, .07), rgba(23, 131, 145, .06));
  color: var(--v5-ink);
}
.read-only-banner[hidden] { display: none; }
.read-only-banner__icon { font-size: 20px; }
.read-only-banner strong { display: block; color: var(--v5-purple); }
.read-only-banner span { font-size: 13px; color: var(--v5-muted); }
body.is-read-only .subitem-mini-add,
body.is-read-only .subitem-create-row { display: none !important; }

/* ─── Load error (Q2) ─── */
.error-state { padding: 28px; justify-content: center; }
.load-error {
  display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
  width: min(760px, 100%); padding: 20px 22px;
  border: 1px solid rgba(196, 8, 71, .18); border-radius: 18px;
  background: #fff; box-shadow: 0 16px 40px rgba(4, 52, 57, .08);
}
.load-error__icon {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px; background: var(--v5-red-soft); color: var(--v5-red); font-weight: 800; font-size: 18px;
}
.load-error__copy { display: grid; gap: 3px; }
.load-error__copy strong { color: var(--v5-ink); font-size: 15px; }
.load-error__copy span { color: var(--v5-muted); font-size: 13px; }
.load-error__copy small { color: #8aa0a3; font-size: 11.5px; word-break: break-word; }
.load-error__retry {
  border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer;
  background: var(--v5-teal); color: #fff; font-weight: 700; font: inherit; font-weight: 700;
}
@media (max-width: 640px) { .load-error { grid-template-columns: 1fr; } }

/* ─── Table: ficha button, dates and locks ─── */
.task-open-detail {
  flex-shrink: 0; margin-left: auto;
  border: 1px solid var(--v5-line); border-radius: 999px; padding: 2px 9px;
  background: #fff; color: var(--v5-teal-deep); cursor: pointer;
  font: inherit; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  opacity: .55; transition: opacity .15s ease, background .15s ease;
}
tr:hover .task-open-detail,
.task-open-detail:focus-visible { opacity: 1; background: var(--v5-teal-soft); }
.task-open-detail--subitem { font-size: 11px; }

.date-range--window { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.date-range--window i { font-style: normal; color: #9bb1b3; }
.date-range--window strong { color: var(--v5-ink); font-weight: 700; }
.date-lock { font-size: 11px; margin-right: 4px; opacity: .75; }
td.locked-date-cell { cursor: pointer; }
td.locked-date-cell:hover { background: var(--v5-amber-soft); }

.audit-reason { margin-top: 6px; font-size: 12px; color: var(--v5-purple); }
.audit-task__open {
  border: 0; background: none; padding: 0; cursor: pointer; text-align: left;
  font: inherit; font-weight: 700; color: var(--v5-teal-deep); text-decoration: underline; text-underline-offset: 3px;
}

/* ─── Buttons ─── */
.moa-btn {
  border: 1px solid transparent; border-radius: 12px; padding: 9px 14px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; line-height: 1.2;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.moa-btn:active { transform: translateY(1px); }
.moa-btn--primary { background: var(--v5-teal); color: #fff; }
.moa-btn--primary:hover { background: var(--v5-teal-deep); }
.moa-btn--danger { background: var(--v5-red); color: #fff; }
.moa-btn--ghost { background: #fff; color: var(--v5-teal-deep); border-color: var(--v5-line); }
.moa-btn--ghost:hover { background: var(--v5-teal-soft); }
.moa-btn--danger-ghost { background: #fff; color: var(--v5-red); border-color: rgba(179, 18, 63, .22); }
.moa-btn--danger-ghost:hover { background: var(--v5-red-soft); }
.detail-link-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--v5-teal);
  text-decoration: underline; text-underline-offset: 3px;
}

/* ─── Task detail drawer (Ficha de tarea) ─── */
.task-detail { position: fixed; inset: 0; z-index: 900; }
.task-detail[hidden] { display: none; }
.task-detail__backdrop {
  position: absolute; inset: 0; background: rgba(6, 34, 38, .38);
  opacity: 0; transition: opacity .18s ease;
}
.task-detail__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(620px, 100vw); background: #f7fbfb;
  box-shadow: -24px 0 60px rgba(4, 52, 57, .22);
  transform: translateX(24px); opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
  display: flex; flex-direction: column; outline: none;
}
.task-detail.is-open .task-detail__backdrop { opacity: 1; }
.task-detail.is-open .task-detail__panel { transform: none; opacity: 1; }
body.has-task-detail { overflow: hidden; }

.task-detail__content { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.task-detail__head {
  position: relative; padding: 22px 24px 0; background: #fff;
  border-bottom: 1px solid var(--v5-line);
}
.task-detail__badges { display: flex; flex-wrap: wrap; gap: 6px; padding-right: 40px; }
.badge--subitem { background: #eef0f2; color: #4b5b5e; }
.task-detail__close {
  position: absolute; top: 16px; right: 16px; width: 34px; height: 34px;
  border: 1px solid var(--v5-line); border-radius: 10px; background: #fff;
  font-size: 20px; line-height: 1; cursor: pointer; color: var(--v5-ink);
}
.task-detail__close:hover { background: var(--v5-teal-soft); }
.task-detail__head h2 {
  margin: 12px 0 6px; font-size: 22px; line-height: 1.25; color: var(--v5-ink); letter-spacing: -.01em;
}
.task-detail__id { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 12px; color: var(--v5-muted); }
.task-detail__id span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.task-detail__tabs { display: flex; gap: 2px; margin-top: 16px; overflow-x: auto; }
.task-detail__tab {
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  padding: 10px 14px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--v5-muted);
  border-bottom: 2px solid transparent;
}
.task-detail__tab:hover { color: var(--v5-ink); }
.task-detail__tab.is-active { color: var(--v5-teal-deep); border-bottom-color: var(--v5-teal); }

.task-detail__body { flex: 1; overflow-y: auto; padding: 18px 24px 24px; display: grid; gap: 14px; align-content: start; }
.task-detail__footer {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  padding: 14px 24px; background: #fff; border-top: 1px solid var(--v5-line);
}

.detail-role {
  display: grid; grid-template-columns: minmax(150px, auto) 1fr; gap: 14px; align-items: start;
  padding: 14px 16px; border-radius: var(--v5-radius);
  background: var(--v5-teal-soft); border: 1px solid var(--v5-line);
}
.detail-role--readonly, .detail-role--viewer { background: #f2eef2; border-color: rgba(79, 26, 72, .14); }
.detail-role--admin { background: #fdf6e7; border-color: rgba(178, 106, 0, .18); }
.detail-role small { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--v5-muted); }
.detail-role strong { color: var(--v5-ink); font-size: 14px; }
.detail-role ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--v5-ink); display: grid; gap: 2px; }
@media (max-width: 520px) { .detail-role { grid-template-columns: 1fr; } }

.detail-card {
  background: #fff; border: 1px solid var(--v5-line); border-radius: var(--v5-radius);
  padding: 16px;
}
.detail-card__title {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px; font-size: 13px; font-weight: 800; color: var(--v5-ink);
  text-transform: uppercase; letter-spacing: .05em;
}
.detail-card__title--sub { margin-top: 16px; }
.detail-card__hint { font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--v5-muted); }

.detail-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-fact small { display: block; margin-bottom: 4px; font-size: 11.5px; color: var(--v5-muted); font-weight: 600; }
.detail-fact__value { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.detail-status-select select {
  border: 1px solid var(--v5-line); border-radius: 10px; padding: 5px 8px; background: #fff;
  font: inherit; font-size: 12.5px; color: var(--v5-ink); cursor: pointer;
}
.detail-chip {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  background: #eef4f4; color: var(--v5-ink); font-size: 12px; font-weight: 600;
}
.detail-chip--ontime, .detail-chip--complete { background: var(--v5-green-soft); color: var(--v5-green); }
.detail-chip--pending { background: var(--v5-amber-soft); color: var(--v5-amber); }
.detail-chip--delayed { background: var(--v5-red-soft); color: var(--v5-red); }
.detail-chip--missing { background: #f1f1f1; color: #6b6b6b; }
.detail-muted { color: var(--v5-muted); font-size: 13px; }

.detail-dates { display: grid; gap: 8px; }
.detail-date {
  display: grid; grid-template-columns: minmax(130px, 1fr) minmax(0, 1.4fr) auto; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: #f7fafa;
}
.detail-date--emphasis { background: var(--v5-teal-soft); }
.detail-date--empty .detail-date__value { color: #9aaeb0; font-style: italic; }
.detail-date__label { font-size: 12.5px; font-weight: 700; color: var(--v5-ink); }
.detail-date__label small { display: block; font-weight: 500; color: var(--v5-muted); font-size: 11.5px; }
.detail-date__value { font-size: 14px; font-weight: 700; color: var(--v5-ink); }
.detail-date__action { text-align: right; }
.detail-add-milestone {
  border: 1px dashed rgba(3, 104, 112, .3); border-radius: 12px; padding: 9px; background: none;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--v5-teal-deep); cursor: pointer;
}
.detail-add-milestone:hover { background: var(--v5-teal-soft); }
@media (max-width: 520px) {
  .detail-date { grid-template-columns: 1fr auto; }
  .detail-date__label { grid-column: 1 / -1; }
}

.detail-people { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 0; }
.detail-meta dt { font-size: 11.5px; color: var(--v5-muted); font-weight: 600; }
.detail-meta dd { margin: 2px 0 0; font-size: 12.5px; color: var(--v5-ink); word-break: break-word; }
@media (max-width: 520px) { .detail-meta { grid-template-columns: 1fr; } .detail-facts { grid-template-columns: 1fr; } }
.detail-text { margin: 0; font-size: 14px; line-height: 1.6; color: var(--v5-ink); white-space: pre-wrap; }

.detail-related-list { display: grid; gap: 6px; }
.detail-related {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 1px solid var(--v5-line); border-radius: 12px; background: #fff;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--v5-ink); cursor: pointer; text-align: left;
}
.detail-related:hover { background: var(--v5-teal-soft); }

.detail-intro { margin: 0; font-size: 13px; color: var(--v5-muted); }
.detail-empty {
  display: grid; justify-items: center; gap: 6px; padding: 28px 16px; text-align: center;
  border: 1px dashed var(--v5-line); border-radius: var(--v5-radius); color: var(--v5-muted); font-size: 13px;
}
.detail-empty strong { color: var(--v5-ink); }
.detail-empty--error strong { color: var(--v5-red); }
.detail-empty .spinner { width: 22px; height: 22px; }

.detail-checkpoints { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.detail-checkpoint {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--v5-line);
}
.detail-checkpoint strong { display: block; font-size: 13.5px; color: var(--v5-ink); }
.detail-checkpoint small { color: var(--v5-muted); font-size: 12px; }
.detail-checkpoint__num {
  width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  background: #eef4f4; color: var(--v5-ink); font-weight: 800; font-size: 13px;
}
.detail-checkpoint__state { font-size: 12px; font-weight: 700; text-align: right; }
.detail-checkpoint--good .detail-checkpoint__num { background: var(--v5-green-soft); color: var(--v5-green); }
.detail-checkpoint--good .detail-checkpoint__state { color: var(--v5-green); }
.detail-checkpoint--delayed .detail-checkpoint__num { background: var(--v5-red-soft); color: var(--v5-red); }
.detail-checkpoint--delayed .detail-checkpoint__state { color: var(--v5-red); }
.detail-checkpoint--pending { border-color: rgba(178, 106, 0, .35); }
.detail-checkpoint--pending .detail-checkpoint__num { background: var(--v5-amber-soft); color: var(--v5-amber); }
.detail-checkpoint--pending .detail-checkpoint__state { color: var(--v5-amber); }
.detail-checkpoint--future .detail-checkpoint__state { color: var(--v5-muted); }
.detail-wide-btn { width: 100%; }

.detail-timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--v5-line); display: grid; gap: 14px; }
.detail-timeline li { position: relative; padding-left: 8px; }
.detail-timeline li::before {
  content: ""; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--v5-teal); box-shadow: 0 0 0 3px #f7fbfb;
}
.detail-timeline__head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.detail-timeline__head strong { font-size: 13.5px; color: var(--v5-ink); }
.detail-timeline__head time { font-size: 11.5px; color: var(--v5-muted); white-space: nowrap; }
.detail-timeline small { color: var(--v5-muted); font-size: 12px; }
.detail-timeline__change {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px;
  font-size: 12.5px; color: var(--v5-ink);
}
.detail-timeline__change span { padding: 3px 8px; border-radius: 8px; background: #eef4f4; max-width: 100%; overflow-wrap: anywhere; }
.detail-timeline__change span:last-child { background: var(--v5-teal-soft); font-weight: 600; }
.detail-timeline__change i { font-style: normal; color: var(--v5-muted); }
.detail-timeline__reason { margin-top: 6px; font-size: 12.5px; color: var(--v5-purple); }

.detail-request-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ─── Requests (cards + view) ─── */
.requests-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.requests-filter {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--v5-line); border-radius: 999px; padding: 8px 14px; background: #fff;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--v5-ink); cursor: pointer;
}
.requests-filter b { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: #eef4f4; font-size: 11.5px; text-align: center; }
.requests-filter.is-active { background: var(--v5-teal); border-color: var(--v5-teal); color: #fff; }
.requests-filter.is-active b { background: rgba(255,255,255,.22); color: #fff; }
.requests-refresh {
  margin-left: auto; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--v5-teal-deep);
}

.request-list { display: grid; gap: 10px; }
.request-list--grid { grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); }
.request-card {
  display: grid; gap: 10px; padding: 16px; border-radius: var(--v5-radius);
  background: #fff; border: 1px solid var(--v5-line); box-shadow: 0 10px 28px rgba(4, 52, 57, .05);
}
.request-card--pending { border-left: 4px solid #f9b03b; }
.request-card--approved { border-left: 4px solid var(--v5-green); }
.request-card--rejected { border-left: 4px solid var(--v5-red); }
.request-card__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.request-card__type { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--v5-purple); }
.request-status { padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.request-status--pending { background: var(--v5-amber-soft); color: var(--v5-amber); }
.request-status--approved { background: var(--v5-green-soft); color: var(--v5-green); }
.request-status--rejected { background: var(--v5-red-soft); color: var(--v5-red); }
.request-status--muted { background: #eef0f0; color: #6b6b6b; }
.request-card__task {
  border: 0; background: none; padding: 0; text-align: left; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 800; color: var(--v5-ink);
}
.request-card__task:hover { color: var(--v5-teal-deep); text-decoration: underline; }
.request-card__reason { margin: 0; font-size: 13px; color: var(--v5-ink); line-height: 1.5; }
.request-card__meta { display: grid; gap: 2px; font-size: 12px; color: var(--v5-muted); }
.request-card__actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.moa-compare {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: #f3f7f7;
}
.moa-compare span { font-size: 11.5px; font-weight: 700; color: var(--v5-muted); text-transform: uppercase; letter-spacing: .05em; }
.moa-compare strong { font-size: 14px; color: var(--v5-ink); }
.moa-compare--inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.moa-compare--inline span { flex-basis: 100%; }
.moa-compare--inline i { font-style: normal; color: var(--v5-muted); }
.moa-compare .is-new { color: var(--v5-teal-deep); }

/* ─── Dialog ─── */
.moa-dialog { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 16px; }
.moa-dialog__backdrop { position: absolute; inset: 0; background: rgba(6, 34, 38, .45); }
.moa-dialog__card {
  position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: #fff; border-radius: 20px; padding: 22px; box-shadow: var(--v5-shadow);
  display: grid; gap: 14px;
}
.moa-dialog__card--danger { border-top: 4px solid var(--v5-red); }
.moa-dialog__card--primary { border-top: 4px solid var(--v5-teal); }
.moa-dialog__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.moa-dialog__head h2 { margin: 0; font-size: 18px; color: var(--v5-ink); line-height: 1.3; }
.moa-dialog__close { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--v5-muted); }
.moa-dialog__intro { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--v5-muted); }
.moa-dialog__intro strong { color: var(--v5-ink); }
.moa-dialog__list { margin: 8px 0 0; padding-left: 18px; color: var(--v5-ink); }
.moa-dialog__fields { display: grid; gap: 12px; }
.moa-field { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--v5-ink); }
.moa-field em { font-style: normal; font-weight: 600; font-size: 11px; color: var(--v5-red); margin-left: 4px; }
.moa-field input, .moa-field textarea {
  width: 100%; border: 1px solid rgba(3, 104, 112, .22); border-radius: 12px; padding: 10px 12px;
  font: inherit; font-weight: 500; font-size: 14px; color: var(--v5-ink); background: #fbfdfd;
}
.moa-field input:focus, .moa-field textarea:focus { outline: 2px solid rgba(23, 131, 145, .35); border-color: var(--v5-teal); }
.moa-field__hint { font-weight: 500; font-size: 12px; color: var(--v5-muted); }
.moa-field__range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.moa-field__range label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--v5-muted); }
.moa-field--info { font-weight: 500; }
.moa-dialog__error {
  margin: 0; padding: 9px 12px; border-radius: 10px; background: var(--v5-red-soft); color: var(--v5-red);
  font-size: 13px; font-weight: 600;
}
.moa-dialog__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ─── Create form: lock note + milestones ─── */
.date-lock-note {
  display: flex; gap: 10px; align-items: flex-start; margin: 14px 0;
  padding: 12px 14px; border-radius: 14px; background: var(--v5-amber-soft); border: 1px solid rgba(178, 106, 0, .18);
}
.date-lock-note p { margin: 0; font-size: 13px; line-height: 1.5; color: #6b4300; }
.date-lock-note strong { color: #5a3700; }
#submit-horizon-row[hidden] { display: none; }
.milestone-field__row { display: flex; gap: 8px; align-items: center; }
.milestone-remove {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--v5-line);
  background: #fff; cursor: pointer; font-size: 18px; color: var(--v5-muted);
}
.deadline-add-button:disabled { opacity: .45; cursor: not-allowed; }

/* ─── Toast: "info" tone used by new flows ─── */
.toast--info { background: var(--v5-ink) !important; color: #fff !important; }

/* The work-window date row must really disappear for PERPETUAL tasks. */
#submit-date-row[hidden],
.form-row[hidden] { display: none !important; }
.error-state .load-error span,
.error-state .load-error small {
  background: none !important; border: 0 !important; padding: 0 !important;
  text-align: left !important; box-shadow: none !important; display: block;
}
.error-state .load-error__icon { display: grid !important; }
.error-state .load-error__icon { background: var(--v5-red-soft) !important; width: 40px; height: 40px; place-items: center; }

/* =====================================================================
   v5.1 — Fases 2 y 3: flujos, checkpoints por persona, entregables
   ===================================================================== */

/* ─── "Más" tab group ─── */
.tab-more { position: relative; display: inline-flex; }
.tab-more__chevron { margin-left: 2px; opacity: .6; }
.tab-more__panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 400; min-width: 210px;
  display: grid; gap: 2px; padding: 6px; border-radius: 14px; background: #fff;
  border: 1px solid var(--v5-line); box-shadow: var(--v5-shadow);
}
.tab-more__panel[hidden] { display: none; }
.tab-more__panel .tab { justify-content: flex-start; width: 100%; }
.tab-more__panel .tab[hidden] { display: none !important; }

/* ─── Heroes for the new views ─── */
.view-hero--deliverables,
.view-hero--archive,
.view-hero--settings { color: #fff; }
.view-hero--deliverables { background: radial-gradient(circle at 84% 12%, rgba(249, 208, 93, .30), transparent 30%), linear-gradient(135deg, #036870 0%, #178391 60%, #2aa6b0 100%); }
.view-hero--archive { background: radial-gradient(circle at 84% 12%, rgba(255,255,255,.16), transparent 30%), linear-gradient(135deg, #2c3e41 0%, #3f5b5f 55%, #178391 100%); }
.view-hero--settings { background: radial-gradient(circle at 84% 12%, rgba(249, 176, 59, .26), transparent 30%), linear-gradient(135deg, #4f1a48 0%, #6d2f64 50%, #82647f 100%); }
:is(.view-hero--deliverables, .view-hero--archive, .view-hero--settings) .view-hero__copy h2 { color: #fff !important; }
:is(.view-hero--deliverables, .view-hero--archive, .view-hero--settings) .view-hero__copy p { color: rgba(255,255,255,.86) !important; }
:is(.view-hero--deliverables, .view-hero--archive, .view-hero--settings) .view-hero__eyebrow { color: #f9d05d !important; }
.view-hero__count { font-size: .5em; padding: 2px 10px; border-radius: 999px; background: rgba(255,255,255,.18); vertical-align: middle; }

/* ─── Chips ─── */
.flow-chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #eef4f4; color: var(--v5-ink); white-space: nowrap; }
.flow-chip--good { background: var(--v5-green-soft); color: var(--v5-green); }
.flow-chip--warn { background: var(--v5-amber-soft); color: var(--v5-amber); }
.flow-chip--bad { background: var(--v5-red-soft); color: var(--v5-red); }
.flow-chip--info { background: var(--v5-teal-soft); color: var(--v5-teal-deep); }
.flow-chip--muted { background: #f0f1f1; color: #7b8587; }
.flow-link { font-size: 12.5px; font-weight: 700; color: var(--v5-teal); text-decoration: underline; text-underline-offset: 3px; }

/* ─── My Tasks: "Tu siguiente paso" ─── */
.flow-actions { background: #fff; border: 1px solid var(--v5-line); border-radius: 20px; padding: 18px 20px; box-shadow: 0 13px 34px rgba(4, 63, 69, .06); }
.flow-actions[hidden] { display: none; }
.flow-actions__head p { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--v5-teal); }
.flow-actions__head h3 { margin: 2px 0 12px; font-size: 18px; color: var(--v5-ink); }
.flow-actions__list { display: grid; gap: 8px; }
.flow-action {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; width: 100%;
  padding: 11px 14px; border-radius: 14px; border: 1px solid var(--v5-line); background: #fbfdfd;
  font: inherit; text-align: left; cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.flow-action:hover { background: var(--v5-teal-soft); border-color: rgba(23,131,145,.3); }
.flow-action__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--v5-teal); }
.flow-action--urgent .flow-action__dot { background: #c40847; box-shadow: 0 0 0 4px rgba(196,8,71,.12); }
.flow-action__main strong { display: block; font-size: 13.5px; color: var(--v5-ink); }
.flow-action__main small { color: var(--v5-muted); font-size: 12px; }
.flow-action__due { font-size: 12px; font-weight: 700; color: var(--v5-muted); white-space: nowrap; }
.flow-action__due.is-late { color: var(--v5-red); }
.flow-action__go { color: var(--v5-teal); font-weight: 800; }
.flow-actions__empty, .flow-actions__more { margin: 0; font-size: 13px; color: var(--v5-muted); }
@media (max-width: 640px) { .flow-action { grid-template-columns: auto 1fr auto; } .flow-action__due { grid-column: 2; } }

/* ─── Ficha: Flujo ─── */
.flow-stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; }
.flow-step { flex: 1 1 0; min-width: 86px; display: grid; justify-items: center; gap: 6px; text-align: center; position: relative; }
.flow-step::before { content: ""; position: absolute; top: 14px; left: -50%; width: 100%; height: 2px; background: var(--v5-line); z-index: 0; }
.flow-step:first-child::before { display: none; }
.flow-step span { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: #eef2f2; color: #7b8587; }
.flow-step small { font-size: 11px; line-height: 1.3; color: var(--v5-muted); font-weight: 600; }
.flow-step--done span { background: var(--v5-teal); color: #fff; }
.flow-step--done::before, .flow-step--current::before { background: var(--v5-teal); }
.flow-step--current span { background: #fff; color: var(--v5-teal-deep); box-shadow: 0 0 0 3px var(--v5-teal); }
.flow-step--current small { color: var(--v5-ink); font-weight: 800; }
.flow-step--skipped span { background: #f4f4f4; color: #b0b7b8; text-decoration: line-through; }

.flow-status { display: grid; gap: 10px; border-left: 4px solid var(--v5-teal); }
.flow-status--waiting_base_document, .flow-status--awaiting_confirmations { border-left-color: #f9b03b; }
.flow-status--archived, .flow-status--implemented { border-left-color: var(--v5-green); }
.flow-status--cancelled { border-left-color: #9aa5a7; }
.flow-status__main { display: grid; gap: 2px; }
.flow-status__main small { font-size: 11.5px; font-weight: 700; color: var(--v5-muted); text-transform: uppercase; letter-spacing: .05em; }
.flow-status__main strong { font-size: 18px; color: var(--v5-ink); }
.flow-status__main span { font-size: 13px; color: var(--v5-ink); }
.flow-blockers { margin: 0; padding: 10px 12px 10px 28px; border-radius: 12px; background: var(--v5-amber-soft); color: #6b4300; font-size: 13px; display: grid; gap: 3px; }
.flow-mine { padding: 10px 12px; border-radius: 12px; background: var(--v5-teal-soft); font-size: 13px; color: var(--v5-ink); }

.flow-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.flow-row + .flow-row { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--v5-line); }
.flow-row small { color: var(--v5-muted); font-size: 12px; }

.flow-people { display: grid; gap: 8px; }
.flow-person { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: #f7fafa; }
.flow-person--inactive { opacity: .7; }
.flow-person strong { display: block; font-size: 13.5px; color: var(--v5-ink); }
.flow-person small { font-size: 12px; color: var(--v5-muted); }
.flow-person__state { display: grid; justify-items: end; gap: 3px; }
.flow-person__reason { max-width: 260px; text-align: right; color: var(--v5-red) !important; }
.flow-person__actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.flow-person__actions:empty { display: none; }

.flow-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.flow-stage { padding: 12px; border-radius: 14px; border: 1px solid var(--v5-line); background: #fff; display: grid; gap: 8px; }
.flow-stage--active, .flow-stage--correction, .flow-stage--revalidation { border-color: rgba(23,131,145,.45); box-shadow: 0 0 0 3px rgba(23,131,145,.08); }
.flow-stage--done { background: #f8fcfa; }
.flow-stage--locked, .flow-stage--skipped { background: #fafbfb; }
.flow-stage__head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.flow-stage__num { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: #eef4f4; font-weight: 800; font-size: 12.5px; color: var(--v5-ink); }
.flow-stage--done .flow-stage__num { background: var(--v5-green-soft); color: var(--v5-green); }
.flow-stage__title strong { display: block; font-size: 13.5px; color: var(--v5-ink); }
.flow-stage__title small { font-size: 12px; color: var(--v5-muted); }
.flow-stage__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.flow-stage__actions:empty { display: none; }
.flow-round { font-size: 12.5px; padding: 7px 10px; border-radius: 10px; background: var(--v5-amber-soft); color: #6b4300; }
.flow-round--done { background: #f1f4f4; color: var(--v5-muted); }

/* ─── Checkpoints & deliverables lists ─── */
.cp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cp-row, .dl-row { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: center; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--v5-line); }
.cp-row--missed { border-left: 4px solid var(--v5-red); }
.cp-row--pending { border-left: 4px solid #f9b03b; }
.cp-row--on_time { border-left: 4px solid var(--v5-green); }
.cp-row--late { border-left: 4px solid var(--v5-amber); }
.cp-row__main strong, .dl-row__main strong { display: block; font-size: 13.5px; color: var(--v5-ink); }
.cp-row__main small, .dl-row__main small { font-size: 12px; color: var(--v5-muted); }
.cp-row__answer { margin-top: 6px; font-size: 12.5px; color: var(--v5-ink); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cp-row__answer a { color: var(--v5-teal); font-weight: 700; }
.cp-row__side { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.dl-row__main { display: grid; gap: 2px; justify-items: start; }
@media (max-width: 560px) { .cp-row, .dl-row { grid-template-columns: 1fr; } .cp-row__side { justify-content: flex-start; } }

.cp-list--board { gap: 10px; }
.cp-board-row { display: grid; gap: 6px; }
.cp-board-row__task { justify-self: start; border: 0; background: none; padding: 0 2px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 800; color: var(--v5-teal-deep); text-align: left; }
.cp-board-row__task span { margin-right: 8px; font-size: 10.5px; letter-spacing: .06em; color: var(--v5-muted); }
.cp-board-row__task:hover { text-decoration: underline; }
.cp-row--inline { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: center; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--v5-line); }

#timeline-overview:has(.cp-filter) { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cp-filter {
  display: grid; gap: 2px; text-align: left; padding: 14px; border-radius: 16px; cursor: pointer;
  border: 1px solid var(--v5-line); background: #fff; font: inherit; color: var(--v5-ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cp-filter strong { font-size: 24px; line-height: 1; }
.cp-filter span { font-size: 13px; font-weight: 700; }
.cp-filter small { font-size: 11.5px; color: var(--v5-muted); }
.cp-filter.is-active { border-color: var(--v5-teal); box-shadow: 0 0 0 3px rgba(23,131,145,.14); }
.cp-filter--missed strong { color: var(--v5-red); }
.cp-filter--today strong, .cp-filter--attention strong { color: var(--v5-amber); }
.checkpoint-explainer--v5 strong { font-size: 12px; letter-spacing: .04em; }

/* ─── Findings ─── */
.finding-list { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; color: var(--v5-ink); }

/* ─── Settings ─── */
.settings-root { display: grid; gap: 14px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.settings-grid select, .settings-holiday-add input { width: 100%; border: 1px solid rgba(3,104,112,.22); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 14px; background: #fbfdfd; }
.moa-field select { width: 100%; border: 1px solid rgba(3,104,112,.22); border-radius: 12px; padding: 10px 12px; font: inherit; font-weight: 500; font-size: 14px; color: var(--v5-ink); background: #fbfdfd; }
.settings-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.settings-holiday-add { display: grid; grid-template-columns: 180px 1fr auto; gap: 10px; align-items: end; margin-bottom: 12px; }
@media (max-width: 640px) { .settings-holiday-add { grid-template-columns: 1fr; } }
.holiday-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 360px; overflow-y: auto; }
.holiday-list li { display: grid; grid-template-columns: 130px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: #f7fafa; font-size: 13px; }
.holiday-list li.is-off { opacity: .5; text-decoration: line-through; }
.holiday-list small { color: var(--v5-muted); }

/* ─── Create form: flow section ─── */
.submit-section--flow[hidden] { display: none; }
.flow-radios { display: flex; flex-wrap: wrap; gap: 10px; }
.flow-radio { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--v5-line); border-radius: 12px; background: #fff; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--v5-ink); }
.flow-radio small { font-weight: 500; color: var(--v5-muted); }
.flow-radio:has(input:checked) { border-color: var(--v5-teal); background: var(--v5-teal-soft); }
.flow-people-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.flow-person-chip { display: grid; padding: 8px 12px; border-radius: 12px; background: #f4f8f8; border: 1px solid var(--v5-line); }
.flow-person-chip strong { font-size: 13px; color: var(--v5-ink); }
.flow-person-chip small { font-size: 11.5px; color: var(--v5-muted); }
.flow-manual-dates { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important; }
.flow-project-preview { margin: 12px 0; }
.flow-preview { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: stage; }
.flow-preview li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 10px; background: #f4f8f8; font-size: 13px; }
.flow-preview li strong { color: var(--v5-ink); }
.flow-preview li span { color: var(--v5-teal-deep); font-weight: 700; white-space: nowrap; }
.flow-preview-error { padding: 10px 12px; border-radius: 10px; background: var(--v5-red-soft); color: var(--v5-red); font-size: 13px; font-weight: 600; }
.flow-preview-warn { margin-top: 8px; padding: 9px 12px; border-radius: 10px; background: var(--v5-amber-soft); color: #6b4300; font-size: 12.5px; }
.flow-confirm { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--v5-teal-soft); font-size: 13px; line-height: 1.5; color: var(--v5-ink); cursor: pointer; }
.flow-confirm input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--v5-teal); }
.flow-info { padding: 12px 14px; border-radius: 14px; background: var(--v5-teal-soft); font-size: 13.5px; color: var(--v5-ink); line-height: 1.5; }
.flow-perpetual-rows { display: grid; gap: 8px; margin: 10px 0; }
.flow-perpetual-row { display: grid; grid-template-columns: 1fr 180px auto; gap: 8px; }
.flow-perpetual-row input { border: 1px solid rgba(3,104,112,.22); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 14px; background: #fbfdfd; }
@media (max-width: 560px) { .flow-perpetual-row { grid-template-columns: 1fr auto; } .flow-perpetual-row input[type=date] { grid-column: 1; } }

/* Calendar markers for the new item types */
.calendar-card--holiday, .lane-chip--holiday { background: #fdecef !important; color: #8a1238 !important; }
.flow-stepper { min-height: 64px; flex-shrink: 0; padding: 4px 2px; }
.task-detail__tab { padding: 10px 11px; font-size: 13px; }
.checkpoint-explainer--v5 > div { display: flex; align-items: center; gap: 10px; }
.checkpoint-explainer--v5 strong {
  width: auto !important; height: auto !important; min-width: 0 !important; border-radius: 999px !important;
  padding: 6px 12px !important; font-size: 11px !important; line-height: 1 !important; white-space: nowrap;
}
.checkpoint-shell:has(.cp-filter) .checkpoint-legend { display: none !important; }
.cp-task-group { display: grid; gap: 8px; padding: 14px; border-radius: 18px; background: rgba(255,255,255,.7); border: 1px solid var(--v5-line); }
.cp-task-group__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.flow-radio input[type=radio],
.flow-confirm input[type=checkbox] {
  appearance: auto !important; -webkit-appearance: auto !important;
  width: 16px !important; height: 16px !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important;
  border: 0 !important; box-shadow: none !important; background: none !important; flex: 0 0 auto; accent-color: var(--v5-teal);
}
.flow-radio { padding: 9px 14px; }
.flow-radio span { line-height: 1.35; }

/* ═══════════════════════ Fase 4 · KPIs semanales ═══════════════════════ */
.kpi-weekly { display: grid; gap: 16px; margin-top: 18px; }
.kpi-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border: 1px solid var(--v5-line); border-radius: var(--v5-radius); padding: 12px 14px;
}
.kpi-toolbar__week { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.kpi-toolbar__week small { display: block; font-size: 11px; color: var(--v5-muted); font-weight: 600; }
.kpi-toolbar__week strong { font-size: 15px; color: var(--v5-ink); }
.kpi-toolbar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.kpi-toolbar__person { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--v5-muted); font-weight: 600; }
.kpi-toolbar__person select { border: 1px solid var(--v5-line); border-radius: 10px; padding: 7px 10px; font: inherit; color: var(--v5-ink); background: #fff; max-width: 280px; }
.kpi-nav {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--v5-line); background: #fff;
  font-size: 20px; line-height: 1; color: var(--v5-teal-deep); cursor: pointer;
}
.kpi-nav:hover:not(:disabled) { background: var(--v5-teal-soft); }
.kpi-nav:disabled { opacity: .35; cursor: default; }
.kpi-note { border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.5; }
.kpi-note--warn { background: var(--v5-amber-soft); color: #6b4000; border: 1px solid rgba(178,106,0,.2); }

.kpi-team__scroll, .kpi-drill__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.kpi-team__table { width: 100%; border-collapse: separate; border-spacing: 0 6px; min-width: 640px; }
.kpi-team__table thead th { text-align: center; font-size: 12px; color: var(--v5-ink); font-weight: 800; padding: 4px 6px; }
.kpi-team__table thead th:first-child { text-align: left; }
.kpi-team__table thead small { display: block; font-weight: 500; color: var(--v5-muted); font-size: 11px; }
.kpi-team__table tbody tr { cursor: pointer; }
.kpi-team__table tbody tr:hover th, .kpi-team__table tbody tr:focus th { color: var(--v5-teal-deep); }
.kpi-team__table tbody th { text-align: left; padding: 8px 10px; background: #f7fbfb; border-radius: 10px 0 0 10px; }
.kpi-team__table tbody th strong { display: block; font-size: 13.5px; }
.kpi-team__table tbody th small { color: var(--v5-muted); font-weight: 500; font-size: 11.5px; }
.kpi-cell { text-align: center; padding: 8px 6px; background: #f7fbfb; font-size: 13px; }
.kpi-cell:last-child { border-radius: 0 10px 10px 0; }
.kpi-cell strong { display: block; font-size: 14px; }
.kpi-cell small { display: block; font-size: 10.5px; opacity: .8; }
.kpi-cell--good { background: var(--v5-green-soft); color: var(--v5-green); }
.kpi-cell--bad { background: var(--v5-red-soft); color: var(--v5-red); }
.kpi-cell--muted { color: #8a9496; }
.kpi-cell--soon { color: var(--v5-teal-deep); font-size: 12px; font-weight: 600; }
.kpi-history__table { border-collapse: separate; border-spacing: 4px; min-width: 560px; width: 100%; }
.kpi-history__table th { font-size: 12px; color: var(--v5-muted); text-align: center; font-weight: 700; }
.kpi-history__table tbody th { text-align: left; color: var(--v5-ink); }
.kpi-history__table .kpi-cell { border-radius: 8px; font-weight: 700; }
.kpi-history__table .is-current { font-weight: 800; text-decoration: underline; }

.kpi-person { display: grid; gap: 16px; }
.kpi-person__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.kpi-person__head h3 { margin: 0; font-size: 20px; color: var(--v5-ink); }
.kpi-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  background: #fff; border: 1px solid var(--v5-line); border-radius: var(--v5-radius); padding: 14px 14px 12px;
  border-top: 4px solid #cfd8d9;
}
.kpi-card--good { border-top-color: var(--v5-green); }
.kpi-card--bad { border-top-color: var(--v5-red); }
.kpi-card--soon { border-top-color: var(--v5-teal); background: linear-gradient(180deg, #f6fbfb, #fff); }
.kpi-card.is-open { box-shadow: 0 0 0 2px var(--v5-teal) inset; }
.kpi-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-card__code { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--v5-muted); }
.kpi-card h4 { margin: 0; font-size: 14px; color: var(--v5-ink); line-height: 1.3; min-height: 36px; }
.kpi-card__value { font-size: 30px; font-weight: 800; color: var(--v5-ink); letter-spacing: -.02em; }
.kpi-card--good .kpi-card__value { color: var(--v5-green); }
.kpi-card--bad .kpi-card__value { color: var(--v5-red); }
.kpi-card__bar { height: 6px; border-radius: 99px; background: #edf2f2; overflow: hidden; }
.kpi-card__bar span { display: block; height: 100%; border-radius: inherit; background: var(--v5-teal); }
.kpi-card--good .kpi-card__bar span { background: var(--v5-green); }
.kpi-card--bad .kpi-card__bar span { background: var(--v5-red); }
.kpi-card__target { margin: 0; font-size: 12.5px; color: var(--v5-muted); }
.kpi-card__note { margin: 0; font-size: 12px; color: var(--v5-muted); line-height: 1.4; }
.kpi-card__why {
  margin-top: auto; align-self: flex-start; border: 0; background: none; padding: 4px 0;
  color: var(--v5-teal-deep); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; text-decoration: underline;
}
.kpi-drill h5 { margin: 14px 0 6px; font-size: 12.5px; color: var(--v5-ink); text-transform: uppercase; letter-spacing: .04em; }
.kpi-drill__formula, .kpi-drill__result { margin: 0 0 8px; font-size: 13px; line-height: 1.5; color: var(--v5-ink); }
.kpi-drill__private { margin: 8px 0 0; font-size: 12px; color: var(--v5-muted); }
.kpi-drill__table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 520px; }
.kpi-drill__table th { text-align: left; font-size: 11.5px; color: var(--v5-muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--v5-line); }
.kpi-drill__table td { padding: 7px 8px; border-bottom: 1px solid #eef3f3; vertical-align: middle; }
.kpi-drill__surveys { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.kpi-drill__surveys li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: #f7fbfb; font-size: 13px; }
.kpi-drill__surveys small { color: var(--v5-muted); }
.kpi-manual__form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.kpi-manual__wide, .settings-grid__wide { grid-column: 1 / -1; }
.kpi-manual__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin: 0 0 8px; }
.kpi-manual__list dt { font-size: 11.5px; color: var(--v5-muted); }
.kpi-manual__list dd { margin: 0; font-weight: 800; font-size: 16px; color: var(--v5-ink); }
.kpi-legend, .kpi-legacy {
  background: #fff; border: 1px solid var(--v5-line); border-radius: var(--v5-radius); padding: 12px 14px; font-size: 13px; color: var(--v5-ink);
}
.kpi-legend summary, .kpi-legacy summary { cursor: pointer; font-weight: 700; color: var(--v5-teal-deep); }
.kpi-legend ul { margin: 10px 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.kpi-legend li { line-height: 1.5; }
.kpi-legend p { margin: 6px 0 0; line-height: 1.5; color: var(--v5-muted); }
.kpi-legacy { margin-top: 16px; }
.kpi-legacy .kpi-grid { margin-top: 12px; }

/* ═══════════════════════ Fase 5 · Encuestas ═══════════════════════ */
.view-hero--surveys { color: #fff; background: radial-gradient(circle at 84% 12%, rgba(249, 208, 93, .28), transparent 30%), linear-gradient(135deg, #12383d 0%, #036870 55%, #4f1a48 100%); }
.view-hero--surveys .view-hero__copy h2 { color: #fff !important; }
.view-hero--surveys .view-hero__copy p { color: rgba(255,255,255,.86) !important; }
.view-hero--surveys .view-hero__eyebrow { color: #f9d05d !important; }
.surveys-root { display: grid; gap: 16px; margin-top: 18px; }
.survey-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.survey-card {
  display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px;
  background: #fff; border: 1px solid var(--v5-line); border-left: 4px solid var(--v5-teal);
}
.survey-card--descending { border-left-color: var(--v5-green); }
.survey-card--ascending { border-left-color: var(--v5-amber); }
.survey-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.survey-card h4 { margin: 0; font-size: 15px; font-weight: 600; color: var(--v5-ink); }
.survey-card p { margin: 0; font-size: 12.5px; color: var(--v5-muted); min-height: 18px; }
.survey-card .moa-btn { align-self: flex-start; }
.survey-card__due { font-size: 12px; color: var(--v5-muted); font-weight: 600; }
.survey-card__due.is-late { color: var(--v5-red); }
.survey-admin-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.survey-admin-top__card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--v5-radius); background: #fff; border: 1px solid var(--v5-line);
}
.survey-admin-top__card.is-due { background: var(--v5-amber-soft); border-color: rgba(178,106,0,.25); }
.survey-admin-top__card small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--v5-muted); font-weight: 700; }
.survey-admin-top__card strong { display: block; font-size: 15px; color: var(--v5-ink); margin: 2px 0; }
.survey-admin-top__card span { font-size: 12.5px; color: var(--v5-muted); }
.survey-cycle { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid #eef3f3; }
.survey-cycle:first-of-type { border-top: 0; padding-top: 0; }
.survey-cycle header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.survey-cycle header strong { font-size: 14px; color: var(--v5-ink); margin-right: 4px; }
.survey-cycle__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.survey-progress { height: 6px; border-radius: 99px; background: #edf2f2; overflow: hidden; max-width: 420px; }
.survey-progress span { display: block; height: 100%; background: var(--v5-teal); border-radius: inherit; }
.survey-form { max-width: 640px; }
.survey-questions { margin: 0 0 12px; padding: 0 0 0 18px; display: grid; gap: 14px; max-height: min(56vh, 520px); overflow-y: auto; }
.survey-questions li p { margin: 0 0 6px; font-size: 13.5px; color: var(--v5-ink); line-height: 1.4; }
.survey-scale { display: flex; flex-wrap: wrap; gap: 6px; }
.survey-scale label { position: relative; }
.survey-scale input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.survey-scale span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 38px; padding: 0 10px;
  border-radius: 10px; border: 1px solid var(--v5-line); background: #fff; font-weight: 700; color: var(--v5-ink); cursor: pointer;
}
.survey-scale input:focus-visible + span { outline: 2px solid var(--v5-teal); outline-offset: 2px; }
.survey-scale input:checked + span { background: var(--v5-teal); border-color: var(--v5-teal); color: #fff; }
.survey-scale__na span { color: var(--v5-muted); font-weight: 600; }
.survey-scale__na input:checked + span { background: #5f7679; border-color: #5f7679; }
.survey-result { padding: 10px 0; border-top: 1px solid #eef3f3; text-align: left; }
.survey-result ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.survey-result li { display: flex; gap: 8px; justify-content: space-between; font-size: 12.5px; }
.survey-result li span { flex: 1; }
.survey-result li small { color: var(--v5-muted); }
.survey-result__comments { margin-top: 8px; }
.survey-result__comments small { font-weight: 700; color: var(--v5-muted); }
.survey-result blockquote { margin: 6px 0 0; padding: 6px 10px; border-left: 3px solid var(--v5-teal); background: #f7fbfb; font-size: 12.5px; }
.flow-action--survey .flow-action__dot { background: #4f1a48; }
.settings-questions { padding: 10px 0; border-top: 1px solid #eef3f3; }
.settings-questions h4 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 13px; }
.settings-questions h4 small { font-weight: 500; color: var(--v5-muted); }
.settings-questions ol { margin: 0 0 6px; padding-left: 20px; display: grid; gap: 4px; }
.settings-questions li { font-size: 13px; }
.settings-questions li span { margin-right: 6px; }
.settings-questions li small { color: var(--v5-muted); margin-right: 6px; }

@media (max-width: 640px) {
  .kpi-toolbar { flex-direction: column; align-items: stretch; }
  .kpi-toolbar__person select { max-width: none; width: 100%; }
  .kpi-card__value { font-size: 26px; }
  .survey-scale span { min-width: 36px; height: 36px; }
}
/* Phone width: nothing may push the page sideways */
.kpi-weekly > *, .kpi-person > *, .surveys-root > * { min-width: 0; }
.kpi-cards { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.survey-list { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
.survey-admin-top { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.kpi-manual__form { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.kpi-manual__form .settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
:is(.view-hero--settings, .view-hero--surveys, .view-hero--deliverables, .view-hero--archive) { box-sizing: border-box; max-width: 100%; overflow: hidden; }
.settings-questions li .detail-link-btn { margin-left: 8px; }
.requests-workspace { grid-template-columns: minmax(0, 1fr); }
.requests-workspace > * { min-width: 0; }
.settings-root { grid-template-columns: minmax(0, 1fr); }
.settings-root > * { min-width: 0; }
.settings-grid { grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); }
.settings-grid input, .settings-grid select { max-width: 100%; box-sizing: border-box; }

/* ═══════════════════════ Fase 6 · Cola de revisión (KPI 3) ═══════════════════════ */
.view-hero--review { color: #fff; background: radial-gradient(circle at 84% 12%, rgba(249, 208, 93, .26), transparent 30%), linear-gradient(135deg, #17733f 0%, #036870 55%, #12383d 100%); }
.view-hero--review .view-hero__copy h2 { color: #fff !important; }
.view-hero--review .view-hero__copy p { color: rgba(255,255,255,.86) !important; }
.view-hero--review .view-hero__eyebrow { color: #f9d05d !important; }
.view-hero--review { box-sizing: border-box; max-width: 100%; overflow: hidden; }
.review-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px; }
.review-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 14px; background: #fff; border: 1px solid var(--v5-line); border-left: 4px solid var(--v5-amber); min-width: 0; }
.review-card--ai_processing { border-left-color: var(--v5-teal); border-left-style: dashed; }
.review-card--ai_proposed { border-left-color: var(--v5-teal); }
.review-card--ai_failed { border-left-color: var(--v5-red); }
.review-card--confirmed { border-left-color: var(--v5-green); }
.review-card header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.review-card h4 { margin: 2px 0 0; font-size: 15px; color: var(--v5-ink); }
.review-card__score { margin-left: auto; font-size: 22px; font-weight: 800; color: var(--v5-green); }
.review-card__score small { font-size: 12px; color: var(--v5-muted); font-weight: 600; }
.review-card__meta { margin: 0; font-size: 12.5px; color: var(--v5-muted); line-height: 1.45; overflow-wrap: anywhere; }
.review-card__ai { padding: 10px 12px; border-radius: 12px; background: var(--v5-teal-soft); font-size: 13px; color: var(--v5-ink); display: grid; gap: 2px; }
.review-card__ai span { color: var(--v5-muted); font-size: 12px; }
.review-card__ai p { margin: 4px 0 0; line-height: 1.45; }
.review-card__error { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--v5-red-soft); color: var(--v5-red); font-size: 12.5px; }
.review-card__hint { margin: 0; font-size: 12px; color: var(--v5-amber); }
.review-card__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.review-steps { margin: 10px 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.5; }
.review-criteria { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 10px; max-height: min(40vh, 360px); overflow-y: auto; }
.review-criteria li { font-size: 13px; }
.review-criteria small { display: block; color: var(--v5-muted); margin: 2px 0 0 24px; line-height: 1.4; }
.review-criteria__check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.review-criteria__check input { width: 16px; height: 16px; margin-top: 2px; flex: 0 0 auto; }
.review-redflags { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: var(--v5-amber-soft); font-size: 12.5px; color: #6b4000; }
.review-redflags ul { margin: 4px 0 0; padding-left: 18px; }
.settings-grid--kpi3 { grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.kpi3-seat { border: 1px solid var(--v5-line); border-radius: 12px; padding: 8px 10px 10px; margin: 0; display: grid; grid-template-columns: 1fr 80px; gap: 8px; min-width: 0; }
.kpi3-seat legend { font-size: 12px; font-weight: 800; color: var(--v5-ink); padding: 0 4px; }
.kpi3-seat input { width: 100%; box-sizing: border-box; border: 1px solid rgba(3,104,112,.22); border-radius: 12px; padding: 10px 8px; font: inherit; }

/* ═══════════════════════ Fase 7 · Avisos y estado del sistema ═══════════════════════ */
.notif-inbox { border-bottom: 1px solid var(--v5-line); }
.notif-inbox__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px 6px; font-size: 13px; color: var(--v5-ink); }
.notif-inbox__head span { display: flex; gap: 10px; }
.notif-inbox__item { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: start; width: 100%; padding: 8px 14px; border: 0; background: none; text-align: left; font: inherit; cursor: pointer; color: var(--v5-ink); }
.notif-inbox__item:hover { background: #f4fafa; }
.notif-inbox__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: transparent; }
.notif-inbox__item.is-unread .notif-inbox__dot { background: var(--v5-teal); }
.notif-inbox__item.is-unread strong { font-weight: 800; }
.notif-inbox__main { display: grid; gap: 2px; min-width: 0; }
.notif-inbox__main strong { font-size: 13px; font-weight: 600; line-height: 1.35; }
.notif-inbox__main small { font-size: 12px; color: var(--v5-muted); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-inbox__when { font-size: 11px; color: var(--v5-muted); white-space: nowrap; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.sys-grid h4, .sys-subtitle { margin: 0 0 6px; font-size: 13px; color: var(--v5-ink); }
.sys-subtitle { margin-top: 16px; }
.sys-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--v5-ink); }
.sys-list small { display: block; color: var(--v5-muted); font-size: 12px; }
.sys-list .sys-list { margin: 4px 0 0 26px; }
.sys-check { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 800; margin-right: 4px; }
.sys-check--ok { background: var(--v5-green-soft); color: var(--v5-green); }
.sys-check--bad { background: var(--v5-red-soft); color: var(--v5-red); }
.sys-check--wait { background: #f0f1f1; color: #7b8587; }
.moa-btn:disabled, .moa-btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ─── Configuración · Duración de etapas (explicada) ─────────────────── */
.durations-explainer { background: var(--v5-teal-soft); border: 1px solid var(--v5-line); border-radius: 14px; padding: 16px 18px; margin: 4px 0 18px; }
.durations-explainer p { margin: 0 0 14px; font-size: 14px; line-height: 1.55; color: var(--v5-ink); }
.duration-timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.duration-timeline__step { position: relative; background: #fff; border: 1px solid var(--v5-line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.duration-timeline__step:not(:last-child)::after { content: "→"; position: absolute; right: -9px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--v5-teal); background: var(--v5-teal-soft); border-radius: 50%; width: 14px; text-align: center; z-index: 1; }
.duration-timeline__n { width: 20px; height: 20px; border-radius: 50%; background: var(--v5-teal-deep); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; margin-bottom: 4px; }
.duration-timeline__step strong { font-size: 13px; color: var(--v5-ink); line-height: 1.3; }
.duration-timeline__step small { font-size: 12px; color: var(--v5-teal-deep); font-weight: 600; }
.duration-timeline__step.is-flex small { color: var(--v5-muted); font-weight: 500; font-style: italic; }
.duration-timeline__step.is-optional { border-style: dashed; background: #fbfdfd; }
.duration-timeline__step.is-optional .duration-timeline__n { background: var(--v5-muted); }

.durations-group { border: 1px solid var(--v5-line); border-radius: 14px; padding: 14px 16px 16px; margin: 0 0 14px; min-width: 0; }
.durations-group legend { padding: 0 6px; font-size: 14px; font-weight: 800; color: var(--v5-ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.durations-group legend small { font-size: 12px; font-weight: 500; color: var(--v5-muted); }
.durations-group__tag { width: 22px; height: 22px; border-radius: 7px; background: var(--v5-purple); color: #fff; font-size: 12px; display: grid; place-items: center; }
.durations-grid { align-items: start; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.duration-field small { font-size: 12px; font-weight: 500; line-height: 1.45; color: var(--v5-muted); }
.duration-field__input { display: flex; align-items: center; gap: 8px; }
.duration-field__input input { width: 84px; flex: none; }
.duration-field__input em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--v5-muted); }
.durations-sum { margin: 12px 0 0; padding: 9px 12px; border-radius: 10px; background: var(--v5-amber-soft); color: #6b4300; font-size: 13px; }
.durations-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; margin: 4px 0 14px; }
.durations-note { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; background: #f6f9f9; border-left: 3px solid var(--v5-teal); font-size: 13px; line-height: 1.5; color: var(--v5-ink); }
.durations-note em { font-style: normal; font-weight: 700; }
@media (max-width: 820px) {
  .duration-timeline { grid-template-columns: 1fr; }
  .duration-timeline__step:not(:last-child)::after { content: "↓"; right: auto; left: 22px; top: auto; bottom: -11px; transform: none; }
}
