/**
 * ONE-OS 台账类列表页 — 统一页面壳层
 *
 * 适用：租赁业务台账、自营业务台账（vm-page + ldb-page）
 * 对齐：租赁合同管理（vm-page + lc-page）的间距、卡片层次与工具栏布局
 * 依赖：vehicle-management/style.css（Linear 主题 token）
 */

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

.vm-page.ldb-page .ldb-page-header,
.vm-page.lc-page .lc-page-header {
  margin-bottom: 16px;
}

.vm-page.ldb-page .ldb-page-header h1,
.vm-page.lc-page .lc-page-header h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ln-ink);
  letter-spacing: -0.02em;
}

.vm-page.ldb-page .vm-filter-card.ldb-filter-card,
.vm-page.lc-page .vm-filter-card.ldb-filter-card {
  margin-bottom: 16px;
}

.vm-page.ldb-page .vm-filter-card.ldb-filter-card .vm-filter-header,
.vm-page.lc-page .vm-filter-card.ldb-filter-card .vm-filter-header {
  margin-bottom: 16px;
}

.vm-page.ldb-page .vm-filter-header {
  margin-bottom: 16px;
}

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

.vm-page.ldb-page .ldb-kpi-row {
  margin-bottom: 16px;
}

.vm-page.ldb-page .vm-table-section {
  min-width: 0;
  max-width: 100%;
}

.vm-page.ldb-page .vm-table-toolbar.ldb-table-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: var(--vm-btn-height);
  padding: 0 0 16px;
  margin-bottom: 0;
}

.vm-page.ldb-page .vm-table-toolbar.ldb-table-toolbar .vm-table-actions {
  margin-left: auto;
}

.vm-page.ldb-page .vm-table-card > .ldb-table-wrap {
  overflow: auto;
  scrollbar-gutter: stable;
  max-height: calc(100vh - 640px);
  min-width: 0;
}

/* 表头「?」提示需溢出卡片，避免被 vm-table-card 的 overflow:hidden 裁切 */
.vm-page.ldb-page .vm-table-card {
  overflow: visible;
}

.ldb-table thead th {
  overflow: visible;
}

.ldb-table thead th:has(.ldb-th-tip:hover),
.ldb-table thead th:has(.ldb-th-tip:focus-within) {
  z-index: 20;
}

.ldb-table {
  table-layout: fixed;
}

.ldb-table .sticky-col-left {
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: none;
}

.ldb-table .sticky-col-left-last {
  box-shadow: 4px 0 8px -4px rgba(15, 23, 42, 0.08);
}

.ldb-table .sticky-col-left-last::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: -12px;
  width: 12px;
  pointer-events: none;
  background: linear-gradient(to right, var(--ln-surface-card) 40%, transparent);
}

.ldb-table thead th.sticky-col-left-last::after {
  background: linear-gradient(to right, var(--ln-canvas-soft) 40%, transparent);
}

.ldb-table tbody tr:hover td.sticky-col-left-last::after {
  background: linear-gradient(to right, var(--ln-canvas-soft) 40%, transparent);
}

.ldb-table .sticky-col-right {
  position: sticky;
  right: 0;
  z-index: 2;
  box-shadow: -4px 0 8px -4px rgba(15, 23, 42, 0.08);
}

.ldb-table .sticky-col-right::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -12px;
  width: 12px;
  pointer-events: none;
  background: linear-gradient(to left, var(--ln-surface-card) 40%, transparent);
}

.ldb-table thead th.sticky-col-left,
.ldb-table thead th.sticky-col-right {
  z-index: 3;
  background: var(--ln-canvas-soft);
}

.ldb-table tbody td.sticky-col-left,
.ldb-table tbody td.sticky-col-right {
  z-index: 2;
  background: var(--ln-surface-card);
}

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

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

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

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

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

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

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

.ldb-filter-expand.is-expanded .ldb-filter-expand-inner {
  overflow: visible;
}

.ldb-filter-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: visible;
}

.vm-page.ldb-page .vm-filter-card.ldb-filter-card {
  overflow: visible;
}

.vm-page.ldb-page .vm-filter-grid.ldb-filter-grid--primary {
  margin-bottom: 0;
}

.ldb-filter-expand {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease, opacity 0.22s ease, margin-top 0.22s ease;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
  visibility: hidden;
}

.ldb-filter-expand.is-expanded {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 12px;
  pointer-events: auto;
  visibility: visible;
}

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

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

.ldb-filter-actions {
  margin-top: 16px;
}

.ldb-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ldb-filter-toggle-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ln-primary);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .ldb-filter-expand {
    transition: none;
  }

  .ldb-filter-toggle-icon {
    transition: none;
  }
}

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

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

.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);
}
