/* ============================================
   PSE PDMS - Core Design System
   ============================================ */
:root {
  --bg: #f5f7fb;
  --bg-elev: #ffffff;
  --bg-glass: rgba(255,255,255,0.65);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e9f2;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --primary: #1d3c88;
  --primary-600: #162e6c;
  --primary-50: #e8edf8;
  --accent: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --purple: #8b5cf6;
  --pink: #ec4899;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 4px 16px rgba(15,23,42,.08);
  --shadow-lg: 0 20px 40px -12px rgba(15,23,42,.18);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --sidebar-w: 260px;
  --header-h: 64px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --gradient: linear-gradient(135deg, #1d3c88 0%, #8b5cf6 50%, #ec4899 100%);
  --gradient-2: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  --gradient-3: linear-gradient(135deg, #1d3c88 0%, #8b5cf6 100%);
}
[data-theme="dark"] {
  --bg: #0b1020;
  --bg-elev: #111830;
  --bg-glass: rgba(17,24,48,0.65);
  --surface: #131a2e;
  --surface-2: #0f1526;
  --border: #1f2a44;
  --text: #e6ecff;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --primary-50: #0d1b3f;
  --shadow: 0 4px 20px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.5);
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  font-size:14px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}
a{color:inherit;text-decoration:none}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}
input,select,textarea{font-family:inherit;font-size:14px}
img{max-width:100%;display:block}

/* Scrollbar */
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--border);border-radius:10px}
::-webkit-scrollbar-thumb:hover{background:var(--text-soft)}

/* ============ LAYOUT ============ */
.app{display:flex;min-height:100vh}
.sidebar{
  width:var(--sidebar-w);
  background:var(--bg-elev);
  border-right:1px solid var(--border);
  position:fixed;top:0;left:0;bottom:0;
  display:flex;flex-direction:column;
  z-index:50;
  transition:transform .3s ease, width .3s ease;
}
.sidebar-header{
  height:var(--header-h);
  display:flex;align-items:center;gap:12px;
  padding:0 20px;border-bottom:1px solid var(--border);
}
.brand{
  display:flex;align-items:center;gap:10px;font-weight:700;font-size:16px;
}
.brand-logo{
  height:40px;
  display:flex;align-items:center;
}
.brand-logo img{
  height:100%;width:auto;object-fit:contain;display:block;
}
.nav{flex:1;overflow-y:auto;padding:16px 12px}
.nav-section{margin-bottom:20px}
.nav-title{
  padding:0 12px 8px;font-size:11px;text-transform:uppercase;
  letter-spacing:.8px;color:var(--text-soft);font-weight:600;
}
.nav-item{
  display:flex;align-items:center;gap:12px;
  padding:10px 12px;border-radius:10px;
  color:var(--text-muted);font-weight:500;font-size:14px;
  margin-bottom:2px;cursor:pointer;
  transition:all .2s ease;position:relative;
}
.nav-item:hover{background:var(--surface-2);color:var(--text)}
.nav-item.active{
  background:var(--primary-50);color:var(--primary);
}
[data-theme="dark"] .nav-item.active{background:rgba(79,70,229,.15)}
.nav-item.active::before{
  content:"";position:absolute;left:-12px;top:8px;bottom:8px;width:3px;
  background:var(--primary);border-radius:0 4px 4px 0;
}
.nav-item i{width:18px;height:18px;flex-shrink:0}
.nav-item .badge{
  margin-left:auto;background:var(--danger);color:#fff;
  font-size:10px;padding:2px 6px;border-radius:8px;font-weight:600;
}

.sidebar-footer{
  padding:12px;border-top:1px solid var(--border);
  display:flex;align-items:center;gap:10px;
}
.avatar{
  width:36px;height:36px;border-radius:50%;
  background:var(--gradient);display:grid;place-items:center;
  color:#fff;font-weight:700;font-size:13px;flex-shrink:0;
}
.avatar-sm{width:28px;height:28px;font-size:11px}
.avatar-lg{width:56px;height:56px;font-size:20px}
.user-meta{flex:1;min-width:0}
.user-meta .name{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.user-meta .role{font-size:11px;color:var(--text-muted)}

.main{flex:1;margin-left:var(--sidebar-w);min-width:0}
.header{
  position:sticky;top:0;height:var(--header-h);
  background:var(--bg-glass);backdrop-filter:saturate(180%) blur(14px);
  -webkit-backdrop-filter:saturate(180%) blur(14px);
  border-bottom:1px solid var(--border);
  display:flex;align-items:center;gap:16px;
  padding:0 24px;z-index:40;
}
.hamburger{display:none;padding:8px;border-radius:8px}
.hamburger:hover{background:var(--surface-2)}
.search{
  flex:1;max-width:520px;position:relative;
}
.search input{
  width:100%;background:var(--surface-2);border:1px solid transparent;
  padding:9px 14px 9px 40px;border-radius:10px;color:var(--text);
  transition:all .2s;
}
.search input:focus{outline:none;border-color:var(--primary);background:var(--surface)}
.search i{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--text-soft)}
.header-actions{display:flex;align-items:center;gap:8px;margin-left:auto}
.icon-btn{
  width:38px;height:38px;border-radius:10px;display:grid;place-items:center;
  color:var(--text-muted);transition:all .2s;position:relative;
}
.icon-btn:hover{background:var(--surface-2);color:var(--text)}
.icon-btn .dot{
  position:absolute;top:8px;right:8px;width:8px;height:8px;
  background:var(--danger);border-radius:50%;border:2px solid var(--bg-elev);
}

