/* ============================================
   MILESTONES STATUS — Premium UI with Light/Dark Mode
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- Dark Mode Tokens ---- */
[data-theme="dark"] {
  --bg-primary: #0b0e14;
  --bg-secondary: #0f1219;
  --bg-card: #151822;
  --bg-card-hover: #1c202d;
  --bg-table-row: #12151e;
  --bg-table-row-alt: #181b26;
  --bg-table-header: #0d1017;
  --bg-input: #12151e;
  --bg-glass: rgba(11, 14, 20, 0.75);
  --border-primary: rgba(255, 255, 255, 0.05);
  --border-active: rgba(99, 102, 241, 0.6);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-heading: #ffffff;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.6);
}

/* ---- Light Mode Tokens ---- */
[data-theme="light"] {
  --bg-primary: #f6f8fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f3f6;
  --bg-table-row: #ffffff;
  --bg-table-row-alt: #f8f9fa;
  --bg-table-header: #f0f2f5;
  --bg-input: #f3f5f8;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --border-primary: rgba(0, 0, 0, 0.06);
  --border-active: rgba(99, 102, 241, 0.5);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-heading: #0f172a;
  --accent: #6366f1;
  --accent-light: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.08);
}

/* ---- Shared Tokens ---- */
:root {
  --status-completed: #22c55e;
  --status-completed-bg: rgba(34, 197, 94, 0.12);
  --status-in-progress: #f59e0b;
  --status-in-progress-bg: rgba(245, 158, 11, 0.12);
  --status-not-started: #ef4444;
  --status-not-started-bg: rgba(239, 68, 68, 0.12);
  --status-on-hold: #3b82f6;
  --status-on-hold-bg: rgba(59, 130, 246, 0.12);
  --status-closed: #8b5cf6;
  --status-closed-bg: rgba(139, 92, 246, 0.12);
  --gradient-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-2: linear-gradient(135deg, #22c55e 0%, #06b6d4 100%);
  --gradient-3: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --gradient-4: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


/* ---- Text Selection ---- */
::selection { background: rgba(99, 102, 241, 0.35); color: inherit; }
::-moz-selection { background: rgba(99, 102, 241, 0.35); color: inherit; }
input::selection, textarea::selection, [contenteditable]::selection {
  background: rgba(99, 102, 241, 0.45);
  color: var(--text-primary);
}
input::-moz-selection, textarea::-moz-selection, [contenteditable]::-moz-selection {
  background: rgba(99, 102, 241, 0.45);
  color: var(--text-primary);
}

body {

  font-family: 'Calibri', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.12), transparent), radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.08), transparent);
  pointer-events: none;
  z-index: 0;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 1;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 20px 20px;
}

/* ---- Header (hides on scroll) ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 20px;
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: 16px;
  transition: opacity 0.3s, max-height 0.3s, margin 0.3s, padding 0.3s;
  overflow: hidden;
  max-height: 120px;
}

.header-hidden {
  opacity: 0;
  max-height: 0;
  margin-bottom: 0;
  padding: 0;
  pointer-events: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.header-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.3px;
}

.header-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Sticky Zone (KPI + filters + tabs) ---- */
.sticky-zone {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: 12px;
}

/* ---- KPI Cards ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-1);
  opacity: 0.5;
  transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--accent-glow);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 0;
}

.kpi-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.kpi-header-row .kpi-label {
  flex-shrink: 0;
}

.kpi-header-row .kpi-value {
  margin-left: 8px;
  white-space: nowrap;
}

/* High Risk centered card */
.kpi-card-highlight {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}

.kpi-card-highlight .kpi-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.kpi-card-highlight .kpi-label {
  font-size: 13px;
  margin-bottom: 4px;
}

.kpi-card-highlight .kpi-value {
  font-size: 28px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.5px;
}

.kpi-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

.kpi-change.positive {
  color: var(--status-completed);
}

.kpi-change.negative {
  color: var(--status-not-started);
}

/* ---- Filter Bar ---- */
.filter-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 14px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
  width: 100%;
  max-width: 100%;
}

.sticky-zone.filters-compact {
  margin-bottom: 6px;
  padding-bottom: 2px;
}

.sticky-zone.filters-compact .kpi-grid,
.sticky-zone.filters-compact .active-filters {
  display: none;
}

.sticky-zone.filters-compact .filter-bar {
  gap: 8px;
  margin-bottom: 4px;
  padding: 8px 10px;
  border-radius: 8px;
}

.sticky-zone.filters-compact .filter-label {
  display: none;
}

.sticky-zone.filters-compact .filter-group {
  min-width: 104px;
}

.sticky-zone.filters-compact .filter-select,
.sticky-zone.filters-compact .filter-input {
  min-height: 32px;
  padding: 6px 9px;
}

#btnToggleMilestoneFilters {
  min-width: 92px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 120px;
}

.filter-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.filter-select,
.filter-input {
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease-in-out;
}

.filter-select:focus,
.filter-input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.filter-divider {
  width: 1px;
  height: 32px;
  background: var(--border-primary);
  align-self: center;
}

.filter-actions {
  display: flex;
  align-items: flex-end;
}

.filter-date {
  max-width: 140px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 9999px;
  /* Pill shape for premium feel */
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s, box-shadow 0.2s, border 0.2s;
  border: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--gradient-1);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 9999px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 9999px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}

.btn-danger:active {
  transform: scale(0.96);
}

.btn-danger:hover {
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.btn-sm {
  font-size: 11px;
  padding: 4px 10px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
  font-size: 14px;
  line-height: 1;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.btn-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.tab {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.06);
}

.tab.active {
  color: var(--accent-light);
  background: var(--accent-glow);
  font-weight: 600;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 0 6px;
  margin-left: 4px;
}

.tab-content {
  display: none;
  flex: 1;
  min-height: 0;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Make non-milestone tabs scroll internally if content overflows */
#tab-dashboard,
#tab-projects,
#tab-aging,
#tab-sla,
#tab-report,
#page-pipeline {
  overflow-y: auto;
}

.table-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

/* ---- Date Header Filter (th) ---- */
.date-header-filter {
  cursor: pointer !important;
  transition: var(--transition);
}

.date-header-filter:hover {
  color: var(--accent-light) !important;
  background: var(--bg-card-hover) !important;
}

.date-header-active {
  color: var(--accent-light) !important;
  border-bottom-color: var(--accent) !important;
  background: var(--accent-glow) !important;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 2000px;
}

.data-table thead {
  z-index: 50;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background-color: var(--bg-table-header) !important;
  z-index: 50;
  box-shadow: inset 0 -2px 0 0 var(--border-primary);
  border-bottom: none;
}

.data-table tfoot th,
.data-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 80;
  background-color: var(--bg-table-header) !important;
  box-shadow: inset 0 2px 0 0 var(--border-primary), 0 28px 0 0 var(--bg-table-header);
  border-top: none;
  border-bottom: none;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-primary);
}

.data-table tfoot tr {
  position: relative;
  z-index: 80;
  background-color: var(--bg-table-header) !important;
}

.data-table th {
  background: var(--bg-table-header);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-primary);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: color 0.15s, background 0.15s;
}

.data-table th:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.data-table th.sorted {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

.data-table th[draggable="true"] {
  cursor: grab;
}

.data-table th[draggable="true"]:active {
  cursor: grabbing;
}

.sort-icon {
  font-size: 9px;
  opacity: 0.4;
  margin-left: 2px;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-primary);
  white-space: nowrap;
  vertical-align: middle;
  transition: background-color 0.15s;
  /* Solid base so hover/edit overlays never show page body behind */
  background-color: var(--bg-card);
}

.data-table tbody tr {
  transition: none;
}

.data-table td.editable:hover {
  background-color: var(--bg-card-hover) !important;
  box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.4);
  cursor: pointer;
}

/* ---- Project Row Grouping ---- */
.project-first-row {
  border-top: 3px solid var(--accent) !important;
}

.project-first-row td {
  padding-top: 12px;
}

/* ---- Merged Cells ---- */
.merged-cell {
  vertical-align: middle;
  font-weight: 700;
  border-right: 1px solid var(--border-primary);
  border-left: 1px solid var(--border-primary);
}

[data-sticky="true"] {
  position: sticky;
  z-index: 10 !important;
  /* Ensure it's opaque */
  background-clip: padding-box;
  /* Force opaque background on hover/focus/edit to prevent bleed-through */
  background-color: var(--bg-card);
}

th[data-sticky="true"] {
  z-index: 60 !important;
  background-color: var(--bg-table-header) !important;
  background-image: none !important;
}

/* Fix for sticky column transparency on row hover/select */
.data-table tr:hover [data-sticky="true"],
.data-table tr.selected [data-sticky="true"],
[data-sticky="true"].editing,
[data-sticky="true"]:focus-within {
  background-color: var(--bg-card-hover) !important;
  opacity: 1 !important;
}

[data-theme="dark"] .data-table tr:hover [data-sticky="true"] {
  background-color: var(--bg-card-hover) !important;
}

/* ---- Milestone Divider ---- */
.milestone-divider td {
  border-top: 1px dashed var(--border-primary) !important;
}

.btn-add-ms {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  margin-right: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-ms:hover {
  background: var(--accent-light);
  transform: scale(1.1);
}



.diff-warn {
  color: #f59e0b;
  font-weight: 600;
  font-style: italic;
}

/* ---- Cell Types ---- */
.text-center {
  text-align: center !important;
}

.text-right {
  text-align: right !important;
}

.truncate {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.financial {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.text-success {
  color: var(--status-completed);
}

.location-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.completed {
  background: var(--status-completed-bg);
  color: var(--status-completed);
}

.status-badge.in-progress {
  background: var(--status-in-progress-bg);
  color: var(--status-in-progress);
}

.status-badge.not-started {
  background: var(--status-not-started-bg);
  color: var(--status-not-started);
}

.status-badge.on-hold {
  background: var(--status-on-hold-bg);
  color: var(--status-on-hold);
}

.status-badge.closed {
  background: var(--status-closed-bg);
  color: var(--status-closed);
}

.status-badge.active {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.cancelled {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.risk-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.risk-low {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

.risk-medium {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.risk-high {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.risk-critical {
  background: rgba(220, 38, 38, 0.2);
  color: #dc2626;
  font-weight: 700;
}

.yes-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--status-completed-bg);
  color: var(--status-completed);
}

.no-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--status-not-started-bg);
  color: var(--status-not-started);
}

.partial-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--status-in-progress-bg);
  color: var(--status-in-progress);
}

.progress-bar-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  min-width: 50px;
}

[data-theme="light"] .progress-bar {
  background: rgba(0, 0, 0, 0.06);
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s;
}

.progress-bar-fill.high {
  background: var(--gradient-2);
}

.progress-bar-fill.medium {
  background: linear-gradient(135deg, #f59e0b, #eab308);
}

.progress-bar-fill.low {
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.progress-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 32px;
}

.notes-cell {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* ---- Folder Button (before milestone) ---- */
.folder-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(99, 102, 241, 0.10);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  margin-right: 5px;
  vertical-align: middle;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.folder-btn:hover {
  background: rgba(99, 102, 241, 0.25);
  transform: scale(1.15);
}

[data-theme="light"] .folder-btn {
  background: rgba(99, 102, 241, 0.08);
}

[data-theme="light"] .folder-btn:hover {
  background: rgba(99, 102, 241, 0.18);
}

/* ---- Tooltip ---- */
.tooltip {
  position: relative;
}

.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: pre-wrap;
  max-width: 300px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-primary);
  pointer-events: none;
}

/* ---- Table Footer ---- */
.table-footer {
  display: none !important;
}

.table-footer-info {
  display: flex;
  align-items: center;
}

.pagination {
  display: flex;
  gap: 4px;
}

.page-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border-primary);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-light);
}

.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-size-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 16px;
}

.page-size-selector label {
  font-size: 12px;
  color: var(--text-secondary);
}

