/* ============================================================
   LOKAL Task Board — Brand-Aligned
   Warm cream, deep navy, burnt orange accent
   Matching lokal.ph editorial aesthetic
   ============================================================ */

:root {
  --bg-base: #f5f0e8;
  --bg-surface: #faf7f2;
  --bg-raised: #fff;
  --bg-hover: #f0ebe2;
  --bg-active: #e8e2d8;
  --border: #ddd6c8;
  --border-subtle: #e8e2d8;
  --text-primary: #1a1a2e;
  --text-secondary: #3a3a52;
  --text-muted: #8a8898;
  --accent: #c96b2e;
  --accent-hover: #b55e26;
  --accent-dim: rgba(201, 107, 46, 0.08);
  --accent-border: rgba(201, 107, 46, 0.2);
  --status-overdue: #b8352a;
  --status-week: #1a1a2e;
  --status-nodate: #8a8898;
  --status-completed: #3a7a52;
  --stat-tasks: #1a1a2e;
  --stat-projects: #6a5acd;
  --stat-overdue: #b8352a;
  --stat-unassigned: #c96b2e;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  padding: 20px;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============================================================
   Container
   ============================================================ */
.container {
  max-width: 100%;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}

/* ============================================================
   Header
   ============================================================ */
.header {
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 32px 36px 28px;
  border-bottom: 1px solid var(--border);
}
.header h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  line-height: 1.1;
}
.header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.2px;
}
.header p::before {
  content: '\25C6';
  color: var(--accent);
  margin-right: 6px;
  font-size: 8px;
  vertical-align: middle;
}

/* ============================================================
   Stats Bar
   ============================================================ */
