:root {
  color-scheme: light;
  --bg: #f6fbff;
  --panel: #ffffff;
  --text: #1d2522;
  --muted: #64748b;
  --line: #dbeafe;
  --accent: #0ea5e9;
  --accent-strong: #0284c7;
  --gold: #bb7b16;
  --blue: #3b82f6;
  --rose: #b4535f;
  --shadow: 0 14px 40px rgba(30, 64, 175, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.ghost {
  background: #e0f2fe;
  color: var(--accent-strong);
}

.ghost:hover {
  background: #bae6fd;
}

.icon-button {
  min-height: 32px;
  padding: 0 10px;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  padding: 24px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fcff 0%, #f3fbfc 58%, #eff8fb 100%);
  box-shadow: 0 16px 42px rgba(30, 64, 175, 0.1);
  text-align: left;
}

.eyebrow {
  margin: 0 0 4px;
  color: #2f6aa3;
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 40px);
}

.topbar h1 {
  font-size: clamp(28px, 3vw, 34px);
  line-height: 1.15;
}

.subtitle {
  margin: 6px 0 0;
  color: #3b6f9f;
  font-size: 13px;
  line-height: 1.5;
}

h2 {
  font-size: 16px;
}

.actions {
  display: flex;
  gap: 10px;
}

#syncButton {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fcff;
  color: #075985;
  font-size: 0;
  font-weight: 800;
  padding: 0;
}

#syncButton::before {
  content: "↻";
  font-size: 18px;
  line-height: 1;
}

#syncButton:hover {
  border-color: #93c5fd;
  background: #eef8ff;
  color: var(--accent-strong);
}

#exportButton {
  display: inline-grid;
  place-items: center;
  min-width: 56px;
  min-height: 42px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fcff;
  color: #075985;
  font-size: 14px;
  font-weight: 800;
  padding: 0 12px;
}

#exportButton:hover {
  border-color: #93c5fd;
  background: #eef8ff;
  color: var(--accent-strong);
}

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

