
button, input, select { font: inherit; }
button, select, summary, input[type="checkbox"] { cursor: pointer; }
[hidden] { display: none !important; }
.page-shell {
  width: min(1680px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 28px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.eyebrow {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 800;
}
h1 {
  margin: 5px 0 0;
  font-size: 32px;
  line-height: 1.12;
  color: var(--ink);
}
h2 {
  margin: 0;
  font-size: 18px;
  color: var(--ink);
}
p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.history-layout { display: grid; gap: 12px; }
.surface-card {
  background: var(--surface);
  border: 1px solid var(--line-s);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(15,23,42,.06);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 16px 12px;
}
.table-head { border-bottom: 1px solid var(--line-s); }
.tab-bar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  align-items: flex-end;
  padding: 0 16px;
  margin: 2px 0 -1px;
  background: transparent;
  overflow-x: auto;
  scrollbar-gutter: stable;
}
.tab-button {
  position: relative;
  min-height: 44px;
  margin: 0;
  padding: 0 18px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  color: var(--ink-2);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 900;
  box-shadow: none;
  white-space: nowrap;
}
.tab-button + .tab-button { margin-left: 4px; }
.tab-button:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.tab-button.active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-s);
  min-height: 50px;
  box-shadow: 0 -8px 18px rgba(16, 42, 67, 0.06);
}
.tab-button.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--primary);
}
.table-title-line { display: flex; align-items: baseline; gap: 8px; }
.table-total-count { color: var(--ink-3); font-size: 12px; font-weight: 850; }
.table-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.ghost-button, .quick-filter, .row-button, .icon-button {
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 600;
  transition: background-color .14s, border-color .14s, color .14s;
}
.ghost-button {
  min-height: 28px;
  padding: 0 10px;
  color: var(--ink-2);
  background: var(--surface);
  border-color: var(--line-s);
  font-size: 11px;
}
.ghost-button:hover:not(:disabled) { border-color: var(--line); background: var(--surface-2); }
.icon-button {
  width: 28px;
  min-height: 28px;
  border: 0;
  color: var(--ink-2);
  background: var(--surface-2);
  font-size: 15px;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.quick-filter {
  min-height: 28px;
  padding: 0 10px;
  color: var(--ink-2);
  background: var(--surface);
  border-color: var(--line-s);
  font-size: 11px;
  white-space: nowrap;
}
.quick-filter.active {
  color: var(--blue);
  background: var(--primary-soft);
  border-color: var(--primary);
}
.table-search-inline {
  display: inline-grid;
  grid-template-columns: 26px minmax(130px, 180px);
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line-s);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}
.table-search-inline span {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--primary);
  font-size: 20px;
  font-weight: 900;
}
.table-search-inline input {
  width: 100%;
  min-height: 32px;
  border: 0;
  padding: 0 8px 0 2px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  outline: 0;
}

.th-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink-2);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
}
.th-filter:hover,
.th-filter.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgba(0,87,231,.16);
}
.th-filter span {
  color: inherit;
  font-size: 11px;
}
.filter-popover {
  position: fixed;
  z-index: 80;
  width: 260px;
  max-width: calc(100vw - 24px);
  border: 1px solid var(--line-s);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 22px 54px rgba(18, 42, 68, 0.22);
  overflow: hidden;
}
.filter-popover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 8px 12px;
  border-bottom: 1px solid var(--line-s);
  color: var(--ink);
}
.filter-option-list {
  display: grid;
  max-height: 310px;
  overflow: auto;
  padding: 8px;
}
.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 750;
}
.filter-option-all {
  min-height: 24px;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line-s);
}
.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 850;
}
.active-filter-chip button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 900;
  padding: 0;
  min-height: 0;
}

.table-panel { overflow: hidden; }
.tab-bar + .table-panel {
  border-top-left-radius: 0;
}
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  min-width: 1280px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-s);
  background: var(--surface-2);
}
.pagination-summary,
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pagination-summary {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 850;
}
.pagination-summary label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pagination-summary select {
  min-height: 32px;
  border: 1px solid var(--line-s);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}
