*{box-sizing:border-box;margin:0;padding:0}
:root{
  --purple:#6E45E2;--purple-dark:#5932C5;--purple-light:#F0EEFF;--purple-mid:#EDE9FF;
  --bg:#F4F5F9;--white:#ffffff;--border:#EEF0F3;--border2:#D1D5DB;
  --text:#0A0915;--text2:#5E6278;--text3:#8E95A5;
  --green:#10B981;--green-light:#E8FFF3;--orange:#FF9900;--orange-light:#FFF8DD;
  --red:#F1416C;--red-light:#FFF5F8;--blue:#00A3FF;--blue-light:#E0F2FE;
  --yellow:#FFC700;--yellow-light:#FFF8DD;
  --sidebar-w:240px;--topbar-h:76px;
  --r:20px;--r-sm:12px;
  --shadow:0 6px 20px rgba(0,0,0,0.025);
  --shadow-md:0 12px 30px rgba(110,69,226,0.06);
}
body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--text);min-height:100vh;font-size:13.5px;line-height:1.5;-webkit-font-smoothing:antialiased}

/* ===== TOPBAR ===== */
.topbar{
  position:fixed;top:16px;left:20px;right:20px;height:var(--topbar-h);
  background:var(--white);border-radius:var(--r);border:1px solid var(--border);
  box-shadow:var(--shadow);
  display:flex;align-items:center;padding:0 24px;gap:16px;z-index:200;
}
.topbar-brand{display:flex;align-items:center;gap:12px;width:280px;flex-shrink:0}
.brand-icon{
  width:40px;height:40px;background:#0A0915;border-radius:50%;
  display:flex;align-items:center;justify-content:center;flex-shrink:0;color:#fff;
}
.brand-icon svg{width:22px;height:22px}
.brand-logo{height:36px;width:auto;max-width:170px;object-fit:contain;display:block}
.brand-name{font-size:16px;font-weight:700;color:var(--text);letter-spacing:-0.4px}
.topbar-search{
  flex:1;max-width:480px;margin:0 auto;
  display:flex;align-items:center;gap:10px;
  background:#F4F6F9;border:1px solid transparent;border-radius:30px;
  padding:10px 18px;color:var(--text3);font-size:13px;
}
.topbar-search input{border:none;background:transparent;outline:none;color:var(--text);font-size:13px;font-family:'Inter',sans-serif;flex:1}
.topbar-search svg{width:18px;height:18px;flex-shrink:0;color:var(--text3)}
.topbar-right{margin-left:auto;width:280px;flex-shrink:0;display:flex;align-items:center;justify-content:flex-end;gap:20px}
.notif-btn{
  position:relative;width:42px;height:42px;border-radius:50%;
  border:1px solid var(--border);background:var(--white);
  display:flex;align-items:center;justify-content:center;cursor:pointer;
  transition:all 0.15s ease;
}
.notif-btn:hover{border-color:var(--purple);background:var(--purple-light)}
.notif-btn svg{width:20px;height:20px;color:var(--text2)}
.notif-badge{
  position:absolute;top:-2px;right:-2px;
  background:var(--purple);color:#fff;font-size:9px;font-weight:700;
  width:18px;height:18px;border-radius:50%;border:2px solid #fff;
  display:flex;align-items:center;justify-content:center;
}
.user-pill{
  display:flex;align-items:center;gap:12px;padding:4px;
  cursor:pointer;background:transparent;
  transition:all 0.15s ease;
  text-decoration:none;
}
.user-avatar{
  width:36px;height:36px;border-radius:50%;background:var(--blue);
  display:flex;align-items:center;justify-content:center;
  font-size:13px;font-weight:700;color:#fff;flex-shrink:0;
}
.user-info{display:flex;flex-direction:column;align-items:flex-start}
.user-info .user-name{font-size:13px;font-weight:700;color:var(--text);line-height:1.2}
.user-info .user-role{font-size:11px;color:var(--text3);margin-top:2px}
.user-pill svg{width:16px;height:16px;color:var(--text3);margin-left:4px}

/* ===== SIDEBAR ===== */
.sidebar{
  position:fixed;top:108px;left:20px;bottom:20px;
  width:var(--sidebar-w);background:var(--white);
  border-radius:var(--r);border:1px solid var(--border);box-shadow:var(--shadow);
  display:flex;flex-direction:column;padding:24px 18px;z-index:100;overflow:visible;
}
.quick-add-btn{
  width:48px;height:48px;background:var(--purple);border-radius:14px;
  display:flex;align-items:center;justify-content:center;color:#fff;
  cursor:pointer;margin-bottom:28px;margin-left:10px;
  box-shadow:0 6px 16px rgba(110,69,226,0.25);transition:all 0.2s ease;
  border:none;text-decoration:none;
}
.quick-add-btn:hover{background:var(--purple-dark);transform:scale(1.05)}
.quick-add-btn svg{width:22px;height:22px}
.nav-item{
  display:flex;align-items:center;gap:14px;
  padding:12px 16px;border-radius:12px;
  color:var(--text2);cursor:pointer;
  font-size:13.5px;font-weight:500;
  margin-bottom:6px;text-decoration:none;
  transition:all 0.15s ease;
}
.nav-item:hover{background:var(--purple-light);color:var(--purple)}
.nav-item.active{background:var(--purple-light);color:var(--purple);font-weight:700}
.nav-item svg{width:20px;height:20px;flex-shrink:0}
.nav-item .nav-badge{
  margin-left:auto;background:var(--purple);color:#fff;
  font-size:10px;font-weight:600;padding:2px 7px;border-radius:20px;
}
.nav-item .nav-badge.warn{background:var(--orange)}
.sidebar-copyright{font-size:11px;color:var(--text3);margin-top:auto;padding-left:12px;padding-top:16px}

/* ===== MAIN ===== */
.main{
  margin-left:276px;
  margin-top:108px;
  min-height:calc(100vh - 128px);
  padding:16px 20px 48px;
}

/* ===== PAGE HEADER ===== */
.page-hdr{margin-bottom:24px}
.page-hdr h1{font-size:24px;font-weight:700;letter-spacing:-0.5px;color:var(--text)}
.page-hdr p{font-size:13.5px;color:var(--text3);margin-top:4px}
.page-hdr-row{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:24px;gap:16px}
@media (max-width:640px){
  .page-hdr-row{flex-direction:column;align-items:stretch}
  .page-hdr-row > div{width:100%}
  .page-hdr-row div[style*="display:flex"]{width:100%;flex-direction:column;gap:12px}
  .page-hdr-row .btn{width:100%!important}
}
.page-hdr-row h1{font-size:24px;font-weight:700;letter-spacing:-0.5px;color:var(--text)}
.page-hdr-row p{font-size:13.5px;color:var(--text3);margin-top:4px}
.breadcrumb{display:flex;align-items:center;gap:6px;font-size:12.5px;color:var(--text3);margin-bottom:8px}
.breadcrumb a{color:var(--purple);font-weight:500;cursor:pointer;text-decoration:none}
.breadcrumb svg{width:12px;height:12px}