.content{padding:24px 28px 40px}
.page-head{
  display:flex;align-items:flex-end;justify-content:space-between;
  gap:16px;margin-bottom:24px;flex-wrap:wrap;
}
.page-title{font-size:24px;font-weight:700;letter-spacing:-.5px}
.page-sub{color:var(--text-muted);margin-top:4px;font-size:13px}
.breadcrumbs{display:flex;gap:6px;align-items:center;font-size:12px;color:var(--text-muted);margin-bottom:6px}
.breadcrumbs span:not(:last-child)::after{content:"/";margin-left:6px;color:var(--text-soft)}

/* ============ COMPONENTS ============ */
.card{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);box-shadow:var(--shadow-sm);
  transition:transform .25s ease, box-shadow .25s ease;
}
.card:hover{box-shadow:var(--shadow)}
.card-body{padding:20px}
.card-head{padding:18px 20px;border-bottom:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;gap:12px}
.card-title{font-size:15px;font-weight:600}
.card-sub{font-size:12px;color:var(--text-muted)}

.grid{display:grid;gap:20px}
.grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
@media(max-width:1100px){.grid-4{grid-template-columns:repeat(2,1fr)}.grid-3{grid-template-columns:repeat(2,1fr)}}
@media(max-width:640px){.grid-4,.grid-3,.grid-2{grid-template-columns:1fr}}

