/* =========================================================
   ERP/HRIS Admin Template - Core Stylesheet
   Built on Bootstrap 5.3 (custom theme layer)
   ========================================================= */

:root{
  --sidebar-width: 264px;
  --sidebar-width-collapsed: 84px;
  --header-height: 70px;
  --footer-height: 52px;

  --brand-primary: #6a5fdb;
  --brand-primary-dark: #564bc7;
  --brand-secondary: #2fbf9f;
  --brand-info: #2f9bff;
  --brand-warning: #ffab2d;
  --brand-danger: #ff4d6a;
  --brand-success: #2fbf71;
  --brand-pink: #ff5ca8;

  --bs-primary: var(--brand-primary);
  --bs-primary-rgb: 106,95,219;
  --bs-success: var(--brand-success);
  --bs-info: var(--brand-info);
  --bs-warning: var(--brand-warning);
  --bs-danger: var(--brand-danger);

  --surface: #ffffff;
  --body-bg: #f4f5fb;
  --border-color: #eaebf3;
  --text-muted-2: #8a8fa3;
  --sidebar-bg: #ffffff;
  --sidebar-text: #5b6178;
  --sidebar-active-bg: rgba(106,95,219,.1);
  --header-bg: #ffffff;
  --card-radius: .9rem;
  --shadow-soft: 0 .25rem 1.5rem rgba(30,34,60,.06);
  --shadow-pop: 0 .5rem 2rem rgba(30,34,60,.12);
}

[data-bs-theme="dark"]{
  --surface: #1b1d2e;
  --body-bg: #14151f;
  --border-color: #2a2c40;
  --text-muted-2: #8a8fa3;
  --sidebar-bg: #191b2a;
  --sidebar-text: #9599b3;
  --sidebar-active-bg: rgba(106,95,219,.18);
  --header-bg: #191b2a;
  --shadow-soft: 0 .25rem 1.5rem rgba(0,0,0,.35);
  --shadow-pop: 0 .5rem 2rem rgba(0,0,0,.5);
}

body{
  background: var(--body-bg);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: .875rem;
  color: var(--bs-body-color);
}

a{ text-decoration:none; }

/* ---------------- Layout shell ---------------- */
.app-wrapper{ display:flex; min-height:100vh; }

.app-content{
  flex:1;
  margin-left: var(--sidebar-width);
  min-width:0;
  transition: margin-left .25s ease;
  display:flex;
  flex-direction:column;
  min-height:100vh;
}
body.sidebar-collapsed .app-content{ margin-left: var(--sidebar-width-collapsed); }

.page-body{ flex:1; padding: 1.5rem; }

/* ---------------- Sidebar ---------------- */
.app-sidebar{
  position:fixed;
  top:0; left:0; bottom:0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  z-index: 1030;
  display:flex;
  flex-direction:column;
  transition: width .25s ease, transform .25s ease;
}
body.sidebar-collapsed .app-sidebar{ width: var(--sidebar-width-collapsed); }

.sidebar-brand{
  height: var(--header-height);
  display:flex; align-items:center; gap:.6rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink:0;
}
.sidebar-brand .brand-mark{
  width:36px;height:36px;border-radius:10px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-pink));
  display:flex;align-items:center;justify-content:center;
  color:#fff;font-weight:700;font-size:1.05rem;flex-shrink:0;
}
.sidebar-brand .brand-text{ font-weight:700; font-size:1.05rem; color: var(--bs-body-color); white-space:nowrap; }
.sidebar-brand .brand-text small{ display:block; font-size:.68rem; font-weight:500; color:var(--text-muted-2); }
body.sidebar-collapsed .sidebar-brand .brand-text{ display:none; }

.sidebar-scroll{ flex:1; overflow-y:auto; padding: .75rem .75rem 2rem; }
.sidebar-scroll::-webkit-scrollbar{ width:5px; }
.sidebar-scroll::-webkit-scrollbar-thumb{ background: var(--border-color); border-radius:10px; }

.nav-section-title{
  font-size:.68rem; text-transform:uppercase; letter-spacing:.06em;
  color: var(--text-muted-2); font-weight:700;
  margin: 1.1rem .75rem .4rem; white-space:nowrap;
}
body.sidebar-collapsed .nav-section-title{ text-align:center; }
body.sidebar-collapsed .nav-section-title span{ display:none; }

.nav-menu{ list-style:none; margin:0; padding:0; }
.nav-menu .nav-item{ margin:.15rem 0; }

