:root {
  --blue: #3d73ea;
  --blue-deep: #356ae2;
  --blue-light: #eef4ff;
  --line: #e7ebf2;
  --line-dark: #d6dce8;
  --bg: #f4f6fa;
  --text: #4a5568;
  --text-light: #7e8ba3;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(34, 60, 120, 0.08);
  --danger: #eb5757;
  --success: #3d73ea;
  --icon-stroke: 1.7;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: #edf1f7;
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
}

svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.topbar {
  height: 42px;
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 18px;
  box-shadow: 0 1px 4px rgba(23, 56, 136, 0.22);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

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

.brand-logo {
  width: 26px;
  height: 26px;
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.icon-button {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-button {
  flex-direction: column;
  gap: 3px;
}

.menu-button span {
  width: 13px;
  height: 2px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 3px;
}

.system-info,
.date-info {
  font-size: 13px;
  opacity: 0.95;
}

.header-icons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-icon {
  position: relative;
  width: 24px;
  height: 24px;
  color: rgba(255, 255, 255, 0.95);
  padding: 4px;
}

.badge {
  position: absolute;
  top: -4px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff625b;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-weight: 700;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 13px;
}

.user-chip svg {
  width: 12px;
  height: 12px;
}

.body-shell {
  display: grid;
  grid-template-columns: 140px 1fr;
  min-height: calc(100vh - 42px);
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  box-shadow: inset -1px 0 0 rgba(61, 115, 234, 0.03);
}

.sidebar-scroll {
  height: calc(100vh - 42px);
  overflow: auto;
}

.menu {
  display: flex;
  flex-direction: column;
  padding: 3px 0;
}

.menu-item,
.submenu-item {
  width: 100%;
  min-height: 38px;
  padding: 0 10px 0 15px;
  color: #5f6676;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #f6f7fa;
  transition: background 0.2s ease, color 0.2s ease;
  font-size: 13px;
}

.menu-item:hover,
.submenu-item:hover {
  background: #f7faff;
}

.active-top {
  background: #ffffff;
  color: #3f506b;
  font-weight: 600;
}

.submenu-item.current {
  background: linear-gradient(90deg, #edf4ff 0%, #f4f8ff 100%);
  color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.menu-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6c7a91;
  flex: 0 0 auto;
}

.submenu-item.current .menu-icon,
.submenu-item.current .menu-text {
  color: var(--blue);
}

.menu-icon.mini {
  width: 14px;
  height: 14px;
}

.menu-text {
  flex: 1;
  font-size: 13px;
  text-align: left;
}

.menu-arrow {
  color: #a5adba;
  font-size: 12px;
  line-height: 1;
}

.main-panel {
  background: var(--bg);
  padding: 8px 8px 18px;
  display: flex;
  flex-direction: column;
}

.tabs-row {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 28px;
  padding: 0 2px;
}

.tab-chip {
  height: 24px;
  padding: 0 12px;
  border-radius: 4px 4px 0 0;
  background: #edf2fb;
  border: 1px solid #dde5f3;
  border-bottom: none;
  color: #70809b;
  font-size: 12px;
}

.tab-chip.active {
  background: linear-gradient(180deg, #4e7df0 0%, #356de7 100%);
  color: #fff;
}

.panel-card {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.search-panel {
  position: relative;
  margin-top: 2px;
  padding: 14px 14px 10px;
}

.panel-title {
  font-size: 13px;
  color: #5f6c84;
  margin-bottom: 18px;
}

.panel-title.small {
  margin-bottom: 0;
}

.top-actions {
  position: absolute;
  top: 10px;
  right: 12px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-button {
  min-width: 64px;
  height: 30px;
  border-radius: 3px;
  padding: 0 12px;
  border: 1px solid #cfd8eb;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  color: #7d889e;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.action-button.primary {
  background: linear-gradient(180deg, #4f7ff2 0%, #3b73ea 100%);
  border-color: #376de5;
  color: #fff;
  box-shadow: 0 1px 4px rgba(61, 115, 234, 0.2);
}

.action-button.light {
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fc 100%);
  color: #7b889d;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.action-button.ghost {
  background: #fff;
}

.file-action {
  position: relative;
  overflow: hidden;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px 10px;
  padding-top: 18px;
}

.search-grid.collapsed .advanced-field {
  display: none;
}

.field-item {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 8px;
}

.field-item span {
  font-size: 13px;
  color: #5e6a80;
  white-space: nowrap;
}

.input-wrap {
  display: flex;
  align-items: center;
  height: 32px;
  border: 1px solid #dfe5f0;
  background: #fff;
}

.input-wrap input,
.modal-form input,
.modal-form select,
.jump-input,
.page-size-wrap select {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: #61708b;
  padding: 0 10px;
}

.input-wrap input::placeholder,
.modal-form input::placeholder {
  color: #b3bdcd;
}

.with-icon {
  padding-right: 0;
}

.input-icon {
  width: 32px;
  height: 30px;
  border-left: 1px solid #e1e6f0;
  padding: 7px;
  color: #aab4c4;
  flex: 0 0 auto;
}

.table-panel {
  margin-top: 10px;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

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

.table-wrap {
  border: 1px solid #dbe3f0;
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.data-table thead tr {
  background: linear-gradient(180deg, #4e80f3 0%, #3c75ea 100%);
  color: #fff;
}

.data-table th,
.data-table td {
  border-right: 1px solid #d8e0ef;
  border-bottom: 1px solid #e6ebf4;
  padding: 0 8px;
  height: 32px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: none;
}

.data-table th {
  font-weight: 500;
  font-size: 12px;
}

.data-table tbody tr:nth-child(even) {
  background: #fcfdff;
}

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

.data-table tbody tr.selected {
  background: #ecf4ff;
}

.checkbox-col {
  width: 34px;
  text-align: center;
}

.index-col {
  width: 44px;
  text-align: center;
}

.actions-col {
  width: 146px;
}

.data-table td.checkbox-col,
.data-table td.index-col,
.data-table th.checkbox-col,
.data-table th.index-col {
  text-align: center;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.text-action {
  color: #6e88c6;
  font-size: 12px;
  padding: 0;
}

.text-action::before {
  content: "◬";
  font-size: 10px;
  margin-right: 2px;
  opacity: 0.7;
}

.text-action.more::before {
  content: "»";
}

.text-action.danger {
  color: #7e9ad2;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 22px;
  padding: 0 10px;
  border-radius: 4px;
  font-size: 12px;
  background: #edf5ff;
  color: #4d82e5;
}

.status-badge.invalid {
  background: #f2f4fa;
  color: #7b92be;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px 4px;
  color: #6f7f9a;
  font-size: 13px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.page-size-wrap {
  width: 92px;
  height: 30px;
  border: 1px solid #dbe3ef;
  background: linear-gradient(180deg, #fff 0%, #f8fafd 100%);
}

.page-size-wrap select {
  color: #6d7a90;
  appearance: none;
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-number,
.page-ellipsis,
.page-nav {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6f7e99;
  font-size: 13px;
}

.page-number.active {
  color: #316fe6;
  font-weight: 700;
}

.jump-input {
  width: 42px;
  height: 28px;
  border: 1px solid #dbe3ef;
  background: #fff;
  text-align: center;
  padding: 0 6px;
}

.page-footer {
  margin-top: auto;
  text-align: center;
  color: #a5adba;
  font-size: 11px;
  padding-top: 22px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(33, 45, 73, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal-backdrop.hidden {
  display: none;
}

.edit-modal {
  width: min(560px, calc(100vw - 40px));
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(24, 40, 73, 0.2);
  overflow: hidden;
}

.modal-header {
  height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e8edf4;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  color: #3c4a61;
}

.modal-close {
  font-size: 24px;
  color: #9aa7bc;
}

.modal-form {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: #66758f;
}

.modal-form input,
.modal-form select {
  height: 38px;
  border: 1px solid #dbe2f0;
  background: #fff;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

input[type="checkbox"] {
  width: 13px;
  height: 13px;
  accent-color: #4a7bee;
  cursor: pointer;
  vertical-align: middle;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(129, 145, 176, 0.35);
  border-radius: 999px;
}

@media (max-width: 1200px) {
  .search-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (max-width: 980px) {
  .body-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main-panel {
    padding: 8px;
  }
}

@media (max-width: 768px) {
  .topbar {
    height: auto;
    padding: 8px 12px;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .body-shell {
    min-height: calc(100vh - 74px);
  }

  .topbar-right {
    flex-wrap: wrap;
  }

  .search-grid,
  .modal-form {
    grid-template-columns: 1fr;
  }

  .field-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .top-actions {
    position: static;
    margin-bottom: 12px;
  }

  .search-panel {
    padding-top: 12px;
  }

  .table-toolbar,
  .pagination-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}
