:root {
  --bg: #081120;
  --panel: rgba(15, 23, 42, 0.82);
  --panel-soft: rgba(30, 41, 59, 0.72);
  --line: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #0ea5e9;
  --accent: #f59e0b;
  --danger: #ef4444;
  --success: #22c55e;
  --shadow: 0 20px 60px rgba(8, 15, 30, 0.45);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(245, 158, 11, 0.12), transparent 22%),
    linear-gradient(135deg, #020617, #0f172a 52%, #111827);
  color: var(--text);
  font-family: 'Noto Sans SC', sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select {
  font: inherit;
}

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

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  min-width: 260px;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  overflow-y: auto;
  align-self: flex-start;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 36px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #2563eb);
  font-weight: 700;
}

.brand h1, .hero h2, .page-header h2 {
  margin: 0;
  font-family: 'Noto Serif SC', serif;
}
.brand h1 {
  max-width: 150px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.brand p, .sidebar-footer p, .subtle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.nav-links {
  display: grid;
  gap: 10px;
}

.nav-links a, .logout-link {
  padding: 12px 14px;
  border-radius: 14px;
  color: #cbd5e1;
  transition: 0.2s ease;
}

.nav-links a:hover, .logout-link:hover, .nav-links a.active {
  background: rgba(14, 165, 233, 0.12);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.28);
}

.main-content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100vw - 260px);
  padding: 24px;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.flash {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}
.flash.success { border-color: rgba(34, 197, 94, 0.4); }
.flash.danger { border-color: rgba(239, 68, 68, 0.4); }
.flash.info, .flash.warning { border-color: rgba(14, 165, 233, 0.4); }

.login-page {
  min-height: 100vh;
}

.login-page .main-content {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-page .flash-stack {
  width: min(1120px, 100%);
  margin: 0 auto 16px;
}

.login-layout {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  gap: 42px;
  align-items: center;
}

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

.login-card {
  width: 100%;
  padding: 36px;
  border-radius: 28px;
}

.tech-visual {
  position: relative;
  min-height: 540px;
  overflow: visible;
  padding: 46px 10px 46px 0;
}

.tech-copy {
  position: relative;
  z-index: 2;
  max-width: 420px;
}
.tech-copy h2 {
  margin: 10px 0 12px;
  font-family: 'Noto Serif SC', serif;
  font-size: 42px;
  letter-spacing: 0.04em;
}
.tech-copy p { color: var(--muted); line-height: 1.8; }

.bar-field {
  position: absolute;
  left: 42px;
  right: 42px;
  bottom: 42px;
  height: 290px;
  display: flex;
  align-items: end;
  gap: 10px;
  transform: perspective(700px) rotateX(52deg) rotateZ(-5deg);
  transform-origin: bottom left;
}
.bar-field span {
  flex: 1;
  min-width: 7px;
  height: var(--h);
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.95), rgba(14, 165, 233, 0.18));
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.36);
  animation: techBar 1.8s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * -0.08s);
}

@keyframes techBar {
  from { transform: scaleY(0.55); opacity: 0.45; }
  to { transform: scaleY(1.18); opacity: 1; }
}

.hero {
  margin-bottom: 24px;
}

.hero p { color: var(--muted); line-height: 1.7; }

.form-grid {
  display: grid;
  gap: 16px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: #cbd5e1;
}

.field input, .field select {
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
}

.clearable-input {
  position: relative;
  display: block;
  width: 100%;
}

.clearable-input input {
  padding-right: 40px;
}

.clear-input-button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.18);
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  font-size: 18px;
  padding: 0;
}

