:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e2e6ee;
  --text: #1f2733;
  --muted: #6b7686;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --au: #0ea5e9;
  --us: #10b981;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.app__header h1 {
  margin: 0 0 4px;
  font-size: 24px;
}
.app__subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ---- Loader ---- */
.loader {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.loader__input {
  flex: 1 1 280px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.loader__input--small {
  flex: 0 1 180px;
}
.loader__input:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

/* ---- Buttons ---- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s,
    opacity 0.15s;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--primary);
  color: #fff;
}
.btn--primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn__spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading .btn__spinner {
  display: inline-block;
}

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

/* ---- Status ---- */
.status {
  margin: 14px 2px 0;
  font-size: 14px;
  min-height: 20px;
}
.status--error {
  color: var(--danger);
}
.status--ok {
  color: #059669;
}
.status--info {
  color: var(--muted);
}

/* ---- Toolbar ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 10px;
}
.toolbar__search {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.toolbar__search:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}
.toolbar__count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

/* ---- List ---- */
.list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.list__head,
.row {
  display: grid;
  grid-template-columns: 180px 90px 150px 1fr 90px 90px 200px 170px;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
}
.list__head {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  position: sticky;
  top: 0;
  z-index: 1;
}
.list__body {
  max-height: 60vh;
  overflow-y: auto;
}
.row {
  border-bottom: 1px solid #f1f4f9;
  font-size: 14px;
}
.row:hover {
  background: #f9fbff;
}
.cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell--title {
  white-space: normal;
}
.cell--num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.cell--model {
  font-weight: 600;
}

.cell--actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.action-btns {
  display: flex;
  gap: 6px;
}
.listed-links {
  display: flex;
  flex-direction: row;
  gap: 6px;
}
.listed-link {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 5px;
  text-align: center;
}
.listed-link--au {
  color: var(--au);
  background: rgba(14, 165, 233, 0.12);
}
.listed-link--us {
  color: #059669;
  background: rgba(16, 185, 129, 0.12);
}
.listed-link[href]:hover {
  text-decoration: underline;
}
.btn--au {
  background: var(--au);
  color: #fff;
  padding: 7px 12px;
  font-size: 13px;
  flex: 1;
}
.btn--us {
  background: var(--us);
  color: #fff;
  padding: 7px 12px;
  font-size: 13px;
  flex: 1;
}
.btn--au:hover:not(:disabled) {
  filter: brightness(0.93);
}
.btn--us:hover:not(:disabled) {
  filter: brightness(0.93);
}
.btn--row.is-loading .btn__label {
  opacity: 0;
}
.btn--row .btn__spinner {
  border-color: rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  position: absolute;
}

/* Input chỉnh sửa ngay trong dòng */
.cell-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
.cell-input:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}
.cell-input--num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cell-input--area {
  resize: vertical;
  min-height: 38px;
  line-height: 1.35;
}
.cell-select {
  cursor: pointer;
  background: #fff;
}

/* Nút dạng link (anchor) — khi đã có link sản phẩm eBay */
.btn--link {
  text-decoration: none;
}

.row.is-busy {
  opacity: 0.7;
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 760px) {
  .list__head {
    display: none;
  }
  .row {
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
  }
  .cell--title {
    grid-column: 1 / -1;
    font-weight: 600;
  }
  .cell--actions {
    grid-column: 1 / -1;
  }
}

.textCenter {
  text-align: center;
}
