/* ═══════════════════════════════════════════════════════════════════════════
   PropertyDesk — Units Listing Page   (pd-ul-*)
   Visual design matches system: pdc-tbl / pdc-fsel / pdc-tabn patterns
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Hide default Views output on /units ──────────────────────────────────── */
.path--units .view-id-units-view,
.path--units .view-units-view { display: none !important; }

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.pd-ul-wrap { max-width: 100%; margin: 0 0 40px; font-family: inherit; }

/* ── Sub-header ───────────────────────────────────────────────────────────── */
.pd-ul-subhdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.pd-ul-subhdr__meta { font-size: 13px; color: #64748b; font-weight: 500; }
.pd-ul-subhdr__acts { display: flex; gap: 8px; align-items: center; }

/* Export buttons — matching building-portfolio.css (pdbp-csv-btn / pdlp-pdf-btn) */
.pd-ul-btn-csv {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; background: #f0faf4; color: #166534 !important;
  border: 1px solid #bbf7d0; border-radius: 5px; font-size: 12px; font-weight: 500;
  text-decoration: none !important; white-space: nowrap; transition: background .15s;
}
.pd-ul-btn-csv:hover { background: #dcfce7; border-color: #86efac; }
.pd-ul-btn-pdf {
  display: inline-flex; align-items: center; gap: 6px;
  background: #2e8b57; color: #fff !important;
  padding: 7px 16px; border-radius: 6px; font-size: 13px; font-weight: 500;
  text-decoration: none !important; white-space: nowrap; transition: background .15s;
}
.pd-ul-btn-pdf:hover { background: #267a4c; color: #fff !important; }

/* ── KPI strip — matches pd-ov-kpi style (border-top accent) ─────────────── */
.pd-ul-kpis {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 12px; margin-bottom: 18px;
}
@media (max-width: 1100px) { .pd-ul-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .pd-ul-kpis { grid-template-columns: repeat(2, 1fr); } }

.pd-ul-kpi {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 16px 18px; border-top: 3px solid #cbd5e1;
}
.pd-ul-kpi--neutral { border-top-color: #94a3b8; }
.pd-ul-kpi--good    { border-top-color: #22c55e; }
.pd-ul-kpi--warn    { border-top-color: #f59e0b; }
.pd-ul-kpi--bad     { border-top-color: #ef4444; }
.pd-ul-kpi--info    { border-top-color: #0d9488; }
.pd-ul-kpi--amber   { border-top-color: #f59e0b; background: linear-gradient(150deg, #fffbeb, #fff 70%); }

.pd-ul-kpi__lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #64748b; margin-bottom: 6px; }
.pd-ul-kpi__val { font-size: 22px; font-weight: 700; color: #0f172a; line-height: 1; font-variant-numeric: tabular-nums; }
.pd-ul-kpi__sub { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.pd-ul-kpi__alert { color: #f59e0b; font-size: 13px; }

@keyframes pd-ul-kpi-pulse {
  0%, 100% { border-top-color: #f59e0b; }
  50%       { border-top-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
}
.pd-ul-kpi--pulse { animation: pd-ul-kpi-pulse 2s ease-in-out infinite; }

/* ── Intelligence row: heatmap (left 60%) + pulse panels (right 40%) ──────── */
.pd-ul-intel {
  display: grid; grid-template-columns: 3fr 2fr;
  gap: 14px; margin-bottom: 18px; align-items: start;
}
@media (max-width: 900px) { .pd-ul-intel { grid-template-columns: 1fr; } }

/* ── Heatmap ──────────────────────────────────────────────────────────────── */
.pd-ul-hm {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden;
}
.pd-ul-hm__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #475569;
}
.pd-ul-hm-toggle {
  background: none; border: none; cursor: pointer; font-size: 11px;
  color: #94a3b8; padding: 2px 6px; border-radius: 4px;
}
.pd-ul-hm-toggle:hover { color: #2e8b57; background: #f0fdf4; }
.pd-ul-hm__body { max-height: 260px; overflow-y: auto; }
.pd-ul-hm__row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px; cursor: pointer; transition: background .1s;
}
.pd-ul-hm__row:hover { background: #f0fdf4; }
.pd-ul-hm__row--active { background: #dcfce7 !important; }
.pd-ul-hm__label {
  width: 160px; flex-shrink: 0; font-size: 12px; color: #374151;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pd-ul-hm__bar {
  flex: 1; height: 13px; background: #f1f5f9; border-radius: 3px;
  display: flex; overflow: hidden; gap: 1px;
}
.pd-ul-hm__seg { height: 100%; min-width: 2px; }
.pd-ul-hm__seg--r { background: #2e8b57; }
.pd-ul-hm__seg--v { background: #fbbf24; }
.pd-ul-hm__seg--m { background: #60a5fa; }
.pd-ul-hm__count { width: 44px; flex-shrink: 0; text-align: right; font-size: 11px; color: #64748b; font-weight: 500; }
.pd-ul-hm__full { color: #2e8b57; }

/* ── Pulse panels (stacked vertically in right column) ────────────────────── */
.pd-ul-pulse { display: flex; flex-direction: column; gap: 10px; }
.pd-ul-pulse__panel {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
  border-left: 3px solid #e2e8f0; overflow: hidden;
}
.pd-ul-pulse__panel--vacant { border-left-color: #f59e0b; }
.pd-ul-pulse__panel--maint  { border-left-color: #3b82f6; }
.pd-ul-pulse__hdr {
  padding: 8px 12px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #475569;
}
.pd-ul-pulse__item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-bottom: 1px solid #f3f4f6; font-size: 12px;
}
.pd-ul-pulse__item:last-of-type { border-bottom: none; }
.pd-ul-pulse__bldg { color: #94a3b8; font-size: 11px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-ul-pulse__days { color: #b45309; background: #fef3c7; padding: 1px 5px; border-radius: 3px; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.pd-ul-pulse__tkt  { color: #64748b; font-size: 11px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-ul-pulse__empty { padding: 8px 12px; font-size: 11px; color: #94a3b8; font-style: italic; }
.pd-ul-pulse__view {
  display: block; padding: 6px 12px; font-size: 11px; color: #2e8b57 !important;
  text-decoration: none !important; border-top: 1px solid #f3f4f6; font-weight: 600;
}
.pd-ul-pulse__view:hover { background: #f0fdf4; text-decoration: underline !important; }
.pd-ul-pri--emergency { color: #991b1b !important; font-weight: 700; }
.pd-ul-pri--high      { color: #9a3412 !important; font-weight: 600; }

/* ── Main panel ───────────────────────────────────────────────────────────── */
.pd-ul-main { border: 1px solid #dee2e6; border-radius: 0 0 6px 6px; overflow: hidden; background: #fff; }

/* ── Status tabs — exactly like pdc-tabn (cheques page style) ─────────────── */
.pd-ul-tabs {
  display: flex; gap: 0; border-bottom: 1px solid #dee2e6;
  background: #f1f3f5; border-radius: 6px 6px 0 0; overflow: hidden;
}
.pd-ul-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 12px 16px; font-size: 13px; font-weight: 500; color: #2e8b57;
  cursor: pointer; border: none; border-bottom: 3px solid transparent;
  border-right: 1px solid #dee2e6; background: #f1f3f5; white-space: nowrap;
  transition: background .12s, color .12s;
}
.pd-ul-tab:last-child { border-right: none; }
.pd-ul-tab:hover { color: #267a4c; background: #e9ecef; }
.pd-ul-tab--active,
.pd-ul-tab--active:hover {
  color: #2e8b57 !important; background: #fff !important;
  border-bottom-color: #2e8b57 !important; font-weight: 700 !important;
}
.pd-ul-tab__cnt {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
  background: #e2e8f0; color: #475569;
}
.pd-ul-tab--active .pd-ul-tab__cnt { background: #dcfce7; color: #166534; }

/* ── Filter bar — matches cheques pdc-filters layout ─────────────────────── */
.pd-ul-filters {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 12px 14px; background: #f8fafc; border-bottom: 1px solid #e5e7eb;
}
.pd-ul-fg { display: flex; flex-direction: column; gap: 3px; }
.pd-ul-fg label { font-size: 11px; color: #6b7280; font-weight: 500; }

/* Inputs — exactly like pdc-fsel / pdc-finput */
.pd-ul-fsel, .pd-ul-finput {
  padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 5px;
  font-size: 13px; background: #fff; color: #374151; min-width: 110px;
}
.pd-ul-fsel:focus, .pd-ul-finput:focus {
  outline: none; border-color: #2e8b57; box-shadow: 0 0 0 2px rgba(46,139,87,.12);
}

/* Autocomplete wrapper */
.pd-ul-ac-wrap { position: relative; }
.pd-ul-ac-results {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 1000;
  background: #fff; border: 1px solid #d1d5db; border-top: none;
  border-radius: 0 0 5px 5px; max-height: 200px; overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.pd-ul-ac-item {
  padding: 8px 10px; font-size: 13px; color: #374151;
  cursor: pointer; border-bottom: 1px solid #f3f4f6;
}
.pd-ul-ac-item:hover { background: #f0fdf4; color: #2e8b57; }
.pd-ul-ac-item:last-child { border-bottom: none; }
.pd-ul-ac-empty { padding: 8px 10px; font-size: 13px; color: #9ca3af; font-style: italic; }

/* Reset button — like pdc-clearbtn */
.pd-ul-reset-btn {
  display: none; padding: 7px 14px; border-radius: 5px; font-size: 13px;
  font-weight: 500; cursor: pointer; border: 1px solid #d1d5db;
  background: #fff; color: #374151; white-space: nowrap; align-self: flex-end;
}
.pd-ul-reset-btn:hover { background: #f3f4f6; }

/* ── Active filter chips ──────────────────────────────────────────────────── */
.pd-ul-chips {
  display: none; flex-wrap: wrap; gap: 6px;
  padding: 8px 14px; background: #f0fdf4;
  border-bottom: 1px solid #bbf7d0;
}
.pd-ul-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; background: #dcfce7; color: #166534;
  border: 1px solid #bbf7d0; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.pd-ul-chip__rm {
  background: none; border: none; cursor: pointer;
  color: #15803d; font-size: 14px; line-height: 1; padding: 0 1px;
}
.pd-ul-chip__rm:hover { color: #dc2626; }

/* ── Table — exactly like pdc-tbl (cheques page style) ───────────────────── */
.pd-ul-tbl { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }

.pd-ul-tbl thead th {
  background: #2e8b57; color: #fff; padding: 10px 12px;
  text-align: left; font-weight: 600; font-size: 13px;
  text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
}
.pd-ul-tbl thead th:first-child { border-radius: 0; } /* inside .pd-ul-main */
.pd-ul-tbl thead th:last-child  { border-radius: 0; }

/* Sort headers */
.pd-ul-th[data-col] { cursor: pointer; user-select: none; }
.pd-ul-th[data-col]:hover { background: #267a4c; }
.pd-ul-th--sorted { background: #1f7248 !important; }
.pd-ul-sort-arrow  { font-size: 10px; opacity: .7; margin-left: 3px; }

.pd-ul-tbl tbody td {
  padding: 11px 12px; border-bottom: 1px solid #e5e7eb;
  vertical-align: middle; color: #374151; font-size: 14px;
}
/* Zebra — exact pd-ov-tbl pattern (overview-pages.css) */
.pd-ul-tbl tbody td                    { text-align: left; }
.pd-ul-tbl tbody tr:nth-child(odd) td  { background: #ffffff !important; }
.pd-ul-tbl tbody tr:nth-child(even) td { background: #f0f9f3 !important; }
.pd-ul-tbl tbody tr:last-child td      { border-bottom: none; }
.pd-ul-tbl tbody tr:hover td           { background: #e2f0e6 !important; }
.pd-ul-tbl tbody tr[data-href] { cursor: pointer; }
.pd-ul-tbl tbody td a { color: #2e8b57; text-decoration: none; }
.pd-ul-tbl tbody td a:hover { text-decoration: underline; }

/* Row left-border status tints */
.pd-ul-tbl tbody tr { border-left: 3px solid transparent; }
.pd-ul-tr--rented  { border-left-color: #2e8b57 !important; }
.pd-ul-tr--vacant  { border-left-color: #f59e0b !important; }
.pd-ul-tr--maint   { border-left-color: #3b82f6 !important; }

/* ── Status pills ─────────────────────────────────────────────────────────── */
.pd-ul-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 4px; font-size: 11px; font-weight: 600;
  text-transform: capitalize; white-space: nowrap;
}
.pd-ul-pill__dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.pd-ul-pill--rented { background: #dcfce7; color: #166534; }
.pd-ul-pill--rented .pd-ul-pill__dot { background: #22c55e; }
.pd-ul-pill--vacant { background: #fef3c7; color: #92400e; }
.pd-ul-pill--vacant .pd-ul-pill__dot { background: #f59e0b; }
.pd-ul-pill--maint  { background: #dbeafe; color: #1e40af; }
.pd-ul-pill--maint  .pd-ul-pill__dot { background: #3b82f6; }

/* ── Sub-lines inside cells ───────────────────────────────────────────────── */
.pd-ul-subline       { display: inline-block; font-size: 10.5px; margin-top: 2px; padding: 1px 5px; border-radius: 3px; }
.pd-ul-subline--warn   { background: #fef3c7; color: #92400e; }
.pd-ul-subline--danger { background: #fee2e2; color: #991b1b; }
.pd-ul-subline--idle   { background: #fef3c7; color: #78350f; }
.pd-ul-subline--maint  { background: #eff6ff; color: #1e40af; }
.pd-ul-floor           { font-size: 11px; color: #94a3b8; display: block; margin-top: 1px; }
.pd-ul-link            { color: #2e8b57 !important; text-decoration: none !important; font-weight: 500; }
.pd-ul-link:hover      { text-decoration: underline !important; }
.pd-ul-link--nowrap    { white-space: nowrap; }

/* ── Empty / Loading ──────────────────────────────────────────────────────── */
.pd-ul-empty   { padding: 28px; text-align: center; color: #6b7280; font-size: 14px; background: #f9fafb; }
.pd-ul-loading { padding: 28px; text-align: center; color: #9ca3af; font-size: 13px; }

/* ── Pager — exactly like pdc-pager / pdc-pgb ────────────────────────────── */
.pd-ul-pager {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-top: 1px solid #e5e7eb;
  flex-wrap: wrap; gap: 8px;
}
.pd-ul-pager__info { font-size: 13px; color: #6b7280; font-weight: 500; }
.pd-ul-pager__btns { display: flex; gap: 4px; }
.pd-ul-pg-btn {
  min-width: 34px; height: 34px; display: inline-flex; align-items: center;
  justify-content: center; border-radius: 5px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid #d1d5db; background: #fff; color: #374151;
}
.pd-ul-pg-btn:hover:not(.pd-ul-pg-btn--active) { background: #f3f4f6; }
.pd-ul-pg-btn--active { background: #2e8b57 !important; color: #fff !important; border-color: #2e8b57 !important; }

/* ── Legend ───────────────────────────────────────────────────────────────── */
.pd-ul-legend {
  display: flex; gap: 14px; align-items: center;
  padding: 6px 14px 10px; font-size: 11px; color: #94a3b8;
}
.pd-ul-legend__dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 4px; vertical-align: middle; }

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .pd-ul-subhdr { flex-direction: column; align-items: flex-start; }
  .pd-ul-filters { flex-direction: column; align-items: stretch; }
  .pd-ul-fsel, .pd-ul-finput { min-width: unset; width: 100%; }
  .pd-ul-pager { flex-direction: column; }
  /* Hide size column on mobile (col 5 after Emirate added) */
  .pd-ul-tbl thead th:nth-child(5),
  .pd-ul-tbl tbody td:nth-child(5) { display: none; }
}
