/* =========================================================
   Unit Portfolio Block — unit-portfolio.css
   Self-contained: includes all pdlp-* styles needed by the
   block (since landlord-portfolio.css doesn't load on unit pages).
   Scope for pdc-* overrides: .pdup-wrap
   ========================================================= */

/* --- Base wrapper --- */
.pdup-wrap { max-width: 100%; padding: 0; }

/* --- CSV export button --- */
.pdup-csv-btn { margin-left:auto; padding:7px 14px; border-radius:5px; font-size:12px; font-weight:500; text-decoration:none !important; background:#f0faf4; color:#166534 !important; border:1px solid #bbf7d0; white-space:nowrap; }
.pdup-csv-btn:hover { background:#dcfce7; border-color:#86efac; }

/* --- Cheque remind button --- */
.pdup-remind-btn { padding:4px 10px; border-radius:4px; font-size:12px; font-weight:500; cursor:pointer; border:1px solid #bfdbfe; background:#eff6ff; color:#1e40af; white-space:nowrap; }
.pdup-remind-btn:hover:not(:disabled) { background:#dbeafe; }
.pdup-remind-btn:disabled { cursor:default; opacity:.8; }

/* --- Maintenance summary strip --- */
.pdup-maint-summary { display:flex; gap:0; margin-bottom:16px; border:1px solid #e5e7eb; border-radius:8px; overflow:hidden; }
.pdup-ms-item { flex:1; padding:14px 12px; text-align:center; border-right:1px solid #e5e7eb; }
.pdup-ms-item:last-child { border-right:none; }
.pdup-ms-count { display:block; font-size:20px; font-weight:700; line-height:1.2; }
.pdup-ms-lbl { display:block; font-size:11px; color:#6b7280; margin-top:2px; }
.pdup-ms-open   .pdup-ms-count { color:#991b1b; }
.pdup-ms-inprog .pdup-ms-count { color:#92400e; }
.pdup-ms-closed .pdup-ms-count { color:#166534; }
.pdup-ms-cost   .pdup-ms-count { color:#0f3460; font-size:15px; }

/* --- Add maintenance button --- */
.pdup-add-maint-btn { margin-left:auto; padding:7px 14px; border-radius:5px; font-size:12px; font-weight:500; text-decoration:none !important; background:#2e8b57; color:#fff !important; white-space:nowrap; }
.pdup-add-maint-btn:hover { background:#267a4c; }

/* --- Priority badges --- */
.pdup-priority { display:inline-block; font-size:11px; font-weight:600; }
.pdup-pr-low    { color:#6b7280; }
.pdup-pr-med    { color:#92400e; }
.pdup-pr-high   { color:#991b1b; }
.pdup-pr-urgent { color:#7f1d1d; font-weight:700; }

/* --- Rent chart wrapper --- */
.pdup-chart-wrap { padding:8px 0 4px; }

/* --- Tab/panel system (scoped to .pdup-wrap) --- */
.pdup-wrap .pdc-tabbar { display:flex; gap:0; margin-bottom:0; border:1px solid #dee2e6; border-radius:6px 6px 0 0; overflow:hidden; background:#f1f3f5; }
.pdup-wrap .pdc-tabn { flex:1; display:inline-block; padding:14px 22px; font-size:14px; font-weight:500; color:#2e8b57; text-decoration:none !important; cursor:pointer; text-align:center; border-bottom:3px solid transparent; border-right:1px solid #dee2e6; background:#f1f3f5; }
.pdup-wrap .pdc-tabn:last-child { border-right:none; }
.pdup-wrap .pdc-tabn:hover { color:#267a4c; background:#e9ecef; }
.pdup-wrap .pdc-tabn-on,
.pdup-wrap .pdc-tabn-on:hover { color:#2e8b57 !important; background:#fff !important; border-bottom:3px solid #2e8b57 !important; font-weight:700 !important; }
.pdup-wrap .pdc-panel { display:none; padding-top:18px; }
.pdup-wrap .pdc-panel-on { display:block; }

/* --- Empty / loading states --- */
.pdup-wrap .pdc-empty { padding:18px; text-align:center; color:#6b7280; font-size:14px; background:#f9fafb; border-radius:5px; border:1px dashed #d1d5db; }
.pdup-wrap .pdc-loading { padding:50px; text-align:center; color:#9ca3af; font-size:14px; }

/* --- Filter bar --- */
.pdup-wrap .pdc-filters { display:flex; gap:10px; align-items:flex-end; margin-bottom:16px; flex-wrap:wrap; }
.pdup-wrap .pdc-fg { display:flex; flex-direction:column; gap:4px; }
.pdup-wrap .pdc-fg label { font-size:11px; color:#6b7280; font-weight:500; }
.pdup-wrap .pdc-fsel { padding:7px 10px; border:1px solid #d1d5db; border-radius:5px; font-size:13px; background:#fff; color:#374151; min-width:120px; }
.pdup-wrap .pdc-applybtn { padding:8px 16px; border-radius:5px; font-size:13px; font-weight:500; cursor:pointer; border:none; background:#2e8b57; color:#fff !important; }
.pdup-wrap .pdc-applybtn:hover { background:#267a4c; }
.pdup-wrap .pdc-clearbtn { padding:8px 16px; border-radius:5px; font-size:13px; font-weight:500; cursor:pointer; border:1px solid #d1d5db; background:#fff; color:#374151 !important; }

/* --- Table --- */
.pdup-wrap .pdc-tbl { width:100%; border-collapse:collapse; font-size:14px; line-height:1.5; }
.pdup-wrap .pdc-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; }
.pdup-wrap .pdc-tbl tbody td { padding:11px 12px; border-bottom:1px solid #e5e7eb; vertical-align:middle; color:#374151; font-size:14px; text-align:left !important; }
.pdup-wrap .pdc-tbl tbody tr > td { background-color:inherit !important; }
.pdup-wrap .pdc-tbl tbody tr:hover > td { background-color:#e2f0e6 !important; }
.pdup-wrap .pdc-tbl tbody td a { color:#2e8b57; text-decoration:none; }
.pdup-wrap .pdc-tbl tfoot td { background:#f8fafc; border-top:2px solid #d4e8dc; padding:10px 12px; font-size:13px; }
.pdup-wrap .pdc-tbl thead th.pdlp-num { text-align:left; }

/* --- Actions --- */
.pdup-wrap .pdc-acts { display:flex; gap:4px; white-space:nowrap; }
.pdup-wrap .pdc-ae { display:inline-block; padding:5px 12px; border-radius:4px; font-size:12px; font-weight:500; text-decoration:none !important; background:#2e8b57; color:#fff !important; }
.pdup-wrap .pdc-ae:hover { background:#267a4c; }

/* --- Status badges --- */
.pdup-wrap .pdc-st { display:inline-block; padding:3px 10px; border-radius:4px; font-size:11px; font-weight:600; text-transform:capitalize; }
.pdup-wrap .pdc-st-active    { background:#dcfce7; color:#166534; }
.pdup-wrap .pdc-st-inactive  { background:#f3f4f6; color:#6b7280; }
.pdup-wrap .pdc-st-warn      { background:#feebc8; color:#7b341e; }
.pdup-wrap .pdc-st-received  { background:#dbeafe; color:#1e40af; }
.pdup-wrap .pdc-st-deposited { background:#fef3c7; color:#92400e; }
.pdup-wrap .pdc-st-cleared   { background:#dcfce7; color:#166534; }
.pdup-wrap .pdc-st-bounced   { background:#fecaca; color:#991b1b; }
.pdup-wrap .pdc-st-replaced  { background:#f3f4f6; color:#6b7280; }

/* --- Section headers --- */
.pdup-wrap .pd-section-header { padding:14px 18px; margin:16px 0 0; background:#f8f9fa; border:1px solid #e5e7eb; border-radius:8px 8px 0 0; border-left:4px solid #2e8b57; }
.pdup-wrap .pd-section-title  { font-size:16px; font-weight:700; color:#1a1a1a; }
.pdup-wrap .pdc-hdr-blue { border-left:4px solid #2563eb !important; background:#eff6ff !important; }
.pdup-wrap .pdc-hdr-blue .pd-section-title { color:#1e40af !important; }
.pdup-wrap .pdc-hdr-amber { border-left:4px solid #f59e0b !important; background:#fffbeb !important; }
.pdup-wrap .pdc-hdr-amber .pd-section-title { color:#92400e !important; }

/* --- Autocomplete --- */
.pdup-wrap .pdc-ac-wrap { position:relative; }
.pdup-wrap .pdc-ac { width:100%; }
.pdup-wrap .pdc-ac-results { display:none; position:absolute; top:100%; left:0; right:0; z-index:999; 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); }
.pdup-wrap .pdc-ac-item { padding:8px 12px; font-size:13px; color:#374151; cursor:pointer; border-bottom:1px solid #f3f4f6; }
.pdup-wrap .pdc-ac-item:hover { background:#f0fdf4; color:#2e8b57; }
.pdup-wrap .pdc-ac-item:last-child { border-bottom:none; }
.pdup-wrap .pdc-ac-empty { padding:8px 12px; font-size:13px; color:#9ca3af; font-style:italic; }

/* =========================================================
   Shared info-card styles — copied from landlord-portfolio.css
   (those are global classes, but landlord CSS doesn't load on
   unit pages, so we include them here to be self-contained).
   ========================================================= */

/* Info card wrapper */
.pdlp-info-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* Header bar: name + status */
.pdlp-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #e8f5ee 100%);
  border-bottom: 1px solid #e2e8f0;
}
.pdlp-info-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pdlp-info-name {
  font-size: 17px;
  font-weight: 700;
  color: #0f3460;
}

/* Field grid */
.pdlp-info-sections {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 1px solid #e2e8f0;
}
@media (max-width: 768px) {
  .pdlp-info-sections { grid-template-columns: 1fr; }
}
.pdlp-info-section {
  padding: 16px 20px;
  border-right: 1px solid #f1f5f9;
}
.pdlp-info-section:last-child { border-right: none; }

/* Section column headings */
.pdlp-section-head {
  font-size: 11px;
  font-weight: 700;
  color: #2e8b57;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e8f5ee;
}

/* Field rows */
.pdlp-field-row {
  display: flex;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid #f1f5f9;
  gap: 8px;
}
.pdlp-field-label {
  font-size: 10px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .3px;
  font-weight: 600;
  min-width: 100px;
  flex-shrink: 0;
}
.pdlp-field-val {
  font-size: 13px;
  color: #1f2937;
  word-break: break-word;
}
.pdlp-field-val a { color: #2563eb; text-decoration: none; }
.pdlp-field-mono { font-family: monospace; font-size: 12px; letter-spacing: .5px; }

/* Notes section */
.pdlp-notes-section {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafcff;
}
.pdlp-notes-body {
  font-size: 13px;
  color: #4a5568;
  line-height: 1.7;
  margin-top: 8px;
}
.pdlp-notes-body p { margin: 0 0 8px; }
.pdlp-notes-body p:last-child { margin-bottom: 0; }

/* Attachments */
.pdlp-attachments-section {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
}
.pdlp-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.pdlp-attach-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  text-decoration: none !important;
  color: #374151 !important;
  font-size: 13px;
  transition: background .15s, border-color .15s;
}
.pdlp-attach-item:hover { background: #e8f5ee; border-color: #2e8b57; color: #166534 !important; }
.pdlp-attach-ext {
  display: inline-block;
  padding: 2px 6px;
  background: #2e8b57;
  color: #fff;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.pdlp-attach-name {
  font-weight: 500;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdlp-attach-size { font-size: 11px; color: #9ca3af; white-space: nowrap; }

/* KPI strip at bottom of info card */
.pdlp-info-kpi-strip {
  display: flex;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}
.pdlp-ik-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  border-right: 1px solid #e2e8f0;
  text-align: center;
}
.pdlp-ik-cell:last-child { border-right: none; }
.pdlp-ik-val {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #0f3460;
  line-height: 1.2;
}
.pdlp-ik-lbl {
  display: block;
  font-size: 10px;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-top: 3px;
}
.pdlp-ik-rev .pdlp-ik-val { font-size: 15px; color: #2e8b57; }

/* Edit button */
.pdlp-edit-btn {
  display: inline-block;
  padding: 5px 16px;
  background: #2e8b57;
  color: #fff !important;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background .15s;
}
.pdlp-edit-btn:hover { background: #267a4c; }

/* Audit trail */
.pdlp-audit-trail {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 8px 20px;
  border-top: 1px solid #f1f5f9;
  background: #fafcff;
  font-size: 12px;
  color: #6b7280;
}
.pdlp-audit-lbl { font-weight: 600; color: #374151; }
.pdlp-audit-sep { color: #d1d5db; font-size: 14px; }

/* Port header (report tab top bar: title + PDF button) */
.pdlp-port-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e2e8f0;
}
.pdlp-port-title {
  font-size: 15px;
  font-weight: 600;
  color: #0f3460;
}
.pdlp-pdf-btn {
  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;
  transition: background .15s;
}
.pdlp-pdf-btn:hover { background: #267a4c; color: #fff !important; }

/* Cheque status summary row (Unit Report) */
.pdlp-status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 16px;
  padding: 12px 18px;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 6px 6px;
  background: #fff;
}
.pdlp-ss-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 14px;
}
.pdlp-ss-count { font-size: 18px; font-weight: 700; color: #2d3748; }
.pdlp-ss-amt   { font-size: 12px; color: #718096; }

/* Number cells */
.pdlp-num { text-align: right; font-variant-numeric: tabular-nums; }

/* =========================================================
   Unit-specific classes
   ========================================================= */

/* 2-column info grid override (landlord has 3 columns) */
.pdup-info-2col {
  grid-template-columns: 1fr 1fr !important;
}
@media (max-width: 768px) {
  .pdup-info-2col { grid-template-columns: 1fr !important; }
}

/* Unit status badge */
.pdup-unit-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
}
.pdup-us-rented  { background: #dcfce7; color: #166534; }
.pdup-us-vacant  { background: #f3f4f6; color: #6b7280; }
.pdup-us-maint   { background: #feebc8; color: #7b341e; }

/* Days remaining badge */
.pdup-days-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}
.pdup-days-red   { background: #fecaca; color: #991b1b; }
.pdup-days-amber { background: #fef3c7; color: #92400e; }
.pdup-days-green { background: #dcfce7; color: #166534; }

/* Active contract card */
.pdup-active-contract {
  background: #fff;
  border: 1px solid #d4e8dc;
  border-left: 4px solid #2e8b57;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.pdup-active-contract.pdlp-exp-red   { border-left-color: #fc8181; background: #fff5f5; }
.pdup-active-contract.pdlp-exp-amber { border-left-color: #f6ad55; background: #fffaf0; }

.pdup-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #2e8b57;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e8f5ee;
  width: 100%;
}
.pdup-active-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2e8b57;
  flex-shrink: 0;
}

/* 2-col field grid inside active contract card */
.pdup-ac-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
  margin-bottom: 12px;
}
@media (max-width: 768px) {
  .pdup-ac-grid { grid-template-columns: 1fr; }
}

.pdup-ac-notes {
  padding: 12px 0;
  border-top: 1px solid #f1f5f9;
  margin-top: 6px;
}
.pdup-ac-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

/* No active contract empty state */
.pdup-no-contract {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 20px;
}

/* Active row in contract history table */
.pdup-wrap .pdup-row-active > td {
  background: #f0fdf4 !important;
  font-weight: 500;
}

/* Active contract inline dot in history table */
.pdup-active-dot-inline {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2e8b57;
  margin-left: 5px;
  vertical-align: middle;
}

/* Unit Report 2-col field grid */
.pdup-report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
  padding: 12px 18px;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 6px 6px;
  background: #fff;
  margin-bottom: 4px;
}
.pdup-report-grid .pdlp-field-row { border-bottom: 1px solid #f1f5f9; }
@media (max-width: 768px) {
  .pdup-report-grid { grid-template-columns: 1fr; }
}

/* Cheques AJAX tab — contract group headers */
.pdup-chq-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #9ca3af;
  border-radius: 6px 6px 0 0;
  margin-top: 20px;
}
.pdup-chq-group-header:first-child { margin-top: 0; }
.pdup-chq-group-active {
  background: #f0fdf4;
  border-color: #d4e8dc;
  border-left-color: #2e8b57;
}
.pdup-chq-group-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f3460;
}
.pdup-chq-group-title a { color: #0f3460 !important; text-decoration: none; }
.pdup-chq-group-active .pdup-chq-group-title { color: #166534; }
.pdup-chq-group-active .pdup-chq-group-title a { color: #166534 !important; }
.pdup-chq-group-meta {
  font-size: 12px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pdup-chq-group-meta a { color: #374151 !important; text-decoration: none; }

/* Table immediately below group header — flush join */
.pdup-wrap .pdup-chq-group-header + table {
  border-top: none;
  border-radius: 0 0 6px 6px;
  margin-bottom: 0;
}
