/* =========================================================
   BrokerCRM Auth UI
   Employee Login / Splash
========================================================= */
:root{
  --auth-primary:#2563eb;
  --auth-primary-dark:#1d4ed8;
  --auth-soft:#eff6ff;
  --auth-text:#0f172a;
  --auth-muted:#64748b;
  --auth-border:#e2e8f0;
  --auth-bg:#f8fafc;
  --auth-white:#ffffff;
  --auth-danger:#dc2626;
  --auth-success:#16a34a;
  --auth-line:#06c755;
  --auth-radius:18px;
  --auth-shadow:0 24px 70px rgba(15,23,42,.12);
}

html,body{height:100%;max-width:100%;overflow-x:hidden;}
body.auth-page{
  font-family:'Sarabun',sans-serif;
  min-height:100vh;
  width:100%;
  max-width:100%;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.14), transparent 32%),
    radial-gradient(circle at bottom right, rgba(6,199,85,.12), transparent 28%),
    linear-gradient(135deg,#f8fafc 0%,#eef4ff 100%);
  color:var(--auth-text);
  overflow-x:hidden;
}
.auth-shell{
  min-height:100vh;
  width:100%;
  max-width:100vw;
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  overflow-x:hidden;
}
.auth-card{
  width:100%;
  max-width:1080px;
  min-width:0;
  box-sizing:border-box;
  display:grid;
  grid-template-columns:minmax(0,1fr) 430px;
  background:rgba(255,255,255,.92);
  border:1px solid rgba(226,232,240,.9);
  border-radius:28px;
  box-shadow:var(--auth-shadow);
  overflow:hidden;
  backdrop-filter:blur(10px);
}
.auth-brand{
  min-width:0;
  padding:44px;
  background:
    linear-gradient(135deg,rgba(37,99,235,.96),rgba(29,78,216,.9)),
    url('../img/avatar.svg');
  color:#fff;
  position:relative;
  overflow:hidden;
}
.auth-brand::after{
  content:'';
  position:absolute;
  width:320px;height:320px;
  right:-120px;bottom:-120px;
  border-radius:50%;
  background:rgba(255,255,255,.12);
}
.auth-logo{
  display:inline-flex;align-items:center;gap:10px;
  font-weight:800;font-size:18px;margin-bottom:38px;
}
.auth-logo i{font-size:20px;}
.auth-service-status{
  position:relative;
  z-index:1;
  display:flex;
  align-items:center;
  gap:8px;
  max-width:100%;
  margin:-22px 0 26px;
  padding:8px 10px;
  border:1px solid rgba(255,255,255,.22);
  border-radius:12px;
  background:rgba(15,23,42,.18);
  color:#fff;
}
.auth-service-status span{
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  color:rgba(255,255,255,.78);
}
.auth-service-status b{
  min-width:44px;
  text-align:center;
  font-size:11px;
  font-weight:900;
  line-height:1;
  border-radius:999px;
  padding:6px 8px;
  background:#2563eb;
  color:#fff;
}
.auth-service-status-prod b{background:#16a34a;}
.auth-service-status-uat b{background:#f59e0b;}
.auth-service-status small{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:11px;
  color:rgba(255,255,255,.78);
}
.auth-brand h1{font-size:34px;line-height:1.28;font-weight:800;margin:0 0 14px;}
.auth-brand p{font-size:14px;line-height:1.8;color:rgba(255,255,255,.82);max-width:520px;}
.auth-feature-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:34px;position:relative;z-index:1;}
.auth-feature{padding:14px;border-radius:16px;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.16);}
.auth-feature i{font-size:18px;margin-bottom:8px;display:block;}
.auth-feature b{display:block;font-size:13px;margin-bottom:3px;color:#fff;}
.auth-feature span{font-size:12px;color:rgba(255,255,255,.78);}
.auth-panel{padding:38px;background:#fff;}
.auth-panel,
.auth-panel *,
.auth-brand,
.auth-brand *{
  box-sizing:border-box;
}
.auth-panel{
  min-width:0;
  max-width:100%;
  overflow-x:hidden;
}
.auth-panel-header{margin-bottom:20px;}
.auth-panel-header .eyebrow{font-size:11px;font-weight:800;letter-spacing:.08em;color:var(--auth-primary);text-transform:uppercase;margin-bottom:8px;}
.auth-panel-header h2{font-size:24px;font-weight:800;margin:0 0 6px;}
.auth-panel-header p{font-size:13px;color:var(--auth-muted);margin:0;line-height:1.6;}
.auth-tabs{display:flex;background:#f8fafc;border:1px solid var(--auth-border);border-radius:14px;padding:4px;margin-bottom:18px;}
.auth-tab{flex:1;border:0;background:transparent;border-radius:11px;height:38px;font-size:12px;font-weight:700;color:#64748b;cursor:pointer;}
.auth-tab.active{background:#fff;color:var(--auth-primary);box-shadow:0 4px 14px rgba(15,23,42,.08);}
.auth-view{display:none;}
.auth-view.active{display:block;}
.auth-page .form-group{margin-bottom:14px;}
.auth-page label{font-size:12px;font-weight:700;color:#334155;margin-bottom:6px;}
.auth-page .form-control{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  height:42px!important;
  border-radius:12px!important;
  border:1px solid var(--auth-border)!important;
  background:#fff!important;
  font-size:13px!important;
  font-weight:600!important;
  padding:0 14px!important;
  box-shadow:none!important;
}
.auth-page .form-control:focus{border-color:var(--auth-primary)!important;box-shadow:0 0 0 4px rgba(37,99,235,.12)!important;}
.auth-input-icon{position:relative;}
.auth-input-icon,
.auth-password-field{
  width:100%;
  max-width:100%;
  min-width:0;
}
.auth-input-icon .form-control{padding-left:42px!important;}
.auth-input-icon i{position:absolute;left:14px;top:50%;transform:translateY(-50%);color:#94a3b8;font-size:14px;}
.auth-help-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:4px 0 16px;font-size:12px;}
.auth-link{border:0;background:transparent;color:var(--auth-primary);font-weight:700;padding:0;cursor:pointer;}
.btn-auth{height:42px!important;border-radius:12px!important;font-size:13px!important;font-weight:800!important;display:flex;align-items:center;justify-content:center;gap:8px;}
.btn-auth-primary{background:var(--auth-primary)!important;border-color:var(--auth-primary)!important;color:#fff!important;}
.btn-auth-primary:hover{background:var(--auth-primary-dark)!important;}
.btn-auth-line{background:var(--auth-line)!important;border-color:var(--auth-line)!important;color:#fff!important;}
.auth-divider{display:flex;align-items:center;gap:12px;margin:18px 0;color:#94a3b8;font-size:12px;font-weight:700;}
.auth-divider::before,.auth-divider::after{content:'';height:1px;background:#e2e8f0;flex:1;}
.auth-note{padding:12px;border-radius:14px;background:#f8fafc;border:1px dashed #cbd5e1;font-size:12px;color:#64748b;line-height:1.6;margin-top:14px;}
.auth-result{display:none;margin-top:12px;border-radius:14px;padding:12px;font-size:12px;font-weight:600;line-height:1.6;}
.auth-result.success{display:block;background:#ecfdf5;color:#166534;border:1px solid #bbf7d0;}
.auth-result.error{display:block;background:#fef2f2;color:#991b1b;border:1px solid #fecaca;}
.auth-step-badge{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:800;color:#1d4ed8;background:#eff6ff;border-radius:999px;padding:6px 10px;margin-bottom:12px;}
.auth-reset-box{display:none;}
.auth-reset-box.active{display:block;}

.bcrm-splash{
  position:fixed;inset:0;z-index:99999;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,#0f172a 0%,#1d4ed8 100%);
  color:#fff;
  transition:opacity .35s ease,visibility .35s ease;
}
.bcrm-splash.is-hidden{opacity:0;visibility:hidden;pointer-events:none;}
.splash-content{text-align:center;padding:30px;}
.splash-logo{width:78px;height:78px;border-radius:24px;background:rgba(255,255,255,.14);display:flex;align-items:center;justify-content:center;margin:0 auto 18px;border:1px solid rgba(255,255,255,.2);}
.splash-logo i{font-size:34px;}
.splash-content h3{font-weight:800;margin:0 0 8px;font-size:24px;}
.splash-content p{margin:0;color:rgba(255,255,255,.75);font-size:13px;}
.splash-loader{width:180px;height:4px;border-radius:999px;background:rgba(255,255,255,.18);overflow:hidden;margin:24px auto 0;}
.splash-loader span{display:block;height:100%;width:45%;background:#fff;border-radius:999px;animation:splashMove 1.2s infinite ease-in-out;}
@keyframes splashMove{0%{transform:translateX(-100%)}100%{transform:translateX(260%)}}

@media (max-width: 991.98px){
  .auth-card{grid-template-columns:1fr;max-width:520px;}
  .auth-brand{display:none;}
  .auth-panel{padding:28px;}
}
@media (max-width: 575.98px){
  .auth-shell{padding:0;align-items:stretch;}
  .auth-card{border-radius:0;min-height:100vh;border:0;box-shadow:none;}
  .auth-panel{padding:24px 18px;}
  .auth-tabs{gap:3px;}
  .auth-tab{font-size:11px;}
}

/* =========================================================
   Multi-user Auth + High Security Password
========================================================= */
.auth-user-type{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin-bottom:14px;
}
.auth-type-card{
  margin:0;
  cursor:pointer;
  display:block;
}
.auth-type-card input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}
.auth-type-card span{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-height:78px;
  border:1px solid #e2e8f0;
  border-radius:14px;
  background:#fff;
  padding:12px 10px;
  transition:.18s ease;
}
.auth-type-card i{
  font-size:16px;
  color:#64748b;
  margin-bottom:2px;
}
.auth-type-card b{
  font-size:12px;
  font-weight:800;
  color:#0f172a;
  line-height:1.25;
}
.auth-type-card small{
  font-size:10px;
  color:#64748b;
  line-height:1.25;
}
.auth-type-card.active span,
.auth-type-card input:checked + span{
  border-color:#2563eb;
  background:#eff6ff;
  box-shadow:0 0 0 3px rgba(37,99,235,.10);
}
.auth-type-card.active i,
.auth-type-card input:checked + span i,
.auth-type-card.active b,
.auth-type-card input:checked + span b{
  color:#2563eb;
}
.auth-password-field .form-control{
  padding-right:46px!important;
}
.password-toggle{
  position:absolute;
  right:8px;
  top:50%;
  transform:translateY(-50%);
  width:34px;
  height:34px;
  border:0;
  border-radius:10px;
  background:#f8fafc;
  color:#64748b;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:.18s ease;
}
.password-toggle:hover{
  color:#2563eb;
  background:#eff6ff;
}
.password-strength{
  height:6px;
  border-radius:999px;
  background:#e2e8f0;
  overflow:hidden;
  margin-top:8px;
}
.password-strength span{
  display:block;
  width:0;
  height:100%;
  border-radius:999px;
  transition:.22s ease;
}
.password-strength.weak span{background:#dc2626;}
.password-strength.medium span{background:#f59e0b;}
.password-strength.strong span{background:#16a34a;}
.password-rules{
  list-style:none;
  padding:0;
  margin:8px 0 0;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:4px 8px;
}
.password-rules li{
  position:relative;
  padding-left:18px;
  font-size:11px;
  line-height:1.35;
  color:#64748b;
}
.password-rules li::before{
  content:'\f111';
  font-family:'Font Awesome 5 Free';
  font-weight:900;
  position:absolute;
  left:0;
  top:1px;
  font-size:8px;
  color:#cbd5e1;
}
.password-rules li.pass{
  color:#166534;
  font-weight:700;
}
.password-rules li.pass::before{
  content:'\f00c';
  font-size:10px;
  color:#16a34a;
}
.auth-security-note{
  display:flex;
  align-items:flex-start;
  gap:8px;
  border:1px solid #bfdbfe;
  background:#eff6ff;
  color:#1e40af;
  border-radius:14px;
  padding:10px 12px;
  font-size:12px;
  line-height:1.55;
  margin-bottom:14px;
  max-width:100%;
  min-width:0;
  overflow:hidden;
}
.auth-security-note i{margin-top:2px;}
.auth-security-note span{
  min-width:0;
  max-width:100%;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.auth-user-type-group{
  margin-bottom:16px;
}
.auth-user-type-tabs{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  padding:8px;
  border:1px solid #dbe4f0;
  border-radius:16px;
  background:#f8fafc;
  max-width:100%;
  min-width:0;
  overflow:hidden;
}
.auth-user-type-tab{
  min-width:0;
  min-height:72px;
  border:1px solid transparent;
  border-radius:12px;
  background:transparent;
  color:#475569;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  padding:10px 8px;
  max-width:100%;
  cursor:pointer;
  transition:background-color .18s ease,border-color .18s ease,box-shadow .18s ease,color .18s ease;
}
.auth-user-type-tab:hover{
  background:#fff;
  border-color:#cbd5e1;
}
.auth-user-type-tab.active{
  background:#fff;
  border-color:#2563eb;
  color:#1d4ed8;
  box-shadow:0 10px 24px rgba(37,99,235,.14);
}
.auth-user-type-icon{
  width:34px;
  height:34px;
  flex:0 0 34px;
  border-radius:11px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#e2e8f0;
  color:#64748b;
  font-size:14px;
}
.auth-user-type-tab.active .auth-user-type-icon{
  background:#eff6ff;
  color:#2563eb;
}
.auth-user-type-copy{
  min-width:0;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  line-height:1.2;
  max-width:100%;
}
.auth-user-type-copy b{
  font-size:12px;
  font-weight:800;
  color:#0f172a;
  white-space:nowrap;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
}
.auth-user-type-copy small{
  margin-top:3px;
  font-size:10px;
  font-weight:700;
  color:#64748b;
  text-transform:uppercase;
}
.auth-user-type-tab.active .auth-user-type-copy b,
.auth-user-type-tab.active .auth-user-type-copy small{
  color:#1d4ed8;
}
@media(max-width:575.98px){
  html,
  body,
  body.auth-page{
    width:100%;
    max-width:100vw;
    overflow-x:hidden!important;
  }
  body.auth-page{
    min-height:100svh;
  }
  .auth-shell{
    width:100%;
    max-width:100vw;
    min-height:100svh;
    padding:0;
    overflow-x:hidden!important;
  }
  .auth-card{
    width:100%;
    max-width:100vw;
    min-width:0;
    overflow-x:hidden;
  }
  .auth-panel{
    width:100%;
    max-width:100vw;
    min-width:0;
    padding:20px 16px calc(20px + env(safe-area-inset-bottom));
    overflow-x:hidden;
  }
  .auth-panel-header h2{
    font-size:21px;
    overflow-wrap:anywhere;
  }
  .auth-panel-header p,
  .auth-note,
  .auth-panel-actions,
  .auth-panel-actions a{
    max-width:100%;
    overflow-wrap:anywhere;
    word-break:break-word;
  }
  .auth-user-type{grid-template-columns:1fr;}
  .auth-user-type-tabs{grid-template-columns:1fr;}
  .auth-user-type-tab{
    min-height:56px;
    justify-content:flex-start;
    padding:10px 12px;
  }
  .auth-type-card span{min-height:auto;}
  .password-rules{grid-template-columns:1fr;}
  .auth-page .form-control{
    height:46px!important;
    font-size:16px!important;
    line-height:46px!important;
  }
  .btn-auth{
    height:46px!important;
    font-size:16px!important;
  }
  .auth-input-icon .form-control{
    padding-left:44px!important;
  }
  .auth-input-icon i{
    left:15px;
  }
  .password-toggle{
    width:38px;
    height:38px;
  }
  .forgot-password-text{
    max-width:100%;
    overflow-wrap:anywhere;
    word-break:break-word;
  }
}
