:root {
  color-scheme: light;
  --text-major: #409eff;
  --border: #ebeef5;
  --text: #303133;
  --muted: #909399;
  --danger: #f56c6c;
  --success: #67c23a;
  --warning: #e6a23c;
  --info: #909399;
  --surface: #ffffff;
  --page: #f5f7fa;
  font-family: "Helvetica Neue", Arial, "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--text);
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-root {
  min-height: 100vh;
}

.app-navbar {
  height: 40px !important;
  padding: 0;
}

.navbar {
  min-height: 40px;
}

.navbar-brand {
  font-size: 20px;
}

.navbar-major-menu {
  height: 40px;
  background: transparent;
  border-bottom: 0;
}

.navbar-major-menu .el-menu-item {
  height: 40px;
  line-height: 40px;
  color: #fff;
  border-bottom: 0;
  padding: 0 18px;
}

.navbar-major-menu .el-menu-item.is-active,
.navbar-major-menu .el-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-bottom: 0;
}

.navbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.uid-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #fff;
}

.uid-field input {
  width: 76px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.page-body {
  display: block;
  min-height: calc(100vh - 40px);
}

.breadcrumb-header {
  height: auto !important;
  padding: 0;
}

.breadcrumb {
  margin: 0;
  min-height: 40px;
  border-radius: 0;
  background: #fff;
  align-items: center;
}

.text-major {
  color: var(--text-major);
}

.money-page {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px);
  background: #fff;
}

.money-topbar {
  height: auto !important;
  min-height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.book-tabs,
.record-tabs {
  border-bottom: 0;
  background: transparent;
}

.book-tabs {
  display: flex;
  min-width: 0;
  overflow-x: auto;
}

.book-tabs .el-menu-item,
.record-tabs .el-menu-item {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text);
  white-space: nowrap;
}

.book-tabs .el-menu-item {
  height: 32px;
  line-height: 14px;
  padding: 8px 12px;
}

.record-tabs .el-menu-item {
  height: 32px;
  line-height: 14px;
  padding: 8px 12px;
}

.book-tabs .el-menu-item.is-active,
.record-tabs .el-menu-item.is-active {
  color: var(--text-major);
  border-bottom-color: var(--text-major);
}

.book-tabs .book-tab-actions {
  display: inline-flex;
  margin-left: 6px;
  opacity: 0;
  transition: opacity 120ms ease;
}

.book-tabs .el-menu-item:hover .book-tab-actions,
.book-tabs .el-menu-item:focus-within .book-tab-actions {
  opacity: 1;
}

.book-tab-actions button {
  width: 20px;
  height: 20px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

.money-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 8px;
}

.search-wrap {
  display: inline-flex;
  align-items: stretch;
  width: min(260px, 42vw);
}

.search-wrap .el-input__inner {
  height: 28px;
  border-radius: 4px 0 0 4px;
}

.search-wrap .el-button {
  border-radius: 0 4px 4px 0;
  border-left: 0;
}

.money-workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: stretch;
  flex: 1;
}

.class-aside {
  width: 300px !important;
  display: block;
  border-right: 1px solid var(--border);
  background: #fff;
}

.class-menu {
  width: 300px;
  border-right: 0;
}

.class-menu .el-menu-item,
.class-menu .el-submenu__title {
  height: 45px;
  line-height: 45px;
  border-left: 3px solid transparent;
}

.class-menu .el-submenu .el-menu-item {
  height: 35px;
  line-height: 35px;
  padding: 0 10px 0 45px;
}

.class-menu .is-active {
  color: var(--text-major);
  border-left-color: var(--text-major);
  background: #ecf5ff;
}

.class-title,
.class-item-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 8px;
}

.class-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.class-total {
  flex: 0 0 auto;
  display: inline-block;
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 4px;
  padding: 0 6px;
  color: #909399;
  background: #f4f4f5;
  font-size: 12px;
}

.parent-currency-tags {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.currency-tag {
  display: inline-block;
  border-radius: 4px;
  padding: 0 6px;
  color: #909399;
  background: #f4f4f5;
  font-size: 12px;
  line-height: 20px;
}

.money-main {
  min-width: 0;
  padding: 0;
  background: #fff;
}

.visual-panel {
  min-height: 0;
  border-bottom: 1px solid var(--border);
}

.legacy-calendar {
  background: #fff;
}

.legacy-calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
  border-bottom: 1px solid var(--border);
}

.legacy-calendar-header strong {
  font-weight: 500;
}

.legacy-calendar-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  padding: 5px;
}

.calendar-weekday,
.calendar-day {
  min-height: 35px;
  padding: 3px 5px;
  border-bottom: 1px solid #f2f6fc;
}

