/* 租赁业务台账 — 模块样式（基于 vehicle-management vm-*） */

.ldb-page {
  padding-bottom: 48px;
}

.ldb-page-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ln-ink);
}

.ldb-date-range {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.ldb-date-range input {
  flex: 1;
  min-width: 0;
}

.ldb-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 1280px) {
  .ldb-kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .ldb-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.ldb-kpi-card {
  position: relative;
  padding: 16px 18px;
  border-radius: var(--ln-radius-card);
  border: 1px solid var(--ln-hairline);
  background: var(--ln-surface-card);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.03);
  min-height: 76px;
}

.ldb-kpi-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--ln-muted-soft);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.ldb-kpi-val {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--ln-ink);
  line-height: 1.2;
}

.ldb-kpi-val--profit { color: var(--ln-success); }
.ldb-kpi-val--loss { color: var(--ln-error); }

.ldb-kpi-tip {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--ln-muted-soft);
  cursor: help;
}

.ldb-kpi-tooltip {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10;
  width: max-content;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: var(--ln-radius-control);
  background: var(--ln-ink);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.45;
  box-shadow: var(--ln-shadow-hover);
}

.ldb-kpi-tip:hover .ldb-kpi-tooltip,
.ldb-kpi-tip:focus-within .ldb-kpi-tooltip {
  display: block;
}

.ldb-table-toolbar {
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.ldb-toolbar-unpaid-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--ln-ink);
  cursor: pointer;
  user-select: none;
}

