@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  --bg: #071013;
  --panel: rgba(13, 25, 28, 0.78);
  --panel-strong: rgba(17, 34, 38, 0.92);
  --line: rgba(189, 240, 226, 0.16);
  --text: #ecfff9;
  --muted: #95aaa5;
  --accent: #35f2b7;
  --accent-2: #ffcc66;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 10%, rgba(53, 242, 183, 0.18), transparent 30%),
    radial-gradient(circle at 82% 16%, rgba(255, 204, 102, 0.12), transparent 24%),
    linear-gradient(145deg, #071013 0%, #0b1817 48%, #10110f 100%);
  font-family: "Space Grotesk", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

.mono {
  font-family: "JetBrains Mono", Consolas, monospace;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(4, 13, 15, 0.72);
  backdrop-filter: blur(18px);
  padding: 24px 16px;
}

.brand {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
}

.nav-group {
  margin: 20px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.nav-link {
  width: fit-content;
  min-width: 132px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
}

.nav-link:hover,
.nav-link.active {
  border-color: rgba(53, 242, 183, 0.32);
  background: rgba(53, 242, 183, 0.1);
  box-shadow: 0 0 24px rgba(53, 242, 183, 0.08);
}

.main {
  padding: 24px;
  min-width: 0;
}

.topbar,
.panel,
.modal-box {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.topbar {
  min-height: 68px;
  border-radius: 8px;
  margin-left: -24px;
  margin-right: -24px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
}

.panel {
  border-radius: 8px;
  margin-left: -24px;
  margin-right: -24px;
  padding: 16px;
  animation: fade-in 0.28s ease-out;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar-split {
  justify-content: space-between;
  align-items: flex-start;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.toolbar-reset-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.toolbar-total {
  flex: 0 0 auto;
}

.toolbar-actions {
  justify-content: flex-end;
  margin-left: auto;
}

.filter-select {
  width: 138px;
}

.browser-filter-input {
  width: 104px;
}

.search-input {
  width: clamp(160px, 20vw, 220px);
  flex: 0 1 220px;
}

.input,
.select,
.textarea {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.18);
  padding: 8px 10px;
  outline: none;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 130px;
  padding-right: 34px;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0.2);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%),
    linear-gradient(to right, rgba(189, 240, 226, 0.14), rgba(189, 240, 226, 0.14));
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%,
    calc(100% - 32px) 50%;
  background-size:
    5px 5px,
    5px 5px,
    1px 18px;
  background-repeat: no-repeat;
}

.select:hover {
  border-color: rgba(53, 242, 183, 0.42);
  background-color: rgba(53, 242, 183, 0.08);
}

.select option {
  color: var(--text);
  background: #102126;
}

.textarea {
  min-height: 80px;
  resize: vertical;
}

.cookie-textarea {
  min-height: 76px;
  overflow-x: auto;
  white-space: pre;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(53, 242, 183, 0.65);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  color: rgba(149, 170, 165, 0.68);
  background: rgba(255, 255, 255, 0.035);
  cursor: not-allowed;
  opacity: 0.72;
}

.btn {
  min-height: 38px;
  border: 1px solid rgba(53, 242, 183, 0.35);
  border-radius: 8px;
  color: var(--text);
  background: rgba(53, 242, 183, 0.12);
  padding: 8px 12px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 22px rgba(53, 242, 183, 0.16);
  background: rgba(53, 242, 183, 0.18);
}

.btn:disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.52;
}

.btn.secondary {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.btn.warn {
  border-color: rgba(255, 204, 102, 0.45);
  background: rgba(255, 204, 102, 0.12);
}

.btn.danger {
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.12);
}

.table-wrap {
  width: 100%;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  white-space: nowrap;
}

tr:hover td {
  background: rgba(53, 242, 183, 0.045);
}

.select-cell {
  padding-left: 6px;
  padding-right: 4px;
  text-align: center;
}

.row-check {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin: 0;
  border: 1px solid rgba(189, 240, 226, 0.28);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
  vertical-align: middle;
}

.row-check:hover {
  border-color: rgba(53, 242, 183, 0.55);
  background: rgba(53, 242, 183, 0.08);
}

.row-check:checked {
  border-color: rgba(53, 242, 183, 0.85);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.2 6.2 4.8 8.8 9.9 3.5' fill='none' stroke='%23071013' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 11px 11px;
}

.row-check:focus-visible {
  outline: 2px solid rgba(53, 242, 183, 0.35);
  outline-offset: 2px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  color: var(--text);
  font-size: 13px;
}

.pagination-jump-label {
  color: var(--muted);
  white-space: nowrap;
}

.pagination-size {
  width: 112px;
  min-width: 112px;
  min-height: 32px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.page-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.page-btn:hover:not(:disabled),
.page-btn.active {
  border-color: rgba(53, 242, 183, 0.55);
  background: rgba(53, 242, 183, 0.18);
  color: var(--accent);
}

.page-btn:disabled {
  color: rgba(149, 170, 165, 0.42);
  background: rgba(255, 255, 255, 0.025);
  cursor: not-allowed;
}

.pagination-jump {
  width: 56px;
  min-height: 32px;
  padding: 5px 8px;
  text-align: center;
}

.cell-ellipsis {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-single,
.stacked-cell {
  width: 100%;
  min-height: 40px;
  display: flex;
  justify-content: flex-start;
  text-align: left;
}

.cell-single {
  align-items: center;
}

.stacked-cell {
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
  justify-content: center;
}

.stacked-cell-line {
  min-height: 18px;
  line-height: 18px;
}

.cell-nowrap {
  text-overflow: clip;
}

.quick-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.quick-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  padding: 0;
  cursor: pointer;
  line-height: 20px;
}

.quick-icon:hover {
  border-color: rgba(53, 242, 183, 0.45);
  background: rgba(53, 242, 183, 0.12);
}

.quick-icon.danger:hover {
  border-color: rgba(255, 107, 107, 0.55);
  background: rgba(255, 107, 107, 0.14);
}

.quick-editor {
  position: fixed;
  z-index: 30;
  width: 260px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.quick-editor label {
  color: var(--muted);
  font-size: 12px;
}

.quick-editor .textarea {
  min-height: 96px;
}

.quick-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-center {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 50;
  transform: translate(-50%, -50%);
  min-width: 180px;
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid rgba(53, 242, 183, 0.45);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-strong);
  padding: 14px 18px;
  text-align: center;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.38);
}

.actions-cell {
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

button.badge {
  cursor: pointer;
}

button.badge:hover {
  border-color: rgba(53, 242, 183, 0.45);
  background: rgba(53, 242, 183, 0.1);
}

.badge.ready,
.badge.success,
.badge.开启 {
  color: var(--accent);
}

.badge.failed,
.badge.error,
.badge.关闭 {
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.48);
  z-index: 20;
}

.modal-box {
  width: min(980px, 100%);
  max-height: 88vh;
  overflow: auto;
  border-radius: 8px;
  padding: 18px;
  animation: pop-in 0.18s ease-out;
}

.modal-header {
  position: sticky;
  top: -18px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -18px -18px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 16px 18px;
}

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

.form-sections {
  display: grid;
  gap: 14px;
}

.form-section {
  border: 1px solid rgba(189, 240, 226, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 14px;
}

.form-section-title {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 12px;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  padding-left: 10px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 12px;
}

.field.disabled label {
  opacity: 0.72;
}

.required-star,
.required-suffix {
  color: var(--danger);
}

.required-star {
  margin-right: 3px;
  font-weight: 700;
}

.modal-box .field .textarea {
  min-height: 38px;
  height: 38px;
}

.modal-footer {
  position: sticky;
  bottom: -18px;
  z-index: 2;
  margin: 16px -18px -18px;
  border-top: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 14px 18px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-box {
  width: min(420px, 100%);
  border-radius: 8px;
  padding: 28px;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

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

  .modal-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal-actions {
    width: 100%;
  }

  .modal-actions .btn {
    flex: 1 1 120px;
  }

  .pagination-bar {
    justify-content: flex-start;
  }
}
