/* ══════════════════════════════════════
   518-matriz.css — matriz Pewen
   ══════════════════════════════════════ */

.pw-matriz-block {
  background: #131d2a;
  border: 1px solid #2d3a4c;
  border-radius: 10px;
  padding: 10px;
}

.pw-matriz-title {
  color: #f4f7fb;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.pw-matriz-table {
  margin: 0;
  background: transparent;
  color: #e5edf8;
  border-color: #344357;
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255, 255, 255, 0.025);
  --bs-table-striped-color: #e5edf8;
  --bs-table-hover-bg: rgba(127, 190, 146, 0.06);
  --bs-table-hover-color: #f4f7fb;
  --bs-table-border-color: #344357;
}

.pw-matriz-table thead th {
  background: #1a2635;
  color: #dce7f4;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-color: #344357;
  padding: 10px 8px;
  vertical-align: middle;
  position: sticky;
  top: 0;
  z-index: 5;
}

.pw-matriz-table tbody td,
.pw-matriz-table tbody th {
  border-color: #344357;
  padding: 0px 8px;
  vertical-align: top;
}

.pw-matriz-table tbody td:first-child {
  background: #16202d;
  min-width: 120px;
}

.pw-matriz-table tbody td:first-child strong {
  color: #f2f6fb;
  font-size: 12px;
  font-weight: 700;
}

/* ── Columna contexto activo ── */
.pw-matriz-table thead th.pw-col-activa {
  background: rgba(139, 211, 160, 0.15);
  border-top: 3px solid #8bd3a0;
  color: #8bd3a0;
}

.pw-matriz-table tbody td.pw-col-activa {
  background: rgba(139, 211, 160, 0.06);
}

.pw-module-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 86px;
  background: #101925;
  border-radius: 8px;
  padding: 3px;
}

.pw-module-cell:hover {
  border-color: #5d9970;
  background: #152131;
}

.pw-module-cell .pw-module-id {
  color: #f4f7fb;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  font-family: monospace;
  white-space: nowrap;
  margin: 0;
}

.pw-matriz-table .text-muted {
  color: #6f8097 !important;
  font-size: 10px;
  font-family: monospace;
  font-weight: 600;
  line-height: 1;
}

.pw-matriz-debug {
  background: #131d2a;
  border: 1px dashed #41516a;
  border-radius: 8px;
  padding: 10px;
  color: #c9d5e3;
  line-height: 1.6;
}

.pw-matriz-debug strong {
  color: #f4f7fb;
}

/* ── Scroll tabla ── */
.table-responsive {
  border-radius: 8px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: auto;
}

/* ── Tabs matriz ── */
.pw-matriz-tabs {
  border-bottom: 1px solid #314054;
  gap: 6px;
}

.pw-matriz-tabs .nav-link {
  border: 1px solid #314054;
  background: #16202d;
  color: #b8c5d6;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px 8px 0 0;
}

.pw-matriz-tabs .nav-link:hover {
  color: #eef3f9;
  border-color: #5d9970;
}

.pw-matriz-tabs .nav-link.active {
  background: #1b2838;
  color: #8bd3a0;
  border-color: #5d9970;
}

.pw-matriz-tab-content {
  padding-top: 2px;
}

/* ── Edición inline celda ── */
.pw-cell-view {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}

.pw-cell-edit {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.pw-module-id-click {
    cursor: pointer;
    transition: color 0.15s ease;
}

.pw-module-id-click:hover {
    color: #8bd3a0;
    text-decoration: underline;
}

.pw-module-id-zero {
    color: #6f8097;
    font-size: 10px;
    font-family: monospace;
    font-weight: 600;
}

.pw-btn-inline-edit, .pw-btn-inline-create {
    background: none;
    border: none;
    color: #6f8097;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 11px;
    line-height: 1;
    transition: color 0.15s ease;
}

.pw-btn-inline-edit:hover {
    color: #8bd3a0;
}

.pw-input-module-id {
    width: 56px;
    background: #0d1520;
    border: 1px solid #3a4d63;
    border-radius: 4px;
    color: #f4f7fb;
    font-size: 12px;
    font-family: monospace;
    font-weight: 700;
    padding: 2px 6px;
    text-align: center;
}

.pw-input-module-id:focus {
    outline: none;
    border-color: #8bd3a0;
    box-shadow: 0 0 0 2px rgba(139, 211, 160, 0.2);
}

.pw-btn-inline-save {
    background: none;
    border: none;
    color: #8bd3a0;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 13px;
    line-height: 1;
}

.pw-btn-inline-save:hover {
    color: #a8f0be;
}

.pw-btn-inline-cancel {
    background: none;
    border: none;
    color: #e57373;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 13px;
    line-height: 1;
}

.pw-btn-inline-cancel:hover {
    color: #ff8a80;
}

.pw-cell-saved {
    animation: pwCellFlash 1.2s ease;
}

@keyframes pwCellFlash {
    0%   { background-color: rgba(139, 211, 160, 0.25); }
    100% { background-color: transparent; }
}
/* ── Override global input dentro de matriz ── */
.pw-module-cell .pw-input-module-id,
.pw-cell-edit input[type="number"].pw-input-module-id {
    display: inline-block;
    width: 66px;
    padding: 2px 6px !important;
    font-size: 16px;
    line-height: 1.4;
    color: #f4f7fb;
    background-color: #0d1520;
    background-image: none;
    border: 1px solid #3a4d63;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 700;
    text-align: center;
}

.pw-module-cell .pw-input-module-id:focus,
.pw-cell-edit input[type="number"].pw-input-module-id:focus {
    border-color: #8bd3a0;
    box-shadow: 0 0 0 2px rgba(139, 211, 160, 0.2);
    outline: none;
    background-color: #0d1520;
    color: #f4f7fb;
}