/* HQ-34: trang chi tiết dự án — khách hàng nổi bật đầu trang, tab Tổng quan (views/project_overview.js), tab Tiền có mục con.
   Tách file khỏi app.css để nhánh song song (HQ-33 menu / trang chủ / khách hàng) sửa app.css không đụng nhau. Chỉ dùng biến màu của app.css. */
:root {
  --chart-fc: #16A394;   /* dự kiến — kiểm bằng validate_palette (sáng: CVD ΔE 20,8; tối: 14,6) */
  --chart-ac: #5B5BD6;   /* đã nghiệm thu */
}
:root[data-theme="dark"] { --chart-fc: #18A396; --chart-ac: #8080EE; }

/* ---- Đầu trang ---- */
.pj-hero { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; margin: 0 0 12px; position: relative; overflow: visible; }
.pj-hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: var(--radius) var(--radius) 0 0; background: var(--brand-gradient); }
.pj-client { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); padding: 8px 10px; margin: -4px -6px 0;
  border-radius: 12px; border: 1px solid transparent; min-width: 0; }
a.pj-client:hover { background: var(--hover); border-color: var(--line); }
a.pj-client:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
:root[data-theme="dark"] a.pj-client { color: var(--ink); }
.pj-avatar { flex: none; width: 48px; height: 48px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; font-size: 17px; letter-spacing: .02em; }
.pj-client.missing .pj-avatar { background: var(--err-soft); color: var(--err); }
.pj-client-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pj-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pj-brand { font-size: 20px; line-height: 1.25; font-weight: 750; overflow-wrap: anywhere; }
.pj-legal { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.pj-client-open { flex: none; font-size: 13px; font-weight: 600; color: var(--brand-dark); white-space: nowrap; }
:root[data-theme="dark"] .pj-client-open { color: var(--accent-text); }
.pj-title-row { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pj-title { flex: 1 1 320px; min-width: 0; }
.pj-title h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.015em; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }   /* tên quá dài (dữ liệu cũ dán link) ⇒ 3 dòng, đủ tên ở title */
.pj-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pj-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.pj-dates { font-size: 12.5px; }
.pj-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.pj-danger { color: var(--err); }
.pj-more { position: relative; display: none; }
.pj-more > summary { list-style: none; font-size: 18px; line-height: 1; padding: 6px 12px; }
.pj-more > summary::-webkit-details-marker { display: none; }
.pj-more-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.pj-more-pop .btn { justify-content: flex-start; text-align: left; border-color: transparent; }
.pj-more-pop .btn:hover { background: var(--hover); }
.pj-owners { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.pj-owner { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink); font: inherit; min-width: 0; max-width: 100%; text-align: left; }
button.pj-owner { cursor: pointer; border-style: dashed; border-color: var(--btn-border); background: transparent; }
button.pj-owner:hover { border-color: var(--brand); background: var(--brand-soft); }
.pj-owner.teams { padding-left: 12px; }
.pj-owner-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.pj-owner-txt small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pj-owner-txt strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-owner.empty .pj-owner-txt strong { color: var(--muted); font-weight: 500; }
.pj-av { flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px;
  font-weight: 700; background: var(--accent-soft); color: var(--accent-text); }
.pj-av.empty { background: var(--surface); border: 1px dashed var(--btn-border); color: var(--muted); }

/* ---- Tab + mục con ---- */
.pj-tabs a { font-size: 14.5px; }
.pj-sec-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 18px 0 10px; scroll-margin-top: 70px; }
.pj-sec-head:first-child { margin-top: 0; }
.pj-sec-head h3 { margin: 0; font-size: 16px; }
.pj-sec-head .muted { font-size: 12.5px; }
.pj-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 14px; max-width: 100%; }
.pj-seg-btn { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; min-height: 34px; }
.pj-seg-btn:hover { color: var(--ink); }
.pj-seg-btn.on { background: var(--surface); color: var(--brand-dark); box-shadow: 0 1px 4px rgb(20 26 46 / .12); }
:root[data-theme="dark"] .pj-seg-btn.on { color: var(--accent-text); }
.link-btn { border: 0; background: none; padding: 2px 0; color: var(--brand-dark); cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; }
.link-btn:hover { text-decoration: underline; }
:root[data-theme="dark"] .link-btn { color: var(--accent-text); }

