* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f0f13;
  color: #e0e0e0;
  padding: 16px;
  font-size: 14px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1a1a24;
  border-radius: 8px;
  margin-bottom: 16px;
}

.header h1 {
  font-size: 18px;
  color: #fe2c55;
}

.header .meta {
  font-size: 12px;
  color: #888;
}

.header .status {
  font-size: 12px;
  color: #4ade80;
}

.script-link {
  font-size: 12px;
  color: #60a5fa;
  text-decoration: none;
  padding: 2px 8px;
  border: 1px solid #60a5fa;
  border-radius: 4px;
}

.script-link:hover {
  background: #60a5fa;
  color: #fff;
}

.stats {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: #1a1a24;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-card .label {
  font-size: 14px;
  color: #888;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 32px;
  font-weight: 700;
}

.stat-card .value.total {
  color: #60a5fa;
}

.stat-card .value.done {
  color: #4ade80;
}

.stat-card .value.pending {
  color: #facc15;
}

.stat-card .value.error {
  color: #f87171;
}

.stat-card .value.target {
  color: #a78bfa;
}

.stat-card .value.warn {
  color: #fb923c;
}

.stat-card .value.slate {
  color: #94a3b8;
}

.stat-card .value.teal {
  color: #2dd4bf;
}

.stat-card .value.rose {
  color: #f472b6;
}

.stat-card .value-sub {
  font-size: 12px;
  font-weight: 400;
  margin-top: 2px;
}

.stat-card.clickable {
  cursor: pointer;
}

.stat-card.clickable:hover {
  background: #25253a;
}

.stat-card.clickable.pending-card:hover {
  background: rgba(250, 204, 21, 0.15);
}

.stat-card.clickable.pending-card:hover,
.stat-card.clickable#statUserUpdateCard:hover {
  background: rgba(167, 139, 250, 0.15);
}

.active-clients-section {
  background: #1a1a24;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.active-clients-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.active-clients-bar .bar-label {
  font-size: 13px;
  color: #888;
  margin-right: 4px;
}

.active-clients-bar .client-badge {
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.active-clients-bar .client-badge .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.active-clients-bar .client-badge.active {
  background: #1a2e1a;
  color: #4ade80;
}

.active-clients-bar .client-badge.active:hover {
  background: #224422;
}

.active-clients-bar .client-badge.active .dot {
  background: #4ade80;
}

.active-clients-bar .client-badge.inactive {
  background: #252536;
  color: #64748b;
}

.active-clients-bar .client-badge.selected {
  outline: 2px solid #60a5fa;
}

.active-clients-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}

.active-clients-table th {
  text-align: left;
  color: #888;
  font-weight: 500;
  padding: 6px 12px;
  border-bottom: 1px solid #2a2a3a;
}

.active-clients-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #1e1e2e;
  color: #ccc;
}

.active-clients-table td.client-id {
  font-family: monospace;
  font-size: 12px;
  color: #60a5fa;
}

.active-clients-table td.ip-port {
  font-family: monospace;
  font-size: 12px;
  color: #facc15;
}

.active-clients-table td.user-id {
  font-family: monospace;
  font-size: 12px;
  color: #c084fc;
}

.active-clients-table td.last-seen {
  color: #94a3b8;
  font-size: 12px;
}

.active-clients-table tr:hover td {
  background: #1e1e2e;
}

.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.chart-box {
  background: #1a1a24;
  border-radius: 8px;
  padding: 16px;
}

.chart-box h3 {
  font-size: 14px;
  color: #888;
  margin-bottom: 12px;
}

.bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.bar-row .name {
  width: 50px;
  color: #ccc;
  flex-shrink: 0;
}

.bar-row .bar-bg {
  flex: 1;
  background: #2a2a3a;
  border-radius: 4px;
  height: 20px;
  overflow: hidden;
  margin: 0 8px;
}

