:root {
  --radius-card: 14px;
  --shadow-card: 0 18px 45px rgba(15, 23, 42, 0.10);

  /* Colores por app: --color-app-{codigo} se inyectan en header.php desde BD */

  --bg: #f4f3f1;
  --bg-card: #ffffff;
  --bg-fila: transparent;
  --bg-fila-hover: rgba(0, 0, 0, 0.03);
  --text: #141416;
  --text-muted: #6b6a67;
  --text-secondary: #8a8985;
  --border: #e5e3df;
  --border-hair: #e5e3df;
  --danger: #b42318;
  --retraso-bg: #FCEBEB;
  --retraso-text: #A32D2D;
  --aviso-bg: #fff7ed;
  --aviso-text: #9a3412;
  --aviso-border: #fdba74;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }

/* ── Cabecera ── */
.pc-header {
  background: #fff;
  border-bottom: 0.5px solid var(--border);
}
.pc-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.pc-header-left,
.pc-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pc-header-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #141416;
  color: #fff;
}
.pc-header-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.pc-badge-ro {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f0efed;
  color: #6b6a67;
  border: 0.5px solid #dddcd8;
}
.pc-btn-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 0.5px solid var(--border);
  background: #fff;
  color: var(--text);
}
.pc-btn-icon:hover { background: var(--bg); }
.pc-btn-icon svg {
  width: 16px;
  height: 16px;
}
.pc-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #141416;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
}
.pc-link-salir {
  font-size: 13px;
  color: var(--text-muted);
}
.pc-link-salir:hover { color: var(--text); }

/* ── Tabs ── */
.pc-tabs {
  background: #fff;
  border-bottom: 0.5px solid var(--border);
}
.pc-tabs-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.pc-tabs-links {
  display: flex;
  gap: 4px;
  min-width: 0;
}
.pc-tab {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.pc-tab:hover { color: var(--text); }
.pc-tab.is-active {
  color: var(--text);
  font-weight: 700;
  border-bottom-color: #141416;
}
.pc-tabs-updated {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.panel-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

.panel-footer {
  border-top: 0.5px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 18px 0 28px;
}
.panel-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Filtros ── */
.pc-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.pc-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
}
.pc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  border-radius: 0;
}
.pc-chip:hover { color: var(--text); opacity: .85; }
.pc-chip.is-active {
  font-weight: 700;
  background: transparent;
  color: var(--text);
}
.pc-chip-dot {
  width: 6px;
  height: 6px;
  min-width: 6px;
  border-radius: 999px;
  display: inline-block;
  background: var(--app-color, #d6d3d1);
}
.pc-chip-dot.is-todas {
  background: #9B9A95;
}
.pc-filters-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
  min-width: 0;
  margin-left: auto;
}
.pc-filters-estado {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}
.pc-filters-ausencias {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── KPIs (franja) ── */
.pc-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-bottom: 0;
  border-top: 0.5px solid var(--border-hair);
  border-bottom: 0.5px solid var(--border-hair);
  background: transparent;
}
.pc-kpi {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  border-right: 0.5px solid var(--border-hair);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  transition: background .12s;
}
.pc-kpi:last-child { border-right: 0; }
.pc-kpi:hover { background: rgba(0, 0, 0, 0.02); }
.pc-kpi.is-active { background: rgba(0, 0, 0, 0.04); }
.pc-kpi.is-zero {
  opacity: 0.4;
}
.pc-kpi-num {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
}
.pc-kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: lowercase;
}
.pc-kpi.is-danger .pc-kpi-num { color: var(--danger); }
.pc-kpi.is-zero.is-danger .pc-kpi-num { color: var(--danger); }

