/* ==========================================================================
   CareMetrix — Care Loop (work board: Kanban board, list, backlog, sprints)
   Follows the same conventions as Leave Approvals / Leave Analytics: rules
   scoped under `.crl`, shared table/drawer/modal/toast components, a single
   fixed-position popover pattern for the sprint/space switchers and row
   menus, and the page-scoped-CSS + IIFE + mountOverlays() convention.
   ========================================================================== */

.crl {
  --crl-pink: var(--brand-magenta);
}
.crl b { font-weight: 600; }

.crl-pagepath { margin-bottom: 0; }
.page.crl { gap: 14px; }
.CareloopDiv { padding: 16px 20px 18px; }

/* -------------------------------------------------------------- headrow -- */

.crl-headrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.crl-headrow__title { display: flex; align-items: center; gap: 10px; }
.crl-headrow__icon { width: 36px; height: 36px; border-radius: 10px; background: var(--grad-violet); color: #fff; display: grid; place-items: center; flex: none; }
.crl-headrow__icon svg { width: 17px; height: 17px; }
.crl-headrow__title h1 { font-size: 19px; font-weight: 600; letter-spacing: -.2px; }

.crl-headrow__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.crl-spacebtn {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 8px;
  border: 1.5px solid var(--border-strong); border-radius: var(--r-btn); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--text);
}
.crl-spacebtn__dot { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 600; flex: none; }
.crl-spacebtn svg { width: 14px; height: 14px; color: var(--text-3); }

/* -------------------------------------------------------------- tab bar -- */

.crl-tabs { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.crl-tabs button { display: flex; align-items: center; gap: 6px; padding: 8px 0 7px; font-size: 13.5px; font-weight: 700; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.crl-tabicon { width: 14px; height: 14px; flex: none; }
.crl-tabs button.is-active { color: var(--brand-purple); border-bottom-color: var(--brand-purple); }
.crl-tabcount { background: var(--surface-3); color: var(--text-2); border-radius: 999px; font-size: 10.5px; font-weight: 600; padding: 1px 7px; min-width: 16px; text-align: center; }
.crl-tabs button.is-active .crl-tabcount { background: var(--brand-purple); color: #fff; }

/* -------------------------------------------------------------- toolbar -- */

.crl-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#crlFilters { margin: 0; padding: 14px 0 18px; background: transparent; border: none; border-radius: 0; }
.crl-toolbar__search { flex: 1; min-width: 220px; position: relative; }
.crl-toolbar__search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); }
.crl-toolbar__search input { width: 100%; height: 34px; padding: 0 14px 0 38px; border-radius: var(--r-btn); border: 1.5px solid var(--border-strong); background: var(--surface); font-size: 13px; }
.crl-filterbtn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border: 1.5px solid var(--border-strong); border-radius: var(--r-btn); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.crl-filterbtn svg { width: 15px; height: 15px; }
.crl-filterbtn.is-active { border-color: var(--brand-violet); color: var(--brand-purple); background: var(--violet-bg); }
.crl-avatargroup { display: flex; align-items: center; }
.crl-avatargroup .crl-avatar { margin-left: -8px; border: 2px solid var(--surface); cursor: pointer; }
.crl-avatargroup .crl-avatar:first-child { margin-left: 0; }
.crl-avatargroup .crl-avatar.is-selected { outline: 2px solid var(--brand-purple); outline-offset: 1px; }
.crl-avatargroup--mini .crl-avatar { width: 20px; height: 20px; font-size: 8px; margin-left: -6px; cursor: default; }
.crl-assigneebtn { padding-left: 6px; }

/* --------------------------------------------------------------- avatar -- */

.crl-avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 10.5px; font-weight: 600; flex: none; }

/* ------------------------------------------------------------- priority -- */

.crl-priority { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.crl-priority__dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.crl-priority--high .crl-priority__dot { background: var(--red-dot); } .crl-priority--high { color: var(--red); }
.crl-priority--medium .crl-priority__dot { background: var(--amber-dot); } .crl-priority--medium { color: var(--amber); }
.crl-priority--low .crl-priority__dot { background: var(--green-dot); } .crl-priority--low { color: var(--green); }

/* --------------------------------------------------------------- status -- */

.crl-status { display: inline-flex; align-items: center; height: 24px; padding: 0 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }

.crl-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---------------------------------------------------------------- tag -- */

.crl-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 9px; border-radius: 999px; background: var(--green-bg); color: var(--green); font-size: 10.5px; font-weight: 600; letter-spacing: .02em; }

