/* =========================================================
   ACCOUNTS / PLATFORM ADMIN
   Page-specific styles only.
   Shared layout styles should gradually move to core CSS.
   ========================================================= */

/* =========================
   LEGACY ADMIN BASICS
   Keep temporarily for older account pages still using these classes.
   ========================= */

.form-control{
  width:100%;
  min-height:42px;
  padding:10px 12px;
  border:1px solid #d0d5dd;
  border-radius:10px;
  background:#fff;
  color:#111827;
}

.form-control:focus{
  outline:none;
  border-color:#f7941d;
  box-shadow:0 0 0 3px rgba(247,148,29,.12);
}

.form-check-input{
  width:16px;
  height:16px;
}

.text-danger{
  color:#b42318;
  font-size:.9rem;
  margin-top:6px;
}

.section-title{
  margin-top:22px;
  margin-bottom:10px;
  font-weight:700;
}

.form-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(240px, 1fr));
  gap:16px;
}

.tag{
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  background:#f2f4f7;
  font-size:12px;
  margin-right:4px;
}

/* =========================
   MODULE PERMISSION PILLS
   ========================= */

.module-row{
  display:flex;
  align-items:center;
  gap:12px;
}

.module-checklist-two-rows{
  flex:1;
  display:grid;
  grid-template-columns:repeat(3, minmax(72px, 1fr));
  grid-template-rows:repeat(2, auto);
  gap:6px 10px;
  align-items:center;
}

.module-save-side{
  display:flex;
  align-items:center;
  min-width:56px;
}

.module-save-btn{
  height:32px;
  padding:0 12px;
  white-space:nowrap;
}

.module-save-btn[hidden]{
  display:none !important;
}

.module-pill{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:32px;
  padding:0 12px;
  border:1px solid #d0d5dd;
  border-radius:999px;
  background:#fff;
  color:#344054;
  font-size:12px;
  font-weight:600;
  line-height:1;
  cursor:pointer;
  user-select:none;
  transition:
    background-color .15s ease,
    border-color .15s ease,
    color .15s ease,
    box-shadow .15s ease;
}

.module-pill input[type="checkbox"]{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.module-pill-label{
  display:inline-flex;
  align-items:center;
  gap:6px;
}

.module-pill-label::before{
  content:"✓";
  font-size:11px;
  font-weight:700;
  line-height:1;
  opacity:0;
  transform:scale(.9);
  transition:opacity .15s ease, transform .15s ease;
}

.module-pill:hover{
  border-color:#f7941d;
  box-shadow:0 0 0 3px rgba(247,148,29,.08);
}

.module-pill:has(input[type="checkbox"]:checked){
  background:#fff6eb;
  border-color:#f7941d;
  color:#b25b00;
}

.module-pill:has(input[type="checkbox"]:checked) .module-pill-label::before{
  opacity:1;
  transform:scale(1);
}

.module-pill:has(input[type="checkbox"]:focus-visible){
  box-shadow:0 0 0 3px rgba(247,148,29,.14);
}

.module-pill-disabled{
  opacity:.45;
  cursor:not-allowed;
}

.module-pill-disabled:hover{
  border-color:#d0d5dd;
  box-shadow:none;
}

/* =========================
   USER ACCESS PAGE
   ========================= */

.user-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:16px;
}

.user-search-form{
  display:flex;
  align-items:center;
  gap:8px;
}

.user-search-form .form-control{
  width:260px;
  min-height:36px;
}

.user-search-form .btn{
  height:36px;
  padding:0 14px;
}

