/* ==========================================================================
   CareMetrix — My Leave (Apply Leave / Leave Management)
   Follows the same conventions as the Asset Management module: rules
   scoped under `.leave`, listing card built from the shared
   card/table/pagination components, inline filter bar, a single
   fixed-position 3-dot row menu, and slide-over drawers moved to <body> to
   escape the page's fade-up animation (see apply-leave.js's mountOverlays()).
   ========================================================================== */

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

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

.leave-pagepath { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.leave-pagepath__actions { display: flex; align-items: center; gap: 10px; }

.leave-outlinebtn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: var(--r-btn);
  border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13.5px; font-weight: 700;
  transition: all .14s var(--ease);
}
.leave-outlinebtn:hover { border-color: var(--brand-violet); color: var(--brand-purple); }
.leave-outlinebtn svg { width: 16px; height: 16px; }

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

.leave-card { overflow: hidden; }

.leave-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);
}
.leave-headrow__title h1 { font-size: 19px; font-weight: 600; letter-spacing: -.2px; }
.leave-headrow__title p { margin-top: 3px; font-size: 12.5px; color: var(--text-2); }

.leave-headrow__actions { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; flex: none; }
.leave-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;
}

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

/* ---- inline filter bar ---- */

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

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

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

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

.leave-searchrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.leave-searchrow__pagination { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-left: auto; }
.leave-searchrow__perpage { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.leave-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 */

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

.leave-table th.t-right, .leave-table td.t-right { width: 1%; white-space: nowrap; }
.leave-table td.is-hidden-col, .leave-table th.is-hidden-col { display: none; }
.leave-table tbody td:first-child { position: relative; padding-left: 26px; }
.leave-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);
}

.leave-shiftpill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 12px; border-radius: 999px;
  background: var(--violet-bg); color: var(--brand-purple);
  font-size: 11.5px; font-weight: 700; border: none; cursor: pointer; white-space: nowrap;
}
.leave-shiftpill svg { width: 12px; height: 12px; }

.leave-status { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.leave-status--pending { background: var(--amber-bg); color: var(--amber); }
.leave-status--approved { background: var(--green-bg); color: var(--green); }
.leave-status--rejected { background: var(--red-bg); color: var(--red); }
.leave-status--cancelled { background: var(--surface-3); color: var(--text-3); }
.leave-status--completed { background: var(--violet-bg); color: var(--brand-purple); }

.leave-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); }
.leave-morebtn svg { width: 18px; height: 18px; }
.leave-morebtn:hover, .leave-morebtn[aria-expanded="true"] { background: var(--violet-bg); color: var(--brand-purple); }

.leave-rowmenu { position: fixed; z-index: 120; min-width: 190px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); display: none; }
.leave-rowmenu.is-open { display: block; }
.leave-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(--text-2); text-align: left; transition: background .16s var(--ease); }
.leave-rowmenu__item svg { width: 16px; height: 16px; flex: none; }
.leave-rowmenu__item--view { color: var(--brand-purple); }
.leave-rowmenu__item--view:hover { background: var(--violet-bg); }
.leave-rowmenu__item--edit { color: var(--amber); }
.leave-rowmenu__item--edit:hover { background: var(--amber-bg); }
.leave-rowmenu__item--download { color: var(--blue); }
.leave-rowmenu__item--download:hover { background: var(--blue-bg); }
.leave-rowmenu__item--reapply { color: var(--green); }
.leave-rowmenu__item--reapply:hover { background: var(--green-bg); }
.leave-rowmenu__item--danger { color: var(--red); }
.leave-rowmenu__item--danger:hover { background: var(--red-bg); }

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

.leave-fd__body .field { margin-bottom: 16px; }
.leave-fd__section { font-size: 11.5px; font-weight: 600; color: var(--leave-pink); text-transform: uppercase; letter-spacing: .05em; margin: 22px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.leave-fd__section:first-child { margin-top: 0; }
.leave-fd__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.leave-fd__grid .field { margin-bottom: 0; }

.leave-balancebox { display: flex; flex-direction: column; gap: 8px; background: var(--amber-bg); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.leave-balancebox__row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--amber); font-weight: 700; }
.leave-balancebox__row b { font-size: 13.5px; }

.leave-dayrow { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.leave-dayrow__top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.leave-dayrow__label { flex: 1; font-size: 13px; font-weight: 700; color: var(--text); }
.leave-dayrow__label span { margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--text-3); }
.leave-dayrow__pill { flex: none; display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 999px; background: var(--violet-bg); color: var(--brand-purple); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.leave-dayrow__remove { flex: none; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-3); display: grid; place-items: center; cursor: pointer; }
.leave-dayrow__remove:hover { background: var(--red-bg); color: var(--red); border-color: var(--red-bg); }