.bar-row .bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
  display: flex;
  align-items: center;
  padding-left: 6px;
  font-size: 11px;
  color: #fff;
  white-space: nowrap;
}

.bar-row .target-badge {
  width: 60px;
  text-align: center;
  color: #4ade80;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
  margin: 0 6px;
}

.bar-row .count {
  width: 55px;
  text-align: right;
  color: #888;
  flex-shrink: 0;
}

.bar-row.is-target {
  background: rgba(167, 139, 250, 0.08);
  border-radius: 4px;
  padding: 2px 0;
}

.bar-row.is-target .name {
  color: #a78bfa;
  font-weight: 600;
}

.target-badge-other {
  color: #666 !important;
}

.source-row {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
}

.source-row .s-name {
  width: 80px;
  color: #ccc;
  flex-shrink: 0;
}

.source-row .s-val {
  color: #888;
}

.table-wrap {
  background: #1a1a24;
  border-radius: 8px;
  padding: 16px;
}

.table-wrap h3 {
  font-size: 14px;
  color: #888;
  margin-bottom: 12px;
}

.controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.controls input {
  flex: 1;
  min-width: 150px;
  padding: 6px 12px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0f0f13;
  color: #e0e0e0;
  font-size: 13px;
  outline: none;
}

.controls input:focus {
  border-color: #fe2c55;
}

.controls button {
  padding: 6px 14px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #2a2a3a;
  color: #ccc;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.controls button:hover {
  border-color: #fe2c55;
  color: #fff;
}

.controls button.active {
  background: #fe2c55;
  color: #fff;
  border-color: #fe2c55;
}

#targetReprocessBtn {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

#targetReprocessBtn:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.add-users {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.add-users button {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  background: #fe2c55;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.add-users button:hover {
  background: #e61944;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: #1a1a24;
  border-radius: 12px;
  padding: 24px;
  width: 520px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal h3 {
  font-size: 16px;
  color: #e0e0e0;
  margin-bottom: 6px;
}

.modal .hint {
  font-size: 12px;
  color: #888;
  margin-bottom: 16px;
}

.modal textarea {
  width: 100%;
  height: 180px;
  padding: 10px 14px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #0f0f13;
  color: #e0e0e0;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  line-height: 1.6;
}

.modal textarea:focus {
  border-color: #fe2c55;
}

.modal textarea::placeholder {
  color: #555;
}

.modal .preview {
  margin-top: 8px;
  font-size: 12px;
  color: #60a5fa;
  min-height: 20px;
}

.modal .btn-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