/* ── Grid de listas ── */
.pc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.pc-col {
  min-width: 0;
}
.pc-col + .pc-col {
  border-left: 0.5px solid var(--border-hair);
}
.pc-block {
  margin: 0;
  padding: 14px 16px 16px;
  border-bottom: 0.5px solid var(--border-hair);
}
.pc-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.pc-block-title {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: .01em;
}
.pc-block-total {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.pc-ver-mas {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.pc-ver-mas:hover { color: var(--text); }

/* ── Filas ── */
.panel-fila-lista {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.panel-fila {
  display: flex;
  align-items: center;
  background: var(--bg-fila);
  border-radius: 0;
  min-height: 0;
  overflow: hidden;
  color: inherit;
  gap: 10px;
  padding: 7px 4px 7px 0;
}
.panel-fila:hover { background: var(--bg-fila-hover); }
.panel-fila-barra {
  width: 3px;
  min-width: 3px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 1px;
  align-self: center;
  background: var(--app-color, #d6d3d1);
}
.pc-cal-cell.is-ausente { background: var(--app-color, #d6d3d1); }
.panel-fila.is-urgente .panel-fila-barra { background: var(--danger); }

.pc-aviso-apps {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 0.5px solid var(--aviso-border);
  background: var(--aviso-bg);
  color: var(--aviso-text);
  font-size: 13px;
  font-weight: 600;
}
.panel-fila-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
}
.panel-fila-info { flex: 1; min-width: 0; }
.panel-fila-titulo {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-fila-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-fila-retraso {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--retraso-bg);
  color: var(--retraso-text);
}
.panel-fila-chevron {
  color: #b0aea9;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.pc-empty {
  margin: 0;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.pc-app-links {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.pc-app-link {
  display: flex;
  align-items: center;
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  min-height: 0;
  gap: 10px;
  padding: 7px 4px 7px 0;
}
.pc-app-link:hover { background: var(--bg-fila-hover); }
.pc-app-link-label {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
}
.pc-app-link .panel-fila-chevron {
  display: flex;
  align-items: center;
  padding-right: 0;
}

/* ── Login ── */
.panel-login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(226,75,74,.12), transparent 40%),
    radial-gradient(circle at top right, rgba(29,158,117,.12), transparent 40%),
    var(--bg);
}
.panel-login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px;
  border: 1px solid var(--border);
}
.panel-login-card h1 { margin: 0 0 4px; font-size: 26px; }
.panel-login-sub { margin: 0 0 20px; color: var(--text-muted); font-size: 14px; }
.panel-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.panel-input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
.panel-btn {
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: #141416;
  cursor: pointer;
}
.panel-btn:hover { filter: brightness(1.08); }
.panel-alert {
  background: #fef3f2;
  color: var(--danger);
  border: 1px solid #fecdca;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}

/* ── Fichajes ── */
.pc-mes-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 18px;
}
.pc-mes-titulo {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  min-width: 160px;
  text-align: center;
}
.pc-mes-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 0.5px solid var(--border);
  background: #fff;
  font-size: 22px;
  line-height: 1;
  color: var(--text);
}
.pc-mes-btn:hover { background: rgba(0, 0, 0, 0.03); }

.pc-table-wrap {
  overflow-x: auto;
  background: transparent;
  border: 0.5px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}
.pc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pc-table th,
.pc-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 0.5px solid var(--border);
  white-space: nowrap;
}
.pc-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  background: transparent;
}
.pc-table tr:last-child td { border-bottom: 0; }
.pc-table-a { font-weight: 600; }
.pc-table-a:hover { text-decoration: underline; }
.pc-table .is-pos { color: #15803d; font-weight: 600; }
.pc-table .is-neg { color: var(--danger); font-weight: 600; }
.pc-app-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

/* ── Vacaciones ── */
.pc-pend-vac {
  background: transparent;
  border: 0.5px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.pc-pend-vac-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pc-pend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  background: #fafaf9;
  color: var(--text);
  font-size: 13px;
}
.pc-pend-chip:hover { filter: brightness(0.98); }

.pc-cal-wrap {
  overflow-x: auto;
  background: transparent;
  border: 0.5px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}
.pc-cal {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
  min-width: 100%;
}
.pc-cal th,
.pc-cal td {
  border-bottom: 0.5px solid #eee;
  border-right: 0.5px solid #f0eeeb;
}
.pc-cal-sticky {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg);
  min-width: 140px;
  max-width: 180px;
  text-align: left;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 2px 0 4px rgba(0,0,0,.04);
}
thead .pc-cal-sticky { z-index: 3; background: #fafaf9; }
.pc-cal-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-cal-day {
  min-width: 28px;
  width: 28px;
  padding: 4px 2px;
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
  background: #fafaf9;
  vertical-align: bottom;
}
.pc-cal-day.is-solape {
  background: var(--aviso-bg);
  color: var(--aviso-text);
  box-shadow: inset 0 -2px 0 var(--aviso-border);
}
.pc-cal-d { display: block; font-size: 11px; line-height: 1.1; color: inherit; }
.pc-cal-m { display: block; font-size: 9px; text-transform: uppercase; opacity: .8; }
.pc-cal-cell {
  width: 28px;
  height: 22px;
  padding: 0;
}
.pc-cal-cell.is-ausente { opacity: .92; }
.pc-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.pc-cal-leg-item { display: inline-flex; align-items: center; gap: 6px; }
.pc-cal-leg-solape {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--aviso-bg);
  border: 0.5px solid var(--aviso-border);
}

.panel-fila.is-urgente .panel-fila-titulo { color: var(--danger); }

@media (max-width: 860px) {
  .pc-grid { grid-template-columns: 1fr; }
  .pc-col + .pc-col { border-left: 0; }
  .pc-kpis { grid-template-columns: repeat(2, 1fr); }
  .pc-kpi:nth-child(2) { border-right: 0; }
  .pc-kpi:nth-child(1),
  .pc-kpi:nth-child(2) { border-bottom: 0.5px solid var(--border-hair); }
  .pc-header-title { font-size: 15px; }
  .pc-badge-ro { display: none; }
  .pc-filters-meta { align-items: flex-start; text-align: left; width: 100%; }
  .pc-filters-ausencias { max-width: 100%; white-space: normal; }
}