/* ------------------------------------------------------------- progress -- */

.crl-progress { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 40px; }
.crl-progress > span { display: block; height: 100%; border-radius: 999px; background: var(--grad-pink); }
.crl-progress--done > span { background: var(--green); }

/* ------------------------------------------------------------------ meta -- */

.crl-meta { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.crl-meta__item { display: inline-flex; align-items: center; gap: 4px; }
.crl-meta__item svg { width: 13px; height: 13px; }

/* ---------------------------------------------------------------- board -- */

.crl-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.crl-column { flex: 0 0 290px; width: 290px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; min-height: 120px; }
.crl-column.is-dragover .crl-column__body { background: var(--violet-bg); outline: 2px dashed var(--brand-violet); outline-offset: -2px; }
.crl-column__head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; }
.crl-column__head b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.crl-column__count { margin-left: auto; background: var(--surface); font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 10px; box-shadow: var(--shadow-xs); }

.crl-column__body { background: var(--surface); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.crl-cardlist { display: flex; flex-direction: column; gap: 10px; }
.crl-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  cursor: grab; transition: box-shadow .14s var(--ease), transform .14s var(--ease);
}
.crl-card:hover { box-shadow: var(--shadow-sm); }
.crl-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.crl-card__addsub { flex: none; width: 20px; height: 20px; border-radius: 6px; color: var(--text-3); display: grid; place-items: center; transition: background .12s var(--ease), color .12s var(--ease); }
.crl-card__addsub svg { width: 13px; height: 13px; }
.crl-card__addsub:hover { background: var(--violet-bg); color: var(--brand-purple); }
.crl-card.is-dragging { opacity: .4; }
.crl-card__title { font-size: 13px; font-weight: 600; color: var(--text); margin: 8px 0 8px; line-height: 1.35; }
.crl-card__due { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-3); margin-bottom: 8px; }
.crl-card__due svg { width: 12px; height: 12px; }
.crl-card__foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.crl-card__foot .crl-progress { max-width: 70px; }
.crl-card__stack { display: flex; align-items: center; margin-left: auto; }
.crl-card__stack .crl-avatar { width: 24px; height: 24px; font-size: 9.5px; margin-left: -7px; border: 2px solid var(--surface); }
.crl-card__stack .crl-avatar:first-child { margin-left: 0; }

.crl-addtask { display: flex; align-items: center; gap: 6px; padding: 8px 6px; font-size: 12.5px; font-weight: 700; color: var(--text-3); border-radius: 9px; }
.crl-addtask:hover { background: var(--surface); color: var(--brand-purple); }
.crl-addtask svg { width: 15px; height: 15px; }

.crl-addtaskbox { background: var(--surface); border: 1.5px solid var(--brand-violet); border-radius: 12px; padding: 10px; }
.crl-addtaskbox input { width: 100%; border: none; font-size: 13px; padding: 4px 2px 10px; }
.crl-addtaskbox input:focus { outline: none; }
.crl-addtaskbox__row { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.crl-addtaskbox__row button { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: var(--text-3); }
.crl-addtaskbox__row button:hover { background: var(--violet-bg); color: var(--brand-purple); }
.crl-addtaskbox__row button svg { width: 15px; height: 15px; }
.crl-addtaskbox__submit { margin-left: auto; background: var(--grad-brand); color: #fff !important; }

/* ------------------------------------------------------------------ table -- */

.crl-table td:first-child, .crl-table th:first-child { width: 1%; white-space: nowrap; }
.crl-tasktitle { font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.crl-taskmeta { display: flex; align-items: center; gap: 10px; }
.crl-taskmeta .crl-progress { max-width: 90px; }
.crl-personcell { display: flex; align-items: center; gap: 8px; }
.crl-personcell__name { font-size: 13px; font-weight: 600; color: var(--text); }
.crl-duecell b { display: block; font-size: 13px; color: var(--text); }
.crl-duecell span { font-size: 11px; color: var(--text-3); }

.crl-rowmenu { position: fixed; z-index: 120; min-width: 170px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); display: none; }
.crl-rowmenu.is-open { display: block; }
.crl-rowmenu__item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-2); text-align: left; }
.crl-rowmenu__item svg { width: 15px; height: 15px; flex: none; }
.crl-rowmenu__item--add:hover { background: var(--violet-bg); color: var(--brand-purple); }
.crl-rowmenu__item--edit:hover { background: var(--amber-bg); color: var(--amber); }
.crl-rowmenu__item--danger { color: var(--red); }
.crl-rowmenu__item--danger:hover { background: var(--red-bg); }

