/* Unified Vettro project/task cards. Loaded after legacy page styles on purpose.
   Fixed-width columns stay compact while the masonry script measures real card heights. */
:root { --vettro-card-width:320px; --vettro-card-gap:24px; }

/* Shared stage statuses: finished = green, active = purple, upcoming = gray. */
#reviews.page-reviews .my-review-card .my-task-step,
#projects.page-projects .project-card.is-task-style .my-task-step {
  background:#ebebf1;
  color:#8b8c99;
}
#reviews.page-reviews .my-review-card .my-task-step.is-done,
#projects.page-projects .project-card.is-task-style .my-task-step.is-done {
  background:#def4e6;
  color:#167447;
}
#reviews.page-reviews .my-review-card .my-task-step.is-current,
#projects.page-projects .project-card.is-task-style .my-task-step.is-current {
  background:#6938d4;
  color:#fff;
}

/* Project masonry uses compact real card widths, not proportional 3-column tracks. */
#projects.page-projects > .projects:not(.is-list) {
  display:grid;
  grid-template-columns:repeat(auto-fill,var(--vettro-card-width));
  grid-auto-rows:1px;
  grid-auto-flow:row dense;
  column-gap:var(--vettro-card-gap);
  row-gap:18px !important;
  justify-content:start;
  align-items:start;
  container-type:inline-size;
}
#projects.page-projects > .projects:not(.is-list) > .project-create-card {
  grid-column:auto;
  width:100%;
}
#projects.page-projects > .projects:not(.is-list) > .project-finder {
  width:var(--vettro-card-width);
  max-width:100%;
  min-height:440px !important;
  padding:23px;
}
#projects.page-projects > .projects:not(.is-list) > .project-card.is-task-style {
  grid-column:auto;
  width:var(--vettro-card-width);
  max-width:100%;
}
@container (min-width:664px) {
  #projects.page-projects > .projects:not(.is-list) > .project-create-card {
    grid-column:span 2;
  }
}

