:root {
  --bg: #f4f5f8;
  --panel: #fff;
  --line: #edf0f5;
  --line-dark: #dcdfe6;
  --text: #242933;
  --muted: #8b93a3;
  --blue: #1677d2;
  --blue-hover: #0d66bd;
  --red: #e52d2d;
  --green: #087f5b;
  --orange: #f59f00;
  --teal: #00796b;
  --side: #fafafa;
  --active: #e8f3ff;
  --shadow: 0 3px 14px rgba(31, 41, 55, 0.08);
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  height: 42px;
  min-width: 0;
  border: 1px solid var(--line-dark);
  border-radius: 2px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
}

input::placeholder {
  color: #b6bdc9;
}

.system-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.side-menu {
  background: var(--side);
  border-right: 1px solid var(--line);
}

.logo {
  height: 72px;
  display: flex;
  align-items: center;
  padding-left: 34px;
  color: var(--blue);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.side-menu nav {
  padding-top: 12px;
}

.side-item {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  border: 0;
  border-left: 4px solid transparent;
  padding: 0 18px 0 36px;
  color: #303744;
  background: transparent;
  text-align: left;
  font-size: 16px;
}

.side-item.active {
  border-left-color: var(--blue);
  color: var(--blue);
  background: var(--active);
}

.side-item:hover {
  color: var(--blue);
  background: #f0f7ff;
}

.main-shell {
  min-width: 0;
  display: grid;
  grid-template-rows: 72px 50px 1fr;
}

.module-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.plain-icon {
  width: 36px;
  height: 36px;
  border: 0;
  color: #333;
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.plain-icon.user-entry {
  width: 54px;
  font-size: 14px;
  color: var(--blue);
}

.module-nav {
  display: flex;
  align-items: center;
  gap: 38px;
  margin-left: 10px;
  flex: 1;
}

.module-nav button {
  height: 72px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: #1f2937;
  background: transparent;
  font-size: 18px;
  font-weight: 600;
}

.module-nav button.active,
.module-nav button:hover {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-identity {
  min-width: 74px;
  color: #5f6878;
  font-size: 14px;
  text-align: right;
}

.logout-btn {
  height: 32px;
  border: 1px solid var(--line-dark);
  border-radius: 2px;
  padding: 0 10px;
  color: #303744;
  background: #fff;
}

.tab-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  overflow: hidden;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(31, 41, 55, 0.04);
}

.tab {
  height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0 14px;
  color: #4b5563;
  background: transparent;
  white-space: nowrap;
}

.tab::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b8bfca;
}

.tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.tab.active::before {
  background: var(--blue);
}

.tab span {
  color: #a0a7b4;
}

.page-area {
  min-width: 0;
  padding: 18px 20px 32px;
  overflow: auto;
}

.query-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 0;
  margin-bottom: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.field {
  min-height: 76px;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
}

.field label {
  color: #202733;
  font-size: 16px;
  font-weight: 600;
}

.field.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.wide-field {
  grid-column: span 2;
}

.table-card {
  position: relative;
  min-height: 520px;
  background: #fff;
  box-shadow: var(--shadow);
}

.toolbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}

.selection-bar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #d9ecff;
  padding: 0 18px;
  color: #0b5cab;
  background: #eef7ff;
}

.selection-bar strong {
  color: var(--blue);
}

.table-tools {
  position: absolute;
  top: 16px;
  right: 18px;
  display: flex;
  gap: 14px;
}

.table-tools button {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #2f3540;
  font-size: 22px;
}

.btn {
  min-width: 86px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line-dark);
  border-radius: 2px;
  padding: 0 14px;
  color: #303744;
  background: #fff;
}

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

.btn.primary:hover {
  background: var(--blue-hover);
}

