:root {
  color-scheme: light;
  --bg: #f0f2f5;
  --panel: #ffffff;
  --line: #ebeef5;
  --line-dark: #dcdfe6;
  --text: #303133;
  --muted: #909399;
  --primary: #409eff;
  --warning: #e6a23c;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 16px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle,
.sidebar-label,
.group-meta-mini,
.page-subtitle,
.muted,
.dt2,
.empty-cell,
.group-empty,
.section-subtitle {
  color: var(--muted);
}

.sidebar-label {
  font-size: 12px;
  margin-bottom: 8px;
}

.group-list {
  display: grid;
  gap: 8px;
}

.group-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.group-item.is-active {
  border-color: var(--primary);
  background: #ecf5ff;
}

.group-name {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.content {
  padding: 16px;
}

.page.hidden {
  display: none;
}

.transactions-page {
  width: min(100%, 1220px);
  margin: 0 auto;
}

.page-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.page-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 600;
}

.page-subtitle {
  margin-top: 6px;
  font-size: 13px;
}

.surface {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 14px;
}

.section-head {
  margin-bottom: 10px;
}

.section-title,
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.card-title {
  margin-bottom: 10px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-title-row .card-title {
  margin-bottom: 0;
}

.section-subtitle {
  display: none;
}

.quick-card .section-head,
.toolbar-card .section-head {
  display: none;
}

.group-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f4f4f5;
  color: #606266;
  font-size: 12px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ecf5ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.quick-card {
  display: grid;
  gap: 10px;
}

.quick-row {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 120px;
  gap: 8px;
}

.field-select,
.field-input,
.primary-btn,
.ghost-btn {
  width: 100%;
  min-height: 36px;
  border-radius: 4px;
  font: inherit;
}

.field-select,
.field-input {
  border: 1px solid var(--line-dark);
  background: #fff;
  padding: 0 12px;
}

.field-select:focus,
.field-input:focus {
  outline: none;
  border-color: #79bbff;
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.12);
}

.toolbar-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  color: #606266;
  font-size: 13px;
}

.action-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn {
  cursor: pointer;
  padding: 0 14px;
  transition: 0.15s ease;
}

.primary-btn {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover {
  background: #66b1ff;
  border-color: #66b1ff;
}

.ghost-btn {
  border: 1px solid var(--line-dark);
  background: #fff;
  color: #606266;
}

.ghost-btn:hover {
  color: var(--primary);
  border-color: #c6e2ff;
  background: #ecf5ff;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.compact-table {
  min-width: 720px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.data-table th:last-child,
.data-table td:last-child {
  white-space: normal;
  min-width: 180px;
}

.data-table th {
  background: #fafafa;
  color: #606266;
  font-weight: 600;
}

.data-table tbody tr:hover {
  background: #f5f7fa;
}

.amount,
.dt1,
.summary-strong {
  font-weight: 600;
}

.text-primary {
  color: var(--primary);
  font-weight: 600;
}

.text-warning {
  color: var(--warning);
  font-weight: 600;
}

.cell-num {
  text-align: right;
}

.code-text {
  font-family: Consolas, "SFMono-Regular", Monaco, monospace;
  font-size: 12px;
  color: #606266;
}

.stats-card .table-wrapper {
  max-width: 440px;
}

.collapse-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}

.collapse-item:last-child {
  margin-bottom: 0;
}

.collapse-item summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  background: #fafafa;
  position: relative;
}

.collapse-item summary::-webkit-details-marker {
  display: none;
}

.collapse-item summary::after {
  content: "▸";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #909399;
  transition: transform 0.15s ease;
}

.collapse-item[open] summary {
  border-bottom: 1px solid var(--line);
}

.collapse-item[open] summary::after {
  transform: translateY(-50%) rotate(90deg);
}

.empty-state {
  padding: 40px 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.empty-state.error {
  background: #fff7f7;
  border-color: #f3d2d2;
}

body.isolated .app-shell {
  grid-template-columns: 1fr;
}

body.isolated .sidebar {
  display: none;
}

@media (max-width: 768px) {
  .content {
    padding: 12px;
  }

  .page-hero {
    flex-direction: column;
  }

  .quick-row,
  .toolbar-grid {
    grid-template-columns: 1fr;
  }

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

  .card-title-row {
    align-items: flex-start;
  }

  .data-table {
    min-width: 720px;
  }
}