.modal .btn-row button {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.modal .btn-cancel {
  background: #2a2a3a;
  color: #ccc;
}

.modal .btn-cancel:hover {
  background: #333;
}

.modal .btn-submit {
  background: #fe2c55;
  color: #fff;
}

.modal .btn-submit:hover {
  background: #e61944;
}

.loc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.loc-option {
  padding: 10px 8px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #2a2a3a;
  color: #ccc;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.loc-option:hover {
  border-color: #fe2c55;
  background: rgba(254, 44, 85, 0.1);
  color: #fe2c55;
}

.loc-option.active {
  border-color: #fe2c55;
  background: rgba(254, 44, 85, 0.15);
  color: #fe2c55;
}

.location-cell {
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.location-cell:hover {
  background: rgba(254, 44, 85, 0.08);
  color: #fe2c55;
}

.location-cell.modified {
  color: #f59e0b !important;
  font-weight: 600 !important;
}

.location-cell.modified:hover {
  color: #fbbf24 !important;
  background: rgba(245, 158, 11, 0.1) !important;
}

.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 999;
  transition: opacity 0.3s;
}

.toast.success {
  background: #166534;
  color: #fff;
}

.toast.error {
  background: #991b1b;
  color: #fff;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.loading-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: #1a1a24;
  padding: 24px 36px;
  border-radius: 12px;
  border: 1px solid #2a2a3a;
}

.loading-spinner .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #2a2a3a;
  border-top-color: #fe2c55;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner .loading-text {
  color: #ccc;
  font-size: 14px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes flashChange {
  0% {
    filter: brightness(1.8);
    box-shadow: 0 0 12px rgba(254, 44, 85, 0.6);
  }

  100% {
    filter: brightness(1);
    box-shadow: none;
  }
}

.flash-change {
  animation: flashChange 0.6s ease-out;
}

@keyframes rowFlash {
  0% {
    background: rgba(254, 44, 85, 0.25);
  }

  100% {
    background: transparent;
  }
}

tr.row-flash {
  animation: rowFlash 0.8s ease-out;
}

@keyframes barFlash {
  0% {
    filter: brightness(1.6);
  }

  100% {
    filter: brightness(1);
  }
}

.bar-fill.bar-flash {
  animation: barFlash 0.5s ease-out;
}

.table-scroll {
  max-height: none;
  overflow-y: auto;
  height: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  position: sticky;
  top: 0;
  background: #22222e;
  padding: 8px 10px;
  text-align: left;
  color: #888;
  font-weight: 600;
  border-bottom: 1px solid #333;
  white-space: nowrap;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  color: #fe2c55;
}

th.sortable .sort-icon {
  font-size: 10px;
  opacity: 0.4;
  margin-left: 2px;
}

th.sortable.sort-asc .sort-icon {
  opacity: 1;
  color: #fe2c55;
}

th.sortable.sort-desc .sort-icon {
  opacity: 1;
  color: #fe2c55;
}

th.sortable-target {
  cursor: pointer;
  user-select: none;
}

th.sortable-target:hover {
  color: #fe2c55;
}

th.sortable-target .sort-icon {
  font-size: 10px;
  opacity: 0.4;
  margin-left: 2px;
}

th.sortable-target.sort-asc .sort-icon {
  opacity: 1;
  color: #fe2c55;
}

th.sortable-target.sort-desc .sort-icon {
  opacity: 1;
  color: #fe2c55;
}

td {
  padding: 6px 10px;
  border-bottom: 1px solid #1f1f2a;
  white-space: nowrap;
}

tr:hover {
  background: #1f1f2a;
}

td.user-id {
  cursor: pointer;
  color: #60a5fa;
}

td.user-id:hover {
  color: #fe2c55;
}

.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
}

.tag.seller {
  background: #dc2626;
  color: #fff;
}

.tag.verified {
  background: #2563eb;
  color: #fff;
}

.tag.pending {
  background: #ca8a04;
  color: #000;
}

.tag.processing {
  background: #0ea5e9;
  color: #fff;
}

.tag.error {
  background: #991b1b;
  color: #fff;
}

.tag.unknown-country {
  background: #4b5563;
  color: #fff;
}

#pendingPage {
  display: none;
}

#pendingPage.active {
  display: block;
}

#userUpdatePage {
  display: none;
}

#userUpdatePage.active {
  display: block;
}

#rawPage {
  display: none;
}

#rawPage.active {
  display: block;
}

#targetPage {
  display: none;
}

#targetPage.active {
  display: block;
}

#backToTop {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(254, 44, 85, 0.85);
  color: #fff;
  font-size: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(254, 44, 85, 0.35);
  transition: opacity 0.25s, transform 0.25s, background 0.2s;
  user-select: none;
}

#backToTop:hover {
  background: #e61944;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(254, 44, 85, 0.5);
}

#backToTop.visible {
  display: flex;
}

#backToTop.dragging {
  transition: none;
  opacity: 0.9;
  cursor: grabbing;
}

#mainPage.hidden {
  display: none;
}

.pending-country-card {
  background: #1a1a24;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.pending-country-card h3 {
  font-size: 16px;
  color: #facc15;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pending-country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.pending-country-item {
  background: #2a2a3a;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  position: relative;
}

