:root {
  color-scheme: light;
  --ink: #17211e;
  --muted: #69736f;
  --line: #dde2dd;
  --paper: #ffffff;
  --canvas: #f5f4ef;
  --green: #27624c;
  --green-soft: #e6f0eb;
  --orange: #b75d2b;
  --orange-soft: #faece2;
  --red: #a3403d;
  --red-soft: #f8e8e6;
  --blue: #315c83;
  --blue-soft: #e7eef5;
  --shadow: 0 18px 45px rgba(24, 38, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(rgba(39, 98, 76, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(39, 98, 76, 0.035) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(23, 33, 30, 0.1);
  background: rgba(250, 250, 247, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0.04em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar-actions,
.live-status {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 18px;
}

.live-status {
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.live-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3c9b6d;
  box-shadow: 0 0 0 4px rgba(60, 155, 109, 0.13);
}

.refresh-button,
.filters button,
.primary-button {
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
  font-weight: 700;
}

.refresh-button {
  padding: 10px 14px;
}

.refresh-button:hover,
.filters button:hover,
.primary-button:hover {
  background: var(--green);
}

main {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.19em;
}

h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.intro-copy {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.updated-at {
  min-width: 150px;
  text-align: right;
}

.updated-at span,
.updated-at strong {
  display: block;
}

.updated-at span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.updated-at strong {
  margin-top: 5px;
  font-size: 13px;
}

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

.summary-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 104px;
  padding: 22px;
  border: 1px solid rgba(23, 33, 30, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(24, 38, 32, 0.04);
}

.summary-icon {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  font-weight: 800;
}

.orders-icon {
  color: var(--green);
  background: var(--green-soft);
}

.users-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.accounts-icon {
  color: var(--orange);
  background: var(--orange-soft);
}

.assignments-icon {
  color: var(--red);
  background: var(--red-soft);
}

.summary-card span,
.summary-card strong {
  display: block;
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
}

.summary-card strong {
  margin-top: 3px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.workspace {
  overflow: hidden;
  border: 1px solid rgba(23, 33, 30, 0.1);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #f8f8f5;
}

.tab {
  padding: 11px 16px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
}

.tab span {
  display: inline-grid;
  min-width: 24px;
  height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  background: rgba(23, 33, 30, 0.08);
  font-size: 11px;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  color: #fff;
  background: var(--ink);
}

.tab.is-active span {
  background: rgba(255, 255, 255, 0.16);
}

.data-panel {
  padding: 24px;
}

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

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
}

.panel-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.filters input,
.filters select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  background: #fff;
}

.filters input:focus,
.filters select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(39, 98, 76, 0.1);
}

.filters select {
  padding: 0 34px 0 12px;
}

.filters button {
  height: 40px;
  padding: 0 16px;
}

.search-field {
  position: relative;
}

.search-field span {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-field input {
  width: min(260px, 30vw);
  padding: 0 12px 0 34px;
}

.country-input {
  width: 72px;
  padding: 0 10px;
  text-transform: uppercase;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

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

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid #e9ece8;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #707975;
  background: #fafaf8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfcfa;
}

.primary-cell strong,
.primary-cell small {
  display: block;
}

.primary-cell strong {
  font-size: 13px;
}

.primary-cell small,
.subtle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.status-cell .tag,
.status-cell .subtle {
  display: flex;
  width: fit-content;
}

.mono {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.tag::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.tag-active,
.tag-enabled,
.tag-valid,
.tag-success {
  color: var(--green);
  background: var(--green-soft);
}

.tag-filled {
  color: var(--blue);
  background: var(--blue-soft);
}

.tag-unavailable,
.tag-failed,
.tag-timeout {
  color: var(--red);
  background: var(--red-soft);
}

.tag-cancelled,
.tag-disabled,
.tag-pending {
  color: #747b78;
  background: #eceeec;
}

.error-note {
  display: block;
  max-width: 280px;
  margin-top: 6px;
  overflow: hidden;
  color: var(--red);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.countries {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.country-chip {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafaf8;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
}

.social-counts {
  display: flex;
  gap: 16px;
  white-space: nowrap;
}

.social-counts span,
.social-counts small,
.social-counts strong {
  display: block;
}

.social-counts small {
  color: var(--muted);
  font-size: 9px;
}

.social-counts strong {
  margin-top: 2px;
  font-size: 12px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  white-space: nowrap;
}

.progress-meta strong {
  font-size: 12px;
}

.progress-meta span {
  color: var(--muted);
  font-size: 11px;
}

.progress-track {
  width: 150px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ebe7;
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination button,
.pagination select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.pagination button {
  min-width: 34px;
  padding: 0 10px;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--green);
  color: var(--green);
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.pagination select {
  padding: 0 28px 0 9px;
}

.page-number {
  min-width: 64px;
  color: var(--ink);
  text-align: center;
  font-weight: 700;
}

.row-action,
.secondary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.row-action {
  padding: 7px 10px;
  white-space: nowrap;
}

.row-action:hover,
.secondary-button:hover {
  border-color: var(--green);
  color: var(--green);
}

.sync-dialog {
  width: min(680px, calc(100% - 32px));
  max-height: min(760px, calc(100vh - 40px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(23, 33, 30, 0.28);
}

.sync-dialog::backdrop {
  background: rgba(23, 33, 30, 0.45);
  backdrop-filter: blur(4px);
}

.sync-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.sync-dialog-heading h2,
.sync-dialog-heading p {
  margin: 0;
}

.sync-dialog-heading h2 {
  font-size: 20px;
}

.sync-dialog-heading p:not(.eyebrow) {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: #f0f2ef;
  font-size: 22px;
}

.sync-search {
  display: block;
  padding: 18px 24px 0;
}

.sync-search input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.sync-search input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(39, 98, 76, 0.1);
}

.sync-status {
  min-height: 36px;
  padding: 12px 24px 8px;
  color: var(--muted);
  font-size: 12px;
}

.sync-group-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 390px;
  padding: 0 24px 18px;
  overflow-y: auto;
}

.sync-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafaf8;
  cursor: pointer;
}

.sync-group:has(input:checked) {
  border-color: var(--green);
  background: var(--green-soft);
}

.sync-group input {
  accent-color: var(--green);
}

.sync-group span,
.sync-group strong,
.sync-group small {
  display: block;
  min-width: 0;
}

.sync-group strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-group small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.sync-empty {
  grid-column: 1 / -1;
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
}

.sync-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: #fafaf8;
}

.sync-dialog-actions > span {
  color: var(--muted);
  font-size: 12px;
}

.sync-dialog-actions > div {
  display: flex;
  gap: 8px;
}

.secondary-button,
.primary-button {
  min-height: 38px;
  padding: 0 14px;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.error-banner {
  margin: 20px 24px 0;
  padding: 12px 14px;
  border: 1px solid #efc7c3;
  border-radius: 10px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 13px;
}

.is-loading tbody {
  opacity: 0.45;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .filters {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .search-field {
    flex: 1 1 220px;
  }

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

@media (max-width: 720px) {
  .topbar {
    padding: 12px 16px;
  }

  .live-status {
    display: none;
  }

  .refresh-button {
    padding: 9px 11px;
    font-size: 12px;
  }

  main {
    width: min(100% - 24px, 1480px);
    padding-top: 30px;
  }

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

  .updated-at {
    text-align: left;
  }

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

  .summary-card {
    min-height: 82px;
    padding: 16px;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    flex: 0 0 auto;
  }

  .data-panel {
    padding: 16px;
  }

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

  .filters input,
  .filters select,
  .filters button,
  .country-input {
    width: 100%;
  }

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

  .sync-group-list {
    grid-template-columns: 1fr;
  }

  .sync-dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
