/* ==========================================================================
   QALIS NOVA — Accès & comptes, mot de passe, « Mon agenda » de l'ouvrier
   ========================================================================== */

.access-root {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.access-kpis {
  margin-bottom: 0;
}

/* Cartes des rôles ---------------------------------------------------------- */
.access-roles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.access-role-card {
  --role-color: var(--qn-blue);
  --role-soft: var(--qn-blue-soft);
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--qn-surface-raised);
  box-shadow: 0 0 0 1px var(--border-color), var(--shadow-sm);
  border-top: 3px solid var(--role-color);
}

.access-role-card--admin {
  --role-color: var(--qn-gold);
  --role-soft: var(--qn-gold-soft);
}

.access-role-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.access-role-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 19px;
  color: var(--role-color);
  background: var(--role-soft);
}

.access-role-head strong {
  display: block;
  font-size: 15px;
  color: var(--qn-ink);
}

.access-role-head span {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.access-role-card ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.access-role-card li {
  position: relative;
  padding-left: 22px;
  font-size: 13px;
  color: var(--qn-ink-soft);
}

.access-role-card li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 5px;
  height: 9px;
  border: solid var(--role-color);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Tableau des comptes -------------------------------------------------------- */
.access-table tr.is-disabled td {
  opacity: 0.6;
}

.access-table tr.is-disabled td.access-actions-col {
  opacity: 1;
}

.access-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.access-user strong {
  display: block;
  color: var(--qn-ink);
}

.access-user span {
  font-size: 12px;
  color: var(--text-muted);
}

.access-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(145deg, #3a6aa3 0%, var(--qn-blue) 100%);
}

.access-avatar--admin {
  background: linear-gradient(145deg, #b47d1f 0%, #8f6114 100%);
}

.access-self {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 700;
  color: var(--text-secondary);
  background: #eef1f5;
}

.access-role-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--qn-blue);
  background: var(--qn-blue-soft);
}

.access-role-badge--admin {
  color: #8a5a00;
  background: var(--qn-gold-soft);
}

.access-scope {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--qn-ink-soft);
}

.access-scope--warn {
  color: #b42318;
  font-weight: 600;
}

.access-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.access-actions-col {
  text-align: right;
}

.access-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 6px;
}

.access-actions .btn {
  white-space: nowrap;
}

.access-table th:nth-child(4),
.access-table td:nth-child(4) {
  white-space: nowrap;
}

body.light-mode .access-actions .access-danger {
  color: #b42318;
}

.access-actions .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Modales ------------------------------------------------------------------- */
.access-modal {
  width: min(560px, calc(100vw - 32px));
}

#modal-access-account [hidden],
#modal-access-password [hidden],
#modal-change-password [hidden] {
  display: none !important;
}

.access-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.access-password-row {
  display: flex;
  gap: 8px;
}

.access-password-row .input-field {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
}

.access-error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: #8f1d14;
  background: #fdeeec;
  box-shadow: inset 0 0 0 1px rgba(180, 35, 24, 0.2);
}

.access-created {
  display: grid;
  gap: 14px;
}

.access-created-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #0f7a52;
  background: #e8f6ef;
  box-shadow: inset 0 0 0 1px rgba(15, 122, 82, 0.22);
}

.access-created-banner strong {
  display: block;
  color: #0b5c3e;
}

.access-credentials {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: #f7f9fb;
  box-shadow: inset 0 0 0 1px var(--border-color);
}

.access-credentials div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.access-credentials span {
  color: var(--text-muted);
}

.access-credentials code {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 700;
  color: var(--qn-ink);
}

/* Changement de mot de passe : version imposée sans fermeture possible */
#modal-change-password.is-forced .btn-close,
#modal-change-password.is-forced .pwd-cancel {
  display: none;
}

#modal-change-password:not(.is-forced) .pwd-logout {
  display: none;
}

.pwd-forced-notice {
  margin-bottom: 14px;
}

/* « Mon agenda » dans le planning d'un ouvrier ------------------------------ */
.pl-own {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pl-own-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--res-color) 10%, #ffffff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--res-color) 30%, transparent);
}

.pl-own-card .pl-res-text strong {
  font-size: 14px;
}

.pl-own-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.pl-own-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 0 0 1px var(--border-color);
}

.pl-own-stats strong {
  font-size: 16px;
  color: var(--qn-ink);
}

.pl-own-stats span {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 900px) {
  .access-roles {
    grid-template-columns: minmax(0, 1fr);
  }

  .access-credentials div {
    grid-template-columns: minmax(0, 1fr);
  }
}