.nav-menu .nav-link{
  display:flex; align-items:center; gap:.7rem;
  padding: .55rem .75rem;
  border-radius: .6rem;
  color: var(--sidebar-text);
  font-weight:500; font-size:.85rem;
  white-space:nowrap;
  position:relative;
}
.nav-menu .nav-link i.nav-icon{ font-size:1.05rem; width:22px; text-align:center; flex-shrink:0; }
.nav-menu .nav-link .nav-badge{ margin-left:auto; }
.nav-menu .nav-link .menu-arrow{ margin-left:auto; transition: transform .2s ease; font-size:.75rem; }
.nav-menu .nav-link:hover{ background: var(--sidebar-active-bg); color: var(--brand-primary); }
.nav-menu > .nav-item > .nav-link.active{ background: var(--sidebar-active-bg); color: var(--brand-primary); font-weight:600; }
.nav-menu .nav-link[aria-expanded="true"] .menu-arrow{ transform: rotate(90deg); }

.nav-submenu{ list-style:none; padding-left: 2.35rem; margin: .1rem 0; }
.nav-submenu .nav-link{ padding: .42rem .6rem; font-size:.81rem; }
.nav-submenu .nav-link.active{ color: var(--brand-primary); font-weight:600; }
.nav-submenu .nav-link:before{
  content:""; position:absolute; left:-1rem; width:5px; height:5px; border-radius:50%;
  background: var(--text-muted-2);
}

body.sidebar-collapsed .nav-link span.nav-label,
body.sidebar-collapsed .nav-link .menu-arrow,
body.sidebar-collapsed .nav-link .nav-badge,
body.sidebar-collapsed .nav-submenu{ display:none; }
body.sidebar-collapsed .nav-menu .nav-link{ justify-content:center; }

/* ---------------- Header ---------------- */
.app-header{
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  display:flex; align-items:center;
  padding: 0 1.25rem;
  gap: 1rem;
  position: sticky; top:0; z-index:1020;
}
.header-search{ max-width:340px; }
.header-icon-btn{
  width:40px;height:40px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;
  color: var(--bs-body-color); background: var(--body-bg);
  border:1px solid var(--border-color); position:relative;
}
.header-icon-btn:hover{ background: var(--sidebar-active-bg); color:var(--brand-primary); }
.header-icon-btn .dot{
  position:absolute; top:6px; right:7px; width:8px;height:8px;border-radius:50%;
  background: var(--brand-danger); border:2px solid var(--header-bg);
}
.avatar-btn img{ width:40px;height:40px;border-radius:10px;object-fit:cover; }

/* ---------------- Cards / widgets ---------------- */
.card{
  border:1px solid var(--border-color);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-soft);
  background: var(--surface);
}
.card-header{ background:transparent; border-bottom:1px solid var(--border-color); font-weight:600; }

.stat-card .stat-icon{
  width:52px;height:52px;border-radius:14px;
  display:flex;align-items:center;justify-content:center;font-size:1.35rem;color:#fff;flex-shrink:0;
}
.stat-card .stat-value{ font-size:1.55rem; font-weight:700; }
.stat-card .stat-delta{ font-size:.78rem; font-weight:600; }

