*{box-sizing:border-box}body{margin:0;background:#0c1320;color:#dde6f5;font:14px/1.5 system-ui,sans-serif}main{max-width:1920px;margin:auto;padding:24px}header{display:flex;align-items:center;justify-content:space-between}h1{font-size:26px;margin:0}a{color:#91baff}.eyebrow{font-size:11px;color:#8ca3bc;letter-spacing:2px;margin:0}.intro,.hint{color:#91a3b9}.toolbar,.actions,.savebar{display:flex;gap:12px;align-items:center;flex-wrap:wrap}.toolbar{margin:22px 0 10px;flex-direction:row;align-items:center;justify-content:flex-start;gap:12px}.toolbar>input{width:320px;flex:none}.toolbar-right{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-left:auto}.toolbar label{display:flex;gap:8px;align-items:center}#clearFilters{padding:8px 14px;font-size:13px;color:#91a3b9;border-color:#30435c;background:#0e1c2e;display:inline-flex;align-items:center;gap:4px}#clearFilters:hover{color:#dde6f5;background:#233653}#clearFilters.active{color:#efc372;border-color:#efc372;background:#2e2815}
/* 表头多选漏斗按钮与浮层 */
th .th-content{display:inline-flex;align-items:center;gap:6px;position:relative}
th .th-content span{display:inline-block;text-align:center;line-height:1.25;vertical-align:middle}
.th-filter-btn{background:transparent;border:none;color:#6b829e;padding:2px 4px;font-size:11px;border-radius:3px;cursor:pointer;line-height:1}
.th-filter-btn:hover{color:#dde6f5;background:#2c405a}
.th-filter-btn.active{color:#efc372;background:#38321e}
.filter-popover{position:absolute;top:calc(100% + 6px);left:0;background:#152135;border:1px solid #445979;border-radius:8px;padding:12px;box-shadow:0 8px 24px #00000088;z-index:100;min-width:200px;max-width:280px;font-weight:normal;color:#dde6f5}
.filter-popover-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-size:12px;color:#8ca3bc;border-bottom:1px solid #23344c;padding-bottom:6px}
.filter-popover-actions{display:flex;gap:8px}
.filter-popover-actions button{background:transparent;border:none;color:#91baff;padding:0;font-size:12px;cursor:pointer}
.filter-popover-actions button:hover{text-decoration:underline}
.filter-popover-list{max-height:220px;overflow-y:auto;display:flex;flex-direction:column;gap:4px;padding:2px 0}
.filter-popover-item{display:flex;align-items:center;gap:8px;font-size:13px;cursor:pointer;padding:4px 6px;border-radius:4px}
.filter-popover-item:hover{background:#1e304a}
.filter-popover-item input[type=checkbox]{margin:0;cursor:pointer}input,select,button{font:inherit;color:inherit;background:#121f31;border:1px solid #30435c;border-radius:6px;padding:9px}input:focus,select:focus{outline:2px solid #74a8fc;outline-offset:-2px}button{cursor:pointer}button:hover{background:#233653}button:disabled{opacity:.45;cursor:default}.primary{background:#2868c9;border-color:#4085ec;color:white}.danger{color:#ffaca9}#status{color:#efc372}.table-wrap{max-height:62vh;overflow:auto;border:1px solid #30435c;border-radius:8px}table{border-collapse:separate;border-spacing:0;width:100%;font-size:13px}th{position:sticky;top:0;background:#1c2b40;z-index:2;text-align:left;white-space:nowrap;padding:10px;border-bottom:1px solid #40516a}td{border-bottom:1px solid #233047;padding:3px;background:#101a2a}td input:not([type=checkbox]),td select{min-width:150px;width:100%;border-color:transparent;background:transparent;border-radius:3px;padding:8px}td input:disabled{color:#72849a}td.identity{min-width:180px;padding:8px}td.computed-cost{min-width:130px;padding:8px 12px;color:#a8c0e0;font-variant-numeric:tabular-nums;text-align:right}td input.price{text-align:right;font-variant-numeric:tabular-nums}td input.price.live-ready{color:#76d69e;font-weight:500}td input.price:not(:disabled){border-color:#3a5475;background:#142338;color:#ffffff}td input.name{min-width:220px}th:first-child,td:first-child{position:sticky;left:0;z-index:1;min-width:42px}th:first-child{z-index:3}td.changed{background:#2e2b1c}tr.new td{background:#112d2b}tr.removed td{opacity:.6;text-decoration:line-through}footer{position:sticky;bottom:0;background:#0c1320f5;border-top:1px solid #30435c;padding:14px 0;z-index:4}.savebar{margin-top:12px}.savebar input{flex:1;min-width:240px}.hint{font-size:12px}#dirty{color:#efc372}dialog{background:#152135;color:#dde6f5;border:1px solid #445979;border-radius:12px;width:min(780px,94vw);max-height:85vh;padding:24px}dialog::backdrop{background:#0009}pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:50vh;overflow:auto;font-size:13px}#saveError{color:#ffb4aa}.empty{text-align:center;padding:40px}.empty-hint{margin-top:8px}.empty-hint button{padding:6px 14px;font-size:12px}@media(max-width:700px){main{padding:12px}h1{font-size:22px}.table-wrap{max-height:55vh}.toolbar>input,.filter-row select{width:100%;max-width:100%}}

/* Keep asset identity visible while editing columns on the right. */
td.identity{min-width:100px}th:nth-child(2),td:nth-child(2){position:sticky;left:42px;min-width:105px;max-width:105px;z-index:1;overflow-wrap:anywhere}th:nth-child(3),td:nth-child(3){position:sticky;left:147px;min-width:220px;max-width:220px;z-index:1}th:nth-child(2),th:nth-child(3){z-index:3}td:nth-child(3){border-right:1px solid #40516a}th:first-child,td:first-child{width:42px;max-width:42px} @media(max-width:700px){th:nth-child(3),td:nth-child(3){position:static}}

/* Readonly data maintenance date */
td.col-readonly-date{min-width:145px;padding:8px 10px;text-align:center}
.badge-readonly-date{display:inline-block;font-size:12px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;color:#91a3b9;background:#131f31;border:1px solid #23344c;border-radius:4px;padding:3px 8px;letter-spacing:0.2px}
.badge-readonly-date.pending{color:#efc372;border-color:#5c4720;background:#2a2213}
.badge-readonly-date.muted{background:transparent;border-color:transparent;color:#4f637b}

/* ─── Precision Column Alignment ─── */
/* Center-aligned columns: enums, short tags, dates, and actions */
th.col-bucket, th.col-assetType, th.col-currency, th.col-custodyJurisdiction, th.col-valuationMethod, th.col-maintainedAt, th.col-record {
  text-align: center;
}
th.col-bucket .th-content, th.col-assetType .th-content, th.col-currency .th-content, th.col-custodyJurisdiction .th-content, th.col-valuationMethod .th-content, th.col-maintainedAt .th-content, th.col-record .th-content {
  justify-content: center;
  width: 100%;
}
th.col-bucket .filter-popover, th.col-assetType .filter-popover, th.col-currency .filter-popover, th.col-custodyJurisdiction .filter-popover, th.col-valuationMethod .filter-popover {
  left: 50%;
  transform: translateX(-50%);
  text-align: left;
}
td.col-bucket, td.col-assetType, td.col-currency, td.col-custodyJurisdiction, td.col-valuationMethod, td.col-maintainedAt, td.col-record {
  text-align: center;
}
td.col-bucket select, td.col-assetType select, td.col-currency select, td.col-custodyJurisdiction input, td.col-valuationMethod select {
  text-align: center;
  text-align-last: center;
}
td.col-record {
  text-align: center;
}
td.col-record button {
  margin: 0 auto;
}

/* Numeric right-aligned columns: shares, totalCost, unitCost, price */
th.col-shares, th.col-totalCost, th.col-unitCost, th.col-price {
  text-align: right;
}
th.col-shares .th-content, th.col-totalCost .th-content, th.col-unitCost .th-content, th.col-price .th-content {
  justify-content: flex-end;
  width: 100%;
}
td.col-shares, td.col-totalCost, td.col-unitCost, td.col-price {
  text-align: right;
}
td.col-shares input, td.col-totalCost input, td.col-price input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
td.col-unitCost {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding: 8px 12px;
}

/* ─── 资产历史弹窗与时间线 ─── */
.history-dialog {
  width: min(720px, 94vw);
  max-height: 88vh;
  padding: 20px 24px;
  background: #131d2c;
  border: 1px solid #324765;
  border-radius: 12px;
  box-shadow: 0 16px 40px #000000c0;
  display: flex;
  flex-direction: column;
}
.history-dialog[open] {
  display: flex;
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  border-bottom: 1px solid #23344c;
  padding-bottom: 12px;
}
.dialog-header h2 {
  font-size: 18px;
  margin: 0 0 4px 0;
  color: #f1f5f9;
}
.dialog-subtitle {
  font-size: 13px;
  color: #8ca3bc;
  margin: 0;
}
.close-dialog-btn {
  background: transparent;
  border: none;
  color: #8ca3bc;
  font-size: 18px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
}
.close-dialog-btn:hover {
  background: #233653;
  color: #fff;
}
.history-timeline {
  flex: 1;
  overflow-y: auto;
  padding: 4px 2px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.history-card {
  background: #182538;
  border: 1px solid #2a3e5c;
  border-radius: 8px;
  padding: 14px 16px;
  position: relative;
}
.history-card.init {
  border-color: #244138;
  background: #112423;
}
.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
}
.history-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #1e3a5f;
  color: #91baff;
}
.history-badge.init {
  background: #164032;
  color: #6ee7b7;
}
.history-time {
  color: #8ca3bc;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.history-reason {
  background: #212c1b;
  border: 1px solid #445322;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: #efc372;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.4;
}
.history-reason-label {
  font-weight: 600;
  white-space: nowrap;
  opacity: 0.9;
}
.history-diff-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.history-diff-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px dashed #20314a;
}
.history-diff-row:last-child {
  border-bottom: none;
}
.history-diff-prop {
  color: #8ca3bc;
  width: 130px;
  flex-shrink: 0;
  font-size: 12px;
}
.history-diff-values {
  flex: 1;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.history-old-val {
  color: #94a3b8;
  text-decoration: line-through;
  opacity: 0.75;
}
.history-arrow {
  color: #64748b;
  font-size: 11px;
}
.history-new-val {
  color: #6ee7b7;
  font-weight: 500;
}
.history-empty-diff {
  color: #8ca3bc;
  font-size: 12px;
  font-style: italic;
  padding: 4px 0;
}
.history-init-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 14px;
  font-size: 12px;
  color: #cbd5e1;
}
.history-init-item {
  display: flex;
  gap: 6px;
}
.history-init-item span:first-child {
  color: #8ca3bc;
  white-space: nowrap;
}
.history-source-details {
  margin-top: 10px;
  border-top: 1px solid #23344c;
  padding-top: 10px;
  font-size: 12px;
  color: #8ca3bc;
}
.history-source-details summary {
  cursor: pointer;
  color: #91baff;
}
.history-source-details summary:hover {
  text-decoration: underline;
}
.history-source-body {
  margin-top: 8px;
  background: #0d1624;
  border: 1px solid #1f2e44;
  border-radius: 6px;
  padding: 10px;
  font-family: monospace;
  font-size: 11px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.dialog-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #23344c;
  display: flex;
  justify-content: flex-end;
}
