:root {
  --dms-navy: #07162f;
  --dms-navy-2: #0b2144;
  --dms-navy-3: #12305c;
  --dms-cyan: #4fb3e8;
  --dms-cyan-2: #7dd3fc;
  --dms-ink: #0f172a;
  --dms-muted: #64748b;
  --dms-label: #7b8aa3;
  --dms-bg: #eef2f7;
  --dms-card: #ffffff;
  --dms-border: #d7e0ec;
  --dms-field-bg: #f3f6fa;
  --dms-field-border: #d5dee9;
  --dms-sidebar-w: 280px;
  --dms-topbar-h: 42px;
  --dms-footer-h: 34px;
  --dms-radius: 14px;
  --dms-radius-sm: 10px;
  --dms-glow: 0 0 24px rgba(79, 179, 232, 0.35);
  --dms-control-h: 34px;
  --dms-control-font: 0.875rem;
  --dms-control-radius: 8px;
}

html, body {
  height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--dms-ink);
}

/* ========== Auth / Login ========== */
body.auth-body {
  min-height: 100vh;
  background: radial-gradient(1200px 700px at 50% -10%, #12305c 0%, transparent 55%),
              linear-gradient(160deg, #050a18 0%, #07162f 45%, #0a1d3a 100%);
  position: relative;
  overflow-x: hidden;
}

.starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  --auth-tilt-x: 0deg;
  --auth-tilt-y: 0deg;
  --auth-glow-x: 50%;
  --auth-glow-y: 30%;
  position: relative;
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, rgba(12, 28, 58, 0.92), rgba(8, 18, 40, 0.96));
  border-radius: 22px;
  padding: 28px 28px 22px;
  border: 1px solid rgba(79, 179, 232, 0.45);
  box-shadow: 0 0 0 1px rgba(79, 179, 232, 0.08), var(--dms-glow), 0 24px 60px rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
  transform: perspective(1000px) rotateX(var(--auth-tilt-x)) rotateY(var(--auth-tilt-y));
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  will-change: transform;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    380px circle at var(--auth-glow-x) var(--auth-glow-y),
    rgba(79, 179, 232, 0.22),
    transparent 55%
  );
  opacity: 0.55;
  transition: opacity 0.2s ease;
  z-index: 0;
}

.auth-card.is-moving {
  box-shadow: 0 0 0 1px rgba(79, 179, 232, 0.18), 0 0 36px rgba(79, 179, 232, 0.35), 0 28px 70px rgba(0, 0, 0, 0.5);
}

.auth-card.is-moving::before {
  opacity: 0.9;
}

.auth-card > * {
  position: relative;
  z-index: 1;
}

.auth-secure {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(79, 179, 232, 0.12);
  border: 1px solid rgba(79, 179, 232, 0.28);
  color: var(--dms-cyan-2);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.auth-secure-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dms-cyan);
  box-shadow: 0 0 8px var(--dms-cyan);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.auth-mark {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #67e8f9, #3b82f6);
  color: #04111f;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  box-shadow: 0 0 18px rgba(79, 179, 232, 0.45);
}

.auth-brand-copy h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.25;
}

.auth-brand-copy p {
  margin: 2px 0 0;
  color: #94a3b8;
  font-size: 0.8rem;
}

.auth-subtitle {
  text-align: center;
  color: #7dd3fc;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 10px 0 22px;
}

.auth-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #93c5fd;
  margin-bottom: 6px;
}

.auth-input {
  background: rgba(2, 10, 24, 0.65) !important;
  border: 1px solid rgba(125, 211, 252, 0.35) !important;
  color: #f8fafc !important;
  border-radius: var(--dms-control-radius) !important;
  min-height: var(--dms-control-h);
  height: var(--dms-control-h);
  padding: 0 0.75rem;
  font-size: var(--dms-control-font);
  line-height: 1.25;
  box-shadow: none !important;
  box-sizing: border-box;
}

.auth-input::placeholder {
  color: #64748b;
}

.auth-input:focus {
  border-color: var(--dms-cyan) !important;
  box-shadow: 0 0 0 2px rgba(79, 179, 232, 0.2) !important;
}

.auth-password-wrap {
  position: relative;
}

.auth-password-wrap .auth-input {
  padding-right: 40px;
}

.auth-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #93c5fd;
  padding: 4px 6px;
  line-height: 1;
  font-size: 0.9rem;
}

