@media(max-width:900px){
  :root{--mobile-radius:16px;--mobile-shadow:0 8px 24px rgba(15,23,42,.08)}
  *{scrollbar-width:thin}
  body{min-width:0;background:#f2f5fa;font-size:14px}
  .dark{background:#0f172a}
  .app{padding-bottom:76px;min-height:100vh}
  .main{margin-left:0;width:100%;min-width:0}
  .topbar{height:64px;padding:0 14px;gap:10px;background:rgb(205 224 253);box-shadow:1px -2px 5px #d3e3fd;border-bottom:1px solid #e2e6eb;backdrop-filter:blur(10px);display:flex;align-items:center}
  .dark .topbar{background:rgb(205 224 253)}
  .topbar-user{margin-right:auto;display:flex;flex-direction:column;min-width:0}
  .topbar-user strong{font-size:14px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .topbar-user small{font-size:10px;letter-spacing:.04em;color:var(--muted)}
  .topbar-actions .btn,.topbar-right-group .btn,.btn-sm{min-height:32px;height:32px;padding:6px 12px;font-size:12px;border-radius:8px!important;white-space:nowrap;font-weight:700}
  .link-btn,.topbar-right-group .link-btn{min-height:32px;height:32px;padding:6px 12px;border-radius:8px!important;background:#d3e3fd!important;color:#0b2d68!important;font-weight:700;font-size:12px;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center}
  .menu-btn{display:none!important}
  .content{width:100%;max-width:none;padding:12px 0 30px}
  .page-head{margin:0 0 16px;padding:18px;border-radius:var(--mobile-radius);background:linear-gradient(135deg,#2b579a,#3b68b7);color:white;align-items:center;box-shadow:0 10px 24px rgba(43,87,154,.25)}
  .page-head h1{margin:0;font-size:23px;line-height:1.2;color:#fff;font-weight:800}
  .page-head p{margin:5px 0 0;color:#d3e3fd;font-size:13px}
  .page-head .back{color:#d3e3fd;font-size:12px;margin-bottom:7px}
  .page-head>.pill,.page-head>.status{background:rgba(255,255,255,.2);color:#fff}
  .page-head .btn{background:#fff;color:#3b68b7;border:0;font-weight:700;box-shadow:none}
  .stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px;margin-bottom:16px}
  .stat{min-width:0;min-height:104px;padding:14px;display:flex;align-items:flex-start;flex-direction:column;gap:10px;border:0;border-radius:var(--mobile-radius);box-shadow:var(--mobile-shadow)}
  .stat>i{font-size:17px;padding:9px;border-radius:11px}
  .stat>div{display:flex;width:100%;align-items:flex-end;justify-content:space-between;gap:8px}
  .stat b{font-size:23px;line-height:1}
  .stat span{font-size:12px;text-align:right;line-height:1.2}
  .grid-2,.detail-grid{display:grid;grid-template-columns:1fr;gap:14px}
  .panel{max-width:100%;padding:16px;border:0;border-radius:var(--mobile-radius);box-shadow:var(--mobile-shadow);overflow:hidden}
  .panel h2{font-size:16px;margin-bottom:14px}
  .panel-head{align-items:center;gap:12px}
  .panel-head a{font-size:12px;font-weight:700;color:#5b5fc7}
  .details{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .details div{padding:11px;border-radius:11px}
  .details dt{font-size:10px;text-transform:uppercase;letter-spacing:.04em}
  .details dd{font-size:13px;word-break:break-word}
  .filters{display:grid;grid-template-columns:1fr 1fr;gap:9px;padding:12px;margin-bottom:14px;border-radius:14px;background:var(--panel);box-shadow:var(--mobile-shadow)}
  .filters>*{width:100%;min-width:0!important}
  input,select,textarea{min-height:44px;border-radius:10px;background:var(--bg)}
  textarea{min-height:96px}
  .btn{min-height:42px;border-radius:10px;font-weight:700}
  .form-grid{display:grid;grid-template-columns:1fr;gap:13px}
  .form-grid .full,.full{grid-column:1/-1}
  .actions{gap:8px}
  .table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;border-radius:11px}
  table{min-width:590px;font-size:12px}
  th,td{padding:11px 9px}
  th{font-size:10px;background:var(--bg)}
  .activity>div{padding:10px 0;margin:0;border-bottom:1px solid var(--line)}
  .comments article{padding:12px;margin:0;border-bottom:1px solid var(--line)}
  .avatar{width:32px;height:32px}
  .inline-form,.upload{display:grid;grid-template-columns:1fr;align-items:stretch;margin-top:14px}
  .modal{align-items:flex-end;padding:0;background:rgba(15,23,42,.55)}
  .modal-card{width:100%;max-height:calc(100vh - 80px);max-height:calc(100dvh - 80px);overflow-y:auto;border-radius:22px 22px 0 0;padding:20px 16px calc(18px + env(safe-area-inset-bottom));box-shadow:0 -10px 30px rgba(15,23,42,.18);-webkit-overflow-scrolling:touch}
  .modal-card h2{font-size:18px;margin-top:0}
  .modal-close{width:36px;height:36px;border-radius:50%;background:var(--bg);top:12px;right:12px}
  .modal-card form,.modal-card .form-grid{display:grid;grid-template-columns:1fr;gap:13px}
  .modal-card form .full,.modal-card .full{grid-column:1/-1!important}
  .modal-header-tabs{flex-wrap:nowrap;gap:8px;padding-bottom:10px;margin-bottom:12px;position:sticky;top:-20px;background:var(--panel);z-index:2;padding-top:4px}
  .modal-tabs{gap:4px;flex-wrap:nowrap;overflow-x:auto}
  .modal-tab{padding:7px 12px;font-size:12px;white-space:nowrap;flex-shrink:0}
  .sidebar{position:fixed;inset:auto 0 0 0;width:100%;height:64px;padding:0;background:#ffffff!important;border-top:1px solid #d8e2f0!important;transform:none!important;z-index:50;overflow-x:auto;overflow-y:hidden;box-shadow:0 -4px 20px rgba(11,29,58,.08)!important}
  .sidebar .brand{display:none}
  .sidebar nav{width:100%;height:100%;display:flex;align-items:stretch;gap:0;min-width:0}
  .sidebar nav a{position:relative;flex:1;min-width:0;height:64px;padding:7px 2px 5px;border-radius:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;text-align:center;font-size:9px;line-height:1.1;white-space:nowrap;color:#5c6e8c!important;transition:all .2s ease}
  .sidebar nav a i{width:auto;margin:0;font-size:17px;color:#5c6e8c!important;transition:all .2s ease}
  .sidebar nav a:hover{color:#0b1d3a!important;background:#edf2fa!important}
  .sidebar nav a:hover i{color:#3b68b7!important}
  .sidebar nav a.active{background:rgba(37,99,235,0.12)!important;color:#1d4ed8!important;font-weight:700!important;border-radius:14px!important;box-shadow:none!important}
  .sidebar nav a.active i{color:#1d4ed8!important}
  .sidebar .badge{position:absolute;top:5px;right:8px;float:none;height:17px;min-width:17px;line-height:17px;padding:0 4px}
  .notification-list a,.files a{padding:13px 4px}
}
@media(max-width:480px){
  .content{padding:10px 0 24px}
  .page-head{padding:15px;align-items:stretch;gap:12px}
  .page-head h1{font-size:22px}
  .page-head .btn{width:100%}
  .filters{grid-template-columns:1fr}
  .details{grid-template-columns:1fr}
  .actions{flex-direction:column-reverse}
  .actions .btn{width:100%}
  .comments header{display:grid;gap:2px}
}

/* Small-screen hardening for long names, dense content and safe-area devices. */
@media(max-width:900px){
  html,body{max-width:100%;overflow-x:hidden}
  .app{padding-bottom:calc(76px + env(safe-area-inset-bottom))}
  .topbar{padding-top:env(safe-area-inset-top);height:calc(64px + env(safe-area-inset-top))}
  .topbar form{flex:none}
  .content,.panel,.ui-panel,.role-hero,.entity-card{min-width:0}
  .sidebar{height:calc(72px + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom)}
  .sidebar nav{overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:none}
  .sidebar nav::-webkit-scrollbar{display:none}
  .sidebar nav a{min-width:58px}
  .notification-list a>div,.files a>div,.comments article>div:last-child{min-width:0}
  .notification-list b,.files b,.comments p{overflow-wrap:anywhere}
  .description{overflow-wrap:anywhere}
  .table-wrap{border:1px solid var(--line)}
}

@media(max-width:480px){
  .topbar{padding-inline:10px;gap:8px}
  .topbar strong{max-width:34vw}
  .theme-btn{width:34px;height:34px}
  .link-btn{padding-inline:8px}
  .stat{min-height:96px}
  .modal-card{padding:16px 12px calc(20px + env(safe-area-inset-bottom));max-height:calc(100vh - 70px);max-height:calc(100dvh - 70px)}
  .modal-card .actions{flex-direction:column-reverse;gap:8px}
  .modal-card .actions .btn{width:100%}
  .modal-tab{padding:6px 10px;font-size:11px}
  .notification-list a{align-items:flex-start}
}

@media(max-width:768px){
  .metric-grid.six, .dashboard-kpis{
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }
  .metric-grid.six .metric-card, .dashboard-kpis .metric-card{
    padding: 10px 6px !important;
    min-height: 70px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
  }
  .metric-grid.six .metric-card i, .dashboard-kpis .metric-card i{
    width: 26px !important;
    height: 26px !important;
    font-size: 12px !important;
    margin-bottom: 4px !important;
  }
  .metric-grid.six .metric-card b, .dashboard-kpis .metric-card b{
    font-size: 17px !important;
    line-height: 1.1 !important;
  }
  .metric-grid.six .metric-card span, .dashboard-kpis .metric-card span{
    font-size: 9px !important;
    margin-top: 2px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }
}

.project-hero {
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  padding: 18px 20px !important;
  border-radius: 16px !important;
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
  color: #fff !important;
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.25) !important;
  margin-bottom: 20px !important;
  width: 100% !important;
}
.project-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.project-hero-top .back {
  font-size: 12px;
  color: #c7d2fe;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.project-hero-top .back:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}
.project-hero-top h1 {
  margin: 0;
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.project-hero-meta {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  width: 100%;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.project-hero-meta > div {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.project-hero-meta small {
  display: block;
  font-size: 10px;
  color: #a5b4fc;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.project-hero-meta b {
  display: block;
  font-size: 13px;
  color: #ffffff;
  font-weight: 700;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-hero-meta .status-chip {
  padding: 3px 10px;
  font-size: 11px;
  margin-top: 3px;
  display: inline-block;
  font-weight: 700;
}
@media (max-width: 900px) {
  .project-hero-meta {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
}
@media (max-width: 600px) {
  .project-hero {
    padding: 14px !important;
    gap: 10px !important;
  }
  .project-hero-top h1 {
    font-size: 20px !important;
  }
  .project-hero-meta {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }
  .project-hero-meta > div {
    padding: 7px 10px !important;
  }
  .project-hero-meta b {
    font-size: 12px !important;
  }
}

/* Unbreakable 1-Line Row for Task KPIs across ALL roles and ALL screen sizes */
html body .task-kpis,
html body .metric-grid.task-kpis,
html body div.task-kpis {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 4px !important;
    margin-bottom: 12px !important;
    width: 100% !important;
}

html body .task-kpis .metric-card,
html body .metric-grid.task-kpis .metric-card,
html body div.task-kpis .metric-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 6px 2px !important;
    min-height: 62px !important;
    border-radius: 10px !important;
    min-width: 0 !important;
}

html body .task-kpis .metric-card i,
html body .metric-grid.task-kpis .metric-card i,
html body div.task-kpis .metric-card i {
    width: 22px !important;
    height: 22px !important;
    font-size: 10px !important;
    margin: 0 0 2px 0 !important;
    border-radius: 6px !important;
    display: grid !important;
    place-items: center !important;
    grid-row: auto !important;
}

html body .task-kpis .metric-card b,
html body .metric-grid.task-kpis .metric-card b,
html body div.task-kpis .metric-card b {
    font-size: 15px !important;
    line-height: 1 !important;
    margin: 1px 0 !important;
    font-weight: 800 !important;
}

html body .task-kpis .metric-card span,
html body .metric-grid.task-kpis .metric-card span,
html body div.task-kpis .metric-card span {
    font-size: 8px !important;
    margin-top: 1px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    letter-spacing: -0.02em !important;
}

/* Unbreakable 1-Line Row for Employee KPIs (all 4 cards in 1 row across all screen sizes) */
html body .employee-kpis,
html body .metric-grid.employee-kpis,
html body div.employee-kpis,
html body .metric-grid.four-by-two {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 5px !important;
    margin-bottom: 12px !important;
    width: 100% !important;
}

html body .employee-kpis .metric-card,
html body .metric-grid.employee-kpis .metric-card,
html body div.employee-kpis .metric-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 6px 2px !important;
    min-height: 62px !important;
    border-radius: 10px !important;
    min-width: 0 !important;
}

html body .employee-kpis .metric-card i,
html body .metric-grid.employee-kpis .metric-card i,
html body div.employee-kpis .metric-card i {
    width: 22px !important;
    height: 22px !important;
    font-size: 10px !important;
    margin: 0 0 2px 0 !important;
    border-radius: 6px !important;
    display: grid !important;
    place-items: center !important;
    grid-row: auto !important;
}

html body .employee-kpis .metric-card b,
html body .metric-grid.employee-kpis .metric-card b,
html body div.employee-kpis .metric-card b {
    font-size: 15px !important;
    line-height: 1 !important;
    margin: 1px 0 !important;
    font-weight: 800 !important;
}

html body .employee-kpis .metric-card span,
html body .metric-grid.employee-kpis .metric-card span,
html body div.employee-kpis .metric-card span {
    font-size: 8.5px !important;
    margin-top: 1px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    letter-spacing: -0.02em !important;
}

/* Glass Hero Header Buttons (Project Detail) */
.hero-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    height: 32px !important;
    padding: 0 14px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    backdrop-filter: blur(8px) !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}
.hero-btn:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    color: #ffffff !important;
}

.hero-icon-pen-btn {
    display: grid !important;
    place-items: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.32) !important;
    backdrop-filter: blur(6px) !important;
    cursor: pointer !important;
    font-size: 13px !important;
    transition: all 0.2s ease !important;
}
.hero-icon-pen-btn:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
}

/* Symmetrical Action Row Pills (Task Detail) */
.task-action-row {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    margin-top: 8px !important;
    width: 100% !important;
}
.task-action-row::-webkit-scrollbar {
    display: none !important;
}

.task-action-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    height: 28px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    border-radius: 7px !important;
    border: 1px solid transparent !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

.task-action-pill.edit-pill {
    background: #d3e3fd !important;
    color: #0b2d68 !important;
    border-color: #bae0fd !important;
}
.task-action-pill.edit-pill:hover {
    background: #bae0fd !important;
}

.task-action-pill.delete-pill {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border-color: #fecaca !important;
}
.task-action-pill.delete-pill:hover {
    background: #fca5a5 !important;
}

.task-action-pill.priority-pill {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}
.task-action-pill.priority-pill.low { background: #f1f5f9 !important; color: #475569 !important; border-color: #e2e8f0 !important; }
.task-action-pill.priority-pill.medium { background: #e0f2fe !important; color: #0369a1 !important; border-color: #bae6fd !important; }
.task-action-pill.priority-pill.high { background: #fef3c7 !important; color: #b45309 !important; border-color: #fde68a !important; }
.task-action-pill.priority-pill.critical { background: #fee2e2 !important; color: #b91c1c !important; border-color: #fecaca !important; }

/* Priority Pill Colors — Task List Cards */
.priority-pill.low { background: none !important; border: none !important; color: #475569 !important; }
.priority-pill.medium { background: none !important; border: none !important; color: #0369a1 !important; }
.priority-pill.high { background: none !important; border: none !important; color: #b45309 !important; }
.priority-pill.critical { background: none !important; border: none !important; color: #b91c1c !important; }

/* Unbreakable Pure White Background for All Inputs, Textareas & Selects in Default State */
html body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not(.note-title-field),
html body select,
html body textarea,
html body .modal-card input,
html body .modal-card select,
html body .modal-card textarea,
html body .form-grid input,
html body .form-grid select,
html body .form-grid textarea,
html body .compact-filter input,
html body .compact-filter select,
html body .toolbar-ui input,
html body .toolbar-ui select {
    background-color: #ffffff !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html:not(.dark-theme) body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not(.note-title-field):focus,
html:not(.dark-theme) body select:focus,
html:not(.dark-theme) body textarea:focus {
    background-color: #ffffff !important;
    background: #ffffff !important;
    border-color: #3b68b7 !important;
    box-shadow: 0 0 0 3px rgba(59, 104, 183, 0.16) !important;
}

/* Row actions alignment for Managers & Employees cards */
html body .entity-card .row-actions {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-left: auto !important;
    grid-column: auto !important;
    grid-row: auto !important;
}
html body .entity-card .row-actions form {
    margin: 0 !important;
    display: inline-flex !important;
}
html body .entity-card .entity-meta {
    display: block !important;
}

/* Light & Clean Theme for Project Detail Hero Card */
html body .project-hero {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 2px !important;
    background: #ffffff !important;
    color: #0b1d3a !important;
    border: 1px solid #d8e2f0 !important;
    box-shadow: 0 8px 24px rgba(11, 29, 58, 0.05) !important;
    padding: 10px 14px 12px !important;
    border-radius: 14px !important;
    margin-bottom: 10px !important;
}

html body .project-hero-top {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin: 0 !important;
    padding: 0 !important;
}

html body .project-hero-top h1 {
    font-size: 19px !important;
    line-height: 1.1 !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #0b1d3a !important;
}

html body .hero-icon-pen-btn {
    background: #d3e3fd !important;
    color: #0b2d68 !important;
    border: 1px solid #bae0fd !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
}

html body .project-hero-meta {
    gap: 5px !important;
    margin-top: 2px !important;
    padding-top: 0 !important;
}

html body .project-hero-meta > div {
    padding: 6px 10px !important;
    border-radius: 10px !important;
    background: #edf2fa !important;
    border: 1px solid #d8e2f0 !important;
}

html body .project-hero-meta small {
    font-size: 9px !important;
    letter-spacing: 0.05em !important;
    margin-bottom: 2px !important;
    color: #5c6e8c !important;
}

html body .project-hero-meta b {
    font-size: 12px !important;
    color: #0b1d3a !important;
}

html body .content .panel {
    padding: 12px 14px !important;
    border-radius: 14px !important;
    margin-bottom: 10px !important;
}

html body .content .panel h2 {
    font-size: 14px !important;
    margin-bottom: 8px !important;
}

html body .content .panel p.description {
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin: 0 !important;
}

/* Subtle & Soft Active Selected KPI Card Highlight */
html body .metric-card.active-kpi-filter {
    border-color: #3b68b7 !important;
    background: #edf3fe !important;
    box-shadow: 0 0 0 2.5px rgba(59, 104, 183, 0.25) !important;
    outline: none !important;
    transform: none !important;
}

/* Ultra Compact Spacing for Task Detail View */
html body .task-detail-card {
    padding: 8px 12px 10px !important;
    margin-top: 0 !important;
    margin-bottom: 8px !important;
}

html body .task-detail-header {
    margin-bottom: 6px !important;
    gap: 4px !important;
}

html body .task-detail-header .back-link {
    margin-bottom: 2px !important;
    font-size: 11px !important;
}

html body .task-title-group h2 {
    font-size: 17px !important;
    line-height: 1.2 !important;
}

html body .project-tag {
    font-size: 13px !important;
    color: #3b68b7 !important;
    margin-top: 1px !important;
}

html body .task-desc-box {
    padding: 6px 10px !important;
    margin-bottom: 6px !important;
    border-radius: 8px !important;
}

html body .task-desc-box small {
    font-size: 13px !important;
    color: #000000 !important;
    margin-bottom: 1px !important;
}

html body .task-desc-box p {
    font-size: 13px !important;
    line-height: 1.3 !important;
}

html body .task-info-grid {
    padding: 6px 10px !important;
    margin-bottom: 6px !important;
    border-radius: 8px !important;
    gap: 4px !important;
}

html body .task-info-grid small {
    font-size: 8px !important;
}

html body .task-info-grid b {
    font-size: 11px !important;
    margin-top: 1px !important;
}

html body .task-detail-card + .ui-panel,
html body .task-detail-card ~ .ui-panel {
    margin-top: 6px !important;
    margin-bottom: 8px !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
}

/* ── Active KPI Filter Card ── CORRECT dark-theme selector ── */
html.dark-theme body .metric-card.active-kpi-filter,
html.dark-theme .metric-card.active-kpi-filter {
    border-color: rgba(255, 255, 255, 0.20) !important;
    background: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25), 0 8px 30px rgba(0, 0, 0, 0.7) !important;
    outline: none !important;
}

html.dark-theme .metric-card.active-kpi-filter b,
html.dark-theme .metric-card.active-kpi-filter span {
    color: #ffffff !important;
}

/* Keep Row Actions Anchored Right Inline on Employee and Manager Cards */
html body .entity-card.employee-card,
html body .entity-card.manager-card {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
}

html body .entity-card.employee-card .row-actions,
html body .entity-card.manager-card .row-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    margin-left: 8px !important;
}

/* Mobile PWA Floating Install Popup Banner */
.mobile-pwa-banner {
    position: fixed;
    bottom: 20px;
    left: 12px;
    right: 12px;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: slideUpPwaBanner 0.4s ease-out;
}

@keyframes slideUpPwaBanner {
    from {
        transform: translateY(120px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pwa-banner-close {
    position: absolute;
    top: 6px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 22px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 24px;
}

.pwa-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
    flex-shrink: 0;
}

.pwa-banner-text b {
    display: block;
    font-size: 14px;
    color: #0f172a;
}

.pwa-banner-text small {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
}

.pwa-banner-install-btn {
    width: 100%;
    background: #3b68b7 !important;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(59, 104, 183, 0.3);
}

@media (min-width: 768px) {
    .mobile-pwa-banner {
        left: auto;
        right: 20px;
        bottom: 20px;
        width: 350px;
    }
}

/* Force expand main container and panel horizontally on mobile view */
@media (max-width: 900px) {
    html body .content {
        padding-left: 7px !important;
        padding-right: 7px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    html body .ui-panel {
        padding-left: 10px !important;
        padding-right: 10px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        border-radius: 12px !important;
    }
    html body .metric-grid {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
    }
    html body .overdue-alert {
        margin-left: 4px !important;
        margin-right: 4px !important;
    }

/* ==========================================================================
   GLASSMORPHISM THEME & MOBILE RESPONSIVE ENHANCEMENTS
   ========================================================================== */

/* Modern Ambient Mesh Glass Background */
body {
    background: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
                radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.14) 0px, transparent 50%),
                radial-gradient(at 100% 100%, rgba(147, 197, 253, 0.18) 0px, transparent 50%),
                #eef3fa !important;
    background-attachment: fixed !important;
}

/* Glass Panels, Cards, Stats, Modals & Metric Cards */
.panel,
.stat,
.metric-card,
.ui-panel,
.entity-card,
.login-card,
.modal-card,
.task-detail-card,
.project-hero {
    background: rgba(255, 255, 255, 0.72) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.65) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07), inset 0 1px 0 0 rgba(255, 255, 255, 0.9) !important;
    border-radius: 16px !important;
}

/* Glass Topbar Header */
.topbar {
    background: rgba(224, 237, 255, 0.75) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.65) !important;
    box-shadow: 0 4px 20px rgba(11, 45, 104, 0.06) !important;
}

/* Glass Desktop Sidebar (> 900px) */
@media (min-width: 901px) {
    .sidebar {
        background: linear-gradient(180deg, rgba(21, 39, 68, 0.92) 0%, rgba(15, 27, 48, 0.95) 100%) !important;
        backdrop-filter: blur(20px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
        border-right: 1px solid rgba(255, 255, 255, 0.12) !important;
        box-shadow: 6px 0 28px rgba(0, 0, 0, 0.08) !important;
    }
    .sidebar nav a.active {
        background: rgba(255, 255, 255, 0.18) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15) !important;
    }
}

/* Modern Floating Glass Mobile Navigation Dock (<= 900px) */
@media (max-width: 900px) {
    .sidebar {
        position: fixed !important;
        inset: auto 12px calc(10px + env(safe-area-inset-bottom)) 12px !important;
        width: calc(100% - 24px) !important;
        height: 62px !important;
        padding: 4px !important;
        background: rgba(255, 255, 255, 0.92) !important;
        backdrop-filter: blur(25px) saturate(200%) !important;
        -webkit-backdrop-filter: blur(25px) saturate(200%) !important;
        border: 1.5px solid rgba(203, 213, 225, 0.9) !important;
        border-radius: 20px !important;
        box-shadow: 0 12px 35px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
        z-index: 9999 !important;
        overflow: hidden !important;
    }
    .sidebar .brand {
        display: none !important;
    }
    .sidebar nav {
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-around !important;
        gap: 4px !important;
        padding: 0 2px !important;
    }
    .sidebar nav a {
        position: relative !important;
        flex: 1 !important;
        min-width: 0 !important;
        height: 54px !important;
        padding: 5px 2px !important;
        border-radius: 14px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 3px !important;
        color: #334155 !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        transition: all 0.2s ease !important;
        background: transparent !important;
        box-shadow: none !important;
        border: 1px solid transparent !important;
    }
    .sidebar nav a i {
        font-size: 19px !important;
        color: #1e293b !important;
        transition: transform 0.2s ease, color 0.2s ease !important;
    }
    .sidebar nav a:hover {
        color: #0f172a !important;
        background: rgba(59, 104, 183, 0.08) !important;
    }
    .sidebar nav a.active {
        background: rgba(37, 99, 235, 0.12) !important;
        color: #1d4ed8 !important;
        font-weight: 700 !important;
        border: 1px solid rgba(37, 99, 235, 0.2) !important;
        box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15) !important;
    }
    .sidebar nav a.active i {
        color: #1d4ed8 !important;
        transform: translateY(-1px) scale(1.1) !important;
    }
    .sidebar nav a.active::after {
        content: "" !important;
        position: absolute !important;
        bottom: 3px !important;
        width: 5px !important;
        height: 5px !important;
        border-radius: 50% !important;
        background: #1d4ed8 !important;
    }

    /* Dark Mode Overrides for Mobile Dock */
    html.dark-theme .sidebar {
        background: rgba(22, 22, 26, 0.96) !important;
        backdrop-filter: blur(25px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
        border: 1.5px solid rgba(255, 255, 255, 0.20) !important;
        box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
    }
    html.dark-theme .sidebar nav a {
        color: #e2e8f0 !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        border: 1px solid transparent !important;
    }
    html.dark-theme .sidebar nav a i {
        color: #ffffff !important;
        font-size: 19px !important;
        opacity: 0.9 !important;
    }
    html.dark-theme .sidebar nav a:hover {
        color: #ffffff !important;
        background: rgba(255, 255, 255, 0.10) !important;
    }
    html.dark-theme .sidebar nav a:hover i {
        color: #ffffff !important;
        opacity: 1 !important;
    }
    html.dark-theme .sidebar nav a.active {
        background: rgba(255, 255, 255, 0.16) !important;
        color: #ffffff !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5) !important;
        font-weight: 700 !important;
    }
    html.dark-theme .sidebar nav a.active i {
        color: #ffffff !important;
        opacity: 1 !important;
        transform: translateY(-1px) scale(1.1) !important;
    }
    html.dark-theme .sidebar nav a.active::after {
        content: "" !important;
        position: absolute !important;
        bottom: 3px !important;
        width: 5px !important;
        height: 5px !important;
        border-radius: 50% !important;
        background: #3b82f6 !important;
        box-shadow: 0 0 8px #3b82f6 !important;
    }
    html.dark-theme .sidebar .badge {
        background: #ef4444 !important;
        color: #ffffff !important;
        border: 1.5px solid #141418 !important;
        font-weight: 700 !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
    }
}


/* Glass Interactive Buttons & Inputs */
.btn {
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

.btn.primary {
    background: linear-gradient(135deg, #3b68b7 0%, #2563eb 100%) !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.btn.primary:hover {
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4) !important;
    transform: translateY(-1px) !important;
}

/* Glass Inputs & Form Fields (Light Theme Only) */
html:not(.dark-theme) body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not(.note-title-field),
html:not(.dark-theme) body select,
html:not(.dark-theme) body textarea {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(203, 213, 225, 0.8) !important;
    border-radius: 12px !important;
    transition: all 0.2s ease !important;
}

html:not(.dark-theme) body input:focus,
html:not(.dark-theme) body select:focus,
html:not(.dark-theme) body textarea:focus {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: #3b68b7 !important;
    box-shadow: 0 0 0 3px rgba(59, 104, 183, 0.18) !important;
}

/* Mobile Display Hardening & Micro-Touch Improvements */
@media (max-width: 600px) {
    .page-head {
        border-radius: 16px !important;
        padding: 16px 14px !important;
        background: linear-gradient(135deg, rgba(43, 87, 154, 0.92), rgba(59, 130, 246, 0.95)) !important;
        backdrop-filter: blur(14px) !important;
        -webkit-backdrop-filter: blur(14px) !important;
    }
    .modal-card {
        border-radius: 24px 24px 0 0 !important;
        backdrop-filter: blur(24px) saturate(190%) !important;
        -webkit-backdrop-filter: blur(24px) saturate(190%) !important;
        background: rgba(255, 255, 255, 0.92) !important;
    }
    .stats {
        gap: 8px !important;
    }
    .stat {
        padding: 12px !important;
        border-radius: 14px !important;
    }
    .filters {
        border-radius: 14px !important;
        padding: 10px !important;
    }
/* Dark Theme Glass Inputs & Form Fields Hardening */
html.dark-theme body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not(.note-title-field),
html.dark-theme body select,
html.dark-theme body textarea,
html.dark-theme .login-card input {
    background-color: rgba(255, 255, 255, 0.05) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

html.dark-theme body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not(.note-title-field):focus,
html.dark-theme body input:focus,
html.dark-theme body select:focus,
html.dark-theme body textarea:focus,
html.dark-theme .login-card input:focus,
html.dark-theme input:focus {
    background-color: rgba(255, 255, 255, 0.08) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #FFFFFF !important;
    border-color: rgba(96, 165, 250, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25) !important;
    outline: none !important;
}

html.dark-theme body input::placeholder,
html.dark-theme body textarea::placeholder,
html.dark-theme .login-card input::placeholder {
    color: #888888 !important;
    opacity: 1 !important;
}

/* Chrome Autofill Dark Mode Override */
html.dark-theme input:-webkit-autofill,
html.dark-theme input:-webkit-autofill:hover,
html.dark-theme input:-webkit-autofill:focus,
html.dark-theme input:-webkit-autofill:active,
html.dark-theme textarea:-webkit-autofill,
html.dark-theme select:-webkit-autofill,
.dark-theme input:-webkit-autofill,
.dark-theme input:-webkit-autofill:hover,
.dark-theme input:-webkit-autofill:focus,
.dark-theme input:-webkit-autofill:active {
    -webkit-text-fill-color: #FFFFFF !important;
    -webkit-box-shadow: 0 0 0px 1000px #18181c inset !important;
    box-shadow: 0 0 0px 1000px #18181c inset !important;
    caret-color: #FFFFFF !important;
    transition: background-color 600000s ease-in-out 0s, color 600000s ease-in-out 0s !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* Dark Theme Primary Button Override */
html.dark-theme body .btn.primary,
html.dark-theme .btn.primary,
html.dark-theme .login-card .btn.primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4) !important;
    font-weight: 700 !important;
}

html.dark-theme body .btn.primary:hover,
html.dark-theme .btn.primary:hover,
html.dark-theme .login-card .btn.primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5) !important;
}

/* Dark Theme Alert Error Box */
html.dark-theme body .alert.error,
html.dark-theme .alert.error,
html.dark-theme .login-card .alert.error {
    background: rgba(153, 27, 27, 0.35) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(248, 113, 113, 0.4) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
}









