/* =========================
   Applications Cards Grid
   ========================= */

.applicationsGrid{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

/* responsive columns */
@media (max-width: 1400px){
  .applicationsGrid{ grid-template-columns: repeat(12, 1fr); }
  .appCard{ grid-column: span 4; }
}
@media (max-width: 992px){
  .appCard{ grid-column: span 6; }
}
@media (max-width: 600px){
  .appCard{ grid-column: span 12; }
}

.appCard{
  grid-column: span 3;
  background: #fff;
  border: 1px solid rgba(17, 24, 39, 0.10);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.06);
  transition: transform .12s ease, box-shadow .12s ease;
}

.appCard:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.10);
}

.appCardTop{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px 16px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.avatarIcon{
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(21, 94, 239, 0.10);
  border: 1px solid rgba(21, 94, 239, 0.20);
  flex: 0 0 auto;
}

.avatarIcon svg{
  width: 22px;
  height: 22px;
  fill: #542D6F;
}

.appMeta{
  min-width: 0;
  flex: 1 1 auto;
}

.appName{
  font-weight: 700;
  font-size: 14px;
  color: #542D6F;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appEmail{
  font-size: 13px;
  color: rgba(17, 24, 39, 0.70);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.appNameFull{
  font-weight: 700;
  font-size: 14px;
  color: #542D6F;
  line-height: 1.2;
  white-space: normal;     /* allow wrap */
  overflow: visible;       /* show full */
  text-overflow: clip;     /* no ellipsis */
  word-break: break-word;  /* handle long names */
}

.appInfoRow .value{
  max-width: 65%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  text-align: right;
}

.appEmailFull{
  font-size: 13px;
  color: rgba(17, 24, 39, 0.70);
  margin-top: 2px;
  white-space: normal;     /* allow wrap */
  overflow: visible;       /* show full */
  text-overflow: clip;     /* no ellipsis */
  word-break: break-word;  /* handle long emails */
}

.appCardBody{
  padding: 14px 16px;
}

.appInfoRow{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(17, 24, 39, 0.10);
}

.appInfoRow:last-child{
  border-bottom: none;
}

.appInfoRow .label{
  font-size: 12px;
  color: rgba(17, 24, 39, 0.65);
}

.appInfoRow .value{
  font-size: 12px;
  font-weight: 700;
  color: #542D6F;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.appCardActions{
  display: flex;
  gap: 10px;
  padding: 12px 16px 16px 16px;
  flex-wrap: wrap;
}

.appBtn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: #542D6F;
  color: #fff;
  transition: transform .12s ease, opacity .12s ease;
}

.appBtn:hover{
  opacity: 0.95;
  transform: translateY(-1px);
  color: #fff;
}

.appBtn.secondary{
  background: #fff;
  color: #542D6F;
}

.appBtn.secondary:hover{
  color: #542D6F;
}

.appBtn.danger{
  background: #fff;
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.25);
}

.appBtn.danger:hover{
  color: #b91c1c;
}

.appsToolbar{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  padding:16px;
  border-radius:14px;
  background:#fff;
  border:1px solid rgba(17,24,39,0.08);
  box-shadow: 0 6px 18px rgba(17,24,39,0.06);
  margin-bottom:14px;
}

.appsToolbarTitle{
  margin:0;
  font-size:18px;
  font-weight:800;
  color:#542D6F;
  letter-spacing:0.2px;
}

.appsToolbarSub{
  margin:4px 0 0 0;
  font-size:13px;
  color:rgba(17,24,39,0.65);
}

.appsToolbarRight{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.appsSearch{
  position:relative;
  min-width:280px;
  max-width:420px;
  flex:1;
}

.appsSearchIcon{
  position:absolute;
  left:12px;
  top:50%;
  transform:translateY(-50%);
  opacity:.65;
}

.appsSearchIcon svg{
  display:block;
  fill: rgba(17,24,39,0.65);
}

.appsSearch input{
  width:100%;
  height:42px;
  border-radius:12px;
  border:1px solid rgba(17,24,39,0.10);
  background:#fff;
  padding:10px 12px 10px 40px;
  outline:none;
  font-size:13px;
  color:#542D6F;
}

.appsSearch input:focus{
  border-color: rgba(21,94,239,0.40);
  box-shadow: 0 0 0 4px rgba(21,94,239,0.10);
}

.appsPrimaryBtn{
  height:42px;
  border-radius:12px;
  border:1px solid rgba(21,94,239,0.20);
  background:#542D6F;
  color:#fff;
  font-weight:700;
  font-size:13px;
  padding:0 14px;
  display:inline-flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  box-shadow: 0 8px 18px rgba(21,94,239,0.18);
}

.appsPrimaryBtn .btnIcon svg{
  display:block;
  fill:#fff;
}

.appsPrimaryBtn:hover{
  filter:brightness(0.98);
}

.appsPrimaryBtn:active{
  transform:translateY(1px);
}

/* Responsive */
@media (max-width: 768px){
  .appsToolbar{
    align-items:flex-start;
  }
  .appsToolbarRight{
    width:100%;
  }
  .appsSearch{
    min-width:100%;
  }
  .appsPrimaryBtn{
    width:100%;
    justify-content:center;
  }
}

.statsGrid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:14px;
  margin-bottom:14px;
}

