:root {
  --sidebar-width: 240px;
  --sidebar-collapsed: 68px;
  --dark: #171923;
  --dark-deep: #10121a;
  --dark-hover: #232635;
  --blue: #4b6fff;
  --blue-strong: #3458f6;
  --blue-soft: #eef4ff;
  --line: #e7ecf5;
  --line-strong: #dce3ef;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #202532;
  --muted: #7c8494;
  --subtle: #f8fafd;
  --danger: #ff6666;
  --warning: #f2a93b;
  --success: #45b864;
  --shadow: 0 18px 48px rgba(22, 28, 45, 0.18);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  min-width: 0;
}

.app.is-collapsed {
  grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
}

.sidebar {
  min-width: 0;
  background: var(--dark);
  color: #d7dce6;
  border-right: 1px solid #0b0d13;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.brand {
  height: 68px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-logo {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
  letter-spacing: 0;
}

.brand-text strong,
.brand-text span {
  display: block;
  line-height: 1.1;
}

.brand-text strong {
  margin-bottom: 6px;
  color: #fff;
  font-size: 16px;
}

.brand-text span {
  color: #b2b9c7;
  font-size: 13px;
  font-weight: 700;
}

.nav-list {
  overflow: auto;
  padding: 4px 14px 18px;
}

.nav-group {
  margin-bottom: 8px;
}

.nav-parent,
.nav-child {
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 4px;
  color: inherit;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.nav-parent {
  min-height: 46px;
  padding: 0 10px;
  font-weight: 700;
}

.nav-parent:hover,
.nav-child:hover {
  background: var(--dark-hover);
}

.nav-parent.is-active,
.nav-child.is-active {
  color: #fff;
  background: var(--blue);
}

.nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav-arrow {
  margin-left: auto;
  color: #aab1bf;
}

.nav-children {
  display: none;
  padding: 2px 0 4px 20px;
}

.nav-group.is-open .nav-children {
  display: block;
}

.nav-child {
  min-height: 38px;
  padding: 0 10px;
  color: #cfd4df;
  font-size: 13px;
  font-weight: 700;
}

.nav-child::before {
  content: "";
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #555b6b;
}

.nav-child.is-active::before {
  background: #fff;
}

.app.is-collapsed .brand-text,
.app.is-collapsed .nav-label,
.app.is-collapsed .nav-arrow,
.app.is-collapsed .nav-children {
  display: none;
}

.app.is-collapsed .brand {
  padding: 14px 15px;
}

.app.is-collapsed .nav-list {
  padding: 8px 10px;
}

.app.is-collapsed .nav-parent {
  justify-content: center;
  padding: 0;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 56px 42px minmax(0, 1fr);
}

.topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #687182;
  background: #fff;
}

.icon-button:hover,
.ghost-button:hover {
  color: var(--blue);
  border-color: #cbd6ff;
  background: #f7f9ff;
}

.menu-button {
  display: none;
}

.breadcrumb {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #727b8c;
  font-weight: 700;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #6d7584;
  font-weight: 700;
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: #52c7a8;
  font-weight: 800;
}

.tabs {
  min-width: 0;
  overflow-x: auto;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 116px;
  max-width: 220px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: #5e6778;
  font-weight: 700;
}

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

.tab.is-active {
  color: var(--blue-strong);
  background: var(--blue-soft);
}

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

.tab span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tab-close {
  border: 0;
  color: inherit;
  background: transparent;
  padding: 0;
  line-height: 1;
}

.content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 14px 18px 22px;
}

.notice {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 4px;
  color: #9a5a13;
  background: #fff4df;
  border: 1px solid #ffe0ac;
  font-weight: 700;
}

.page-card {
  min-width: 0;
}

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

.title-stack {
  min-width: 0;
}

.module-chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  margin-bottom: 8px;
  border-radius: 4px;
  color: var(--blue-strong);
  background: var(--blue-soft);
  font-weight: 700;
}

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

h1 {
  font-size: 20px;
  line-height: 1.35;
}

.page-actions,
.button-row,
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.danger-button,
.warning-button,
.link-button {
  min-height: 32px;
  border-radius: 4px;
  border: 1px solid var(--line);
  padding: 0 14px;
  font-weight: 700;
}

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

.primary-button:hover {
  background: var(--blue-strong);
  border-color: var(--blue-strong);
}

.ghost-button {
  color: #5c6576;
  background: #fff;
}

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

.warning-button {
  color: #fff;
  background: var(--warning);
  border-color: var(--warning);
}

.link-button {
  border-color: transparent;
  color: var(--blue-strong);
  background: transparent;
  padding: 0 6px;
}