.page-size-selector select {
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

/* ---- Inline Editing ---- */
.editable {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.editable:hover {
  background: var(--bg-card-hover) !important;
}

/* Non-frozen (non-sticky) editable cells keep solid bg when editing */
.data-table td.editable.editing {
  background: var(--bg-input) !important;
}

.editing {
  padding: 2px !important;
  background: var(--bg-input) !important;
}

.inline-input,
.inline-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
  transition: all 0.2s;
}

.inline-input:focus,
.inline-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* ---- Actions Column ---- */
.th-actions {
  width: 60px;
  text-align: center;
}

.td-actions {
  text-align: center;
  white-space: nowrap;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 50px 20px;
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state-sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- Dashboard ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  grid-auto-rows: min-content;
}

.dashboard-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dashboard-full {
  grid-column: 1 / -1;
}

.col-span-3 {
  grid-column: span 3;
}

.col-span-2 {
  grid-column: span 2;
}

.col-span-1 {
  grid-column: span 1;
}

.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  height: 100%;
  box-shadow: var(--shadow-sm);
}

.dashboard-card:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--accent-glow);
  transform: translateY(-4px);
}

.dashboard-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 12px;
  text-align: center;
}

.status-summary-item {
  padding: 10px;
  background: var(--bg-table-row);
  border-radius: var(--radius-md);
}

.status-summary-count {
  font-size: 28px;
  font-weight: 800;
}

.status-summary-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Invoiced GP Summary Panel ---- */
.invoiced-gp-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.invoiced-gp-kpi-card {
  background: var(--bg-table-row);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: var(--transition);
}

.invoiced-gp-kpi-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.invoiced-gp-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.invoiced-gp-kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.2;
}

.invoiced-gp-kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.invoiced-gp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.invoiced-gp-table thead th {
  background: var(--bg-table-header);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-primary);
}

.invoiced-gp-table thead th.text-right,
.invoiced-gp-table tbody td.text-right {
  text-align: right;
}

.invoiced-gp-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}

[data-theme="light"] .invoiced-gp-table tbody tr {
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.invoiced-gp-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.invoiced-gp-table tbody td {
  padding: 9px 12px;
  color: var(--text-primary);
}

.invoiced-gp-table tfoot tr {
  border-top: 2px solid var(--border-primary);
  background: var(--bg-table-header);
}

.invoiced-gp-table tfoot td {
  padding: 9px 12px;
  font-weight: 700;
  color: var(--text-heading);
  font-size: 13px;
}

.invoiced-gp-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.invoiced-gp-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(99,102,241,0.10);
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}

.invoiced-gp-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s;
}

.location-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.location-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 80px;
}

.location-bar-track {
  flex: 1;
  height: 26px;
  background: rgba(99, 102, 241, 0.06);
  border-radius: 6px;
  overflow: hidden;
}

.location-bar-fill {
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  min-width: 30px;
  transition: width 0.5s;
}

.location-bar-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 24px;
}

.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-primary);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-text {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Projects Status Tab ---- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  overflow: hidden;
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.project-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
  flex: 1;
  margin-right: 10px;
}

.project-card-client {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.project-location-select,
.project-location-chip {
  min-width: 92px;
  max-width: 140px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border-primary);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
}

.project-location-select {
  cursor: pointer;
}

.project-location-select:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}

.project-location-chip {
  display: inline-flex;
  align-items: center;
  background: color-mix(in srgb, var(--project-location-color, #888) 18%, var(--bg-secondary));
  border-color: color-mix(in srgb, var(--project-location-color, #888) 45%, var(--border-primary));
}

.project-card-dept {
  min-width: 0;
}

.project-progress {
  margin-bottom: 14px;
}

.project-progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.project-progress-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.project-progress-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-heading);
}

.project-progress-bar {
  height: 6px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.project-progress-fill {
  transition: width 0.5s;
}

.project-card-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---- Modals ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: flex-start;
  padding: 30px;
  overflow-y: auto;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  margin: auto;
}

@keyframes modalIn {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-primary);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-heading);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-form {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

/* ---- Global Loader ---- */
.global-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s;
}

.global-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-primary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loader-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* ---- Full Page Modal ---- */
.modal-fullpage {
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-lg {
  max-width: 1000px;
}

.modal-sm {
  max-width: 420px;
}

.modal-section-title {
  grid-column: 1 / -1;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-light);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---- Milestone Row Form (inside Add Project) ---- */
.milestone-rows {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.milestone-row-form {
  background: var(--bg-table-row);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 12px;
}

.ms-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 10px;
}

.ms-row-fields {
  display: grid;
  grid-template-columns: 2fr 80px 120px 1fr 100px 100px 100px 1fr;
  gap: 8px;
}

.ms-row-fields .form-group {
  margin-bottom: 0;
}

.ms-row-fields .form-group label {
  font-size: 10px;
  margin-bottom: 2px;
}

.ms-row-fields .form-group input,
.ms-row-fields .form-group select {
  padding: 6px 8px;
  font-size: 12px;
}

/* ---- Import Modal ---- */
.import-info {
  grid-column: 1 / -1;
  margin-bottom: 8px;
}

.import-info p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.import-warning {
  color: #f59e0b !important;
  font-weight: 500;
}

.import-success {
  color: #22c55e !important;
  font-weight: 500;
}

.import-preview {
  grid-column: 1 / -1;
  padding: 8px 0;
  font-size: 13px;
}

.file-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 10px;
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
}

.file-input::-webkit-file-upload-button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 10px;
  font-family: inherit;
  font-size: 12px;
}

/* ---- Settings Modal ---- */
.settings-hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.column-toggles {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.toggle-label:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.toggle-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* ---- SLA ---- */
.sla-met {
  color: var(--status-completed);
  font-weight: 600;
}

.sla-at-risk {
  color: var(--status-in-progress);
  font-weight: 600;
}

.sla-breached {
  color: var(--status-not-started);
  font-weight: 600;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-primary);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ---- Resize Handle ---- */
.resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  background: transparent;
  z-index: 20;
}

.resize-handle:hover,
.resize-handle:active {
  background: var(--accent);
}

/* ---- Cell Empty Highlight ---- */
.cell-empty {
  background: rgba(239, 68, 68, 0.06) !important;
  border-left: 2px solid rgba(239, 68, 68, 0.25);
}

/* ---- Column Filter Popup — Complete UI ---- */
.col-filter-popup,
#dateTreePopup,
#multiFilterPopup,
#colFilterPopup,
#agingColPopup {
  position: fixed;
  background: var(--bg-card, #1e2130);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-primary, #2d3148);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  z-index: 9990;
  width: 280px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: popupIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.col-filter-popup.active,
#dateTreePopup.active,
#multiFilterPopup.active,
#colFilterPopup.active,
#agingColPopup.active {
  display: flex !important;
}

@keyframes popupIn {
  0% { opacity: 0; transform: translateY(-8px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Popup: Title bar */
#colFilterTitle,
#multiFilterTitle,
#dateTreeTitle {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border-primary, #2d3148);
  background: rgba(255,255,255,0.02);
}

/* Search field inside popup */
#colFilterPopup .search-container,
#multiFilterPopup .search-container {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-primary, #2d3148);
}

#colFilterSearchInput,
#multiFilterSearch {
  width: 100%;
  background: var(--bg-secondary, #161829);
  border: 1px solid var(--border-primary, #2d3148);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text-primary, #e2e8f0);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

#colFilterSearchInput:focus,
#multiFilterSearch:focus {
  border-color: var(--accent, #6366f1);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}

/* Scrollable checkbox list — max 6 rows */
#colFilterValues,
#multiFilterValues {
  overflow-y: auto;
  max-height: 168px;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: #6366f1 rgba(99,102,241,0.12);
}

#colFilterValues::-webkit-scrollbar,
#multiFilterValues::-webkit-scrollbar {
  width: 6px;
}

#colFilterValues::-webkit-scrollbar-track,
#multiFilterValues::-webkit-scrollbar-track {
  background: rgba(99, 102, 241, 0.1);
  border-radius: 3px;
}

#colFilterValues::-webkit-scrollbar-thumb,
#multiFilterValues::-webkit-scrollbar-thumb {
  background: #6366f1;
  border-radius: 3px;
}

#colFilterValues::-webkit-scrollbar-thumb:hover,
#multiFilterValues::-webkit-scrollbar-thumb:hover {
  background: #818cf8;
}

/* Individual checkbox row */
.col-filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-primary, #e2e8f0);
  cursor: pointer;
  transition: background 0.12s;
  user-select: none;
  line-height: 1.3;
}

.col-filter-item:hover {
  background: rgba(99,102,241,0.08);
  color: var(--accent-light, #a5b4fc);
}

.col-filter-item input[type="checkbox"] {
  accent-color: var(--accent, #6366f1);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Action buttons row */
.popup-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-primary, #2d3148);
  background: rgba(255,255,255,0.02);
  flex-wrap: wrap;
}

.col-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-primary);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-heading);
}

.col-filter-sort {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
}

.col-filter-search {
  padding: 0 14px 8px;
}

.col-filter-search input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 12px;
}

.col-filter-values {
  overflow-y: auto;
  max-height: 168px;
  padding: 0 14px;
}

.col-filter-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-primary);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 11px;
}

/* ---- Active Filters ---- */
.active-filters {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 11px;
  color: var(--accent-light);
  font-weight: 500;
}

.af-remove {
  cursor: pointer;
  font-size: 13px;
  margin-left: 2px;
  opacity: 0.7;
}

.af-remove:hover {
  opacity: 1;
}

/* ---- KPI Dropdown & Sub ---- */
.kpi-dropdown {
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  text-align: center;
}

.kpi-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 5px;
  line-height: 1.6;
  font-weight: 500;
}

/* ---- 4-col Milestone Form ---- */
.ms-row-fields-4 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

/* ---- Date Tree Filter ---- */
.date-tree-btn {
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.date-tree-popup {
  width: 240px;
}

.date-tree-content {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px 14px;
}

.dt-node {
  padding: 2px 0;
}

.dt-toggle {
  cursor: pointer;
  font-size: 10px;
  color: var(--text-muted);
  user-select: none;
  width: 14px;
  display: inline-block;
  text-align: center;
}

.dt-toggle:hover {
  color: var(--accent-light);
}

.dt-label {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: 4px;
}

.dt-label:hover {
  background: var(--accent-glow);
  color: var(--accent-light);
}

.dt-active {
  background: var(--accent) !important;
  color: #fff !important;
  font-weight: 600;
}

.dt-children {
  margin-left: 18px;
}

.dt-leaf {
  margin-left: 18px;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .ms-row-fields-4 {
    grid-template-columns: 1fr 1fr;
  }

  .header-right {
    flex-wrap: wrap;
    gap: 6px;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .modal-fullpage {
    max-width: 100vw;
  }
}

/* ---- Scroll to Top Button ---- */
.scroll-top-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-1);
  color: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-btn:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

/* ---- Fixed Scroll Proxy ---- */
.scroll-proxy {
  position: fixed;
  bottom: 0;
  overflow-x: scroll;
  overflow-y: hidden;
  height: 14px;
  z-index: 999;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}

.table-wrapper::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 5px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--accent-light);
}

/* ---- Weekly Report ---- */
.report-container {
  padding: 0;
}

.report-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.report-content {
  background: #fff;
  color: #222;
  padding: 40px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
  font-family: 'Inter', sans-serif;
}

.report-content h1 {
  text-align: center;
  font-size: 28px;
  margin: 0 0 24px;
  color: #111;
}

.report-content h2 {
  font-size: 14px;
  color: #d32f2f;
  font-weight: 800;
  margin: 24px 0 8px;
  text-transform: uppercase;
}

.report-content .rpt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 16px;
}

.report-content .rpt-table th {
  background: #d32f2f;
  color: #fff;
  padding: 8px 10px;
  text-align: center;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  border: 1px solid #b71c1c;
}

