/* Phase 5 of Project Management (pm-health.js): health dots, milestones, Confirm dates, Archive.
   Tones follow the Roadmap's: red = danger, amber = warn, green = the accent. */

/* ---- the health dot: next to a project's name on the Roadmap and the Map ---- */
.pm-hdot { display: inline-block; flex: none; width: 8px; height: 8px; margin: 0 7px 2px 0; border-radius: 999px; background: var(--accent); vertical-align: middle; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent); }
.pm-hdot.red { background: var(--danger); box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 22%, transparent); }
.pm-hdot.amber { background: var(--amber); box-shadow: 0 0 0 2px color-mix(in srgb, var(--amber) 22%, transparent); }
.pmv-rm-name .pm-hdot { margin-bottom: 3px; }
.pmv-map-ws b .pm-hdot { margin-right: 6px; }

/* ---- milestone diamonds on a Roadmap bar ---- */
.pm-ms-mark { position: absolute; top: 50%; z-index: 4; width: 9px; height: 9px; box-sizing: border-box; transform: translate(-50%, -50%) rotate(45deg); border: 1.5px solid var(--pmv-rm-bg); background: color-mix(in srgb, var(--c) 55%, #fff); }
.pm-ms-mark.done { background: var(--accent); }
.pm-ms-mark.late { background: var(--danger); }
:where(html[data-theme="light"]) .pm-ms-mark { background: color-mix(in srgb, var(--c) 70%, #000); }

/* ---- the project popup: health line, Archive, the milestone list ---- */
.pm-hsec { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.pm-hrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pm-hline { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; line-height: 20px; }
.pm-hline b { flex: none; font-weight: 600; }
.pm-hline span { color: var(--muted); overflow-wrap: anywhere; }
.pm-hline .pm-hdot { margin: 0; }
.pm-archive { height: var(--btn-h-sm, 36px); }
.pm-msbox { display: flex; flex-direction: column; gap: 8px; }
.pm-mshead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pm-mslist { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pm-ms-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pm-ms-tick { flex: none; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 999px; background: none; color: transparent; font: inherit; font-size: 15px; font-weight: 700; line-height: 1; cursor: pointer; transition: border-color .15s, background .15s; }
.pm-ms-tick[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.pm-ms-tick:not(:disabled):hover { border-color: var(--accent); }
.pm-ms-tick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pm-ms-tick:disabled { cursor: default; }
.pm-ms-name { flex: 1 1 auto; min-width: 0; height: 40px; }
.pm-ms-row.done .pm-ms-name { color: var(--muted); text-decoration: line-through; }
.pm-ms-when { flex: 0 0 auto; width: 190px; min-width: 0; }
.pm-ms-when .pm-due { gap: 0; }
.pm-ms-when .pm-due select, .pm-ms-when .pm-due input { width: 100%; height: 40px; }
.pm-ms-when > span { color: var(--muted); font-size: 13px; }
.pm-ms-row.late:not(.done) .pm-ms-when select { color: var(--danger); }
.pm-ms-row .pmv-rm-x { flex: none; }

/* ---- Confirm dates: the button in the Roadmap head and the sheet ---- */
.pm-confirm-dates { flex: none; align-self: center; height: var(--btn-h-sm, 36px); }
.panel.pm-cf { width: min(520px, calc(100vw - 32px)); padding: 22px 24px 24px; border-radius: 20px; }
.pm-cf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-right: -8px; }
.pm-cf-head h2 { margin: 0; font-family: var(--display, inherit); font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }
.pm-cf-intro { margin: 10px 0 14px; color: var(--muted); font-size: 14px; line-height: 21px; }
.pm-cf-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.pm-cf-row { border-bottom: 1px solid var(--line); }
.pm-cf-row label { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 2px; cursor: pointer; }
.pm-cf-row input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.pm-cf-dot { flex: none; width: 10px; height: 10px; border-radius: 999px; background: var(--c); }
.pm-cf-words { display: flex; flex-direction: column; min-width: 0; }
.pm-cf-words b { font-weight: 600; overflow-wrap: anywhere; }
.pm-cf-words small { color: var(--muted); font-size: 13px; line-height: 18px; }
.pm-cf-none { padding: 14px 2px; color: var(--muted); font-size: 14px; }
.pm-cf-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---- Dates: milestone chips (tone cool), ticked when done ---- */
.pmv-dt-chip.ms { background: color-mix(in srgb, var(--sky) 12%, var(--surface)); color: var(--sky); }
.pmv-dt-chip.ms::before { content: "◇"; flex: none; font-size: 10px; }
.pmv-dt-chip.ms.done { color: var(--muted); opacity: .75; }
.pmv-dt-chip.ms.done::before { content: ""; }
.pmv-dt-ag.done .pmv-dt-ag-t { color: var(--muted); }
.pmv-dt-ag.done .pmv-dt-ag-c { color: var(--accent); }

/* ---- Map: an archived project, greyed, with Bring back ---- */
.pmv-map-ws.archived { opacity: .5; cursor: default; }
.pmv-map-ws.archived b { color: var(--muted); }
@media (hover: hover) { .pmv-map-ws.archived:hover { border-color: var(--line); } }
.pm-bringback { height: var(--btn-h-sm, 36px); }

/* ---- phone ---- */
@media (max-width: 760px) {
  .pm-hdot { width: 9px; height: 9px; }
  .pm-ms-tick { width: 40px; height: 40px; }
  .pm-ms-row { flex-wrap: wrap; }
  .pm-ms-name { flex-basis: calc(100% - 96px); height: 44px; }
  .pm-ms-when { flex: 1 1 auto; width: auto; margin-left: 48px; }
  .pm-ms-when .pm-due select, .pm-ms-when .pm-due input { height: 44px; }
  .pm-confirm-dates { min-height: 40px; }
  .pm-archive, .pm-bringback { min-height: 40px; }
  .pm-cf-head { position: sticky; top: 0; z-index: 5; box-sizing: border-box; min-height: calc(56px + env(safe-area-inset-top, 0px)); margin: 0 -16px; padding: env(safe-area-inset-top, 0px) 8px 0 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .pm-cf-head h2 { font-family: inherit; font-size: 17px; }
  dialog.panel.pm-cf { padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .pm-cf-head + * { margin-top: 16px; }
  .pm-cf-btns .btn { flex: 1 1 auto; }
}
@media (max-width: 700px) {
  /* the compact calendar draws chips as small bars: a milestone's is sky blue */
  .pmv-dt-chip.ms { background: var(--sky); box-shadow: none; opacity: 1; }
  .pmv-dt-chip.ms.done { background: var(--accent); opacity: .7; }
  .pmv-dt-chip.ms::before { display: none; }
}