.auth-submit {
  min-height: var(--dms-control-h);
  height: var(--dms-control-h);
  padding: 0 1rem;
  border: 0;
  border-radius: var(--dms-control-radius);
  font-weight: 800;
  font-size: var(--dms-control-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #04111f;
  background: linear-gradient(90deg, #67e8f9, #38bdf8 45%, #60a5fa);
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.auth-submit:hover {
  color: #04111f;
  filter: brightness(1.05);
}

.auth-alert {
  border-radius: 12px;
  font-size: 0.9rem;
}

.auth-card-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  text-align: center;
  color: #64748b;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ========== App shell (sidebar + scrollable content) ========== */
body.app-shell {
  display: flex;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: var(--dms-bg);
}

.app-sidebar {
  width: var(--dms-sidebar-w);
  flex: 0 0 var(--dms-sidebar-w);
  background:
    radial-gradient(600px 280px at 20% -10%, rgba(79, 179, 232, 0.18), transparent 60%),
    linear-gradient(180deg, var(--dms-navy-2), var(--dms-navy));
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 0;
  z-index: 1040;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 16px;
  flex: 0 0 auto;
  position: relative;
}

.sidebar-collapse-btn {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  flex: 0 0 30px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}
.sidebar-collapse-btn i {
  font-size: 1.15rem;
  line-height: 1;
}

body.sidebar-collapsed {
  --dms-sidebar-w: 76px;
}
body.sidebar-collapsed .app-sidebar {
  padding-left: 10px;
  padding-right: 10px;
  overflow: visible;
}
body.sidebar-collapsed .sidebar-brand {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 6px 0 14px;
}
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .sidebar-user-meta,
body.sidebar-collapsed .sidebar-link span,
body.sidebar-collapsed .sidebar-foot-meta {
  display: none !important;
}
body.sidebar-collapsed .brand-mark {
  margin: 0;
}
body.sidebar-collapsed .sidebar-collapse-btn {
  position: static;
  margin: 0;
  background: #fff;
  color: #0b2144;
  border-color: #c9d4e4;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}
body.sidebar-collapsed .sidebar-collapse-btn:hover {
  background: #f4f7fb;
  color: #0b2144;
}
body.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding: 10px 8px;
  gap: 0;
  flex-direction: column;
}
body.sidebar-collapsed .sidebar-logout {
  margin-top: 6px;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
}
body.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 0;
  min-height: var(--dms-control-h);
  height: var(--dms-control-h);
}
body.sidebar-collapsed .sidebar-link i {
  margin: 0;
  font-size: 1.2rem;
}
body.sidebar-collapsed .sidebar-avatar {
  width: 40px;
  height: 40px;
  font-size: 0.92rem;
}
body.sidebar-collapsed .sidebar-collapse-btn {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}
body.sidebar-collapsed .sidebar-collapse-btn i {
  font-size: 1.25rem;
}
body.sidebar-collapsed .sidebar-foot {
  justify-content: center;
  margin-left: -10px;
  margin-right: -10px;
  padding: 0;
}
.app-sidebar {
  transition: flex-basis 0.2s ease, width 0.2s ease;
}

.brand-mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #67e8f9, #3b82f6);
  color: #04111f;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  color: #fff;
}

.brand-text small {
  color: #94a3b8;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--dms-ink);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 16px;
  flex: 0 0 auto;
}

.sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(145deg, #38bdf8, #2563eb);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex: 0 0 auto;
}

.sidebar-user-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.sidebar-user-name {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-id {
  color: var(--dms-muted);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  flex: 0 0 auto;
  border-radius: 8px;
  font-size: 1.05rem;
  line-height: 1;
  color: #64748b;
  background: #fff;
  border: 1px solid #cbd5e1;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.sidebar-logout:hover,
.sidebar-logout:focus {
  color: #dc2626;
  background: #fff5f5;
  border-color: #fca5a5;
  text-decoration: none;
  outline: none;
}

.sidebar-logout:hover i,
.sidebar-logout:focus i {
  color: #dc2626;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--dms-control-h);
  height: var(--dms-control-h);
  padding: 0 12px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--dms-control-font);
  line-height: 1.2;
  border: 1px solid transparent;
  box-sizing: border-box;
}

.sidebar-link i {
  font-size: 1.1rem;
  width: 1.1rem;
  text-align: center;
  line-height: 1;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-link.active {
  background: #fff;
  color: var(--dms-navy);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

/* Modals: always center in the viewport (app shell uses flex + overflow) */
.modal {
  --bs-modal-margin: 0.75rem;
}
.modal.show .modal-dialog {
  display: flex;
  align-items: center;
  min-height: calc(100% - var(--bs-modal-margin) * 2);
}
.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - var(--bs-modal-margin) * 2);
}
body.has-impersonation-banner .modal {
  padding-top: 44px;
}

.sidebar-foot {
  flex: 0 0 var(--dms-footer-h);
  height: var(--dms-footer-h);
  margin: 8px -14px 0;
  padding: 0 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  overflow: hidden;
  min-width: 0;
}

.sidebar-cloud-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.sidebar-cloud-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.sidebar-foot-meta {
  color: #94a3b8;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: var(--dms-bg);
}

.app-topbar {
  flex: 0 0 auto;
  height: var(--dms-topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--dms-border);
  overflow: visible;
  position: relative;
  z-index: 40;
}

.topbar-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--dms-ink);
  line-height: 1;
}

.topbar-spacer {
  flex: 1 1 auto;
}

.topbar-project-btn {
  max-width: min(320px, 46vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 8px !important;
  font-size: 0.8rem;
}

.dmy-date-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  max-width: 100%;
  width: 100%;
  position: relative;
  height: var(--dms-control-h);
}
.dmy-date-wrap .dmy-date-text {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: var(--dms-control-h) !important;
  min-height: var(--dms-control-h) !important;
}
.dmy-date-wrap .dmy-date-btn {
  width: var(--dms-control-h) !important;
  height: var(--dms-control-h) !important;
  min-height: var(--dms-control-h) !important;
  min-width: var(--dms-control-h) !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--dms-control-h);
  line-height: 1 !important;
  overflow: hidden;
}
.dmy-date-wrap .dmy-date-btn > i {
  font-size: 0.95rem;
  line-height: 1;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 1;
  pointer-events: none;
  display: block;
}
.dmy-date-wrap .dmy-date-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.modal .dmy-date-wrap .dmy-date-text,
.page-toolbar .dmy-date-wrap .dmy-date-text {
  width: auto;
  min-width: 8.5rem;
}
.page-toolbar .dmy-date-wrap {
  width: auto;
}
.page-toolbar .dmy-date-wrap .dmy-date-text {
  flex: 0 0 8.5rem;
  width: 8.5rem;
}