/* Same visual hierarchy as My Tasks: full-bleed image, title, segmented stages, footer. */
#projects.page-projects > .projects .project-card.is-task-style {
  display:flex;
  flex-direction:column;
  gap:0;
  padding:0;
  min-height:0 !important;
  height:auto;
  border:1px solid #e3e4e9;
  border-radius:15px;
  background:#fff;
  overflow:hidden;
  box-shadow:none;
}
#projects.page-projects .project-card.is-task-style .project-thumb {
  flex:none;
  width:100%;
  aspect-ratio:2.15 / 1;
  border-radius:0;
  background:#e8e3f2;
  overflow:hidden;
  position:relative;
}
#projects.page-projects .project-card.is-task-style .project-thumb-link {
  display:block;
  height:100%;
  width:100%;
}
#projects.page-projects .project-card.is-task-style .project-image {
  display:block;
  width:100%;
  height:100%;
  aspect-ratio:auto;
  object-fit:cover;
  object-position:center;
  border-radius:0;
}
#projects.page-projects .project-card.is-task-style .project-counts {
  position:absolute;
  top:9px;
  right:9px;
  display:flex;
  align-items:center;
  gap:4px;
  padding:0;
  border:0;
  border-radius:0;
  box-shadow:none;
  background:transparent;
  backdrop-filter:none;
}
#projects.page-projects .project-card.is-task-style .project-counts > span {
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:5px 7px;
  border-radius:6px;
  background:rgba(19,17,32,.80);
  color:#fff;
  font-size:10px;
  font-weight:650;
  line-height:1.2;
  white-space:nowrap;
  box-shadow:none;
}
#projects.page-projects .project-card.is-task-style .project-counts .icon {
  width:13px;
  height:13px;
  flex:none;
}
#projects.page-projects .project-card.is-task-style .project-card-body {
  display:flex;
  flex:1;
  flex-direction:column;
  padding:17px 15px 0;
  gap:0;
  min-width:0;
}
#projects.page-projects .project-card.is-task-style .project-task-title {
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
  color:#1d2030;
}
#projects.page-projects .project-card.is-task-style .project-task-title > .icon {
  width:18px;
  height:18px;
  flex:none;
  color:#5639a7;
}
#projects.page-projects .project-card.is-task-style .project-task-title h2 {
  flex:1;
  min-width:0;
  margin:0;
  font-size:14px;
  font-weight:750;
  letter-spacing:0;
  line-height:1.4;
  overflow-wrap:anywhere;
}
#projects.page-projects .project-card.is-task-style .project-task-title button {
  display:grid;
  place-items:center;
  padding:4px;
  border:0;
  background:transparent;
  color:#8d8997;
  cursor:pointer;
}
#projects.page-projects .project-card.is-task-style .project-task-title button:hover {color:#5639a7;}
#projects.page-projects .project-card.is-task-style .project-task-title button .icon {width:15px;height:15px;}
#projects.page-projects .project-card.is-task-style .project-stage-progress {
  display:flex;
  gap:3px;
  width:100%;
  margin:17px 0 20px;
  border-radius:7px;
  overflow:hidden;
}
#projects.page-projects .project-card.is-task-style .my-task-step {
  flex:1 1 0;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:3px;
  height:29px;
  min-width:0;
  padding:3px 1px;
  font-size:10px;
  font-weight:650;
}
#projects.page-projects .project-card.is-task-style .my-task-step .icon {
  width:12px;
  height:12px;
  flex:none;
}
#projects.page-projects .project-card.is-task-style .project-task-info {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  min-height:55px;
  padding:0 0 19px;
  flex-wrap:nowrap;
}
#projects.page-projects .project-card.is-task-style .project-task-info .status {
  font-size:10px;
  font-weight:700;
  padding:5px 8px;
  min-width:0;
  white-space:normal;
}
#projects.page-projects .project-card.is-task-style .project-task-updated {
  margin-left:auto;
  text-align:right;
  white-space:nowrap;
  color:#606575;
  font-size:10px;
  font-weight:650;
}
#projects.page-projects .project-card.is-task-style .project-task-actions {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:0;
  margin:0 -15px;
  padding:12px 8px;
  border-top:1px solid #e8e6ed;
}
#projects.page-projects .project-card.is-task-style .project-task-actions button {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-width:0;
  padding:9px 3px;
  background:transparent;
  border:0;
  color:#5633bb;
  font-size:12px;
  font-weight:750;
  cursor:pointer;
}
#projects.page-projects .project-card.is-task-style .project-task-actions button + button {
  border-left:1px solid #e8e6ed;
}
#projects.page-projects .project-card.is-task-style .project-task-actions .my-task-delete-action {
  color:#93919e;
  font-weight:500;
}
#projects.page-projects .project-card.is-task-style .project-task-actions .my-task-delete-action:hover {color:#b43f4d;}
#projects.page-projects .project-card.is-task-style .project-task-actions .icon {width:16px;height:16px;}

/* Keep the list-view toggle useful with the new markup. */
#projects.page-projects > .projects.is-list > .project-card.is-task-style {
  flex-direction:row;
  align-items:stretch;
  width:100%;
}
#projects.page-projects > .projects.is-list > .project-card.is-task-style .project-thumb {
  width:min(35%,340px);
  aspect-ratio:16/9;
}
#projects.page-projects > .projects.is-list > .project-card.is-task-style .project-card-body {
  padding:17px 15px 0;
}

/* Full-width single column on phones. */
@media(max-width:700px) {
  #projects.page-projects > .projects:not(.is-list) {
    grid-template-columns:minmax(0,1fr);
    column-gap:0;
    container-type:normal;
  }
  #projects.page-projects > .projects:not(.is-list) > .project-create-card,
  #projects.page-projects > .projects:not(.is-list) > .project-finder,
  #projects.page-projects > .projects:not(.is-list) > .project-card.is-task-style {
    grid-column:1;
    width:100%;
    max-width:none;
  }
  #projects.page-projects > .projects.is-list > .project-card.is-task-style {
    flex-direction:column;
  }
  #projects.page-projects > .projects.is-list > .project-card.is-task-style .project-thumb {
    width:100%;
    aspect-ratio:2.15/1;
  }
}

