body.chs365-portal{margin:0;padding:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;line-height:1.35;background:#f6f7f7;color:#1d2327;}
.notice{margin:16px 0;padding:10px 12px;border-radius:8px;border:1px solid #dcdcde;background:#fff;}
.notice-error{border-color:#d63638;background:#fff5f5;}
.notice-success{border-color:#00a32a;background:#f1fff6;}
.notice-info{border-color:#2271b1;background:#f0f6ff;}

img{max-width:100%;height:auto;}

/* --- CSP hardening (screen: portal login/root) --- */
.chs365-portal-wrap{max-width:980px;margin:32px auto;padding:0 16px;}
.chs365-portal-title{margin:0 0 10px 0;}
.chs365-portal-box{padding:14px 16px;border:1px solid #e5e5e5;background:#fff;border-radius:8px;}
.chs365-portal-box-text{margin:0;}

.chs365-login-card{margin-top:18px;padding:18px 2ch;border:1px solid #e5e5e5;background:#fff;border-radius:8px;max-width:420px;}
.chs365-login-title{margin-top:0;}
.chs365-login-quick{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0 14px 0;}
.chs365-login-pill{display:inline-block;text-decoration:none;background:#f0f0f1;border:1px solid #c3c4c7;padding:6px 10px;border-radius:999px;font-size:13px;color:#1d2327;}
.chs365-full{width:100%;}
.chs365-login-btn{background:#2271b1;border:0;color:#fff;padding:8px 14px;border-radius:4px;cursor:pointer}
.chs365-login-hint{margin:12px 0 0 0;color:#666;font-size:13px}
.chs365-mt10{margin-top:10px !important;}


/* Responsive defaults for portal */
@media (max-width: 720px){
  body.chs365-portal{padding:12px;}
  input[type="text"],input[type="password"],input[type="email"],select,textarea{width:100% !important;max-width:100% !important;box-sizing:border-box;}
  button, .button, input[type="submit"]{width:100% !important;box-sizing:border-box;}
  /*
   * Default portal tables: allow horizontal scroll on small screens.
   * NOTE: some tables (e.g. Informes -> Detalle diario) are explicitly styled
   * as real tables and should not be forced into display:block.
   */
  table:not(.chs365-report-table){max-width:100%;display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;}
}


/* Responsive adjustments for public portal */
@media (max-width: 768px) {
  .chs365-portal-wrap { padding: 12px !important; }
  /* Same as above but scoped to the portal wrapper; exclude the report table */
  .chs365-portal-wrap table:not(.chs365-report-table) { display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .chs365-portal-wrap th, .chs365-portal-wrap td { white-space: nowrap; }
  .chs365-portal-wrap form .chs365-row, .chs365-portal-wrap form .row { display:block !important; }
  .chs365-portal-wrap input[type="text"],
  .chs365-portal-wrap input[type="email"],
  .chs365-portal-wrap input[type="password"],
  .chs365-portal-wrap select,
  .chs365-portal-wrap textarea { width: 100% !important; max-width: 100% !important; }
  .chs365-portal-wrap button { width: 100% !important; }
}


/* Employee Activity calendar (portal) */

.chs365-activity .chs365-activity-toolbar{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;align-items:end;margin-bottom:12px}
.chs365-activity .chs365-activity-toolbar label{font-size:12px;color:#444}
.chs365-activity .chs365-activity-toolbar select,
.chs365-activity .chs365-activity-toolbar input{padding:6px 8px;border:1px solid #d6d6d6;border-radius:6px;margin-right:8px}
.chs365-activity .chs365-activity-grid{display:grid;grid-template-columns: 1fr;gap:14px;align-items:start}
@media (max-width: 1100px){.chs365-activity .chs365-activity-grid{grid-template-columns:1fr}}
.chs365-activity .chs365-activity-title{font-size:16px;font-weight:600;margin:0 0 8px 0;color:#222}
.chs365-act-table{width:100%;border-collapse:separate;border-spacing:6px}
.chs365-act-table th{font-size:12px;color:#666;font-weight:600;text-align:center}
.chs365-act-cell{vertical-align:top;background:#fff;border:1px solid #e5e5e5;border-radius:12px;min-height:150px;height:150px;padding:8px;cursor:pointer;overflow:hidden;}
.chs365-act-cell.empty{background:transparent;border:none;cursor:default}
.chs365-act-cell.selected{outline:2px solid #111}
.chs365-act-cell-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
.chs365-act-daynum{font-weight:700;font-size:12px;color:#222}
.chs365-act-hm{font-size:11px;color:#444;white-space:nowrap}
.chs365-act-chips{margin-top:6px;display:flex;flex-direction:column;gap:4px}
.chs365-act-chip{font-size:10px;line-height:1.1;padding:3px 6px;border-radius:6px;border:1px solid #e5e5e5;white-space:nowrap;overflow:hidden;text-overflow:ellipsiswidth:100%;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;}
.chs365-act-chip.in{background:#e9f7ee}
.chs365-act-chip.out{background:#fdecec}
.chs365-act-chip.ps{background:#eef6ff}
.chs365-act-chip.pe{background:#f3f3ff}
.chs365-act-cell.st-ok{background:#fff}
.chs365-act-cell.st-incomplete{background:#fffaf0}
.chs365-act-cell.st-none{background:#fbfbfb}
.chs365-act-card{background:#fff;border:1px solid #e5e5e5;border-radius:10px;padding:12px}
.chs365-act-card .row{display:flex;justify-content:space-between;padding:6px 0;border-bottom:1px dashed #eee}
.chs365-act-card .row:last-child{border-bottom:none}
.chs365-act-card .k{color:#666;font-size:12px}
.chs365-act-card .v{color:#111;font-weight:700;font-size:12px}
.chs365-act-daytitle{font-weight:700;margin:12px 0 8px}
.chs365-act-daylist{background:#fff;border:1px solid #e5e5e5;border-radius:10px;padding:10px}
.chs365-act-dayrow{display:flex;gap:10px;align-items:center;padding:6px 0;border-bottom:1px dashed #eee}
.chs365-act-dayrow:last-child{border-bottom:none}
.chs365-act-dayrow .t{width:54px;font-weight:700}
.chs365-act-dayrow.in{color:#1a6f37}
.chs365-act-dayrow.out{color:#b42318}
.chs365-act-dayrow.ps,.chs365-act-dayrow.pe{color:#1d4ed8}
.chs365-activity .muted{color:#777;font-size:12px}
.chs365-activity .error{color:#b42318;font-size:12px}
.chs365-activity-legend .chip{display:inline-block;margin-left:6px;padding:2px 6px;border-radius:999px;border:1px solid #e5e5e5;font-size:11px}
.chs365-activity-legend .chip.ok{background:#e9f7ee}
.chs365-activity-legend .chip.warn{background:#fffaf0}
.chs365-activity-legend .chip.bad{background:#fdecec}

/* Employee Activity calendar - visual refinements (bigger cells + proper toolbar) */
.chs365-activity .chs365-activity-toolbar{margin: 12px 0 14px;}
.chs365-activity .chs365-activity-left{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end;}
.chs365-activity .chs365-activity-toolbar label{display:flex;flex-direction:column;gap:4px;}
.chs365-activity .chs365-activity-toolbar select{min-width: 320px;}
.chs365-act-table{table-layout:fixed;border-spacing:10px;}
.chs365-act-cell{min-height:150px;padding:8px;border-radius:12px;}
.chs365-act-chip{font-size:11px;padding:6px 8px;border-radius:8px;}
@media (max-width: 768px){
  .chs365-activity .chs365-activity-toolbar select{min-width: 100%;}
  .chs365-act-table{border-spacing:8px;}
  .chs365-act-cell{min-height:120px;}
  .chs365-act-chip{font-size:10px;padding:5px 7px;}
}


.chs365-inc-list{display:flex;flex-direction:column;gap:8px;}
.chs365-inc-item{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:6px 8px;border:1px solid #eee;border-radius:10px;background:#fafafa;}
.chs365-inc-left{min-width:0;}
.chs365-inc-date{font-size:12px;font-weight:600;color:#111;}
.chs365-inc-reason{font-size:12px;color:#555;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px;}
.chs365-inc-badge{font-size:11px;padding:3px 8px;border-radius:999px;border:1px solid #ddd;background:#fff;}
.chs365-inc-badge.approved{border-color:#b7e1c1;}
.chs365-inc-badge.rejected{border-color:#f5b5b5;}
.chs365-inc-badge.pending{border-color:#f3d38a;}



/* Incidences list badges */
.chs365-inc-list{display:flex;flex-direction:column;gap:8px;}
.chs365-inc-item{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:6px 8px;border:1px solid #eee;border-radius:10px;background:#fafafa;}
.chs365-inc-left{min-width:0;flex:1;}
.chs365-inc-date{font-size:12px;font-weight:600;color:#111;}
.chs365-inc-reason{font-size:12px;color:#555;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:260px;}
.chs365-inc-badge{font-size:11px;padding:2px 8px;border-radius:999px;border:1px solid #ddd;background:#fff;color:#333;flex-shrink:0;}
.chs365-inc-badge.approved{border-color:#a5d6a7;background:#e8f5e9;color:#1b5e20;}
.chs365-inc-badge.rejected{border-color:#ef9a9a;background:#ffebee;color:#b71c1c;}
.chs365-inc-badge.pending{border-color:#ffe082;background:#fff8e1;color:#8d6e63;}

.chs365-act-card-title{font-weight:700;margin-bottom:6px;color:#333;}


/* --- Portal UI basics (forms/cards) --- */
.chs365-wrap{max-width:1920px;width:calc(100vw - 32px);box-sizing:border-box;margin:24px auto;padding:0 16px;}
.chs365-card{background:#fff;border:1px solid #dcdcde;border-radius:12px;padding:16px;box-shadow:0 1px 2px rgba(0,0,0,.04);}
.chs365-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 16px;align-items:end;}
@media (max-width: 780px){.chs365-grid{grid-template-columns:1fr;}}
.chs365-colspan-2{grid-column:span 2;}
@media (max-width: 780px){.chs365-colspan-2{grid-column:auto;}}
.chs365-field label{display:block;font-size:12px;color:#50575e;margin:0 0 4px;font-weight:600;}
/* Inputs (portal) */
body.chs365-portal input[type="text"],
body.chs365-portal input[type="email"],
body.chs365-portal input[type="password"],
body.chs365-portal input[type="number"],
body.chs365-portal input[type="search"],
body.chs365-portal select,
body.chs365-portal textarea{
  font-size:14px; line-height:1.4;
  padding:6px 8px;
  border:1px solid #dcdcde;
  border-radius:6px;
  background:#fff;
  color:#1d2327;
  box-sizing:border-box;
}
body.chs365-portal textarea{min-height:92px;}
/* WP-like helper width */
body.chs365-portal .regular-text{width:25em;max-width:100%;}
/* Buttons (WP-like) */
body.chs365-portal .button{
  display:inline-block;
  padding:6px 12px;
  border-radius:6px;
  border:1px solid #c3c4c7;
  background:#f6f7f7;
  color:#2c3338;
  text-decoration:none;
  cursor:pointer;
  line-height:1.2;
}
body.chs365-portal .button:hover{background:#f0f0f1;}
body.chs365-portal .button:focus{outline:2px solid #2271b1; outline-offset:1px;}
body.chs365-portal .button.button-primary{
  border-color:#2271b1;
  background:#2271b1;
  color:#fff;
}
body.chs365-portal .button.button-primary:hover{background:#135e96;border-color:#135e96;}



/* ===== Portal: mejoras de legibilidad en tablas (solo layout; sin tocar lógica) ===== */

/* Informes (Portal Empresa): tabla "Detalle diario" - columnas alineadas y legibles */
.chs365-report-table-wrap{overflow-x:visible;}
@media (max-width: 1100px){
  .chs365-report-table-wrap{overflow:auto;-webkit-overflow-scrolling:touch;}
}

.chs365-report-table{width:100%;display:table;overflow-x:visible;overflow-y:visible;table-layout:fixed;border-collapse:collapse;}
.chs365-report-table th,.chs365-report-table td{padding:8px 10px;vertical-align:top;}
.chs365-report-table th{white-space:nowrap;}

/* Anchuras por columna (desktop). En móvil/tablet se mantiene el scroll horizontal del contenedor */
.chs365-report-table th:nth-child(1),.chs365-report-table td:nth-child(1){width:110px;}
.chs365-report-table th:nth-child(2),.chs365-report-table td:nth-child(2){width:110px;}
/* "Fichajes" debe ajustarse al contenido sin empujar el resto */
.chs365-report-table th:nth-child(3),.chs365-report-table td:nth-child(3){width:12ch;}
.chs365-report-table th:nth-child(4),.chs365-report-table td:nth-child(4),
.chs365-report-table th:nth-child(5),.chs365-report-table td:nth-child(5),
.chs365-report-table th:nth-child(6),.chs365-report-table td:nth-child(6){width:70px;white-space:nowrap;text-align:right;}
.chs365-report-table th:nth-child(7),.chs365-report-table td:nth-child(7){width:120px;}
.chs365-report-table th:nth-child(8),.chs365-report-table td:nth-child(8){width:140px;white-space:normal;}

/* Columna Fichajes: permitir varias líneas y evitar solapes con columnas contiguas */
.chs365-report-table td.chs365-col-punches{
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

/* Usuarios internos: permitir leer Fecha alta y apilar acciones */
.chs365-users-list table { width: 100% !important; }
.chs365-users-list .chs365-created-cell { white-space: normal !important; min-width: 140px; }
.chs365-users-list .chs365-actions-cell { white-space: normal !important; }
.chs365-users-list .chs365-actions-cell a,
.chs365-users-list .chs365-actions-cell form { display: block !important; margin: 0 0 6px 0 !important; }
.chs365-users-list .chs365-actions-cell a { text-align: center; }
.chs365-users-list .chs365-actions-cell button { width: 100% !important; }

/* Tiempo Real: aprovechar ancho disponible y separar columnas */
table.chs365-realtime-table { width: 100% !important; max-width: none !important; }
table.chs365-realtime-table th, table.chs365-realtime-table td { padding: 10px 12px !important; vertical-align: middle; }
table.chs365-realtime-table th { white-space: nowrap; }
table.chs365-realtime-table td:nth-child(2) { min-width: 220px; }  /* Empleado/a */
table.chs365-realtime-table td:nth-child(3) { min-width: 160px; }  /* Delegación */
table.chs365-realtime-table td:nth-child(4) { min-width: 170px; }  /* Último evento */
table.chs365-realtime-table td:nth-child(5) { white-space: nowrap; } /* Hace */
table.chs365-realtime-table td:nth-child(6) { white-space: nowrap; } /* Hoy */


/* Users list: 2-row layout per user (portal only) */
.chs365-users-list table { width: 100%; border-collapse: collapse; }
.chs365-users-list th, .chs365-users-list td { vertical-align: top; }

/* Zebra striping per USER (2 rows = 1 user) */
.chs365-users-list tbody tr:nth-child(4n+3),
.chs365-users-list tbody tr:nth-child(4n+4) {
  background: #f7f7f7;
}

/* Meta row uses same background as its user block */
.chs365-users-list .chs365-user-row-meta td.chs365-user-meta {
  background: transparent;
  border-top: 0;
  padding-top: 6px;
  padding-bottom: 10px;
}

/* Actions: compact, stacked */
.chs365-users-list .chs365-actions-cell { width: 140px; }
.chs365-users-list .chs365-actions-cell .button{
  display:block;
  width: 120px;
  margin: 4px 0;
  padding: 5px 10px;
  line-height: 1.2;
  font-size: 13px;
}


/* ZIP330: tighter action buttons in portal users list */
.chs365-users-list .chs365-actions-cell{
  vertical-align: top;
}
.chs365-users-list .chs365-actions-cell .button{
  display:block;
  width: 100%;
  padding: 2px 10px !important;
  min-height: 26px !important;
  line-height: 22px !important;
  margin: 0 0 4px 0 !important;
}
.chs365-users-list .chs365-actions-cell .button:last-child{
  margin-bottom: 0 !important;
}


/* Portal: notas con 'Leer más' (máx. 2 líneas) */
.chs365-note-wrap { max-width: 520px; }
.chs365-note-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}
.chs365-note-clamp.is-expanded {
  -webkit-line-clamp: unset;
  max-height: none;
}
.chs365-note-toggle { font-size: 12px; }



/* Notas (Leer más) sin JS */
.chs365-note-wrap{max-width:520px}
.chs365-note-clamp{
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  white-space:normal;
}
.chs365-note-details{margin-top:4px}
.chs365-note-details summary{
  display:inline;
  cursor:pointer;
  color:#2271b1;
  font-weight:600;
}
.chs365-note-details summary::-webkit-details-marker{display:none}
.chs365-note-full{margin-top:8px;white-space:pre-wrap}
.chs365-inc-line{display:block;margin:0 0 6px 0}
.chs365-inc-prefix{font-weight:600}


/* Brand header */
.chs365-brand{display:flex;align-items:center;gap:12px;margin:0 0 12px 0}
.chs365-brand-logo{width:40px;height:40px;object-fit:contain}
.chs365-brand-title{font-size:32px;font-weight:700;line-height:1}
.chs365-brand-sub{font-size:14px;color:#666;margin-top:2px}


/* Portal: acciones usuarios más compactas (sin <br />) */
.chs365-users-list .chs365-actions-compact{
  display:flex;
  flex-direction:column;
  gap:4px;
  align-items:flex-start;
}
.chs365-users-list .chs365-actions-compact .button{
  margin:0 !important;
  width:120px !important;
}

/* Ajuste fino: separar un poco del borde derecho y alinear a la izquierda dentro de la celda */
.chs365-users-list .chs365-actions-cell{
  padding-right:16px;
}

/* Meta inline debajo del nombre en listado de usuarios */
.chs365-users-list .chs365-user-meta-inline{
  margin-top:6px;
  font-size:13px;
  color:#555;
  line-height:1.25;
  white-space:normal;
}
.chs365-users-list .chs365-user-meta-inline strong{
  font-weight:700;
}

/* Zebra por usuario (por fila), forzando alternancia consistente incluso con estilos WP */
.chs365-users-list table.widefat.striped tbody tr:nth-child(odd) > *{
  background-color:#f7f7f7 !important;
}
.chs365-users-list table.widefat.striped tbody tr:nth-child(even) > *{
  background-color:#ffffff !important;
}
.chs365-users-list .chs365-user-meta-inline{
  background:transparent;
}


/* Informe Portal Empresa: Detalle diario (sin scroll en escritorio, columnas profesionales) */
.chs365-report-table th, .chs365-report-table td{padding:10px 10px; vertical-align:top;}
.chs365-report-table th:nth-child(1), .chs365-report-table td:nth-child(1){width:110px;}
.chs365-report-table th:nth-child(2), .chs365-report-table td:nth-child(2){width:110px;}
/* Fichajes: ~12 caracteres de ancho visible, multilinea, sin invadir */
.chs365-report-table th:nth-child(3), .chs365-report-table td:nth-child(3){width:12ch;}
.chs365-report-table td:nth-child(3){white-space:normal; overflow-wrap:anywhere; word-break:break-word;}
/* Plan/Trab/Dif: compactos y alineados a la derecha */
.chs365-report-table th:nth-child(4), .chs365-report-table td:nth-child(4),
.chs365-report-table th:nth-child(5), .chs365-report-table td:nth-child(5),
.chs365-report-table th:nth-child(6), .chs365-report-table td:nth-child(6){width:72px; text-align:right; white-space:nowrap;}
.chs365-report-table th:nth-child(7), .chs365-report-table td:nth-child(7){width:120px;}
.chs365-report-table th:nth-child(8), .chs365-report-table td:nth-child(8){width:140px;}



/* Portal: usar el ancho del viewport (sin depender del contenedor del theme) */
body.chs365-portal .chs365-wrap{
  max-width:1920px;
  width:min(1920px, calc(100vw - 32px));
  margin-left:auto;
  margin-right:auto;
  box-sizing:border-box;
}


/* CSP audit (pantalla 2): header + navegación sin estilos inline */
.chs365-portal-card{
  margin-top:18px;
  padding:18px 2ch;
  border:1px solid #e5e5e5;
  background:#fff;
  border-radius:8px;
}
.chs365-portal-usercard-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  flex-wrap:wrap;
}
.chs365-portal-usercard-main{margin:0 0 6px 0;}
.chs365-portal-usercard-role{color:#666;}
.chs365-portal-usercard-sub{margin:0 0 6px 0;color:#666;font-size:13px;}
.chs365-portal-usercard-sub:last-child{margin-bottom:0;}
.chs365-portal-usercard-logout{margin:0;}

.chs365-portal-area-tabs{
  margin-top:12px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.chs365-portal-nav{margin-top:12px;padding:12px 14px;}
.chs365-portal-nav-row{display:flex;gap:10px;flex-wrap:wrap;}

.chs365-pill{
  display:inline-block;
  text-decoration:none;
  background:#f0f0f1;
  color:#1d2327;
  border:1px solid #c3c4c7;
  padding:6px 10px;
  border-radius:999px;
  font-size:13px;
}
.chs365-pill.is-active{
  background:#2271b1;
  color:#fff;
  border-color:transparent;
}
/* PATCH10: Portal Empresa (y resto del portal) más ancho en escritorio.
 * Mantiene responsive en móvil/tablet y limita a 1440px máximo en escritorio (estándar/pro).
 */
@media (min-width: 1024px){
  body.chs365-portal .chs365-portal-wrap{
    max-width: 1920px;
    width: min(1920px, calc(100vw - 32px));
    margin-left: auto;
    margin-right: auto;
  }
}
