/* =============================================================================
   Avi-Vest IFS · pages-admin.css
   Stiluri specifice paginilor Notifications, Users, Settings, Config și
   panoului de mod audit. Se încarcă după app.css; fundația (tokens, carduri,
   KPI, tabele, dialoguri) stă în app.css.
   ============================================================================= */

/* Rădăcini de pagină care nu sunt încă definite în app.css. */
.p-users,
.p-config {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

/* Stiva de pagină are deja gap; antetul și bannerele nu mai adaugă margini. */
.p-notifications > .page-head,
.p-users > .page-head,
.p-config > .page-head,
.p-settings > .page-head,
.p-notifications > .banner,
.p-users > .banner,
.p-config > .banner,
.p-settings > .banner {
  margin-bottom: 0;
}

/* =============================================================================
   NOTIFICĂRI
   ============================================================================= */

.p-notifications .notification-item {
  align-items: flex-start;
  transition: background .15s var(--ease);
}

/* Rând necitit: fundal ambră + bară verticală, fără hack-ul `.is-unread`. */
.p-notifications .notification-item.unread {
  background: var(--amber-100);
  box-shadow: inset 3px 0 0 var(--amber-400);
}

.p-notifications .notification-item.unread .list-title {
  font-weight: 700;
}

.p-notifications .notification-item.unread:hover {
  background: var(--amber-200);
}

.p-notifications .notification-item:hover {
  background: #FBFCFB;
}

.p-notifications .notification-meta {
  align-items: center;
  row-gap: 5px;
}

.p-notifications .notification-body {
  margin-top: 2px;
  line-height: 1.45;
  max-width: 84ch;
}

.p-notifications .notification-due {
  margin-top: 6px;
}

.p-notifications .list-actions {
  align-self: flex-start;
  padding-top: 1px;
}

.p-notifications .mark-all-form {
  display: inline-flex;
  margin: 0;
}

.p-notifications .day-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6C756D;
}

.p-notifications .day-group-head:first-child {
  border-top: 0;
}

.p-notifications .day-group-count {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .p-notifications .page-head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .p-notifications .notification-item {
    flex-wrap: wrap;
    padding: 10px 13px;
  }

  .p-notifications .list-actions {
    width: 100%;
    margin-left: 0;
    padding-top: 2px;
  }

  .p-notifications .day-group-head {
    padding: 6px 13px;
  }
}

/* =============================================================================
   UTILIZATORI
   ============================================================================= */

.p-users .user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.p-users .user-cell-meta {
  min-width: 0;
}

.p-users .user-cell .cell-title {
  line-height: 1.3;
}

.p-users .edit-panel {
  border-left: 3px solid var(--green-500);
}

.p-users .edit-panel .card-head .avatar {
  width: 34px;
  height: 34px;
}

.p-users .edit-panel .card-foot,
.p-users .new-user .card-foot {
  justify-content: flex-end;
}

.p-users .field-switch {
  justify-content: flex-start;
}

.p-users .table-actions {
  flex-wrap: nowrap;
}

.p-users .new-user-summary,
.p-config .new-obligation-summary {
  cursor: pointer;
  list-style: none;
}

.p-users .new-user-summary::-webkit-details-marker,
.p-config .new-obligation-summary::-webkit-details-marker {
  display: none;
}

.p-users .new-user-summary::marker,
.p-config .new-obligation-summary::marker {
  content: "";
}

.p-users .new-user-summary:hover,
.p-config .new-obligation-summary:hover {
  background: var(--surface-2);
}

.p-users .new-user-summary .card-sub,
.p-config .new-obligation-summary .card-sub {
  display: block;
}

.new-user-toggle,
.new-obligation-toggle {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-700);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  transition: transform .18s var(--ease), background .18s var(--ease);
}

.p-users .new-user[open] .new-user-toggle,
.p-config .new-obligation[open] .new-obligation-toggle {
  transform: rotate(45deg);
  background: var(--lime-200);
}

.p-users .new-user .form-grid,
.p-config .new-obligation .form-grid {
  margin: 0;
}

.p-users .card-foot {
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .p-users .edit-panel .card-foot,
  .p-users .new-user .card-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .p-users .edit-panel .card-foot .row,
  .p-users .new-user .card-foot .row {
    width: 100%;
    justify-content: flex-end;
  }
}

/* =============================================================================
   CONFIGURARE
   ============================================================================= */

.p-config .filter-select {
  width: auto;
  min-width: 190px;
}

.p-config .form-editor {
  border-left: 3px solid var(--info-500);
}

.p-config .form-editor .card-body > .row {
  gap: 10px;
}