.page-toolbar .d-flex.align-items-center > .btn,
.page-toolbar .d-flex.align-items-center > .btn-sm,
.page-toolbar .d-flex.align-items-center > .form-control,
.page-toolbar .d-flex.align-items-center > .form-select,
.page-toolbar .dmy-date-wrap .dmy-date-text,
.page-toolbar .dmy-date-wrap .dmy-date-btn {
  height: var(--dms-control-h) !important;
  min-height: var(--dms-control-h) !important;
  box-sizing: border-box;
}
.page-toolbar .d-flex.align-items-center > .btn,
.page-toolbar .d-flex.align-items-center > .btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.dmy-calendar {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1080;
  width: 280px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #c9d4e4;
  background: #fff;
  box-shadow: 0 12px 28px rgba(11, 33, 68, 0.16);
}
.dmy-calendar.is-fixed-open {
  position: fixed;
  z-index: 2000;
}
.dmy-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.dmy-cal-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #0b2144;
}
.dmy-cal-nav {
  width: 30px;
  height: 30px;
  border: 1px solid #c9d4e4;
  border-radius: 8px;
  background: #f4f7fb;
  color: #0b2144;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.dmy-cal-nav:hover {
  background: #e8eef6;
}
.dmy-cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #74839e;
  text-transform: uppercase;
}
.dmy-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dmy-cal-empty {
  height: 34px;
}
.dmy-cal-day {
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #0b2144;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.dmy-cal-day:hover:not(:disabled) {
  background: #e8eef6;
}
.dmy-cal-day.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 1px #0b2144;
}
.dmy-cal-day.is-selected {
  background: #0b2144;
  color: #fff;
}
.dmy-cal-day.is-disabled,
.dmy-cal-day:disabled {
  color: #b6c0d0;
  cursor: not-allowed;
  background: transparent;
}

.impersonation-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: #0f3d5e;
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.impersonation-banner strong {
  font-weight: 700;
}
.impersonation-banner .text-muted {
  color: rgba(255,255,255,0.75) !important;
}
.impersonation-sep {
  margin: 0 6px;
  opacity: 0.5;
}
.impersonation-banner-text {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
body.has-impersonation-banner {
  padding-top: 44px;
  box-sizing: border-box;
}
body.has-impersonation-banner .app-sidebar,
body.has-impersonation-banner .app-main {
  height: calc(100vh - 44px);
  max-height: calc(100vh - 44px);
}
body.has-impersonation-banner .app-sidebar {
  top: 44px;
}
/* Small gap only under the page header / action buttons — sidebar stays flush */
body.has-impersonation-banner .app-topbar {
  margin-top: 8px;
}

.work-project-list .work-project-item {
  border-radius: 8px;
  margin-bottom: 6px;
}

.sidebar-toggle {
  border: 1px solid var(--dms-border);
  background: #fff;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--dms-ink);
}

.app-content {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 20px;
}

.app-footer {
  flex: 0 0 var(--dms-footer-h);
  height: var(--dms-footer-h);
  background: #fff;
  border-top: 1px solid var(--dms-border);
  color: var(--dms-muted);
  text-align: center;
  font-size: 0.7rem;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 20, 0.45);
  z-index: 1035;
}

body.sidebar-open .sidebar-backdrop {
  display: block;
}

/* ========== Content components ========== */
.command-banner {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(2px 2px at 12% 28%, rgba(255,255,255,0.55), transparent 40%),
    radial-gradient(1.5px 1.5px at 28% 72%, rgba(255,255,255,0.4), transparent 40%),
    radial-gradient(2px 2px at 48% 18%, rgba(255,255,255,0.5), transparent 40%),
    radial-gradient(1.5px 1.5px at 68% 62%, rgba(255,255,255,0.35), transparent 40%),
    radial-gradient(2px 2px at 86% 30%, rgba(255,255,255,0.45), transparent 40%),
    radial-gradient(1.5px 1.5px at 92% 78%, rgba(255,255,255,0.3), transparent 40%),
    linear-gradient(135deg, #0b2144 0%, #12305c 55%, #0a1d3a 100%);
  box-shadow: 0 14px 30px rgba(7, 22, 47, 0.22);
}

.command-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #93c5fd;
  font-weight: 700;
  margin-bottom: 6px;
}

.command-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.command-sub {
  margin: 8px 0 0;
  color: #cbd5e1;
  font-size: 0.92rem;
}

.command-banner-side {
  display: flex;
  align-items: center;
}

.command-metric {
  text-align: center;
  min-width: 110px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.command-metric-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
}

.command-metric-label {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #93c5fd;
}

.stat-card,
.panel-card {
  --glow-x: 50%;
  --glow-y: 50%;
  position: relative;
  background: var(--dms-card);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  padding: 18px 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card,
.progress-metric-card {
  transform: scale(1);
  transform-origin: center center;
  will-change: transform;
}

.stat-card {
  overflow: visible;
}

.panel-card {
  /* visible so row action dropdowns are not clipped */
  overflow: visible;
}

.stat-card::before,
.panel-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(
    420px circle at var(--glow-x) var(--glow-y),
    rgba(59, 130, 246, 0.16),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Little grow + lifted shadow (like Delivered Points) */
.stat-card:hover,
.stat-card.is-growing,
.progress-metric-card:hover,
.progress-metric-card.is-growing {
  transform: scale(1.035);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
  z-index: 3;
}

.stat-card:hover::before,
.stat-card.is-growing::before,
.progress-metric-card:hover::before,
.progress-metric-card.is-growing::before {
  opacity: 1;
}

.stat-card > *,
.panel-card > * {
  position: relative;
  z-index: 1;
}

.stat-label {
  color: #74839e;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  margin-top: 6px;
  font-size: 2rem;
  font-weight: 800;
  color: #0b2144;
  line-height: 1.15;
}

.panel-card-head {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 14px;
  color: #0b2144;
}

.progress-metric-row > [class*="col-"] {
  display: flex;
  /* allow hover grow/shadow to show outside the column */
  overflow: visible;
}
.progress-metric-row {
  overflow: visible;
}
.progress-metric-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 108px;
  height: 100%;
}
.progress-metric-value {
  margin: 6px 0;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  color: #0b2144;
  word-break: break-word;
}

.role-list {
  list-style: none;
  padding: 0;
}

.role-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--dms-border);
}

.role-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.role-name {
  font-weight: 600;
}

.role-code {
  background: #fce7f3;
  color: #be185d;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.8rem;
}

/* ========== Forms: labels, inputs, selects ========== */
.app-content .form-label,
.modal .form-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #74839e;
  margin-bottom: 6px;
}