.bg-soft-primary{ background: rgba(106,95,219,.12) !important; color: var(--brand-primary) !important; }
.bg-soft-success{ background: rgba(47,191,113,.12) !important; color: var(--brand-success) !important; }
.bg-soft-info{ background: rgba(47,155,255,.12) !important; color: var(--brand-info) !important; }
.bg-soft-warning{ background: rgba(255,171,45,.14) !important; color: #d78500 !important; }
.bg-soft-danger{ background: rgba(255,77,106,.12) !important; color: var(--brand-danger) !important; }
.bg-soft-pink{ background: rgba(255,92,168,.12) !important; color: var(--brand-pink) !important; }
.bg-soft-secondary{ background: rgba(47,191,159,.12) !important; color: var(--brand-secondary) !important; }

.icon-tile{
  width:44px;height:44px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;font-size:1.1rem;flex-shrink:0;
}

.avatar{ width:42px;height:42px;border-radius:50%;object-fit:cover; }
.avatar-sm{ width:32px;height:32px;border-radius:50%;object-fit:cover; }
.avatar-lg{ width:88px;height:88px;border-radius:16px;object-fit:cover; }
.avatar-initial{
  display:inline-flex;align-items:center;justify-content:center;
  border-radius:50%; font-weight:600; color:#fff;
}

.status-dot{ width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:.4rem; }

.table thead th{
  text-transform:uppercase; font-size:.7rem; letter-spacing:.04em;
  color: var(--text-muted-2); font-weight:700; border-bottom-width:1px;
}
.table td, .table th{ vertical-align:middle; }

.badge-soft-primary{ background: rgba(106,95,219,.12); color: var(--brand-primary); }
.badge-soft-success{ background: rgba(47,191,113,.12); color: var(--brand-success); }
.badge-soft-warning{ background: rgba(255,171,45,.16); color: #d78500; }
.badge-soft-danger{ background: rgba(255,77,106,.12); color: var(--brand-danger); }
.badge-soft-info{ background: rgba(47,155,255,.12); color: var(--brand-info); }
.badge-soft-secondary{ background: rgba(138,143,163,.14); color: var(--text-muted-2); }

.list-clean{ list-style:none; margin:0; padding:0; }

.chart-holder{ position:relative; width:100%; }

/* ---------------- Auth pages ---------------- */
.auth-shell{ min-height:100vh; display:flex; align-items:stretch; }
.auth-visual{
  background: linear-gradient(155deg, var(--brand-primary), #423aa8 60%, #2c2670);
  color:#fff; position:relative; overflow:hidden;
}
.auth-visual .deco-circle{ position:absolute; border-radius:50%; background: rgba(255,255,255,.08); }

@media (max-width: 991.98px){
  .auth-shell > div:last-child{ width:100%; }
}

/* ---------------- Auth v2 (cover carousel card) ---------------- */
.auth-v2-page{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background: var(--body-bg);
  padding: 2.5rem 1.25rem;
}
.auth-v2-card{
  width:100%;
  max-width:1120px;
  min-height:640px;
  background: var(--surface);
  border-radius: 32px;
  box-shadow: var(--shadow-pop);
  overflow:hidden;
  display:flex;
}
.auth-v2-visual{
  position:relative;
  flex:0 0 52%;
  max-width:52%;
  overflow:hidden;
  background:#111;
}
.auth-v2-visual .carousel,
.auth-v2-visual .carousel-inner,
.auth-v2-visual .carousel-item{ height:100%; }
.auth-v2-visual .carousel-item img{ width:100%; height:100%; object-fit:cover; }
.auth-v2-visual::after{
  content:""; position:absolute; left:0; right:0; bottom:0; height:45%;
  background:linear-gradient(to top, rgba(8,8,16,.6), transparent);
  pointer-events:none; z-index:1;
}
.auth-v2-visual .carousel-indicators{ z-index:3; margin-bottom:.85rem; }
.auth-v2-visual .carousel-indicators [data-bs-target]{
  width:8px; height:8px; border-radius:50%; background-color:#fff; opacity:.55; margin:0 4px;
  border:0;
}
.auth-v2-visual .carousel-indicators .active{ opacity:1; width:22px; border-radius:5px; }

.auth-v2-form-side{
  flex:1;
  min-width:0;
  background: linear-gradient(160deg, #fbf9f4, #f3efe4 60%, #ece5d3);
  display:flex;
  flex-direction:column;
  padding: 2.5rem 3rem;
}
[data-bs-theme="dark"] .auth-v2-form-side{
  background: linear-gradient(160deg, #23212a, #1c1a22 60%, #17151c);
}
.auth-v2-brand-pill{
  display:inline-flex; align-items:center; gap:.5rem;
  padding:.5rem 1rem; border-radius:2rem; border:1px solid var(--border-color);
  font-weight:700; font-size:.85rem; width:fit-content; color:var(--bs-body-color);
  background: var(--surface);
}
.auth-v2-form-wrap{ flex:1; display:flex; flex-direction:column; justify-content:center; max-width:360px; margin:0 auto; width:100%; }
.auth-v2-btn-cta{
  background: var(--brand-warning); border-color:var(--brand-warning); color:#3a2600;
  border-radius:14px; font-weight:700; padding:.7rem 1rem;
}
.auth-v2-btn-cta:hover{ background:#f19d00; border-color:#f19d00; color:#3a2600; }
.auth-v2-social-btn{ border-radius:14px; padding:.6rem 1rem; }
.auth-v2-form-wrap .form-control,
.auth-v2-form-wrap .form-select{ border-radius:14px; padding:.7rem 1rem; }

.auth-v2-float-chip{
  position:absolute; background:rgba(18,18,28,.55); backdrop-filter:blur(6px);
  color:#fff; border-radius:14px; padding:.55rem .85rem; font-size:.76rem; z-index:2;
  display:flex; align-items:center; gap:.5rem;
}
.auth-v2-avatars-float{ position:absolute; z-index:2; display:flex; align-items:center; }
.auth-v2-avatars-float img{ width:32px;height:32px;border-radius:50%;border:2px solid #fff; margin-left:-10px; }
.auth-v2-avatars-float img:first-child{ margin-left:0; }
.auth-v2-meeting-card{
  position:absolute; z-index:2; background:rgba(255,255,255,.94); color:#20222c;
  border-radius:16px; padding:.75rem 1rem; min-width:200px; box-shadow:0 12px 30px rgba(0,0,0,.25);
}

.auth-v2-mobile-trigger{ display:none; }
.password-toggle-btn{ cursor:pointer; }

@media (max-width: 991.98px){
  .auth-v2-page{ padding:1.25rem .75rem; }
  .auth-v2-card{ flex-direction:column; min-height:auto; border-radius:24px; }
  .auth-v2-visual{ display:none; }
  .auth-v2-form-side{ padding:2rem 1.5rem; }
  .auth-v2-form-wrap{ max-width:420px; }
  .auth-v2-mobile-trigger{
    display:flex; align-items:center; gap:.75rem; cursor:pointer; text-align:left;
    background: var(--body-bg); border:1px solid var(--border-color); width:100%;
    border-radius:16px; padding:.7rem .9rem; margin-bottom:1.5rem;
  }
}

#authCoverModal .modal-content{ border-radius:24px; overflow:hidden; border:0; }
#authCoverModal .carousel-item img{ width:100%; height:60vh; object-fit:cover; }
#authCoverModal .btn-close{
  position:absolute; top:1rem; right:1rem; z-index:5; background-color:#fff;
  border-radius:50%; padding:.5rem; opacity:1;
}

/* ---------------- Kanban ---------------- */
.kanban-col{ background: var(--body-bg); border-radius: var(--card-radius); min-width:290px; }
.kanban-card{ cursor:grab; }
.kanban-card:active{ cursor:grabbing; }

/* ---------------- Misc ---------------- */
.icon-custom{ width:1.35em; height:1.35em; fill:currentColor; vertical-align:-0.22em; display:inline-block; }
.icon-set-tabs{ display:flex; flex-wrap:wrap; gap:.4rem; margin-bottom:1.25rem; }
.icon-set-tabs a{
  padding:.4rem .9rem; border-radius:2rem; font-size:.8rem; font-weight:600;
  color: var(--sidebar-text); background: var(--surface); border:1px solid var(--border-color);
}
.icon-set-tabs a.active{ background: var(--brand-primary); border-color: var(--brand-primary); color:#fff; }
.code-block{
  background: var(--body-bg); border:1px solid var(--border-color); border-radius:.7rem;
  padding:1rem 1.1rem; font-family: "Consolas","Monaco",monospace; font-size:.8rem;
  overflow-x:auto; white-space:pre; line-height:1.6; margin:0;
}
.step-num-badge{
  width:28px;height:28px;border-radius:50%;background:var(--brand-primary);color:#fff;
  display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:.8rem;flex-shrink:0;
}

.fw-600{ font-weight:600; }
.text-muted-2{ color: var(--text-muted-2) !important; }
.rounded-14{ border-radius: 14px !important; }
.min-w-0{ min-width:0; }
.cursor-pointer{ cursor:pointer; }

.timeline{ list-style:none; margin:0; padding:0; position:relative; }
.timeline li{ position:relative; padding-left:2rem; padding-bottom:1.5rem; }
.timeline li:before{ content:""; position:absolute; left:5px; top:4px; bottom:-1.2rem; width:2px; background: var(--border-color); }
.timeline li:last-child:before{ display:none; }
.timeline li .t-dot{ position:absolute; left:0; top:2px; width:12px;height:12px;border-radius:50%; }

/* ---------------- Responsive ---------------- */
@media (max-width: 991.98px){
  .app-sidebar{ transform: translateX(-100%); width: var(--sidebar-width); }
  body.sidebar-mobile-open .app-sidebar{ transform: translateX(0); box-shadow: var(--shadow-pop); }
  .app-content{ margin-left:0; }
  body.sidebar-collapsed .app-content{ margin-left:0; }
  .sidebar-backdrop{
    display:none; position:fixed; inset:0; background: rgba(15,16,30,.5); z-index:1025;
  }
  body.sidebar-mobile-open .sidebar-backdrop{ display:block; }
}

@media (max-width: 575.98px){
  .page-body{ padding: 1rem; }
  .header-search{ display:none; }
}