.stats-bar {
  display: flex;
  gap: 0;
  padding: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.stat-card {
  flex: 1;
  min-width: 140px;
  background: transparent;
  padding: 20px 28px;
  text-align: left;
  border-right: 1px solid var(--border);
  transition: background 0.15s;
}
.stat-card:last-child { border-right: none; }
.stat-card:hover { background: var(--bg-hover); }
.stat-card .val {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -1px;
}
.stat-card .lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 6px;
  font-weight: 500;
}
.stat-card.tasks .val { color: var(--stat-tasks); }
.stat-card.projects .val { color: var(--stat-projects); }
.stat-card.overdue .val { color: var(--stat-overdue); }
.stat-card.unassigned .val { color: var(--stat-unassigned); }
.stat-card.adhoc .val { color: #8b5cf6; }

/* ============================================================
   Week Bar
   ============================================================ */
.week-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 36px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-wrap: wrap;
  gap: 10px;
}
.week-selector { display: flex; align-items: center; gap: 2px; }
.week-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  transition: all 0.15s;
}
.week-btn:hover { color: var(--text-primary); border-color: #bbb5a8; }
.week-label {
  padding: 6px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  min-width: 230px;
  text-align: center;
  transition: all 0.15s;
  font-family: var(--font-body);
}
.week-label:hover { border-color: #bbb5a8; }
.week-label.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.week-label.current:hover { background: var(--accent-hover); }

.week-actions { display: flex; align-items: center; gap: 14px; }
.fetched-at { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   Filter Bar (Unified Panel)
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 36px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: all 0.15s;
}
.filter-trigger:hover { border-color: #bbb5a8; color: var(--text-primary); }
.filter-trigger.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.filter-icon { font-size: 14px; opacity: 0.5; }
.active-count {
  display: none;
  background: var(--accent);
  color: #fff;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}
.active-count.visible { display: inline; }

.active-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  align-items: center;
}
.no-filters-msg {
  font-size: 12px;
  color: var(--text-muted);
}
.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}
.filter-tag .tag-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 2px;
}
.filter-tag .tag-remove {
  cursor: pointer;
  opacity: 0.5;
  font-size: 13px;
  line-height: 1;
  margin-left: 2px;
}
.filter-tag .tag-remove:hover { opacity: 1; }

.reset-btn {
  display: none;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: all 0.15s;
  white-space: nowrap;
}
.reset-btn.visible { display: block; }
.reset-btn:hover { color: var(--status-overdue); border-color: var(--status-overdue); }

/* ============================================================
   Filter Panel
   ============================================================ */
.filter-panel {
  display: none;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(26, 26, 46, 0.06);
  padding: 24px 36px;
}
.filter-panel.open { display: block; }
.filter-panel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.filter-section h4 {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}
.filter-section label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.1s;
}
.filter-section label:hover { color: var(--text-primary); }
.filter-section label input { accent-color: var(--accent); }
.filter-section-wide { grid-column: span 2; }
.filter-projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.filter-chip:hover { border-color: #bbb5a8; color: var(--text-primary); }
.filter-chip.selected {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 500;
}
.filter-chip input { display: none; }
.filter-radio-group { display: flex; flex-direction: column; gap: 2px; }
.filter-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.filter-radio:hover { color: var(--text-primary); }
.filter-radio input { accent-color: var(--accent); }

/* ============================================================
   Controls (icon buttons in filter bar)
   ============================================================ */
.filter-bar-right {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  transition: all 0.15s;
}
.icon-btn:hover { border-color: #bbb5a8; color: var(--text-primary); }
.btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: all 0.15s;
}
.btn:hover { border-color: #bbb5a8; color: var(--text-primary); }
.refresh-btn {
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.refresh-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.refresh-btn.loading { opacity: 0.5; pointer-events: none; }

/* ============================================================
   Legend
   ============================================================ */
.legend {
  padding: 8px 36px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  background: var(--bg-surface);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.overdue { background: var(--status-overdue); }
.dot.week { background: var(--status-week); }
.dot.nodate { background: var(--status-nodate); }
.dot.completed { background: var(--status-completed); }

/* ============================================================
   Table
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--text-primary);
  color: rgba(255,255,255,0.65);
  padding: 12px 10px;
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
thead th:hover { color: #fff; }
thead th:first-child { min-width: 220px; }
thead th .badge {
  background: rgba(201,107,46,0.35);
  color: rgba(255,255,255,0.9);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  margin-left: 6px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
thead th .sort-arrow { margin-left: 4px; font-size: 9px; opacity: 0.3; }
thead th .sort-arrow.active { opacity: 1; color: var(--accent); }

/* ============================================================
   Project Rows
   ============================================================ */
.project-header {
  cursor: pointer;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.12s;
}
.project-header:hover { background: var(--bg-active); }
.project-header td {
  padding: 11px 10px;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  border-right: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.project-header td:first-child { padding-left: 16px; }
.arrow {
  display: inline-block;
  width: 16px;
  font-size: 9px;
  color: var(--text-muted);
  transition: transform 0.2s ease, color 0.15s;
}
.project-header:hover .arrow { color: var(--accent); }
.project-header.expanded .arrow { transform: rotate(90deg); color: var(--accent); }
.proj-name {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}
.proj-name:hover { color: var(--accent); }
.cell-count {
  display: inline-block;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.cell-count.zero { background: transparent; color: transparent; }
.cell-count.done { background: rgba(58, 122, 82, 0.1); color: var(--status-completed); }

/* Pod Group Headers */
.pod-header {
  background: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s;
}
.pod-header:hover { background: #252540; }
.pod-header td {
  padding: 8px 16px;
  font-family: var(--font-display);
  font-size: 14px;
  color: #fff;
  font-weight: 400;
  border: none;
}
.pod-arrow {
  display: inline-block;
  width: 16px;
  font-size: 9px;
  color: rgba(255,255,255,0.4);
  transition: transform 0.2s ease, color 0.15s;
  margin-right: 6px;
}
.pod-header:hover .pod-arrow { color: rgba(255,255,255,0.8); }
.pod-header.expanded .pod-arrow { transform: rotate(90deg); color: var(--accent); }
.pod-name { margin-right: 10px; }
.pod-count {
  font-family: var(--font-body);
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  font-weight: 400;
}

/* Lead tag next to project name */
.proj-lead {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 8px;
  padding: 1px 7px;
  background: var(--bg-base);
  border-radius: 10px;
}

/* Monthly completion % */
.proj-completion {
  font-size: 10px;
  font-weight: 600;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 10px;
}
.proj-completion.low { color: var(--text-muted); background: rgba(138, 136, 152, 0.1); }
.proj-completion.mid { color: var(--accent); background: var(--accent-dim); }
.proj-completion.high { color: var(--status-completed); background: rgba(58, 122, 82, 0.1); }
.proj-completion.full { color: var(--status-completed); background: rgba(58, 122, 82, 0.15); }
.completion-bar-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(0,0,0,0.04);
}
.completion-bar {
  height: 100%;
  border-radius: 0 1px 1px 0;
  transition: width 0.3s ease;
}
.completion-bar.low { background: var(--text-muted); opacity: 0.3; }
.completion-bar.mid { background: var(--accent); opacity: 0.4; }
.completion-bar.high { background: var(--status-completed); opacity: 0.5; }
.completion-bar.full { background: var(--status-completed); opacity: 0.6; }

/* Empty project rows */
.project-header.empty-project { opacity: 0.45; }
.project-header.empty-project:hover { opacity: 0.7; }

/* ============================================================
   Task Detail Rows
   ============================================================ */
.task-detail { display: none; }
.task-detail.visible { display: table-row; }
.task-detail td {
  padding: 8px 10px;
  vertical-align: top;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.task-detail td:first-child {
  background: var(--bg-hover);
}

/* ============================================================
   Task Links
   ============================================================ */
.task-link {
  display: block;
  padding: 3px 0;
  text-decoration: none;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  transition: color 0.12s;
}
.task-link:hover { color: var(--text-primary); }
.task-link.overdue { color: var(--status-overdue); font-weight: 500; }
.task-link.overdue:hover { color: #d44035; }
.task-link.this_week { color: var(--status-week); font-weight: 500; }
.task-link.no_date { color: var(--text-muted); }
.task-link.no_date:hover { color: var(--text-secondary); }
.task-link.completed { color: var(--status-completed); text-decoration: line-through; opacity: 0.6; }
.task-link.completed:hover { opacity: 1; }
.due-tag { font-size: 10px; color: var(--text-muted); margin-left: 4px; }
.due-tag.overdue { color: var(--status-overdue); opacity: 0.75; }
.due-tag.completed { color: var(--status-completed); opacity: 0.6; }
.source-icon { font-size: 10px; margin-right: 3px; opacity: 0.25; }

/* ============================================================
   Loading Overlay
   ============================================================ */
.loading-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(250,247,242,0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 16px;
}
.loading-overlay.visible { display: flex; }
.loading-overlay p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: var(--text-muted);
}
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Progress Bar (manual refresh)
   ============================================================ */
.progress-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 250;
  height: 28px;
  background: var(--bg-active);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
.progress-bar.visible { display: block; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  width: 0%;
  transition: width 0.4s ease;
}
.progress-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: none;
}

/* Silent refresh indicator */
.fresh-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--status-completed);
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  animation: pulse-dot 2s ease-out;
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(58,122,82,0.5); }
  70% { box-shadow: 0 0 0 6px rgba(58,122,82,0); }
  100% { box-shadow: 0 0 0 0 rgba(58,122,82,0); }
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  padding: 16px 36px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  letter-spacing: 0.2px;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
  padding: 60px 32px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ============================================================
   Tab Bar
   ============================================================ */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.tab-bar .tab {
  padding: 12px 24px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: color 0.15s;
}
.tab-bar .tab:hover { color: var(--text-secondary); }
.tab-bar .tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   Monthly View
   ============================================================ */
.monthly-view {
  background: var(--bg-surface);
}

.monthly-legend {
  display: flex;
  gap: 18px;
  padding: 10px 36px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-muted);
}
.monthly-legend span { display: flex; align-items: center; gap: 4px; }
.m-dot { width: 8px; height: 3px; border-radius: 2px; }
.m-dot.green { background: var(--status-completed); }
.m-dot.orange { background: var(--accent); }
.m-dot.gray { background: var(--bg-active); }

.monthly-month-cols {
  display: grid;
  grid-template-columns: 200px repeat(3, 1fr);
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
}
.monthly-month-cols .m-col {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.monthly-month-cols .m-col.current { color: var(--accent); }

/* Pod header in monthly view */
.monthly-body .m-pod {
  padding: 10px 20px;
  background: var(--text-primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.monthly-body .m-pod-stat {
  font-family: var(--font-body);
  font-size: 10px;
  color: rgba(255,255,255,0.5);
}

/* Project row */
.m-project-row {
  display: grid;
  grid-template-columns: 200px repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.m-project-row:hover { background: var(--bg-hover); }

.m-project-label {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.m-project-label .m-pname {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.3;
}
.m-project-label .m-plead {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Month cell */
.m-cell {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.m-cell:last-child { border-right: none; }
.m-cell.empty {
  display: flex;
  align-items: center;
  justify-content: center;
}
.m-cell .empty-label {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* Headline: grade + pct */
.m-headline {
  display: flex;
  align-items: center;
  gap: 10px;
}
.m-grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.m-grade.a { background: var(--status-completed); color: #fff; }
.m-grade.b { background: rgba(58,122,82,0.08); color: var(--status-completed); border: 1.5px solid var(--status-completed); }
.m-grade.c { background: var(--accent-dim); color: var(--accent); border: 1.5px solid var(--accent); }
.m-grade.d { background: rgba(184,53,42,0.08); color: var(--status-overdue); border: 1.5px solid var(--status-overdue); }
.m-grade.f { background: var(--status-overdue); color: #fff; }
.m-grade.ip { background: var(--accent-dim); color: var(--accent); font-size: 10px; font-weight: 700; }

.m-headline-text { display: flex; flex-direction: column; }
.m-headline-pct {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-display);
  line-height: 1;
}
.m-headline-summary {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.m-pct-green { color: var(--status-completed); }
.m-pct-orange { color: var(--accent); }
.m-pct-red { color: var(--status-overdue); }

.m-adhoc-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
  margin-left: auto;
}

/* Stacked bar */
.m-bar-wrap { display: flex; flex-direction: column; gap: 3px; }
.m-track {
  height: 6px;
  background: var(--bg-active);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  width: 100%;
}
.m-fill { height: 100%; position: absolute; top: 0; }
.m-fill-green { background: var(--status-completed); border-radius: 3px 0 0 3px; }
.m-fill-orange { background: var(--accent); }
.m-fill-faded { background: var(--status-completed); opacity: 0.3; }

.m-bar-legend {
  display: flex;
  gap: 10px;
  font-size: 9px;
  color: var(--text-muted);
}
.m-bar-legend span { display: flex; align-items: center; gap: 3px; }
.m-bar-legend .dot { width: 6px; height: 6px; border-radius: 2px; flex-shrink: 0; }
.m-bar-legend .dot.g { background: var(--status-completed); }
.m-bar-legend .dot.o { background: var(--accent); }
.m-bar-legend .dot.r { background: var(--bg-active); }
.m-bar-legend .num { font-weight: 600; color: var(--text-secondary); }
.m-bar-legend .text-green { color: var(--status-completed); }
.m-bar-legend .text-red { color: var(--status-overdue); }
.m-bar-legend .text-orange { color: var(--accent); }

/* Metrics line */
.m-metrics {
  display: flex;
  gap: 16px;
  font-size: 10px;
  color: var(--text-muted);
}
.m-met { display: flex; align-items: center; gap: 4px; }
.m-met-val { font-weight: 600; }
.m-met-val.fast { color: var(--status-completed); }
.m-met-val.med { color: var(--accent); }
.m-met-val.slow { color: var(--status-overdue); }
.m-met-val.hrs { color: var(--stat-projects); }
.m-met-val.hrs-warn { color: var(--status-overdue); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  body { padding: 10px; }
  .stats-bar { flex-direction: column; }
  .stat-card { border-right: none; border-bottom: 1px solid var(--border); }
  .filter-bar { flex-direction: column; align-items: flex-start; padding: 10px 20px; }
  .week-bar { flex-direction: column; padding: 12px 20px; }
  .header { padding: 24px 20px; }
  .legend { padding: 8px 20px; }
}

/* ============================================================
   Utilization Tab
   ============================================================ */
.utilization-view { padding: 16px 20px 40px; }

.util-period-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.util-period-buttons { display: flex; gap: 6px; }
.util-period-btn {
  padding: 6px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-surface);
  font-family: var(--font-body); font-size: 13px;
  color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
}
.util-period-btn:hover { background: var(--bg-hover); }
.util-period-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.util-period-label {
  font-size: 13px; color: var(--text-muted); font-style: italic;
  max-width: 55%; text-align: right; line-height: 1.5;
}

.util-allocation { margin-bottom: 24px; }
.util-alloc-bar {
  display: flex; height: 28px; border-radius: var(--radius-sm);
  overflow: hidden; margin-bottom: 8px;
}
.util-alloc-segment { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 500; color: #fff; min-width: 30px; }
.util-alloc-segment.deliverable { background: var(--accent); }
.util-alloc-segment.investment { background: var(--accent); }
.util-alloc-segment.overhead { background: var(--border); }
.util-alloc-segment.revenue { background: var(--status-completed); }
.util-alloc-legend {
  display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary);
}
.util-alloc-legend span { display: flex; align-items: center; gap: 4px; }
.util-alloc-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.util-section { margin-bottom: 32px; padding-top: 24px; border-top: 1px solid var(--border-subtle); }
.util-allocation + .util-section { border-top: none; padding-top: 0; }
.util-section h3 {
  font-family: var(--font-display); font-size: 20px; font-weight: 400;
  margin-bottom: 12px; color: var(--text-primary);
}

.util-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.util-table th {
  text-align: left; padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.3px; color: var(--text-muted);
  white-space: nowrap;
}
.util-table th[data-sort-key] { cursor: pointer; }
.util-table th[data-sort-key]:hover { color: var(--text-secondary); }
.util-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.util-table tr:hover td { background: var(--bg-hover); }
.util-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.util-badge {
  display: inline-block; padding: 2px 8px;
  border-radius: var(--radius-sm); font-size: 11px; font-weight: 600;
}
.util-badge.overloaded { background: rgba(184, 53, 42, 0.1); color: var(--status-overdue); }
.util-badge.fully_utilized { background: rgba(58, 122, 82, 0.1); color: var(--status-completed); }
.util-badge.moderate { background: rgba(201, 107, 46, 0.1); color: var(--accent); }
.util-badge.low { background: rgba(138, 136, 152, 0.1); color: var(--text-muted); }
.util-badge.critical_underlog { background: rgba(184, 53, 42, 0.15); color: var(--status-overdue); font-weight: 700; }

.util-table .expand-row { cursor: pointer; }
.util-table .expand-arrow { display: inline-block; transition: transform 0.15s; margin-right: 4px; font-size: 10px; }
.util-table .expand-row.expanded .expand-arrow { transform: rotate(90deg); }
.util-table .detail-row { display: none; }
.util-table .detail-row.visible { display: table-row; }
.util-table .detail-row td { padding-left: 28px; font-size: 12px; color: var(--text-secondary); background: var(--bg-base); }

.util-alerts { padding-top: 24px; border-top: 1px solid var(--border-subtle); }
.util-alert {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 8px;
  border-radius: var(--radius-sm); font-size: 13px;
  border-left: 3px solid var(--accent);
  background: var(--accent-dim); color: var(--text-secondary);
}
.util-alert.alert-overloaded { border-left-color: var(--status-overdue); background: rgba(184, 53, 42, 0.05); }
.util-alert.alert-underlog { border-left-color: var(--accent); }
.util-alert.alert-no_timesheet { border-left-color: var(--text-muted); background: rgba(138, 136, 152, 0.05); }

.util-bar-wrap { width: 100px; height: 10px; background: var(--border); border-radius: 3px; display: inline-block; vertical-align: middle; margin-left: 6px; }
.util-bar-fill { display: block; height: 100%; border-radius: 3px; }
.util-bar-fill.green { background: var(--status-completed); }
.util-bar-fill.yellow { background: var(--accent); }
.util-bar-fill.red { background: var(--status-overdue); }

/* Sort indicators */
.util-table th.sortable { cursor: pointer; user-select: none; }
.util-table th.sortable:hover { color: var(--text-primary); }
.util-table th .sort-arrow { font-size: 10px; margin-left: 4px; opacity: 0.4; }
.util-table th.sort-active .sort-arrow { opacity: 1; color: var(--accent); }

/* Group header rows (Client / Internal) */
.util-table .group-header td {
  padding: 10px 10px 6px; font-size: 12px; color: var(--text-secondary);
  border-bottom: 1px solid var(--border); background: var(--bg-base);
}

/* Leave indicator */
.leave-tag {
  display: inline-block; font-size: 10px; font-weight: 500;
  color: var(--text-muted); background: var(--bg-active);
  padding: 1px 6px; border-radius: 3px; margin-left: 6px;
  vertical-align: middle; letter-spacing: 0.2px;
}

/* Logging health coverage colors */
.coverage-critical { color: var(--status-overdue); font-weight: 600; }
.coverage-low { color: var(--accent); font-weight: 600; }
.coverage-good { color: var(--status-completed); }

/* Insight cards */
.insight-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; margin-bottom: 10px;
  border-radius: var(--radius-sm); font-size: 13px;
  border-left: 3px solid var(--text-muted);
  background: var(--bg-raised);
}
.insight-card.critical { border-left-color: var(--status-overdue); background: rgba(184, 53, 42, 0.04); }
.insight-card.warning { border-left-color: var(--accent); background: var(--accent-dim); }
.insight-card.success { border-left-color: var(--status-completed); background: rgba(58, 122, 82, 0.04); }
.insight-card.info { border-left-color: var(--text-primary); background: rgba(26, 26, 46, 0.03); }
.insight-headline { font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.insight-detail { color: var(--text-secondary); line-height: 1.4; }

/* Insight card headline colors */
.insight-card.critical .insight-headline { color: var(--status-overdue); }
.insight-card.warning .insight-headline { color: var(--accent); }
.insight-card.success .insight-headline { color: var(--status-completed); }

/* Benchmark table column widths */
#util-benchmarks-table { table-layout: fixed; }
#util-benchmarks-table th:first-child { width: 28%; }
#util-benchmarks-table th:nth-child(2) { width: 10%; }

/* Benchmark delta colors */
.delta-good { color: var(--status-completed); }
.delta-warn { color: var(--accent); }
.delta-bad { color: var(--status-overdue); }

/* ============================================================
   Forecast Tab
   ============================================================ */
.forecast-view { padding: 0 24px 24px; }

.fc-period-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 0; border-bottom: 1px solid var(--border-subtle);
}
.fc-period-buttons { display: flex; gap: 6px; }
.fc-period-btn {
  padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-surface); cursor: pointer; font-size: 13px; color: var(--text-secondary);
  font-family: var(--font-body);
}
.fc-period-btn:hover { background: var(--bg-hover); }
.fc-period-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.fc-period-label { font-size: 13px; color: var(--text-muted); margin-left: auto; }

.fc-summary-card {
  margin: 20px 0 16px;
  padding: 16px 20px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.fc-summary-title {
  font-family: var(--font-display);
  font-size: 18px; color: var(--text-primary);
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.fc-summary-metrics {
  display: flex;
  gap: 24px;
  justify-content: flex-start;
}
.fc-metric { text-align: center; min-width: 80px; }
.fc-metric-value {
  font-size: 20px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.fc-metric-label {
  font-size: 11px; color: var(--text-muted);
  margin-top: 2px;
}

.fc-chart-wrap {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 160px;
}

.fc-meta {
  display: flex; gap: 16px; margin-bottom: 20px;
  font-size: 12px; color: var(--text-muted);
}
.fc-meta span { display: flex; align-items: center; gap: 4px; }

.fc-capacity-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.fc-capacity-pill.green { background: rgba(58, 122, 82, 0.12); color: var(--status-completed); }
.fc-capacity-pill.yellow { background: rgba(201, 107, 46, 0.12); color: var(--accent); }
.fc-capacity-pill.red { background: rgba(184, 53, 42, 0.12); color: var(--status-overdue); }

.fc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fc-table th {
  padding: 8px 12px; text-align: left; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.fc-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); }
.fc-table tr:hover td { background: var(--bg-hover); }
.fc-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.fc-pod-header {
  background: var(--bg-base);
  font-weight: 600;
  font-size: 13px;
}
.fc-pod-header td {
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text-primary);
}
.fc-pod-meta {
  font-weight: 400; font-size: 11px; color: var(--text-muted);
  margin-left: 8px;
}
.fc-ghost-tag {
  display: inline-block;
  font-size: 10px; color: var(--text-muted); font-style: italic;
}
.fc-group-header td {
  padding: 14px 12px 6px;
  font-family: var(--font-display);
  font-size: 16px; font-weight: 600;
  color: var(--accent);
  border-bottom: 2px solid var(--accent-border);
  background: transparent;
}
.fc-section-title {
  font-family: var(--font-display);
  font-size: 16px; color: var(--text-primary);
  margin: 24px 0 12px; padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}