.app-content .form-control,
.app-content .form-select,
.app-content .form-control-sm,
.app-content .form-select-sm,
.modal .form-control,
.modal .form-select,
.modal .form-control-sm,
.modal .form-select-sm,
.page-toolbar .form-control,
.page-toolbar .form-select,
.page-toolbar .form-control-sm,
.page-toolbar .form-select-sm {
  height: var(--dms-control-h) !important;
  min-height: var(--dms-control-h) !important;
  padding: 0 0.75rem !important;
  font-size: var(--dms-control-font) !important;
  line-height: 1.25 !important;
  border-radius: var(--dms-control-radius);
  border: 1px solid #c9d4e4;
  background: #f4f7fb;
  color: #0b2144;
  box-shadow: none;
  box-sizing: border-box;
}

.app-content textarea.form-control,
.app-content textarea.form-control-sm,
.modal textarea.form-control,
.modal textarea.form-control-sm {
  height: auto !important;
  min-height: 68px !important;
  padding-top: 0.45rem !important;
  padding-bottom: 0.45rem !important;
  line-height: 1.4 !important;
}

.app-content .form-control::placeholder,
.modal .form-control::placeholder {
  color: #94a3b8;
}

.app-content .form-control:focus,
.app-content .form-select:focus,
.modal .form-control:focus,
.modal .form-select:focus,
.page-toolbar .form-control:focus,
.page-toolbar .form-select:focus {
  border-color: #0b2144;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(11, 33, 68, 0.1);
  color: #0b2144;
}

.app-content .form-select,
.app-content .form-select-sm,
.modal .form-select,
.modal .form-select-sm,
.page-toolbar .form-select,
.page-toolbar .form-select-sm {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230b2144' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 9px 6px;
  padding-right: 32px !important;
}

.app-content .form-select[multiple],
.modal .form-select[multiple] {
  height: auto !important;
  min-height: 110px !important;
  background-image: none;
  padding-right: 0.75rem !important;
}

.app-content .form-text,
.modal .form-text {
  color: #74839e;
  font-size: 0.75rem;
  margin-top: 4px;
}

/* ========== Buttons: match input control height everywhere ========== */
.btn,
.btn-sm,
.btn-lg {
  --bs-btn-padding-y: 0;
  --bs-btn-padding-x: 1rem;
  --bs-btn-font-size: var(--dms-control-font);
  --bs-btn-line-height: 1.25;
  --bs-btn-border-radius: var(--dms-control-radius);
  --btn-glow-x: 50%;
  --btn-glow-y: 50%;
  position: relative;
  overflow: hidden;
  height: var(--dms-control-h) !important;
  min-height: var(--dms-control-h) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-left: 1rem;
  padding-right: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  box-sizing: border-box;
  border-radius: var(--dms-control-radius) !important;
  font-weight: 700;
  font-size: var(--dms-control-font) !important;
  line-height: 1.25 !important;
  letter-spacing: 0.01em;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-sm {
  --bs-btn-padding-x: 0.85rem;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    120px circle at var(--btn-glow-x) var(--btn-glow-y),
    rgba(255, 255, 255, 0.35),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 0.15s ease;
}

.btn.is-glowing::after {
  opacity: 1;
}

.btn > * {
  position: relative;
  z-index: 1;
}

.btn-dms,
.btn-primary {
  background: #0b2144 !important;
  border: 1px solid #0b2144 !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(11, 33, 68, 0.2);
}

.btn-dms:hover,
.btn-primary:hover,
.btn-dms:focus,
.btn-primary:focus {
  background: #12305c !important;
  border-color: #12305c !important;
  color: #fff !important;
  box-shadow: 0 12px 24px rgba(11, 33, 68, 0.28);
  transform: translateY(-1px);
}

.btn-outline-secondary,
.btn-secondary {
  background: #fff !important;
  border: 1px solid #c9d4e4 !important;
  color: #74839e !important;
  box-shadow: none;
}

.btn-outline-secondary:hover,
.btn-secondary:hover,
.btn-outline-secondary:focus,
.btn-secondary:focus {
  background: #f4f7fb !important;
  border-color: #0b2144 !important;
  color: #0b2144 !important;
  transform: translateY(-1px);
}

.btn-outline-primary {
  background: #fff !important;
  border: 1px solid #93c5fd !important;
  color: #1d4ed8 !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: #eff6ff !important;
  border-color: #2563eb !important;
  color: #1d4ed8 !important;
}

.btn-outline-danger {
  background: #fff !important;
  border: 1px solid #fecaca !important;
  color: #b91c1c !important;
}

.btn-outline-danger:hover {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}

/* Compact row actions menu */
.btn-row-actions {
  width: var(--dms-control-h) !important;
  min-width: var(--dms-control-h) !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}
.btn-row-actions::after {
  display: none !important;
}
.dropdown-menu .dropdown-item {
  font-size: 0.875rem;
  display: flex;
  align-items: center;
}
/* Keep row action menus above clipped table/card overflow.
   Dropdowns use Popper strategy:fixed, so overflow-x:auto is safe. */
.table-responsive .dropdown-menu,
.panel-card .dropdown-menu {
  z-index: 1080;
}

.btn-close {
  height: auto !important;
  min-height: 0 !important;
  padding: 0.25em !important;
  display: inline-block;
}

.modal-footer .btn-outline-secondary {
  margin-right: 0.35rem;
}

.page-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-toolbar .command-kicker {
  margin-bottom: 2px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-badge.tone-green { background: #dcfce7; color: #166534; }
.status-badge.tone-blue { background: #dbeafe; color: #1d4ed8; }
.status-badge.tone-gray { background: #e2e8f0; color: #475569; }
.status-badge.tone-gold { background: #fef3c7; color: #92400e; }

.dms-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2000;
  min-width: 220px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.2s ease;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.dms-toast.show { opacity: 1; transform: translateY(0); }
.dms-toast.ok { background: #15803d; }
.dms-toast.err { background: #b91c1c; }

.dms-version-banner {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2100;
  width: min(380px, calc(100vw - 32px));
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.dms-version-banner.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dms-version-banner-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon copy"
    "actions actions";
  gap: 10px 12px;
  padding: 14px 14px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--dms-navy-2), var(--dms-navy));
  border: 1px solid rgba(79, 179, 232, 0.22);
  box-shadow: 0 16px 40px rgba(7, 22, 47, 0.45);
  color: #e2e8f0;
}

.dms-version-icon {
  grid-area: icon;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 179, 232, 0.12);
  border: 1px solid rgba(79, 179, 232, 0.28);
  color: var(--dms-cyan-2);
  font-size: 1rem;
}

.dms-version-copy {
  grid-area: copy;
  min-width: 0;
  padding-top: 2px;
}

.dms-version-title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  color: #f8fafc;
}

.dms-version-sub {
  margin-top: 2px;
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.35;
}

.dms-version-actions {
  grid-area: actions;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.dms-version-later {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: #e2e8f0;
}

.dms-version-later:hover {
  background: rgba(79, 179, 232, 0.1);
  border-color: rgba(79, 179, 232, 0.4);
  color: #fff;
}

.dms-version-refresh {
  border: none;
  background: linear-gradient(90deg, #67e8f9, #38bdf8 45%, #60a5fa);
  color: #04111f;
  font-weight: 600;
}

.dms-version-refresh:hover {
  background: linear-gradient(90deg, #7dd3fc, #4fb3e8 45%, #60a5fa);
  color: #04111f;
}

body.dms-dialog-open {
  overflow: hidden;
}

.dms-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 2300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 10, 24, 0.72);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.dms-dialog-overlay[hidden] {
  display: none !important;
}

.dms-dialog-overlay.is-visible {
  opacity: 1;
}

.dms-dialog {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon body"
    "actions actions";
  gap: 12px 14px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--dms-navy-2), var(--dms-navy));
  border: 1px solid rgba(79, 179, 232, 0.22);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.18s ease;
}

.dms-dialog-overlay.is-visible .dms-dialog {
  transform: translateY(0) scale(1);
}

.dms-dialog-icon {
  grid-area: icon;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 179, 232, 0.12);
  border: 1px solid rgba(79, 179, 232, 0.28);
  color: var(--dms-cyan-2);
  font-size: 1.05rem;
}

.dms-dialog-overlay.is-danger .dms-dialog-icon {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

.dms-dialog-overlay.is-warning .dms-dialog-icon {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.4);
  color: #fbbf24;
}

.dms-dialog-body {
  grid-area: body;
  min-width: 0;
}

.dms-dialog-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.3;
}

.dms-dialog-message {
  margin-top: 4px;
  font-size: 0.86rem;
  color: #94a3b8;
  line-height: 1.45;
}

.dms-dialog-tip {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(79, 179, 232, 0.1);
  border: 1px solid rgba(79, 179, 232, 0.28);
  color: #cbd5e1;
  font-size: 0.8rem;
  line-height: 1.4;
}

.dms-dialog-overlay.is-warning .dms-dialog-tip {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.32);
}

.dms-dialog-overlay.is-danger .dms-dialog-tip {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.28);
}

