/* ==========================================================================
   PMS - View-specific styles: dashboard, projects, tasks, people, reports,
   settings.
   ========================================================================== */

/* ---------- Dashboard ---------- */
.dash-section { margin-block-start: var(--space-5); }
.dash-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4); margin-block-start: var(--space-4); }
.dash-lists { margin-block-start: var(--space-4); }
.chart-card .card-body { display: flex; flex-direction: column; align-items: center; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-block-start: var(--space-3); font-size: 0.8rem; }
.chart-legend .lg-item { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.chart-legend .lg-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* Centerpiece overall-progress ring card */
.overall-ring-card {
  background: var(--brand-tint);
  border-block-start: 3px solid transparent;
  border-image: var(--brand-grad) 1;
}
.overall-ring-card .card-title { color: var(--primary); }
.overall-ring-card .card-body { padding-block: var(--space-5); }

.kpi-card {
  border-block-start: 3px solid var(--border);
}
.kpi-card .kpi-value { color: var(--primary); }
.kpi-card .kpi-value.danger { color: var(--danger); }
.kpi-card .kpi-value.ok { color: var(--success); }

.project-progress-list { display: flex; flex-direction: column; gap: var(--space-3); }
.project-progress-row { display: flex; align-items: center; gap: var(--space-3); }
.project-progress-row .pp-name { min-width: 140px; font-weight: 600; }

/* ---------- Projects tree ---------- */
.project-tree-item { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }

/* ---------- Pillars list: one roomy card per pillar ---------- */
.pillar-grid { margin-block-start: var(--space-2); }
.pillar-grid .tree-node {
  display: block;
  padding: 0;
  margin-block-end: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow: hidden;
}
.pillar-grid .tree-node:hover { border-color: var(--primary); }
.pillar-grid .tree-node > .tree-toggle {
  float: inline-start;
  margin: 14px 0 0 10px;
}
.pillar-grid .tree ul { padding-inline-start: 18px; }
.pillar-grid .tree ul .tree-node { border-style: dashed; }
.pillar-grid .project-tree-item {
  display: block;
  padding: 12px 14px 12px 34px;
}
.pillar-row-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 0.98rem;
}
.pillar-row-head .u-ellipsis { flex: 1 1 auto; min-width: 120px; }
.pillar-row-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-block-start: 8px;
}
.pillar-grid .progress-track { margin-block-start: 10px; }
.chip-owner { cursor: pointer; }
.chip-owner:hover { background: var(--primary-soft); color: var(--primary); }
.project-tree-row {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  margin-block-end: 3px;
}
.project-tree-row:hover { background: var(--bg-hover); border-color: var(--border); }
/* Disclosure arrow for the work nested under a task on a pillar page. Shares the
   virtual table's chevron styling so the two lists feel like one control. */
.pt-twisty {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text-muted);
  font-size: 0.7rem; line-height: 1; cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.pt-twisty:hover { background: var(--primary-soft); color: var(--primary); }
.pt-twisty:not(.open) { transform: rotate(-90deg); }
.pt-twisty-leaf { border: none; background: none; color: var(--text-faint); cursor: default; }
.pt-twisty-leaf:hover { background: none; color: var(--text-faint); }

/* ---------- Project detail header ---------- */
.project-hero { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-start; }
.project-hero .ph-main { flex: 1; min-width: 260px; }

/* ---------- Task table cells ---------- */
.tcell-prio { display: inline-flex; align-items: center; gap: 6px; }
.tcell-id { font-family: var(--font-sans); font-size: 0.75rem; color: var(--text-faint); }

/* ---------- People ---------- */
.person-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--space-4);
  cursor: pointer;
  transition: box-shadow var(--transition);
}
.person-card:hover { box-shadow: var(--shadow-md); }
.person-card .pc-top { display: flex; gap: 12px; align-items: center; }
.person-card .pc-name { font-weight: 700; }

/* ---------- People: sections, contact lines, workload ---------- */
.people-toolbar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
  margin-block-end: var(--space-3);
}
.people-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { cursor: pointer; border: 1px solid var(--border); background: var(--bg-elevated); }
.filter-chip.is-active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.person-card .dept-chip {
  align-self: flex-start;
  max-width: 100%;
  font-size: .75rem;
}
.person-card .pc-contact,
.person-contact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: .8rem;
}
a.contact-line {
  color: var(--text-muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.contact-line:hover { color: var(--primary); text-decoration: underline; }
.pc-load { margin-block-start: auto; }
.pc-load-track {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}
.pc-load-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--success);
}
.person-detail-head { display: flex; gap: var(--space-3); align-items: center; }
.people-rows { display: flex; flex-direction: column; gap: 2px; }
.people-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: 6px 0;
  border-block-end: 1px solid var(--border);
}
.people-row:last-child { border-block-end: none; }
.people-row:hover { background: var(--bg-subtle); }

/* ---------- Reports ---------- */
.report-card { margin-block-end: var(--space-5); }
.report-toolbar { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.report-row-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }

