/* ═══════════════════════════════════════════════════════════════
   BOARD — Dashboard Home: Header, Layout, Kanban, Execs, Sidebar
   ═══════════════════════════════════════════════════════════════ */

/* ── App Header ── */
.app-header {
  background: rgba(20,20,20,0.88); border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-3) var(--space-6); display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: var(--space-3);
  position: sticky; top: 0; z-index: 100; backdrop-filter: blur(12px);
}
.app-header-left { display: flex; align-items: center; gap: var(--space-4); }
.app-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text-primary); }
.app-header-right { display: flex; align-items: center; gap: var(--space-4); }
.app-header-timestamp { font-size: var(--text-xs); color: var(--text-tertiary); }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.toggle-text { font-size: var(--text-xs); color: var(--text-secondary); }
.toggle-wrap input { display: none; }
.toggle-track {
  width: 34px; height: 18px; background: var(--border-default); border-radius: 9px;
  position: relative; transition: background var(--duration-fast);
}
.toggle-thumb {
  width: 14px; height: 14px; background: var(--text-primary); border-radius: 50%;
  position: absolute; top: 2px; left: 2px; transition: transform var(--duration-fast);
}
.toggle-wrap input:checked + .toggle-track { background: var(--accent); }
.toggle-wrap input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); }

/* Notifications */
.notif-bell-wrap { position: relative; }
.notif-bell { background: none; border: none; font-size: 1.1rem; cursor: pointer; padding: var(--space-1); }
.notif-badge { position: absolute; top: -4px; right: -4px; font-size: 0.6rem; font-weight: var(--weight-bold);
  background: var(--error); color: #fff; border-radius: var(--radius-full); padding: 1px 5px; min-width: 16px; text-align: center; }
.notif-badge.hidden { display: none; }
.notif-dropdown {
  position: absolute; top: 100%; right: 0; width: 340px; background: var(--bg-surface);
  border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
  display: none; z-index: 200; max-height: 400px; overflow-y: auto; margin-top: var(--space-2);
}
.notif-dropdown.open { display: block; }
.notif-dropdown-header { display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle);
  font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.notif-list { padding: var(--space-2); }
.notif-empty { padding: var(--space-6); text-align: center; color: var(--text-muted); font-size: var(--text-sm); }

/* ── Toolbar ── */
.app-toolbar {
  padding: var(--space-3) var(--space-6); display: flex; align-items: center; gap: var(--space-3);
  flex-wrap: wrap; border-bottom: 1px solid var(--border-subtle); background: var(--bg-surface);
}
.toolbar-search { flex: 1; min-width: 180px; max-width: 320px; position: relative; }
.toolbar-search-icon { position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: var(--text-sm); }
.toolbar-search input { width: 100%; padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8); font-size: var(--text-sm); }
.app-toolbar select { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); cursor: pointer; }
.toolbar-actions { display: flex; gap: var(--space-2); margin-left: auto; }

/* ── Tab Panels ── */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s var(--ease-default); }
.panel-wrap { padding: var(--space-6); max-width: var(--content-max-width); margin: 0 auto; }
.panel-section-label {
  font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: var(--space-3);
}

/* ── Loading spinner ── */
.panel-loading { display: flex; align-items: center; justify-content: center; gap: var(--space-3);
  padding: var(--space-16); color: var(--text-secondary); }
.panel-spinner { width: 24px; height: 24px; border: 2px solid var(--border-default);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Board Layout ── */
.board-layout { display: grid; grid-template-columns: 1fr 280px; gap: 0; min-height: calc(100vh - 140px); }
.board-main { padding: var(--space-4) var(--space-6); overflow-y: auto; }
.board-sidebar {
  background: var(--bg-surface); border-left: 1px solid var(--border-subtle);
  padding: var(--space-4); overflow-y: auto;
}
.board-sidebar-section { margin-bottom: var(--space-6); }
.board-sidebar-title {
  font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: var(--space-3);
}

/* Metric rows */
.metric-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--text-sm);
}
.metric-row:last-child { border-bottom: none; }
.metric-label { color: var(--text-secondary); }
.metric-val { font-weight: var(--weight-semibold); color: var(--text-primary); }
.metric-val.muted { color: var(--text-muted); font-weight: var(--weight-normal); font-size: var(--text-xs); }
.metric-val.accent { color: var(--accent-text); }
.metric-val.info { color: var(--info); }
.metric-val.error { color: var(--error); }
.metric-val.warning { color: var(--warning); }

/* Helper text */
.text-xs { font-size: var(--text-xs); }
.text-tertiary { color: var(--text-tertiary); }
.text-semibold { font-weight: var(--weight-semibold); }