.dms-dialog-prompt {
  margin-top: 10px;
}

.dms-dialog-input {
  background: rgba(15, 23, 42, 0.55) !important;
  border-color: rgba(148, 163, 184, 0.35) !important;
  color: #f8fafc !important;
}

.dms-dialog-input:focus {
  border-color: var(--dms-cyan) !important;
  box-shadow: 0 0 0 0.2rem rgba(79, 179, 232, 0.2);
}

.dms-dialog-actions {
  grid-area: actions;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.dms-dialog-btn.dms-dialog-cancel {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: #e2e8f0;
}

.dms-dialog-btn.dms-dialog-cancel:hover {
  background: rgba(79, 179, 232, 0.1);
  border-color: rgba(79, 179, 232, 0.4);
  color: #fff;
}

.dms-dialog-btn.dms-dialog-ok {
  border: none;
  background: linear-gradient(90deg, #67e8f9, #38bdf8 45%, #60a5fa);
  color: #04111f;
  font-weight: 600;
}

.dms-dialog-btn.dms-dialog-ok:hover {
  background: linear-gradient(90deg, #7dd3fc, #4fb3e8 45%, #60a5fa);
  color: #04111f;
}

.dms-dialog-btn.dms-dialog-ok.is-danger {
  background: linear-gradient(90deg, #f87171, #ef4444 55%, #dc2626);
  color: #fff;
}

.dms-dialog-btn.dms-dialog-ok.is-danger:hover {
  background: linear-gradient(90deg, #fca5a5, #f87171 55%, #ef4444);
  color: #fff;
}

.table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #74839e;
  border-bottom-width: 1px;
  background: #f4f7fb;
}

.panel-card .table {
  margin-bottom: 0;
}

/* Flex children default to min-width:auto and can blow past the viewport */
.panel-card {
  min-width: 0;
  max-width: 100%;
}

.panel-card .table-responsive {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

/* Default: scroll wide tables inside the card (not clipped by app-content) */
.panel-card .table-responsive > .table {
  width: max-content;
  min-width: 100%;
  max-width: none;
}

.panel-card .table-responsive > .table th,
.panel-card .table-responsive > .table td {
  white-space: nowrap;
  vertical-align: middle;
}

/* Tasks list: fit all columns on screen — wrap title / project / etc. */
.panel-card .table-responsive > #tasksTable {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
}

#tasksTable th,
#tasksTable td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

#tasksTable th:first-child,
#tasksTable td:first-child {
  width: 8.75rem;
  min-width: 8.75rem;
  white-space: nowrap;
  padding-right: 0.75rem;
}

/* Shared trailing columns (admin 9-col & developer 8-col) */
#tasksTable th:nth-last-child(1),
#tasksTable td:nth-last-child(1) {
  width: 2.75rem;
  white-space: nowrap;
  text-align: end;
}

#tasksTable th:nth-last-child(2),
#tasksTable td:nth-last-child(2),
#tasksTable th:nth-last-child(3),
#tasksTable td:nth-last-child(3) {
  width: 3.75rem;
  white-space: nowrap;
  text-align: end;
}

#tasksTable th:nth-last-child(4),
#tasksTable td:nth-last-child(4) {
  width: 5.5rem;
}