.report-content .rpt-table td {
  padding: 6px 10px;
  text-align: center;
  border: 1px solid #ddd;
  font-size: 12px;
}

.report-content .rpt-table td.text-right {
  text-align: right;
}

.report-content .rpt-table .rpt-positive {
  background: #c8e6c9;
  font-weight: 700;
}

.report-content .rpt-table .rpt-negative {
  background: #ffcdd2;
}

.report-content .rpt-table .rpt-sla {
  background: #ffcdd2;
  color: #d32f2f;
  font-weight: 700;
}

.report-content .rpt-notes {
  margin: 8px 0;
  padding: 8px 16px;
  font-size: 12px;
  color: #333;
}

.report-content .rpt-notes li {
  margin-bottom: 4px;
}

.report-content [contenteditable]:focus {
  outline: 2px solid #6366f1;
  border-radius: 2px;
}

/* ---- Profit Chart ---- */
.profit-chart-container {
  overflow-x: auto;
  padding: 16px 0;
}

.profit-chart-area {
  position: relative;
  height: 280px;
  padding-left: 64px;
}

.profit-grid {
  position: absolute;
  top: 0;
  left: 64px;
  right: 0;
  bottom: 28px;
  pointer-events: none;
}

.profit-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.profit-grid-val {
  position: absolute;
  left: -64px;
  top: -8px;
  font-size: 11px;
  color: var(--text-secondary);
  width: 60px;
  text-align: right;
  font-weight: 500;
}

.profit-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: calc(100% - 28px);
  padding: 0 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.profit-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 28px;
  height: 100%;
  justify-content: flex-end;
}

.profit-bar {
  width: 100%;
  max-width: 40px;
  background: linear-gradient(180deg, #818cf8 0%, #6366f1 100%);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
  position: relative;
  min-height: 4px;
}

.profit-bar:hover {
  opacity: 0.85;
}

/* ---- PDF Export Overlay (Visible) ---- */
.report-overlay-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: #ffffff;
  color: #000000;
  overflow-y: auto;
  /* Use flexbox to center content horizontally */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px;
  box-sizing: border-box;
  /* Ensure variables are set for light mode within this overlay */
  --bg-primary: #ffffff;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-table-row: #ffffff;
  --text-primary: #000000;
  --text-secondary: #333333;
  --text-muted: #666666;
  --text-heading: #000000;
  --border-primary: rgba(0, 0, 0, 0.1);
}

.report-overlay-container .report-content {
  border: none !important;
  box-shadow: none !important;
  /* Padding handled by JS wrapper now */
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
  background: #ffffff !important;
  box-sizing: border-box !important;
}

/* Ensure table headers in export are correct */
.report-overlay-container th {
  background-color: #d32f2f !important;
  color: #ffffff !important;
  border: 1px solid #b71c1c !important;
}

/* Hide non-print elements in export */
.report-overlay-container .no-print,
.report-overlay-container .toast-container,
.report-overlay-container #btnReportPDF,
.report-overlay-container #btnReportWord,
.report-overlay-container .resize-handle {
  display: none !important;
}

/* Loading Overlay Text */
.report-loading-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 20px 40px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  z-index: 10000;
  pointer-events: none;
}

.profit-bar-val {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.profit-bar-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 6px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  max-height: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- ISS Logo Image ---- */
.logo-img {
  background: transparent !important;
  box-shadow: none !important;
  padding: 2px;
}

.logo-img svg {
  width: 100%;
  height: 100%;
}

.environment-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.65);
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.08), 0 8px 20px rgba(245, 158, 11, 0.12);
}

.environment-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

html[data-theme="light"] .environment-badge {
  background: #fef3c7;
  color: #92400e;
  border-color: #f59e0b;
}

/* ---- Dashboard vibration fix ---- */
.dashboard-card {
  will-change: transform;
}

.status-summary-grid,
.location-bar,
.activity-list {
  will-change: auto;
}

/* ---- Print Styles ---- */
@media print {

  .sticky-zone,
  .header,
  .tabs,
  .report-actions,
  .scroll-top-btn,
  .scroll-proxy {
    display: none !important;
  }

  .report-content {
    border: none;
    padding: 0;
    box-shadow: none;
  }

  body {
    background: #fff !important;
    overflow: visible !important;
  }
}

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-left: 4px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  font-family: 'Calibri', 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  border-left-color: var(--status-completed);
}

.toast.error {
  border-left-color: var(--status-not-started);
}

.toast.info {
  border-left-color: var(--accent);
}

.toast-icon {
  font-size: 18px;
}

/* ---- Skeleton Loading ---- */
.skeleton {
  background: var(--bg-secondary);
  background-image: linear-gradient(90deg, var(--bg-secondary) 0px, var(--bg-card-hover) 40px, var(--bg-secondary) 80px);
  background-size: 600px;
  animation: shimmer 1.6s infinite linear;
  border-radius: 4px;
  color: transparent !important;
  user-select: none;
}

@keyframes shimmer {
  0% {
    background-position: -100px;
  }

  40%,
  100% {
    background-position: 300px;
  }
}

/* ---- Tooltips ---- */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 6px 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 100;
  width: max-content;
  max-width: 250px;
  white-space: normal;
  text-align: center;
}

[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

/* ---- Drag & Drop ---- */
.data-table tr[draggable="true"] {
  cursor: grab;
}

.data-table tr[draggable="true"]:active {
  cursor: grabbing;
}

.data-table tr.dragging {
  opacity: 0.5;
  background: var(--bg-card-hover) !important;
  box-shadow: var(--shadow-md);
}


/* ---- Project Drag & Drop ---- */
.project-card[draggable="true"] {
  cursor: grab;
  transition: transform 0.2s, box-shadow 0.2s;
}

.project-card[draggable="true"]:active {
  cursor: grabbing;
}


.project-card.dragging {
  opacity: 1;
  /* Keep fully opaque to show the border clearly */
  background: rgba(255, 255, 255, 0.05) !important;
  border: 2px dashed #666 !important;
  /* Clearly dashed/dotted */
  box-shadow: none !important;
  color: transparent !important;
  /* Hide text */
  transform: scale(0.98);
  /* Slightly smaller */
  z-index: 0;
}

.project-card.dragging>* {
  visibility: hidden;
  /* Hide internal content */
}

/* ---- Weekly Report Styling ---- */
.rpt-table-header-red th {
  background: #ef4444;
  /* Red header */
  color: white;
  padding: 10px;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid #dc2626;
}

.rpt-cell-pos {
  background: #86efac !important;
  /* Green for positive */
  color: #14532d;
  font-weight: 700;
}

.rpt-cell-neg {
  background: #fca5a5 !important;
  /* Red/Pink for negative */
  color: #7f1d1d;
  font-weight: 700;
}

/* ---- Settings UI ---- */
.settings-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.settings-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  margin-bottom: 20px;
}

.settings-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-primary);
  font-size: 13px;
}

.settings-list-item:last-child {
  border-bottom: none;
}

.settings-list-item:hover {
  background: var(--bg-card-hover);
}

.settings-list .btn-delete {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border: 1px solid rgba(239, 68, 68, .24);
  border-radius: 7px;
  background: rgba(239, 68, 68, .08);
  color: transparent;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
}

.settings-list .btn-delete::before,
.settings-list .btn-delete::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: #f87171;
}

.settings-list .btn-delete::before {
  transform: rotate(45deg);
}

.settings-list .btn-delete::after {
  transform: rotate(-45deg);
}

.settings-list .btn-delete:hover {
  border-color: rgba(248, 113, 113, .52);
  background: rgba(239, 68, 68, .16);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .08);
}

.settings-list .btn-delete:focus-visible {
  outline: 2px solid rgba(248, 113, 113, .75);
  outline-offset: 2px;
}

#settingsCountryList {
  grid-template-columns: 1fr;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
}

.country-settings-item {
  gap: 14px;
}

.country-settings-name,
.country-settings-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.country-settings-name {
  font-weight: 700;
}

.country-color-preview,
.country-color-swatch,
.country-color-auto-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .34);
  background: var(--country-color, var(--swatch, var(--accent)));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
  flex: 0 0 auto;
}

.country-color-select {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 116px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border-primary);
  border-radius: 7px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
}

.country-color-select:hover {
  border-color: var(--country-color);
  background: color-mix(in srgb, var(--country-color) 12%, var(--bg-secondary));
}

.country-color-swatch {
  background: var(--country-color);
}

.country-color-caret {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 10px;
}

.country-color-menu {
  position: fixed;
  z-index: 5000;
  width: 286px;
  padding: 10px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-secondary);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .46);
  color: var(--text-primary);
}

.country-color-menu-head,
.country-color-auto,
.country-color-more {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.country-color-menu-head {
  justify-content: space-between;
  padding: 2px 2px 9px;
  font-size: 12px;
  font-weight: 800;
  border-bottom: 1px solid var(--border-primary);
}

.country-color-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 10px;
}

.country-color-current::before {
  content: '';
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background: var(--swatch);
  border: 1px solid rgba(255, 255, 255, .3);
}

.country-color-auto,
.country-color-more {
  border: 0;
  border-bottom: 1px solid var(--border-primary);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  padding: 9px 2px;
  font: inherit;
  font-size: 12px;
  text-align: left;
}

.country-color-auto:hover,
.country-color-more:hover {
  color: var(--accent-light);
}

.country-color-section-title {
  margin: 10px 0 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
}

.country-color-theme-grid,
.country-color-standard-grid,
.country-color-recent-grid {
  display: grid;
  grid-template-columns: repeat(10, 22px);
  gap: 5px;
}

.country-color-option {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 3px;
  background: var(--swatch);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
}

.country-color-option:hover {
  outline: 2px solid var(--accent-light);
  outline-offset: 1px;
}

.country-color-empty {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 0;
}

.country-color-more {
  margin-top: 10px;
  border-top: 1px solid var(--border-primary);
  border-bottom: 0;
}

.country-color-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-primary);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row input {
  cursor: pointer;
}

.toggle-row:hover {
  background: var(--bg-card-hover);
}

/* Dept Filter */
#deptFilterValues {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Inline Multi-Select */
.multi-select-editor {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 100%;
  width: auto;
  min-width: 180px;
  /* Ensure enough width for labels */
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  z-index: 100;
  box-shadow: var(--shadow-lg);
  outline: none !important;
  padding: 4px 0;
}

.ms-option {
  display: flex !important;
  align-items: center !important;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  background-color: transparent;
  color: var(--text-primary);
}

.ms-option:hover {
  background-color: #3b82f6 !important;
  /* Bright blue for clear hover */
  color: white !important;
}

.ms-option input {
  margin: 0;
  cursor: pointer;
}

/* ---- Aging Report ---- */
.aging-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 0;
}

.aging-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.aging-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-3);
  opacity: 0;
  transition: var(--transition);
}

.aging-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.aging-kpi-card:hover::before {
  opacity: 1;
}

.aging-kpi-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.aging-kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.aging-kpi-worst {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aging-kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Aging Buckets */
.aging-buckets-section {
  margin-bottom: 20px;
}

.aging-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 12px;
  padding-left: 4px;
}

.aging-buckets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.aging-bucket-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: var(--transition);
}

.aging-bucket-card:hover {
  box-shadow: var(--shadow-sm);
}

.aging-bucket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.aging-bucket-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.aging-bucket-count {
  font-size: 20px;
  font-weight: 800;
}