.country-action-btns {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
}

.country-action-btn {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 999px;
  background: rgba(127, 29, 29, 0.45);
  color: #fca5a5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.country-action-btn:hover {
  background: rgba(153, 27, 27, 0.85);
  color: #fff;
  border-color: rgba(248, 113, 113, 0.8);
}

.country-action-btn.restore {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(20, 83, 45, 0.45);
  color: #86efac;
}

.country-action-btn.restore:hover {
  background: rgba(22, 101, 52, 0.9);
  border-color: rgba(74, 222, 128, 0.8);
  color: #fff;
}

.raw-page-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

.raw-side-card {
  background: #1a1a24;
  border-radius: 8px;
  padding: 16px;
}

.raw-side-card h3 {
  font-size: 14px;
  color: #f59e0b;
  margin-bottom: 12px;
}

.raw-table-card {
  background: #1a1a24;
  border-radius: 8px;
  padding: 16px;
}

.raw-table-card h3 {
  font-size: 14px;
  color: #888;
  margin-bottom: 12px;
}

.muted-tip {
  font-size: 12px;
  color: #777;
  margin-top: 8px;
  line-height: 1.5;
}

.pending-country-item:hover {
  border-color: #facc15;
  background: #33334a;
}

.pending-country-item .country-name {
  font-size: 18px;
  font-weight: 700;
  color: #facc15;
  margin-bottom: 4px;
}

