/* Tasks redesign — component styles (ported from the prototype's helmet block).
   Layered on top of the design system in styles.css; only the redesign-specific
   .tr-* row/tile/drawer behaviour lives here. */
.tr-row { transition: border-color .12s ease, box-shadow .12s ease; }
.tr-row:hover { border-color: #c8d2de; box-shadow: 0 2px 10px rgba(15, 30, 50, .08); }
.tr-seg { transition: background .12s, color .12s; }
.tr-drawer { transition: transform .26s cubic-bezier(.22, .61, .36, 1); }
.tr-backdrop { transition: opacity .22s ease; }
.tr-chev { transition: transform .12s; }
.tr-row:hover .tr-chev { transform: translateX(2px); }
.tr-clientlink:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------------
   Simplified Tasks view — the small control surface that replaced the 8-control
   filter bar and the 4 tabs (js/tasks.js build): Mine/Everyone + Open/Done
   segmented switches, search, the Recurring toggle, category chips, and the
   urgency-grouped list scaffolding.
   --------------------------------------------------------------------------- */
/* control bar: one flex row */
.ts-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.ts-seg { display: inline-flex; gap: 4px; background: #e6eaf0; border-radius: 9px; padding: 3px; flex: none; }
.ts-seg button {
  border: 0; cursor: pointer; border-radius: 7px; padding: 6px 13px;
  font: inherit; font-size: 12.5px; font-weight: 650;
  background: transparent; color: var(--muted);
  transition: background .12s, color .12s;
}
.ts-seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(22, 33, 46, .14); }
.ts-seg button .n { opacity: .55; font-weight: 600; }

.ts-search { flex: 1; position: relative; min-width: 140px; }
.ts-search svg { position: absolute; left: 13px; top: 11px; pointer-events: none; }
.ts-search input {
  width: 100%; box-sizing: border-box; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px 9px 36px;
  font: inherit; font-size: 13px;
}
.ts-search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }

.ts-recbtn {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  border-radius: 9px; padding: 9px 14px; font: inherit; font-size: 12.5px; font-weight: 650;
  cursor: pointer; transition: border-color .12s, color .12s;
}
.ts-recbtn.on { border-color: var(--blue); color: var(--blue); }
.ts-new {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  background: var(--blue); color: #fff; border: none;
  border-radius: 9px; padding: 9px 15px; font: inherit; font-size: 12.5px; font-weight: 650;
  cursor: pointer; transition: background .12s;
}
.ts-new:hover { background: #1d49a8; }

/* category chips — single-select pills; "All" clears */
.ts-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.ts-cat {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 11.5px; font-weight: 650;
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.ts-cat.on { border-color: var(--blue-line); background: var(--blue-bg); color: var(--blue); }

/* urgency groups (the grouping IS the sort) and the rows within them */
.ts-groups { display: flex; flex-direction: column; gap: 18px; }
.ts-group-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.ts-rows { display: flex; flex-direction: column; gap: 8px; }
.ts-count { font-size: 11.5px; color: var(--faint); margin-top: 12px; }

/* Recurring-mode row actions */
.ts-edit, .ts-del {
  background: #fff; border-radius: 8px; padding: 6px 12px;
  font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; transition: background .12s;
}
.ts-edit { border: 1px solid var(--line); color: var(--ink); }
.ts-edit:hover { background: var(--bg); }
.ts-del { border: 1px solid var(--red-line); color: var(--red); }
.ts-del:hover { background: var(--red-bg); }

/* narrow screens: let the control bar wrap (search takes its own full line) and
   shed the row's fixed-width extras so the title keeps room to breathe */
@media (max-width: 900px) {
  .ts-bar { flex-wrap: wrap; }
  .ts-search { flex: 1 1 100%; order: 10; }
}
@media (max-width: 560px) {
  .ts-done, .ts-donesep { display: none !important; }   /* the solid green circle already reads as done */
  .ts-due { width: auto !important; }
}

/* task rows (Tasks page, Dashboard "needs attention", and the client-profile Tasks
   tab all share the same one-line card anatomy): on a phone, shed the fixed-width
   trimmings — chevron, divider, In Progress pill — so the flexible title cluster
   keeps room to breathe (the avatar's live green ring + row tint still carry
   "in progress"). The pill/divider carry inline display styles, so the overrides
   need !important. */
@media (max-width: 560px) {
  .tr-chev { display: none; }
  .tr-divider { display: none !important; }
  .tr-ip, .tr-ipsep { display: none !important; }
}

/* ---- task detail drawer: Comments (discussion thread) ----
   Shared by both task-drawer implementations (the dedicated Tasks view in
   js/tasks.js and the client-profile / dashboard drawer in js/app.js); both
   render into the same app DOM, so one set of .tr-* classes styles both. */

/* section header: label on the left, a muted count on the right */
.tr-sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--faint); margin-bottom: 14px;
}
.tr-sec-n { font-variant-numeric: tabular-nums; color: var(--muted); letter-spacing: 0; }