/* ===== BUTTONS ===== */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:10px 20px;border-radius:10px;font-size:13.5px;font-weight:600;
  cursor:pointer;border:none;transition:all 0.2s ease;font-family:'Inter',sans-serif;
  text-decoration:none;
}
.btn svg{width:16px;height:16px}
.btn-purple{background:var(--purple);color:#fff;box-shadow:0 4px 12px rgba(110,69,226,0.15)}
.btn-purple:hover{background:var(--purple-dark);transform:translateY(-1px);box-shadow:0 6px 16px rgba(110,69,226,0.25)}
.btn-outline{background:var(--white);color:var(--text2);border:1.5px solid var(--border)}
.btn-outline:hover{border-color:var(--purple);color:var(--purple);background:var(--purple-light)}
.btn-sm{padding:7px 14px;font-size:12px;border-radius:8px}

/* ===== STAT CARDS ===== */
.stats-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:16px;margin-bottom:24px}
.stat-card{
  background:var(--white);border:1px solid var(--border);border-radius:16px;
  padding:20px;box-shadow:var(--shadow);
  display:flex;align-items:center;gap:16px;
}
.stat-icon-wrap{
  width:46px;height:46px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.stat-icon-wrap svg{width:22px;height:22px}
.si-purple{background:var(--purple-light);color:var(--purple)}
.si-green{background:var(--green-light);color:var(--green)}
.si-orange{background:var(--orange-light);color:var(--orange)}
.si-blue{background:var(--blue-light);color:var(--blue)}
.si-yellow{background:var(--yellow-light);color:#B7860A}
.stat-content{display:flex;flex-direction:column;gap:2px;flex:1}
.stat-label{font-size:12px;color:var(--text3);font-weight:500}
.stat-val{font-size:22px;font-weight:700;letter-spacing:-0.4px;color:var(--text);line-height:1.2}
.stat-trend{font-size:11px;margin-top:2px;display:flex;align-items:center;gap:4px}
.trend-up{color:var(--green);font-weight:600}
.trend-down{color:var(--red);font-weight:600}
.trend-label{color:var(--text3);font-weight:400}

/* ===== CARDS ===== */
.card{background:var(--white);border-radius:12px;border:1px solid var(--border);overflow:hidden;margin-bottom:0}
.card-hdr{display:flex;align-items:center;justify-content:space-between;padding:18px 24px;border-bottom:1px solid var(--border);gap:8px;flex-wrap:wrap}
.card-body{padding:24px}

/* ===== GRID SYSTEM ===== */
.grid-6{display:grid;grid-template-columns:repeat(6,1fr);gap:20px}
.grid-5{display:grid;grid-template-columns:repeat(5,1fr);gap:20px}
.grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.grid-2{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}
.grid-full{grid-column:span 2}

@media (max-width:1200px){
  .grid-6{grid-template-columns:repeat(4,1fr)}
  .grid-5{grid-template-columns:repeat(3,1fr)}
}
@media (max-width:900px){
  .grid-6,.grid-5,.grid-4{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:600px){
  .grid-6,.grid-5,.grid-4,.grid-3,.grid-2{grid-template-columns:1fr}
  .grid-full{grid-column:span 1!important}
}

/* ===== TABLE SEARCH ===== */
.card-search-wrap{
  position:relative;display:flex;align-items:center;
  background:#F4F6F9;border-radius:30px;padding:6px 14px;width:240px;
}
.card-search-wrap input{border:none;background:transparent;outline:none;font-size:12.5px;color:var(--text);width:100%;padding-left:6px;font-family:'Inter',sans-serif}
.card-search-wrap svg{width:15px;height:15px;color:var(--text3)}

/* ===== FILTER BAR ===== */
.filter-bar{
  background:var(--white);border:1px solid var(--border);border-radius:16px;
  padding:20px;margin-bottom:24px;display:flex;align-items:flex-end;gap:16px;
  flex-wrap:wrap;box-shadow:var(--shadow);
}
.filter-group{display:flex;flex-direction:column;gap:6px;flex:1;min-width:140px}
.filter-group label{font-size:12px;font-weight:600;color:var(--text2);margin-bottom:2px}
.filter-input,.filter-select{
  height:42px;padding:0 14px;border:1.5px solid var(--border);border-radius:10px;
  font-size:13px;font-family:'Inter',sans-serif;color:var(--text);background:var(--white);
  outline:none;width:100%;transition:all 0.15s ease;
}
.filter-input:focus,.filter-select:focus{border-color:var(--purple);box-shadow:0 0 0 3px rgba(110,69,226,0.08)}

/* ===== TABLE ===== */
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:12.5px}
th{
  font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px;
  color:var(--text3);padding:11px 14px;
  background:#FAFAFC;border-bottom:1px solid var(--border);white-space:nowrap;text-align:left;
}
td{padding:11px 14px;font-size:12.5px;line-height:1.4;border-bottom:1px solid var(--border);vertical-align:middle;color:var(--text)}
tr:last-child td{border-bottom:none}
tbody tr:hover td{background:#FAFAFC}

/* ===== PROGRESS BAR ===== */
.prog-col{display:flex;flex-direction:column;gap:5px;min-width:120px}
.prog-val-text{font-size:12px;font-weight:600;color:var(--text)}
.prog-bar{height:6px;background:#EEF1F6;border-radius:10px;overflow:hidden;width:100%}
.prog-fill{height:100%;border-radius:10px;background:var(--purple);transition:width 0.4s}
.prog-fill.green{background:var(--green)}
.prog-fill.orange{background:var(--orange)}
.prog-fill.red{background:var(--red)}

/* ===== ACTION BUTTONS ===== */
.btn-icon-square {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-icon-square:hover {
  border-color: var(--purple);
  color: var(--purple);
  background: var(--purple-light);
}
.btn-icon-square svg {
  width: 16px;
  height: 16px;
}

/* ===== BADGES ===== */
.badge{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:30px;font-size:11px;font-weight:600;white-space:nowrap}
.b-green{background:var(--green-light);color:#008A56}
.b-blue{background:var(--blue-light);color:var(--blue)}
.b-orange{background:var(--orange-light);color:#D97706}
.b-red{background:var(--red-light);color:#DC2626}
.b-purple{background:var(--purple-light);color:var(--purple)}
.b-yellow{background:var(--yellow-light);color:#B7860A}
.b-gray{background:#f3f4f6;color:var(--text2);border:1px solid var(--border)}
.badge .dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}

/* ===== AVATAR ===== */
.av{display:inline-flex;align-items:center;justify-content:center;border-radius:8px;font-weight:700;color:#fff;flex-shrink:0}
.av-sm{width:36px;height:36px;font-size:13px;border-radius:8px}
.av-md{width:44px;height:44px;font-size:15px;border-radius:10px}
.av-lg{width:64px;height:64px;font-size:20px;border-radius:14px}
.av-round{border-radius:50%!important}
.cell-person{display:flex;align-items:center;gap:12px}
.cell-name{font-weight:500;font-size:12.5px;color:var(--text)}
.cell-sub{font-size:12px;color:var(--text3);margin-top:2px}

/* ===== LEAVE ===== */
.leave-item{display:flex;align-items:center;gap:14px;padding:14px 0;border-bottom:1px solid var(--border)}
.leave-item:last-child{border-bottom:none}
.leave-info{flex:1}
.leave-name{font-size:13.5px;font-weight:600}
.leave-meta{font-size:12px;color:var(--text3);margin-top:2px}
.leave-actions{display:flex;gap:6px}
.act-btn{padding:6px 13px;border-radius:7px;font-size:12px;font-weight:600;border:none;cursor:pointer;font-family:'Inter',sans-serif;transition:all 0.12s}
.act-approve{background:var(--green-light);color:#00875a}
.act-approve:hover{background:#c4f0e3}
.act-reject{background:var(--red-light);color:var(--red)}
.act-reject:hover{background:#ffd5d5}

/* ===== TABS ===== */
.tab-bar{display:flex;border-bottom:1.5px solid var(--border);padding:0 20px}
.tab{padding:12px 16px;font-size:13px;font-weight:500;color:var(--text3);cursor:pointer;border-bottom:2.5px solid transparent;margin-bottom:-1.5px;transition:all 0.13s;white-space:nowrap}
.tab.active{color:var(--purple);border-bottom-color:var(--purple);font-weight:700}
.tab:hover:not(.active){color:var(--text)}
.tab-panel{display:none}.tab-panel.active{display:block}

/* ===== OPENING CARDS ===== */
.opening-card{background:var(--white);border:1px solid var(--border);border-radius:var(--r);padding:18px 20px;box-shadow:var(--shadow);margin-bottom:12px;cursor:pointer;transition:box-shadow 0.15s}
.opening-card:hover{box-shadow:var(--shadow-md)}
.opening-title{font-size:15px;font-weight:700;color:var(--text);margin-bottom:8px}
.opening-meta{display:flex;flex-wrap:wrap;gap:12px;margin-top:6px}
.opening-meta-item{display:flex;align-items:center;gap:5px;font-size:12px;color:var(--text2)}
.opening-meta-item svg{width:12px;height:12px;color:var(--text3)}
.opening-footer{display:flex;align-items:center;justify-content:space-between;margin-top:14px;padding-top:12px;border-top:1px solid var(--border)}
.pile{display:flex}.pile-av{width:24px;height:24px;border-radius:50%;border:2px solid #fff;margin-right:-7px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff}

/* ===== ACTIVITY ===== */
.act-item{display:flex;align-items:flex-start;gap:12px;padding:12px 0;border-bottom:1px solid var(--border)}
.act-item:last-child{border-bottom:none}
.act-icon{width:34px;height:34px;border-radius:9px;display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:1px}
.act-icon svg{width:15px;height:15px}
.act-text{font-size:13px;color:var(--text)}
.act-text strong{font-weight:700}
.act-time{font-size:11px;color:var(--text3);margin-top:3px}

/* ===== ATTENDANCE CAL ===== */
.att-cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:5px;margin-bottom:10px}
.att-day-lbl{font-size:10px;font-weight:700;color:var(--text3);text-align:center;text-transform:uppercase;letter-spacing:0.5px;padding-bottom:3px}
.att-cell{aspect-ratio:1;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;cursor:pointer;border:1.5px solid transparent;transition:all 0.12s}
.att-present{background:#e6faf6;color:#007a5a}
.att-absent{background:#ffeaea;color:#c0392b}
.att-half{background:var(--yellow-light);color:#8a6d00}
.att-weekend{background:#f3f4f6;color:var(--text3)}
.att-empty{background:transparent;border:none!important}
.att-today{border-color:var(--purple)!important;background:var(--purple-light)!important;color:var(--purple)!important}

/* ===== TASK LIST ===== */
.task-item{display:flex;align-items:flex-start;gap:12px;padding:12px 0;border-bottom:1px solid var(--border)}
.task-item:last-child{border-bottom:none}
.task-check{width:19px;height:19px;border-radius:5px;border:1.5px solid var(--border2);flex-shrink:0;margin-top:1px;cursor:pointer;display:flex;align-items:center;justify-content:center;background:var(--white);transition:all 0.12s}
.task-check.done{background:var(--purple);border-color:var(--purple)}
.task-check.done svg{display:block}
.task-check svg{display:none;width:11px;height:11px;color:#fff}
.task-title{font-size:13.5px;font-weight:600;color:var(--text)}
.task-title.done{text-decoration:line-through;color:var(--text3)}
.task-meta{font-size:12px;color:var(--text3);margin-top:3px;display:flex;gap:8px}

/* ===== PROFILE ===== */
.profile-hero{background:linear-gradient(135deg,#6E45E2 0%,#A29BFE 100%);padding:28px 24px 72px;border-radius:var(--r) var(--r) 0 0}
.profile-av{width:72px;height:72px;border-radius:50%;border:4px solid rgba(255,255,255,0.4);background:rgba(255,255,255,0.2);display:flex;align-items:center;justify-content:center;font-size:24px;font-weight:700;color:#fff;margin-bottom:12px}
.profile-name{font-size:20px;font-weight:700;color:#fff;letter-spacing:-0.4px}
.profile-role{font-size:13px;color:rgba(255,255,255,0.75);margin-top:4px}
.profile-body{background:var(--white);border:1px solid var(--border);border-top:none;border-radius:0 0 var(--r) var(--r);padding:20px 24px}
.prof-info-grid{display:grid;grid-template-columns:1fr 1fr;gap:0}
.prof-info-item{padding:12px 0;border-bottom:1px solid var(--border)}
.prof-info-item:nth-last-child(-n+2){border-bottom:none}
.prof-lbl{font-size:11px;font-weight:600;color:var(--text3);text-transform:uppercase;letter-spacing:0.4px;margin-bottom:4px}
.prof-val{font-size:14px;color:var(--text);font-weight:500}

/* ===== REPORT TABLE ===== */
.report-filter{display:flex;gap:12px;align-items:center;padding:14px 20px;border-bottom:1px solid var(--border);flex-wrap:wrap}

/* ===== MISC UTILS ===== */
.two-col{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.three-col-2{display:grid;grid-template-columns:2fr 1fr;gap:16px}
.score-bar-wrap{display:flex;align-items:center;gap:7px}
.score-bar{width:64px;height:5px;background:#eee;border-radius:3px;overflow:hidden}
.score-fill{height:100%;border-radius:3px;background:var(--purple)}
code{font-family:'Inter',monospace;font-size:12px;background:var(--bg);padding:2px 6px;border-radius:4px;color:var(--purple)}
.legend{display:flex;gap:14px;margin-top:8px}
.legend-item{display:flex;align-items:center;gap:5px;font-size:11px;color:var(--text2)}
.legend-dot{width:8px;height:8px;border-radius:2px}
.alert-banner{display:flex;align-items:center;gap:10px;padding:11px 16px;border-radius:var(--r);font-size:13px;margin-bottom:18px}
.alert-info{background:var(--blue-light);color:var(--blue);border:1px solid #c0dcf5}
.alert-banner svg{width:15px;height:15px;flex-shrink:0}
.alert-close{margin-left:auto;cursor:pointer;opacity:0.5}
.tag{display:inline-flex;align-items:center;padding:3px 9px;border-radius:5px;font-size:11px;font-weight:500;background:var(--bg);color:var(--text2);border:1px solid var(--border);margin-right:4px}
.page{display:none}.page.active{display:block}

/* scrollbar */
::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}

/* QUICK ADD DROPDOWN */
.quick-menu{
  position:absolute;left:68px;top:0;
  background:var(--white);border:1px solid var(--border);border-radius:12px;
  box-shadow:var(--shadow-md);padding:8px 0;z-index:999;min-width:180px;display:none;
}
.quick-menu::before {
  content: '';
  position: absolute;
  top: 19px;
  left: -5px;
  width: 8px;
  height: 8px;
  background: var(--white);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}
.quick-menu.open{display:block}
.quick-menu-item{
  display:flex;align-items:center;gap:10px;padding:10px 16px;
  font-size:13px;font-weight:500;color:var(--text);cursor:pointer;
  text-decoration:none;
}
.quick-menu-item:hover{background:var(--purple-light);color:var(--purple)}
.quick-menu-item svg{width:16px;height:16px;color:var(--text2);transition:color 0.15s ease}
.quick-menu-item:hover svg{color:var(--purple)}
.quick-label{font-size:11px;font-weight:600;color:var(--text3);text-transform:uppercase;letter-spacing:0.4px;padding:8px 16px 4px}

/* DONUT */
.donut-wrap{position:relative;flex-shrink:0}
.donut-center{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center}
.donut-val{font-size:20px;font-weight:700;color:var(--text);letter-spacing:-0.5px}
.donut-lbl{font-size:10px;color:var(--text3)}
.chart-legend .cli{display:flex;align-items:center;gap:8px;margin-bottom:10px;font-size:12.5px}
.chart-legend .cli-dot{width:10px;height:10px;border-radius:3px;flex-shrink:0}
.chart-legend .cli-lbl{flex:1;color:var(--text2)}
.chart-legend .cli-val{font-weight:700;color:var(--text)}

/* PROGRESS METER */
.leave-meter{background:var(--bg);border-radius:var(--r);padding:16px;margin-bottom:10px}
.leave-meter-hdr{display:flex;justify-content:space-between;margin-bottom:8px}
.leave-meter-type{font-size:12px;font-weight:700;color:var(--text)}
.leave-meter-val{font-size:13px;font-weight:700}

a{text-decoration:none;color:inherit}
.form-section{font-size:14px;font-weight:700;color:var(--text);margin:24px 0 16px;padding-bottom:12px;border-bottom:2px solid var(--purple-light);display:flex;align-items:center;gap:10px}
.form-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px}
.form-grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.form-group{margin-bottom:0}
.form-label{display:block;font-size:12.5px;font-weight:500;color:var(--text2);margin-bottom:6px}
.form-control{
  width:100%;height:42px;padding:0 14px;border:1.5px solid var(--border);border-radius:10px;
  font-size:13px;font-family:'Inter',sans-serif;color:var(--text);background:var(--white);outline:none;
  transition:all 0.15s ease;
}
.form-control:focus{border-color:var(--purple);box-shadow:0 0 0 3px rgba(110, 69, 226, 0.1)}
select.form-control{cursor:pointer}
textarea.form-control{resize:vertical;height:auto;padding:12px 14px;min-height:100px}
.form-check{display:flex;align-items:center;gap:8px;font-size:13px;cursor:pointer}
.form-check input{accent-color:var(--purple)}
.upload-box{border:2px dashed var(--border);border-radius:16px;padding:24px;text-align:center;color:var(--text3);cursor:pointer;transition:all 0.15s ease}
.upload-box:hover{border-color:var(--purple);background:var(--purple-light)}
.upload-box svg{width:32px;height:32px;margin-bottom:8px;color:var(--text3)}
.upload-box p{font-size:12px;margin-top:4px}
.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:0}
.detail-item{padding:14px 0;border-bottom:1px solid rgba(228, 230, 239, 0.6)}
.detail-lbl{font-size:12px;font-weight:500;color:var(--text2);margin-bottom:4px}
.detail-val{font-size:13.5px;color:var(--text);font-weight:500}
.input-group{position:relative}
.input-group .toggle-pw{position:absolute;right:12px;top:50%;transform:translateY(-50%);cursor:pointer;background:none;border:none;color:var(--text3);font-size:16px}
.pagination{display:flex;gap:6px;align-items:center;justify-content:flex-end;margin-top:20px}
.pg-btn{width:34px;height:34px;border-radius:8px;border:1.5px solid var(--border);background:var(--white);cursor:pointer;font-size:12px;font-weight:600;display:flex;align-items:center;justify-content:center;color:var(--text2);transition:all 0.15s ease}
.pg-btn.active{background:var(--purple);color:#fff;border-color:var(--purple)}
.pg-btn:hover:not(.active){border-color:var(--purple);color:var(--purple)}
.btn-green{background:var(--green);color:#fff}
.btn-green:hover{background:#47bc7b}
.btn-red{background:var(--red);color:#fff}
.btn-red:hover{background:#d9305b}
.three-col{display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px}

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

/* Hamburger button — hidden on desktop */
.hamburger{
  display:none;flex-direction:column;justify-content:center;gap:5px;
  width:38px;height:38px;border:none;background:none;cursor:pointer;padding:6px;flex-shrink:0;
}
.hamburger span{display:block;height:2px;border-radius:2px;background:var(--text);transition:all 0.2s}

/* Desktop: the ☰ button collapses the sidebar to give pages full width */
@media (min-width:901px){
  .hamburger{display:flex;margin-right:-4px;border-radius:10px;transition:background .15s}
  .hamburger:hover{background:var(--purple-light)}
  .sidebar{transition:transform .25s cubic-bezier(0.4,0,0.2,1), opacity .2s ease}
  .main, .follow-sidebar{transition:margin-left .25s cubic-bezier(0.4,0,0.2,1), left .25s cubic-bezier(0.4,0,0.2,1)}
  .sidebar{transition:width .22s cubic-bezier(0.4,0,0.2,1), padding .22s ease, box-shadow .2s ease}
  /* collapsed = icon-only rail; it stays icon-only on hover - only the hamburger opens it again */
  body.sidebar-collapsed .sidebar{width:76px;padding:24px 12px;overflow:hidden}
  body.sidebar-collapsed .sidebar .nav-item{font-size:0;gap:0;justify-content:center;padding:12px 0}
  /* sub-menus and their arrows would spill text into the icon rail - they come back when the sidebar is opened with the hamburger */
  body.sidebar-collapsed .sidebar [id$="SubNav"],
  body.sidebar-collapsed .sidebar .nav-item > svg[id$="Arrow"]{display:none}
  body.sidebar-collapsed .sidebar .nav-badge,
  body.sidebar-collapsed .sidebar .sidebar-copyright,
  body.sidebar-collapsed .sidebar .sb-target{display:none}

  body.sidebar-collapsed .sidebar .quick-label{font-size:0;height:1px;margin:10px 14px;padding:0;background:var(--border);overflow:hidden}
  body.sidebar-collapsed .sidebar .quick-add-btn{margin-left:2px}
  body.sidebar-collapsed .sidebar div{scrollbar-width:none}
  body.sidebar-collapsed .sidebar div::-webkit-scrollbar{display:none}
  body.sidebar-collapsed .main{margin-left:92px}
  body.sidebar-collapsed .follow-sidebar{left:92px !important}
}
body.no-sidebar-anim .sidebar, body.no-sidebar-anim .main, body.no-sidebar-anim .follow-sidebar{transition:none !important}

/* Mobile tables: wrapped by base.html's script so wide tables scroll sideways instead of being clipped */
.auto-table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
@media (max-width:900px){
  .auto-table-scroll{overscroll-behavior-x:contain}
  .auto-table-scroll::-webkit-scrollbar{height:6px}
  .auto-table-scroll::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:6px}
}

/* Sidebar overlay backdrop */
.sidebar-overlay{
  display:none;position:fixed;inset:0;background:rgba(0,0,0,0.35);z-index:99;cursor:pointer;
}
.sidebar-overlay.open{display:block}

@media (max-width:900px){
  /* Show hamburger */
  .hamburger{display:flex}
  .topbar-brand{width:auto}
  .topbar-search{display:none}
  .topbar-right{width:auto}

  /* Reset topbar and sidebar margins for standard fixed layout on tablet */
  .topbar{
    top:0;left:0;right:0;width:100%;height:var(--topbar-h);border-radius:0;border-left:none;border-right:none;border-top:none;
  }
  
  /* Sidebar becomes a slide-in drawer */
  .sidebar{
    top:var(--topbar-h);left:0;bottom:0;width:240px;border-radius:0;border-top:none;border-left:none;border-bottom:none;
    transform:translateX(-100%);transition:transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);z-index:150;
  }
  .sidebar.open{transform:translateX(0)}
  .quick-add-btn{margin-left:0}

  /* Main takes full width */
  .main{margin-left:0;margin-top:var(--topbar-h);min-height:calc(100vh - var(--topbar-h));padding:20px 16px 48px}

  /* Stats: 3 cols on tablet, 2 on small */
  .stats-grid{grid-template-columns:repeat(auto-fit,minmax(180px,1fr))}

  /* Multi-column layouts: 2 cols */
  .three-col{grid-template-columns:1fr 1fr}
  .three-col-2{grid-template-columns:1fr}
  .form-grid{grid-template-columns:1fr 1fr}
}

@media (max-width:640px){
  /* Topbar: shrink user pill */
  .topbar{padding:0 14px;gap:10px}
  .user-info{display:none}
  .filter-bar .btn{flex:1;justify-content:center}

  /* Tables */
  .table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
  table{min-width:500px}

  /* Cards */
  .card-hdr{flex-wrap:wrap;gap:8px}
  .card-body{padding:16px}

  /* Tabs */
  .tab-bar{padding:0 8px;overflow-x:auto;flex-wrap:nowrap}
  .tab{padding:10px 12px;font-size:12px;white-space:nowrap}

  /* Leave */
  .leave-item{flex-wrap:wrap;gap:10px}
  .leave-actions{flex-wrap:wrap;gap:6px;width:100%}
  .act-btn{flex:1;text-align:center}

  /* Attendance calendar */
  .att-cal-grid{gap:3px}
  .att-cell{font-size:9px;border-radius:4px}
  .att-day-lbl{font-size:9px}
  .legend{flex-wrap:wrap;gap:8px}

  /* Opening cards */
  .opening-footer{flex-direction:column;align-items:flex-start;gap:10px}
  .opening-meta{gap:8px}

  /* Profile / Employee detail */
  .profile-hero{padding:20px 16px 52px}
  .profile-av{width:58px;height:58px;font-size:18px}
  .profile-name{font-size:17px}
  .prof-info-item:nth-last-child(-n+2){border-bottom:1px solid var(--border)}
  .prof-info-item:last-child{border-bottom:none}

  /* Stat cards */
  .stat-card{padding:14px}
  .stat-val{font-size:20px}
  .stat-icon-wrap{width:36px;height:36px;margin-bottom:8px}
  .stat-icon-wrap svg{width:17px;height:17px}

  /* Alert banner */
  .alert-banner{flex-wrap:wrap;gap:6px}

  /* Employee grid */
  .emp-grid{grid-template-columns:1fr 1fr;gap:10px}

  /* Pagination */
  .pagination{justify-content:center;flex-wrap:wrap}

  /* Report filter */
  .report-filter{flex-direction:column;align-items:stretch;padding:12px 14px}
  .report-filter .filter-input,.report-filter .filter-select{width:100%}

  /* Breadcrumb */
  .breadcrumb{font-size:11px}

  /* Form action rows */
  div[style*="justify-content:flex-end"]{flex-wrap:wrap}
}

/* ---- SMALL MOBILE (<=400px) ---- */
@media (max-width:400px){
  .stats-grid{grid-template-columns:1fr!important}
  .emp-grid{grid-template-columns:1fr}
  .brand-name{font-size:13px}
  .topbar{padding:0 10px;gap:6px}
  .main{padding:12px 10px 56px}
  .tab{padding:9px 10px;font-size:11.5px}
}

/* ---- EXTRA PAGE-SPECIFIC FIXES ---- */

/* Login page */
@media (max-width:640px){
  .login-card{padding:28px 18px;margin:16px}
}

/* Pending leave cards - approve/reject row */
@media (max-width:500px){
  .act-btn{flex:1;min-width:80px;text-align:center;padding:8px 10px}
  /* catch inline flex rows with justify-content:flex-end inside cards */
  .card-body > div[style*='justify-content:flex-end'],
  .card-body div[style*='justify-content:flex-end']{flex-wrap:wrap;justify-content:stretch!important}
  .card-body div[style*='justify-content:flex-end'] .act-btn{flex:1}
  .card-body div[style*='justify-content:flex-end'] .btn{flex:1;justify-content:center}
}

/* Wide tables (applicants full table - 17 cols) */
.table-wide{min-width:1300px!important}
.table-mid{min-width:900px!important}
.sub-nav.open{display:block!important}
.sub-nav{padding-left:32px;margin-bottom:10px}
.sub-nav .nav-item{font-size:12.5px;padding:8px 12px;margin-bottom:2px;opacity:0.85}
.sub-nav .nav-item:hover{opacity:1}
.rotate{transform:rotate(180deg)}

/* ===== RESPONSIVE: INLINE GRID OVERRIDES ===== */
/* Two-column detail layouts (client-detail, project-detail side-by-side cards) */
.grid-2-1{display:grid;gap:24px}

@media (max-width:900px){
  /* Force inline two-col layouts to stack */
  div[style*="grid-template-columns: 1fr 2fr"],
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr; gap"],
  .grid-2-1{grid-template-columns:1fr!important}

  /* Stats grids with explicit col counts */
  div[style*="grid-template-columns: repeat(4, 1fr)"],
  div[style*="grid-template-columns: repeat(4,1fr)"],
  div[style*="grid-template-columns:repeat(4,1fr)"]{grid-template-columns:repeat(2,1fr)!important}

  div[style*="grid-template-columns: repeat(5, 1fr)"],
  div[style*="grid-template-columns: repeat(3, 1fr)"],
  div[style*="grid-template-columns: repeat(3,1fr)"],
  div[style*="grid-template-columns:repeat(3,1fr)"]{grid-template-columns:repeat(2,1fr)!important}

  /* Form grids with 3-4 columns */
  div[style*="grid-template-columns: repeat(3, 1fr)"],
  .form-grid[style*="repeat(3"],
  .form-grid[style*="repeat(4"]{grid-template-columns:1fr 1fr!important}

  .two-col{grid-template-columns:1fr}
  .three-col-2{grid-template-columns:1fr!important}
  .three-col{grid-template-columns:1fr 1fr!important}
}

@media (max-width:640px){
  /* All inline grid columns collapse to 1 on mobile */
  div[style*="grid-template-columns: repeat(4, 1fr)"],
  div[style*="grid-template-columns: repeat(4,1fr)"],
  div[style*="grid-template-columns:repeat(4,1fr)"],
  div[style*="grid-template-columns: repeat(3, 1fr)"],
  div[style*="grid-template-columns: repeat(3,1fr)"],
  div[style*="grid-template-columns:repeat(3,1fr)"],
  div[style*="grid-template-columns: repeat(2, 1fr)"],
  div[style*="grid-template-columns: repeat(2,1fr)"],
  div[style*="grid-template-columns:repeat(2,1fr)"],
  div[style*="grid-template-columns: 1fr 2fr"],
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr"],
  .form-grid,.form-grid-2,.two-col,.three-col{grid-template-columns:1fr!important}

  /* span 2 overrides on mobile */
  div[style*="grid-column: span 2"]{grid-column:span 1!important}

  /* Fix filter bars with fixed widths */
  .filter-group[style*="width:"]{width:100%!important}
  .filter-group[style*="width:"]{min-width:unset!important}

  /* Action rows in page-hdr-row */
  .page-hdr-row > div[style*="display:flex"]{flex-wrap:wrap;gap:8px}
  .page-hdr-row > div > .btn{flex:1;justify-content:center;min-width:120px}

  /* Card with max-width center alignment stays usable */
  .card[style*="max-width"]{max-width:100%!important}

  /* Button rows inside form footers */
  div[style*="justify-content:flex-end"][style*="gap"]{flex-wrap:wrap}
  div[style*="justify-content:flex-end"] .btn[style*="min-width"]{min-width:unset!important;flex:1}

  /* Two-col inside attendance */
  .two-col{grid-template-columns:1fr!important}

  /* Stats grid forced column for small pages */
  div[style*="grid-template-columns: repeat(2, 1fr)"]{grid-template-columns:1fr 1fr}

  /* Page header action buttons stack */
  .page-hdr-actions{width:100%;display:flex;flex-wrap:wrap;gap:8px}
  .page-hdr-actions .btn{flex:1;justify-content:center}
}


/* ===== MISSING UTILITY CLASSES ===== */
/* names in every table: dark, medium weight (same as the client table) */
.td-primary, .td-name { font-weight: 500; font-size: 12.5px; color: var(--text); }
.td-primary a { color: var(--text) !important; font-weight: 500 !important; font-size: 12.5px; text-decoration: none; }
.td-primary a:hover { color: var(--purple); }

/* Name / primary cells that set their own inline bold (and often a purple link) look like the client table everywhere:
   dark, medium weight, 12.5px. Totals rows and footers keep their emphasis. */
main table :is(tbody, thead) tr:not(.total-row, .tot-row) > td:is([style*="font-weight:6"], [style*="font-weight: 6"], [style*="font-weight:7"], [style*="font-weight: 7"], [style*="font-weight:bold"], [style*="font-weight: bold"]){
  font-weight: 500 !important; font-size: 12.5px !important; color: var(--text);
}
main table tbody tr:not(.total-row, .tot-row) > td:is([style*="font-weight:6"], [style*="font-weight: 6"], [style*="font-weight:7"], [style*="font-weight: 7"], [style*="font-weight:bold"], [style*="font-weight: bold"]) > a{
  color: var(--text) !important; font-weight: 500 !important; font-size: 12.5px !important; text-decoration: none;
}
main table tbody tr > td:is([style*="font-weight:6"], [style*="font-weight: 6"], [style*="font-weight:7"], [style*="font-weight: 7"]) > a:hover{ color: var(--purple) !important; }

.row-actions { display: flex; gap: 6px; align-items: center; }
.row-actions a, .row-actions button {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--white);
  color: var(--text2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; transition: all 0.15s;
}
.row-actions a:hover, .row-actions button:hover {
  background: var(--purple-light); border-color: var(--purple); color: var(--purple);
}
.row-actions a svg, .row-actions button svg { width: 15px; height: 15px; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--purple-light); color: var(--purple);
  font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}


/* ===== MISSING COMPAT CLASSES (old templates) ===== */
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-info { flex: 1; min-width: 0; }

/* Badge color variants */
.b-purple-light { background: var(--purple-light) !important; color: var(--purple) !important; border: none; }
.b-blue-light   { background: var(--blue-light) !important; color: var(--blue) !important; border: none; }
.b-green-light  { background: var(--green-light) !important; color: var(--green) !important; border: none; }
.b-red-light    { background: var(--red-light) !important; color: var(--red) !important; border: none; }

/* Card title inside card-hdr */
.card-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; }

/* novi-table — same as standard table but explicit */
.novi-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.novi-table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text3); padding: 12px 16px; background: #FAFAFC; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
.novi-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.novi-table tr:last-child td { border-bottom: none; }
.novi-table tbody tr:hover td { background: #FAFAFC; }

/* Leave pending/accepted/rejected badges */
.b-pending  { background: #fef3c7; color: #d97706; border: none; }
.b-accepted { background: #dcfce7; color: #16a34a; border: none; }
.b-rejected { background: #fee2e2; color: #dc2626; border: none; }

/* hr\ leave\ templates */
.leave-action-btn { height: 32px; padding: 0 14px; border-radius: 7px; border: none; font-size: 12.5px; font-weight: 600; cursor: pointer; }

/* Product type / small label pill */
.p-type { display: inline-block; padding: 2px 8px; border-radius: 4px; background: var(--purple-light); color: var(--purple); font-size: 11.5px; font-weight: 600; }

/* btn-icon-square — used in project dashboard */
.btn-icon-square { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--white); color: var(--text2); text-decoration: none; transition: all 0.15s; }
.btn-icon-square:hover { background: var(--purple-light); border-color: var(--purple); color: var(--purple); }
.btn-icon-square svg { width: 15px; height: 15px; }

/* card-header alias */
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--border); gap: 8px; }

/* card-actions — right side of card-hdr */
.card-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* info-item — label + value pairs in detail cards */
.info-item { display: flex; flex-direction: column; gap: 4px; }
.info-item label { font-size: 11.5px; color: var(--text3); font-weight: 500; }

/* timeline — response / event history */
.timeline { display: flex; flex-direction: column; gap: 20px; }
.timeline-item { display: flex; gap: 14px; position: relative; }
.timeline-line { width: 2px; background: var(--border); flex-shrink: 0; position: relative; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--purple); position: absolute; left: -4px; top: 2px; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-meta { display: flex; justify-content: space-between; margin-bottom: 6px; }
.timeline-author { font-weight: 700; font-size: 13px; color: var(--text); }
.timeline-time { font-size: 11px; color: var(--text3); }
.timeline-text { font-size: 14px; color: var(--text2); line-height: 1.5; }

/* Status pills */
.status-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.status-primary { background: var(--purple-light); color: var(--purple); }
.status-success { background: #dcfce7; color: #16a34a; }
.status-warning { background: #fef3c7; color: #d97706; }
.status-danger  { background: #fee2e2; color: #dc2626; }

/* td-muted */
.td-muted { color: var(--text3); font-size: 12.5px; }

/* Floating "scroll table sideways" arrow (static/js/table-scroll.js) */
.scroll-end-btn{position:fixed;right:28px;bottom:28px;width:46px;height:46px;border-radius:50%;border:none;background:var(--purple);color:#fff;
  display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 6px 18px rgba(83,74,183,.4);z-index:150;user-select:none;touch-action:none;transition:transform .15s,background .15s}
.scroll-end-btn:hover{transform:scale(1.08)}
.scroll-end-btn:active{transform:scale(.96)}
.scroll-end-btn svg{width:22px;height:22px;transition:transform .25s}
.scroll-end-btn.at-end svg{transform:rotate(180deg)}

/* Filter accordion (.fc-*) — lives here (not in <body>) so the chevron is never drawn unsized while the page loads */
.fc-wrap{border-radius:12px;border:1px solid var(--border);background:#fff;margin-bottom:24px;overflow:hidden;}
.fc-header{display:flex;align-items:center;justify-content:space-between;padding:14px 20px;cursor:pointer;user-select:none;transition:background .15s;}
.fc-header:hover{background:var(--bg);}
.fc-title{display:flex;align-items:center;gap:8px;font-size:13.5px;font-weight:600;color:var(--text1);}
.fc-title svg{color:var(--purple);flex-shrink:0;}
.fc-badge{background:var(--purple);color:#fff;font-size:10.5px;font-weight:700;padding:2px 8px;border-radius:20px;display:none;}
.fc-badge.visible{display:inline-block;}
.fc-hint{font-size:11.5px;color:var(--purple);font-weight:500;}
.fc-chevron{width:18px;height:18px;color:var(--text3);transition:transform .28s ease;flex-shrink:0;}
.fc-wrap.open .fc-chevron{transform:rotate(180deg);}
.fc-body{overflow:hidden;max-height:0;transition:max-height .35s ease;}
.fc-wrap.open .fc-body{max-height:900px;}
.fc-body-inner{padding:20px 24px 24px;border-top:1px solid var(--border);}

/* ── Table loading spinner (global) ───────────────────────────────────────────
   1) while a page loads (<html class="tbl-wait">) every table stays hidden behind a small spinner
   2) .tbl-busy → same spinner over a table that is being reloaded via AJAX
   3) .tbl-spin → inline spinner for "Loading…" placeholders */
@keyframes tblspin{to{transform:rotate(360deg)}}
.tbl-spin{display:inline-block;width:22px;height:22px;border:3px solid rgba(83,74,183,.18);border-top-color:#534AB7;border-radius:50%;animation:tblspin .7s linear infinite;vertical-align:middle}
html.tbl-wait main :is(.table-wrap,.auto-table-scroll):has(table){position:relative;min-height:140px}
html.tbl-wait main :is(.table-wrap,.auto-table-scroll):has(table) table{visibility:hidden}
html.tbl-wait main :is(.table-wrap,.auto-table-scroll):has(table)::after,
.tbl-busy::after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;
  border:3px solid rgba(83,74,183,.18);border-top-color:#534AB7;border-radius:50%;animation:tblspin .7s linear infinite;z-index:5}
.tbl-busy{position:relative;pointer-events:none}
.tbl-busy table{opacity:.35;transition:opacity .15s}

/* ── Table pagination (static/js/table-paginate.js) ── */
.tp-off { display: none !important; }
.tp-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
.tp-info { font-size: 12px; font-weight: 600; color: #8E95A5; }
.tp-ctrl { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tp-size {
  -webkit-appearance: none; appearance: none; height: 40px; padding: 0 34px 0 16px; margin-right: 8px;
  border: 1.5px solid #E0E0E8; border-radius: 12px; background: #fff; color: #1f2937;
  font-size: 14px; font-weight: 600; cursor: pointer; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.tp-size:focus, .tp-size:hover { border-color: var(--P, #534AB7); }
.tp-btn { min-width: 34px; height: 34px; padding: 0 10px; border: 1.5px solid #E0E0E8; border-radius: 8px; background: #fff; color: #4b5563; font-size: 12px; font-weight: 700; cursor: pointer; }
.tp-btn:hover:not(:disabled) { border-color: var(--P, #534AB7); color: var(--P, #534AB7); }
.tp-btn.active { background: var(--P, #534AB7); border-color: var(--P, #534AB7); color: #fff; }
.tp-btn:disabled { opacity: .45; cursor: not-allowed; }
.tp-gap { padding: 0 4px; color: #9ca3af; }

/* ── Numbered pager for AJAX lists (marketing leads, sales clients) ── */
.pgr-info{font-size:13px;color:var(--text3);white-space:nowrap}
.pgr-ctrl{display:flex;align-items:center;gap:4px;flex-wrap:wrap}
.pgr-btn{min-width:34px;height:34px;padding:0 12px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;border:1.5px solid var(--border);border-radius:8px;background:var(--white);color:var(--text2);font-size:12px;font-weight:700;white-space:nowrap;cursor:pointer;transition:all .15s ease}
.pgr-btn:hover:not(:disabled):not(.active){border-color:var(--purple);color:var(--purple)}
.pgr-btn.active{background:var(--purple);border-color:var(--purple);color:#fff;cursor:default}
.pgr-btn:disabled{opacity:.45;cursor:not-allowed}
.pgr-gap{padding:0 4px;color:#9ca3af}
.pgr-bar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;padding:14px 20px;border-top:1px solid var(--border)}

/* ── Column chooser (static/js/table-columns.js) ── */
.tc-bar{display:flex;justify-content:flex-start;padding:10px 14px 0}
.tc-btn{display:inline-flex;align-items:center;gap:8px;height:36px;padding:0 14px;border-radius:9px;border:1px solid #ddd3fb;background:#f3efff;color:#5B3FD1;font-size:12.5px;font-weight:600;cursor:pointer;transition:background .15s,box-shadow .15s}
.tc-btn:hover{background:#e9e2ff;box-shadow:0 2px 8px rgba(91,63,209,.15)}
.tc-btn svg{width:15px;height:15px}
.tc-panel{position:absolute;z-index:400;width:290px;max-height:min(70vh,520px);overflow-y:auto;background:#fff;border:1px solid var(--border);border-radius:14px;box-shadow:0 14px 40px rgba(26,26,46,.2);padding:14px}
.tc-head{display:flex;align-items:center;justify-content:space-between;font-size:14px;font-weight:700;color:var(--text);margin-bottom:4px}
.tc-reset{border:none;background:none;color:var(--purple);font-size:12px;font-weight:600;cursor:pointer;padding:2px 4px}
.tc-reset:hover{text-decoration:underline}
.tc-hint{font-size:11.5px;color:var(--text3);margin-bottom:10px}
.tc-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.tc-list li{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:9px;background:#f1f2f6;font-size:13px;color:var(--text);transition:background .12s,box-shadow .12s}
.tc-list li[draggable="true"]{cursor:grab}
.tc-list li{user-select:none;-webkit-user-select:none}
.tc-list.tc-dragging li *{pointer-events:none}
.tc-list li.tc-over-before{box-shadow:0 -2px 0 var(--purple)}
.tc-list li.tc-over-after{box-shadow:0 2px 0 var(--purple)}
.tc-list li.tc-drag{opacity:.45}
.tc-grip{color:#9aa0b0;font-size:13px;letter-spacing:-2px;user-select:none}
.tc-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tc-arrows{display:inline-flex;gap:2px}
.tc-arrows button{border:none;background:none;color:#9aa0b0;font-size:9px;cursor:pointer;padding:2px 3px;line-height:1}
.tc-arrows button:hover{color:var(--purple)}
.tc-list input[type=checkbox]{width:16px;height:16px;accent-color:#534AB7;cursor:pointer;flex-shrink:0}
.tc-sub{font-size:12px;font-weight:700;color:var(--text2);margin:14px 0 8px}
.tc-hidden li{background:#e9eaf0;color:var(--text2)}
.tc-add{border:none;background:none;color:#2563eb;font-size:12.5px;font-weight:600;cursor:pointer}
.tc-add:hover{text-decoration:underline}

/* ── Table / Kanban switch + kanban board (Clients, Projects) ── */
.vw-toggle { display:inline-flex; background:#eceef5; border-radius:10px; padding:3px; flex-shrink:0; }
.vw { border:none; background:transparent; padding:7px 16px; border-radius:8px; font-size:13px; font-weight:600; color:var(--text2); cursor:pointer; }
.vw.active { background:#fff; color:var(--purple); box-shadow:0 1px 4px rgba(26,26,46,.12); }

/* Kanban board */
.kb-board { display:flex; gap:14px; overflow-x:auto; padding:4px 2px 18px; align-items:flex-start; margin-bottom:24px; }
.kb-board.kb-loading { opacity:.45; pointer-events:none; }
.kb-col { --st:#534AB7; position:relative; overflow:hidden; flex:0 0 285px; background:#f3f4f9; border:1px solid #e0e3ee; border-radius:14px; display:flex; flex-direction:column; max-height:74vh; }
.kb-col::before { content:""; position:absolute; left:0; right:0; top:0; height:4px; background:var(--st); }  /* straight accent bar, clipped by the rounded border */
.kb-head { display:flex; align-items:center; gap:8px; padding:16px 14px 12px; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; color:var(--st); }
.kb-count { margin-left:auto; background:color-mix(in srgb, var(--st) 14%, #fff); color:var(--st); border-radius:20px; padding:2px 10px; font-size:12px; }
.kb-body { padding:4px 10px 10px; overflow-y:auto; display:flex; flex-direction:column; gap:10px; min-height:70px; flex:1; border-radius:10px; }
.kb-body.kb-empty::before { content:"No clients"; color:#a0a6b5; font-size:12px; text-align:center; padding:20px 0; }
.kb-body.kb-over { background:color-mix(in srgb, var(--st) 9%, transparent); outline:2px dashed var(--st); outline-offset:-4px; }
.kb-card { background:#fff; border:1px solid #eceef4; border-radius:11px; padding:12px 13px; box-shadow:0 1px 4px rgba(26,26,46,.07); cursor:grab; display:flex; flex-direction:column; gap:6px; transition:box-shadow .15s, transform .15s; }
.kb-card:hover { box-shadow:0 5px 16px rgba(26,26,46,.13); transform:translateY(-1px); }
.kb-card.kb-drag { opacity:.4; }
.kb-name { font-size:13.5px; font-weight:700; color:var(--purple); text-decoration:none; word-break:break-word; }
.kb-line { font-size:12.5px; color:var(--text2); }
.kb-camp { color:var(--text3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.kb-tags { display:flex; gap:6px; flex-wrap:wrap; }
.kb-tag { font-size:10.5px; font-weight:700; padding:2px 8px; border-radius:20px; background:#ede9fe; color:#534AB7; }
.kb-tag-alt { background:#e0f2fe; color:#0369a1; }
.kb-foot { display:flex; justify-content:space-between; gap:8px; font-size:11.5px; color:var(--text3); margin-top:2px; padding-top:7px; border-top:1px dashed #e6e8ef; }
.kb-exec { font-weight:600; color:var(--text2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* placeholder columns while the board is loading (never a blank page) */
.kb-skel { flex:0 0 285px; display:flex; flex-direction:column; gap:12px; padding:18px 12px 14px; background:#f3f4f9; border:1px solid #e0e3ee; border-radius:14px; }
.kb-sk-h, .kb-sk-c { background:linear-gradient(90deg, #e8eaf2 25%, #f5f6fb 37%, #e8eaf2 63%); background-size:400% 100%; animation:kbShimmer 1.3s ease infinite; }
.kb-sk-h { height:14px; width:55%; border-radius:6px; margin:2px 2px 6px; }
.kb-sk-c { height:96px; border-radius:11px; }
.kb-sk-c:nth-child(3) { height:74px; } .kb-sk-c:nth-child(4) { height:110px; }
@keyframes kbShimmer { 0% { background-position:100% 0; } 100% { background-position:0 0; } }
.kb-error { flex:1; text-align:center; padding:48px 16px; color:var(--text3); font-size:14px; }
.kb-error button { margin-left:8px; border:none; background:none; color:var(--purple); font-weight:700; cursor:pointer; }
.kb-more { margin:0 10px 10px; padding:8px; border:1px dashed #cfd3e0; border-radius:9px; background:transparent; color:var(--text2); font-size:12.5px; font-weight:600; cursor:pointer; }
.kb-more:hover { border-color:var(--purple); color:var(--purple); }
.kb-prog { height:6px; border-radius:6px; background:#e7e9f2; overflow:hidden; }
.kb-prog > i { display:block; height:100%; background:var(--st, #534AB7); border-radius:6px; }
.kb-meta { display:flex; justify-content:space-between; gap:8px; font-size:11.5px; color:var(--text3); }
.kb-chip-late { font-size:10.5px; font-weight:700; color:#dc2626; background:#fee2e2; border-radius:4px; padding:1px 6px; }
.kb-chip-left { font-size:10.5px; font-weight:600; color:#16a34a; background:#dcfce7; border-radius:4px; padding:1px 6px; }
.kb-card.kb-nodrag { cursor:default; }
.kb-prog-hrs > i { background:#0ea5e9; }
.kb-prog-hrs.kb-over > i { background:#dc2626; }
.kb-hrs-over { color:#dc2626; font-weight:700; }

/* ── Inline lead-status dropdown (Clients table, client detail) ── */
.cl-status-sel { --st:#534AB7; appearance:none; -webkit-appearance:none; border:1px solid transparent; border-radius:20px; padding:5px 26px 5px 12px;
  font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.3px; cursor:pointer; outline:none; font-family:inherit; white-space:nowrap;
  color:var(--st); background-color:color-mix(in srgb, var(--st) 12%, #fff);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 9px center; transition:border-color .12s, box-shadow .12s; }
.cl-status-sel:hover { border-color:color-mix(in srgb, var(--st) 35%, transparent); }
.cl-status-sel:focus { box-shadow:0 0 0 3px color-mix(in srgb, var(--st) 20%, transparent); }
.cl-status-sel:disabled { opacity:.6; cursor:progress; }

/* Tablet / small windows: same icon rail as desktop; the hamburger opens the full sidebar over the page */
@media (min-width:481px) and (max-width:900px){
  .sidebar{transform:none;width:60px;padding:16px 8px;overflow:hidden;transition:width .22s ease,padding .22s ease}
  .sidebar .nav-item{font-size:0;gap:0;justify-content:center;padding:12px 0}
  .sidebar .nav-badge,.sidebar .sidebar-copyright,.sidebar .sb-target{display:none}
  .sidebar .quick-label{font-size:0;height:1px;margin:10px 10px;padding:0;background:var(--border);overflow:hidden}
  .sidebar .quick-add-btn{margin-left:0;width:40px;height:40px}
  .sidebar.open{width:240px;padding:24px 18px;overflow:visible}
  .sidebar.open .nav-item{font-size:13.5px;gap:14px;justify-content:flex-start;padding:12px 16px}
  .sidebar.open .nav-badge,.sidebar.open .sidebar-copyright,.sidebar.open .sb-target{display:revert}
  .sidebar.open .quick-label{font-size:11px;height:auto;margin:0;padding:8px 16px 4px;background:none;overflow:visible}
  .main{margin-left:62px}
}
