/* KontaCYP — lo propio de la plataforma de vencimientos, sobre main.css de
   OmniPRIT (mismos tokens, mismos componentes). */

:root {
  --sem-verde: #10B981;
  --sem-amarillo: #F59E0B;
  --sem-rojo: #EF4444;
  --sem-gris: #94A3B8;
}

.page-sub { color: var(--text-muted); font-size: .875rem; margin-top: 4px; }
.muted { color: var(--text-muted); }
.small { font-size: .78rem; }
.mono { font-variant-numeric: tabular-nums; }
.link { color: var(--primary); text-decoration: none; cursor: pointer; font-weight: 500; }
.link:hover { text-decoration: underline; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.card h2 { font-size: 1rem; }
.card-sub { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.input-sm { padding: 7px 10px; font-size: .84rem; width: auto; }
select.input-sm { padding-right: 32px; }
textarea.input { resize: vertical; font-family: inherit; line-height: 1.5; }
.loading { padding: 60px; text-align: center; color: var(--text-muted); }
.loading .spinner-sm { width: 24px; height: 24px; border-width: 3px; margin: 0 auto 12px; display: block; }

/* Franja de ambiente: en pruebas no puede confundirse con producción. */
.env-badge { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; font-size: .7rem; font-weight: 800;
  letter-spacing: .08em; padding: 4px 10px; border-radius: 99px; text-transform: uppercase; }

/* ── Semáforo ── */
.sem { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.sem-verde { background: var(--sem-verde); }
.sem-amarillo { background: var(--sem-amarillo); }
.sem-rojo { background: var(--sem-rojo); box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
.sem-gris { background: var(--sem-gris); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Píldora de tarea dentro de la matriz y del calendario */
.tk { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 99px; font-size: .72rem;
  font-weight: 600; cursor: pointer; border: 1px solid transparent; white-space: nowrap; line-height: 1.3;
  transition: var(--transition); }
.tk:hover { filter: brightness(.95); transform: translateY(-1px); }
.tk-verde { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.tk-amarillo { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }
.tk-rojo { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }
.tk-gris { background: var(--surface-3); color: var(--text-secondary); border-color: var(--border); }

/* ── Tablero: matriz cliente × obligación ── */
.matrix td, .matrix th { vertical-align: middle; }
.matrix thead th { text-transform: none; }
td.td-wrap { white-space: normal; min-width: 240px; }
.matrix thead th:first-child, .matrix tbody td:first-child { position: sticky; left: 0; z-index: 3; text-align: left; }
.matrix thead th:first-child { background: var(--surface-2); }
.matrix tbody td:first-child { background: var(--surface); box-shadow: 2px 0 6px rgba(0,0,0,.05); min-width: 220px; white-space: normal; }
.matrix tbody tr:hover td:first-child { background: var(--surface-2); }
/* La última columna de la matriz es una obligación, no acciones: sin sticky. */
.matrix thead th:last-child, .matrix tbody td:last-child { position: static !important; box-shadow: none !important; }
.matrix tbody td { text-align: center; padding: 10px 12px; }
.matrix .cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.matrix .cli-name { font-weight: 600; }
.matrix .cli-meta { font-size: .72rem; color: var(--text-muted); }
.matrix .empty-cell { color: var(--border); }

/* Tablas cuya última columna es un dato (resultado, cambio, evidencia): la
   regla de main.css la fijaría a la derecha como si fueran acciones. */
table.plain thead th:last-child, table.plain tbody td:last-child { position: static !important; box-shadow: none !important; text-align: left; }

/* ── Avance del checklist ── */
.progress { width: 80px; height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; display: inline-block; vertical-align: middle; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.progress.full > i { background: var(--success); }

.checklist { display: flex; flex-direction: column; }
.check-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.check-item:last-child { border-bottom: none; }
.check-item input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--success); cursor: pointer; flex-shrink: 0; }
.check-item.done .check-text { color: var(--text-muted); text-decoration: line-through; }
.check-item .check-meta { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.check-item[aria-disabled="true"] { cursor: default; }

/* ── Detalle: pares etiqueta / valor ── */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px 20px; }
.kv > div > span { display: block; font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.kv > div > b { font-weight: 600; font-size: .9rem; word-break: break-word; }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: .85rem; font-weight: 500; cursor: pointer; margin-bottom: 12px; }
.back-link:hover { color: var(--primary); }

/* ── Comentarios e historial ── */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl-item { display: flex; gap: 10px; }
.tl-item .tl-body { flex: 1; min-width: 0; }
.tl-head { font-size: .78rem; color: var(--text-muted); }
.tl-head b { color: var(--text); font-weight: 600; }
.tl-text { font-size: .875rem; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.diff { font-size: .76rem; color: var(--text-secondary); margin-top: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-word; }
.diff del { color: var(--danger); text-decoration: line-through; }
.diff ins { color: var(--success); text-decoration: none; }

/* ── Calendario mensual ── */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal-h { padding: 8px; font-size: .72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; text-align: center;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-d { min-height: 110px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px; min-width: 0; background: var(--surface); }
.cal-d.out { background: var(--surface-2); }
.cal-d.out .cal-n { opacity: .4; }
.cal-d.today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-d.festivo .cal-n { color: var(--danger); }
.cal-n { font-size: .78rem; font-weight: 700; color: var(--text-secondary); }
.cal-d .tk { overflow: hidden; text-overflow: ellipsis; max-width: 100%; justify-content: flex-start; }
.cal-more { font-size: .7rem; color: var(--primary); cursor: pointer; font-weight: 600; }

/* ── Login: botón de Google ── */
.btn-google { width: 100%; background: #fff; color: var(--text); border: 1.5px solid var(--border); padding: 12px; font-size: .92rem; }
.btn-google:hover { background: var(--surface-2); }
.login-sep { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: .78rem; margin: 6px 0; }
.login-sep::before, .login-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Reporte de importación ── */
.import-steps { counter-reset: paso; display: flex; flex-direction: column; gap: 16px; }
.import-step { display: flex; gap: 14px; }
.import-step::before { counter-increment: paso; content: counter(paso); width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700; font-size: .85rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.import-step > div { flex: 1; min-width: 0; }

.var-chip { display: inline-block; font-family: ui-monospace, Menlo, monospace; font-size: .74rem; padding: 2px 7px; border-radius: 3px;
  background: var(--surface-3); color: var(--primary); cursor: pointer; margin: 0 4px 4px 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 9px 14px; font-size: .85rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.modal-box.form-modal { width: min(96vw, 560px); align-items: stretch; gap: 0; padding: 28px 24px 20px; }
.modal-box.form-modal.wide { width: min(96vw, 760px); }
.modal-box.form-modal .modal-form { max-height: calc(100vh - 200px); overflow-y: auto; padding: 2px 2px 4px; }

@media (max-width: 768px) {
  .cal-d { min-height: 70px; padding: 3px; }
  .cal-d .tk { font-size: .62rem; padding: 2px 5px; }
  .cal-h { font-size: .62rem; padding: 6px 2px; }
}
