.base-page .base-main {
  padding: 24px var(--hg-page-gutter) 64px;
  max-width: 1800px;
  margin: 0 auto;
}

.base-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.base-toolbar__lead {
  flex: 0 0 440px;
  width: 440px;
  max-width: 100%;
  min-width: 0;
}

.base-toolbar h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
}

#base-summary {
  margin: 0;
  min-height: calc(1.45em * 3);
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  word-break: break-word;
}

.base-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

#base-catalog-refresh.is-loading,
#base-catalog-refresh:disabled {
  opacity: 0.75;
  cursor: wait;
}

.base-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--color-muted);
}

.base-filters select,
.base-filters input {
  min-width: 160px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-panel);
  color: var(--color-text);
}

.base-search input {
  min-width: 240px;
}

.base-include-ts {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-muted);
  user-select: none;
}

.base-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  margin-bottom: 8px;
}

.base-pager[hidden] {
  display: none;
}

.base-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.base-catalog__card {
  position: relative;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--hg-radius);
  padding: 12px 36px 12px 14px;
  font-size: 13px;
}

.base-catalog__card-sync {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg, rgba(255, 255, 255, 0.06));
  color: var(--color-text);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.base-catalog__card-sync:hover:not(:disabled) {
  border-color: rgba(70, 160, 100, 0.55);
  background: rgba(34, 120, 70, 0.12);
}

.base-catalog__card-sync:disabled,
.base-catalog__card-sync.is-loading {
  opacity: 0.55;
  cursor: wait;
}

.hg-btn--sm {
  padding: 6px 10px;
  font-size: 12px;
}

.base-catalog__card-cover,
.base-catalog__card-collect {
  display: block;
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1a4d3a;
  background: #e8f5ef;
  border: 1px solid #b8dcc8;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}

.base-catalog__card-cover:hover:not(:disabled),
.base-catalog__card-collect:hover:not(:disabled) {
  background: #d4eddf;
}

.base-catalog__card-cover:disabled,
.base-catalog__card-collect:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.base-catalog__card-collect {
  color: #1a3d5c;
  background: #e8f0f8;
  border-color: #b8cce0;
}

.base-catalog__card-collect:hover:not(:disabled) {
  background: #d4e4f4;
}

.base-catalog__card-wipe {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #8b3030;
  background: rgba(180, 60, 60, 0.12);
  border: 1px solid rgba(180, 60, 60, 0.35);
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}

.base-catalog__card-wipe:hover:not(:disabled) {
  background: rgba(180, 60, 60, 0.22);
}

.base-catalog__card-wipe:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.base-catalog__card-prune {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b4a1a;
  background: rgba(200, 140, 40, 0.12);
  border: 1px solid rgba(200, 140, 40, 0.35);
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}

.base-catalog__card-prune:hover:not(:disabled) {
  background: rgba(200, 140, 40, 0.22);
}

.base-catalog__card-prune:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.base-prune-dialog__list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  max-height: min(50vh, 420px);
  overflow: auto;
  font-size: 12px;
  line-height: 1.45;
}

.base-prune-dialog__list li {
  margin-bottom: 4px;
  word-break: break-word;
}

.base-prune-dialog__foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.base-prune-dialog__delete {
  color: #fff !important;
  background: #a83232 !important;
}

.base-wipe-dialog__warn {
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #e8a0a0;
  background: rgba(140, 40, 40, 0.15);
  border: 1px solid rgba(140, 40, 40, 0.35);
  border-radius: 8px;
}

.base-wipe-dialog__warn code {
  font-size: 11px;
}

.base-wipe-dialog__submit {
  color: #fff !important;
  background: #a83232 !important;
}

.base-wipe-dialog__foot {
  justify-content: flex-end;
}

.base-collect-dialog__body {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.base-collect-dialog__scope {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.base-collect-dialog__frida-note {
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #e8c878;
  background: rgba(200, 140, 40, 0.12);
  border: 1px solid rgba(200, 140, 40, 0.35);
  border-radius: 8px;
}

.base-collect-dialog__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--color-muted);
}

.base-collect-dialog__field input[type="number"] {
  max-width: 120px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-panel-2);
  color: var(--color-text);
}

.base-collect-dialog__proxy {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  user-select: none;
}

.base-collect-dialog__locales {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.base-collect-dialog__locales legend {
  padding: 0 6px;
  font-size: 12px;
  color: var(--color-muted);
}

.base-collect-dialog__locale-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.base-collect-dialog__locale-actions .hg-btn {
  min-height: 0;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  gap: 4px;
}

.base-collect-dialog__locale-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  max-height: 160px;
  overflow: auto;
}