/* Priority */
#tasksTable th:nth-last-child(5),
#tasksTable td:nth-last-child(5) {
  width: 5.75rem;
  white-space: nowrap;
}

#tasksTable th:nth-last-child(6),
#tasksTable td:nth-last-child(6) {
  width: 7.5rem;
}

#tasksTable td strong {
  font-weight: 700;
}

/* Attendance: fit all columns on screen — wrap remarks / developer */
.panel-card .table-responsive > #attendanceTable {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
}

#attendanceTable th,
#attendanceTable td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

#attendanceTable .att-col-check {
  width: 2.25rem;
  white-space: nowrap;
}

#attendanceTable .att-col-date {
  width: 6.5rem;
  white-space: nowrap;
}

#attendanceTable .att-col-dev {
  width: 8.5rem;
}

#attendanceTable .att-col-status {
  width: 6.5rem;
}

#attendanceTable .att-col-time {
  width: 5rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#attendanceTable .att-col-num {
  width: 5.25rem;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

#attendanceTable th.att-col-num {
  white-space: normal;
  line-height: 1.2;
  vertical-align: bottom;
  overflow: hidden;
}

#attendanceTable th.att-col-num .att-col-unit {
  display: block;
  font-size: 0.68em;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.75;
  text-transform: uppercase;
}

#attendanceTable td.att-col-num {
  white-space: nowrap;
}

#attendanceTable .att-col-remarks {
  width: auto;
  min-width: 0;
}

#attendanceTable .att-col-actions {
  width: 2.75rem;
  white-space: nowrap;
  text-align: end;
}

/* Task progress: fit all columns on screen — wrap instead of clipping */
#taskProgressPanel .table-responsive > #taskProgressTable {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
}

#taskProgressTable th:nth-child(1),
#taskProgressTable td:nth-child(1) {
  width: 22%;
}

#taskProgressTable th:nth-child(2),
#taskProgressTable td:nth-child(2) {
  width: 14%;
}

#taskProgressTable th:nth-child(3),
#taskProgressTable td:nth-child(3),
#taskProgressTable th:nth-child(4),
#taskProgressTable td:nth-child(4),
#taskProgressTable th:nth-child(5),
#taskProgressTable td:nth-child(5) {
  width: 7%;
  white-space: nowrap;
  text-align: right;
}

#taskProgressTable th:nth-child(6),
#taskProgressTable td:nth-child(6) {
  width: 43%;
}

#taskProgressTable td:first-child,
#taskProgressTable td:nth-child(2),
#taskProgressTable td:last-child,
#progressTable td,
#reportsTable td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#taskProgressTable td:last-child {
  min-width: 0;
  max-width: none;
}

#taskProgressTable .progress {
  max-width: 100%;
}

#taskProgressTable .task-delay-reason {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  resize: vertical;
}

#progressTable .proj-id,
#progressTable .proj-desc,
#progressTable .proj-hours {
  min-width: 0;
  width: 100%;
  white-space: normal;
}