/* ── Executive Grid ── */
.exec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-6); }
.exec-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: var(--space-4); cursor: pointer; transition: all var(--duration-normal) var(--ease-default);
  position: relative; overflow: hidden;
}
.exec-card:hover { border-color: var(--border-default); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.exec-card.expanded { grid-column: 1 / -1; }
.exec-card .exec-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-1); }
.exec-card .exec-name { font-weight: var(--weight-semibold); font-size: var(--text-base); }
.exec-card .exec-role { font-size: var(--text-xs); color: var(--text-secondary); }
.exec-card .exec-focus { font-size: var(--text-sm); color: var(--text-secondary); margin-top: var(--space-1); line-height: var(--leading-normal); }
.exec-card .exec-date { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-1); }
.exec-card .health { font-size: var(--text-xs); }
.exec-tasks { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); display: none; }
.exec-card.expanded .exec-tasks { display: block; }
.exec-task-item { padding: var(--space-1) 0; font-size: var(--text-sm); color: var(--text-secondary); display: flex; align-items: center; gap: var(--space-2); }

/* ── Kanban ── */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-bottom: var(--space-6); min-height: 350px; }
.kanban-column {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 280px;
  transition: border-color var(--duration-normal);
}
.kanban-column.drag-over { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-muted); }
.kanban-header {
  padding: var(--space-3) var(--space-4); font-size: var(--text-sm); font-weight: var(--weight-semibold);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.kanban-count {
  background: var(--bg-elevated); border-radius: var(--radius-full);
  padding: 1px 7px; font-size: var(--text-xs); font-weight: var(--weight-medium);
  color: var(--text-secondary);
}
.kanban-column[data-column="urgent"] .kanban-header { border-top: 3px solid var(--error); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.kanban-column[data-column="in-progress"] .kanban-header { border-top: 3px solid var(--info); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.kanban-column[data-column="up-next"] .kanban-header { border-top: 3px solid var(--warning); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.kanban-column[data-column="done"] .kanban-header { border-top: 3px solid var(--success); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

.kanban-body { padding: var(--space-2); flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-2); }

.task-card {
  background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: var(--space-3); cursor: grab; transition: all var(--duration-fast); user-select: none;
}
.task-card:hover { border-color: var(--border-default); box-shadow: var(--shadow-sm); }
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.5; transform: rotate(2deg); }
.task-card .task-title { font-size: var(--text-sm); font-weight: var(--weight-medium); margin-bottom: var(--space-2); line-height: var(--leading-tight); }
.task-card .task-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-1); flex-wrap: wrap; }
.task-card .task-owner { font-size: var(--text-xs); color: var(--text-secondary); }
.task-card .task-tags { display: flex; gap: 3px; flex-wrap: wrap; margin-top: var(--space-1); }
.skill-tag { font-size: 0.6rem; padding: 1px 5px; background: var(--purple-muted); color: var(--purple); border-radius: 3px; font-weight: var(--weight-medium); }
.skill-badge {
  display: inline-flex; align-items: center; gap: 2px; font-size: 0.62rem; padding: 2px 6px;
  background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: 4px;
  cursor: default; white-space: nowrap; transition: all var(--duration-fast);
}
.skill-badge:hover { border-color: var(--accent); background: var(--accent-muted); }
.skill-badge .skill-icon { font-size: var(--text-xs); }
.skill-badge .skill-name { color: var(--text-secondary); font-weight: var(--weight-medium); }
.skills-sidebar-section { margin-bottom: var(--space-4); }
.skills-sidebar-section h4 {
  font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin: var(--space-3) 0 var(--space-2);
  display: flex; align-items: center; gap: var(--space-1);
}
.skills-sidebar-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3px 6px; border-radius: 4px; font-size: var(--text-xs); cursor: pointer;
  transition: background var(--duration-fast);
}
.skills-sidebar-item:hover { background: var(--bg-hover); }
.skills-sidebar-item .skill-count {
  font-size: 0.65rem; font-weight: var(--weight-semibold); color: var(--text-muted);
  background: var(--bg-elevated); padding: 1px 5px; border-radius: var(--radius-full);
}

.priority-badge {
  font-size: 0.63rem; font-weight: var(--weight-semibold); padding: 1px 6px;
  border-radius: var(--radius-full); text-transform: uppercase; letter-spacing: 0.03em;
}
.priority-badge.urgent { background: var(--error-muted); color: var(--error); }
.priority-badge.high { background: var(--warning-muted); color: var(--warning); }
.priority-badge.medium { background: var(--info-muted); color: var(--info); }
.priority-badge.low { background: var(--bg-elevated); color: var(--text-tertiary); }
.task-card.hidden-task { display: none; }

/* ── Sidebar Metrics (legacy compat) ── */
.sidebar-section { margin-bottom: var(--space-5); }
.sidebar-section h3 { font-size: var(--text-xs); font-weight: var(--weight-semibold);
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: var(--space-3); }
.metric-item { display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--text-sm); }
.metric-item:last-child { border-bottom: none; }
.metric-value { font-weight: var(--weight-semibold); }
.metric-value.disconnected { color: var(--text-muted); font-weight: var(--weight-normal); font-size: var(--text-xs); }
.progress-bar-container { width: 100%; height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; margin-top: var(--space-2); }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-text)); border-radius: 3px; transition: width 0.5s ease; }
.headcount-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-1); margin-top: var(--space-2); }
.headcount-item { display: flex; justify-content: space-between; font-size: var(--text-sm); padding: 3px 0; }
.headcount-item .hc-label { color: var(--text-secondary); }
.headcount-item .hc-value { font-weight: var(--weight-semibold); }