/* Stat card */
.stat{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);padding:20px;position:relative;overflow:hidden;
  transition:transform .25s;
}
.stat:hover{transform:translateY(-2px);box-shadow:var(--shadow)}
.stat .label{font-size:12px;color:var(--text-muted);font-weight:500;text-transform:uppercase;letter-spacing:.5px;padding-right:52px}
.stat .value{font-size:28px;font-weight:700;margin-top:6px;letter-spacing:-.5px}
.stat .delta{font-size:12px;margin-top:8px;display:inline-flex;align-items:center;gap:4px;font-weight:600}
.stat .delta.up{color:var(--success)}
.stat .delta.down{color:var(--danger)}
.stat .icon-wrap{
  position:absolute;top:16px;right:16px;
  width:44px;height:44px;border-radius:12px;
  display:grid;place-items:center;color:#fff;
}
.stat.i-primary .icon-wrap{background:var(--gradient)}
.stat.i-success .icon-wrap{background:var(--gradient-3)}
.stat.i-warn .icon-wrap{background:linear-gradient(135deg,#f59e0b,#ef4444)}
.stat.i-info .icon-wrap{background:linear-gradient(135deg,#1d3c88,#8b5cf6)}
.stat.i-purple .icon-wrap{background:linear-gradient(135deg,#8b5cf6,#ec4899)}
.stat.i-pink .icon-wrap{background:var(--gradient-2)}

/* Badges */
.badge{
  display:inline-flex;align-items:center;gap:4px;padding:3px 10px;
  border-radius:999px;font-size:11px;font-weight:600;letter-spacing:.2px;
  background:var(--surface-2);color:var(--text-muted);
}
.badge.dot::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
.badge-primary{background:rgba(29,60,136,.1);color:var(--primary)}
.badge-success{background:rgba(16,185,129,.12);color:var(--success)}
.badge-warn{background:rgba(245,158,11,.12);color:var(--warning)}
.badge-danger{background:rgba(239,68,68,.12);color:var(--danger)}
.badge-info{background:rgba(59,130,246,.12);color:var(--info)}
.badge-purple{background:rgba(139,92,246,.12);color:var(--purple)}
.badge-muted{background:var(--surface-2);color:var(--text-muted)}

/* Priority pills */
.prio-critical{background:rgba(239,68,68,.15);color:#dc2626}
.prio-high{background:rgba(245,158,11,.15);color:#d97706}
.prio-medium{background:rgba(59,130,246,.15);color:#2563eb}
.prio-low{background:rgba(148,163,184,.2);color:#64748b}

/* Admin dashboard enhancements */
.admin-hero{
  display:grid;grid-template-columns:1.3fr .8fr;gap:20px;padding:24px 26px;border-radius:28px;
  background:linear-gradient(135deg,#090d16 0%,#1d3c88 45%,#8b5cf6 80%,#ec4899 100%);color:#fff;
  position:relative;overflow:hidden;box-shadow:0 24px 60px rgba(29,60,136,.24);margin-bottom:24px;
}
.admin-hero::before{
  content:"";position:absolute;inset:-20% -10% auto auto;width:320px;height:320px;
  background:radial-gradient(circle,rgba(255,255,255,.28),rgba(255,255,255,0) 70%);filter:blur(10px);
  animation: drift 8s ease-in-out infinite alternate;
}
.admin-hero-copy{position:relative;z-index:1}
.hero-pill{
  display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border-radius:999px;
  background:rgba(255,255,255,.16);backdrop-filter:blur(10px);font-size:12px;font-weight:700;letter-spacing:.6px;text-transform:uppercase;
}
.hero-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:18px}
.admin-hero-card{
  position:relative;z-index:1;display:flex;align-items:center;gap:16px;padding:18px;border-radius:20px;
  background:rgba(255,255,255,.16);backdrop-filter:blur(12px);border:1px solid rgba(255,255,255,.22);
}
.hero-ring{
  width:110px;height:110px;border-radius:50%;display:grid;place-items:center;
  background:conic-gradient(#ffffff 0 100%, rgba(255,255,255,.18) 100%);
  color:#1d3c88;font-weight:800;font-size:20px;flex-shrink:0;box-shadow:inset 0 0 0 10px rgba(255,255,255,.15);
}
.hero-ring span{display:block;text-align:center;line-height:1.05}
.hero-card-title{font-size:15px;font-weight:700}
.hero-card-text{font-size:12px;line-height:1.5;margin-top:6px;color:rgba(255,255,255,.86)}
.hero-card-foot{margin-top:10px;font-size:11px;font-weight:700;letter-spacing:.6px;text-transform:uppercase;color:rgba(255,255,255,.72)}
.admin-stat{background:linear-gradient(135deg,rgba(255,255,255,.95),rgba(248,250,252,.96));box-shadow:var(--shadow-sm)}
.admin-panel .card-body{padding-top:16px}
.permission-chips{display:flex;flex-wrap:wrap;gap:10px}
.chip{
  display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border-radius:999px;
  background:linear-gradient(90deg,rgba(29,60,136,.1),rgba(139,92,246,.1));color:var(--primary);
  font-size:12px;font-weight:600;border:1px solid rgba(29,60,136,.12);
}
.chip::before{content:"✦";color:var(--accent);font-size:11px}
.action-list{display:flex;flex-direction:column;gap:10px}
.action-item{display:flex;align-items:flex-start;gap:12px;padding:12px;border-radius:12px;background:var(--surface-2)}
.action-item span{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:var(--primary-50);color:var(--primary)}
.action-item strong{display:block;font-size:13px;margin-bottom:2px}
.animated-card{position:relative;overflow:hidden;background:linear-gradient(145deg,var(--surface),rgba(248,250,252,.95));}
.animated-card::after{content:"";position:absolute;inset:auto -40px -40px auto;width:120px;height:120px;border-radius:50%;background:radial-gradient(circle,rgba(79,70,229,.16),rgba(79,70,229,0));animation:pulseGlow 4s ease-in-out infinite;}
.pulse-list{display:flex;flex-direction:column;gap:12px}
.pulse-item{padding:10px 0;border-bottom:1px solid var(--border)}
.pulse-item:last-child{border-bottom:none}
.pulse-meta{display:flex;justify-content:space-between;gap:8px;align-items:center;margin-bottom:8px}
.pulse-name{font-size:13px;font-weight:700}
.pulse-sub{font-size:11px;color:var(--text-muted)}
.pulse-meter{display:flex;align-items:center;gap:8px}
.pulse-bar{flex:1;height:8px;border-radius:999px;background:var(--surface-2);overflow:hidden}
.pulse-fill{display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,var(--primary),var(--accent));animation:fillPulse .8s ease forwards;transform-origin:left}
.pulse-meter span{font-size:11px;font-weight:700;color:var(--text-muted);min-width:34px;text-align:right}
.momentum-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;align-items:end;height:140px;margin-bottom:8px}
.momentum-col{height:100%;display:flex;align-items:flex-end;justify-content:center}
.momentum-bar{width:100%;max-width:24px;border-radius:999px 999px 6px 6px;background:linear-gradient(180deg,var(--primary),var(--accent));animation:barRise .9s ease forwards;transform-origin:bottom}
.momentum-labels{display:grid;grid-template-columns:repeat(6,1fr);font-size:11px;color:var(--text-muted);text-align:center}
.resource-ring-wrap{display:flex;align-items:center;gap:16px}
.resource-ring-wrap .ring{box-shadow:inset 0 0 0 10px rgba(79,70,229,.08)}

/* Dark mode adjustments for admin dashboard */
[data-theme="dark"] .chip{background:linear-gradient(90deg,rgba(79,70,229,.28),rgba(6,182,212,.28));color:#e0e7ff;border-color:rgba(79,70,229,.3)}
[data-theme="dark"] .chip::before{color:#a5f3fc}
[data-theme="dark"] .action-item strong{color:var(--text);font-weight:700}
[data-theme="dark"] .animated-card{background:linear-gradient(145deg,rgba(19,26,46,.8),rgba(15,21,38,.9))}
[data-theme="dark"] .pulse-name{color:var(--text)}
[data-theme="dark"] .pulse-sub{color:var(--text-muted)}
[data-theme="dark"] .pulse-meter span{color:var(--text-muted)}
[data-theme="dark"] .momentum-labels{color:var(--text-muted)}
[data-theme="dark"] .card-title{color:var(--text)}
[data-theme="dark"] .card-sub{color:var(--text-muted)}
[data-theme="dark"] .admin-stat .label{color:var(--text-muted)}
[data-theme="dark"] .admin-stat .value{color:var(--text)}
[data-theme="dark"] .admin-stat .delta{color:var(--success)}
@keyframes fillPulse{from{transform:scaleX(0)}to{transform:scaleX(1)}}
@keyframes barRise{from{transform:scaleY(.2);opacity:.2}to{transform:scaleY(1);opacity:1}}
@keyframes pulseGlow{0%,100%{transform:scale(.95);opacity:.7}50%{transform:scale(1.08);opacity:1}}
@keyframes drift{from{transform:translate3d(0,0,0)}to{transform:translate3d(-20px,-10px,0)}}
@media(max-width:900px){.admin-hero{grid-template-columns:1fr}.admin-hero-card{margin-top:8px}.resource-ring-wrap{flex-direction:column;align-items:flex-start}}

/* Buttons */
.btn{
  display:inline-flex;align-items:center;gap:8px;
  padding:9px 16px;border-radius:10px;font-weight:600;font-size:13px;
  transition:all .2s;border:1px solid transparent;white-space:nowrap;
}
.btn-primary{background:var(--gradient);color:#fff;box-shadow:0 6px 16px rgba(79,70,229,.35)}
.btn-primary:hover{transform:translateY(-1px);box-shadow:0 10px 24px rgba(79,70,229,.45)}
.btn-secondary{background:var(--surface-2);color:var(--text);border-color:var(--border)}
.btn-secondary:hover{background:var(--surface)}
.btn-ghost{color:var(--text-muted)}
.btn-ghost:hover{background:var(--surface-2);color:var(--text)}
.btn-danger{background:var(--danger);color:#fff}
.btn-sm{padding:6px 12px;font-size:12px}

/* Tables */
.table-wrap{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
.table-tools{
  display:flex;align-items:center;gap:10px;padding:14px 16px;
  border-bottom:1px solid var(--border);flex-wrap:wrap;
}
.table-tools .search-mini{position:relative;flex:1;max-width:280px}
.table-tools .search-mini input{
  width:100%;background:var(--surface-2);border:1px solid var(--border);
  padding:7px 12px 7px 34px;border-radius:8px;color:var(--text);
}
.table-tools .search-mini i{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--text-soft)}
.select{
  background:var(--surface-2);border:1px solid var(--border);
  padding:7px 12px;border-radius:8px;color:var(--text);cursor:pointer;
}
table.data{width:100%;border-collapse:separate;border-spacing:0}
table.data th,table.data td{padding:12px 16px;text-align:left;font-size:13px;border-bottom:1px solid var(--border)}
table.data th{
  background:var(--surface-2);font-weight:600;color:var(--text-muted);
  font-size:11px;text-transform:uppercase;letter-spacing:.6px;cursor:pointer;user-select:none;
  position:sticky;top:0;
}
table.data th:hover{color:var(--text)}
table.data tbody tr{transition:background .15s}
table.data tbody tr:hover{background:var(--surface-2)}
table.data tbody tr:last-child td{border-bottom:none}
.pagination{
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 16px;border-top:1px solid var(--border);color:var(--text-muted);font-size:12px;
}
.pagination .pages{display:flex;gap:4px}
.page-btn{
  min-width:32px;height:32px;padding:0 10px;border-radius:8px;
  display:inline-flex;align-items:center;justify-content:center;
  background:transparent;color:var(--text-muted);font-weight:600;font-size:12px;
}
.page-btn:hover{background:var(--surface-2);color:var(--text)}
.page-btn.active{background:var(--primary);color:#fff}

/* Progress */
.progress{height:8px;background:var(--surface-2);border-radius:999px;overflow:hidden}
.progress .bar{height:100%;background:var(--gradient);border-radius:999px;transition:width .5s ease}
.progress-lg{height:12px}
.progress-inline{display:flex;align-items:center;gap:8px}
.progress-inline .progress{flex:1;min-width:80px}
.progress-inline .pct{font-size:12px;font-weight:600;color:var(--text-muted);min-width:34px;text-align:right}

/* Progress circle */
.ring{
  --p:0;--sz:80px;--th:8px;--c:var(--primary);
  width:var(--sz);height:var(--sz);border-radius:50%;
  background:conic-gradient(var(--c) calc(var(--p)*1%),var(--surface-2) 0);
  display:grid;place-items:center;position:relative;flex-shrink:0;
}
.ring::before{
  content:"";position:absolute;inset:var(--th);
  border-radius:50%;background:var(--surface);
}
.ring .ring-val{
  position:relative;
  font-weight:700;
  font-size:16px;
  color:var(--text) !important;
}

/* Avatars group */
.avatars{display:flex}
.avatars .avatar{margin-left:-8px;border:2px solid var(--surface)}
.avatars .avatar:first-child{margin-left:0}
.avatars .more{
  width:28px;height:28px;border-radius:50%;background:var(--surface-2);color:var(--text-muted);
  display:grid;place-items:center;font-size:11px;font-weight:700;
  border:2px solid var(--surface);margin-left:-8px;
}

/* Toast */
.toasts{position:fixed;bottom:24px;right:24px;display:flex;flex-direction:column;gap:10px;z-index:9999}
.toast{
  background:var(--surface);border:1px solid var(--border);border-left:4px solid var(--primary);
  padding:12px 16px;border-radius:12px;box-shadow:var(--shadow-lg);
  min-width:280px;max-width:380px;display:flex;gap:12px;align-items:flex-start;
  animation:slideInRight .3s ease;
}
.toast.success{border-left-color:var(--success)}
.toast.error{border-left-color:var(--danger)}
.toast.warn{border-left-color:var(--warning)}
.toast .t-title{font-weight:600;font-size:13px}
.toast .t-msg{font-size:12px;color:var(--text-muted);margin-top:2px}
.toast .t-icon{
  width:28px;height:28px;border-radius:8px;background:var(--primary-50);color:var(--primary);
  display:grid;place-items:center;flex-shrink:0;
}
.toast.success .t-icon{background:rgba(16,185,129,.12);color:var(--success)}
.toast.error .t-icon{background:rgba(239,68,68,.12);color:var(--danger)}
.toast.warn .t-icon{background:rgba(245,158,11,.12);color:var(--warning)}

/* Panel (notifications, messages) */
.panel{
  position:fixed;top:var(--header-h);right:16px;
  width:380px;max-height:calc(100vh - var(--header-h) - 24px);
  background:var(--bg-glass);backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  border:1px solid var(--border);border-radius:var(--radius-lg);
  box-shadow:var(--shadow-lg);z-index:60;
  display:none;flex-direction:column;overflow:hidden;
  animation:fadeSlide .2s ease;
}
.panel.open{display:flex}
.panel-head{padding:16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.panel-head h3{font-size:15px;font-weight:600}
.panel-body{overflow-y:auto;padding:8px}
.notif{
  display:flex;gap:12px;padding:12px;border-radius:10px;cursor:pointer;
}
.notif:hover{background:var(--surface-2)}
.notif .n-icon{
  width:36px;height:36px;border-radius:10px;flex-shrink:0;
  display:grid;place-items:center;background:var(--primary-50);color:var(--primary);
}
.notif .n-title{font-size:13px;font-weight:600}
.notif .n-msg{font-size:12px;color:var(--text-muted);margin-top:2px;line-height:1.5}
.notif .n-time{font-size:11px;color:var(--text-soft);margin-top:4px}
.notif.unread{background:rgba(79,70,229,.05)}
.notif.unread::before{content:"";width:6px;height:6px;background:var(--primary);border-radius:50%;margin-top:14px;flex-shrink:0}

/* Modal */
.modal-backdrop{
  position:fixed;inset:0;background:rgba(15,23,42,.5);
  backdrop-filter:blur(4px);z-index:100;
  display:none;align-items:center;justify-content:center;padding:20px;
}
.modal-backdrop.open{display:flex;animation:fadeIn .2s}
.modal{
  background:var(--surface);border-radius:var(--radius-lg);
  max-width:560px;width:100%;max-height:90vh;overflow:auto;
  box-shadow:var(--shadow-lg);animation:scaleIn .2s;
}
.modal-lg{max-width:800px}
.modal-sm{max-width:360px}
.modal-head{padding:20px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.modal-body{padding:20px}
.modal-foot{padding:16px 20px;border-top:1px solid var(--border);display:flex;justify-content:flex-end;gap:10px}

/* Forms */
.form-row{margin-bottom:14px}
.form-row label{display:block;font-size:12px;font-weight:600;color:var(--text-muted);margin-bottom:6px}
.form-row input,.form-row select,.form-row textarea{
  width:100%;background:var(--surface-2);border:1px solid var(--border);
  padding:10px 12px;border-radius:10px;color:var(--text);transition:all .2s;
}
.form-row input:focus,.form-row select:focus,.form-row textarea:focus{
  outline:none;border-color:var(--primary);background:var(--surface);
  box-shadow:0 0 0 3px rgba(79,70,229,.15);
}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
@media(max-width:640px){.form-grid{grid-template-columns:1fr}}

/* Timeline */
.timeline{position:relative;padding-left:28px}
.timeline::before{content:"";position:absolute;left:10px;top:6px;bottom:6px;width:2px;background:var(--border)}
.tl-item{position:relative;padding-bottom:20px}
.tl-item::before{
  content:"";position:absolute;left:-24px;top:6px;width:12px;height:12px;
  border-radius:50%;background:var(--surface);border:3px solid var(--primary);
}
.tl-item.done::before{background:var(--success);border-color:var(--success)}
.tl-item.active::before{background:var(--warning);border-color:var(--warning);box-shadow:0 0 0 4px rgba(245,158,11,.2)}
.tl-title{font-weight:600;font-size:14px}
.tl-meta{font-size:12px;color:var(--text-muted);margin-top:2px}

/* Chart */
.chart-wrap{position:relative;width:100%}
canvas{max-width:100%;display:block}

/* Skeleton */
.skeleton{background:linear-gradient(90deg,var(--surface-2),var(--border),var(--surface-2));background-size:200% 100%;animation:shimmer 1.5s infinite;border-radius:8px}
@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}

/* Loader */
.loader{
  width:38px;height:38px;border-radius:50%;
  border:3px solid var(--surface-2);border-top-color:var(--primary);
  animation:spin .8s linear infinite;
}
.page-loader{position:fixed;inset:0;background:var(--bg);display:grid;place-items:center;z-index:9999;transition:opacity .3s}
.page-loader.hide{opacity:0;pointer-events:none}

/* Animations */
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
@keyframes fadeSlide{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}
@keyframes slideInRight{from{opacity:0;transform:translateX(20px)}to{opacity:1;transform:translateX(0)}}
@keyframes scaleIn{from{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.5}}

/* Responsive */
@media(max-width:960px){
  .sidebar{transform:translateX(-100%)}
  .sidebar.open{transform:translateX(0);box-shadow:var(--shadow-lg)}
  .main{margin-left:0}
  .hamburger{display:grid;place-items:center}
  .content{padding:20px 16px 40px}
  .panel{right:8px;left:8px;width:auto}
}

/* ============ LOGIN PAGE ============ */
.login-page {
  background: linear-gradient(160deg, #f7f5fc 0%, #efe7f8 100%);
  min-height: 100vh;
}
.login-page .auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
@media(max-width:900px) {
  .login-page .auth-wrap { grid-template-columns: 1fr; }
  .login-page .auth-brand { display: none; }
}

/* Left brand panel */
.login-page .auth-brand {
  background: linear-gradient(160deg, #f0f4fa 0%, #e1e7f6 100%);
  color: #16213e;
  padding: 64px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(15,23,42,.12);
}
.login-page .auth-brand::before {
  content: '';
  position: absolute;
  width: 360px; height: 360px;
  border-radius: 50%;
  background: rgba(29,60,136,.06);
  top: -120px; right: -100px;
}
.login-page .auth-brand::after {
  content: '';
  position: absolute;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(29,60,136,.06);
  bottom: -80px; left: -60px;
}
.login-page .auth-brand > * { position: relative; z-index: 1; }
.login-page .auth-brand .brand-logo img { filter: none; height: 52px; }
.login-page .auth-brand h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-top: 28px;
  color: #1d3c88;
}
.login-page .auth-brand p {
  font-size: 15px;
  color: rgba(22,33,62,.72);
  margin-top: 16px;
  max-width: 400px;
  line-height: 1.75;
}
.login-page .auth-features { display: flex; flex-direction: column; gap: 14px; margin-top: 36px; }
.login-page .auth-features .f { display: flex; gap: 14px; align-items: center; font-size: 14px; color: rgba(22,33,62,.85); }
.login-page .auth-features .fi {
  width: 38px; height: 38px;
  background: #8b5cf6;
  border-radius: 12px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}
.login-page .auth-brand footer { font-size: 12px; color: rgba(22,33,62,.5); }

/* Right form panel — PSE navy blue */
.login-page .auth-form-wrap {
  display: grid;
  place-items: center;
  padding: 40px 32px;
  background: linear-gradient(145deg, #0a1329 0%, #1d3c88 50%, #0c1a3b 100%);
  position: relative;
  overflow: hidden;
}
.login-page .auth-form-wrap::before {
  content: '';
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  top: -160px; right: -120px;
  pointer-events: none;
}
.login-page .auth-form-wrap::after {
  content: '';
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: rgba(139,92,246,0.12);
  bottom: -80px; left: -60px;
  pointer-events: none;
}
.login-page .auth-form {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 32px 80px rgba(10,20,70,0.35), 0 0 0 1px rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 40px;
  animation: scaleIn .35s cubic-bezier(.22,.68,0,1.2);
}
.login-page .auth-form .auth-actions { margin-bottom: 24px; }
.login-page .auth-logo {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #1d3c88;
  margin-bottom: 10px;
}
.login-page .auth-form h2 {
  font-size: 26px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -.5px;
}
.login-page .auth-form .sub {
  color: #6b7280;
  margin-top: 6px;
  margin-bottom: 28px;
  font-size: 14px;
}
.login-page .form-row label { color: #374151; font-size: 12px; font-weight: 600; }
.login-page .form-row input,
.login-page .form-row select,
.login-page .form-row textarea {
  background: #f3f6ff;
  border: 1.5px solid #e5e9f2;
  color: #111827;
  padding: 13px 14px;
  border-radius: 12px;
  width: 100%;
  transition: all .2s;
}
.login-page .form-row input::placeholder,
.login-page .form-row textarea::placeholder { color: #9ca3af; }
.login-page .form-row input:focus,
.login-page .form-row select:focus,
.login-page .form-row textarea:focus {
  outline: none;
  border-color: #1d3c88;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(29,60,136,0.15);
}
.login-page .btn-primary {
  background: linear-gradient(90deg, #8b5cf6 0%, #ec4899 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(139,92,246,0.35);
  border: none;
  font-size: 14px;
  padding: 13px 20px;
  border-radius: 12px;
  justify-content: center;
}
.login-page .btn-primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(90deg, #7c3aed 0%, #db2777 100%);
  box-shadow: 0 12px 32px rgba(139,92,246,0.5);
}
.login-page .btn-secondary {
  background: #f3f6ff;
  color: #1d3c88;
  border: 1.5px solid #c9d2ec;
  font-size: 13px;
  border-radius: 10px;
  padding: 8px 16px;
}
.login-page .btn-secondary:hover { background: #e8edff; }
.login-page .auth-empty { color: #9ca3af; }
.login-page .form-actions a {
  color: #1d3c88;
  font-weight: 600;
  font-size: 13px;
  transition: opacity .2s;
}
.login-page .form-actions a:hover { opacity: 0.7; }

@keyframes floatOrb {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

/* Utility */
.flex{display:flex}.flex-col{flex-direction:column}.items-center{align-items:center}
.justify-between{justify-content:space-between}.justify-center{justify-content:center}
.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}
.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}
.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}
.text-sm{font-size:12px}.text-muted{color:var(--text-muted)}
.text-right{text-align:right}.text-center{text-align:center}
.w-full{width:100%}.hidden{display:none!important}
.font-bold{font-weight:700}.font-semi{font-weight:600}

/* ============ AUTH ============ */
.auth-wrap{
  min-height:100vh;display:grid;grid-template-columns:1fr 1fr;
}
@media(max-width:900px){.auth-wrap{grid-template-columns:1fr}.auth-brand{display:none}}
.auth-brand{
  background:linear-gradient(160deg,#e3d6f7 0%,#c9aee8 100%);color:#16213e;
  padding:60px;display:flex;flex-direction:column;justify-content:space-between;
  position:relative;overflow:hidden;
}
.auth-brand::before,.auth-brand::after{
  content:"";position:absolute;border-radius:50%;background:rgba(124,58,237,.12);
}
.auth-brand::before{width:400px;height:400px;top:-100px;right:-100px}
.auth-brand::after{width:300px;height:300px;bottom:-80px;left:-80px}
.auth-brand > *{position:relative;z-index:1}
.auth-brand h1{font-size:38px;font-weight:800;letter-spacing:-1px;line-height:1.1;margin-top:24px;color:#16213e}
.auth-brand p{font-size:15px;color:rgba(22,33,62,.72);margin-top:16px;max-width:400px}
.auth-features{display:flex;flex-direction:column;gap:14px;margin-top:32px}
.auth-features .f{display:flex;gap:12px;align-items:center;font-size:14px;color:rgba(22,33,62,.85)}
.auth-features .f .fi{width:36px;height:36px;background:#9b2c8f;border-radius:10px;display:grid;place-items:center;flex-shrink:0;color:#fff}
.auth-form-wrap{display:grid;place-items:center;padding:40px 24px;background:var(--bg)}
.auth-form{width:100%;max-width:420px}
.auth-form h2{font-size:26px;font-weight:700;letter-spacing:-.5px}
.auth-form .sub{color:var(--text-muted);margin-top:8px;margin-bottom:28px}
.roles{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-bottom:16px}
.role-chip{
  padding:8px;text-align:center;border:1px solid var(--border);
  background:var(--surface);border-radius:10px;font-size:11px;font-weight:600;
  cursor:pointer;transition:all .2s;color:var(--text-muted);
}
.role-chip:hover{border-color:var(--primary);color:var(--primary)}
.role-chip.active{background:var(--primary);color:#fff;border-color:var(--primary)}

/* Kanban */
.kanban{display:grid;grid-template-columns:repeat(4,minmax(240px,1fr));gap:16px;overflow-x:auto}
.kb-col{background:var(--surface-2);border-radius:var(--radius);padding:12px;min-height:200px}
.kb-head{display:flex;align-items:center;justify-content:space-between;padding:4px 6px 12px}
.kb-title{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;color:var(--text-muted)}
.kb-card{
  background:var(--surface);border-radius:10px;padding:12px;margin-bottom:10px;
  border:1px solid var(--border);cursor:pointer;transition:all .2s;
}
.kb-card:hover{transform:translateY(-2px);box-shadow:var(--shadow)}
.kb-card .t{font-weight:600;font-size:13px;margin-bottom:8px}
.kb-card .m{display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--text-muted)}

/* Chat */
.chat-wrap{display:grid;grid-template-columns:300px 1fr;gap:0;height:calc(100vh - var(--header-h) - 48px);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
@media(max-width:800px){.chat-wrap{grid-template-columns:1fr}.chat-list{display:none}}
.chat-list{border-right:1px solid var(--border);overflow-y:auto}
.chat-search{padding:12px;border-bottom:1px solid var(--border)}
.chat-search input{width:100%;background:var(--surface-2);border:1px solid transparent;padding:8px 12px;border-radius:8px;color:var(--text)}
.chat-item{display:flex;gap:10px;padding:12px;border-bottom:1px solid var(--border);cursor:pointer;transition:background .15s}
.chat-item:hover,.chat-item.active{background:var(--surface-2)}
.chat-item .ci-body{flex:1;min-width:0}
.chat-item .ci-name{font-weight:600;font-size:13px;display:flex;justify-content:space-between}
.chat-item .ci-time{font-size:11px;color:var(--text-soft);font-weight:400}
.chat-item .ci-msg{font-size:12px;color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-top:2px}
.chat-item .ci-unread{background:var(--primary);color:#fff;font-size:10px;padding:2px 6px;border-radius:8px;font-weight:700}
.chat-main{display:flex;flex-direction:column}
.chat-head{padding:14px 18px;border-bottom:1px solid var(--border);display:flex;gap:12px;align-items:center}
.chat-msgs{flex:1;overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:12px;background:var(--surface-2)}
.msg{max-width:70%;padding:10px 14px;border-radius:14px;font-size:13px;background:var(--surface);border:1px solid var(--border)}
.msg.mine{align-self:flex-end;background:var(--gradient);color:#fff;border:none}
.msg .mt{font-size:10px;opacity:.7;margin-top:4px;text-align:right}
.chat-input{padding:12px;border-top:1px solid var(--border);display:flex;gap:8px}
.chat-input input{flex:1;background:var(--surface-2);border:1px solid var(--border);padding:10px 14px;border-radius:10px;color:var(--text)}

/* Activity feed */
.activity{display:flex;gap:12px;padding:12px 0;border-bottom:1px solid var(--border)}
.activity:last-child{border-bottom:none}
.activity .a-icon{width:36px;height:36px;border-radius:10px;flex-shrink:0;display:grid;place-items:center;background:var(--primary-50);color:var(--primary)}
.activity .a-text{font-size:13px}
.activity .a-text b{font-weight:600}
.activity .a-time{font-size:11px;color:var(--text-soft);margin-top:2px}

/* Project header */
.proj-head{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:24px;margin-bottom:20px;
  position:relative;overflow:hidden;
}
.proj-head::before{
  content:"";position:absolute;top:0;left:0;right:0;height:4px;background:var(--gradient);
}

/* Page loading bar — shown at the top of the viewport while a page's data is
   still being fetched from the backend, hidden once fresh data lands. */
.pdms-loading-bar{position:fixed;top:0;left:0;height:3px;width:100%;z-index:9999;pointer-events:none}
.pdms-loading-bar::before{content:"";display:block;height:100%;width:20%;background:var(--gradient);opacity:0;transition:opacity .2s ease}
.pdms-loading-bar.active::before{opacity:1;animation:pdms-loading-pulse 1.1s ease-in-out infinite}
@keyframes pdms-loading-pulse{0%{width:10%;margin-left:0}50%{width:60%;margin-left:20%}100%{width:10%;margin-left:100%}}

/* Inline loading state for table/list sections while data is still arriving. */
.pdms-loading-inline{display:flex;align-items:center;gap:10px;padding:32px;justify-content:center;color:var(--text-muted);font-size:13px}
.pdms-spinner{width:16px;height:16px;border-radius:50%;border:2px solid var(--border);border-top-color:var(--primary);animation:pdms-spin .7s linear infinite}
@keyframes pdms-spin{to{transform:rotate(360deg)}}