.crl-morebtn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; color: var(--text-3); transition: background .14s var(--ease), color .14s var(--ease); }
.crl-morebtn svg { width: 17px; height: 17px; flex: none; }
.crl-morebtn:hover, .crl-morebtn[aria-expanded="true"] { background: var(--violet-bg); color: var(--brand-purple); }

/* ------------------------------------------------------- sprint / space -- */

.crl-pop { position: fixed; z-index: 130; width: 300px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 10px; display: none; }
.crl-pop.is-open { display: block; }
.crl-pop__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 8px; font-size: 10.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.crl-pop__head a { font-size: 11.5px; font-weight: 700; color: var(--brand-purple); text-transform: none; letter-spacing: 0; }
.crl-pop__item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; text-align: left; }
.crl-pop__item:hover { background: var(--violet-bg); }
.crl-pop__item.is-active { background: var(--violet-bg); }
.crl-pop__check { width: 16px; height: 16px; flex: none; color: var(--brand-purple); }
.crl-pop__item-main { flex: 1; min-width: 0; }
.crl-pop__item-name { font-size: 13px; font-weight: 700; color: var(--text); }
.crl-pop__item-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.crl-pop__new { width: 100%; text-align: left; padding: 9px 8px; border-radius: 10px; font-size: 13px; font-weight: 700; color: var(--brand-purple); border-top: 1px solid var(--border); margin-top: 4px; }
.crl-pop__new:hover { background: var(--violet-bg); }
.crl-pop__spacedot { width: 22px; height: 22px; border-radius: 7px; flex: none; }
.crl-pop__search { margin: 4px 0 8px; }
.crl-pop__search input { height: 32px; }
.crl-pop__list { max-height: 260px; overflow-y: auto; }

/* ------------------------------------------------------------- fd drawer -- */