#progressTable .proj-hours {
  min-width: 5.5rem;
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .panel-card {
    padding: 14px 12px;
  }

  .panel-card .table-responsive {
    margin-left: 0;
    margin-right: 0;
    /* Bound width so wide tables scroll inside the card */
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .panel-card .table-responsive > .table {
    font-size: 0.875rem;
  }

  .panel-card .table-responsive > .table th,
  .panel-card .table-responsive > .table td {
    padding: 0.55rem 0.65rem;
  }

  /*
   * Shared mobile card-stack for list tables (Salary, Developers, etc.).
   * Use class "dms-mobile-cards" on .table-responsive and data-label on <td>.
   */
  .dms-mobile-cards {
    border: none !important;
    overflow: visible !important;
    background: transparent !important;
  }

  .dms-mobile-cards > .table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: auto !important;
  }

  .dms-mobile-cards > .table thead {
    display: none;
  }

  .dms-mobile-cards > .table tbody {
    display: block;
    width: 100%;
  }

  .dms-mobile-cards > .table tr {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
  }

  .dms-mobile-cards > .table td {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0.4rem 0 !important;
    white-space: normal !important;
    text-align: left !important;
    border: none !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .dms-mobile-cards > .table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #74839e;
    margin-bottom: 3px;
    font-weight: 700;
  }

  .dms-mobile-cards > .table td[colspan]::before,
  .dms-mobile-cards > .table td:not([data-label])::before,
  .dms-mobile-cards > .table td[data-label=""]::before {
    display: none !important;
  }

  .dms-mobile-cards > .table td[data-span="half"] {
    display: inline-block;
    width: 50% !important;
    vertical-align: top;
    box-sizing: border-box;
    padding-right: 8px !important;
  }

  .dms-mobile-cards > .table td[data-span="third"] {
    display: inline-block;
    width: 33.33% !important;
    vertical-align: top;
    box-sizing: border-box;
    padding-right: 8px !important;
  }

  .dms-mobile-cards > .table td[data-label="Actions"],
  .dms-mobile-cards > .table td[data-label="Action"] {
    text-align: right !important;
    padding-top: 0.65rem !important;
    margin-top: 0.25rem;
    border-top: 1px solid #eef2f7 !important;
  }

  /*
   * Tasks + Daily Progress tables on phones: stack each row as a card so
   * every field is fully visible (no clipped / letter-stacked columns).
   */
  .tasks-table-wrap,
  .attendance-table-wrap,
  .leaves-table-wrap,
  #taskProgressPanel .table-responsive,
  #progressTableHead + .table-responsive {
    border: none;
    overflow: visible;
    background: transparent;
  }

  .panel-card .table-responsive > #tasksTable,
  .panel-card .table-responsive > #attendanceTable,
  .panel-card .table-responsive > #leavesTable {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: auto !important;
  }

  #tasksTable thead {
    display: none;
  }

  #tasksTable tbody {
    display: block;
    width: 100%;
  }

  #tasksTable tr {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
  }

  #tasksTable td {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0.4rem 0 !important;
    white-space: normal !important;
    text-align: left !important;
    border: none !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #tasksTable td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #74839e;
    margin-bottom: 3px;
    font-weight: 700;
  }

  #tasksTable td[colspan]::before,
  #tasksTable td:not([data-label])::before {
    display: none !important;
  }

  #tasksTable td[data-label="Priority"],
  #tasksTable td[data-label="Status"],
  #tasksTable td[data-label="Est H"],
  #tasksTable td[data-label="Act H"] {
    display: inline-block;
    width: 50% !important;
    vertical-align: top;
    box-sizing: border-box;
    padding-right: 8px !important;
  }

  #tasksTable td[data-label="Actions"] {
    text-align: right !important;
    padding-top: 0.65rem !important;
    margin-top: 0.25rem;
    border-top: 1px solid #eef2f7 !important;
  }

  #tasksTable td[data-label="Title"] strong {
    font-size: 1rem;
  }

  #attendanceTable thead {
    display: none;
  }

  #attendanceTable tbody {
    display: block;
    width: 100%;
  }

  #attendanceTable tr {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
  }

  #attendanceTable td {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0.4rem 0 !important;
    white-space: normal !important;
    text-align: left !important;
    border: none !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #attendanceTable td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #74839e;
    margin-bottom: 3px;
    font-weight: 700;
  }

  #attendanceTable td[colspan]::before,
  #attendanceTable td:not([data-label])::before {
    display: none !important;
  }

  #attendanceTable td[data-label="Select"] {
    display: inline-block;
    width: auto !important;
    vertical-align: middle;
    padding-right: 10px !important;
  }

  #attendanceTable td[data-label="Select"]::before {
    display: none !important;
  }

  #attendanceTable td[data-label="Date"] {
    display: block;
    width: 100% !important;
    font-weight: 600;
  }

  #attendanceTable td[data-label="Select"] + td[data-label="Date"] {
    display: inline-block;
    width: calc(100% - 2.5rem) !important;
    vertical-align: middle;
  }

  #attendanceTable td[data-label="Check-in"],
  #attendanceTable td[data-label="Check-out"] {
    display: inline-block;
    width: 50% !important;
    vertical-align: top;
    box-sizing: border-box;
    padding-right: 8px !important;
  }

  #attendanceTable td[data-label="Session hrs"],
  #attendanceTable td[data-label="Progress hrs"],
  #attendanceTable td[data-label="Idle min"] {
    display: inline-block;
    width: 33.33% !important;
    vertical-align: top;
    box-sizing: border-box;
    padding-right: 8px !important;
  }

  #attendanceTable td[data-label="Actions"] {
    text-align: right !important;
    padding-top: 0.65rem !important;
    margin-top: 0.25rem;
    border-top: 1px solid #eef2f7 !important;
  }

  #leavesTable thead {
    display: none;
  }

  #leavesTable tbody {
    display: block;
    width: 100%;
  }

  #leavesTable tr {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
  }

  #leavesTable td {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0.4rem 0 !important;
    white-space: normal !important;
    text-align: left !important;
    border: none !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #leavesTable td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #74839e;
    margin-bottom: 3px;
    font-weight: 700;
  }

  #leavesTable td[colspan]::before,
  #leavesTable td:not([data-label])::before {
    display: none !important;
  }

  #leavesTable td[data-label="From"],
  #leavesTable td[data-label="To"],
  #leavesTable td[data-label="Days"],
  #leavesTable td[data-label="Paid"] {
    display: inline-block;
    width: 50% !important;
    vertical-align: top;
    box-sizing: border-box;
    padding-right: 8px !important;
  }

  #leavesTable td[data-label="Developer"] {
    font-weight: 600;
  }

  #leavesTable td[data-label="Actions"] {
    text-align: right !important;
    padding-top: 0.65rem !important;
    margin-top: 0.25rem;
    border-top: 1px solid #eef2f7 !important;
  }

  #leaveBalanceCards .progress-metric-card {
    padding: 10px 8px !important;
    min-height: 0;
  }

  #leaveBalanceCards .progress-metric-value {
    font-size: 1.15rem;
    line-height: 1.2;
  }

  #leaveBalanceCards .text-muted.small,
  #leaveBalanceCards .small.text-muted {
    font-size: 0.68rem;
    line-height: 1.25;
  }

  #taskProgressPanel .table-responsive > #taskProgressTable,
  #progressTableHead + .table-responsive > #progressTable {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: auto !important;
  }

  #taskProgressTable thead,
  #progressTable thead {
    display: none;
  }

  #taskProgressTable tbody,
  #progressTable tbody {
    display: block;
    width: 100%;
  }

  #taskProgressTable tr,
  #progressTable tr {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
  }

  #taskProgressTable td,
  #progressTable td {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0.4rem 0 !important;
    white-space: normal !important;
    text-align: left !important;
    border: none !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #taskProgressTable td::before,
  #progressTable td::before {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #74839e;
    margin-bottom: 3px;
    font-weight: 700;
  }

  #taskProgressTable td:nth-child(1)::before { content: "Task"; }
  #taskProgressTable td:nth-child(2)::before { content: "Project"; }
  #taskProgressTable td:nth-child(3)::before { content: "Est"; }
  #taskProgressTable td:nth-child(4)::before { content: "Actual"; }
  #taskProgressTable td:nth-child(5)::before { content: "Today"; }
  #taskProgressTable td:nth-child(6)::before { content: "Progress / delay"; }

  #progressTable td:nth-child(1)::before { content: "Project"; }
  #progressTable td:nth-child(2)::before { content: "Task / comment"; }
  #progressTable td:nth-child(3)::before { content: "Hours"; }
  #progressTable td:nth-child(4)::before { content: "Actions"; }

  /* Empty / placeholder rows (colspan) — no fake labels */
  #taskProgressTable td[colspan]::before,
  #progressTable td[colspan]::before {
    display: none !important;
  }

  /* Est / Actual / Today on one row */
  #taskProgressTable td:nth-child(3),
  #taskProgressTable td:nth-child(4),
  #taskProgressTable td:nth-child(5) {
    display: inline-block;
    width: 33.33% !important;
    vertical-align: top;
    box-sizing: border-box;
    padding-right: 8px !important;
  }

  #taskProgressTable .progress,
  #taskProgressTable .task-delay-reason,
  #progressTable .proj-id,
  #progressTable .proj-desc,
  #progressTable .proj-hours {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  #progressTable td:last-child .btn-remove-row {
    width: 100%;
  }

  .panel-card-head {
    flex-wrap: wrap;
    gap: 4px;
  }

  .page-toolbar {
    align-items: stretch;
  }

  .page-toolbar > .d-flex {
    width: 100%;
  }

  .page-toolbar .form-control,
  .page-toolbar .form-select {
    min-width: 0 !important;
    max-width: 100%;
    flex: 1 1 140px;
  }

  .page-toolbar .btn {
    flex: 0 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stat-card,
  .progress-metric-card,
  .panel-card,
  .btn,
  .auth-card {
    transform: none !important;
    transition: none !important;
  }
  .stat-card:hover,
  .progress-metric-card:hover,
  .stat-card.is-growing,
  .progress-metric-card.is-growing {
    transform: none !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  }
  .stat-card::before,
  .panel-card::before,
  .btn::after,
  .auth-card::before {
    display: none;
  }
}