/* Project reviewer photos replace the status chip, matching the My Tasks card row. */
#projects.page-projects .project-card.is-task-style .project-avatars {
  display:inline-flex;
  align-items:center;
  flex:0 0 auto;
  padding-left:2px;
  min-width:0;
}
#projects.page-projects .project-card.is-task-style .project-avatar {
  display:grid;
  place-items:center;
  position:relative;
  isolation:isolate;
  width:30px;
  height:30px;
  margin-left:-3px;
  flex:none;
  border:2px solid #fff;
  border-radius:50%;
  overflow:hidden;
  background:#e1d7f0;
  color:#453163;
}
#projects.page-projects .project-card.is-task-style .project-avatar.is-holder {
  width:32px;
  height:32px;
  z-index:2;
  border:3px solid #3ba96c;
  box-shadow:0 0 0 2px #fff;
}
#projects.page-projects .project-card.is-task-style .project-avatar img {
  position:absolute;
  inset:0;
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:inherit;
}
#projects.page-projects .project-card.is-task-style .project-avatar-initials {
  font-size:9px;
  font-weight:750;
  line-height:1;
}
#projects.page-projects .project-card.is-task-style .project-avatar.is-unassigned {
  background:#f0eef3;
  color:#8a8693;
  border:1px dashed #c9c5d0;
}
#projects.page-projects .project-card.is-task-style .project-avatar.is-unassigned .icon {
  width:16px;
  height:16px;
}

/* ---- b118 app glue (Jarvis): real-data bits the playground does not have. Kept after Sparrow's rules on purpose. ---- */
/* Real workflows can have 2–6 stages; names truncate instead of wrapping. */
#reviews.page-reviews .my-review-card .my-task-step,
#projects.page-projects .project-card.is-task-style .my-task-step { min-width:0; }
.my-task-step .my-task-step-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.my-task-step.is-empty { flex:1 1 auto; font-style:normal; }
/* Title is a link to the project (keeps keyboard access) but looks like Sparrow's plain heading. */
#projects.page-projects .project-card.is-task-style .project-task-title h2 a { color:inherit; text-decoration:none; }
#projects.page-projects .project-card.is-task-style .project-task-title h2 a:hover { color:#5639a7; }
/* Comment count is clickable (opens that project's Feedback panel). */
#projects.page-projects .project-card.is-task-style .project-counts > a.project-count-link {
  display:inline-flex; align-items:center; gap:5px; padding:5px 7px; border-radius:6px; background:rgba(19,17,32,.80);
  color:#fff; font-size:10px; font-weight:650; line-height:1.2; white-space:nowrap; text-decoration:none;
}
#projects.page-projects .project-card.is-task-style .project-counts > a.project-count-link:hover,
#reviews .my-task-counts button:hover { background:#5833cb; }
#projects.page-projects .project-card.is-task-style .project-counts { z-index:2; }
/* Holder ring timing, same scale as My Tasks: green ≤8h, amber ≤24h, red >24h. */
#projects.page-projects .project-card.is-task-style .project-avatar.is-holder.tone-aging { border-color:#e2ad37; }
#projects.page-projects .project-card.is-task-style .project-avatar.is-holder.tone-overdue { border-color:#db5b65; }
/* Thumbnails: fallback label sits under the image / live email render. */
#projects.page-projects .project-card.is-task-style .project-preview-placeholder,
#reviews .my-task-thumbnail .rv-thumb-fallback {
  position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px;
  color:#6b5aa6; font-size:12px; text-align:center; padding:10px;
}
#reviews .my-task-thumbnail .rv-thumb-fallback .icon { width:22px; height:22px; }
#reviews .my-task-thumbnail > img { position:relative; z-index:1; }
#projects.page-projects .project-card.is-task-style .project-image { position:relative; z-index:1; }
/* Disabled Delete (no permission) stays visible but quiet. */
.my-task-delete-action:disabled { opacity:.45; cursor:not-allowed; }
.my-task-delete-action:disabled:hover { color:#93919e !important; }
#reviews .my-review-more .my-review-initials { font-size:10px; }
/* Rename dialog */
.vt-rename .vt-rename-input { width:100%; box-sizing:border-box; font:inherit; font-size:14px; padding:9px 11px; border:1px solid #d6d1e0; border-radius:8px; margin:6px 0 2px; }
.vt-rename .vt-rename-input:focus { outline:2px solid #7e69d455; border-color:#7e69d4; }
.vt-confirm .vt-btn.vt-btn-primary { background:#5833cb; border-color:#5833cb; color:#fff; }
#reviews .my-task-counts { z-index:2; }