.crl-fd__body .field { margin-bottom: 16px; }
.crl-fd__section { font-size: 11.5px; font-weight: 600; color: var(--crl-pink); text-transform: uppercase; letter-spacing: .05em; margin: 22px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.crl-fd__section:first-child { margin-top: 0; }
.crl-fd__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.crl-fd__grid .field { margin-bottom: 0; }
.crl-checklist__remove { flex: none; width: 28px; height: 28px; border-radius: 7px; color: var(--text-3); display: grid; place-items: center; }
.crl-checklist__remove:hover { background: var(--red-bg); color: var(--red); }
.crl-addchecklist { font-size: 12.5px; font-weight: 700; color: var(--brand-purple); display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; margin-bottom: 18px; }
.crl-addchecklist svg { width: 14px; height: 14px; }

/* --------------------------------------------------------- task drawer -- */

.crl-taskdrawer__footerright { display: flex; gap: 10px; margin-left: auto; }
.crl-deletebtn { display: inline-flex; align-items: center; gap: 6px; color: var(--red); font-weight: 700; font-size: 13px; padding: 0 6px; }
.crl-deletebtn:hover { color: #fff; background: var(--red); border-radius: var(--r-btn); }

.crl-tftitle { width: 100%; height: 44px; padding: 0 14px; border: 1.5px solid var(--border-strong); border-radius: 10px; font-size: 14px; font-weight: 700; color: var(--text); background: var(--surface); margin-bottom: 12px; transition: border-color .15s, box-shadow .15s; }
.crl-tftitle:focus { border-color: var(--form-focus, var(--brand-violet)); box-shadow: 0 0 0 3px var(--form-focus-ring, var(--violet-bg)); }
.crl-taskdrawer__rte { margin-bottom: 12px; }
.crl-taskdrawer__rte .leave-rte__body { min-height: 110px; }

.crl-attachbtn { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.crl-attachbtn:hover { color: var(--brand-purple); }

.crl-attachlist { display: flex; flex-direction: column; padding: 0 12px; }
.crl-attachlist:not(:empty) { padding-bottom: 8px; }
.crl-attachitem { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.crl-attachitem:last-child { border-bottom: none; }
.crl-attachitem__icon { flex: none; width: 26px; height: 26px; border-radius: 7px; background: var(--violet-bg); color: var(--brand-purple); display: grid; place-items: center; }
.crl-attachitem__icon svg { width: 14px; height: 14px; }
.crl-attachitem__name { flex: 1; min-width: 0; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crl-attachitem__size { flex: none; font-size: 11px; color: var(--text-3); }
.crl-attachitem__remove { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); }
.crl-attachitem__remove:hover { background: var(--red-bg); color: var(--red); }

.crl-collapsible { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; }
.crl-collapsible__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; }
.crl-collapsible__toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.crl-collapsible__chev { width: 14px; height: 14px; flex: none; color: var(--text-3); transition: transform .15s var(--ease); }
.crl-collapsible.is-collapsed .crl-collapsible__chev { transform: rotate(-90deg); }
.crl-collapsible.is-collapsed #tfSubtaskSection,
.crl-collapsible.is-collapsed #tfLinkSection,
.crl-collapsible.is-collapsed #tfActivitySection { display: none; }
#tfSubtaskSection, #tfLinkSection, #tfActivitySection { padding: 0 12px 10px; }

.crl-subtaskbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.crl-subtaskbar__track { flex: 1; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.crl-subtaskbar__track span { display: block; height: 100%; border-radius: 999px; background: var(--green); transition: width .2s var(--ease); }
.crl-subtaskbar__label { flex: none; font-size: 11.5px; font-weight: 600; color: var(--green); }

.crl-subtaskrow-title { display: flex; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--text); }
.crl-subtaskrow-title b { color: var(--brand-purple); margin-right: 6px; white-space: nowrap; }
.crl-subtaskrow-title input { flex: 1; min-width: 0; border: none; background: none; font: inherit; color: var(--text); }
.crl-subtaskrow-title input:focus { outline: none; }
#tfSubtaskBody select { width: 100%; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 12px; font-weight: 600; }

.crl-subtasktable thead th { background: transparent; border-right: none; color: var(--text-3); padding: 8px 10px; }
.crl-subtasktable tbody td { border-right: none; padding: 7px 10px; }
.crl-subtasktable td:first-child { overflow: hidden; }
.crl-subtaskwork { display: flex; align-items: center; gap: 9px; cursor: pointer; min-width: 0; overflow: hidden; }
.crl-subtaskwork input[type="checkbox"] { width: 18px; height: 18px; border-radius: 6px; accent-color: var(--brand-violet); flex: none; cursor: pointer; }
.crl-subtaskwork b { color: var(--crl-pink); font-weight: 600; font-size: 12px; white-space: nowrap; flex: none; }
.crl-subtaskwork span { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crl-subtaskassignee { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; }

.crl-linkworkitem__add { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--violet-bg); color: var(--brand-purple); display: grid; place-items: center; }
.crl-linkworkitem__add:hover { background: var(--brand-violet); color: #fff; }
.crl-linksearch { position: relative; margin-bottom: 10px; }
.crl-linksearch .crl-toolbar__search input { height: 34px; }
.crl-linkitem { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.crl-linkitem:last-child { border-bottom: none; }
.crl-linkitem b { color: var(--crl-pink); font-weight: 600; }
.crl-linkitem__title { flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crl-linkitem__remove { flex: none; width: 20px; height: 20px; display: grid; place-items: center; color: var(--text-3); font-size: 15px; border-radius: 50%; }
.crl-linkitem__remove:hover { background: var(--red-bg); color: var(--red); }
.crl-linkempty { font-size: 12.5px; color: var(--text-3); padding: 4px 0; }

.crl-fd__grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.crl-fd__grid3 .field { margin-bottom: 0; }

.crl-taskdrawer .crl-fd__body .field { margin-bottom: 12px; }
.crl-taskdrawer .crl-fd__grid { gap: 12px; margin-bottom: 12px; }
.crl-taskdrawer .crl-fd__grid3 { gap: 12px; margin-bottom: 12px; }
.crl-taskdrawer .crl-addchecklist { margin-bottom: 2px; }
.crl-taskdrawer .drawer-body { padding: 18px 22px 20px; }
.field__label i { font-style: normal; font-weight: 500; color: var(--text-3); }
.field__label { display: inline-flex; align-items: center; gap: 6px; }
.field__icon { width: 13px; height: 13px; flex: none; color: var(--brand-purple); }
.crl-taskdrawer .field__label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-purple); }
.crl-taskdrawer .field__label i { color: var(--text-3); text-transform: none; letter-spacing: 0; font-weight: 600; }

.crl-fdd { width: 100%; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 12px; border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text); text-align: left; }
.crl-fdd:hover { border-color: var(--brand-violet); }
.crl-fdd__dot { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.crl-fdd__text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crl-fdd__chev { flex: none; width: 14px; height: 14px; color: var(--text-3); }
.crl-fdd--chips { flex-wrap: wrap; align-items: flex-start; }
.crl-fdd__chips { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; align-items: center; }
.crl-fdd__chips-empty { color: var(--text-3); font-weight: 500; }
.crl-fdd__chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px 3px 4px; border-radius: 999px; background: var(--violet-bg); color: var(--brand-purple); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.crl-fdd__chip-remove { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; }
.crl-fdd__chip-remove:hover { background: rgba(124, 58, 237, .18); }
.crl-fdd__chip-remove svg { width: 9px; height: 9px; }

.crl-fddpop { width: 220px; padding: 6px; max-height: 70vh; overflow-y: auto; }
.crl-fdd__list { max-height: 200px; overflow-y: auto; }
.crl-fdd__item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-2); text-align: left; }
.crl-fdd__item:hover { background: var(--violet-bg); color: var(--brand-purple); }
.crl-fdd__item.is-active { background: var(--violet-bg); color: var(--brand-purple); }
.crl-fdd__item .crl-fdd__dot { width: 9px; height: 9px; }
.crl-fdd__item svg { width: 15px; height: 15px; margin-left: auto; flex: none; }
.crl-fdd__item--add { color: var(--brand-purple); border-top: 1px solid var(--border); border-radius: 0; margin-top: 4px; padding-top: 12px; }
.crl-fdd__item--add svg { width: 14px; height: 14px; margin-left: 0; }

.crl-newcat { padding: 10px 10px 6px; }
.crl-newcat__row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.crl-newcat__preview { flex: none; width: 22px; height: 22px; border-radius: 50%; }
.crl-newcat-input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border-radius: 8px; border: 1.5px solid var(--border-strong); background: var(--surface); font-size: 12.5px; }
.crl-newcat-swatches { grid-template-columns: repeat(6, 1fr); padding: 0; }
.crl-newcat-swatches .crl-colorpop__swatch { width: 24px; height: 24px; }
.crl-newcat-actions { display: flex; gap: 8px; margin-top: 8px; }
.crl-newcat-actions .btn { flex: 1; height: 34px; font-size: 12.5px; padding: 0; border-radius: var(--r-btn); }

/* ----------------------------------------------------- activity section -- */

.crl-activitysection { margin-bottom: 0; }
.crl-activitytabs { display: flex; align-items: center; gap: 18px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.crl-activitytabs button { padding: 6px 0; font-size: 12.5px; font-weight: 700; color: var(--text-3); border-bottom: 2px solid transparent; }
.crl-activitytabs button.is-active { color: var(--brand-purple); border-bottom-color: var(--brand-purple); }

.crl-composer { border: 1.5px solid var(--brand-violet); border-radius: 10px; padding: 10px; margin-bottom: 12px; box-shadow: 0 0 0 3px var(--violet-bg); }
.crl-composer textarea { width: 100%; min-height: 40px; border: none; resize: vertical; font: inherit; font-size: 13px; color: var(--text); background: none; }
.crl-composer textarea:focus { outline: none; }
.crl-composer__row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.crl-composer__chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.crl-composer__chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 11.5px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.crl-composer__chip:hover { border-color: var(--brand-violet); color: var(--brand-purple); }
.crl-composer__foot { display: flex; justify-content: flex-end; gap: 8px; flex: none; }

.crl-commentrow { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.crl-commentrow:last-child { border-bottom: none; }
.crl-commentrow__body { flex: 1; min-width: 0; }
.crl-commentrow__head { display: flex; align-items: baseline; gap: 8px; }
.crl-commentrow__name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.crl-commentrow__time { font-size: 11px; color: var(--text-3); }
.crl-commentrow__more { margin-left: auto; width: 24px; height: 24px; flex: none; align-self: flex-start; }
.crl-commentrow__more svg { width: 14px; height: 14px; }
.crl-commentrow__text { font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }

.crl-activitylog { display: flex; flex-direction: column; gap: 14px; }
.crl-activitylog__item { display: flex; gap: 10px; }
.crl-activitylog__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-violet); margin-top: 5px; }
.crl-activitylog__text { font-size: 12.5px; color: var(--text-2); }
.crl-activitylog__text b { color: var(--text); font-weight: 600; }
.crl-activitylog__time { font-size: 11px; color: var(--text-3); margin-left: 8px; }
.crl-activityempty { font-size: 12.5px; color: var(--text-3); padding: 6px 0; }

/* ------------------------------------------------------------ performance -- */

.crl-perf-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.crl-perfstat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.crl-perfstat__top { display: flex; align-items: center; gap: 10px; }
.crl-perfstat__icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.crl-perfstat__label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.crl-perfstat__value { font-size: 23px; font-weight: 600; color: var(--text); letter-spacing: -.5px; }
.crl-perfstat__bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.crl-perfstat__bar > span { display: block; height: 100%; border-radius: 999px; }
.crl-perfstat__caption { font-size: 11px; font-weight: 600; color: var(--text-3); }

.crl-perftable-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.crl-perftable { width: 100%; min-width: 880px; border-collapse: separate; border-spacing: 0; }
.crl-perftable thead th { text-align: left; padding: 12px 16px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-purple); background: var(--violet-bg); white-space: nowrap; }
.crl-perftable thead th:first-child { border-top-left-radius: 13px; }
.crl-perftable thead th:last-child { border-top-right-radius: 13px; }
.crl-perftable tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.crl-perftable tbody tr:last-child td { border-bottom: 0; }
.crl-perftable tbody tr:hover { background: var(--surface-2); }