/* ---- Tổng quan: lưới khối ---- */
.pjo-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.pjo-card { grid-column: span 4; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.pjo-card.pjo-c-flow { grid-column: span 12; }
.pjo-card.pjo-c-chart { grid-column: span 8; }
.pjo-card > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.pjo-card > header h3 { margin: 0; font-size: 15px; }
.pjo-hint { font-size: 12px; }
.pjo-loading { color: var(--muted); font-size: 13px; padding: 14px 0; }
.pjo-note { font-size: 12.5px; margin: 8px 0 0; }
.pjo-empty { color: var(--muted); font-size: 13px; padding: 10px 12px; border: 1px dashed var(--btn-border); border-radius: 10px; }
.pjo-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
.pjo-bar { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.pjo-bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.pjo-bar.ok i { background: var(--accent); }
.pjo-bar.neg i { background: var(--err); }

/* (a) dòng tiền */
ol.pjo-flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.pjo-step-btn { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; font: inherit; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; min-width: 0; }
.pjo-step-btn:hover { border-color: var(--brand); }
.pjo-step-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pjo-step-label { font-size: 12px; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.pjo-arrow { color: var(--soon); font-weight: 700; }
.pjo-step-val { font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pjo-step-pct { font-size: 12px; font-weight: 600; color: var(--muted); min-height: 18px; }
.pjo-step-sub { font-size: 11.5px; margin-top: 4px; }
.pjo-step .pjo-bar { width: 100%; }
.pjo-step.s-margin .pjo-step-btn { background: var(--accent-soft); }
.pjo-step.s-margin .pjo-bar i { background: var(--accent); }
.pjo-step.neg .pjo-step-btn { background: var(--err-soft); }
.pjo-step.neg .pjo-step-val { color: var(--err); }
.pjo-rest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pjo-pill { display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.pjo-pill:hover { border-color: var(--brand); }
.pjo-pill strong { font-variant-numeric: tabular-nums; }

/* (b) biểu đồ */
.pjo-sum { margin: 0 0 6px; font-size: 13px; }
.pjo-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.pjo-legend span, .pjo-tip span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.fc { background: var(--chart-fc); }
.sw.ac { background: var(--chart-ac); }
.sw.now { background: var(--surface-2); border: 1px solid var(--line); }
.pjo-chart { position: relative; }
.pjo-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.pjo-svg .pjo-gl { stroke: var(--line); stroke-width: 1; }
.pjo-svg .pjo-axis { stroke: var(--btn-border); stroke-width: 1; }
.pjo-svg .pjo-tick, .pjo-svg .pjo-mlabel, .pjo-svg .pjo-ylabel { fill: var(--muted); font-size: 10.5px; font-family: var(--font); }
.pjo-svg .pjo-mlabel.now { fill: var(--ink); font-weight: 700; }
.pjo-svg .pjo-ylabel { font-size: 9.5px; }
.pjo-svg .pjo-b.fc { fill: var(--chart-fc); }
.pjo-svg .pjo-b.fc.future { fill-opacity: .55; }
.pjo-svg .pjo-b.ac { fill: var(--chart-ac); }
.pjo-svg .pjo-now { fill: var(--surface-2); }
.pjo-svg .pjo-hit { fill: transparent; cursor: pointer; outline: none; }
.pjo-svg .pjo-hit.on, .pjo-svg .pjo-hit:focus-visible { fill: var(--brand); fill-opacity: .07; stroke: var(--brand); stroke-opacity: .35; }
.pjo-tip { position: absolute; top: -6px; z-index: 5; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; font-size: 12px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); white-space: nowrap; transform: translateY(-100%); }
.pjo-tip[hidden] { display: none; }
.pjo-table { margin-top: 8px; font-size: 13px; }
.pjo-table summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.pjo-table .table-wrap { margin-top: 8px; box-shadow: none; }

/* (c) hạng mục & việc */
.pjo-progs { display: grid; gap: 10px; }
.pjo-prog-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.pjo-prog-head strong { font-variant-numeric: tabular-nums; }
.pjo-prog-head .muted { margin-left: auto; font-size: 12px; }
.pjo-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pjo-tasks, .pjo-list, .pjo-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pjo-tasks li { border-top: 1px solid var(--line); }
.pjo-tasks li:first-child { border-top: 0; }
.pjo-task { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; cursor: pointer; }
.pjo-task input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.pjo-task-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--soon); margin: 7px 5px 0; flex: none; }
.pjo-task-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 13px; }
.pjo-task-title { font-weight: 600; overflow-wrap: anywhere; }
.pjo-task-txt .muted { font-size: 12px; }
.pjo-task-due { flex: none; }
.pjo-tasks li.late .pjo-task-title { color: var(--err); }

/* (d) phụ lục, (e) người, (f) hoạt động */
.pjo-kpi { display: flex; align-items: baseline; gap: 8px; }
.pjo-kpi strong { font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.pjo-kpi span { color: var(--muted); font-size: 13px; }
.pjo-list li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.pjo-list li:first-child { border-top: 0; }
.pjo-li-sub { display: block; font-size: 12px; }
.pjo-people li { display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.pjo-people li:first-child { border-top: 0; }
.pjo-people li > span:last-child { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.pjo-roles { display: flex; flex-wrap: wrap; gap: 4px; }
.pjo-act-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pjo-tl .tl-item { padding-top: 6px; padding-bottom: 6px; }

@media (max-width: 1100px) {
  .pjo-card { grid-column: span 6; }
  .pjo-card.pjo-c-chart { grid-column: span 12; }
  ol.pjo-flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .pj-hero { padding: 14px; }
  .pj-client { flex-wrap: wrap; }
  .pj-client-open { width: 100%; padding-left: 60px; }
  .pj-brand { font-size: 18px; }
  .pj-title h1 { font-size: 21px; }
  .pj-title-row { flex-direction: column; }
  .pj-title { flex-basis: auto; width: 100%; }
  .pj-actions { justify-content: flex-start; width: 100%; }
  .pj-actions .pj-sec { display: none; }
  .pj-more { display: block; }
  .pj-more-pop { left: 0; right: auto; }
  .pj-owners { gap: 6px; }
  .pj-owner { flex: 1 1 calc(50% - 6px); }
  .pjo-grid { grid-template-columns: minmax(0, 1fr); }
  .pjo-card, .pjo-card.pjo-c-chart, .pjo-card.pjo-c-flow { grid-column: auto; }
  ol.pjo-flow { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .pjo-step-btn { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 10px; }
  .pjo-step-label { grid-column: 1; }
  .pjo-step-val { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-size: 16px; }
  .pjo-step-pct { grid-column: 1; min-height: 0; }
  .pjo-step .pjo-bar, .pjo-step-sub { grid-column: 1 / -1; }
  .pj-seg { display: flex; flex-wrap: nowrap; overflow-x: auto; }
  .pj-seg-btn { flex: none; white-space: nowrap; }
}
