body {
  margin: 0;
  overflow: hidden;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei UI",
    sans-serif;
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.28), transparent 24%),
    radial-gradient(circle at bottom right, rgba(129, 140, 248, 0.18), transparent 22%),
    linear-gradient(180deg, #f6f8fb 0%, #eef2f7 100%);
  color: #26313f;
}

.layout-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 268px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: rgba(246, 248, 251, 0.72);
  border-right: 1px solid rgba(197, 205, 217, 0.7);
  backdrop-filter: blur(24px);
  transition: transform 0.3s ease;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(212, 219, 228, 0.78);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  font-weight: 700;
}

.sidebar-group {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(212, 219, 228, 0.74);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
  padding: 14px;
}

.sidebar-label {
  margin: 0 0 10px;
  color: #7b8798;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.token-field {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #566273;
}

.token-field input {
  width: 100%;
  height: 36px;
  border-radius: 12px;
  border: 1px solid #d7dde6;
  background: rgba(249, 250, 251, 0.9);
  padding: 0 12px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: #495566;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.nav-item:hover {
  background: rgba(226, 232, 240, 0.68);
}

.nav-item.active {
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  color: white;
  transform: translateX(2px);
  box-shadow: 0 12px 24px rgba(14, 165, 233, 0.22);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.sidebar-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(212, 219, 228, 0.74);
  font-size: 13px;
}

.sidebar-metric strong {
  font-size: 16px;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(10px);
}

.toolbar {
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(212, 219, 228, 0.78);
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(18px);
}

.tool-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #536072;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.tool-btn:hover {
  background: rgba(226, 232, 240, 0.76);
}

.tool-btn.accent {
  color: #0284c7;
}

.tool-btn.danger {
  color: #dc2626;
}

.tool-btn.disabled {
  color: #aab2bf;
  cursor: not-allowed;
  pointer-events: none;
}

.tool-divider {
  width: 1px;
  height: 26px;
  background: rgba(203, 213, 225, 0.9);
  margin: 0 4px;
}

.toolbar-meta {
  display: flex;
  gap: 8px;
  margin-left: 4px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(212, 219, 228, 0.74);
  color: #5c6978;
  font-size: 12px;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 220px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid #d7dde6;
  background: rgba(255, 255, 255, 0.82);
  padding: 0 12px 0 32px;
  font-size: 12px;
}

.table-container {
  flex: 1;
  overflow: auto;
  background: rgba(255, 255, 255, 0.52);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(248, 250, 252, 0.96);
  padding: 10px 12px;
  border-bottom: 1px solid #d8dee7;
  color: #667387;
  font-weight: 700;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f5;
  color: #2d3748;
  white-space: nowrap;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(240, 249, 255, 0.86);
}

.data-table tr.selected td {
  background: rgba(224, 242, 254, 0.92);
}

.mono-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
  font-size: 12px;
  color: #64748b;
}

.statusbar {
  height: 34px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  border-top: 1px solid rgba(212, 219, 228, 0.78);
  background: rgba(246, 248, 251, 0.78);
  color: #667387;
  font-size: 12px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, #f3f6fb, #ecf1f7);
  border-bottom: 1px solid #d8dee7;
  font-size: 14px;
  font-weight: 700;
  color: #485466;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #d8dee7;
  background: #f8fafc;
}

.form-line {
  display: grid;
  gap: 6px;
}

.form-line label {
  color: #566273;
  font-size: 13px;
  font-weight: 600;
}

.inline-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #566273;
  font-size: 13px;
}

.rule-layout {
  min-height: 0;
}

.rule-editor {
  width: 34%;
  min-width: 280px;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  background: #f8fafc;
  border-right: 1px solid #e5eaf1;
}

.rule-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rule-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
}

.empty-cell {
  padding: 40px 16px;
  text-align: center;
  color: #9aa5b3;
}

.spinner-inline {
  color: #0ea5e9;
  animation: spin 1s linear infinite;
}

.mobile-menu-btn {
  display: none;
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(15, 23, 42, 0.16);
}

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

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.65);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 960px) {
  .sidebar {
    position: absolute;
    height: 100%;
    transform: translateX(-100%);
  }

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

  .mobile-menu-btn {
    display: inline-flex;
  }

  .toolbar-meta {
    display: none;
  }

  .search-box input {
    width: 160px;
  }

  .rule-layout {
    flex-direction: column;
  }

  .rule-editor {
    width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid #e5eaf1;
  }
}