.crl-perfstaff { display: flex; align-items: center; gap: 10px; }
.crl-perfstaff__name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.crl-perfstaff__role { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.crl-perfprogress__frac { font-size: 13px; font-weight: 700; color: var(--text); }
.crl-perfprogress__pct { font-size: 12px; font-weight: 600; }
.crl-perfbadge { display: inline-flex; align-items: center; height: 25px; padding: 0 12px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.crl-perfbadge--good { background: var(--green-bg); color: var(--green); }
.crl-perfbadge--warn { background: var(--amber-bg); color: var(--amber); }
.crl-perfbadge--bad { background: var(--red-bg); color: var(--red); }
.crl-perfnum { display: block; font-size: 16px; font-weight: 600; }
.crl-perfnum-label { display: block; font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--text-3); letter-spacing: .03em; margin-top: 1px; }

/* ------------------------------------------------------- create space -- */

.crl-fd__section { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.crl-fd__hint { font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text-3); }

.crl-spacelogo { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.crl-spacelogo__preview { flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--grad-brand); color: #fff; font-size: 15px; font-weight: 600; display: grid; place-items: center; }
.crl-spacelogo__meta { display: flex; flex-direction: column; gap: 6px; }
.crl-spacelogo__hint { font-size: 11.5px; color: var(--text-3); }

.crl-wflist, .crl-typelist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.crl-wfrow, .crl-typerow { display: flex; align-items: center; gap: 8px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; padding: 7px 9px; }
.crl-wfrow.is-dragging, .crl-typerow.is-dragging { opacity: .4; }
.crl-wfrow__handle, .crl-typerow__handle { flex: none; display: grid; place-items: center; width: 18px; height: 18px; color: var(--text-3); cursor: grab; }
.crl-wfrow__dot { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; transition: box-shadow .14s var(--ease), transform .14s var(--ease); }
.crl-wfrow__dot:hover { box-shadow: 0 0 0 2px var(--brand-violet); transform: scale(1.08); }
.crl-wfrow__input, .crl-typerow__name { flex: 1; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 12.5px; font-weight: 600; min-width: 0; }
.crl-typerow__status { flex: none; width: 150px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 12.5px; font-weight: 600; }
.crl-wfrow__badge { flex: none; font-size: 9.5px; font-weight: 600; letter-spacing: .04em; color: var(--brand-purple); background: var(--violet-bg); padding: 3px 7px; border-radius: 999px; }
.crl-wfrow__badge--last { color: var(--green); background: var(--green-bg); }
.crl-wfrow__del, .crl-typerow__del { flex: none; width: 28px; height: 28px; border-radius: 7px; color: var(--text-3); display: grid; place-items: center; }
.crl-wfrow__del:hover, .crl-typerow__del:hover { background: var(--red-bg); color: var(--red); }
.crl-wfrow__del:disabled { opacity: .35; cursor: not-allowed; }
.crl-wfrow__del:disabled:hover { background: none; color: var(--text-3); }

.crl-addrow-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--brand-purple); border: 1.5px dashed var(--border-strong); border-radius: 9px; padding: 8px 14px; width: 100%; justify-content: center; transition: background .14s var(--ease), border-color .14s var(--ease); }
.crl-addrow-btn:hover { background: var(--violet-bg); border-color: var(--brand-violet); }
.crl-addrow-btn svg { flex: none; }