.base-collect-dialog__locale-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  user-select: none;
}

.base-collect-dialog__foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

.base-catalog__card--synced {
  background: rgba(34, 120, 70, 0.18);
  border-color: rgba(70, 160, 100, 0.35);
}

.base-catalog__card strong {
  display: block;
  margin-bottom: 4px;
}

.base-catalog__card .hg-muted {
  font-size: 12px;
  line-height: 1.45;
}

.base-table-wrap {
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--hg-radius);
  background: var(--color-panel);
}

.base-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.base-table th,
.base-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #222;
  text-align: left;
  vertical-align: top;
  white-space: normal;
}

.base-table th {
  position: sticky;
  top: 0;
  background: #161616;
  color: var(--color-muted);
  font-weight: 600;
  z-index: 1;
}

.base-table tbody tr:hover {
  background: rgba(255, 210, 28, 0.04);
}

.base-table a.base-title-link {
  font-weight: 600;
}

.base-table a.base-title-link--ok {
  color: #5ddea0;
}

.base-table a.base-title-link--empty {
  color: #ff6b6b;
}

.base-table a.base-title-link--warn {
  color: var(--color-primary);
}

.base-brand-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  white-space: nowrap;
}

.base-brand-tag--huangguo {
  background: #c47a00;
}

.base-brand-tag--rellshort {
  background: #0d8a7a;
}

.base-brand-tag--shortmax {
  background: #2563eb;
}

.base-brand-tag--flickreels {
  background: #c0265a;
}

.base-brand-tag--dramabox {
  background: #6d28d9;
}

.base-brand-tag--melolo {
  background: #15803d;
}

.base-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--color-border);
  text-align: center;
}

.base-pill--ok {
  color: #7dffa3;
  border-color: #2f6b45;
}

.base-pill--bad {
  color: #ff8f8f;
  border-color: #6b2f2f;
}

.base-pill--danger {
  color: #ffb4b4;
  border-color: #8b3030;
  background: rgba(120, 30, 30, 0.25);
}

.base-pill--warn {
  color: #ffd21c;
  border-color: #6b5a1e;
}

.base-reason {
  max-width: 280px;
  color: var(--color-muted);
  line-height: 1.4;
}

.base-reason__tags {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 6px;
}

.base-missing {
  font-weight: 600;
}

.base-missing--bad {
  color: #ff6b6b;
}

.base-missing--ok {
  color: #5ddea0;
}

.base-sync-rate {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.base-sync-rate--ok {
  color: #5ddea0;
}

.base-sync-rate--empty {
  color: #ff6b6b;
}

.base-sync-rate--mid {
  color: #f2f2f2;
}

.base-time--today {
  color: #5ddea0;
  font-weight: 600;
}

.base-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: stretch;
}

.base-error-btn,
.base-metadata-btn,
.base-delete-btn {
  cursor: pointer;
  border: none;
  font: inherit;
}

.base-delete-btn:hover:not(:disabled) {
  filter: brightness(1.12);
}

.base-delete-btn:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.base-metadata-btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.base-metadata-btn:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.base-sync-btn {
  cursor: pointer;
  font: inherit;
  background: transparent;
  appearance: none;
}

.base-error-btn:hover,
.base-sync-btn:hover:not(:disabled) {
  filter: brightness(1.15);
}

.base-sync-btn:disabled {
  cursor: wait;
  opacity: 0.85;
}

.base-pill--sync {
  color: #8ec8ff;
  border-color: #2f4f6b;
}

.base-pill--fill {
  color: #ffc978;
  border-color: #6b4f2f;
  cursor: pointer;
  background: transparent;
}

.base-error-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: min(80vh, 720px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--hg-radius);
  background: var(--color-panel);
  color: var(--color-text);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.base-error-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.base-error-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--color-border);
}

.base-error-dialog__actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  align-items: center;
}

.base-error-dialog__actions form {
  margin: 0;
}

.base-error-dialog__head h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.base-error-dialog__head .hg-muted {
  margin: 0;
  font-size: 12px;
  word-break: break-all;
}

.base-error-dialog__body {
  margin: 0;
  padding: 14px 18px 18px;
  max-height: min(60vh, 560px);
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e8e8e8;
}

@media (max-width: 720px) {
  .base-filters {
    width: 100%;
  }

  .base-filters select,
  .base-filters input,
  .base-search input {
    min-width: 0;
    width: 100%;
  }
}