.p-config .form-editor .field {
  min-width: 160px;
}

.p-config .field-switch {
  justify-content: flex-start;
}

.p-config .obligation-toggle {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.p-config .card-foot {
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .p-config .page-head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .p-config .page-head-actions .filter-select {
    flex: 1 1 160px;
    min-width: 0;
  }

  .p-config .form-editor .card-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .p-config .form-editor .card-foot .row {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 1023.98px) {
  .p-users .table {
    min-width: 660px;
  }

  .p-config .table {
    min-width: 880px;
  }
}

/* =============================================================================
   SETĂRI PERSONALE + MOD AUDIT
   ============================================================================= */

.p-settings .settings-grid {
  align-items: stretch;
}

.p-settings .settings-grid > .card {
  height: 100%;
}

.p-settings .profile-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.p-settings .profile-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.012em;
  line-height: 1.25;
}

.p-settings .profile-username {
  font-size: 12px;
  color: var(--muted);
}

.p-settings .settings-grid .card-foot {
  flex-wrap: wrap;
  gap: 8px;
}

.p-settings .settings-grid .card-foot form,
.p-settings .settings-grid .card-foot .btn {
  margin-left: auto;
}

/* Panoul de audit este card frate, nu card în card. */
.p-settings .audit-mode {
  border-left: 3px solid var(--red-600);
}

.p-settings .audit-block {
  min-width: 0;
}

.p-settings .audit-block-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6C756D;
}

.p-settings .audit-effects {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-soft);
}

.p-settings .audit-effects li {
  position: relative;
  padding-left: 16px;
}

.p-settings .audit-effects li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber-500);
}

.p-settings .audit-warning {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #F0DCA0;
  border-left: 3px solid var(--amber-500);
  border-radius: var(--radius);
  background: var(--amber-100);
  color: #634500;
  font-size: 12px;
  line-height: 1.45;
}

.p-settings .audit-warning strong {
  font-weight: 650;
}

.p-settings .audit-mode .card-body {
  display: grid;
  gap: 14px;
}

.p-settings .audit-mode .banner {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .p-settings .settings-grid .card-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .p-settings .settings-grid .card-foot form,
  .p-settings .settings-grid .card-foot .btn {
    margin-left: 0;
  }

  .p-settings .audit-mode .card-body {
    gap: 12px;
  }
}

/* =============================================================================
   CLIENȚI (PP 04)
   ============================================================================= */

.p-customers {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.p-customers > .page-head,
.p-customers > .banner {
  margin-bottom: 0;
}

.p-customers .edit-panel {
  border-left: 3px solid var(--green-500);
}

.p-customers .edit-panel .card-title .muted {
  font-weight: 500;
}

.p-customers .edit-panel .card-foot {
  flex-wrap: wrap;
  gap: 10px;
}

.p-customers .field-switch {
  justify-content: flex-start;
}

.p-customers .validity-row,
.p-customers .switch-row {
  gap: 12px;
  align-items: flex-start;
}

.p-customers .validity-row .field,
.p-customers .switch-row .field {
  flex: 1 1 180px;
}

.p-customers .customer-toolbar .toolbar-search {
  flex: 1 1 220px;
  min-width: 0;
}

.p-customers .toolbar-search .input {
  width: 100%;
  min-width: 0;
}

.p-customers .banner-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding-left: 16px;
}

.p-customers .table-actions {
  flex-wrap: nowrap;
}

.p-customers .cell-sub {
  white-space: nowrap;
}

.p-customers .chips {
  margin-top: 3px;
}

@media (max-width: 1023.98px) {
  .p-customers .table {
    min-width: 980px;
  }
}

@media (max-width: 640px) {
  .p-customers .page-head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .p-customers .customer-toolbar .input {
    min-width: 0;
  }

  .p-customers .customer-toolbar .segmented {
    width: 100%;
  }

  .p-customers .edit-panel .card-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .p-customers .edit-panel .card-foot .row {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Cerințele de parolă (Administrare → Utilizatori) — validare live din password-rules.js */
.pw-rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 6px 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FAFBF9;
}
.pw-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.pw-rule-ic {
  display: inline-block;
  width: 16px;
  font-weight: 700;
}
.pw-rule.idle .pw-rule-ic { color: var(--muted); }
.pw-rule.ok { color: var(--green-700); }
.pw-rule.ok .pw-rule-ic { color: var(--green-700); }
.pw-rule.bad { color: var(--red-700); }
.pw-rule.bad .pw-rule-ic { color: var(--red-700); }
.pw-rules-err {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--red-700);
}