.aging-bucket-bar-track {
  height: 6px;
  background: var(--bg-table-header);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.aging-bucket-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.aging-bucket-value {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Aging Risk Badges */
.aging-risk-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.aging-expand-icon {
  display: inline-block;
  font-size: 10px;
  margin-right: 4px;
  transition: transform 0.15s;
}

.aging-project-row {
  cursor: pointer;
}

.aging-project-row:hover td {
  background: var(--bg-hover);
}

.aging-risk-low {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.aging-risk-medium {
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
}

.aging-risk-high {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.aging-risk-critical {
  background: rgba(153, 27, 27, 0.15);
  color: #991b1b;
}

[data-theme="light"] .aging-risk-critical {
  background: rgba(153, 27, 27, 0.1);
  color: #b91c1c;
}

/* Aging table specific */
#tab-aging #agingPivotTable {
  min-width: auto;
}

#tab-aging #agingDetailTable {
  min-width: 1400px;
  /* Prevents text from overlapping/mushing */
}

/* Fix sticky header globally by making table-wrapper scroll internally */
#tab-milestones .table-wrapper {
  max-height: calc(100vh - var(--sticky-offset, 120px) - 80px);
  /* Fill remaining space exactly */
  overflow-y: auto;
}

#tab-aging .table-wrapper {
  max-height: 65vh;
  /* Keep completely on-screen so horizontal scrolling works alongside sticky headers */
  overflow-y: auto;
}

/* ---- Aging Sub-Tabs ---- */
.aging-sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 4px;
  width: fit-content;
}

.aging-sub-tab {
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
}

.aging-sub-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.aging-sub-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.aging-sub-content {
  display: none;
}

.aging-sub-content.active {
  display: block;
  animation: tabFadeIn 0.3s ease-out;
}

/* ---- Aging Action Bar ---- */
.aging-action-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---- Aging Column Config ---- */
.aging-col-config {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.aging-col-config-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* ---- Aging Pivot Table ---- */
.aging-pivot-country {
  background: var(--bg-table-header);
  font-weight: 600;
}

.aging-pivot-country:hover {
  background: var(--bg-card-hover);
}

.aging-pivot-arrow {
  display: inline-block;
  width: 20px;
  font-size: 11px;
  color: var(--text-muted);
}

.aging-pivot-client td {
  background: var(--bg-card);
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-primary);
}

.aging-pivot-client:hover td {
  background: var(--bg-card-hover);
}

/* ---- Old Aging Balances ---- */
.aging-old-balances-section {
  margin-bottom: 20px;
}

.aging-old-balances-section .data-table {
  min-width: auto;
}

/* Delete button inside aging table */
.aging-old-balances-section .btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.aging-old-balances-section .btn-delete:hover {
  background: #ef4444;
  color: #fff;
}

/* ============================
   PREMIUM VISUAL ENHANCEMENTS
   ============================ */

/* ---- KPI Card Shimmer ---- */
@keyframes kpiShimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.kpi-card:hover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  background-size: 200% 100%;
  animation: kpiShimmer 1.5s ease-in-out;
  pointer-events: none;
  border-radius: inherit;
}

[data-theme="light"] .kpi-card:hover::after {
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.04), transparent);
  background-size: 200% 100%;
  animation: kpiShimmer 1.5s ease-in-out;
}

.kpi-card {
  backdrop-filter: blur(8px);
}

.kpi-value {
  background: linear-gradient(135deg, var(--text-heading), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Enhanced Tab Bar ---- */
.tabs {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 5px 6px;
  border: 1px solid var(--border-primary);
  backdrop-filter: blur(10px);
}

/* Make Resources sub-tabs box larger to cleanly wrap buttons */
.team-sub-tabs {
  padding: 12px 20px !important;
}
.tab {
  position: relative;
  z-index: 1;
  transition: color 0.3s, background 0.3s, transform 0.15s;
}

.tab:hover {
  transform: translateY(-1px);
}

.tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

[data-theme="light"] .tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

/* ---- Tab Content Fade-In ---- */
@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-content.active {
  animation: tabFadeIn 0.35s ease-out;
}

/* ---- Enhanced Table Row Hover ---- */
.data-table tbody tr:hover td {
  background-image: linear-gradient(var(--bg-card-hover), var(--bg-card-hover)) !important;
}

.data-table tbody tr {
  transition: transform 0.15s ease;
}

/* ---- Smoother Table Container ---- */
.table-container {
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.table-container:hover {
  box-shadow: var(--shadow-lg);
}

/* ---- Enhanced Card Containers ---- */
.filter-bar {
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s, border-color 0.3s;
}

.filter-bar:hover {
  box-shadow: var(--shadow-md);
}

/* ---- Button Hover Glow ---- */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.btn-primary:hover::after {
  opacity: 1;
}

/* ---- Status Badge Micro-Animation ---- */
.status-badge,
.risk-badge,
.location-chip {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.status-badge:hover,
.risk-badge:hover {
  transform: scale(1.05);
}

/* ---- Aging KPI Gradient Values ---- */
.aging-kpi-value {
  background: linear-gradient(135deg, var(--text-heading), #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Aging Bucket Animated Bars ---- */
@keyframes barGrow {
  from {
    width: 0;
  }
}

.aging-bucket-bar-fill {
  animation: barGrow 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Modal Backdrop Blur ---- */
.modal-overlay.active {
  backdrop-filter: blur(6px);
}

/* ---- Scroll Top Button Enhancement ---- */
.scroll-top-btn {
  box-shadow: var(--shadow-md), 0 0 20px var(--accent-glow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.scroll-top-btn:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: var(--shadow-lg), 0 0 30px var(--accent-glow);
}

/* ---- Header Gradient Accent ---- */
.header {
  background: linear-gradient(135deg, transparent, var(--accent-glow));
  border-radius: var(--radius-lg);
  padding: 16px 20px 20px;
}

/* ---- Project Status Cards Enhancement ---- */
.project-card {
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

/* ---- Report Full-Width ---- */
#tab-report,
#tab-country-report {
  margin-left: calc(-28px);
  margin-right: calc(-28px);
  padding: 0;
}

#tab-report .report-container,
#tab-country-report .report-container {
  width: 100%;
  max-width: none;
  padding: 0 16px;
}

#tab-report .report-content,
#tab-country-report .report-content {
  width: 100%;
  max-width: none;
}

#tab-report .report-content>div,
#tab-country-report .report-content>div {
  max-width: none !important;
  width: 100% !important;
  padding: 24px 32px !important;
}

#tab-report .report-actions,
#tab-country-report .report-actions {
  padding: 12px 16px;
}

/* ============================
   SETTINGS MODAL STYLES
   ============================ */

.modal-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent-glow);
}

.settings-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 12px 0;
}

/* Column Toggles Grid */
.column-toggles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 16px;
  margin-bottom: 16px;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
}

/* Toggle Row — checkbox NEXT to the label */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 0.15s;
  flex-direction: row;
}

.toggle-row:hover {
  background: var(--bg-card-hover);
}

.toggle-row span {
  order: 1;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toggle-row input[type="checkbox"] {
  order: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* Settings Add Row */
.settings-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

/* Settings List */
.settings-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.settings-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-primary);
  transition: background 0.15s;
}

.settings-list-item:hover {
  background: var(--bg-card-hover);
}

.settings-list-item:last-child {
  border-bottom: none;
}

/* ============================
   MORE VISUAL ENHANCEMENTS
   ============================ */

/* ---- Animated Number Counters ---- */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpi-card {
  animation: countUp 0.5s ease-out both;
}

.kpi-card:nth-child(1) {
  animation-delay: 0s;
}

.kpi-card:nth-child(2) {
  animation-delay: 0.08s;
}

.kpi-card:nth-child(3) {
  animation-delay: 0.16s;
}

.kpi-card:nth-child(4) {
  animation-delay: 0.24s;
}

.kpi-card:nth-child(5) {
  animation-delay: 0.32s;
}

.kpi-card:nth-child(6) {
  animation-delay: 0.40s;
}

.kpi-card:nth-child(7) {
  animation-delay: 0.48s;
}

.kpi-card:nth-child(8) {
  animation-delay: 0.56s;
}

/* ---- Main Navigation ---- */
.main-nav {
  display: flex;
  gap: 4px;
  margin-left: 20px;
}

.main-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  font-family: inherit;
}

.main-nav-btn:hover {
  color: var(--text-heading);
  background: var(--bg-hover);
}

.main-nav-btn.active {
  color: var(--accent);
  background: var(--bg-secondary);
}

.main-nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
}

/* ---- Pipeline ---- */
.pipeline-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.pipeline-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: var(--transition);
}

.pipeline-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ---- Gradient Border Header ---- */
.header::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #ec4899, #f59e0b, var(--accent));
  background-size: 300% 100%;
  animation: gradientSlide 6s ease-in-out infinite;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

@keyframes gradientSlide {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

/* ---- Pulsing Active Tab Dot ---- */
.tab.active::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
  animation: tabPulse 2s ease-in-out infinite;
}

@keyframes tabPulse {

  0%,
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }

  50% {
    opacity: 0.5;
    transform: translateX(-50%) scale(0.7);
  }
}

/* ---- Dashboard Grid Stagger ---- */
.dashboard-grid>* {
  animation: countUp 0.4s ease-out both;
}

.dashboard-grid>*:nth-child(1) {
  animation-delay: 0.05s;
}

.dashboard-grid>*:nth-child(2) {
  animation-delay: 0.1s;
}

.dashboard-grid>*:nth-child(3) {
  animation-delay: 0.15s;
}

.dashboard-grid>*:nth-child(4) {
  animation-delay: 0.2s;
}

.dashboard-grid>*:nth-child(5) {
  animation-delay: 0.25s;
}

.dashboard-grid>*:nth-child(6) {
  animation-delay: 0.3s;
}

/* ---- Chart Container Glow ---- */
.chart-container {
  position: relative;
  transition: transform 0.2s, box-shadow 0.3s;
}

.chart-container:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 25px var(--accent-glow);
}

/* ---- Enhanced Progress Bars ---- */
.progress-bar-fill {
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%);
  background-size: 20px 20px;
  animation: progressStripe 1s linear infinite;
}

@keyframes progressStripe {
  from {
    background-position: 0 0;
  }

  to {
    background-position: 20px 0;
  }
}

/* ---- Smooth Modal Entrance ---- */
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-overlay.active .modal {
  animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Enhanced Scroll Top ---- */
@keyframes floatUpDown {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

.scroll-top-btn.visible {
  animation: floatUpDown 3s ease-in-out infinite;
}

/* ---- Table Header Gradient ---- */
.data-table thead th {
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg-card)) !important;
  border-bottom: 2px solid var(--accent) !important;
}

/* ---- Empty State Animation ---- */
@keyframes emptyBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.empty-state-icon {
  animation: emptyBounce 2s ease-in-out infinite;
}

/* ---- Yes/No Badge Enhancement ---- */
.yes-badge {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
}

.no-badge {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.04));
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
}

/* ---- Sticky Zone Glass Effect ---- */
.sticky-zone {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ================================================================
   TEAM EFFORT — Styles
   ================================================================ */

/* Team Page Sub-Content (Effort, Project Hours, Resource Timesheet) */
.team-sub-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 0 0 0;
  box-sizing: border-box;
  flex: 1 1 auto;
  min-height: 0;
}

.team-sub-content .effort-header {
  padding: 0 20px;
}

.team-sub-content .effort-kpi-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  padding: 6px 20px 12px;
  width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

/* Allow table-container inside team sub-tabs to grow and fill remaining space */
.team-sub-content .table-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.team-sub-content .table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

/* Fallback bounded heights to ensure position: sticky header limits never blow out */
#team-effort .table-wrapper {
  max-height: calc(100vh - 340px);
}
#team-projecthours .table-wrapper,
#team-restimesheet .table-wrapper {
  max-height: calc(100vh - 240px);
}

#team-projectactivities {
  gap: 14px;
}

.pa-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pa-header-actions .filter-input {
  min-width: 260px;
}

.pa-projects-view,
.pa-project-detail {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 20px 20px;
}

.pa-projects-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pa-project-detail {
  overflow: auto;
}

.pa-summary-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.pa-summary-card,
.pa-metric-card {
  min-height: 64px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 12px;
}

