/* ==========================================================================
   CareMetrix — Leave Analytics (admin reporting over the leave dataset)
   Reuses global components (.stat/.stat-grid, .card, .tabs, .badge, .notice,
   .drawer, .overlay, .toast) and follows the same page-scoped-CSS + IIFE +
   mountOverlays() convention as Leave Approvals / My Leave.
   ========================================================================== */

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

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

/* the shared .page rule already applies `gap: 22px` between direct
   children via flexbox, so these top-level sections must not add their own
   margin-bottom — that stacked with the flex gap and produced large,
   uneven blank bands down the page. */
.lan-pagepath { margin-bottom: 0; }

.lan-titlerow { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.lan-titlerow h1 { font-size: 22px; font-weight: 600; letter-spacing: -.3px; }
.lan-titlerow p { margin-top: 4px; font-size: 13px; color: var(--text-2); }
.lan-titlerow__actions { display: flex; align-items: center; gap: 10px; flex: none; }
.lan-titlerow__actions select {
  height: 40px; 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: 190px;
}
.lan-pinkbtn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border: 1.5px solid var(--lan-pink); border-radius: var(--r-btn);
  background: var(--surface); color: var(--lan-pink);
  font-size: 13.5px; font-weight: 700;
  transition: all .14s var(--ease);
}
.lan-pinkbtn:hover { background: var(--lan-pink-soft); }
.lan-pinkbtn svg { width: 16px; height: 16px; }
.lan-pinkbtn.is-active { background: var(--lan-pink-soft); }

/* -------------------------------------------------------------- chips -- */

.lan-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lan-chips:empty { display: none; }
.lan-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 8px 0 12px; border-radius: 999px;
  background: var(--violet-bg); color: var(--brand-purple);
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.lan-chip button { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: inherit; }
.lan-chip button:hover { background: rgba(124,58,237,.16); }
.lan-chip button svg { width: 11px; height: 11px; }
.lan-chips__clear { font-size: 12px; font-weight: 700; color: var(--text-3); align-self: center; }
.lan-chips__clear:hover { color: var(--red); }

/* --------------------------------------------------------- summary cards -- */

.lan-stats { margin-bottom: 0; }
.lan-statcard { cursor: pointer; transition: transform .16s var(--ease), box-shadow .16s var(--ease); }
.lan-statcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.lan-statcard:focus-visible { outline: 2.5px solid var(--brand-purple); outline-offset: 2px; }
.lan-statcard .stat__label { display: flex; align-items: center; gap: 6px; }
.lan-noncompare { color: var(--text-3) !important; font-style: italic; }

/* --------------------------------------------------------------- banner -- */

.lan-warnbanner { align-items: center; justify-content: space-between; flex-wrap: wrap; }
.lan-warnbanner__text b { display: block; font-size: 13.5px; color: var(--amber); }
.lan-warnbanner__text span { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-top: 2px; }
.lan-warnbanner__action { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--amber); white-space: nowrap; }
.lan-warnbanner__action svg { width: 15px; height: 15px; }
.lan-warnbanner__action:hover { text-decoration: underline; }
.lan-warnbanner--ok { background: var(--green-bg); color: var(--green); }
.lan-warnbanner--ok .lan-warnbanner__text b { color: var(--green); }

/* ---------------------------------------------------------------- grid -- */

.lan-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 940px) { .lan-grid2 { grid-template-columns: 1fr; } }

.lan-chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: nowrap; }
.lan-chart-head > div:first-child { min-width: 0; }
.lan-chart-head p { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.lan-chart-controls { display: flex; align-items: center; gap: 8px; flex: none; white-space: nowrap; }
.lan-chart-controls select { height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border-strong); font-size: 12px; background: var(--surface); }
.lan-clearsel { font-size: 11.5px; font-weight: 700; color: var(--brand-purple); }
.lan-clearsel:hover { text-decoration: underline; }
.lan-clearsel[hidden] { display: none; }