.user-summary-name{
  font-weight:800;
  color:var(--text, #111827);
}

.user-summary-email{
  color:var(--muted, #667085);
  font-size:13px;
}

.role-block{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.role-current-row{
  display:flex;
  align-items:center;
  gap:6px;
}

.role-pill{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  background:#fff6eb;
  color:#b25b00;
  font-size:12px;
  font-weight:800;
}

.role-empty,
.module-role-first{
  color:#667085;
  font-size:13px;
}

.role-form-inline{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.role-form-compact select{
  min-width:160px;
}

.module-current{
  font-size:12px;
  color:#667085;
  margin-bottom:8px;
}

.module-checklist{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.user-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.user-empty-row{
  text-align:center;
  color:#667085;
  padding:20px;
}

/* =========================
   PASSWORD ROWS
   ========================= */

.tg-password-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

.tg-password-row input{
  flex:1 1 260px;
  min-width:220px;
}

/* =========================
   PLATFORM MODALS
   ========================= */

.tg-modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:5000;
}

.tg-modal-card{
  width:100%;
  max-width:560px;
  background:#fff;
  border-radius:18px;
  border:1px solid var(--border, #e5e7eb);
  box-shadow:0 20px 45px rgba(15,23,42,.18);
  overflow:hidden;
}

.tg-modal-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  padding:18px 20px;
  border-bottom:1px solid var(--border, #e5e7eb);
}

.tg-modal-title{
  font-size:20px;
  font-weight:800;
  color:var(--text, #111827);
}

.tg-modal-body{
  padding:20px;
}

.tg-password-copy{
  display:flex;
  gap:10px;
  margin-top:14px;
}

.tg-password-copy input{
  flex:1;
}

/* =========================
   AUDIT TABLE
   ========================= */

.audit-table{
  width:100%;
  border-collapse:collapse;
  table-layout:fixed;
}

.audit-table thead th{
  text-align:left;
  font-size:12px;
  color:#667085;
  padding-bottom:10px;
}

.audit-table td{
  font-size:13px;
  color:#344054;
  padding:6px 0;
  vertical-align:top;
}

.audit-table .col-time{ width:140px; }
.audit-table .col-module{ width:110px; }
.audit-table .col-event{ width:100px; }
.audit-table .col-level{ width:80px; }
.audit-table .col-actor{ width:200px; }
.audit-table .col-message{ width:auto; }

.audit-table td,
.audit-table th{
  white-space:nowrap;
}

.audit-table .col-message,
.audit-table td:last-child{
  white-space:normal;
}

.audit-table tbody tr{
  border-bottom:1px solid #f2f4f7;
}

.audit-table td:nth-child(4){
  font-weight:600;
  color:#475467;
}

/* =========================
   LOGIN / PASSWORD RESET
   ========================= */

.login-wrapper{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:#f4f6f9;
}

.login-container{
  width:100%;
  max-width:460px;
}

.login-brand{
  text-align:center;
  margin-bottom:18px;
}

.login-logo{
  max-height:70px;
  margin-bottom:12px;
}

.login-title{
  font-size:28px;
  font-weight:900;
  color:var(--text, #111827);
}

.login-subtitle{
  margin-top:4px;
  font-size:13px;
}

.login-card{
  background:#fff;
  border-radius:18px;
  padding:24px;
  box-shadow:var(--shadow-md, 0 12px 30px rgba(15,23,42,.10));
  border:1px solid var(--border, #e5e7eb);
}

.login-card-head{
  margin-bottom:18px;
}

.login-card-title{
  font-size:22px;
  font-weight:800;
  color:var(--text, #111827);
}

.login-form{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.login-password-row{
  display:flex;
  gap:8px;
  align-items:center;
}

.login-password-row input{
  flex:1;
}

.login-submit-btn{
  width:100%;
  margin-top:4px;
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width:1280px){
  .module-checklist-two-rows{
    gap:6px 8px;
  }
}

@media (max-width:920px), (orientation:landscape) and (max-height:520px){

  .user-toolbar{
    flex-direction:column;
    align-items:stretch;
  }

  .user-search-form{
    width:100%;
  }

  .user-search-form .form-control{
    width:100%;
  }

}

@media (max-width:520px){

  .tg-modal-card{
    border-radius:16px;
  }

  .tg-modal-head,
  .tg-modal-body{
    padding:16px;
  }

  .tg-password-copy{
    flex-direction:column;
  }

  .login-wrapper{
    padding:14px;
  }

  .login-card{
    padding:18px;
    border-radius:16px;
  }

  .login-title{
    font-size:24px;
  }

  .login-card-title{
    font-size:20px;
  }

}
.login-links{
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-top:4px;
}

.btn-link{
  border:0;
  background:transparent;
  color:#b25b00;
  font-weight:800;
  cursor:pointer;
  padding:0;
  text-decoration:none;
  font-size:13px;
}

.btn-link:hover{
  text-decoration:underline;
}