.crl-membersearch { position: relative; }
.crl-memberresults { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: none; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; z-index: 5; }
.crl-memberresults.is-open { display: flex; }
.crl-memberresults__item { display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--text); text-align: left; }
.crl-memberresults__item:hover { background: var(--violet-bg); }
.crl-memberresults__empty { padding: 10px 9px; font-size: 12px; color: var(--text-3); }
.crl-fd__body .table-wrap { overflow-x: hidden; }
.crl-fd__body .table-wrap .commonstyletabletwo { min-width: 0; table-layout: fixed; }
.crl-fd__body .table-wrap .commonstyletabletwo td, .crl-fd__body .table-wrap .commonstyletabletwo th { white-space: normal; }
.crl-fd__body .table-wrap .crl-subtasktable { table-layout: auto; }

.crl-colorpop { width: 216px; }
.crl-colorpop__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; padding: 4px 6px 6px; }
.crl-colorpop__swatch { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(0,0,0,.08); cursor: pointer; transition: transform .12s var(--ease); }
.crl-colorpop__swatch:hover { transform: scale(1.12); }
.crl-colorpop__swatch.is-active { border: 2px solid var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--text); }

/* -------------------------------------------------------------- modal -- */

.crl-modal { position: fixed; inset: 0; z-index: 160; padding: 20px; display: none; align-items: center; justify-content: center; background: rgba(36, 28, 60, .45); }
.crl-modal.show { display: flex; }
.crl-modal__box { width: 420px; max-width: 100%; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 26px; }
.crl-modal__icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--red-bg); color: var(--red); margin-bottom: 14px; }
.crl-modal h3 { font-size: 16.5px; font-weight: 600; margin: 0 0 8px; }
.crl-modal p { font-size: 13px; color: var(--text-2); line-height: 1.55; margin: 0; }
.crl-modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* --------------------------------------------------------- spaces drawer -- */

.crl-spaceslistdrawer { width: 880px; }
.crl-spacesdrawer__tabs { padding: 0 26px; border-bottom: 1px solid var(--border); flex: none; }
.crl-spacesdrawer__tabs .crl-tabs { border-bottom: none; }
.crl-spacename__code { display: inline-flex; align-items: center; height: 20px; padding: 0 9px; border-radius: 999px; background: var(--violet-bg); color: var(--brand-purple); font-size: 10.5px; font-weight: 600; letter-spacing: .02em; margin-top: 4px; }

@media (max-width: 760px) {
  .crl-headrow { flex-direction: column; align-items: stretch; }
  .crl-fd__grid { grid-template-columns: 1fr; }
}
.CareloopDiv {padding: 25px;}