.pa-summary-card span,
.pa-metric-card span {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pa-summary-card strong,
.pa-metric-card strong {
  display: block;
  margin-top: 6px;
  color: var(--text-heading);
  font-size: 20px;
  font-weight: 900;
}

.pa-project-list {
  display: grid;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 4px;
  padding-bottom: 12px;
}

.pa-status-section {
  display: grid;
  gap: 8px;
}

.pa-status-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: rgba(15, 23, 42, .24);
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
}

.pa-status-header strong {
  color: var(--text-heading);
}

.pa-status-chevron {
  width: 16px;
  color: var(--accent);
  font-weight: 900;
}

.pa-status-projects {
  display: grid;
  gap: 8px;
}

.pa-project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(110px, auto);
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.pa-project-card:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, .10);
}

.pa-project-main {
  min-width: 0;
}

.pa-project-name {
  display: block;
  overflow: hidden;
  color: var(--text-heading);
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pa-project-meta {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pa-status-pill {
  min-width: 76px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.pa-status-pill.active {
  background: rgba(34, 197, 94, .12);
  color: #86efac;
}

.pa-status-pill.closed {
  background: rgba(148, 163, 184, .12);
  color: #cbd5e1;
}

.pa-status-pill.canceled {
  background: rgba(239, 68, 68, .12);
  color: #fca5a5;
}

.pa-status-pill.expired {
  background: rgba(245, 158, 11, .12);
  color: #fcd34d;
}

.pa-project-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.pa-project-stats strong,
.pa-project-stats span {
  color: var(--text-heading);
  font-weight: 900;
}

.pa-detail-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(220px, 320px);
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.pa-back-btn {
  white-space: nowrap;
}

.pa-project-heading {
  min-width: 0;
}

.pa-project-kicker {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pa-project-heading h3 {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--text-heading);
  font-size: 18px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pa-switcher .filter-input {
  width: 100%;
}

.pa-switcher {
  position: relative;
}

.pa-project-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 80;
  max-height: 232px;
  overflow-y: auto;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}

.pa-project-popup[hidden] {
  display: none;
}

.pa-project-popup-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.pa-project-popup-item:hover,
.pa-project-popup-item.active {
  background: var(--bg-card-hover);
}

.pa-project-popup-item span {
  overflow: hidden;
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pa-project-popup-item small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pa-project-popup-empty {
  padding: 12px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.pa-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.pa-manual-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 150px auto;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: rgba(15, 23, 42, .20);
}

.pa-management-view {
  min-height: 0;
}

.pa-management-table {
  width: 100%;
  margin: 0;
}

.pa-management-table th,
.pa-management-table td {
  vertical-align: middle;
}

.pa-management-table .filter-input,
.pa-management-table .filter-select {
  width: 100%;
  min-height: 34px;
  font-size: 11px;
}

.pa-management-table th:nth-child(3),
.pa-management-table th:nth-child(4),
.pa-management-table th:nth-child(5),
.pa-management-table td:nth-child(3),
.pa-management-table td:nth-child(4),
.pa-management-table td:nth-child(5) {
  width: 120px;
  text-align: right;
}

.pa-hours-cell {
  color: var(--text-heading);
  font-weight: 900;
}

.pa-variance-cell {
  font-weight: 900;
}

.pa-variance-cell.over {
  color: #f59e0b;
}

.pa-variance-cell.under {
  color: #38bdf8;
}

.pa-variance-cell.even {
  color: #22c55e;
}

.pa-empty-cell {
  padding: 24px !important;
  color: var(--text-muted);
  text-align: center;
}

.pa-team-view {
  display: grid;
  gap: 12px;
}

.pa-team-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: rgba(15, 23, 42, .20);
}

.pa-team-toolbar strong {
  display: block;
  color: var(--text-heading);
  font-size: 13px;
}

.pa-team-toolbar span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.pa-team-table-wrap {
  overflow: auto;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
}

.pa-team-table {
  min-width: 920px;
  margin: 0;
}

.pa-team-table th,
.pa-team-table td {
  text-align: center;
}

.pa-team-table th:first-child,
.pa-team-table td:first-child {
  min-width: 220px;
  text-align: left;
}

.pa-team-table th span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
}

.pa-team-table td:first-child span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.pa-team-hour-input {
  width: 64px;
  min-height: 32px;
  text-align: center;
}

.pa-team-total {
  color: var(--accent);
  font-weight: 900;
}

.pa-activity-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
}

.pa-category-column {
  min-width: 0;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-card);
  overflow: hidden;
}

.pa-category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-heading);
  font-size: 13px;
  font-weight: 900;
}

.pa-category-title span {
  color: var(--accent);
  font-size: 12px;
}

.pa-category-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 430px);
  overflow: auto;
  padding: 10px;
}

.pa-activity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 82px 34px;
  gap: 6px;
  align-items: center;
}

.pa-activity-row .filter-input,
.pa-activity-row .filter-select {
  width: 100%;
  min-height: 34px;
  font-size: 11px;
}

.pa-delete-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-color: rgba(239, 68, 68, .35);
  color: #fca5a5;
}

.pa-category-empty,
.pa-empty-state {
  padding: 20px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 1100px) {
  .pa-summary-strip,
  .pa-metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pa-detail-bar,
  .pa-manual-panel,
  .pa-activity-board {
    grid-template-columns: 1fr;
  }
}

/* ---- Header ---- */
.effort-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-primary);
  flex-shrink: 0;
}

.effort-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-heading);
  margin: 0 0 4px;
}

.effort-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.effort-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- KPI strip ---- */
.effort-kpi-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  flex-shrink: 0;
  overflow: visible;
}

.effort-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  min-width: 0;
  flex: 1 1 0;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.effort-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.effort-kpi-icon {
  font-size: 20px;
}

.effort-kpi-body {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.effort-kpi-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.5px;
}

.effort-kpi-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.effort-kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ================================================================
   TABLE
   ================================================================ */
.effort-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
}

.effort-table tbody td {
  border-bottom: 1px solid var(--border-primary);
}

.effort-table thead th {
  border-bottom: none;
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

/* Fixed columns — shrink to content */
.effort-th-fixed {
  background: var(--bg-table-header) !important;
  vertical-align: middle !important;
  white-space: nowrap;
  width: 1%;
}

/* Month group header row */
.effort-thead-months th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-table-header);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: none !important;
  box-shadow: inset 0 -2px 0 0 var(--accent) !important;
}

/* Sub-header row */
.effort-thead-sub th {
  position: sticky;
  top: 37px;
  /* height of row 1 */
  z-index: 19;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  background: var(--bg-table-header);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 6px 10px;
  border-bottom: none !important;
  box-shadow: inset 0 -2px 0 0 var(--border-primary) !important;
}

/* Month colour coding — only in header rows */
thead .effort-th-jan {
  background: rgba(99, 102, 241, 0.10) !important;
  color: #a5b4fc !important;
}

thead .effort-th-feb {
  background: rgba(56, 189, 248, 0.10) !important;
  color: #7dd3fc !important;
}

thead .effort-th-mar {
  background: rgba(245, 158, 11, 0.10) !important;
  color: #fcd34d !important;
}

thead .effort-th-apr {
  background: rgba(34, 197, 94, 0.10) !important;
  color: #86efac !important;
}

thead .effort-th-may {
  background: rgba(168, 85, 247, 0.10) !important;
  color: #c4b5fd !important;
}

thead .effort-th-jun {
  background: rgba(236, 72, 153, 0.10) !important;
  color: #f9a8d4 !important;
}

thead .effort-th-jul {
  background: rgba(14, 165, 233, 0.10) !important;
  color: #7dd3fc !important;
}

thead .effort-th-aug {
  background: rgba(251, 146, 60, 0.10) !important;
  color: #fdba74 !important;
}

thead .effort-th-sep {
  background: rgba(20, 184, 166, 0.10) !important;
  color: #5eead4 !important;
}

thead .effort-th-oct {
  background: rgba(244, 63, 94, 0.10) !important;
  color: #fda4af !important;
}

thead .effort-th-nov {
  background: rgba(132, 204, 22, 0.10) !important;
  color: #bef264 !important;
}

thead .effort-th-dec {
  background: rgba(99, 102, 241, 0.10) !important;
  color: #a5b4fc !important;
}

/* Data cells with month classes — no background tint */
tbody .effort-th-jan, tbody .effort-th-feb, tbody .effort-th-mar,
tbody .effort-th-apr, tbody .effort-th-may, tbody .effort-th-jun,
tbody .effort-th-jul, tbody .effort-th-aug, tbody .effort-th-sep,
tbody .effort-th-oct, tbody .effort-th-nov, tbody .effort-th-dec {
  background: transparent !important;
  color: inherit !important;
}

tfoot .effort-th-jan, tfoot .effort-th-feb, tfoot .effort-th-mar,
tfoot .effort-th-apr, tfoot .effort-th-may, tfoot .effort-th-jun,
tfoot .effort-th-jul, tfoot .effort-th-aug, tfoot .effort-th-sep,
tfoot .effort-th-oct, tfoot .effort-th-nov, tfoot .effort-th-dec {
  background: inherit !important;
  color: inherit !important;
}

/* ---- Sticky thead for effort table ---- */
#effortTable thead th {
  position: sticky;
  z-index: 20;
  border-bottom: none !important;
  box-shadow: inset 0 -2px 0 0 var(--accent) !important;
}

#effortTable .effort-thead-months th {
  top: 0;
}

#effortTable .effort-thead-sub th {
  top: 37px; /* height of first header row */
  box-shadow: inset 0 -2px 0 0 var(--border-primary) !important;
}

/* ---- Sticky tfoot (totals) for effort table ---- */
#effortTable tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 80;
  background: var(--bg-secondary) !important;
  border-left-color: var(--bg-secondary) !important;
  border-bottom: none !important;
  box-shadow: inset 0 1px 0 0 var(--border-primary), 0 28px 0 0 var(--bg-secondary) !important;
}

.effort-th-month-group {
  text-align: center !important;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px !important;
  font-weight: 700 !important;
  padding: 10px 6px;
}

/* Country cell — tight fit */
.effort-country-cell {
  vertical-align: middle;
  text-align: center;
  padding: 8px 10px;
  white-space: nowrap;
  width: 1%;
}

/* Client cell — reasonable max, truncate if very long */
.effort-client-cell {
  color: var(--text-secondary);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  padding: 9px 12px;
  width: 1%;
}

/* Editable month cells — give them a consistent min-width */
.effort-editable {
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  padding: 9px 10px;
  position: relative;
  min-width: 72px;
  white-space: nowrap;
}

.effort-editable:hover {
  background: var(--bg-card-hover) !important;
  box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.4);
}

.effort-editable.editing {
  background: var(--bg-card-hover) !important;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.sla-table .sticky-country-head,
.sla-table .sticky-country-col {
  position: sticky;
  left: 0;
  min-width: 80px;
  width: 80px;
  max-width: 80px;
}

.sla-table .sticky-country-head {
  z-index: 60;
  background: var(--bg-table-header);
}

.sla-table .sticky-country-col {
  z-index: 10;
  background: var(--bg-card);
}

.sla-table .sticky-client-head,
.sla-table .sticky-client-col {
  position: sticky;
  left: 80px;
  min-width: 230px;
}

.sla-table .sticky-client-head {
  z-index: 59;
  background: var(--bg-table-header);
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.15);
}

.sla-table .sticky-client-col {
  z-index: 10;
  background: var(--bg-card);
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.15);
}

.effort-empty {
  color: var(--text-muted);
  opacity: 0.4;
}

/* Column separators between months */
.effort-table td.effort-th-feb:first-of-type,
.effort-table th.effort-th-feb,
.effort-table td.effort-th-mar:first-of-type,
.effort-table th.effort-th-mar {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

/* Inline input */
.effort-inline-input {
  width: 80px;
  background: var(--bg-input);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 4px 6px;
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.effort-inline-input:focus {
  border-color: var(--accent-light);
}

.effort-inline-input::-webkit-inner-spin-button,
.effort-inline-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
}

.effort-inline-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Totals footer */
.effort-totals-row td {
  background: var(--bg-secondary) !important;
  border-top: 2px solid rgba(99, 102, 241, 0.25) !important;
  border-left-color: var(--bg-secondary) !important;
  border-bottom: none !important;
}

.effort-totals-label {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-secondary);
  border-left: none !important;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 14px;
}