.ldb-toolbar-unpaid-filter input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.ldb-kpi-card--clickable {
  width: 100%;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--ln-hairline);
  background: var(--ln-surface-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ldb-kpi-card--clickable:hover {
  border-color: var(--ln-primary);
  box-shadow: var(--ln-shadow-soft);
}

.ldb-kpi-card--clickable.ldb-kpi-card--active {
  border-color: var(--ln-primary);
  box-shadow: 0 0 0 1px var(--ln-primary);
}

.ldb-asset-tag {
  display: inline-flex;
  padding: 0 8px;
  border-radius: var(--ln-radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 22px;
}

.ldb-asset--owned { background: #eff6ff; color: #1d4ed8; }
.ldb-asset--leased { background: #fff7ed; color: #c2410c; }
.ldb-asset--affiliated { background: #f5f3ff; color: #6d28d9; }

.ldb-table-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ldb-table-wrap { overflow: auto; }
.ldb-table { min-width: 4200px; table-layout: fixed; }

.ldb-table .vm-table thead th,
.ldb-table .vm-table tbody td {
  padding: 10px 12px;
  transition: background-color 0.18s ease;
}

.ldb-table .vm-table tbody tr {
  transition: background-color 0.18s ease;
}

.ldb-table .vm-table tbody tr:hover td {
  background: var(--ln-canvas-soft);
}

.ldb-table .vm-table tbody tr:hover td.sticky-col-left,
.ldb-table .vm-table tbody tr:hover td.sticky-col-right {
  background: var(--ln-canvas-soft);
}

.ldb-cell-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ldb-cell-primary {
  font-size: 0.875rem;
  color: var(--ln-ink);
  line-height: 1.35;
}

.ldb-cell-secondary {
  font-size: 0.75rem;
  color: var(--ln-muted);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ldb-col-check { width: 48px; }
.ldb-col-money { text-align: right; white-space: nowrap; }
.ldb-col-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ldb-col-remark { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ldb-col-actions { min-width: 168px; white-space: nowrap; }

.ldb-row-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ldb-action-btn {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0;
  border: none;
  background: none;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  border-radius: var(--ln-radius-xs);
  transition: color 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
}

.ldb-action-btn:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ldb-action-btn--edit {
  color: var(--ln-primary);
}

.ldb-action-btn--edit:hover {
  color: var(--ln-primary-hover);
}

.ldb-action-btn--link {
  color: #2563eb;
}

.ldb-action-btn--link:hover {
  color: #1d4ed8;
}

.ldb-action-btn--delete {
  color: var(--ln-error);
}

.ldb-action-btn--delete:hover {
  color: #b91c1c;
}

.ldb-th-inner {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 24px;
  padding-right: 8px;
}

.ldb-th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.ldb-th-sort:hover {
  color: var(--ln-primary);
}

.ldb-th-sort.is-active {
  color: var(--ln-primary);
}

.ldb-th-sort-icon {
  display: inline-flex;
  color: var(--ln-muted-soft);
  flex-shrink: 0;
}

.ldb-th-sort.is-active .ldb-th-sort-icon {
  color: var(--ln-primary);
}

.ldb-th-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ldb-col-resizable {
  position: relative;
}

.ldb-col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}

.ldb-col-resize-handle:hover {
  background: color-mix(in srgb, var(--ln-primary) 18%, transparent);
}

.ldb-toolbar-btn {
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.ldb-toolbar-btn:hover {
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.ldb-toolbar-btn:active {
  transform: translateY(1px);
}

.ldb-filter-expand {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease, opacity 0.22s ease;
  opacity: 0;
}

.ldb-filter-expand.is-expanded {
  grid-template-rows: 1fr;
  opacity: 1;
}

.ldb-filter-expand-inner {
  overflow: hidden;
}

.ldb-filter-expand-grid {
  padding-top: 4px;
}

.ldb-filter-toggle-icon {
  transition: transform 0.25s ease;
}

.ldb-filter-toggle-icon.is-open {
  transform: rotate(180deg);
}

.ldb-date-range-sep {
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: var(--ln-muted);
}

.ldb-table-skeleton {
  padding: 12px 0;
}

.ldb-skeleton-row {
  height: 44px;
  margin: 0 12px 8px;
  border-radius: var(--ln-radius-control);
  background: linear-gradient(90deg, var(--ln-canvas-soft) 25%, #eef1f4 50%, var(--ln-canvas-soft) 75%);
  background-size: 200% 100%;
  animation: ldb-skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes ldb-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.vm-btn-danger {
  background: var(--ln-error);
  color: #fff;
  border-color: var(--ln-error);
}

.vm-btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.sticky-col-left {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--ln-surface-card);
}

.sticky-col-right {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--ln-surface-card);
}

.ldb-status-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--ln-radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 20px;
  border: 1px solid transparent;
}

.ldb-status--draft { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.ldb-status--confirmed { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.ldb-status--partial { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.ldb-status--paid { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }

.ldb-confirm-text {
  margin: 0 0 8px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ln-ink);
}

.ldb-confirm-meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--ln-muted);
}

.ldb-receipt-modal { max-width: 720px; width: calc(100% - 32px); }

.ldb-receipt-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--ln-radius-control);
  background: var(--ln-surface-strong);
  font-size: 0.8125rem;
  color: var(--ln-muted);
}

.ldb-receipt-summary strong {
  color: var(--ln-ink);
  font-weight: 600;
}

.ldb-receipt-table-wrap {
  overflow: auto;
  max-height: 320px;
  border: 1px solid var(--ln-hairline);
  border-radius: var(--ln-radius-control);
}

.ldb-receipt-table { margin: 0; }

.ldb-receipt-empty {
  text-align: center;
  color: var(--ln-muted);
  padding: 24px !important;
}

.vm-btn-link:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.ldb-action-sep { color: var(--ln-hairline); margin: 0 2px; }
.ldb-link-danger { color: var(--ln-error) !important; }

.ldb-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ldb-table-total {
  font-size: 0.875rem;
  color: var(--ln-muted);
}

.ldb-table .vm-table thead th.ldb-col-money,
.ldb-table .vm-table tbody td.ldb-col-money {
  text-align: right;
}

.ldb-link-preview {
  margin: 12px 0 0;
  font-size: 0.8125rem;
  color: var(--ln-muted);
}

.ldb-link-preview strong {
  color: var(--ln-ink);
}

.ldb-income-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
}

.ldb-income-warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff7ed;
  color: #c2410c;
  cursor: pointer;
  flex-shrink: 0;
}

.ldb-income-warn:hover {
  background: #ffedd5;
}

.ldb-income-pending {
  color: #c2410c;
}

.ldb-income-input {
  width: 100%;
  min-width: 88px;
  max-width: 120px;
  padding: 4px 8px;
  font-size: 0.8125rem;
  text-align: right;
}

.ldb-computed-val {
  color: var(--ln-ink);
}

.ldb-cell-readonly {
  color: var(--ln-muted);
}

.ldb-th-with-tip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ldb-th-tip {
  position: relative;
  display: inline-flex;
  color: var(--ln-muted);
  cursor: help;
}

.ldb-text-input {
  width: 100%;
  min-width: 100px;
  max-width: 140px;
  padding: 4px 8px;
  font-size: 0.8125rem;
}

.ldb-input-required {
  border-color: #f97316;
}

.ldb-linked-badge {
  display: inline-flex;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.6875rem;
  font-weight: 600;
  vertical-align: middle;
}

.ldb-overflow-hint {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--ln-radius-control);
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.ldb-overflow-tag {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: #c2410c;
}

.ldb-alloc-input {
  width: 88px;
  padding: 4px 6px;
  font-size: 0.8125rem;
  text-align: right;
}