.leave-dayrow__shifts { display: flex; flex-wrap: wrap; gap: 8px; }
.leave-dayshift {
  flex: 1 1 150px; min-width: 150px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--border-strong); background: var(--surface-2); border-radius: 10px; padding: 8px 12px;
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.leave-dayshift__time { font-size: 12.5px; font-weight: 700; color: var(--text-3); }
.leave-dayshift__time span { font-weight: 600; color: var(--text-3); }
.leave-dayshift__meta { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.leave-dayshift.is-selected { border-color: var(--leave-pink); background: var(--leave-pink-soft); }
.leave-dayshift.is-selected .leave-dayshift__time { color: var(--text); }

.leave-totalbar { display: flex; align-items: center; justify-content: space-between; background: var(--violet-bg); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; font-size: 13px; font-weight: 700; color: var(--brand-purple); }
.leave-totalbar b { font-size: 15px; }

.leave-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--border); margin-top: 4px; }
.leave-switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.leave-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.leave-switch__track { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--surface-3); transition: background .18s var(--ease); }
.leave-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); }
.leave-switch input:checked + .leave-switch__track { background: var(--leave-pink); }
.leave-switch input:checked + .leave-switch__track::after { transform: translateX(18px); }
.leave-switch__label { font-size: 13px; font-weight: 700; color: var(--text-3); }
.leave-switch input:checked ~ .leave-switch__label { color: var(--text); }

.leave-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; }
.leave-rte:focus-within { border-color: var(--form-focus); box-shadow: 0 0 0 3px var(--form-focus-ring); }
.leave-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); }
.leave-rte__sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 6px; }
.leave-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); }
.leave-rte__btn:hover { background: var(--violet-bg); color: var(--brand-purple); }
.leave-rte__tt { font-weight: 600; }
.leave-rte__body { min-height: 90px; padding: 12px 14px; font-size: 13px; color: var(--text); line-height: 1.5; outline: none; }
.leave-rte__body:empty:before { content: attr(data-placeholder); color: var(--text-3); pointer-events: none; }

.leave-upload { border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 26px 16px; text-align: center; cursor: pointer; color: var(--brand-purple); background: var(--violet-bg); transition: all .14s var(--ease); }
.leave-upload:hover { background: #EFE7FE; }
.leave-upload svg { width: 22px; height: 22px; margin: 0 auto 6px; display: block; }
.leave-upload b { font-size: 13px; }
.leave-upload small { display: block; margin-top: 3px; font-size: 11px; color: var(--text-3); }

/* ------------------------------------------------------- leave balance -- */

.leave-employee {
  background: var(--violet-bg); border-radius: 14px; padding: 16px 18px; margin-bottom: 22px;
}
.leave-employee__name { font-size: 14.5px; font-weight: 600; color: var(--text); }
.leave-employee__sub { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.leave-employee__year-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.leave-employee__year-row b { font-size: 13px; color: var(--text); }

.leave-typecard {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px;
  cursor: pointer; transition: all .14s var(--ease);
}
.leave-typecard:hover { border-color: var(--brand-violet); box-shadow: var(--shadow-sm); }
.leave-typecard__dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.leave-typecard__name { font-size: 13.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; }
.leave-typecard__avail { font-size: 11.5px; color: var(--text-3); margin: 6px 0 4px; }
.leave-typecard__hours { font-size: 22px; font-weight: 600; color: var(--brand-purple); }
.leave-typecard__meta { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-2); margin-top: 8px; }
.leave-typecard__meta b { color: var(--text); font-weight: 700; }
.leave-typecard__bar { width: 100%; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.leave-typecard__bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #C026D3, #7C3AED); }
.leave-typecard__chev { flex: none; color: var(--text-3); width: 16px; height: 16px; }
.leave-typecard--unpaid .leave-typecard__avail { font-style: italic; color: var(--text-3); }

.leave-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--brand-purple); margin-bottom: 14px; cursor: pointer; }
.leave-back svg { width: 15px; height: 15px; }

.leave-detailhead h3 { font-size: 17px; font-weight: 600; }
.leave-detailhead p { font-size: 12.5px; color: var(--text-3); margin-top: 3px; margin-bottom: 18px; }