.effort-total-cell {
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-light);
  padding: 10px 10px;
}

/* ---- Drag-and-drop ---- */
.effort-drag-icon {
  display: inline-block;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.35);
  margin-right: 6px;
  letter-spacing: 1px;
  vertical-align: middle;
  cursor: grab;
}

#effortBody tr.effort-tr {
  cursor: default;
}

#effortBody tr.effort-tr .effort-country-cell {
  cursor: grab;
}

#effortBody tr.effort-dragging {
  opacity: 0.35;
}

#effortBody tr.effort-drag-over {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: rgba(99, 102, 241, 0.08) !important;
}

/* ---- Collapsible country header rows ---- */
.effort-country-header {
  cursor: pointer;
  user-select: none;
}

.effort-country-header-cell {
  padding: 9px 14px !important;
  background: var(--bg-table-header) !important;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: background 0.15s;
  vertical-align: middle !important;
}

.effort-country-header:hover .effort-country-header-cell {
  background: rgba(255, 255, 255, 0.05) !important;
}

.effort-toggle {
  display: inline-block;
  width: 16px;
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.2s;
  vertical-align: middle;
}

.effort-country-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  vertical-align: middle;
}

.effort-country-summary {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  vertical-align: middle;
}

.effort-country-summary b {
  font-style: normal;
  color: var(--text-primary);
  font-size: 13px;
}

/* ---- Timesheet section divider ---- */
.effort-section-divider {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 32px 0 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.effort-section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: 0.3px;
}

.effort-section-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.ts-project-cell {
  font-weight: 600;
  color: var(--text-heading);
}

.ts-hours-cell {
  font-weight: 700;
}


#timesheetTable thead th,
#resourceTimesheetTable thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg-card)) !important;
  border-bottom: none !important;
  box-shadow: inset 0 -2px 0 0 var(--accent) !important;
}

#timesheetTable tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 80;
  background: var(--bg-secondary) !important;
  border-left-color: var(--bg-secondary) !important;
  border-bottom: none !important;
  box-shadow: inset 0 1px 0 0 var(--border-primary), 0 28px 0 0 var(--bg-secondary) !important;
}

/* Estimated Time column */
.ts-est-th {
  color: var(--accent-light) !important;
}

.ts-est-cell {
  color: var(--accent-light) !important;
  font-weight: 700 !important;
  font-size: 13px;
}

/* Total column */
.effort-th-total {
  color: #f59e0b !important;
  font-weight: 700 !important;
}

.effort-total-col {
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.06);
  padding: 9px 10px;
  white-space: nowrap;
}

/* ================================================================
   SETTINGS PAGE
   ================================================================ */
.settings-page-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 100px);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.settings-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-primary);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.settings-sidebar-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-heading);
  padding: 0 20px 14px;
  margin: 0;
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: 8px;
}

.settings-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  border-left: 3px solid transparent;
}

.settings-nav-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.settings-nav-btn.active {
  background: var(--accent-glow);
  color: var(--accent-light);
  font-weight: 600;
  border-left-color: var(--accent);
}

.settings-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

.settings-section {
  display: none;
}

.settings-section.active {
  display: block;
}

.settings-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 6px;
}

/* Compact variant for tables inside Settings panels */
.data-table-compact {
  min-width: unset !important;
  width: 100% !important;
  font-size: 12px !important;
}

.data-table-compact th {
  padding: 7px 10px !important;
  font-size: 10px !important;
  cursor: default !important;
}

.data-table-compact td {
  padding: 6px 10px !important;
  font-size: 12px !important;
  white-space: normal !important;
}

.data-table-compact tbody tr:hover td {
  background: var(--bg-secondary) !important;
}

.settings-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.stage-email-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
  gap: 14px;
  align-items: start;
}

.stage-email-card {
  min-width: 0;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-secondary);
  padding: 16px;
}

.stage-email-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.stage-email-title {
  color: var(--text-heading);
  font-size: 14px;
  font-weight: 800;
}

.stage-email-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}

.stage-template-fields {
  display: grid;
  gap: 12px;
}

.stage-template-field {
  min-width: 0;
}

.stage-template-field .filter-input,
.stage-template-field .field-input,
.stage-template-field .field-textarea {
  width: 100%;
}

.stage-template-body {
  min-height: 150px;
  line-height: 1.5;
  font-family: inherit;
}

.stage-template-help {
  margin: 10px 0 14px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.template-token-menu {
  position: fixed;
  z-index: 10000;
  display: none;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 24px));
  max-height: 280px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .32);
}

.template-token-option {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.template-token-option:hover,
.template-token-option.is-active {
  background: var(--accent-glow);
}

.template-token-label {
  font-size: 12px;
  font-weight: 800;
}

.template-token-key {
  color: var(--accent-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.template-token-desc {
  color: var(--text-muted);
  font-size: 11px;
}

/* Company hierarchy editor */
.hierarchy-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 292px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  margin-top: 14px;
  height: clamp(460px, calc(100vh - 300px), 680px);
  min-height: 0;
}

.hierarchy-user-panel,
.hierarchy-builder-panel {
  min-width: 0;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-card);
}

.hierarchy-user-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  min-height: 0;
}

.hierarchy-builder-panel {
  display: flex;
  flex-direction: column;
  padding: 14px;
  min-height: 0;
}

.hierarchy-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.hierarchy-panel-label {
  color: var(--text-heading);
  font-size: 13px;
  font-weight: 800;
}

.hierarchy-panel-subtitle {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.hierarchy-count {
  min-width: 28px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
}

.hierarchy-search,
.hierarchy-resource-select {
  width: 100%;
}

.hierarchy-user-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.hierarchy-user-option {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.hierarchy-user-option:hover,
.hierarchy-user-option.is-selected {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.hierarchy-user-option.is-assigned {
  opacity: 0.72;
}

.hierarchy-user-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gradient-4);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.hierarchy-user-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hierarchy-user-name {
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.hierarchy-user-meta {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.hierarchy-user-state {
  align-self: flex-start;
  padding: 3px 7px;
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.hierarchy-user-option.is-assigned .hierarchy-user-state {
  color: var(--accent-light);
  border-color: var(--border-active);
}

.hierarchy-user-empty {
  padding: 18px 10px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.hierarchy-editor-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.hierarchy-manager-control {
  min-width: 220px;
  max-width: 300px;
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hierarchy-top-drop {
  width: 100%;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  padding: 7px 14px;
  border: 1px dashed var(--border-active);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
}

.hierarchy-chart-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
}

.hierarchy-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.hierarchy-zoom-btn {
  min-width: 30px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.hierarchy-zoom-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text-primary);
}

.hierarchy-zoom-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.hierarchy-zoom-reset {
  min-width: 48px;
}

.hierarchy-zoom-value {
  min-width: 46px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.hierarchy-chart-shell {
  --hierarchy-line: rgba(99, 102, 241, 0.36);
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-secondary);
  cursor: grab;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.hierarchy-chart-shell::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.hierarchy-chart-shell.is-panning {
  cursor: grabbing;
  user-select: none;
}

[data-theme="dark"] .hierarchy-chart-shell {
  --hierarchy-line: rgba(129, 140, 248, 0.38);
}

.hierarchy-pan-surface {
  position: relative;
  min-width: 100%;
  min-height: 100%;
  margin: 0 auto;
}

.hierarchy-chart {
  --hierarchy-zoom: 1;
  width: max-content;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin: 0 auto;
  padding: 28px 32px 34px;
  transform: scale(var(--hierarchy-zoom));
  transform-origin: top center;
  transition: transform 0.12s ease;
}

.hierarchy-tree,
.hierarchy-tree ul {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.hierarchy-tree ul {
  padding-top: 34px;
}

.hierarchy-tree ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  height: 34px;
  border-left: 2px solid var(--hierarchy-line);
}

.hierarchy-branch {
  position: relative;
  padding: 34px 18px 0;
  text-align: center;
}

.hierarchy-tree > .hierarchy-branch {
  padding: 0 22px;
}

.hierarchy-branch::before,
.hierarchy-branch::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: 34px;
  border-top: 2px solid var(--hierarchy-line);
}

.hierarchy-branch::before {
  right: 50%;
}

.hierarchy-branch::after {
  left: 50%;
  border-left: 2px solid var(--hierarchy-line);
}

.hierarchy-branch:first-child::before,
.hierarchy-branch:last-child::after,
.hierarchy-tree > .hierarchy-branch::before,
.hierarchy-tree > .hierarchy-branch::after {
  border: 0;
}

.hierarchy-branch:last-child::before {
  border-right: 2px solid var(--hierarchy-line);
  border-radius: 0 8px 0 0;
}

.hierarchy-branch:first-child::after {
  border-radius: 8px 0 0 0;
}

.hierarchy-tree > .hierarchy-branch:first-child::after,
.hierarchy-tree > .hierarchy-branch:last-child::before {
  border: 0;
}

.hierarchy-branch:only-child::before,
.hierarchy-branch:only-child::after {
  display: none;
}

.hierarchy-tree > .hierarchy-branch:only-child {
  padding-top: 0;
}

.hierarchy-person {
  position: relative;
  width: 164px;
  min-height: 104px;
  flex: 0 0 auto;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 12px 10px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s, opacity 0.2s;
}

.hierarchy-person:hover,
.hierarchy-person.is-selected {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-sm);
}

.hierarchy-person.is-drop-target,
.hierarchy-top-drop.is-drop-target {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
  color: var(--text-primary);
}

.hierarchy-person.is-dragging {
  opacity: 0.58;
  transform: scale(0.98);
}

.hierarchy-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gradient-4);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.hierarchy-name {
  max-width: 100%;
  color: var(--text-heading);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.hierarchy-meta {
  min-height: 14px;
  max-width: 100%;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.hierarchy-top-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.hierarchy-person:hover .hierarchy-top-btn,
.hierarchy-person:focus-within .hierarchy-top-btn {
  display: inline-flex;
}

.hierarchy-person.is-top .hierarchy-top-btn {
  display: none;
}

.hierarchy-top-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.hierarchy-empty {
  min-height: 430px;
  display: grid;
  place-items: center;
  padding: 34px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 980px) {
  .hierarchy-workspace {
    grid-template-columns: 1fr;
  }

  .hierarchy-user-list {
    max-height: 260px;
  }
}

@media (max-width: 820px) {
  .hierarchy-chart {
    justify-content: flex-start;
    padding: 22px 18px 26px;
  }

  .hierarchy-tree,
  .hierarchy-tree ul {
    gap: 0;
  }

  .hierarchy-branch {
    padding-right: 12px;
    padding-left: 12px;
  }

  .hierarchy-person {
    width: 148px;
  }

  .hierarchy-manager-control {
    max-width: none;
  }
}

/* Resource form grid */
.resource-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 12px;
}

.resource-form-grid .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.resource-form-grid .form-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.resource-form-grid .form-group input,
.resource-form-grid .form-group select {
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.resource-form-grid .form-group input:focus,
.resource-form-grid .form-group select:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* GP column header */
thead .effort-th-gp {
  background: rgba(34, 197, 94, 0.10) !important;
  color: #86efac !important;
}

tbody .effort-th-gp {
  background: transparent !important;
  color: inherit !important;
}

tfoot .effort-th-gp {
  background: inherit !important;
  color: inherit !important;
}

/* ---- Resource Timesheet Expandable Rows ---- */
.rts-parent-row {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-primary);
}
.rts-parent-row:hover {
  background: var(--bg-hover);
}
.rts-parent-row td:first-child {
  user-select: none;
}
.rts-child-row {
  background: rgba(99, 102, 241, 0.03);
  border-bottom: 1px dashed var(--border-primary);
}
.rts-child-row:hover {
  background: rgba(99, 102, 241, 0.07);
}
.rts-child-row td {
  font-size: 12.5px;
}

/* ================================================================
   PAGE CONTENT FIXES (RESOURCES / SETTINGS)
   Ensuring these pages have proper flex bounding to fix header sizes
   and force the scrollbars into the right place (bottom bar fix).
   NOTE: visibility is controlled via inline style="display:none"
   set by JavaScript's switchPage(). We must NOT set display:none here
   because JS clears it with style.display='' which falls back to CSS.
   ================================================================ */
.page-content {
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 16px 24px; /* Matches the visual spacing of sticky-zone on milestones tab */
  box-sizing: border-box;
}

#page-team {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

#page-settings {
  overflow-y: auto;
  overflow-x: hidden;
}

/* Guarantee table wrappers don't blow up the container */
#page-team .table-wrapper,
#page-settings .table-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
}

/* ---- SLA Tab: compact tables that fit to screen width ---- */
#sla-milestones .table-container,
#recurrencies-outsource .table-container,
#recurrencies-license .table-container,
#sla-teameffort .table-container {
  display: flex;           /* keep flex layout for sticky footer */
  flex-direction: column;
  width: 100%;
  height: max(320px, calc(100vh - var(--sticky-offset, 120px) - 230px));
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

#sla-milestones .table-wrapper,
#recurrencies-outsource .table-wrapper,
#recurrencies-license .table-wrapper,
#sla-teameffort .table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 100%;
}

#slaTable,
#outsourceTable,
#licenseTable,
#slaTeamEffortTable {
  width: 100% !important;
  min-width: 1500px !important;
  table-layout: auto !important;
  white-space: nowrap;
}