.calendar-weekday {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.calendar-day {
  border: 0;
  background: #fff;
  text-align: left;
  color: var(--text);
}

.calendar-day:hover,
.calendar-day.is-selected {
  background: #ecf5ff;
  color: var(--text-major);
}

.calendar-day.is-today {
  color: var(--text-major);
  font-weight: 700;
}

.calendar-day.is-muted {
  color: #c0c4cc;
}

.chart-view {
  height: 300px;
  padding: 12px 16px 6px;
}

.chart-view svg {
  display: block;
  width: 100%;
  height: 260px;
}

.chart-axis {
  stroke: #dcdfe6;
  stroke-width: 1;
}

.chart-column {
  fill: var(--warning);
  opacity: 0.72;
}

.chart-line-in {
  fill: none;
  stroke: var(--danger);
  stroke-width: 3;
}

.chart-line-out {
  fill: none;
  stroke: var(--success);
  stroke-width: 3;
}

.chart-dot-in {
  fill: var(--danger);
}

.chart-dot-out {
  fill: var(--success);
}

.chart-labels {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-radius: 50%;
}

.legend-in {
  background: var(--danger);
}

.legend-out {
  background: var(--success);
}

.legend-diff {
  background: var(--warning);
}

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

.money-listbar {
  padding: 8px 0 6px;
}

.record-table-wrap {
  padding-bottom: 24px;
}

.legacy-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  color: #606266;
}

.legacy-table tr:nth-child(even) {
  background: #fafafa;
}

.legacy-table td,
.legacy-table th {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  vertical-align: middle;
}

.date-cell {
  width: 80px;
  text-align: center;
  color: #606266;
}

.date-cell strong {
  display: block;
  color: var(--text);
}

.class-flow {
  min-width: 150px;
}

.record-note {
  color: var(--muted);
  font-size: 13px;
}

.amount-cell {
  min-width: 150px;
  text-align: right;
}

.action-cell {
  width: 92px;
  text-align: right;
}

.text-danger {
  color: var(--danger) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-muted {
  color: var(--muted) !important;
}

.empty-table {
  padding: 36px 12px;
  color: var(--muted);
  text-align: center;
}

.loading-mask {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.66);
  color: var(--text-major);
  font-size: 28px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2050;
  background: rgba(0, 0, 0, 0.35);
}

.drawer-panel {
  width: min(75vw, 340px);
  height: 100%;
  overflow: auto;
  background: #fff;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.18);
}

.drawer-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.drawer-panel .class-menu,
.drawer-panel .class-aside {
  width: 100% !important;
}

.legacy-dialog {
  width: min(70vw, 880px);
  max-width: calc(100vw - 24px);
  border: 0;
  border-radius: 2px;
  padding: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.legacy-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.wide-dialog {
  width: min(70vw, 980px);
}

.dialog-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-form h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.dialog-form label {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0;
}

.dialog-stack {
  display: grid;
  gap: 12px;
}

.switch-line {
  grid-template-columns: auto 1fr !important;
  justify-content: start;
}

.transfer-row,
.money-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

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

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

.transfer-row label,
.money-row label {
  grid-template-columns: 80px minmax(0, 1fr);
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.analytics-grid {
  display: grid;
  gap: 16px;
}

.analytics-card {
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 12px;
}

.analytics-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 500;
}

.analytics-bars {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  align-items: end;
  gap: 4px;
  height: 150px;
  border-bottom: 1px solid var(--border);
}

.analytics-bar {
  min-height: 2px;
  background: var(--warning);
}

.analytics-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.analytics-pill {
  border-radius: 4px;
  padding: 4px 8px;
  background: #f4f4f5;
  color: #606266;
}

#toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 3000;
  transform: translateY(80px);
  transition: transform 160ms ease;
  border-radius: 4px;
  padding: 10px 14px;
  background: #303133;
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16);
}

#toast.show {
  transform: translateY(0);
}

@media (max-width: 767.98px) {
  .money-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .money-toolbar {
    width: 100%;
    justify-content: space-between;
  }

  .search-wrap {
    order: 3;
    width: 100%;
  }

  .money-workspace {
    display: block;
  }

  .class-aside {
    display: none !important;
  }

  .money-main {
    width: 100%;
  }

  .record-tabs {
    max-width: calc(100vw - 18px);
    overflow-x: auto;
  }

  .legacy-table,
  .legacy-table tbody,
  .legacy-table tr,
  .legacy-table td {
    display: block;
    width: 100%;
  }

  .legacy-table tr {
    border-bottom: 1px solid var(--border);
  }

  .legacy-table td {
    border-bottom: 0;
  }

  .date-cell,
  .amount-cell,
  .action-cell {
    text-align: left;
  }

  .legacy-dialog,
  .wide-dialog {
    width: 98%;
  }

  .dialog-form label,
  .transfer-row label,
  .money-row label {
    grid-template-columns: 1fr;
  }

  .transfer-row,
  .money-row,
  .money-row.two {
    grid-template-columns: 1fr;
  }
}