.page-button {
  min-width: 32px;
  min-height: 28px;
  border: 1px solid var(--line-s);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
}
.page-button:hover:not(:disabled),
.page-button.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.page-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.page-gap {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 850;
}
th, td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-s);
  text-align: left;
  vertical-align: middle;
}
th {
  color: var(--ink-3);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
}
td {
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
}
tbody tr.history-row { cursor: pointer; }
tbody tr.history-row:hover td,
tbody tr.history-row.expanded td { background: var(--surface-2); }
th:last-child { width: 76px; }
.summary-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-button {
  min-height: 26px;
  padding: 0 8px;
  color: var(--blue);
  background: transparent;
  border: 0;
  font-size: 11px;
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.badge-normal { color: var(--green); background: var(--good-soft); }
.badge-warning { color: var(--amber); background: var(--warn-soft); }
.badge-danger { color: var(--red); background: var(--bad-soft); }
.badge-info { color: var(--blue); background: var(--primary-soft); }
.badge-limit { color: var(--gray); background: var(--surface-2); }

.history-detail-row td {
  padding: 0 14px 14px 42px;
  background: var(--surface-2);
}
.inline-detail {
  --detail-list-label-width: 180px;
  display: grid;
  gap: 10px;
  padding: 10px 0 4px 18px;
  border: 0;
  border-left: 2px solid var(--line-s);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.detail-section {
  display: grid;
  gap: 7px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.detail-section h3 {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}
.detail-grid {
  display: grid;
  grid-template-columns: var(--detail-list-label-width) minmax(0, 1fr);
  gap: 6px 20px;
  padding-left: 14px;
  font-size: 13px;
}
.detail-grid.compact {
  grid-template-columns: var(--detail-list-label-width) minmax(0, 1fr);
  gap: 5px 16px;
  font-size: 12px;
}
.detail-grid > span { padding: 0; border: 0; }
.detail-label {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-weight: 850;
  white-space: nowrap;
}
.detail-label::before { content: "•"; position: absolute; left: -12px; color: var(--ink-3); }
.compact-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}
.compact-detail-grid > div {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 7px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.compact-detail-grid h3 {
  padding: 0;
  border: 0;
}
.timeline {
  display: grid;
  gap: 5px;
  padding-left: 14px;
}
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 88px;
  column-gap: 24px;
  align-items: center;
  min-height: 24px;
  padding: 0;
  border: 0;
  font-size: 12px;
}
.timeline-item::before { content: "•"; position: absolute; left: -12px; color: var(--ink-3); }
.timeline-item > span:first-child {
  color: var(--ink-3);
  font-weight: 800;
}
.timeline-item strong {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.timeline-item > span:last-child { justify-self: end; color: var(--ink-2); font-weight: 800; }
.result-list {
  display: grid;
  gap: 5px;
  padding-left: 14px;
}
.result-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  min-height: 24px;
  align-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
}
.compact-detail-grid > div:nth-child(2) .result-row {
  grid-template-columns: var(--detail-list-label-width) minmax(0, 1fr);
  gap: 16px;
}
.compact-detail-grid > div:nth-child(2) .result-row strong { justify-self: start; }
.compact-result-list .result-row {
  grid-template-columns: var(--detail-list-label-width) minmax(0, 1fr);
  column-gap: 16px;
}
.compact-result-list .result-row > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.compact-result-list .result-row strong { justify-self: start; }
.result-row::before { content: "•"; position: absolute; left: -12px; color: var(--ink-3); }
.result-row-muted {
  color: var(--ink-3);
  background: transparent;
}
.related-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 3px 0 0 14px;
  border: 0;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 850;
}
.related-link {
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line-s);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}
.related-link:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.muted { color: var(--muted); }

@media (max-width: 1180px) {
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
  }
  .app-shell {
    display: block;
    width: 100%;
    height: auto;
    min-height: 100vh;
  }
  .sidebar { display: none; }
  .workspace {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .workspace-frame {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .workspace-top,
  .page-shell { width: min(100% - 20px, 1560px); }
  .workspace-top { padding-top: 12px; }
  .workspace-top,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
  h1 { font-size: 25px; }
  .workspace-title-block h2 { font-size: 25px; }
  .table-tools { justify-content: flex-start; }
  .compact-detail-grid { grid-template-columns: 1fr; }
}