/* Task review / feedback thread */
.task-review-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  line-height: 1.2;
}
.task-review-badge.tone-warning {
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
}
.task-review-badge.tone-danger {
  background: rgba(248, 113, 113, 0.16);
  color: #fca5a5;
}
.task-review-badge.tone-success {
  background: rgba(52, 211, 153, 0.16);
  color: #6ee7b7;
}
.task-review-badge.tone-muted {
  background: rgba(148, 163, 184, 0.14);
  color: #94a3b8;
}
.task-feedback-thread {
  max-height: 360px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.task-feedback-item {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.35);
}
.task-feedback-item.type-approved {
  border-color: rgba(52, 211, 153, 0.35);
}
.task-feedback-item.type-issue,
.task-feedback-item.type-improvement {
  border-color: rgba(248, 113, 113, 0.28);
}
.task-feedback-type {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--dms-cyan-2, #67e8f9);
}
.task-feedback-msg {
  margin-top: 6px;
  font-size: 0.9rem;
  color: #e2e8f0;
  line-height: 1.45;
  white-space: pre-wrap;
}
.task-feedback-shot {
  display: inline-block;
  margin-top: 8px;
}
.task-feedback-shot img {
  max-width: min(100%, 420px);
  max-height: 240px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.task-feedback-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.task-feedback-shots .task-feedback-shot {
  margin-top: 0;
}
.task-feedback-shots .task-feedback-shot img {
  max-width: 160px;
  max-height: 120px;
}
.task-feedback-paste {
  border: 1px dashed rgba(148, 163, 184, 0.4);
  border-radius: 10px;
  padding: 12px;
  min-height: 72px;
  background: rgba(15, 23, 42, 0.28);
  outline: none;
}
.task-feedback-paste:focus {
  border-color: rgba(79, 179, 232, 0.55);
  box-shadow: 0 0 0 0.15rem rgba(79, 179, 232, 0.15);
}
.task-feedback-paste-hint {
  color: #94a3b8;
  font-size: 0.86rem;
}
.task-feedback-file-label {
  color: var(--dms-cyan-2, #67e8f9);
  cursor: pointer;
  text-decoration: underline;
}
.task-feedback-preview img {
  display: block;
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  margin-bottom: 8px;
}
.task-feedback-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.task-feedback-preview-card {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 6px;
  background: rgba(15, 23, 42, 0.4);
}
.task-feedback-preview-card img {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 6px;
}
.task-feedback-preview-card .btn {
  width: 100%;
}

/* Notification bell (topbar) */
.notif-bell-wrap {
  position: relative;
  margin-right: 8px;
  flex: 0 0 auto;
  z-index: 50;
  overflow: visible;
}
.notif-bell-btn {
  position: relative;
  width: 34px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: visible;
}
.notif-bell-btn.has-unread {
  border-color: #f87171 !important;
  color: #dc2626 !important;
}
.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff !important;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
  z-index: 2;
  pointer-events: none;
}
.notif-item.is-action {
  border-left: 3px solid #f59e0b;
}
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 480px);
  display: none;
  flex-direction: column;
  background: linear-gradient(180deg, var(--dms-navy-2, #111827), var(--dms-navy, #0b1220));
  border: 1px solid rgba(79, 179, 232, 0.22);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  z-index: 1200;
  overflow: hidden;
}
.notif-panel.is-open {
  display: flex;
}
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  color: #f8fafc;
  font-size: 0.9rem;
}
.notif-mark-all {
  color: var(--dms-cyan-2, #67e8f9) !important;
  text-decoration: none !important;
  padding: 0;
  white-space: nowrap;
}
.notif-list {
  overflow: auto;
  flex: 1 1 auto;
}
.notif-empty {
  padding: 24px 14px;
  text-align: center;
  font-size: 0.86rem;
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  text-decoration: none !important;
  color: inherit;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  transition: background 0.15s ease;
}
.notif-item:hover {
  background: rgba(79, 179, 232, 0.08);
}
.notif-item.is-unread {
  background: rgba(79, 179, 232, 0.06);
}
.notif-item.is-unread .notif-item-title {
  color: #f8fafc;
}
.notif-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 179, 232, 0.12);
  color: var(--dms-cyan-2, #67e8f9);
  flex: 0 0 auto;
  margin-top: 2px;
}
.notif-item-body {
  min-width: 0;
  flex: 1 1 auto;
}
.notif-item-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.3;
}
.notif-item-msg {
  margin-top: 2px;
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-item-time {
  margin-top: 4px;
  font-size: 0.7rem;
  color: #64748b;
}