/* legend used by Paid vs Unpaid */
.lan-legend { display: flex; align-items: center; gap: 14px; }
.lan-legend--bottom { justify-content: center; padding: 0 24px 20px; }
.lan-legenditem { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-2); cursor: pointer; user-select: none; }
.lan-legenditem__dot { width: 9px; height: 9px; border-radius: 50%; }
.lan-legenditem.is-off { opacity: .38; text-decoration: line-through; }

/* -------------------------------------------------------------- charts -- */

.lan-chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.lan-bar { cursor: pointer; transition: opacity .12s var(--ease); }
.lan-bar:hover, .lan-bar:focus-visible { opacity: .82; }
.lan-bar.is-dim { opacity: .28; }
.lan-bar.is-selected { stroke: var(--brand-purple); stroke-width: 2px; }
.lan-bar:focus-visible { outline: none; stroke: var(--brand-purple); stroke-width: 2px; }
.lan-axislabel { font-size: 11px; fill: var(--text-3); font-family: inherit; }
.lan-barvalue { font-size: 11px; font-weight: 700; fill: var(--text-2); font-family: inherit; }

.lan-point { cursor: pointer; }
.lan-point circle { transition: r .12s var(--ease); }
.lan-point:hover circle:not(.lan-point__halo), .lan-point:focus-visible circle:not(.lan-point__halo) { r: 6; }
.lan-point.is-selected circle:not(.lan-point__halo) { r: 6.5; stroke: var(--brand-purple); stroke-width: 2px; }
.lan-point:focus-visible { outline: none; }
.lan-point:hover .lan-point__halo, .lan-point:focus-visible .lan-point__halo, .lan-point.is-selected .lan-point__halo { r: 11; }

.lan-tooltip {
  position: fixed; z-index: 400; pointer-events: none;
  background: var(--text); color: #fff; font-size: 12px; font-weight: 600;
  padding: 8px 11px; border-radius: 9px; box-shadow: var(--shadow-md);
  max-width: 240px; line-height: 1.45; display: none;
}
.lan-tooltip.show { display: block; }
.lan-tooltip b { display: block; font-weight: 600; margin-bottom: 2px; }

/* ------------------------------------------------------------- rank lists -- */

.lan-ranklist { display: flex; flex-direction: column; }
.lan-rankrow {
  display: flex; align-items: center; gap: 14px; padding: 12px 4px;
  border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 10px;
  transition: background .12s var(--ease);
}
.lan-rankrow:last-child { border-bottom: none; }
.lan-rankrow:hover, .lan-rankrow:focus-visible { background: var(--surface-2); }
.lan-rankrow:focus-visible { outline: none; }
.lan-rank-icon {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; color: #fff; font-size: 12.5px; font-weight: 600;
}
.lan-rank-main { flex: 1; min-width: 0; }
.lan-rank-name { font-size: 13.5px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lan-rank-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.lan-rank-value { flex: none; text-align: right; }
.lan-rank-hrs { font-size: 13.5px; font-weight: 600; color: var(--text); }
.lan-rank-days { font-size: 11px; color: var(--text-3); margin-top: 1px; }

.lan-viewall { display: block; width: 100%; text-align: center; padding: 12px; margin-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--brand-purple); border-top: 1px solid var(--border); }
.lan-viewall:hover { background: var(--violet-bg); }

/* --------------------------------------------------------------- states -- */

.lan-empty, .lan-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.lan-empty svg, .lan-loading svg { width: 34px; height: 34px; color: var(--text-3); opacity: .6; }
.lan-loading .lan-spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--violet-bg); border-top-color: var(--brand-purple); animation: lan-spin .7s linear infinite; }
@keyframes lan-spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------- filter drawer -- */

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