/* discussion thread — each comment sits in a soft bubble beside its author's avatar */
.tr-cmts { display: flex; flex-direction: column; gap: 18px; margin-bottom: 16px; }
.tr-cmt { display: flex; gap: 11px; align-items: flex-start; }
.tr-cmt > :first-child { margin-top: 2px; }
.tr-cmt-body { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line-soft); border-radius: 10px; padding: 8px 12px; }
.tr-cmt-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.tr-cmt-by { font-size: 13px; font-weight: 650; color: var(--ink); }
.tr-cmt-when { font-size: 11.5px; color: var(--faint); }
.tr-cmt-text { font-size: 13px; line-height: 1.55; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.tr-cmt-empty { font-size: 12.5px; color: var(--faint); margin: 2px 0 14px; }

/* per-comment "⋯" actions menu — reveals on hover, reuses the .pay-menu dropdown */
.tr-cmt-menu { margin-left: auto; }
.tr-cmt-kebab {
  opacity: 0; transition: opacity .12s, color .12s, background .12s;
  border: none; background: none; cursor: pointer; color: var(--faint);
  font-size: 15px; line-height: 1; height: 20px; padding: 0 5px; border-radius: 6px;
  display: inline-flex; align-items: center;
}
.tr-cmt-kebab:hover { color: var(--ink); background: var(--grey-bg); }
.tr-cmt:hover .tr-cmt-kebab, .tr-cmt-menu.open .tr-cmt-kebab { opacity: 1; }
@media (hover: none) { .tr-cmt-kebab { opacity: .55; } }   /* no hover on touch — keep it reachable */
.tr-cmt-menu .pay-menu { top: 25px; right: 0; min-width: 116px; z-index: 56; }
.tr-menu-backdrop { position: fixed; inset: 0; z-index: 55; }   /* click-away to dismiss the menu */

/* inline comment editor (from the menu's Edit) */
.tr-cmt-edit .input { width: 100%; resize: vertical; font-size: 13px; }

/* composer — your avatar + a clean rounded field, matching the thread layout */
.tr-cmt-add { display: flex; gap: 11px; align-items: flex-start; margin-top: 2px; }
.tr-cmt-add > :first-child { margin-top: 7px; }
.tr-cmt-add-field { flex: 1; min-width: 0; }
.tr-cmt-add .input { width: 100%; resize: vertical; min-height: 0; font-size: 13px; border-radius: 10px; padding: 8px 12px; }
.tr-cmt-add-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* the composer's Comment button stays quiet until the field has content, then lights up
   (:has + :placeholder-shown — same CSS-only pattern already used elsewhere in the app) */
.tr-cmt-add .btn { color: var(--muted); }
.tr-cmt-add:has(.input:not(:placeholder-shown)) .btn { background: var(--blue); border-color: var(--blue); color: #fff; }
.tr-cmt-add:has(.input:not(:placeholder-shown)) .btn:hover { background: #1d4aab; }

/* uniform width for .filters-bar dropdowns (the clients list still uses this
   bar; the Tasks view's own filter bar was replaced by the .ts-* controls) so
   they don't auto-size to their widest option */
.filters .select { width: 150px; }
.filters .msel-trigger { width: 150px; min-width: 0; }

/* ---------------------------------------------------------------------------
   In-progress / "working now" status — a teammate is heads-down on a task right
   now. Signalled the Figma/Slack "active now" way: a live green pulsing ring +
   status dot on their avatar, a quiet "In Progress" pill on the row, and a
   pulsing dot beside the title in the detail drawer. Shared by both task UIs
   (the dedicated Tasks view in js/tasks.js and the dashboard / client-profile
   drawer in js/app.js).
   --------------------------------------------------------------------------- */
@keyframes ipPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes ipRing  { 0% { box-shadow: 0 0 0 0 rgba(21,128,61,.45); } 70% { box-shadow: 0 0 0 6px rgba(21,128,61,0); } 100% { box-shadow: 0 0 0 0 rgba(21,128,61,0); } }
.ip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); display: inline-block; flex: none; animation: ipPulse 1.6s ease-in-out infinite; }
.ip-ring { display: inline-flex; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--green); animation: ipRing 1.9s ease-out infinite; }
@keyframes ipHdrPulse { 0% { box-shadow: 0 0 0 3px var(--green-bg), 0 0 0 3px rgba(21,128,61,.5); } 70% { box-shadow: 0 0 0 3px var(--green-bg), 0 0 0 6px rgba(21,128,61,0); } 100% { box-shadow: 0 0 0 3px var(--green-bg), 0 0 0 6px rgba(21,128,61,0); } }
.ip-hdrdot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); display: inline-block; flex: none; box-shadow: 0 0 0 3px var(--green-bg); animation: ipHdrPulse 1.9s ease-out infinite; }
.tr-row.ip-active { position: relative; }

/* respect reduced-motion: keep the green signal, drop the looping animation */
@media (prefers-reduced-motion: reduce) {
  .ip-dot, .ip-ring, .ip-hdrdot { animation: none; }
}

/* ---------------------------------------------------------------------------
   Task quick create — the centred command modal (js/tasks.js quickCreateHtml).
   Layout and colours are inline per the design handoff; only the hover / focus
   affordances live here.
   --------------------------------------------------------------------------- */
.qc-modal ::placeholder { color: #a6b0bd; opacity: 1; }
.qc-row { transition: background .12s; }
.qc-row:hover { background: var(--bg); }
.qc-add { transition: color .12s; }
.qc-add:hover { color: var(--blue); }
.qc-signoff { transition: background .12s; }
.qc-signoff:hover { background: #f7f9fc; }
.qc-create { transition: background .12s; }
.qc-create:hover { background: #1d49a8; }
.qc-esc { transition: color .12s, border-color .12s; }
.qc-esc:hover { color: var(--ink); border-color: #c8d2de; }
.qc-search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