.pending-country-item .country-count {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

.pending-country-item .country-label {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.pending-country-item.has-target {
  border-color: #a78bfa;
}

.pending-country-item.has-target .country-name {
  color: #a78bfa;
}

.pending-country-item.selected {
  background: #7c3aed;
  border-color: #a78bfa;
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.6);
}

.pending-country-item.selected .country-name {
  color: #fff;
  font-weight: 700;
}

.pending-country-item.selected .country-count {
  color: #fff;
}

.pending-country-item.selected .country-label {
  color: #ddd6fe;
}

.other-country-item {
  border-color: #f59e0b;
}

.other-country-item .country-name {
  color: #f59e0b;
}

.other-country-item:hover {
  border-color: #fbbf24;
  background: #3a3520;
}

.back-btn {
  padding: 6px 14px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #2a2a3a;
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.back-btn:hover {
  border-color: #fe2c55;
  color: #fff;
}

.tag.processed {
  background: #166534;
  color: #fff;
}

.tag.no-video {
  background: #7c3aed;
  color: #fff;
}

.tag.no-follow {
  background: #b45309;
  color: #fff;
}

.tag.keep-follow {
  background: #059669;
  color: #fff;
}

.tag.pinned {
  background: #f59e0b;
  color: #000;
}

.context-menu {
  position: fixed;
  background: #1e1e2e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 0;
  min-width: 140px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

.context-menu-item {
  padding: 8px 16px;
  font-size: 13px;
  color: #ccc;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-menu-item:hover {
  background: #fe2c55;
  color: #fff;
}

.context-menu-item.danger {
  color: #f87171;
}

.context-menu-item.danger:hover {
  background: #991b1b;
  color: #fff;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #1a1a24;
}

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

.client-errors-section {
  margin-bottom: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.section-header h3 {
  font-size: 14px;
  color: #e0e0e0;
}

.error-badge {
  background: #991b1b;
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.client-errors-table {
  width: 100%;
  border-collapse: collapse;
  background: #1a1a24;
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}

.client-errors-table thead tr {
  background: #22222e;
}

.client-errors-table th {
  padding: 10px 12px;
  text-align: left;
  color: #888;
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid #2a2a3a;
}

.client-errors-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #1f1f2e;
}

.client-errors-table tbody tr:last-child td {
  border-bottom: none;
}

.client-errors-table tbody tr:hover {
  background: #22222e;
}

.error-type-captcha {
  color: #f59e0b;
}

.error-type-network {
  color: #f87171;
}

.error-type-other {
  color: #a78bfa;
}

.target-country-group {
  background: #1a1a24;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.target-country-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #2a2a3a;
}

.target-country-header .country-flag {
  font-size: 20px;
  font-weight: 700;
  color: #a78bfa;
}

.target-country-header .country-user-count {
  font-size: 13px;
  color: #888;
  background: #2a2a3a;
  padding: 2px 10px;
  border-radius: 10px;
}

.target-page-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: 1fr;
  gap: 16px;
  min-height: calc(100vh - 280px);
  align-items: stretch;
}

.target-side-card {
  background: #1a1a24;
  border-radius: 8px;
  padding: 16px;
}

.target-side-card h3 {
  font-size: 14px;
  color: #a78bfa;
  margin-bottom: 12px;
}

.target-table-card {
  background: #1a1a24;
  border-radius: 8px;
  padding: 16px;
}

.target-table-card h3 {
  font-size: 14px;
  color: #888;
  margin-bottom: 12px;
}

@media (max-width: 768px) {
  body {
    padding: 8px;
  }

  .header {
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }

  .header h1 {
    font-size: 16px;
  }

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

  .stat-card {
    padding: 10px;
  }

  .stat-card .label {
    font-size: 11px;
  }

  .stat-card .value {
    font-size: 18px;
  }

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

  .raw-page-layout {
    grid-template-columns: 1fr;
  }

  .target-page-layout {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    padding: 10px;
  }

  .controls {
    flex-wrap: wrap;
    gap: 6px;
  }

  .controls input {
    flex: 0 0 100%;
    width: 100%;
  }

  .controls button {
    flex: 0 0 calc(33.33% - 4px);
    min-width: 0;
    text-align: center;
    white-space: nowrap;
    font-size: 11px;
    padding: 8px 4px;
  }

  #batchResetBtn {
    flex: 0 0 100% !important;
    font-size: 12px !important;
    padding: 8px 12px !important;
  }

  .controls select {
    flex: 0 0 100%;
    width: 100%;
  }

  .table-scroll {
    max-height: none;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    background: #22222e;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid #2a2a3a;
  }

  tr:hover {
    background: #2a2a3a;
  }

  td {
    padding: 4px 0;
    border: none;
    text-align: left;
    position: relative;
    padding-left: 40%;
    font-size: 13px;
  }

  td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 36%;
    text-align: right;
    color: #888;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }

  td.user-id {
    font-size: 15px;
    font-weight: 700;
    color: #60a5fa;
    padding-left: 0;
    border-bottom: 1px solid #2a2a3a;
    margin-bottom: 4px;
    padding-bottom: 6px;
  }

  td.user-id::before {
    display: none;
  }

  td.user-id:hover {
    color: #fe2c55;
  }

  .add-users {
    justify-content: center;
  }

  .modal {
    width: 95vw;
    padding: 16px;
  }

  .modal textarea {
    height: 140px;
  }
}

/* 自定义国家输入行 */
.custom-loc-row {
  margin-top: 12px;
}

.custom-loc-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0f0f13;
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  text-transform: uppercase;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.custom-loc-input:focus {
  border-color: #a78bfa;
}

.custom-loc-input::placeholder {
  color: #555;
  font-weight: 400;
  text-transform: none;
}

/* 非商家按钮 */
.btn-non-seller {
  padding: 4px 10px;
  border: 1px solid #f87171;
  border-radius: 4px;
  background: transparent;
  color: #f87171;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-non-seller:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: #ef4444;
  color: #ef4444;
}

/* 待确认按钮 */
.btn-pending {
  padding: 4px 10px;
  border: 1px solid #fbbf24;
  border-radius: 4px;
  background: transparent;
  color: #fbbf24;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-pending:hover {
  background: rgba(251, 191, 36, 0.12);
  border-color: #f59e0b;
  color: #f59e0b;
}

/* ===== 关键词页面 ===== */
#tagsPage {
  display: none;
  padding-bottom: 40px;
}

#tagsPage.active {
  display: block;
}

