* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #f4f7fb 0%, #eef2f8 100%);
  color: #102033;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.page-catalog {
  max-width: 100%;
  padding-left: 16px;
  padding-right: 16px;
}

.page-nav {
  display: inline-flex;
  gap: 10px;
  margin-bottom: 18px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.page-nav-link {
  padding: 10px 16px;
  border-radius: 999px;
  color: #516174;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.page-nav-link.active {
  background: #1d4ed8;
  color: #fff;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px 32px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.22), transparent 38%),
    linear-gradient(135deg, #0f172a, #17345f 55%, #1e40af);
  color: #fff;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.18);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.18em;
  opacity: 0.72;
}

.hero h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.subtitle {
  max-width: 760px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.65;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
}

.meta-card,
.stat-card,
.panel {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.meta-card {
  padding: 16px 18px;
  color: #102033;
}

.meta-label,
.stat-label {
  display: block;
  margin-bottom: 8px;
  color: #5f6b7a;
  font-size: 13px;
}

.meta-card strong,
.stat-card strong {
  font-size: 22px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.stat-card {
  padding: 18px 20px;
}

.stat-foot {
  margin-top: 10px;
  color: #64748b;
  font-size: 13px;
}

.panel {
  margin-top: 18px;
  padding: 20px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 22px;
}

.panel-head p {
  margin: 6px 0 0;
  color: #607086;
}

.search-input {
  width: 320px;
  max-width: 100%;
  padding: 12px 14px;
  border: 1px solid #d5deea;
  border-radius: 12px;
  background: #f9fbff;
  font-size: 14px;
}

.admin-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.admin-key-input {
  width: 200px;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: #2451c2;
  font-size: 13px;
  font-weight: 700;
}

.admin-status.admin-on {
  background: #dcfce7;
  color: #166534;
}

.admin-message {
  color: #5b6b7d;
  font-size: 14px;
}

.action-btn {
  border: 0;
  border-radius: 12px;
  background: #1d4ed8;
  color: #fff;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.action-btn-secondary {
  background: #e2e8f0;
  color: #1e293b;
}

.admin-alerts {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.admin-alert-card {
  border: 1px solid #fed7aa;
  border-radius: 14px;
  background: #fff7ed;
  padding: 14px 16px;
}

.admin-alert-title {
  font-weight: 700;
}

.admin-alert-meta {
  margin-top: 6px;
  color: #7c2d12;
  font-size: 13px;
}

.admin-threshold-cell {
  min-width: 170px;
}

.threshold-editor {
  display: flex;
  gap: 8px;
  align-items: center;
}

.threshold-editor-compact {
  align-items: stretch;
  min-width: 152px;
}

.threshold-input {
  width: 90px;
  padding: 8px 10px;
  border: 1px solid #d5deea;
  border-radius: 10px;
  background: #f9fbff;
}

.threshold-hint {
  margin-top: 6px;
  color: #738295;
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
}

.page-catalog .table-wrap {
  overflow: visible;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1060px;
}

.catalog-table {
  min-width: 0;
  table-layout: fixed;
}

.catalog-table th,
.catalog-table td {
  padding: 9px 6px;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.catalog-table th {
  vertical-align: bottom;
}

.catalog-table .sort-btn {
  width: 100%;
  justify-content: space-between;
  align-items: flex-end;
  white-space: normal;
  text-align: left;
}

.catalog-table .link-btn {
  white-space: nowrap;
}

.catalog-table .cell-stack {
  gap: 2px;
}

.catalog-table .threshold-input {
  width: 72px;
}

.catalog-table .action-btn {
  padding: 8px 10px;
  font-size: 12px;
}

th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: top;
}

th {
  color: #5f6b7a;
  font-size: 13px;
  font-weight: 600;
  background: #fbfdff;
  position: sticky;
  top: 0;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.sort-btn:hover {
  color: #1d4ed8;
}

.sort-btn.is-active {
  color: #1d4ed8;
}

.sort-indicator {
  display: inline-block;
  min-width: 10px;
  color: #1d4ed8;
}

.cell-stack {
  display: grid;
  gap: 4px;
}

.cell-strong {
  font-weight: 700;
}

.status-note {
  color: #b45309;
  font-size: 12px;
}

.row-dim td {
  color: #7a8797;
}

.price {
  font-weight: 700;
  color: #b91c1c;
}

.muted {
  color: #738295;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2451c2;
  font-size: 12px;
  font-weight: 600;
}

.events-list {
  display: grid;
  gap: 12px;
}

.event-item {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #edf2f7;
  border-radius: 14px;
  background: #fbfdff;
}

.event-type {
  min-width: 88px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #2451c2;
}

.event-body {
  flex: 1;
}

.event-title {
  font-weight: 700;
}

.event-message {
  margin-top: 4px;
  color: #43546a;
}

.event-time {
  margin-top: 6px;
  color: #7a8797;
  font-size: 12px;
}

.empty {
  padding: 22px;
  text-align: center;
  color: #6b7a8e;
}

a.link-btn {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 960px) {
  .hero {
    flex-direction: column;
  }

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

@media (max-width: 640px) {
  .page {
    padding: 18px 14px 28px;
  }

  .hero {
    padding: 22px 18px;
    border-radius: 18px;
  }

  .hero h1 {
    font-size: 28px;
  }

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

  .panel {
    padding: 16px;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    width: 100%;
  }
}
