:root{
  --primary:#1b57a6; --primary-soft:#e6eefa; --page:#eef2f9;
  --text:#1f2937; --muted:#6b7280; --line:#eceff5; --card:#fff;
  --radius:16px; --shadow:0 2px 12px rgba(20,40,90,.06);
}
body.theme-owner   {--primary:#1b57a6; --primary-soft:#e6eefa; --page:#eef2f9;}
body.theme-leader  {--primary:#5b3df5; --primary-soft:#eeeaff; --page:#f1f1fb;}
body.theme-employee{--primary:#2f8cff; --primary-soft:#e5f1ff; --page:#f4f6f9;}
body.theme-guest   {--page:#eef2f9;}

body{font-family:'Inter',system-ui,sans-serif;background:var(--page);color:var(--text);font-size:14px}
.btn-primary{background:var(--primary);border-color:var(--primary);border-radius:10px;font-weight:500}
.btn-primary:hover,.btn-primary:focus{background:var(--primary);filter:brightness(.92);border-color:var(--primary)}
.btn-outline-primary{color:var(--primary);border-color:var(--primary);border-radius:10px}
.btn-outline-primary:hover{background:var(--primary);border-color:var(--primary)}
.text-primary{color:var(--primary)!important}
.form-control,.form-select{border-radius:10px;border-color:#e3e7ef}
.form-control:focus,.form-select:focus{border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-soft)}

/* ---------- Layout ---------- */
.app-shell{display:flex;min-height:100vh}
.sidebar{width:240px;background:var(--card);border-right:1px solid var(--line);padding:20px 16px;
  position:sticky;top:0;height:100vh;overflow-y:auto;flex-shrink:0}
.main-area{flex:1;min-width:0;display:flex;flex-direction:column}
.content{padding:24px 28px;flex:1}
.guest-wrap{max-width:480px;margin:40px auto;padding:0 16px}

.brand{display:flex;align-items:center;gap:10px;margin-bottom:28px;font-weight:700;font-size:18px}
.brand-logo{width:36px;height:36px;border-radius:10px;background:var(--primary);color:#fff;
  display:grid;place-items:center;font-size:18px}
.menu-label{font-size:12px;color:var(--muted);margin:0 8px 8px}
.side-nav{display:flex;flex-direction:column;gap:4px}
.side-link{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;
  color:#4b5563;text-decoration:none;font-weight:500;transition:.15s}
.side-link i{font-size:17px}
.side-link:hover{background:var(--primary-soft);color:var(--primary)}
.side-link.active{background:var(--primary-soft);color:var(--primary)}

/* Employee: icon-only rail */
.theme-employee .sidebar{width:84px;align-items:center;display:flex;flex-direction:column}
.theme-employee .brand-text,.theme-employee .menu-label,.theme-employee .side-link span{display:none}
.theme-employee .brand{margin-bottom:32px}
.theme-employee .brand-logo{width:46px;height:46px;border-radius:14px;font-size:22px}
.theme-employee .side-link{justify-content:center;width:46px;height:46px;padding:0}
.theme-employee .side-link i{font-size:20px}
.theme-employee .side-link.active{background:var(--primary);color:#fff}

/* Topbar */
.topbar{display:flex;align-items:center;gap:16px;padding:16px 28px;background:var(--card);border-bottom:1px solid var(--line)}
.topbar-title h1{font-size:17px;font-weight:600;margin:0}
.topbar-title p{margin:0;color:var(--muted);font-size:12px}
.topbar-right{margin-left:auto;display:flex;align-items:center;gap:14px}
.search-box{align-items:center;gap:8px;border:1px solid var(--line);border-radius:12px;padding:8px 14px;background:#fff;min-width:220px}
.search-box input{border:0;outline:0;width:100%;background:transparent}
.search-box i{color:var(--muted)}
.btn-icon{border:1px solid var(--line);background:#fff;border-radius:50%;width:38px;height:38px;display:grid;place-items:center}
.user-chip{display:flex;align-items:center;gap:10px}
.avatar{width:36px;height:36px;border-radius:50%;background:var(--primary-soft);color:var(--primary);
  display:grid;place-items:center;font-weight:600}
.user-name{font-weight:600;font-size:13px;line-height:1.1}
.user-role{font-size:11px;color:var(--muted)}
.page-footer{text-align:center;color:var(--muted);font-size:12px;padding:24px 0 0}

/* ---------- Cards ---------- */
.card,.panel{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.panel{padding:18px 20px;height:100%}
.panel-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:12px}
.panel-head h3{font-size:15px;font-weight:600;margin:0}
.panel-head p{font-size:12px;color:var(--muted);margin:2px 0 0}
.chart-box{position:relative;height:220px}
.table{--bs-table-bg:transparent}
.table thead th{font-size:12px;color:var(--muted);font-weight:500;border-bottom:1px solid var(--line)}
.badge{font-weight:500;border-radius:8px;padding:5px 9px}

/* ---------- Owner: KPI tiles ---------- */
.kpi-wrap{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:14px;box-shadow:var(--shadow)}
.kpi{border-radius:14px;padding:22px 12px;text-align:center}
.kpi .num{font-size:26px;font-weight:600}
.kpi .lbl{font-size:12px;color:#5b6472}
.kpi.k1{background:#e9eef8}.kpi.k2{background:#ecebf8}.kpi.k3{background:#e9f3ea}.kpi.k4{background:#f8eaea}

.insight{display:flex;gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid var(--line)}
.insight:last-child{border:0}
.insight i{font-size:18px;color:#4b5563}
.insight b{display:block;font-size:13px}
.insight small{color:var(--muted)}

.bar-row{display:flex;align-items:center;gap:10px;margin-bottom:12px;font-size:12px}
.bar-row .name{width:90px;color:var(--muted)}
.bar-row .track{flex:1;background:#f0f2f6;border-radius:8px;height:14px;overflow:hidden}
.bar-row .fill{height:100%;background:var(--primary);border-radius:8px}
.bar-row .val{width:30px;text-align:right;font-weight:600}

/* ---------- Leader: Kanban ---------- */
.board-head{display:flex;align-items:center;gap:14px;margin-bottom:18px;flex-wrap:wrap}
.board-head h2{font-size:22px;font-weight:700;margin:0}
.board-icon{width:40px;height:40px;border-radius:12px;background:var(--primary);color:#fff;display:grid;place-items:center;font-size:20px}
.board-tabs{display:flex;gap:18px;border-bottom:1px solid var(--line);margin-bottom:18px}
.board-tabs a{padding:8px 2px;color:var(--muted);text-decoration:none;font-weight:500}
.board-tabs a.active{color:var(--primary);border-bottom:2px solid var(--primary)}
.kanban{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;align-items:start}
.k-col-head{display:flex;align-items:center;gap:8px;font-weight:600;margin-bottom:12px}
.k-dot{width:8px;height:8px;border-radius:50%}
.k-count{font-size:11px;padding:1px 8px;border-radius:8px;font-weight:600}
.t-card{background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px;margin-bottom:14px;box-shadow:var(--shadow)}
.t-card:hover{box-shadow:0 6px 18px rgba(91,61,245,.12)}
.tag{font-size:10.5px;font-weight:600;padding:3px 8px;border-radius:6px;margin-right:4px;display:inline-block}
.tag.t-blue{background:#e5efff;color:#2f6fed}.tag.t-red{background:#ffe9e9;color:#e04848}
.tag.t-green{background:#e3f6ea;color:#1f9d55}.tag.t-yellow{background:#fff4d6;color:#b7791f}
.t-card h4{font-size:14px;font-weight:600;margin:10px 0 4px}
.t-card p{font-size:12px;color:var(--muted);margin:0 0 10px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.seg{display:flex;gap:4px;margin:4px 0 10px}
.seg i{flex:1;height:4px;border-radius:4px;background:#e5e7ee}
.seg i.on{background:#22c55e}
.seg.warn i.on{background:#f5b301}
.t-foot{display:flex;align-items:center;justify-content:space-between;font-size:12px;color:var(--muted)}
.mini-avatar{width:24px;height:24px;border-radius:50%;background:var(--primary-soft);color:var(--primary);
  display:inline-grid;place-items:center;font-size:11px;font-weight:600}

/* ---------- Employee: Task progress ---------- */
.greet h2{font-size:22px;font-weight:600;margin:0}
.greet p{color:var(--muted);margin:2px 0 0;font-size:12px}
.emp-layout{display:grid;grid-template-columns:1fr 260px;gap:0;background:#fff;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}
.emp-board{padding:16px 20px}
.emp-cols{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}
.col-title{display:flex;align-items:center;gap:8px;padding-bottom:10px;font-weight:600;border-bottom:2px solid var(--line);margin-bottom:14px}
.col-title.todo{border-color:#ef4444}.col-title.done{border-color:#22c55e}
.col-title .dot{width:12px;height:12px;border-radius:50%}
.emp-side{border-left:1px solid var(--line);padding:18px}
.stat-box{border-bottom:1px solid var(--line);padding:12px 0}
.stat-box .big{font-size:30px;font-weight:700}
.stat-box small{color:var(--muted)}
.pill{font-size:11px;padding:2px 10px;border-radius:12px;font-weight:600}
.pill.blue{background:#dbeafe;color:#2563eb}.pill.yellow{background:#fef3c7;color:#b45309}.pill.green{background:#dcfce7;color:#15803d}
.ring{--p:0;width:64px;height:64px;border-radius:50%;flex-shrink:0;
  background:conic-gradient(var(--primary) calc(var(--p)*1%),#e5e7eb 0);display:grid;place-items:center}
.ring span{width:50px;height:50px;border-radius:50%;background:#fff;display:grid;place-items:center;font-weight:600;font-size:12px}

/* ---------- Responsive ---------- */
@media(max-width:991px){
  .sidebar{position:fixed;left:-260px;z-index:1050;transition:.2s;width:240px!important;height:100vh}
  .sidebar.open{left:0}
  .theme-employee .brand-text,.theme-employee .menu-label,.theme-employee .side-link span{display:inline}
  .theme-employee .side-link{width:auto;justify-content:flex-start;padding:10px 12px}
  .content,.topbar{padding-left:16px;padding-right:16px}
  .kanban{grid-template-columns:1fr}
  .emp-layout{grid-template-columns:1fr}
  .emp-side{border-left:0;border-top:1px solid var(--line)}
  .emp-cols{grid-template-columns:1fr}
}

/* ---------- Auth pages (login / register) ---------- */
.auth-page{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;
  background:linear-gradient(135deg,#eef2f9 0%,#dfe8f6 100%)}
.auth-card{display:grid;grid-template-columns:1fr 1fr;width:100%;max-width:880px;background:#fff;
  border-radius:24px;overflow:hidden;box-shadow:0 20px 60px rgba(20,40,90,.15)}
.auth-brand{background:linear-gradient(160deg,var(--primary) 0%,#2f7be0 100%);color:#fff;padding:44px 36px;
  display:flex;flex-direction:column;justify-content:center}
.auth-brand .brand{margin-bottom:32px}
.auth-brand .brand-logo{background:rgba(255,255,255,.2)}
.auth-brand h2{font-size:24px;font-weight:700;line-height:1.3;margin-bottom:12px}
.auth-brand p{opacity:.85;margin-bottom:24px}
.auth-points{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:12px;font-size:13px}
.auth-points i{background:rgba(255,255,255,.18);border-radius:8px;padding:7px;margin-right:8px}
.auth-form{padding:44px 40px;display:flex;flex-direction:column;justify-content:center}
.auth-form h3{font-weight:700;font-size:22px;margin-bottom:4px}
.auth-form .form-label{font-size:13px;font-weight:500}
.input-icon{position:relative}
.input-icon > i{position:absolute;left:14px;top:50%;transform:translateY(-50%);color:var(--muted)}
.input-icon .form-control{padding:11px 42px 11px 40px}
.pwd-toggle{position:absolute;right:8px;top:50%;transform:translateY(-50%);border:0;background:transparent;
  color:var(--muted);padding:6px 8px}
@media(max-width:767px){
  .auth-card{grid-template-columns:1fr}
  .auth-brand{display:none}
  .auth-form{padding:32px 24px}
}