/* 官方回傳結果：桌面寬版顯示表格，手機與平板改顯示資料卡片 */
.result-panel-body {
  container-type: inline-size;
  container-name: result-panel;
}

.record-cards {
  display: none;
}

@container result-panel (max-width: 980px) {
  .result-panel-body .compact-table {
    display: none;
  }

  .result-panel-body .table-head span:last-child {
    display: none;
  }

  .record-cards {
    display: grid;
    gap: 8px;
  }
}

.record-list {
  display: grid;
  gap: 8px;
  align-items: start;
}

/* 平板：卡片一列兩張 */
@container result-panel (min-width: 600px) {
  .record-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.record-others {
  border: 1px dashed #c9d6dc;
  border-radius: 10px;
  background: #f8fafb;
}

.record-others > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.record-others > summary::-webkit-details-marker {
  display: none;
}

.record-others-toggle {
  flex: 0 0 auto;
  color: #0b6668;
  font-size: 12px;
}

.record-others-toggle::after {
  content: "展開 ▾";
}

.record-others[open] .record-others-toggle::after {
  content: "收合 ▴";
}

.record-others > .record-list {
  padding: 0 8px 8px;
}

.record-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  color: #475467;
}

.record-sort {
  min-height: 32px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid #cfd8dd;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  color: #24323f;
}

.record-empty {
  padding: 14px;
  border: 1px solid #dfe7ec;
  border-radius: 10px;
  background: #fff;
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

.record-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid #dfe7ec;
  border-radius: 10px;
  background: #fff;
}

.record-card.is-kept {
  border-color: #86d4c9;
  box-shadow: inset 3px 0 0 #0f7f80;
}

.record-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  line-height: 1.35;
  color: #24323f;
}

.record-head b {
  min-width: 0;
  overflow-wrap: anywhere;
}

.record-head .badge {
  flex: 0 0 auto;
  font-size: 11px;
}

.record-kpi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 6px;
}

.record-kpi div {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f7f9fb;
}

.record-kpi .record-kpi-unit {
  background: #fff1f0;
}

.record-kpi small {
  display: block;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}

.record-kpi strong {
  font-size: 17px;
  font-weight: 900;
  color: #24323f;
}

.record-kpi .record-kpi-unit strong {
  color: #d64045;
}

.record-kpi em {
  margin-left: 2px;
  font-style: normal;
  font-size: 10px;
  color: #667085;
}

.record-meta {
  color: #667085;
  font-size: 12px;
  line-height: 1.5;
}

.record-details {
  margin-top: 4px;
}

.record-details summary {
  color: #0b6668;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.record-details dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 4px 8px;
  margin: 6px 0 0;
  font-size: 12px;
}

.record-details dt {
  color: #667085;
  white-space: nowrap;
}

.record-details dd {
  margin: 0;
  min-width: 0;
  font-weight: 700;
  color: #24323f;
  overflow-wrap: anywhere;
}

@container result-panel (max-width: 340px) {
  .record-details dl {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .record-kpi strong {
    font-size: 15px;
  }
}

.badge-collateral {
  margin-left: 6px;
  background: #fff4e5;
  color: #b54708;
  vertical-align: middle;
}