.statCard{
  background:#fff;
  border:1px solid rgba(17,24,39,0.08);
  border-radius:14px;
  padding:14px;
  box-shadow: 0 6px 18px rgba(17,24,39,0.06);
  display:flex;
  flex-direction:column;
  gap:10px;
  min-height:92px;
}

.statTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.statIcon{
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid rgba(17,24,39,0.08);
  background: rgba(21,94,239,0.06);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}

.statIcon svg{
  display:block;
  fill:#542D6F;
}

.statLabel{
  font-size:13px;
  font-weight:700;
  color:#542D6F;
  opacity:.88;
  text-align:right;
  flex:1;
}

.statValue{
  font-size:22px;
  font-weight:900;
  color:#542D6F;
  text-align:right;
  letter-spacing:0.2px;
  line-height:1;
}

/* subtle hover */
.statCard:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(17,24,39,0.10);
}

/* responsive */
@media (max-width: 1200px){
  .statsGrid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px){
  .statsGrid{ grid-template-columns: 1fr; }
  .statLabel, .statValue{ text-align:left; }
  .statTop{ justify-content:flex-start; }
}

/* ===== Modern Modal ===== */
.modernModal {
  display: none;               /* your JS turns it to flex */
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(17, 24, 39, .55);
  backdrop-filter: blur(6px);
}

.modernModalDialog {
  width: min(680px, 100%);
  background: #fff;
  border: 1px solid rgba(17, 24, 39, .10);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(17, 24, 39, .28);
  overflow: hidden;
  transform: translateY(8px);
  animation: modalIn .16s ease forwards;
}

@keyframes modalIn {
  to { transform: translateY(0); }
}

.modernModalHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 12px 18px;
  border-bottom: 1px solid rgba(17, 24, 39, .08);
  background: rgba(17, 24, 39, .02);
}

.modernModalTitle {
  font-size: 18px;
  font-weight: 950;
  color: #542D6F;
  letter-spacing: .2px;
}

.modernModalSub {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(17, 24, 39, .65);
}

.modernModalClose {
  border: 1px solid rgba(17, 24, 39, .12);
  background: #fff;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 900;
  color: rgba(17, 24, 39, .7);
}

.modernModalClose:hover {
  background: rgba(17, 24, 39, .03);
}

.modernModalBody {
  padding: 16px 18px 18px 18px;
}

.modernGrid3 {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
}

@media (max-width: 720px) {
  .modernGrid3 { grid-template-columns: 1fr; }
}

.modernField {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modernLabel {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .25px;
  color: rgba(17, 24, 39, .65);
}

.modernControl {
  border-radius: 12px !important;
  border: 1px solid rgba(17, 24, 39, .12) !important;
  padding: 10px 12px !important;
  font-weight: 800 !important;
  font-size: 14px !important;
  box-shadow: 0 10px 22px rgba(17, 24, 39, .06);
}

.modernControl:focus {
  border-color: rgba(17, 24, 39, .28) !important;
  box-shadow: 0 0 0 4px rgba(17, 24, 39, .08), 0 10px 22px rgba(17, 24, 39, .08) !important;
}

.modernModalFooter {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid rgba(17, 24, 39, .08);
}

.modernBtn {
  border: 1px solid rgba(17, 24, 39, .12);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 950;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modernBtn:active { transform: translateY(1px); }

.modernBtn.ghost {
  background: #fff;
  color: rgba(17, 24, 39, .8);
}

.modernBtn.ghost:hover {
  background: rgba(17, 24, 39, .03);
}

.modernBtn.soft {
  background: rgba(17, 24, 39, .06);
  color: #542D6F;
}

.modernBtn.soft:hover {
  background: rgba(17, 24, 39, .09);
}

.modernBtn.primary {
  background: #542D6F;
  color: #fff;
  box-shadow: 0 14px 30px rgba(17, 24, 39, .18);
  border-color: #542D6F;
}

.modernBtn.primary:hover {
  filter: brightness(1.03);
}

/* click outside closes: make overlay clickable, but dialog not */
.modernModal { cursor: pointer; }
.modernModalDialog { cursor: default; }
