/* ==========================================================================
   CareMetrix — Asset Master List
   Follows the same conventions as funding.css / rosters.css: rules scoped
   under `.ast`, listing card built from the shared card/table/pagination
   components, and a single fixed-position 3-dot row menu shared by every
   row (same pattern as roster-templates.css's .rowmenu__*).
   ========================================================================== */

.ast {
  --ast-pink: #D0479A; --ast-pink-soft: #FBEAF4;
}

/* -------------------------------------------------------------- pagepath -- */

.ast-pagepath { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

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

.ast-card { overflow: hidden; }

.ast-headrow {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.ast-headrow__title h1 { font-size: 19px; font-weight: 600; letter-spacing: -.2px; }
.ast-headrow__title p { margin-top: 3px; font-size: 12.5px; color: var(--text-2); }

.ast-headrow__actions { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; flex: none; }
.ast-headrow__actions select {
  height: 38px; padding: 0 14px; border-radius: var(--r-btn);
  border: 1.5px solid var(--border-strong); background: var(--surface);
  font-size: 13px; color: var(--text-2); min-width: 170px;
}

.ast-pinkbtn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border: 1.5px solid var(--ast-pink); border-radius: var(--r-btn);
  background: var(--surface); color: var(--ast-pink);
  font-size: 13px; font-weight: 700;
  transition: all .14s var(--ease);
}
.ast-pinkbtn:hover { background: var(--ast-pink-soft); }
.ast-pinkbtn svg { width: 16px; height: 16px; }

/* ---- inline filter bar, same pattern as roster-templates.css's .rt-filters ---- */

.ast-filters {
  padding: 18px 24px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.ast-filters[hidden] { display: none; }
.ast-filters__row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.ast-filter { display: flex; flex-direction: column; gap: 6px; flex: 1 1 160px; min-width: 0; }
.ast-filter__label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.ast-filters__actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; margin-left: auto; }
.ast-pinkbtn.is-open { background: var(--ast-pink-soft); }

/* ------------------------------------------------------------ searchrow -- */

.ast-searchrow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.ast-search { position: relative; display: flex; align-items: center; flex: 1; min-width: 240px; max-width: 480px; }
.ast-search svg { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.ast-search input {
  width: 100%; box-sizing: border-box;
  font-size: 13px; padding: 9px 14px 9px 40px;
  border: 1.5px solid var(--form-border); border-radius: var(--r-pill);
  background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ast-search input:focus { border-color: var(--form-focus); box-shadow: 0 0 0 3px var(--form-focus-ring); }

.ast-searchrow__pagination { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.ast-searchrow__perpage { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.ast-searchrow__perpage select { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; background: var(--surface); color: var(--text); }

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

.ast-sort { margin-left: 5px; font-size: 12px; font-weight: 600; color: #A99FBE; }

.ast-card .table-wrap { width: auto; margin: 20px 24px 24px; border: 1px solid var(--commontable2-cell-border); border-radius: 12px; overflow-x: auto; }
.ast-card .table-wrap thead tr th:first-child { border-top-left-radius: 11px; }
.ast-card .table-wrap thead tr th:last-child { border-top-right-radius: 11px; }

/* gradient row marker, matching roster-templates.css's listing table exactly */
.ast-table tbody td:first-child { position: relative; padding-left: 26px; }
.ast-table tbody td:first-child::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #E24FA8, #9B5CF6);
}

.ast-asset__name { font-weight: 600; color: var(--text); font-size: 13.5px; }
.ast-asset__code { display: inline-block; margin-top: 4px; font-size: 10.5px; font-weight: 700; color: var(--text-3); background: var(--surface-2); border-radius: 6px; padding: 2px 7px; }

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

.ast-req { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.ast-req svg { width: 15px; height: 15px; flex: none; }
.ast-req--yes { color: var(--green); }
.ast-req--no { color: var(--red); }

.ast-status { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.ast-status--active { background: var(--green-bg); color: var(--green); }
.ast-status--inactive { background: var(--surface-3); color: var(--text-3); }

.ast-morebtn {
  width: 32px; height: 32px; border-radius: 9px; border: none;
  background: transparent; color: var(--text-3);
  display: inline-grid; place-items: center; cursor: pointer;
  transition: all .16s var(--ease);
}
.ast-morebtn svg { width: 18px; height: 18px; }
.ast-morebtn:hover, .ast-morebtn[aria-expanded="true"] { background: var(--violet-bg); color: var(--brand-purple); }

/* shared 3-dot row action menu — single fixed-position instance reused by
   every row, same pattern as roster-templates.css's .rowmenu__list. */
.ast-rowmenu {
  position: fixed; z-index: 120; min-width: 150px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); display: none;
}
.ast-rowmenu.is-open { display: block; }
.ast-rowmenu__item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--amber); text-align: left;
  transition: background .16s var(--ease);
}
.ast-rowmenu__item svg { width: 16px; height: 16px; flex: none; }
.ast-rowmenu__item:hover { background: var(--amber-bg); }
.ast-rowmenu__item--danger { color: var(--red); }
.ast-rowmenu__item--danger:hover { background: var(--red-bg); }

/* --------------------------------------------------------- add/edit drawer */

.ast-fd__body .field { margin-bottom: 16px; }
.ast-fd__body .field__label b { color: var(--red); font-weight: 700; margin-left: 2px; }

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

.ast-rte {
  border: 1.5px solid var(--form-border); border-radius: var(--form-radius);
  background: var(--surface); overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.ast-rte:focus-within { border-color: var(--form-focus); box-shadow: 0 0 0 3px var(--form-focus-ring); }

.ast-rte__toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
  padding: 8px 10px; background: var(--surface-3);
  border-bottom: 1px solid var(--border);
}
.ast-rte__sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 6px; }
.ast-rte__btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 4px; border-radius: 6px;
  font-size: 13px; font-weight: 700; color: var(--text-2);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.ast-rte__btn:hover { background: var(--violet-bg); color: var(--brand-purple); }
.ast-rte__tt { font-weight: 600; }

.ast-rte__body {
  min-height: 110px; padding: 12px 14px; font-size: 13px; color: var(--text);
  line-height: 1.5; outline: none;
}
.ast-rte__body:empty:before { content: attr(data-placeholder); color: var(--text-3); pointer-events: none; }

.ast-switchrow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--border);
}
.ast-switchrow:last-of-type { border-bottom: none; }
.ast-switchrow__text b { display: block; font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.ast-switchrow__text span { font-size: 12px; color: var(--text-2); line-height: 1.4; }

.ast-switch { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; flex: none; }
.ast-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.ast-switch__track {
  position: relative; width: 42px; height: 24px; border-radius: 999px;
  background: var(--surface-3); transition: background .18s var(--ease);
}
.ast-switch__track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(36, 28, 60, .25);
  transition: transform .18s var(--ease);
}
.ast-switch input:checked + .ast-switch__track { background: var(--ast-pink); }
.ast-switch input:checked + .ast-switch__track::after { transform: translateX(18px); }
.ast-switch__label { font-size: 13px; font-weight: 700; color: var(--text-3); min-width: 22px; }
.ast-switch input:checked ~ .ast-switch__label { color: var(--text); }

/* ------------------------------------------------------- delete confirm -- */

.ast-modal {
  position: fixed; inset: 0; z-index: 150; padding: 20px;
  display: none; align-items: center; justify-content: center;
  background: rgba(36, 28, 60, .45); backdrop-filter: blur(1px);
}
.ast-modal.show { display: flex; }
.ast-modal__box { width: 420px; max-width: 100%; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 26px; }
.ast-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;
}
.ast-modal__icon svg { width: 20px; height: 20px; }
.ast-modal__box h3 { font-size: 16.5px; font-weight: 600; margin: 0 0 8px; }
.ast-modal__box p { font-size: 13px; color: var(--text-2); line-height: 1.55; margin: 0; }
.ast-modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.ast-modal__danger { background: var(--red); color: #fff; border-radius: var(--r-btn); border: none; }
.ast-modal__danger:hover { background: #C81E1E; }

@media (max-width: 760px) {
  .ast-headrow, .ast-searchrow { flex-direction: column; align-items: stretch; }
  .ast-headrow__actions select { min-width: 0; flex: 1; }
  .ast-fd__grid { grid-template-columns: 1fr; }
  .ast-filters__row { flex-direction: column; align-items: stretch; }
  .ast-filters__actions { margin-left: 0; }
}