#slaTable th,
#slaTable td,
#outsourceTable th,
#outsourceTable td,
#licenseTable th,
#licenseTable td,
#slaTeamEffortTable th,
#slaTeamEffortTable td {
  padding: 5px 8px !important;
  font-size: 10.5px !important;
}

/* Truncate long customer names to ~140px */
#slaTable td:nth-child(2),
#outsourceTable td:nth-child(2),
#licenseTable td:nth-child(2),
#slaTeamEffortTable td:nth-child(2) {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#slaTable thead th,
#outsourceTable thead th,
#licenseTable thead th,
#slaTeamEffortTable thead th {
  position: sticky;
  top: 0;
  z-index: 70;
}

#slaTable tfoot th,
#outsourceTable tfoot th,
#licenseTable tfoot th,
#slaTeamEffortTable tfoot th {
  position: sticky;
  bottom: 0;
  z-index: 90;
  background: var(--bg-table-header) !important;
  box-shadow: inset 0 1px 0 0 var(--border-primary), 0 28px 0 0 var(--bg-table-header) !important;
}

#tab-recurrencies {
  overflow: hidden;
}

#tab-recurrencies > div:first-child {
  flex: 0 0 auto;
}

#tab-recurrencies .sla-sub-content {
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

#tab-recurrencies .sla-sub-content[style*="display:block"],
#tab-recurrencies .sla-sub-content[style*="display: block"] {
  display: flex !important;
}

#tab-recurrencies .sla-sub-content > .table-container {
  flex: 1 1 auto;
  height: auto !important;
  min-height: 0;
}

#tab-recurrencies .table-wrapper {
  max-height: none !important;
  min-height: 0;
}

/* ================================================================
   Role-Based Access Control — UI Restrictions
   ================================================================ */

/* Viewer: disable all inline editable cells */
body.role-viewer td[contenteditable],
body.role-viewer td[data-editable],
body.role-viewer .editable-cell {
  pointer-events: none !important;
  cursor: default !important;
  opacity: 0.85;
}

/* Viewer read-only banner */
body.role-viewer::before {
  content: '👁 Read-Only Mode — Contact your administrator for edit access';
  display: block;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgba(245,158,11,0.12);
  border-top: 1px solid rgba(245,158,11,0.3);
  color: #fcd34d;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  padding: 6px 16px;
  letter-spacing: 0.3px;
  font-family: 'Inter', sans-serif;
}

/* User Management — Last Login column */
.user-last-login {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Resend email button in user table */
.btn-resend-email {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(99,102,241,0.3);
  background: rgba(99,102,241,0.08);
  color: #818cf8;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-resend-email:hover {
  background: rgba(99,102,241,0.2);
  border-color: rgba(99,102,241,0.5);
  color: #a5b4fc;
}

/* Settings Data Management card */
.settings-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 20px 22px;
}

/* ================================================================
   Resource Allocation — Master/Detail Layout
   ================================================================ */
.alloc-master-detail {
  display: flex;
  gap: 0;
  height: 520px;
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-secondary);
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.alloc-left-panel {
  width: 260px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-primary);
  background: var(--bg-card);
}

.alloc-right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-secondary);
}

.alloc-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border-primary);
  background: rgba(0,0,0,0.12);
  flex-shrink: 0;
}

.alloc-count-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.alloc-search-wrap {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-primary);
  flex-shrink: 0;
}

.alloc-search-input {
  width: 100%;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  border: 1px solid var(--border-primary) !important;
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  outline: none !important;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}

.alloc-search-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

.alloc-resource-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.alloc-resource-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background .15s, border-left .15s;
  border-left: 3px solid transparent;
  user-select: none;
}

.alloc-resource-item:hover {
  background: rgba(99,102,241,0.06);
}

.alloc-resource-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(99,102,241,0.08));
  border-left-color: var(--accent);
  color: #e0e7ff;
}

.alloc-resource-item.active .alloc-resource-name {
  font-weight: 700;
  color: #c7d2fe;
}

.alloc-resource-item.active .alloc-resource-badge {
  background: rgba(99,102,241,0.35);
  color: #e0e7ff;
}

.alloc-resource-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.alloc-resource-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 20px;
  text-align: center;
}

.alloc-project-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.alloc-project-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 8px;
  transition: background .15s;
  color: var(--text-primary);
  user-select: none;
}

.alloc-project-item:hover {
  background: rgba(99,102,241,0.06);
}

.alloc-project-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.alloc-project-item.checked {
  background: rgba(99,102,241,0.05);
}

.alloc-project-item.checked .alloc-project-name {
  color: #c7d2fe;
  font-weight: 600;
}

.alloc-project-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alloc-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px 24px;
  gap: 8px;
}

.alloc-empty-state .alloc-empty-icon {
  font-size: 36px;
  opacity: 0.4;
}

.alloc-empty-state .alloc-empty-text {
  font-size: 13px;
  max-width: 220px;
  line-height: 1.5;
}

/* Custom scrollbar for allocation panels */
.alloc-resource-list::-webkit-scrollbar,
.alloc-project-list::-webkit-scrollbar {
  width: 5px;
}

.alloc-resource-list::-webkit-scrollbar-track,
.alloc-project-list::-webkit-scrollbar-track {
  background: transparent;
}

.alloc-resource-list::-webkit-scrollbar-thumb,
.alloc-project-list::-webkit-scrollbar-thumb {
  background: rgba(99,102,241,0.25);
  border-radius: 4px;
}

.alloc-resource-list::-webkit-scrollbar-thumb:hover,
.alloc-project-list::-webkit-scrollbar-thumb:hover {
  background: rgba(99,102,241,0.45);
}
/* ===== Support Tickets ===== */
#tab-support { padding: 20px; }
.active-view-btn { opacity: 1 !important; border-color: var(--accent) !important; }
#ticketKanban::-webkit-scrollbar { height: 6px; }
#ticketKanban::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 3px; }
#ticketDrawer { animation: slideInRight 0.28s cubic-bezier(0.16,1,0.3,1); }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.chatter-tab-btn:hover { color: var(--text-primary) !important; }

/* Viewer mode: neutral top banner, no yellow page overlay */
body.role-viewer::before {
  content: none !important;
  display: none !important;
}

.viewer-mode-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  margin: 0 0 12px;
  border: 1px solid rgba(99,102,241,0.24);
  border-radius: 10px;
  background: rgba(99,102,241,0.08);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

body.role-viewer .viewer-mode-banner {
  display: flex !important;
}

.viewer-mode-banner strong {
  color: var(--text-primary);
}

body.role-viewer [data-viewer-write],
body.role-viewer .viewer-write-action,
body.role-viewer button[onclick*="save"],
body.role-viewer button[onclick*="Save"],
body.role-viewer button[onclick*="add"],
body.role-viewer button[onclick*="Add"],
body.role-viewer button[onclick*="delete"],
body.role-viewer button[onclick*="Delete"],
body.role-viewer button[onclick*="import"],
body.role-viewer button[onclick*="Import"],
body.role-viewer button[onclick*="backup"],
body.role-viewer button[onclick*="Backup"],
body.role-viewer button[onclick*="openProjectModal"],
body.role-viewer button[onclick*="openAddPipelineModal"],
body.role-viewer button[onclick*="openNewModal"],
body.role-viewer button[onclick*="promotePipelineProject"] {
  display: none !important;
}

.system-health-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 18px;
  color: var(--text-primary);
}

.system-health-panel.is-busy {
  opacity: .72;
  pointer-events: none;
}

.system-health-header,
.system-health-actions,
.system-health-columns {
  display: flex;
  gap: 12px;
}

.system-health-header {
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.system-health-title {
  font-size: 14px;
  font-weight: 800;
}

.system-health-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}

.system-health-status {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  padding: 5px 10px;
  text-transform: uppercase;
  white-space: nowrap;
}

.system-health-status.is-healthy {
  background: rgba(16, 185, 129, .14);
  color: #10b981;
}

.system-health-status.is-warning {
  background: rgba(245, 158, 11, .16);
  color: #f59e0b;
}

.system-health-grid,
.system-count-grid {
  display: grid;
  gap: 10px;
}

.system-health-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 14px;
}

.system-health-metric {
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 12px;
}

.system-health-metric span,
.system-health-metric small,
.system-restore-note {
  color: var(--text-muted);
  font-size: 12px;
}

.system-health-metric strong {
  display: block;
  font-size: 16px;
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.system-health-actions {
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.system-health-columns {
  align-items: stretch;
  margin-bottom: 14px;
}

.system-health-columns > div {
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  flex: 1;
  min-width: 0;
  padding: 12px;
}

.system-health-section-title {
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.system-ok-item,
.system-warning-item,
.system-health-loading,
.system-health-error {
  border-radius: 8px;
  font-size: 12px;
  padding: 10px;
}

.system-ok-item {
  background: rgba(16, 185, 129, .1);
  color: #10b981;
}

.system-warning-item {
  background: rgba(245, 158, 11, .12);
  color: #f59e0b;
  margin-top: 6px;
}

.system-health-loading {
  background: rgba(148, 163, 184, .1);
  color: var(--text-muted);
}

.system-health-error {
  background: rgba(239, 68, 68, .12);
  color: #ef4444;
}

.system-count-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.system-count-item {
  align-items: center;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
}

.system-count-item span {
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.system-count-item strong {
  font-size: 13px;
}

@media (max-width: 720px) {
  .system-health-header,
  .system-health-columns {
    flex-direction: column;
  }
}

/* Odoo-style launcher shell */
.app-container {
  padding: 8px 14px 14px;
}

.header {
  min-height: 56px;
  max-height: 72px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(21, 24, 34, 0.82);
  gap: 12px;
}

html[data-theme="light"] .header {
  background: rgba(255, 255, 255, 0.9);
}

.header-left {
  min-width: 0;
  gap: 10px;
}

.header-right {
  flex-shrink: 0;
}

.launcher-hidden-nav {
  display: none !important;
}

#tabNav {
  display: none !important;
}

.page-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.page-top-actions:empty {
  display: none;
}

.top-context-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex: 0 0 auto;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}

.top-context-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.top-context-btn.active {
  background: rgba(99, 102, 241, .14);
  border-color: rgba(99, 102, 241, .34);
  color: var(--text-primary);
}

.top-context-count {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.project-country-btn {
  --country-color: var(--accent);
}

.project-country-btn .country-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--country-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--country-color) 20%, transparent);
}