.lan-daterange { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.lan-daterange button { height: 34px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 700; }
.lan-daterange button.is-active { background: var(--brand-purple); border-color: var(--brand-purple); color: #fff; }
.lan-customrange { display: none; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.lan-customrange.show { display: grid; }

/* ------------------------------------------------------------ drilldown -- */

.lan-drawer-summary { display: flex; align-items: center; gap: 14px; background: var(--violet-bg); border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; flex-wrap: wrap; }
.lan-drawer-summary__item { flex: 1 1 100px; min-width: 90px; }
.lan-drawer-summary__label { font-size: 10.5px; font-weight: 700; color: var(--brand-purple); text-transform: uppercase; letter-spacing: .03em; }
.lan-drawer-summary__value { font-size: 16px; font-weight: 600; color: var(--text); margin-top: 3px; }

.lan-searchrow { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.lan-searchrow input { flex: 1; height: 38px; padding: 0 14px; border-radius: var(--r-btn); border: 1.5px solid var(--border-strong); font-size: 13px; background: var(--surface); }
.lan-sortbtns { display: flex; gap: 6px; flex: none; }
.lan-sortbtns button { height: 38px; padding: 0 12px; border-radius: var(--r-btn); border: 1.5px solid var(--border-strong); background: var(--surface); font-size: 12px; font-weight: 700; color: var(--text-2); }
.lan-sortbtns button.is-active { background: var(--brand-purple); border-color: var(--brand-purple); color: #fff; }

.lan-reqrow { border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; margin-bottom: 10px; }
.lan-reqrow__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.lan-reqrow__staff { font-size: 13.5px; font-weight: 700; color: var(--text); }
.lan-reqrow__meta { font-size: 12px; color: var(--text-2); }
.lan-reqrow__reason { font-size: 11.5px; color: var(--text-3); margin-top: 6px; background: var(--surface-2); border-radius: 8px; padding: 7px 10px; }
.lan-reqrow__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.lan-reqrow__link { font-size: 12px; font-weight: 700; color: var(--brand-purple); }
.lan-reqrow__link:hover { text-decoration: underline; }

.lan-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; }
.lan-status--pending { background: var(--amber-bg); color: var(--amber); }
.lan-status--approved { background: var(--green-bg); color: var(--green); }
.lan-status--rejected { background: var(--red-bg); color: var(--red); }

/* staff / property detail drawer */
.lan-profile { display: flex; align-items: center; gap: 14px; background: var(--violet-bg); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; }
.lan-profile__icon { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 600; }
.lan-profile__name { font-size: 15px; font-weight: 600; color: var(--text); }
.lan-profile__sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.lan-balgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.lan-balcell { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.lan-balcell__label { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; }
.lan-balcell__value { font-size: 14.5px; font-weight: 600; color: var(--text); margin-top: 3px; }

.lan-sparkrow { display: flex; align-items: flex-end; gap: 4px; height: 60px; margin-bottom: 16px; }
.lan-sparkbar { flex: 1; border-radius: 3px 3px 0 0; background: var(--grad-purple); min-height: 3px; }

.lan-coverage-msg { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.lan-coverage-msg svg { width: 15px; height: 15px; flex: none; }

/* config drawer */
.lan-configrow { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.lan-configrow__main { flex: 1; min-width: 0; }
.lan-configrow__name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.lan-configrow__sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.lan-configrow__missing { font-size: 11px; color: var(--amber); font-weight: 600; margin-top: 3px; }
.lan-configrow.is-done { opacity: .5; }
.lan-configrow.is-done .lan-configbtn { background: var(--green-bg); color: var(--green); }
.lan-configbtn { flex: none; height: 32px; padding: 0 14px; border-radius: 999px; background: var(--amber-bg); color: var(--amber); font-size: 12px; font-weight: 700; }

/* configure mini modal */
.lan-modal { position: fixed; inset: 0; z-index: 160; padding: 20px; display: none; align-items: center; justify-content: center; background: rgba(36, 28, 60, .45); }
.lan-modal.show { display: flex; }
.lan-modal__box { width: 440px; max-width: 100%; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 24px; max-height: 88vh; overflow-y: auto; }
.lan-modal h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.lan-modal p { font-size: 12.5px; color: var(--text-2); margin: 0 0 14px; }
.lan-modal__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.lan-modal__row input { width: 80px; height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--border-strong); font-size: 12px; text-align: right; }
.lan-modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 760px) {
  .lan-titlerow { flex-direction: column; align-items: stretch; }
  .lan-titlerow__actions select { min-width: 0; flex: 1; }
  .lan-fd__grid, .lan-customrange { grid-template-columns: 1fr; }
  .lan-balgrid { grid-template-columns: 1fr 1fr; }
}