.btn.danger {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

.btn.green {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.btn.orange {
  color: #fff;
  border-color: var(--orange);
  background: var(--orange);
}

.btn.small {
  min-width: 68px;
  height: 34px;
  padding: 0 10px;
}

.table-scroll {
  overflow: auto;
}

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

.data-table th,
.data-table td {
  height: 58px;
  border-bottom: 1px solid #edf0f5;
  padding: 0 18px;
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  color: #1f2937;
  font-size: 16px;
  font-weight: 700;
  background: #fff;
}

.data-table td {
  color: #202733;
  font-size: 16px;
}

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

.data-table tbody tr {
  cursor: default;
}

.data-table tbody tr[data-row-id] {
  cursor: pointer;
}

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

.checkbox {
  width: 18px;
  height: 18px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 40%, #c9ced8 0 18%, transparent 19%),
    radial-gradient(circle at 50% 70%, #c9ced8 0 28%, transparent 29%),
    #eff2f6;
  border: 1px solid #d9dee8;
}

.switch {
  width: 56px;
  height: 30px;
  display: inline-flex;
  position: relative;
}

.switch input {
  opacity: 0;
  position: absolute;
}

.switch span {
  width: 100%;
  border-radius: 999px;
  background: #d7dbe3;
  transition: background 160ms ease;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.24);
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: #bfc5d0;
}

.switch input:checked + span::after {
  transform: translateX(26px);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 28px;
  border-radius: 2px;
  padding: 0 8px;
  color: #fff;
  font-size: 14px;
}

.tag.blue {
  background: var(--blue);
}

.tag.green {
  background: var(--green);
}

.tag.orange {
  background: var(--orange);
}

.tag.dark {
  background: #263238;
}

.text-link {
  border: 0;
  color: #222;
  background: transparent;
  padding: 0 3px;
  font-size: 15px;
}

.pager {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  color: #202733;
  font-size: 16px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  border: 0;
  border-radius: 2px;
  color: #2b3442;
  background: transparent;
}

.page-btn.active {
  color: #fff;
  background: var(--blue);
}

.page-jump {
  width: 58px;
  height: 34px;
  text-align: center;
}

dialog {
  border: 0;
  padding: 0;
  box-shadow: 0 12px 44px rgba(15, 23, 42, 0.2);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.18);
}

#loginDialog {
  width: 420px;
}

.login-box {
  display: grid;
  gap: 16px;
  padding: 32px;
  background: #fff;
}

.login-box h1 {
  margin: 0;
  color: var(--blue);
  font-size: 26px;
  text-align: center;
}

.login-box p {
  margin: 0 0 8px;
  color: var(--muted);
  text-align: center;
}

.login-box label,
.modal-box label {
  display: grid;
  gap: 8px;
  color: #303744;
  font-weight: 600;
}

.modal-box {
  width: 760px;
  padding: 0;
  background: #fff;
}

.modal-title {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
  font-size: 18px;
}

.close-btn {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  font-size: 28px;
  color: #303744;
}

.form-grid {
  display: grid;
  gap: 18px;
  padding: 22px;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 22px;
}

.detail-modal {
  width: min(1480px, calc(100vw - 120px));
  height: min(820px, calc(100vh - 100px));
  overflow: auto;
  background: #fff;
}

.detail-section {
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 18px;
  font-size: 18px;
}

.detail-body {
  display: grid;
  grid-template-columns: 160px 1fr 160px 1fr;
  gap: 20px 26px;
  align-items: center;
}

.detail-label {
  color: #111827;
  font-weight: 700;
}

.detail-value {
  color: #303744;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
  text-align: center;
}

.stat-card strong {
  display: block;
  color: var(--blue);
  font-size: 28px;
}

.stat-card span {
  color: #3d4552;
}

.sub-tabs {
  display: flex;
  padding-left: 26px;
  border-bottom: 1px solid var(--line);
}

.sub-tabs button {
  height: 58px;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0 30px;
  background: transparent;
  font-size: 16px;
}

.sub-tabs button.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.mini-table {
  padding: 20px 26px 32px;
}

.mini-table table {
  width: 100%;
  border-collapse: collapse;
}

.mini-table th,
.mini-table td {
  height: 48px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  text-align: left;
}

.toast {
  position: fixed;
  right: 28px;
  top: 88px;
  z-index: 50;
  display: grid;
  gap: 10px;
}

.toast-item {
  min-width: 260px;
  border-left: 4px solid var(--blue);
  padding: 12px 14px;
  color: #202733;
  background: #fff;
  box-shadow: var(--shadow);
}

.toast-item.error {
  border-left-color: var(--red);
}

.loading-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.36);
  backdrop-filter: blur(1px);
}

.loading-card {
  min-width: 148px;
  border: 1px solid var(--line-dark);
  padding: 16px 22px;
  color: #303744;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.empty-state {
  height: 180px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  margin-bottom: 8px;
  color: #303744;
  font-size: 18px;
}

footer {
  position: fixed;
  right: 18px;
  bottom: 8px;
  color: rgba(31, 41, 55, 0.52);
  font-size: 12px;
  pointer-events: none;
}

@media (max-width: 1280px) {
  body {
    min-width: 1024px;
  }

  .system-shell {
    grid-template-columns: 188px 1fr;
  }

  .side-item {
    padding-left: 24px;
  }

  .query-panel {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}