.metric {
  background: linear-gradient(135deg, #2b7fba 0%, #25aee5 68%, #5bd8d2 100%);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(14, 116, 144, 0.18);
  color: #fff;
  padding: 16px;
}

.status-grid .metric:first-child {
  background: linear-gradient(135deg, #15518b 0%, #178fbd 62%, #24c7bd 100%);
}

.status-grid .metric:not(:first-child) {
  background: #fff;
  color: var(--text);
}

.status-grid .metric:not(:first-child) span,
.status-grid .metric:not(:first-child) strong {
  color: var(--text);
}

.metric span {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: #fff;
  font-size: 28px;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.settings-panel,
.chart-panel,
.table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings-panel {
  padding: 16px;
  position: sticky;
  top: 16px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-heading.compact {
  margin-top: 20px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16);
}

.field-map {
  display: grid;
  gap: 10px;
}

.message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.topbar .message {
  margin: 6px 0 0;
}

.message.error {
  color: var(--rose);
}

.message.ok {
  color: var(--accent);
}

.dashboard {
  min-width: 0;
}

.toolbar {
  display: grid;
  align-items: end;
  grid-template-columns: minmax(180px, 1.1fr) repeat(5, minmax(130px, 1fr)) minmax(96px, auto);
  column-gap: 10px;
  row-gap: 8px;
  margin-bottom: 14px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
}

.searchbox input {
  height: 100%;
  min-height: 0;
  border: 0;
  box-shadow: none;
  padding-inline: 0;
}

.searchbox span {
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.filter-field {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
  min-width: 0;
}

.filter-field > span {
  color: #49605b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.filter-field select {
  width: 100%;
}

.chart-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.chart-panel {
  padding: 16px;
  min-height: 280px;
}

.bar-chart {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.bar {
  display: grid;
  grid-template-columns: minmax(82px, 145px) minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #eef6ff;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--accent);
}

.bar:nth-child(2n) .bar-fill {
  background: var(--blue);
}

.bar:nth-child(3n) .bar-fill {
  background: var(--gold);
}

.table-panel {
  overflow: hidden;
}

.table-panel .panel-heading {
  padding: 16px 16px 0;
}

.table-panel .panel-heading span {
  color: var(--muted);
  font-size: 13px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding: 14px 16px;
}

.pagination-left,
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-left {
  color: var(--muted);
  font-size: 13px;
}

.pagination-left select {
  width: 112px;
  text-align-last: left;
}

.pager-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  min-height: 34px;
  padding: 0;
  border: 1px solid #bfd4e9;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
}

.pager-button:disabled {
  background: #eef5fb;
  color: #a8bacb;
  cursor: not-allowed;
  opacity: 1;
}

.page-input {
  width: 64px;
  min-height: 34px;
  border-color: #bfd4e9;
  border-radius: 8px;
  font-weight: 700;
  padding-inline: 8px;
}

.page-input::-webkit-inner-spin-button,
.page-input::-webkit-outer-spin-button {
  margin: 0;
}

#pageTotal {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: hidden;
  overflow-y: visible;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: #f8fbff;
}

td strong {
  display: block;
  font-size: 14px;
}

th:nth-child(1),
td:nth-child(1) {
  width: 4%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 8%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 13%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 7%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 11%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 6%;
}

th:nth-child(7),
td:nth-child(7) {
  width: 6%;
}

th:nth-child(8),
td:nth-child(8) {
  width: 13%;
}

th:nth-child(9),
td:nth-child(9) {
  width: 7%;
}

th:nth-child(10),
td:nth-child(10) {
  width: 7%;
}

th:nth-child(11),
td:nth-child(11) {
  width: 13%;
}

th:nth-child(12),
td:nth-child(12) {
  width: 5%;
}

table.hide-brand-column th:nth-child(6),
table.hide-brand-column td:nth-child(6) {
  display: none;
}

table.hide-brand-column th:nth-child(1),
table.hide-brand-column td:nth-child(1) {
  width: 4%;
}

table.hide-brand-column th:nth-child(2),
table.hide-brand-column td:nth-child(2) {
  width: 8%;
}

table.hide-brand-column th:nth-child(3),
table.hide-brand-column td:nth-child(3) {
  width: 14%;
}

table.hide-brand-column th:nth-child(4),
table.hide-brand-column td:nth-child(4) {
  width: 8%;
}

table.hide-brand-column th:nth-child(5),
table.hide-brand-column td:nth-child(5) {
  width: 13%;
}

table.hide-brand-column th:nth-child(7),
table.hide-brand-column td:nth-child(7) {
  width: 7%;
}

table.hide-brand-column th:nth-child(8),
table.hide-brand-column td:nth-child(8) {
  width: 13%;
}

table.hide-brand-column th:nth-child(9),
table.hide-brand-column td:nth-child(9) {
  width: 8%;
}

table.hide-brand-column th:nth-child(10),
table.hide-brand-column td:nth-child(10) {
  width: 7%;
}

table.hide-brand-column th:nth-child(11),
table.hide-brand-column td:nth-child(11) {
  width: 13%;
}

table.hide-brand-column th:nth-child(12),
table.hide-brand-column td:nth-child(12) {
  width: 5%;
}

th:nth-child(11),
td:nth-child(1),
td:nth-child(2),
td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8),
td:nth-child(9),
td:nth-child(10),
td:nth-child(11),
td:nth-child(12) {
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #e0f2fe;
  color: var(--accent-strong);
  padding: 0 9px;
  white-space: nowrap;
}

.clear-filters {
  align-self: end;
  height: 38px;
  min-width: 96px;
  white-space: nowrap;
}

.asset-link-line {
  display: block;
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  color: #7a8794;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-link-line a {
  color: #64748b;
  text-decoration: none;
}

.asset-link-line a:hover {
  color: #2563eb;
  text-decoration: underline;
}

.asset-link-empty {
  color: #a6b0bb;
}

.amount-value {
  display: block;
}

.amount-note {
  display: block;
  margin-top: 4px;
  color: #9aa6b2;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
}

.row-index {
  color: #7a8794;
  font-weight: 700;
}

.data-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  min-height: 26px;
  border: 1px solid var(--tag-border);
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-weight: 700;
  line-height: 1.15;
  padding: 4px 8px;
  white-space: nowrap;
}

.data-tag-company,
.data-tag-subCategory {
  border-radius: 7px;
  padding-inline: 12px;
}

.data-tag-category,
.data-tag-subCategory {
  min-width: 68px;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 42px 16px;
}

.topbar {
  flex-direction: row;
  justify-content: space-between;
  text-align: left;
}

.topbar > div:first-child {
  width: auto;
  min-width: 0;
}

.actions {
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-left: auto;
}

.workspace,
.dashboard,
.chart-panel,
.table-panel,
.panel-heading {
  text-align: center;
}

.panel-heading {
  justify-content: center;
  flex-wrap: wrap;
}

.status-grid,
.toolbar,
.chart-row {
  justify-content: center;
}

.metric {
  display: grid;
  justify-items: center;
  text-align: center;
}

.searchbox {
  justify-content: center;
}

input,
select,
.searchbox input {
  text-align: center;
  text-align-last: center;
}

.searchbox input::placeholder {
  text-align: center;
}

.bar span,
.bar strong {
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table {
  margin-inline: auto;
}

th,
td {
  text-align: center;
  vertical-align: middle;
}

td strong {
  text-align: center;
}

.pill {
  justify-content: center;
}

.empty-cell {
  color: #a6b0bb;
  font-size: 12px;
}

.column-filter-cell {
  position: relative;
  overflow: visible;
  padding: 8px 6px;
  z-index: 2;
}

.column-filter {
  position: relative;
  display: flex;
  justify-content: center;
}

.column-filter-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 28px;
  padding: 0 4px;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.column-filter-trigger:hover,
.column-filter-trigger.is-active {
  background: #e8f4f1;
  color: var(--accent-strong);
}

.column-filter-trigger > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-mark {
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
}

.table-filter-menu[hidden] {
  display: none;
}

.table-filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 50;
  width: 246px;
  transform: translateX(-50%);
  border: 1px solid #b9d7f4;
  border-radius: 8px;
  background: #f8fbff;
  box-shadow: 0 16px 38px rgba(25, 59, 89, 0.16);
  color: var(--text);
  padding: 12px;
  text-align: left;
  white-space: normal;
}

.column-filter-cell:nth-child(2) .table-filter-menu {
  left: 0;
  transform: none;
}

.column-filter-cell:nth-child(11) .table-filter-menu,
.column-filter-cell:nth-child(12) .table-filter-menu {
  right: 0;
  left: auto;
  transform: none;
}

.table-filter-title {
  color: #1f3e64;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 10px;
  text-align: center;
}

.table-filter-field {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  color: #5b6b7a;
  font-size: 12px;
  font-weight: 700;
}

.table-filter-field.is-hidden {
  display: none;
}

.table-filter-field input,
.table-filter-field select {
  min-height: 34px;
  border-color: #cfe0f2;
  border-radius: 6px;
  font-size: 12px;
  text-align: left;
  text-align-last: left;
}

.table-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  border-bottom: 1px solid #dce8f5;
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.table-filter-options.is-empty {
  display: none;
}

.table-filter-option {
  min-height: 26px;
  border: 1px solid #b9d7f4;
  border-radius: 999px;
  background: #edf7ff;
  color: #21679b;
  font-size: 12px;
  font-weight: 700;
  padding: 0 9px;
}

.table-filter-option:hover,
.table-filter-option.is-selected {
  border-color: #78b7e8;
  background: #dff1ff;
  color: #075985;
}

.table-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.table-filter-actions button {
  min-height: 32px;
  border-radius: 7px;
  font-weight: 800;
  padding: 0 14px;
}

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

  .settings-panel {
    position: static;
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .searchbox {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .actions,
  .toolbar,
  .status-grid,
  .chart-row {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
  }

  .status-grid {
    display: grid;
  }

  .pagination-bar,
  .pagination-left,
  .pagination-controls {
    justify-content: center;
  }

  .pagination-bar {
    flex-direction: column;
  }
}