.link-button.danger {
  color: var(--danger);
}

.link-button.warning {
  color: var(--warning);
}

.link-button.success {
  color: var(--success);
}

.filter-panel,
.table-card,
.form-panel,
.dashboard-card,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.filter-panel {
  padding: 12px;
  margin-bottom: 12px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: #525b6c;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

.field textarea {
  min-height: 78px;
  resize: vertical;
  padding: 9px 10px;
  line-height: 1.6;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #8ca0ff;
  box-shadow: 0 0 0 3px rgba(75, 111, 255, 0.12);
}

.range-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.range-field span {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

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

.bet-record-view {
  min-width: 0;
}

.bet-filter-panel {
  margin-bottom: 18px;
  padding: 0;
  background: transparent;
}

.bet-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(170px, 0.9fr) minmax(170px, 0.9fr) minmax(130px, 0.75fr) minmax(370px, 2fr) minmax(150px, 0.75fr) minmax(130px, 0.75fr) auto;
  gap: 12px;
  align-items: end;
}

.bet-filter-grid .field label {
  margin-bottom: 10px;
  color: #667085;
}

.joined-control,
.date-range-control {
  display: flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}

.joined-control select {
  width: 96px;
  flex: 0 0 96px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
}

.joined-control input {
  border: 0;
  border-radius: 0;
}

.date-range-control {
  gap: 8px;
  padding: 0 10px;
}

.date-prefix {
  color: #98a2b3;
}

.date-range-control input {
  min-width: 166px;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.date-range-control strong {
  color: #1f2937;
}

.bet-filter-actions {
  display: flex;
  gap: 12px;
  align-items: end;
}

.bet-filter-actions .primary-button {
  min-width: 56px;
}

.bet-category-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 18px;
  overflow-x: auto;
}

.bet-category {
  min-width: 116px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-right: 0;
  background: #fff;
  color: #3f4654;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
}

.bet-category:first-child {
  border-radius: 4px 0 0 4px;
}

.bet-category:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 4px 4px 0;
}

.bet-category.is-active {
  border-color: #9fb2f8;
  box-shadow: 0 0 0 1px #9fb2f8 inset, 0 4px 12px rgba(75, 111, 255, 0.08);
  color: var(--blue-strong);
  background: linear-gradient(180deg, #fbfdff 0%, #f7faff 100%);
}

.bet-category-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: currentColor;
}

.bet-category-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bet-category:hover {
  background: #fbfcff;
}

.bet-category.blue .bet-category-icon,
.bet-category.cyan .bet-category-icon {
  color: #2f6ce5;
}

.bet-category.pink .bet-category-icon {
  color: #e63f77;
}

.bet-category.purple .bet-category-icon,
.bet-category.violet .bet-category-icon {
  color: #8a46d8;
}

.bet-category.navy .bet-category-icon,
.bet-category.indigo .bet-category-icon,
.bet-category.deep .bet-category-icon {
  color: #1f2d8f;
}

.bet-category.gold .bet-category-icon {
  color: #e3a51a;
}

.bet-category.teal .bet-category-icon {
  color: #24aab8;
}

.bet-summary-bar {
  display: grid;
  grid-template-columns: repeat(5, max-content);
  justify-content: center;
  gap: clamp(24px, 5vw, 92px);
  margin: 4px 0 18px;
  color: #f04444;
  font-weight: 800;
  white-space: nowrap;
}

.bet-table-card {
  border-radius: 4px;
}

.bet-record-table {
  min-width: 2050px;
}

.bet-record-table.is-activity {
  min-width: 2420px;
}

.bet-record-table.is-lottery {
  min-width: 2240px;
}

.bet-record-table.is-chess {
  min-width: 2100px;
}

.bet-record-table.is-lottery th,
.bet-record-table.is-lottery td,
.bet-record-table.is-chess th,
.bet-record-table.is-chess td {
  padding: 0 8px;
  font-size: 12px;
}

.bet-record-table th,
.bet-record-table td {
  height: 38px;
  padding: 0 12px;
}

.bet-record-table th {
  background: #f7fbff;
}

.bet-record-table .status.success {
  background: transparent;
}

.bet-pager {
  min-width: 900px;
}

.bet-construction {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: #7c8494;
}

.bet-construction strong {
  color: #202532;
  font-size: 18px;
}

.bet-construction span {
  font-size: 16px;
  font-weight: 800;
}

.table-card {
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  height: 52px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  text-align: center;
  vertical-align: middle;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.data-table th {
  background: #f3f7fe;
  color: #252b38;
  font-weight: 800;
}

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

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

.cell-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-weight: 700;
}