.project-country-btn.active {
  background: color-mix(in srgb, var(--country-color) 15%, transparent);
  border-color: color-mix(in srgb, var(--country-color) 50%, transparent);
  color: var(--text-primary);
}

.top-context-loading {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
}

body.project-country-theme .header {
  border-color: color-mix(in srgb, var(--project-country-accent) 40%, var(--border-primary));
  box-shadow: inset 0 -2px 0 var(--project-country-accent), var(--shadow-sm);
}

body.project-country-theme #page-projects {
  background:
    radial-gradient(circle at 18% 0%, color-mix(in srgb, var(--project-country-accent) 18%, transparent), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--project-country-accent) 5%, transparent), transparent 220px);
}

body.project-country-theme .projects-plan-shell {
  border-top: 2px solid var(--project-country-accent);
}

.home-return-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(129, 140, 248, .58);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(99, 102, 241, .24), rgba(15, 18, 25, .84));
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px rgba(99, 102, 241, .16), 0 8px 18px rgba(99, 102, 241, .18);
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}

.home-return-btn span:first-child {
  color: #fff;
  font-size: 13px;
  line-height: 1;
}

.home-return-btn:hover {
  border-color: rgba(167, 139, 250, .82);
  background: linear-gradient(135deg, rgba(99, 102, 241, .36), rgba(30, 41, 59, .9));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 0 0 1px rgba(129, 140, 248, .26), 0 10px 22px rgba(99, 102, 241, .26);
}

.page-context {
  display: flex;
  flex-direction: column;
  min-width: 120px;
  line-height: 1.15;
}

.page-context-kicker {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.page-context-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 800;
}

.home-page {
  justify-content: center;
  overflow-y: auto;
}

.home-launcher {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px 0 42px;
}

.home-brand {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.home-eyebrow {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.home-brand h1 {
  color: var(--text-heading);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}

.home-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.home-app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 18px;
}

.home-app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 156px;
  padding: 18px 14px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}

.home-app-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--home-accent, var(--accent));
}

.home-app-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--home-accent, var(--accent)) 55%, transparent);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
}

.home-app-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--home-accent, var(--accent)) 16%, transparent);
  color: var(--home-accent, var(--accent));
  font-size: 25px;
}

.home-app-name {
  font-size: 15px;
  font-weight: 800;
}

.home-app-stat {
  min-height: 18px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.home-accent-red { --home-accent: #ef4444; }
.home-accent-blue { --home-accent: #3b82f6; }
.home-accent-green { --home-accent: #10b981; }
.home-accent-orange { --home-accent: #f97316; }
.home-accent-slate { --home-accent: #64748b; }
.home-accent-violet { --home-accent: #8b5cf6; }
.home-accent-amber { --home-accent: #f59e0b; }
.home-accent-cyan { --home-accent: #06b6d4; }

/* ---- Chat Workspace ---- */
.chat-page {
  min-height: calc(100vh - 116px);
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 16px;
  height: clamp(560px, calc(100vh - 140px), 780px);
  min-height: 0;
}

.chat-contacts-panel,
.chat-thread-panel {
  min-width: 0;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.chat-contacts-panel {
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}

.chat-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-panel-heading h2 {
  margin: 0;
  color: var(--text-heading);
  font-size: 18px;
  font-weight: 800;
}

.chat-panel-heading p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.chat-refresh-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  flex: 0 0 auto;
  border-radius: 8px;
}

.chat-search-input {
  width: 100%;
}

.chat-contacts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  min-height: 0;
}

.chat-contact-btn {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.chat-contact-btn:hover,
.chat-contact-btn.active {
  border-color: var(--border-primary);
  background: var(--bg-secondary);
}

.chat-contact-name {
  overflow: hidden;
  color: var(--text-heading);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-contact-meta {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-unread-pill {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.chat-thread-panel {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.chat-empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  height: 100%;
  gap: 10px;
  color: var(--text-muted);
  font-weight: 700;
}

.chat-empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: rgba(6, 182, 212, .12);
  color: #22d3ee;
  font-size: 26px;
}

.chat-thread {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
}

.chat-thread-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-primary);
}

.chat-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.chat-thread-name {
  color: var(--text-heading);
  font-size: 14px;
  font-weight: 800;
}

.chat-thread-meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.chat-messages-list {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 18px 16px;
}

.chat-messages-list > :first-child {
  margin-top: auto;
}

.chat-message-row {
  display: flex;
  width: 100%;
}

.chat-message-row.mine {
  justify-content: flex-end;
}

.chat-message-row.theirs {
  justify-content: flex-start;
}

.chat-bubble {
  width: fit-content;
  max-width: min(68%, 560px);
  min-height: 0;
  padding: 9px 12px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.4;
  box-sizing: border-box;
}

.chat-bubble.mine {
  border-color: rgba(99, 102, 241, .38);
  background: rgba(99, 102, 241, .18);
}

.chat-bubble-text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-message-time {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}

.chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
  border-top: 1px solid var(--border-primary);
  background: rgba(15, 23, 42, .18);
}

.chat-compose textarea {
  width: 100%;
  min-height: 44px;
  max-height: 96px;
  resize: none;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font: inherit;
  padding: 10px 12px;
  outline: none;
}

.chat-compose textarea:focus {
  border-color: var(--accent);
}

.chat-send-btn {
  width: auto;
  min-width: 76px;
  height: 42px;
  min-height: 0;
  align-self: end;
  border-radius: 8px;
  padding: 0 18px;
}

.wt-activity-select {
  width: 150px;
  max-width: 100%;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 11px;
  padding: 5px 7px;
}

.myts-page {
  gap: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 28px;
  scrollbar-gutter: stable;
}

#team-mytimesheet.myts-page {
  overflow: hidden;
  padding-bottom: 16px;
}

#team-mytimesheet .table-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#team-mytimesheet .table-wrapper {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.myts-status-strip {
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0;
  padding: 12px 14px;
}

.myts-current-status {
  flex: 0 1 640px;
  margin-left: auto;
}

.myts-status-strip-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.myts-status-strip-top {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.myts-status-strip-date {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 800;
}

.myts-status-strip-meta {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.myts-status-strip-note {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.myts-status-strip-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.myts-status-open {
  min-width: 64px;
  padding: 7px 18px;
}

.myts-header,
.myts-panel-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.myts-header {
  align-items: flex-start;
}

.myts-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.myts-actions .filter-input {
  min-width: 260px;
}

.myts-status-grid,
.myts-dashboard-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

#team-mytimesheet .myts-status-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.myts-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 13px 14px;
}

.myts-kpi-clickable {
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
  width: 100%;
}

.myts-kpi-clickable:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.myts-kpi-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.myts-kpi-value {
  color: var(--text-heading);
  font-size: 24px;
  font-weight: 850;
  margin-top: 7px;
}

.myts-kpi-sub {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 4px;
}

.myts-shell,
.myts-manager-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 14px;
}

#team-mytimesheet .myts-shell {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.myts-subtabs {
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.myts-toolbar-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.myts-toolbar-row .myts-subtabs {
  margin-bottom: 0;
}

.myts-toolbar {
  margin-left: auto;
}

.myts-subtab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  padding: 10px 16px;
}

.myts-subtab.active {
  border-bottom-color: var(--accent);
  color: var(--text-primary);
}

.myts-note {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.myts-table {
  min-width: 1120px;
}

#myTimesheetTable tfoot th {
  background: #0b0f17 !important;
  box-shadow: inset 0 2px 0 0 var(--border-primary), 0 -12px 24px rgba(0, 0, 0, .28);
  bottom: 0;
  position: sticky;
  z-index: 95;
}

.myts-table input[type="number"] {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 5px;
  color: var(--text-primary);
  font-size: 12px;
  padding: 5px;
  text-align: center;
  width: 54px;
}

.myts-table input[type="number"]:focus {
  border-color: var(--accent);
  outline: none;
}

.myts-row-meta {
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 2px;
}

.myts-special-row td {
  background: rgba(99, 102, 241, .04);
}

.myts-approval-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.myts-status-detail-card {
  max-width: 760px;
}

.myts-status-detail-list {
  display: grid;
  gap: 10px;
  max-height: min(60vh, 520px);
  overflow: auto;
}

.myts-approval-card {
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  padding: 12px;
}

.myts-current-card {
  align-items: center;
  border-left: 3px solid var(--accent);
}

.myts-approval-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.myts-status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  text-transform: capitalize;
}

.myts-status-pill.pending {
  background: rgba(245, 158, 11, .16);
  color: #fbbf24;
}

.myts-status-pill.approved {
  background: rgba(34, 197, 94, .16);
  color: #4ade80;
}

.myts-status-pill.rejected {
  background: rgba(239, 68, 68, .16);
  color: #f87171;
}

.myts-status-pill.draft {
  background: rgba(99, 102, 241, .16);
  color: #a5b4fc;
}

.myts-detail-modal {
  align-items: center;
  background: rgba(0, 0, 0, .62);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 9999;
}

.myts-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .5);
  max-height: 86vh;
  max-width: 980px;
  overflow: auto;
  padding: 18px;
  width: min(980px, 96vw);
}

.activity-modal-grid {
  display: grid;
  gap: 12px;
}

@media (max-width: 900px) {
  .myts-current-status {
    flex-basis: 100%;
    margin-left: 0;
  }

  .myts-status-strip {
    align-items: flex-start;
  }

  .myts-status-strip-note {
    white-space: normal;
  }

  .myts-status-strip-actions {
    align-items: flex-start;
    flex-direction: column;
    margin-left: 0;
  }

  #team-mytimesheet .myts-status-grid {
    grid-template-columns: 1fr;
  }

  .header {
    align-items: flex-start;
    max-height: none;
    flex-wrap: wrap;
  }

  .header-right {
    justify-content: flex-end;
  }

  .page-top-actions {
    order: 3;
    width: 100%;
    flex-basis: 100%;
  }

  .page-context {
    display: none;
  }

  .home-brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .chat-contacts-panel,
  .chat-thread-panel {
    min-height: 360px;
  }
}

@media (max-width: 620px) {
  .app-container {
    padding: 8px;
  }

  .header {
    gap: 8px;
  }

  .header-left,
  .header-right {
    width: 100%;
  }

  .home-app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .home-app-card {
    min-height: 136px;
  }
}

/* ── Mobile-friendly My Timesheet entry (Resource module go-live) ── */
@media (max-width: 760px) {
  .myts-page { padding: 8px !important; }
  .myts-page .table-wrapper,
  .myts-page .always-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .myts-page .myts-table { font-size: 12px; min-width: 720px; }
  .myts-page .myts-table th,
  .myts-page .myts-table td { padding: 6px 4px; }
  .myts-page .myts-table input[type="number"],
  .myts-page .myts-table input[type="text"],
  .myts-page .myts-table select {
    min-height: 36px;
    font-size: 14px;
    padding: 6px;
    width: 100%;
    box-sizing: border-box;
  }
  .myts-page .filter-input,
  .myts-page .filter-select { min-height: 36px; font-size: 14px; }
  .myts-page .btn { min-height: 38px; padding: 8px 12px; }
}
@media (max-width: 480px) {
  .myts-page .myts-table { min-width: 640px; }
}
/* LIVE_ENVIRONMENT_OVERRIDE_START */
.environment-badge {
  border-color: rgba(34, 197, 94, 0.65) !important;
  background: rgba(34, 197, 94, 0.16) !important;
  color: #86efac !important;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.08), 0 8px 20px rgba(34, 197, 94, 0.12) !important;
}
.environment-badge::before {
  background: #22c55e !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18) !important;
}
html[data-theme="light"] .environment-badge {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-color: #22c55e !important;
}
/* LIVE_ENVIRONMENT_OVERRIDE_END */