/* ── Activity Log ── */
.activity-log-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; }
.activity-log-header {
  padding: var(--space-3) var(--space-4); font-size: var(--text-sm); font-weight: var(--weight-semibold);
  border-bottom: 1px solid var(--border-subtle); display: flex; justify-content: space-between;
  align-items: center; background: var(--bg-elevated);
}
.activity-log-body { max-height: 300px; overflow-y: auto; padding: var(--space-1) 0; font-family: var(--font-mono); }
.log-entry { padding: var(--space-1) var(--space-4); font-size: var(--text-xs); line-height: var(--leading-normal);
  border-bottom: 1px solid var(--border-subtle); transition: background var(--duration-fast); }
.log-entry:hover { background: var(--bg-hover); }
.log-ts { color: var(--text-muted); } .log-actor { color: var(--purple); font-weight: var(--weight-medium); }
.log-action { color: var(--text-secondary); } .log-target { color: var(--accent-text); } .log-output { color: var(--success); }
.log-empty { padding: var(--space-6); text-align: center; color: var(--text-muted); font-size: var(--text-sm); font-family: var(--font-sans); }

/* ── Template Grid ── */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-6); }
.template-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: var(--space-4); cursor: pointer; transition: all var(--duration-normal);
}
.template-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.template-emoji { font-size: 1.3rem; margin-bottom: var(--space-2); }
.template-name { font-size: var(--text-sm); font-weight: var(--weight-semibold); margin-bottom: var(--space-1); }
.template-desc { font-size: var(--text-xs); color: var(--text-secondary); line-height: var(--leading-normal); margin-bottom: var(--space-2); }
.template-tags { display: flex; gap: 3px; flex-wrap: wrap; }

/* ── Milestones ── */
.milestones-section { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border-subtle); background: var(--bg-surface); }
.timeline { display: flex; gap: 0; overflow-x: auto; padding-bottom: var(--space-2); position: relative; }
.timeline::before { content: ''; position: absolute; top: 16px; left: 0; right: 0; height: 2px; background: var(--border-default); }
.timeline-item { flex: 1; min-width: 150px; position: relative; padding: 0 var(--space-3); }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--border-default);
  border: 2px solid var(--bg-surface); position: relative; z-index: 1; margin-bottom: var(--space-2); }
.timeline-dot.active { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.timeline-dot.complete { background: var(--success); }
.timeline-dot.future { background: var(--border-default); }
.timeline-label { font-size: var(--text-sm); font-weight: var(--weight-semibold); margin-bottom: var(--space-1); }
.timeline-desc { font-size: var(--text-xs); color: var(--text-secondary); line-height: var(--leading-normal); }

/* ── Modals (legacy compat) ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity var(--duration-normal);
  backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-overlay .modal {
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); width: 92%; max-width: 540px;
  max-height: 82vh; overflow-y: auto; box-shadow: var(--shadow-xl);
  transform: translateY(12px) scale(0.97); transition: transform var(--duration-normal); padding: var(--space-5);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.modal-header h2 { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.modal-close {
  background: none; border: none; color: var(--text-tertiary); font-size: 1.3rem;
  cursor: pointer; padding: var(--space-1); border-radius: var(--radius-sm); transition: all var(--duration-fast);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-elevated); }
.modal-body .field { margin-bottom: var(--space-3); }
.modal-body label { display: block; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--text-secondary); margin-bottom: var(--space-1); }
.modal-body input, .modal-body select, .modal-body textarea { width: 100%; padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.modal-body textarea { resize: vertical; min-height: 70px; }
.task-detail-priority { display: inline-block; margin-bottom: var(--space-3); }
.task-detail-meta { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-3); line-height: 1.6; }
.task-detail-desc { font-size: var(--text-sm); line-height: 1.6; margin-bottom: var(--space-4); }
.task-detail-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ── Workers ── */
.worker-picker-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 500;
  align-items: center; justify-content: center;
}
.worker-picker-overlay.open { display: flex; }
.worker-picker {
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: var(--space-6); max-width: 480px; width: 90%;
}

/* ── Responsive ── */
@media (max-width: 1100px) { .board-layout { grid-template-columns: 1fr; }
  .board-sidebar { border-left: none; border-top: 1px solid var(--border-subtle); } }
@media (max-width: 900px) { .kanban { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .app-header { padding: var(--space-2) var(--space-4); }
  .board-main { padding: var(--space-3); } .kanban { grid-template-columns: 1fr; }
  .exec-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .app-title { font-size: var(--text-base); } .toolbar-actions { display: none; }
  .milestones-section { padding: var(--space-3); }
  .timeline { flex-direction: column; }
  .timeline::before { top: 0; bottom: 0; left: 16px; width: 2px; height: auto; }
  .timeline-item { padding: 0 0 var(--space-4) 30px; min-width: auto; }
  .timeline-dot { position: absolute; left: 0; top: 2px; }
}