.clear-input-button:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #fff;
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: rgba(14, 165, 233, 0.7);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.captcha-image {
  width: 150px;
  height: 52px;
  border-radius: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
  display: block;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, var(--primary), #2563eb);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(37, 99, 235, 0.28); }
.btn.secondary { background: rgba(30, 41, 59, 0.85); color: #e2e8f0; }
.btn.warn { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.btn.danger { background: linear-gradient(135deg, #ef4444, #b91c1c); }

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

.grid-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card, .panel {
  border-radius: 22px;
  padding: 18px;
}

.metric-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.72));
  border: 1px solid var(--line);
}
.metric-card strong {
  display: block;
  margin-top: 14px;
  font-size: 34px;
  font-family: 'Noto Serif SC', serif;
}

.filter-grid, .two-col {
  display: grid;
  gap: 16px;
}
.filter-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}
th, td {
  padding: 9px 5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  text-align: left;
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
th { color: #cbd5e1; }
tr:hover td { background: rgba(14, 165, 233, 0.05); }

.table-wrap td.actions {
  display: table-cell;
  white-space: nowrap;
  overflow: hidden;
}
.table-wrap td.actions .btn + .btn {
  margin-left: 3px;
}
.table-wrap .btn {
  padding: 5px 6px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.2;
}
.notification-list-table td.actions {
  white-space: normal;
}
.notification-list-table td.actions .btn {
  min-width: 34px;
  padding: 4px 5px;
  margin-bottom: 3px;
}
.notification-list-table td.actions .btn:nth-child(3) {
  margin-left: 0;
}
.table-wrap input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.badge {
  display: inline-flex;
  padding: 4px 6px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(14, 165, 233, 0.12);
  color: #bae6fd;
}
.badge.danger { background: rgba(239, 68, 68, 0.12); color: #fecaca; }
.badge.warn { background: rgba(245, 158, 11, 0.12); color: #fde68a; }

.pagination {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.chart-box {
  height: 320px;
}
.large-chart { height: clamp(245px, 30vh, 330px); }
.compact-header { margin-bottom: 12px; }
.report-panel { margin-bottom: 12px; padding: 14px 16px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  color: #e2e8f0;
  font-weight: 700;
}
.panel-head .btn { padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.ability-report-filter { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.ability-report-filter .field label { margin-bottom: 5px; font-size: 13px; }
.ability-report-filter .field input, .ability-report-filter .field select { padding: 9px 12px; border-radius: 12px; }
.filter-action-field { align-self: end; }

.copy-toast[hidden] { display: none; }
.copy-toast {
  position: fixed;
  right: 28px;
  top: 28px;
  z-index: 120;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(14, 165, 233, 0.45);
  color: #e2e8f0;
  box-shadow: var(--shadow);
}

@media (max-width: 1200px) {
  .filter-grid, .grid-cards, .two-col, .ability-report-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-layout { grid-template-columns: minmax(0, 1fr) 440px; gap: 28px; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; min-width: 0; height: auto; position: static; overflow-y: visible; }
  .main-content { max-width: none; padding: 18px; }
  .filter-grid, .grid-cards, .two-col, .captcha-row, .ability-report-filter { grid-template-columns: 1fr; }
  .page-header, .actions, .pagination { display: grid; }
  .login-page .main-content { padding: 18px; }
  .login-layout { grid-template-columns: 1fr; }
  .tech-visual { min-height: 260px; padding: 28px; }
  .tech-copy h2 { font-size: 30px; }
  .bar-field { left: 28px; right: 28px; bottom: 24px; height: 130px; gap: 6px; }
}

/* 弹窗 modal */
.modal-mask[hidden] { display: none; }
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
}
.modal-card {
  width: min(720px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 24px;
  padding: 24px;
  display: grid;
  gap: 18px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h3 { margin: 0; font-family: 'Noto Serif SC', serif; }
.modal-close {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.modal-close:hover { color: #fff; border-color: rgba(239, 68, 68, 0.6); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.modal-body.form-grid { gap: 16px; }

.field textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  resize: vertical;
  font: inherit;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}
.range-inputs input { flex: 1; min-width: 0; }

.quick-filters {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}
.settings-section {
  display: grid;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.settings-section h3 {
  margin: 0;
  font-family: 'Noto Serif SC', serif;
}
.favicon-setting {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: end;
}
.favicon-preview {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--line);
  padding: 6px;
}
.field textarea:focus {
  outline: none;
  border-color: rgba(14, 165, 233, 0.7);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
}

/* 详情表格 */
.api-docs pre {
  margin: 10px 0 14px;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  overflow: auto;
}
.api-docs pre code {
  font-family: 'Courier New', monospace;
  color: #dbeafe;
  line-height: 1.6;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  min-width: auto;
}
.detail-table th, .detail-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}
.detail-table th {
  width: 120px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.detail-table .raw-message {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  background: rgba(2, 6, 23, 0.5);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}