/* ---------- Settings ---------- */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-block-end: 1px solid var(--border); }
.setting-row:last-child { border-block-end: none; }
.help-box { margin-block-start: var(--space-3); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius, 8px); background: color-mix(in srgb, var(--bg-soft, #f8fafc) 60%, transparent); }
.help-box summary { cursor: pointer; font-weight: 600; }
.help-box ol { margin: 6px 0; padding-inline-start: 18px; }
.help-box pre.code { white-space: pre-wrap; direction: ltr; text-align: left; font-size: 12px; background: var(--bg-soft, #f1f5f9); padding: var(--space-3); border-radius: var(--radius, 8px); overflow-x: auto; }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 42px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  transition: background var(--transition);
  cursor: pointer;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }
html[dir="rtl"] .switch input:checked + .slider::before { transform: translateX(-18px); }

/* ---------- Print helpers: screen-only decorations hidden ---------- */

/* ---------- Filter chips bar ---------- */
.filter-area { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-block-end: var(--space-3); }
.filter-area .filter-bar { flex: 1 1 100%; margin-block-end: 0; }
.filter-area .filter-bar.collapsed { display: none; }
.filter-toggle.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: var(--space-3); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); margin-block-end: var(--space-4); }
.filter-multi { min-width: 180px; }

/* Virtual table container (CSS grid rows so columns stay aligned even when
   rows are absolutely positioned for virtualization) */
.vt-scroll { position: relative; overflow-y: auto; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); }
.vt-head {
  position: sticky; top: 0; z-index: 3;
  display: grid; align-items: center;
  background: var(--bg-subtle);
  border-block-end: 1px solid var(--border);
}
.vt-th {
  display: flex; align-items: center; gap: 4px;
  padding: 10px 12px; white-space: nowrap; overflow: hidden;
  font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted); text-align: start;
}
.vt-th { cursor: default; }
.vt-th.sortable { cursor: pointer; }
.vt-th.sortable:hover { color: var(--text); }
.vt-th .sort-arrow { opacity: 0.4; }
.vt-th.sort-asc .sort-arrow, .vt-th.sort-desc .sort-arrow { opacity: 1; }

.vt-body { position: relative; min-height: 300px; }
.vt-row {
  position: absolute; inset-inline: 0;
  display: grid; align-items: center;
  border-block-end: 1px solid var(--border);
  box-sizing: border-box;
}
.vt-row:hover { background: var(--bg-hover); }
.vt-row.selected { background: var(--primary-soft); }

/* Nested sub-tasks: indented under their parent with a guide rail, and a
   slightly muted treatment so the hierarchy reads at a glance */
.vt-row-sub {
  background: var(--bg-subtle);
  border-inline-start: 2px solid var(--border);
}
.vt-row-sub .vt-td { font-size: 0.85rem; }
.vt-row-sub:hover { background: var(--bg-hover); }
.vt-row-collapsed { background: var(--bg-elevated); }
.vt-twisty {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text-muted);
  font-size: 0.7rem; line-height: 1; cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.vt-twisty:hover { background: var(--primary-soft); color: var(--primary); }
.vt-twisty.collapsed { transform: rotate(-90deg); }
.vt-twisty-leaf { border: none; background: none; color: var(--text-faint); cursor: default; }
.vt-td { padding: 8px 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.vt-td, .vt-td > * { min-width: 0; }
/* The task number anchors the left edge, so it gets a fixed slot and tabular
   figures: right-aligned digits line up instead of jittering per row. */
.vt-td-num {
  display: block;
  text-align: end;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: default;
}
.vt-group {
  position: absolute; inset-inline: 0;
  display: flex; align-items: center;
  height: 44px; padding: 0 12px; box-sizing: border-box;
  background: var(--bg-subtle);
  font-weight: 700; font-size: 0.85rem; color: var(--text-muted);
  border-block-end: 1px solid var(--border);
}

/* Gantt dependency arrow marker */
#gantt-arrowhead { fill: var(--text-faint); }

/* ---------- Activity log ---------- */
.dash-charts .overall-ring-card .card-body { padding-block-start: var(--space-4); }
.act-list { display: flex; flex-direction: column; gap: var(--space-2); margin-block-start: var(--space-4); }
.act-row {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.act-badge {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.act-main { flex: 1; min-width: 0; }
.act-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.act-name { font-weight: 700; }
.act-action { color: var(--text-muted); font-size: 0.85rem; }
.act-detail { margin-block-start: 2px; font-size: 0.85rem; color: var(--text-muted); word-break: break-word; }
.act-meta { flex: 0 0 auto; text-align: end; }
.act-actor { display: block; font-size: 0.8rem; color: var(--text); font-weight: 600; }
.act-time { display: block; font-size: 0.72rem; color: var(--text-faint); margin-block-start: 2px; }
@media (max-width: 640px) {
  .act-row { flex-wrap: wrap; }
  .act-meta { text-align: start; }
}
/* ============================ Meetings ============================ */
.search-inline { max-width: 320px; margin-block-end: var(--space-4); }
.meeting-list { display: flex; flex-direction: column; gap: var(--space-3); }
.meeting-card { cursor: pointer; }
.meeting-card:hover { box-shadow: var(--shadow-md); }
.meeting-card .meeting-date {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--primary);
  white-space: nowrap;
}
.meeting-agenda { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.meeting-agenda li { font-size: 0.9rem; }

/* Tasks + pillars of a meeting, summarized on the card itself */
.meeting-linked {
  display: flex; flex-direction: column; gap: 4px;
  margin-block-start: 10px; padding-block-start: 8px;
  border-block-start: 1px dashed var(--border);
}
.meeting-linked-row { display: flex; align-items: baseline; gap: 8px; }
.meeting-linked-label {
  flex: 0 0 auto; min-width: 74px;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted);
}
.meeting-linked-items {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  min-width: 0;
}
.meeting-task-chip,
.meeting-pillar-chip {
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-inline-start: 3px solid transparent;
  cursor: pointer;
}
.meeting-task-chip:hover, .meeting-pillar-chip:hover { background: var(--primary-soft); color: var(--primary); }
.meeting-pillar-chip { border-inline-start-color: var(--primary); }
.vt-assignees { cursor: default; }