.tags-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tags-table-card {
  background: #1c1c26;
  border-radius: 10px;
  padding: 16px;
}

.tags-table-card h3 {
  font-size: 14px;
  color: #e0e0e0;
  margin-bottom: 12px;
}

#tagsPage .controls {
  margin-bottom: 12px;
}

#tagsPage .controls button {
  padding: 5px 10px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #2a2a3a;
  color: #ccc;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

#tagsPage .controls button.active {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}

#tagsPage .controls button:hover:not(.active) {
  border-color: #7c3aed;
  color: #a78bfa;
}

#tagsTable td {
  font-size: 12px;
}

#tagsTable td:nth-child(3),
#tagsTable td:nth-child(4),
#tagsTable td:nth-child(5),
#tagsTable td:nth-child(6),
#tagsTable td:nth-child(7) {
  font-family: monospace;
  text-align: right;
  color: #9ca3af;
}

.form-row {
  margin-top: 12px;
}

.form-row label {
  display: block;
  margin-bottom: 4px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #0f0f13;
  color: #ccc;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.checkbox-label:hover {
  border-color: #a78bfa;
}

.checkbox-label input[type="checkbox"] {
  accent-color: #a78bfa;
}

/* ========== 烟花开关 ========== */
.firework-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 16px;
  user-select: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.firework-toggle:hover {
  opacity: 1;
}
.firework-toggle input[type="checkbox"] {
  accent-color: #fe2c55;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ========== 烟花画布 ========== */
#fireworkCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ========== LLM 设置页 ========== */
#settingsPage {
  display: none;
}

#settingsPage.active {
  display: block;
}

.settings-card {
  background: #1a1a24;
  border-radius: 12px;
  padding: 28px;
  max-width: 560px;
  margin: 0 auto;
}

.settings-card h3 {
  font-size: 17px;
  color: #e0e0e0;
  margin-bottom: 6px;
}

.settings-hint {
  font-size: 12px;
  color: #888;
  margin-bottom: 24px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-field label {
  display: block;
  font-size: 13px;
  color: #aaa;
  margin-bottom: 6px;
  font-weight: 600;
}

.settings-field input,
.settings-field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #0f0f13;
  color: #e0e0e0;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.settings-field input:focus,
.settings-field select:focus {
  border-color: #fe2c55;
}

.settings-field input[readonly] {
  color: #888;
  cursor: default;
}

.settings-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.settings-key-row {
  display: flex;
  gap: 6px;
}

.settings-key-row input {
  flex: 1;
}

.settings-key-row button {
  padding: 8px 12px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #2a2a3a;
  color: #ccc;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.settings-key-row button:hover {
  background: #333;
}

.settings-note {
  display: block;
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

.settings-status {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

.settings-status.ok {
  background: rgba(74, 222, 128, 0.1);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.settings-status.error {
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.settings-status.loading {
  background: rgba(250, 204, 21, 0.1);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.2);
}

.settings-form .btn-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.settings-form .btn-submit {
  padding: 10px 28px;
  border: none;
  border-radius: 8px;
  background: #fe2c55;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.settings-form .btn-submit:hover {
  background: #e61944;
}

/* ── 看门狗页面 ── */

#watchdogPage {
  display: none;
}

#watchdogPage.active {
  display: block;
}

.watchdog-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.watchdog-clients,
.watchdog-commands {
  background: #1a1a24;
  border-radius: 12px;
  padding: 20px;
}

.watchdog-clients h3,
.watchdog-commands h3 {
  font-size: 15px;
  color: #e0e0e0;
  margin-bottom: 12px;
}

.watchdog-clients table th,
.watchdog-commands table th {
  font-size: 11px;
  color: #888;
  font-weight: 600;
}