.leave-statpills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.leave-statpill { border-radius: 12px; padding: 12px 14px; }
.leave-statpill__label { font-size: 11px; font-weight: 700; }
.leave-statpill__value { font-size: 17px; font-weight: 600; margin-top: 4px; }
.leave-statpill--entitled { background: var(--violet-bg); } .leave-statpill--entitled .leave-statpill__label { color: var(--brand-purple); } .leave-statpill--entitled .leave-statpill__value { color: var(--brand-purple); }
.leave-statpill--used { background: var(--amber-bg); } .leave-statpill--used .leave-statpill__label { color: var(--amber); } .leave-statpill--used .leave-statpill__value { color: var(--amber); }
.leave-statpill--pending { background: #FBEAF4; } .leave-statpill--pending .leave-statpill__label { color: var(--leave-pink); } .leave-statpill--pending .leave-statpill__value { color: var(--leave-pink); }
.leave-statpill--available { background: var(--green-bg); } .leave-statpill--available .leave-statpill__label { color: var(--green); } .leave-statpill--available .leave-statpill__value { color: var(--green); }

.leave-metarow { display: flex; justify-content: space-between; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.leave-metarow__label { font-size: 11.5px; color: var(--text-3); }
.leave-metarow__value { font-size: 13.5px; font-weight: 700; color: var(--text); margin-top: 3px; }

.leave-segtabs { display: flex; gap: 8px; margin-bottom: 16px; }
.leave-segtabs button { height: 32px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 700; }
.leave-segtabs button.is-active { background: var(--brand-purple); border-color: var(--brand-purple); color: #fff; }

/* activity list */
.leave-activity { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.leave-activity.is-open { border-color: var(--brand-violet); }
.leave-activity__head { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; cursor: pointer; text-align: left; }
.leave-activity__title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.leave-activity__sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.leave-activity__right { display: flex; align-items: center; gap: 10px; }
.leave-activity__chev { width: 15px; height: 15px; color: var(--text-3); transition: transform .16s var(--ease); }
.leave-activity.is-open .leave-activity__chev { transform: rotate(180deg); }
.leave-activity__body { display: none; padding: 0 16px 16px; }
.leave-activity.is-open .leave-activity__body { display: block; }

/* day-wise breakdown, reused by activity expand / Leave Shift Schedule / View drawer */
.leave-day { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.leave-day.is-open { border-color: var(--brand-violet); }
.leave-day--muted { opacity: .6; }
.leave-day__head { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; cursor: pointer; text-align: left; background: var(--surface); }
.leave-day--muted .leave-day__head { background: var(--surface-2); cursor: default; }
.leave-day__date { font-size: 13px; font-weight: 700; color: var(--text); }
.leave-day__weekday { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }
.leave-day__right { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--brand-purple); font-weight: 700; }
.leave-day__chev { width: 14px; height: 14px; color: var(--text-3); transition: transform .16s var(--ease); }
.leave-day.is-open .leave-day__chev { transform: rotate(180deg); }
.leave-day__body { display: none; padding: 4px 14px 12px; }
.leave-day.is-open .leave-day__body { display: block; }

.leave-shiftrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.leave-shiftrow:first-child { border-top: none; }
.leave-shiftrow__icon { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; background: var(--green); }
.leave-shiftrow__icon svg { width: 11px; height: 11px; }
.leave-shiftrow__icon--off { background: var(--surface-3); color: var(--text-3); }
.leave-shiftrow__main { flex: 1; min-width: 0; }
.leave-shiftrow__time { font-size: 13px; font-weight: 700; color: var(--text); }
.leave-shiftrow__meta { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.leave-shiftbadge { flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.leave-shiftbadge--leave { background: var(--green-bg); color: var(--green); }
.leave-shiftbadge--working { background: var(--surface-3); color: var(--text-3); }

/* -------------------------------------------------------------- view -- */

.leave-view__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin-bottom: 8px; }
.leave-view__field { display: flex; flex-direction: column; gap: 5px; }
.leave-view__label { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.leave-view__value { font-size: 13.5px; font-weight: 700; color: var(--text); }
.leave-view__reason { font-size: 13px; color: var(--text-2); line-height: 1.55; margin-bottom: 14px; }
.leave-view__reason b { display: block; font-size: 13px; color: var(--text); margin-bottom: 4px; }
.leave-view__file { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-weight: 700; color: var(--text); }
.leave-view__file svg { width: 15px; height: 15px; flex: none; color: var(--brand-purple); }

.leave-approvalstep { display: flex; gap: 12px; }
.leave-approvalstep__rail { display: flex; flex-direction: column; align-items: center; flex: none; }
.leave-approvalstep__dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--surface-3); flex: none; }
.leave-approvalstep__dot svg { width: 13px; height: 13px; }
.leave-approvalstep__dot--done { background: var(--green); }
.leave-approvalstep__dot--current { background: var(--amber); }
.leave-approvalstep__dot--waiting { background: var(--surface-3); border: 2px solid var(--border-strong); }
.leave-approvalstep__line { flex: 1; width: 2px; background: var(--border); margin: 4px 0; min-height: 22px; }
.leave-approvalstep:last-child .leave-approvalstep__line { display: none; }
.leave-approvalstep__body { padding-bottom: 20px; }
.leave-approvalstep__title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.leave-approvalstep__sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

@media (max-width: 760px) {
  .leave-headrow, .leave-searchrow { flex-direction: column; align-items: stretch; }
  .leave-headrow__actions select { min-width: 0; flex: 1; }
  .leave-fd__grid, .leave-view__grid { grid-template-columns: 1fr; }
  .leave-filters__row { flex-direction: column; align-items: stretch; }
  .leave-filters__actions { margin-left: 0; }
  .leave-statpills { grid-template-columns: repeat(2, 1fr); }
  .leave-tabs { overflow-x: auto; }
}