.status.success,
.tag.success {
  color: #23a447;
  background: #edf9f0;
}

.status.danger,
.tag.danger {
  color: #e94f4f;
  background: #fff0f0;
}

.status.warning,
.tag.warning {
  color: #be7a12;
  background: #fff6e7;
}

.status.info,
.tag.info {
  color: var(--blue-strong);
  background: var(--blue-soft);
}

.pager {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: #687182;
}

.pager button,
.pager select,
.pager input {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: #606a7a;
  background: #fff;
  text-align: center;
}

.pager button.is-current {
  color: var(--blue);
  border-color: #cbd6ff;
  background: var(--blue-soft);
}

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

.dashboard-card {
  padding: 18px;
}

.metric-label {
  color: var(--muted);
  font-weight: 700;
}

.metric-value {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 800;
}

.welcome-panel {
  min-height: 320px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  background: #fff;
}

.welcome-panel h2 {
  margin-bottom: 8px;
  font-size: 21px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.quick-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  background: #fbfcff;
}

.quick-card strong {
  display: block;
  margin-bottom: 8px;
}

.quick-card span {
  color: var(--muted);
  line-height: 1.6;
}

.form-panel,
.detail-panel {
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px 18px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.form-actions {
  justify-content: center;
  margin-top: 18px;
}

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

.detail-item {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  background: var(--subtle);
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.detail-item strong {
  display: block;
  margin-top: 8px;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(22, 26, 34, 0.54);
}

.modal {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal.large {
  width: min(960px, calc(100vw - 32px));
}

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

.modal-title {
  font-size: 16px;
  font-weight: 800;
}

.modal-body {
  padding: 18px;
}

.close-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #8a92a1;
  font-size: 18px;
}

.permission-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 16px;
}

.tree-panel {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  max-height: 560px;
  overflow: auto;
}

.tree-list,
.tree-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree-list ul {
  padding-left: 22px;
}

.tree-list li {
  margin: 8px 0;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4f5969;
  font-weight: 700;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.tree-home {
  margin-left: 10px;
  color: #53b35b;
  font-weight: 700;
}

.side-summary {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--subtle);
  padding: 14px;
}

.side-summary strong {
  display: block;
  margin-bottom: 8px;
}

.side-summary p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
}

.rate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.rate-item {
  display: grid;
  grid-template-columns: 1fr 78px;
  gap: 8px;
}

.api-method {
  font-weight: 800;
}

.api-method.post {
  color: #26a65b;
}

.api-method.get {
  color: var(--blue);
}

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 26px;
  min-width: 220px;
  max-width: min(520px, calc(100vw - 32px));
  transform: translateX(-50%) translateY(16px);
  padding: 10px 14px;
  border-radius: 4px;
  color: #fff;
  background: rgba(20, 24, 35, 0.94);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.42);
}

@media (max-width: 1180px) {
  .filter-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .dashboard-grid,
  .detail-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 1500px) {
  .bet-filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .bet-user-field,
  .bet-time-field {
    grid-column: span 2;
  }

  .bet-filter-actions {
    justify-content: flex-start;
  }

  .bet-summary-bar {
    grid-template-columns: repeat(2, max-content);
    justify-content: flex-start;
    gap: 12px 36px;
  }
}

@media (max-width: 920px) {
  .app,
  .app.is-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(300px, 86vw);
    transform: translateX(-104%);
    transition: transform 180ms ease;
  }

  .app.nav-open .sidebar {
    transform: translateX(0);
  }

  .menu-button {
    display: inline-grid;
  }

  .collapse-button {
    display: none;
  }

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

  .filter-grid,
  .bet-filter-grid,
  .form-grid,
  .permission-layout,
  .quick-grid {
    grid-template-columns: 1fr;
  }

  .bet-user-field,
  .bet-time-field {
    grid-column: auto;
  }

  .date-range-control {
    flex-wrap: wrap;
    padding: 8px 10px;
  }

  .date-range-control input {
    min-width: 130px;
    flex: 1 1 130px;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding: 0 10px;
    gap: 8px;
  }

  .user-profile span:last-child {
    display: none;
  }

  .content {
    padding: 10px;
  }

  .tabs {
    height: 42px;
  }

  .tab {
    min-width: 104px;
    padding: 0 10px;
  }

  .filter-actions {
    justify-content: flex-start;
  }

  .pager {
    flex-wrap: wrap;
    padding: 10px;
  }

  .dashboard-grid,
  .detail-grid,
  .rate-grid {
    grid-template-columns: 1fr;
  }
}
